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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
f90c657c06ea2531ebedeb876dc61be1ec0efcf7 | Python | GodamSwapna/list-Question | /kbc.py | UTF-8 | 1,528 | 3.5 | 4 | [] | no_license | print("well come to KBC program")
q=[
"How many continents are there?", # pehla question
"What is the capital of India?", # doosra question
"NG mei kaun se course padhaya jaata hai?" # teesra question
]
o=[
#pehle question ke liye options
["Four", "Nine", "Seven", "Eight"... | true |
3b61bb2ee62c4ae387ee5a14f92465f37a0c0269 | Python | NeoLinkin/py | /regular.py | UTF-8 | 695 | 3.25 | 3 | [] | no_license | #!/usr/bin/env python
import re
def myMatch():
t = "16:01:00"
m = re.match(r'^(0[0-9]|1[0-9]|2[0-3]|[0-9])\:(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|[0-9])\:(0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9]|[0-9])$', t)
print(m.group(0))
print(m.group(1))
l = re.split(r'\s+','a b c d... | true |
d8e34fe4947956ed65f0f7f49b86e5274278d57c | Python | izquierdo/kr | /code/pybayes/Examples/dog.py | UTF-8 | 5,897 | 2.9375 | 3 | [] | no_license | #!/usr/bin/python
# The dog problem example
# Copyright 2008 Denis Maua'
from pybayes.Models.bn import *
from pybayes.IO.pyparsing import Word, alphas, OneOrMore, Optional, Suppress, Group
def run():
"Run this example"
caps = "ABCDEFGHIJKLMNOPQRSTUVWXYZ _"
lowers = caps.lower()
digits = "0123456789"
empty = "."
... | true |
67fd52d8815c46f098e235dc8f79872b155e41ed | Python | Nailin96/NetworkedLife | /linearRegression.py | UTF-8 | 3,471 | 2.90625 | 3 | [
"MIT"
] | permissive | import numpy as np
import projectLib as lib
# shape is movie,user,rating
training = lib.getTrainingData()
validation = lib.getValidationData()
#some useful stats
trStats = lib.getUsefulStats(training)
vlStats = lib.getUsefulStats(validation)
rBar = np.mean(trStats["ratings"])
# we get the A matrix from the training ... | true |
ec9bb1665d2a69baf41d40f7aa61333fa7eb46e1 | Python | NAMYUNWOO/ProblemSolving | /5주차/exercise1-2.py | UTF-8 | 939 | 3.4375 | 3 | [] | no_license | def lcs_with_string(s1, s2):
mat = [[0]*(len(s2)+1) for x in range(len(s1)+1)]
for i in range(1, len(s1)+1):
for j in range(1, len(s2)+1):
if s1[i-1] == s2[j-1]:
mat[i][j] = mat[i-1][j-1] + 1
else:
mat[i][j] = max(mat[i-1][j], mat[i][j-1])
... | true |
bf98a9930785cdf0af2e7d8d51fa4bd6c1eb34db | Python | anshulkamath/manim_projects | /Test Files/cob_test.py | UTF-8 | 17,326 | 2.84375 | 3 | [] | no_license | from manimlib.imports import *
def align_with(mob1, mob2, vertical=True):
'''
Will align the y component of the center of mob1 with mob2 by moving mob1 or mob2 horizontally
'''
mob1_center = mob1.get_center()
mob2_center = mob2.get_center()
if vertical:
mob1.shift((mob2_center[0] - mob1... | true |
89a39a1065b11737fd9f1750c9d66fca154c090a | Python | yuchen-he/algorithm016 | /leetcode/editor/cn/[39]组合总和.py | UTF-8 | 1,631 | 3.25 | 3 | [] | no_license | # 给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合。
#
# candidates 中的数字可以无限制重复被选取。
#
# 说明:
#
#
# 所有数字(包括 target)都是正整数。
# 解集不能包含重复的组合。
#
#
# 示例 1:
#
# 输入:candidates = [2,3,6,7], target = 7,
# 所求解集为:
# [
# [7],
# [2,2,3]
# ]
#
#
# 示例 2:
#
# 输入:candidates = [2,3,5]... | true |
9709679fccc5dc89e6d46ed42ff2a50c73877b1c | Python | OzerBerkay/PygameBerkayOzer | /venv/Include/ScoreBoard.py | UTF-8 | 980 | 3.3125 | 3 | [] | no_license | import pygame
class ScoreBoard:
score=0
@staticmethod
def init_ScoreBoard(rectangle=pygame.rect.Rect(0,20,200,50),textSize=40,textColor=(235,247,9)):
ScoreBoard.textSize=textSize
ScoreBoard.textColor=textColor
ScoreBoard.rectangle=rectangle
@staticmethod
def set_Score(scor... | true |
390cfa892525970df917f65233d2bebaa2faa9ee | Python | kelvin2016/Enterprises | /slack_bot/slack_bot.py | UTF-8 | 5,443 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
from slackclient import SlackClient
import time, json, sys, re, os
import RPi.GPIO as GPIO
token=os.environ.get('SLACK_TOKEN')
command_prefix=":botface"
TRIG_PORT=27
sc=SlackClient(token)
# Test API
res=sc.api_call("api.test")
sys.stdout.write("Test:\n")
sys.stdout.write(str(res)+"\n")
sys.st... | true |
9f3e9678dc7ee32ad24c5578c9514e0ac433964d | Python | stalavitski/s4u-test-assignment | /src/transfer/tests.py | UTF-8 | 912 | 2.78125 | 3 | [] | no_license | from django.test import TestCase
from account.models import Account
from customer.models import Customer
from transfer.models import Transfer
class TransferTest(TestCase):
def setUp(self):
super(TransferTest, self).setUp()
customer = Customer.objects.create(
email='test@test.invalid'... | true |
49dfaa2966fee24942cd8004a9f3a9aa4b58fc44 | Python | owlgit/miniP1 | /mini1/getPosLink.py | UTF-8 | 5,262 | 2.90625 | 3 | [] | no_license | ### Get correct atom position for linkage
import numpy as np
### Get positions of the atoms
def getPos(pFile):
fName = pFile
open(fName, 'r')
# get cell size - assume cubic
str1 = ' '.join(file(fName).readlines()[2:5])
cellSize = np.fromstring(str1, sep=' ')
cellSize.shape = (3,3)
xlat = cellSiz... | true |
f022fc2f2dbdc58df691b8a532b2434813cd9f60 | Python | mattlubner/powerline-shell | /segments/datetime.py | UTF-8 | 494 | 2.796875 | 3 | [
"MIT"
] | permissive | import datetime
def add_datetime_segment():
try:
fg = Color.DATETIME_FG
except AttributeError:
fg = Color.USERNAME_FG
try:
bg = Color.DATETIME_BG
except AttributeError:
bg = Color.USERNAME_BG
datetime_segment = ' %s %s '
datetime_char = u'\u25F7'
datetime_ti... | true |
6a0a488a698f0626118d2129a621e0a452116b60 | Python | shubhamkumar0/large_log_time_extractor | /script.py | UTF-8 | 2,894 | 2.953125 | 3 | [] | no_license | import csv
import re
import datetime
import os
#globals
datesCheck=[]
idxCheck=[]
def divideFile(inputpath, bucket_size):
smallfile = None
with open(inputpath) as bigfile:
for lineno, line in enumerate(bigfile):
if lineno % bucket_size == 0:
if smallfile:
... | true |
97643cc43cc92595dea888ee0532d81e32ac6c36 | Python | AngryBird3/gotta_code | /take_home_test/wiki/indexing1.py | UTF-8 | 1,870 | 3.34375 | 3 | [] | no_license | #!/user/bin/env python
'''
Created on Dec 12, 2015
@author: DHARA
'''
import os, re
class indexing1:
'''
data_dir_path: Directory path where data resides
index_path: type string: File path to store word/freq
catalog_path: type string: File path to store where word resides in index.txt
read_order: type list of cha... | true |
ebc7ea2042a24eb999a02a436b5fd02e165d39c5 | Python | flaviasalisboa/coursera-python-usp-parte1 | /Exercicios-Opcionais/sem2-digitodezenas.py | UTF-8 | 148 | 3.5625 | 4 | [] | no_license | numero = int(input("Digite um número inteiro: "))
restopor100 = numero % 100
digito = restopor100 // 10
print("O dígito das dezenas é",digito)
| true |
d66f132c87e53057e080eb03136bed7f1dcdf946 | Python | muad-dweeb/utilites | /python/simple_counter.py | UTF-8 | 1,723 | 3.375 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Original attempt
Saving in case I can figure it out later
"""
# class Clicker(object):
# def __init__(self):
# self.count = 0
#
# def click(self):
# self.count += 1
# if self.count > 0:
# print(self.count, end='\r', )
#... | true |
f704b532a4d45ed7dd979a60e77574c2a6936fab | Python | JariMutikainen/pyExercise | /oop/bank.py | UTF-8 | 1,324 | 4.875 | 5 | [] | no_license | # The first exercise of Object Oriented Programming. Create a bank account.
# Make it possible to deposit money into it and to withdraw money from it.
class BankAccount:
def __init__(self, owner):
self.owner = owner
self.balance = 0.0
def deposit(self, money_to_add):
m = money_to_add
... | true |
3811a08484248a7fed2b94f07dd424ae035206b8 | Python | ruben-fuertes/rosalind | /corr.py | UTF-8 | 778 | 2.65625 | 3 | [] | no_license | from sys import argv
from functools import reduce
file = open(argv[1])
seqs = []
seq = ''
for line in file:
if line.startswith('>'):
if seq != '': seqs.append(seq)
seq = ''
else: seq+=line.rstrip()
seqs.append(seq)
seqsrev = list(map(lambda x: {x, x.replace('A', 't').replace('T', 'a').replace('C','g').replace('G'... | true |
abd1f56a24ff3b76170434600429c94bb9e45f81 | Python | robinsonegbo/Zuri-ATM-Task-2 | /ATM_Task_2.py | UTF-8 | 2,396 | 3.515625 | 4 | [] | no_license | import random
import deposit_withdrawals_class
database ={}
def generateNewAccount():
return random.randrange(1111111111,9999999999)
def register():
print("Register")
email = input("Enter email address? \n")
first_name = input("Enter first name? \n")
last_name = input("Enter las... | true |
78042ffbd21c5c08cd7c699dcb0fd4db770502a7 | Python | jshufro/slask | /limbo/plugins/cw_old/crossword_image.py | UTF-8 | 3,014 | 3.046875 | 3 | [
"MIT"
] | permissive | import os
from tempfile import mkstemp
from PIL import Image, ImageDraw, ImageFont
MODE = 'RGB'
WHITE = 'rgb(255,255,255)'
LIGHT_GREY = 'rgb(175,175,175)'
BOX_SIZE = 50
Y_TEXT_OFFSET = -2
NUMBER_OFFSET = 4
ANSWER_OFFSET = 13
FILE_PATH = os.path.dirname(os.path.realpath(__file__))
class CrosswordImage(object):
d... | true |
344829791b92f423724e66028d4b3bed793b70be | Python | ribeiro-jenny/FinalProjectVS | /multiagent/multiAgents.py | UTF-8 | 15,967 | 3.46875 | 3 | [] | no_license | # multiAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.e... | true |
b76e01510e2083c3815d9862cebe575d62ea6d62 | Python | juanibutter/Curso_2 | /#17 - Excepciones II.py | UTF-8 | 1,379 | 4.5 | 4 | [] | no_license | print("""
*********************
*** Excepciones I ***
*********************\n
""")
print("Primera parte de excepciones:\n")
def suma(numuno, numdos):
return numuno+numdos
def resta(numuno, numdos):
return numuno-numdos
def multiplica(numuno, numdos):
return numuno*numdos
def divide(numuno, numdos):
t... | true |
b6cc0f883a24a7a1607cb84eb520cad5753b0784 | Python | readygo67/securify2 | /tests/grammar/test_grammar_transform.py | UTF-8 | 1,443 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from securify.grammar.attributes.evaluators import DemandDrivenRecursive
from tests.grammar.grammars import arithmetic
from tests.grammar.grammars.arithmetic import *
class GrammarTransformTest(unittest.TestCase):
grammar = AttributeGrammar.from_modules(arithmetic, rule_extractor=Parser())
d... | true |
c6ecad7c9bc715608d3d6bc8a4637b1614f45874 | Python | LeBron-Jian/BasicAlgorithmPractice | /剑指offer/PythonVersion/62_圆圈中最后剩下的数字.py | UTF-8 | 2,799 | 4.09375 | 4 | [] | no_license | #_*_coding:utf-8_*_
'''
题目:
剑指offer 62 圆圈中最后剩下的数字
0,1,....n-1这 n 个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字
(删除后从下一个数字开始计数),求出这个圆圈里剩下的最后一个数字。
例如0,1,2,3,4 这5个数字组成一个圆圈,从数字0开始每次删除第3个数字,则删除的前4个
数字依次是2, 0, 4, 1,因此最后剩下的数字是3。
示例 1:
输入: n = 5, m = 3
输出: 3
示例 2:
输入: n = 10, m = 17
输出: 2
限制:
... | true |
8f9cb586ff786c69bb75a961911f4464eea1f570 | Python | Vineel-Mallepalli/Projects | /Mathematical_Cryptography/elliptic_curves/double_and_add_algorithm.py | UTF-8 | 168 | 3.15625 | 3 | [] | no_license |
def double_and_add(p, n):
q = p
r = (0, 1, 0)
while n > 0:
if n % 2 == 1:
r = r + q
q = 2 * q
n = n // 2
return r
| true |
6c092613e10e2557c16a6c4521ac1c33b7a22317 | Python | BloomBabe/ResNet-PyTorch | /resnet.py | UTF-8 | 6,723 | 2.578125 | 3 | [] | no_license | import torch
import torch.nn as nn
def conv3x3(input_channels, output_channels, stride = 1,
groups = 1, dilation = 1):
return nn.Conv2d(input_channels, output_channels, kernel_size=3, stride=stride,
padding=dilation, groups=groups, bias=False, dilation=dilation)
def conv1x1(input... | true |
72cda698f8dd65afc61818f3e1d7a38532961ce7 | Python | wuyongzheng/aia-list | /gen-js.py | UTF-8 | 1,420 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
import sys
titles = ['S/N', 'REGION', 'AREA', 'CLINIC NAME', 'ADDRESS', 'TEL',\
'WEEKDAYS', 'WEEKDAYS (EVENING)', 'SATURDAY', 'SUNDAY', 'PUBLIC HOLIDAY',\
'REMARKS']
NF = len(titles)
def load_clinics(filename):
clinics = []
for line in open(filename).read().splitlines():
if line.startswith('P... | true |
76f5401c9a09246acffb93ada1ffca598727ef5a | Python | IBM-Security/ibmsecurity | /ibmsecurity/isam/base/system_alerts/email.py | UTF-8 | 4,748 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import logging
import ibmsecurity.utilities.tools
logger = logging.getLogger(__name__)
def get_all(isamAppliance, check_mode=False, force=False):
"""
Get all email objects
"""
return isamAppliance.invoke_get("Get all email objects",
"/core/rsp_email_objs")
def ge... | true |
4ffe7a809745e8c85a1cb41e23f9613b9f93b8a0 | Python | ohshige15/AtCoder | /ABC094/B.py | UTF-8 | 209 | 2.515625 | 3 | [] | no_license | N, M, X = map(int, input().split())
A = list(map(int, input().split()))
left = [1 if i in A else 0 for i in range(1, X)]
right = [1 if i in A else 0 for i in range(X + 1, N)]
print(min(sum(left), sum(right)))
| true |
c6c5ec1afa5313776042ad11bb2289a48ad2f9df | Python | qllwx/script | /删除空目录.py | UTF-8 | 641 | 3.4375 | 3 | [] | no_license | doc='''
删除当前目录下所有空目录
Usage:
python delete_blank.py
Example:
python delete_blank
'''
from pathlib import Path
from tqdm import tqdm
def unlink_blank():
result=[f for f in Path('.').glob('**/*') if f.is_dir() ]
del_res=[]
for d in tqdm(result):
try:
d.rmdir()
... | true |
7b8b30f1995204939eb74cfca141ec45598a3e47 | Python | jack2150/rivers0.2 | /position/classes/stage/spread/leg_two/vertical/long_call_vertical/tests.py | UTF-8 | 8,235 | 2.609375 | 3 | [] | no_license | from position.classes.stage.tests import TestUnitSetUpStage
from long_call_vertical import StageLongCallVertical
from position.classes.tests import create_filled_order
from position.models import PositionStage
from tos_import.statement.statement_trade.models import FilledOrder
class TestStageLongCallVertical(TestUnit... | true |
a6d4fb5e46e76151e3c14e6acd0c5af304e7a5d5 | Python | BradenM/pydngconverter | /pydngconverter/dngconverter.py | UTF-8 | 4,318 | 2.53125 | 3 | [
"MIT"
] | permissive | """PyDNGConverter interface bridges for Adobe DNG Converter."""
from typing import List, Iterator, Optional
from pathlib import Path
from dataclasses import field, dataclass
from pydngconverter.flags import CRawCompat, DNGVersion, Compression, JPEGPreview, LossyCompression
@dataclass
class DNGParameters:
"""Ado... | true |
b8b4898bb4b1c5694834c23a119c0ee75cad8d7f | Python | ZaneSeos/piper | /piper-http/littlehttpserver/utils/env.py | UTF-8 | 1,861 | 2.625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import logging
import re
import tempfile
import os
from os.path import abspath, basename, isdir, join as pathjoin
_RE_DOCS_BUILD_DIR = re.compile(r"""
(docs?/)?(en/|ja/)?(_?build/)?(sphinx/)?(html/?)?
""", re.U | re.X)
def get_package_name(path):
"""
>>> get_package_name("/path/to... | true |
e4f2225c79e3b442ba603fead96b93161b706aa8 | Python | FrancisDcruz/ML_Algorithms | /Adaptive_Stepsize_Gradient_Descent/least_squares_adaptive_eta.py | UTF-8 | 3,123 | 2.78125 | 3 | [] | no_license | import sys
import random
import math
eta_list = [1,.1,.01,.001,.0001,.00001,.000001,.0000001,.00000001,.000000001,.0000000001,.00000000001]
theta = 0.001
#loading test data file
input_file = sys.argv[1]
features = []
for line in open(input_file):
line = line.rstrip()
test_data = line.split(" ")
aa = []
... | true |
3044f154875908bfd37bd10b95c7d9eb21e9faa8 | Python | wuxu1019/leetcode_sophia | /medium/dfsbfs/test_127_Word_Ladder.py | UTF-8 | 4,208 | 3.609375 | 4 | [] | no_license | """
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
Only one letter can be changed at a time.
Each transformed word must exist in the word list. Note that beginWord is not a transformed word.
Note:
Return ... | true |
8e0770751e94361623df42124c7416efe4ea6478 | Python | jyx13/comet-dnn-jyx | /modules/comet_dnn_eval.py | UTF-8 | 5,880 | 2.515625 | 3 | [] | no_license | # These scripts are based on the example of TensorFlow CIFAR-10
# They use the Apache lisence. We will use the same.
# http://www.apache.org/licenses/LICENSE-2.0
# ==============================================================================
# TODO get this file working
"""Evaluation for comet_dnn.
Accuracy:
S... | true |
90fe39ae6df58e93d6ad80f88c8914f1af70579a | Python | sungkyu-kim/wifi_presence | /keras_anomaly_detection/library/plot_utils.py | UTF-8 | 7,320 | 2.578125 | 3 | [] | no_license | from matplotlib import pyplot as plt
import seaborn as sns
from sklearn.metrics import confusion_matrix
import pandas as pd
LABELS = ["False", "Hit"]
#https://matplotlib.org/examples/color/named_colors.html
cmap_list = ['magenta', 'darkred', 'coral', 'tomato', 'firebrick', 'orangered', 'brown', 'darkviolet', 'peru']
... | true |
19588eb94a822fe178fd189eb14676d48bbed9d5 | Python | BoHyeonPark/test1 | /059_1.py | UTF-8 | 580 | 3.328125 | 3 | [] | no_license | #!/usr/bin/python3
'''
seq = ""
with open("059.fasta",'r') as fr:
for line in fr:
if line.startswith(">"):
pass
else:
seq += line.strip()
print(len(seq))
'''
def fastaToString(f):
seq = ""
with open(f,'r') as fr:
for line in fr:
if line.startswith(... | true |
766c82be4afa1d74fdc5e92bce1447c815a89d69 | Python | sabboud1/SylsPythonProjects | /Syl's first Python list exercise.py | UTF-8 | 360 | 2.9375 | 3 | [] | no_license | job_applicants=["John","Geoff","Brady","Thomas"]
heights=[61,70,67,64,65]
ints_and_strings=[1,2,3,'four','five']
empty_list=[]
print(job_applicants[0])
print(job_applicants[1])
john_skills=['Python','Communication','LowSalary Requewst',10000]
print(john_skills)
applicants=[['John','Python'],['Geoff','Doesnt know pytho... | true |
593d0805ac129ffdee7b4d48564ea3e41332128d | Python | ldeecke/gmm-torch | /test.py | UTF-8 | 6,880 | 2.828125 | 3 | [
"MIT"
] | permissive | import numpy as np
import sklearn.mixture
import torch
from gmm import GaussianMixture
import unittest
class CpuCheck(unittest.TestCase):
"""
Basic tests for CPU.
"""
def testPredictClasses(self):
"""
Assert that torch.FloatTensor is handled correctly.
"""
x = torch.r... | true |
b5d2de686fa6d2fe1ff8cd2104689aaba027de14 | Python | Narasimhareddy26/smart-glesses | /infos_api/news_engine.py | UTF-8 | 1,796 | 2.921875 | 3 | [
"MIT"
] | permissive | import bs4 as bs
import urllib.request
import re
class NewsEngine:
def __init__(self):
self.source = urllib.request.urlopen('https://edition.cnn.com/articles/').read()
self.base_url = "https://edition.cnn.com"
self.article_titles = []
self.article_links = []
def get_latest_a... | true |
158906dc520fa9f4782a80ed31dbf33d57c17a13 | Python | tmittal/Version_working | /PyMagmaCh_Single/input_functions.py | UTF-8 | 13,202 | 2.59375 | 3 | [] | no_license | '''input_functions.py
A collection of function definitions to handle common
calcualtions (i.e. constants and melting curve, density parameterizations)
'''
import pdb
import numpy as np
import constants as const
import warnings
class append_me:
def __init__(self):
self.data = np.empty((100,))
self... | true |
50cb4c163fc222e1f3b33cf9ab80e185647b42db | Python | jfxugithub/python | /debug.py | UTF-8 | 534 | 3.34375 | 3 | [] | no_license | """
断言:
asset 判断条件,提示信息
如果不满足判断条件就会报错
"""
import logging
import pdb
def get_num(nu):
assert nu != 0, 'nu 不能等于0'
return 10 / nu
# get_num(0)
print("=" * 30)
"""
logging
"""
logging.basicConfig(level=logging.INFO)
for i in range(10):
logging.info(i)
print("=" * 30)
"""
pdb:python 自带模块
"""
d... | true |
14c24057969ff32b027654a428ef4fd13e4ef2b7 | Python | dgiart/dgi_art | /rd-internal-python-master/section_1/task_07/task7.py | UTF-8 | 573 | 3.265625 | 3 | [] | no_license | prefixes = ['B', 'Kb', 'Mb', 'Gb', 'Tb']
def file_size(size: int):
power = 0
while True:
try:
# if power > 5:
# break
if 2 ** (10 * power) <= size < 2 ** (10 * (power + 1)):
num_res = round(size / (2 ** (10 * power)), 1)
res = f"... | true |
097ea6ed5020eec9143f3b9f3bd0976b3ce34e22 | Python | zloyvetal/my_first | /bot.py | UTF-8 | 1,380 | 3.234375 | 3 | [] | no_license |
import random
final_count = 0
history = []
open_file = open("input.txt", "r")
value = open_file.readline()
input_value = []
for i in value:
if i == "S" or i == "P" or i == "R":
input_value.append(i)
# LOGIC
def bot(h):
empty = True
if len(h) <= 1:
return rand... | true |
1825d68cb0d384093a66f22b20adf149070b9dd7 | Python | art-bug/Python-scripts | /sum_with_filter.py | UTF-8 | 793 | 4.3125 | 4 | [] | no_license | '''
This module provides sum_with_filter function,
which sums all numbers with or without a filter.
'''
def sum_with_filter(numbers, filter_function=None):
'''
The function sums all numbers that passed filter_function.
If there is no filter, the function just returns sum of numbers.
'''... | true |
bffcdd9e55add62ecabf99b7820c9526dc2cbe71 | Python | Anchal-Mittal/Python | /calender/c2.py | UTF-8 | 481 | 4.125 | 4 | [] | no_license | import calendar
def fun():
print("check is 2008 is leap year or not ")
if calendar.isleap(2008) :
print("2008 is leap year")
else:
print("2008 is not leap year")
print("no.of days between ",calendar.leapdays(2000,2016))
fun();
"""
isleap (year) :- This function checks if ye... | true |
c82417886e71d2a703e6278111655e17d7cf746a | Python | DiegoRugerio97/Selenium | /Quizzes/02-09/StringClassifier.py | UTF-8 | 556 | 4.15625 | 4 | [] | no_license |
evaluationString = "940 These are letters 123 460 String ###!!!***"
specialCharacters = "!#$%&/()='¡_:[]¨*?{@}¿"
digits = 0
chars = 0
spaces = 0
specChars = 0
for c in evaluationString:
if c in specialCharacters:
specChars += 1
elif c.isdigit():
digits += 1
elif c.isspace():
spaces... | true |
4f43d9407963c8215201334586d9389c6160a879 | Python | anavaldesc/Chern | /Analysis/Ramsey_phases.py | UTF-8 | 533 | 2.96875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 12:02:49 2017
@author: banano
"""
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0, 50 * np.pi, )
omega = 200*0
gridsize = 1e3
phi = np.linspace(-3*np.pi, 3 * np.pi, gridsize)
fringes = []
k = 0.8
kvec = np.linspace(-k, k, gridsize)
for i in rang... | true |
0004bd79ac6d6b4dcf0d9fd8829e496563ab09c1 | Python | dnychennnn/m26_g1_semantics | /training/postprocessing/stem_extraction.py | UTF-8 | 4,895 | 2.96875 | 3 | [] | no_license | import torch
from torch import nn
import numpy as np
import cv2
import warnings
from time import process_time
class StemExtraction(nn.Module):
"""Infere stem positions form predicted keypoints an offsets.
Adapted from code originally written for MGE-MSR-P-S.
"""
def __init__(self, input_width, input... | true |
1adb651a4e77fc873100d08512efd4d54eb29726 | Python | Aasthaengg/IBMdataset | /Python_codes/p03290/s469823206.py | UTF-8 | 1,403 | 2.625 | 3 | [] | no_license | D, G = map(int, input().split())
PC = [list(map(int, input().split())) for i in range(D)]
points = []
patterns = []
def flagfun(flag):
if len(flag) == D:
patterns.append(flag)
return
flagfun(flag+'0')
flagfun(flag+'1')
def index_pattern():
flagfun('')
idxes = []
... | true |
e462f6a9fa3ae6f42591838f1183f3f3a47e3b11 | Python | mmorinag127/multiml | /multiml/agent/basic/grid_search.py | UTF-8 | 3,286 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | """ GridSearchAgent module.
"""
import multiprocessing as mp
import itertools
from multiml import logger
from multiml.agent.basic.random_search import RandomSearchAgent, resulttuple
class GridSearchAgent(RandomSearchAgent):
""" Agent scanning all possible subtasks and hyper parameters.
"""
def __init__(... | true |
72648a7a9c93c64c6a8ef5a470bbe151e0892d6d | Python | geoff-reid/ussa_rankings | /race.py | UTF-8 | 4,224 | 2.78125 | 3 | [] | no_license | import csv
import scipy.stats as ss
from operator import itemgetter
import math
class Standings:
def __init__(self):
self.u12 = []
self.u14 = []
self.numResults = 0
self.resultList = []
self.bestOf = 0
def __addRaceGroup(self, results, group):
for racer in gro... | true |
6370eb0e4dc29b50280737100f4d1e7c2bf45669 | Python | microsoft/knowledge-extraction-recipes-forms | /Scenarios/Informative_Image_Selection_FR_Pattern/mlops/form_scoring_pipeline/steps/select_clapperboards.py | UTF-8 | 10,197 | 2.703125 | 3 | [
"MIT",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"Apache-2.0"
] | permissive | # Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""
Step to select clapperboards from action event using OCR(Read API)
"""
import os
from os.path import join
from pathlib import Path
from typing import Dict, List, Tuple
import logging
import click
from tqdm import tqdm
i... | true |
4b477a673409de12c49e22164dc86fc2a36f7477 | Python | IoanaMP/FII_PythonProject | /oldfiles/allatatime.py | UTF-8 | 2,162 | 2.640625 | 3 | [] | no_license | import os
import sys
from pathlib import Path
import ntpath
def split(source, size, n):
dest_dir = Path().absolute()
input_file = open(source, 'rb')
count = 0
f = ntpath.split(source)[1]
fname, ext = os.path.splitext(f)
for i in range(0,n-1):
chunk = int(size / n)
size = size -... | true |
d7d922bf8edcd8f7c53185d439c29d64fa62c437 | Python | YashfatHarman/SoccerLeagueDataMining | /IndividualSeasonFetcherFromWiki.py | UTF-8 | 4,910 | 3.484375 | 3 | [] | no_license | '''
Basically another web scrapper.
- Go through a text file, read each line, get the name and link of the webpage.
- Fetch that page, identify individual seasons and grab their links.
- save the seasons' names and links on a text file.
- Do it for every line in the original text file.
- Additio... | true |
8cb058e4b20db7232f733a966caf387681862059 | Python | Sportsfan77777/unstable-planets | /new_mercury/scatter_results.py | UTF-8 | 1,478 | 2.71875 | 3 | [] | no_license | """
Creates a scatter plot of ejection times against final sm-axes
"""
import numpy as np
import string
import math
import sys
import os
import subprocess
import matplotlib
matplotlib.use('Agg') # for ssh-ed computers
from matplotlib import pyplot as plot
import glob
import pickle
from structures import *
from avat... | true |
cb4886ad15bdc2f1e13a59e77071c4df7e6fe5b9 | Python | Tegrisco/testpaper-stage1 | /packages/xuehao.py | UTF-8 | 1,566 | 3.34375 | 3 | [] | no_license | """
=====================================
Get the coordinates of the student ID
Author: Zheng Zhihuang
Date: 2019.7.12
=====================================
A script for Python3.
Use template matching to locate the XueHao region.
使用模版匹配的方法定位学号区域。
"""
# Use matchTemplate function of opencv
import cv2 as cv
# Sta... | true |
513d0880a968ec6f15469e3b929661ee0a955bb6 | Python | lorashley/housegoals | /walk.py | UTF-8 | 1,563 | 3.265625 | 3 | [] | no_license | import json
import os
import requests
import urllib.parse
"""
http://api.walkscore.com/score?format=json&
address=1119%8th%20Avenue%20Seattle%20WA%2098101&lat=47.6085&
lon=-122.3295&transit=1&bike=1&wsapikey=<YOUR-WSAPIKEY>
"""
def get_item(item, data):
#Optional Data
score = 'n/a'
description = 'n/a'
... | true |
15665b05046aa26d412e00483746d62f9f289591 | Python | Leminen/infoGAN-collections | /src/models/infoGAN.py | UTF-8 | 17,548 | 2.578125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 24 14:01:52 2017
@author: leminen
"""
import sys
import os
import tensorflow as tf
import numpy as np
import itertools
import functools
import matplotlib.pyplot as plt
import datetime
sys.path.append('/home/leminen/Documents/RoboWeedMaps/GAN/weed-g... | true |
baa43896d04a4e6add11ebdd319924d326c63e13 | Python | tarasneroznak/algoritmika | /hw4/yandex/d.py | UTF-8 | 2,243 | 3.5 | 4 | [] | no_license | class HashTable:
def __init__(self) -> None:
self.capacity = 10
self.load_factor = 0.75
self.size = 0
self.table = [None] * self.capacity
self.keys = [None] * self.capacity
def set(self, key: str, value) -> None:
if (self.need_rebuild()):
self.rebuil... | true |
7489988e3a37426f5f1d2a4b7a543df15f280e09 | Python | IssKeCi2Ca/GaFuzzySystem | /GA/AssetFuzzy4.py | UTF-8 | 16,974 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 9 20:39:25 2018
@author: Siew Yaw Hoong
"""
import numpy as np
import pandas as pd
import skfuzzy as fuzz
from skfuzzy import control as ctrl
import math
from datetime import datetime
from datetime import date
from datetime import time
from datetime import ... | true |
c1825099dda37b7b0545dcecba9734785bf5aaf1 | Python | jtschoonhoven/algorithms | /randomize_list_in_place.py | UTF-8 | 833 | 3.984375 | 4 | [] | no_license | from copy import copy
from random import randint
def randomize_list_in_place(int_list):
"""
Randomize list in place in linear time.
"""
max_index = len(int_list) - 1
for index, item in enumerate(int_list):
swap_index = randint(index, max_index)
int_list[index] = int_list[swap_inde... | true |
001ee8cac25acaec2a4a5cd113d65cf4377f4141 | Python | Xoozi/tchomework | /ch00/section6/29.py | UTF-8 | 259 | 3.9375 | 4 | [] | no_license |
#画出参数方程的图像:
#x = 7*sin(t) - sin(7*t)
#y = 7*cos(t) - cos(7*t)
def f(t):
return 7*sin(t) - sin(7*t)
def g(t):
return 7*cos(t) - cos(7*t)
t = linspace(0, 2*pi, 100)
x = f(t)
y = g(t)
xlabel('x')
ylabel('y')
plot(x, y, 'r-');
| true |
695975751ad24ee54d1a603d6016f71558018e5f | Python | eyshah/Eyshah-Nadeem---Project-Brief--Task-4-Csv-file-analysis | /code1.py | UTF-8 | 394 | 3.3125 | 3 | [] | no_license | # Imports the csv module
import csv
# opens the csv file to "r" read function
with open("C:/Users/Ayesha's laptop/PycharmProjects/try-22/boardmeetingnew.csv","r") as csv_rfile:
# Variable created to store the file in
to_extract = csv.reader(csv_rfile)
# final command will print the rows as an ou... | true |
32909f9c42ae6f301ad937af0af13d0c2fcbf635 | Python | uyw4687/p | /snu20/a.py | UTF-8 | 322 | 3.125 | 3 | [] | no_license | import sys
input=sys.stdin.readline
t,n=map(int,input().split())
mapping={'Mon':0,'Tue':1,"Wed":2,"Thu":3,"Fri":4}
total=0
for i in range(n):
inf=input().split()
total+=24*(mapping[inf[2]]-mapping[inf[0]])+int(inf[3])-int(inf[1])
if total>=t:
print(0)
elif t-total>48:
print(-1)
else:
print(t-tota... | true |
e81f800291fc3b2878a1d0ae4cf0a7f18799ad5d | Python | ermontross/ai3202-2 | /Assignment5/Audette_Assignment5.py | UTF-8 | 10,009 | 3.15625 | 3 | [] | no_license | from Lib import heapq
import math
import sys
class NNode:
def __init__(self, locx, locy, kind = 2, disT = 999999999, parent = None):
self.x = locx
self.y = locy
self.k = kind
self.dist = disT
self.parent = parent
self.adj = []
self.h = float('inf')
se... | true |
e751128d6d52e8e06e1dc2d87e2738bb73a23d79 | Python | siriusong/machine-learning | /KNN/约会网站的配对.py | UTF-8 | 636 | 2.5625 | 3 | [
"MIT"
] | permissive | from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report
from sklearn import datasets
import numpy as np
from sklearn.model_selection import train_test_split
import pandas as pd
data=pd.read_table('./datingTestSet2.txt',header=None,names=['var1','var2','var3','label'])
... | true |
6d1297fb65bbb9c4caf4393079f473af7b2e63e1 | Python | andersonresende/learning_python | /chapter_18/minmax.py | UTF-8 | 1,654 | 3.8125 | 4 | [] | no_license | '''
Este modulo apresenta o uso de funcoes genericas.
Com estas funcoes podemos fazer coisas magicas, como
passar funcoes dentro de funcoes e valores indefinidos.
Desta forma ao inves de fazer varias funcoes completas,
podemos economizar varias linhas de codigo fazendo apenas
uma generica que recebe as outras mais simp... | true |
2bc889e60ed1f1b8021e8d6b0f40291f8115e682 | Python | Rizzrackez/CurrencyApi | /currency_api/backend/views.py | UTF-8 | 1,100 | 3.1875 | 3 | [] | no_license | from rest_framework.views import APIView
from rest_framework.response import Response
from backend.currency_functions import get_all_currencies, get_difference_between_currencies
class CurrenciesList(APIView):
"""Получение всех валют в формате ("character_code": символьный код валюты, "name": название валюты)"""
... | true |
78d196d3e05e9e67a898245c83f1cfc79470a4b6 | Python | Nikolay-Lysenko/sinethesizer | /tests/effects/test_vibrato.py | UTF-8 | 2,368 | 2.671875 | 3 | [
"MIT"
] | permissive | """
Test `sinethesizer.effects.vibrato` module.
Author: Nikolay Lysenko
"""
from typing import Any, Dict
import numpy as np
import pytest
from sinethesizer.effects.vibrato import apply_vibrato
from sinethesizer.synth.core import Event
@pytest.mark.parametrize(
"sound, frame_rate, sound_frequency, kind, kwarg... | true |
6907a901af6c0e76280f58aa1389e9f72195b7ee | Python | chengjia37/realtime_posdata_sample | /truncate_dynamo_items.py | UTF-8 | 1,184 | 2.578125 | 3 | [] | no_license | # coding: utf-8
import sys
import os
import boto3
from boto3.session import Session
REGION_NAME = "ap-northeast-1"
TABLE_NAME = "REALTIME-POS-DATA-TEI"
profile = 'kinesis'
def main():
session = Session(profile_name=profile)
dynamodb = session.resource('dynamodb', region_name=REGION_NAME)
table = dynam... | true |
2b437ec2d226bcd5dc65e68ad69703f8568e0d90 | Python | gistable/gistable | /all-gists/1536167/snippet.py | UTF-8 | 440 | 3.015625 | 3 | [
"MIT"
] | permissive | # set/get process name (using ctypes & prctl)
# set_proc_name('python rocks')
# name = get_proc_name()
import ctypes
from ctypes.util import find_library
libc = ctypes.CDLL(find_library('c'))
PR_SET_NAME = 15
PR_GET_NAME = 16
def set_proc_name(name):
libc.prctl(PR_SET_NAME, ctypes.c_char_p(name), 0, 0, 0)
def ge... | true |
f6a1f1906ab26a3d000fc39e3278301f9d145438 | Python | mukiblejlok/random_python_scripts | /diffie_hellman/diffie_hellman.py | UTF-8 | 862 | 3.703125 | 4 | [
"MIT"
] | permissive | import numpy as np
M = 10000
alice_key = np.random.randint(0, M)
bob_key = np.random.randint(0, M)
global_key = np.random.randint(0, M)
n = np.random.randint(0, M ** 2)
print(" --- Secret Keys ----")
print(" Alice Key: {}".format(alice_key))
print(" Bob Key: {}".format(bob_key))
print(" --- Global Keys ----")
print... | true |
312f2bcd1d50583e021751ff970c72c2b1f49aa1 | Python | Heitor-Santos/LEGOPrision | /Block.py | UTF-8 | 2,213 | 3.125 | 3 | [
"MIT"
] | permissive | import time
import json
import hashlib
from uuid import uuid4
from Transaction import Transaction
class Block(object):
"""Cria um novo bloco que acaba de ser mineirado
@param index-> index do bloco
@param transactions-> lista de transaçães feitas neste bloco
@param timestamp-> marca temporal de quando o... | true |
9866e23566ec66e88fc6f488399d3d0b0bffaa97 | Python | messengerW/FTT | /scrapy1/scrapy1/spiders/club.py | UTF-8 | 1,232 | 2.828125 | 3 | [] | no_license | # 2019.04.26
import scrapy
from scrapy1.items import ClubItem
class ClubSpider(scrapy.Spider):
name = 'spider_club'
allowed_domains = ['tzuqiu.cc']
start_urls = ['http://www.tzuqiu.cc/competitions/1/show.do']
def parse(self, response):
club_list = response.xpath("//*[@id='rankTable0']/tbod... | true |
de9845dfa15682cb1d90f91746cf6101f753e9fc | Python | AndrejLehmann/my_pfn_2019 | /Vorlesung/src/Genbank/parseFeatures.py | UTF-8 | 162 | 2.578125 | 3 | [] | no_license | import re
def parse_features(features):
for m in re.finditer('^ {5}\S.*\n( {21}\S.*\n)*',\
features, flags = re.M):
yield m.group(0)
| true |
06ffe4e60fd4b5ec6dbd2ccbbb81619e2f3766b4 | Python | ZhangYizhe/LeetCode | /63. Unique Paths II/63. Unique Paths II.py | UTF-8 | 855 | 3.453125 | 3 | [] | no_license | from typing import List
class Solution:
def uniquePathsWithObstacles(self, obstacleGrid: List[List[int]]) -> int:
m = len(obstacleGrid[0])
n = len(obstacleGrid)
arr = [1] * n
arr[0] = 1 - obstacleGrid[0][0]
for i in range(1, n):
arr[i] = arr[i - 1] * (1 - obst... | true |
9536974d0b08c4194a14cbf9bbff12b139d91d70 | Python | swati-tupat/todays_activities | /using_class.py | UTF-8 | 794 | 2.828125 | 3 | [] | no_license | from selenium import webdriver
import unittest
class googlesearch(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = webdriver.Chrome()
cls.driver.implicitly_wait(10)
cls.driver.maximize_window()
def test_search(self):
self.driver.get("https://... | true |
a6c3bc71f8ac372e73244ba17f8fd35ff5ac302f | Python | harleyguru/it-bot | /instagram_crawler.py | UTF-8 | 7,244 | 2.84375 | 3 | [] | no_license | """Instagram Crawler
"""
import os
import logging
from pymongo import MongoClient
from dotenv import load_dotenv, find_dotenv
from instagram_api import Instagram
load_dotenv(find_dotenv())
class InstagramCrawler:
"""Instagram Crawler class
"""
def __init__(self, debug=False):
if debug:
... | true |
f5e802fd8568410b203c4570cd4a40ab02144daa | Python | brightbyte/classics | /hanoi2.py | UTF-8 | 280 | 2.875 | 3 | [] | no_license | # the classic
def move( tpl ):
( src, dst ) = tpl
print( "move", src, dst )
return ( src, dst ) if len( src ) == 0 else move( ( move( ( src[1:], [] ) )[1], dst + src[:1] ) )
src = [ 5, 4, 3, 2, 1 ]
dst = []
( src, dst ) = move( ( src, dst ) )
print( "result", src, dst )
| true |
f64570b8b235413140c5a2769567f5d24f8d6951 | Python | rocery/data-analyst-python | /4. Data Manipulation with Pandas - Part 1/Data Manipulation with Pandas - Part 1 .py | UTF-8 | 12,865 | 3.75 | 4 | [] | no_license | import pandas as pd
import numpy as np
import mysql.connector
# Series
# number_list = pd.Series([1,2,3,4,5,6])
# print("Series:")
# print(number_list)
# # DataFrame
# matrix = [[1,2,3],
# ['a','b','c'],
# [3,4,5],
# ['d',4,6]]
# matrix_list = pd.DataFrame(matrix)
# print("DataFrame:")
# p... | true |
42f03ba8d44b5d18905d74b2dfe5e72df418fd35 | Python | gadepall/gate-probability | /solutions/adv/ma/1997/8/Codes/simulated_cdf.py | UTF-8 | 641 | 3.015625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import random
count=0
sample_size=1000
x=[]
def F(x):
if (x<-1):
return 0
elif (x>=-1) and (x<=1):
return (1+x)/2
else :
return 1
for i in range(sample_size):
t=np.random.choice(a=[-1,1],size=1000)
p=0
for j in range(1000):... | true |
e9edac34af0108b5e5f4df17d800abc27cc635f9 | Python | hemuke/python | /13_module_advanced/08_logging/01_logging.py | UTF-8 | 1,114 | 2.96875 | 3 | [
"Apache-2.0"
] | permissive | import logging
# filename: 文件名
# format: 数据的格式化输出. 最终在日志文件中的样子
# 时间-名称-级别-模块: 错误信息
# datefmt: 时间的格式
# level: 错误的级别权重, 当错误的级别权重大于等于leval的时候才会写入文件
logging.basicConfig(filename='x1.txt',
format='%(asctime)s - %(name)s - %(levelname)s -%(module)s: %(message)s',
datefmt='%Y-%m-%... | true |
795ae91d0527d0b1e5a67cd78a241d773361905d | Python | logicals7/project-hangman-game-jetbrains-academy | /hangman.py | UTF-8 | 2,939 | 3.953125 | 4 | [] | no_license | # Write your code here
import random
class Hangman:
def __init__(self):
print("H A N G M A N")
#self.words = ['javascript']
self.words = ['python', 'java', 'kotlin', 'javascript'] # list of words
self.ran_ = random.choice(self.words) # chooses the random word from the words
... | true |
7b8a10ade95bf409ddab910c4001f8282961e546 | Python | ashwinkannan94/Large-Scale-Data-Mining | /project1/partd.py | UTF-8 | 1,670 | 2.671875 | 3 | [] | no_license | from sklearn.datasets import fetch_20newsgroups
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import CountVectorizer
from nltk.stem import SnowballStemmer
from sklearn.feature_extraction import text
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.decomposition import Tru... | true |
99e2244a588971a82ad4b4f89aebec20b320c3d7 | Python | pranay2063/PY | /CODEFORCES-API/rating.py | UTF-8 | 616 | 3.203125 | 3 | [] | no_license |
# python program to show the rating changes of a user in the contests he/she participated on codeforces
# Author : Pranay Ranjan
import sys
from urllib import urlopen
from json import load
param = sys.argv[1] # argv[0] is the name of the file itself
response = urlopen(" http://codeforces.com/api/user.rating?handle="... | true |
d93d37980570d32a587214ff7b75f99a400c4173 | Python | StayErk/EserciziPA | /Esempi/Mediator/esempiodiy/modulo.py | UTF-8 | 1,197 | 2.90625 | 3 | [] | no_license | import collections
class Mediated:
def __init__(self):
self.mediator = None
def on_change(self):
if self.mediator is not None:
self.mediator.on_change(self)
class Incendio(Mediated):
def __init__(self):
super().__init__()
self.fiamme = False
def scoppia(se... | true |
48098cc74ee7b88e94591b7e2201261742714275 | Python | byuccl/spydrnet | /spydrnet/tests/test_example_netlist_functionality.py | UTF-8 | 917 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | import unittest
import spydrnet as sdn
import glob
import os
from pathlib import Path
class TestExampleNetlistFunctionality(unittest.TestCase):
def test_example_netlist_names(self):
filenames = glob.glob(os.path.join(sdn.base_dir, 'support_files', 'EDIF_netlists', '*'))
# filenames = glob.glob(Pat... | true |
f62046ff737cb65802fce14e7e4a893e3494d150 | Python | afzal-xyz/GTEdx_6040 | /Week 12 Homework/prepend-cells.py | UTF-8 | 1,298 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
"""
python3 prepend-cells.py <cells.ipynb> <notebook0.ipynb> [<notebook1.ipynb> ...]
"""
import sys
import nbformat
def msg(s, target=sys.stderr):
target.write(s)
def open_notebook(filename, as_version=4):
with open(filename, "rt") as fp:
nb = nbformat.read(fp, as_version)
... | true |
03bbe240bbeda3e88cc0f9c67836f4c3cdd5d3c5 | Python | Sandy4321/kaggle-web-traffic-time-series-forecasting | /codes/tools.py | UTF-8 | 2,920 | 3.28125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Useful functions used by main codes
import numpy as np
import matplotlib.pyplot as plt
# Visualization
def view(x, xlim=None, ylim=None, yscale='linear', title=None, show=True):
plt.yscale(yscale)
plt.plot(x)
if ylim: plt.ylim(ylim)
if xlim: plt.xlim(xlim)
if title: plt.t... | true |
43091b393ce725133ad3f80a281e9a5f25151c65 | Python | TheLampshady/pascompiler | /skynet.py | UTF-8 | 4,686 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive |
def parse_line(instr):
split_line = instr.split()
x, y = split_line[0], ' '.join(split_line[1:])
if y.lower() == 'true':
y = True
elif y.lower() == 'false':
y = False
return x, y
class Skynet(object):
def __init__(self, filename, debug=False):
self.instr_file = open(... | true |
93bea862557e4741adc3dd9b4129510f7d5ad9e8 | Python | Active-Programmer/Rock-Paper-Scissors-Game | /rock_paper_scissor.py | UTF-8 | 1,845 | 3.703125 | 4 | [] | no_license | # rock beats scissor, scissor beats paper and paper beats rock
import random
player_moves = ["rock", "scissor", "paper"]
comp_moves = ["rock", "scissor", "paper"]
Your_Score = 0
Comp_Score = 0
while True:
player_choice = random.choice(player_moves)
comp_choice = random.choice(comp_moves)
... | true |
3ae4e67fb097ea1bf8e0d982c499cd387855d00f | Python | cnduk/bbcondeparser | /tests/test_html_display.py | UTF-8 | 20,870 | 2.765625 | 3 | [] | no_license | import unittest
from bbcondeparser import (
ErrorText,
TagCategory,
BaseHTMLRenderTreeParser,
BaseHTMLTag,
HtmlSimpleTag,
)
#
# Tag categories
#
INLINE_TAGS = TagCategory("Simple tags")
BASIC_TAGS = TagCategory("Basic tags")
BLOCK_TAGS = TagCategory("Block tags")
LIST_TAGS = TagCategory("List t... | true |
3a7b8c7e98562fe5170a5b34444edd8298a54545 | Python | xiaochenchen-PITT/Leetcode | /Python/Number of 1 Bits.py | UTF-8 | 168 | 3.046875 | 3 | [] | no_license | class Solution(object):
def hammingWeight(self, n):
bitCount = 0
while n > 0:
bitCount += n & 1
n >>= 1
return bitCount
print Solution().hammingWeight(11) | true |
d77775cafd1fbde1ccf04cfbdaa2bda9f579d8ce | Python | uvsq21705818/ex_info | /ex4.py | UTF-8 | 1,695 | 3.28125 | 3 | [] | no_license | import tkinter as tk
HEIGHT = 500
WIDTH = 500
coord_carre = []
paused = False
def pause():
global paused
bouton_pause.config(text="RESTART", command=restart)
paused = True
def restart():
global paused
bouton_pause.config(text="PAUSE", command=pause)
paused = False
def clic... | true |
577e8fc51de2b2fa4d027b389810dfba08d33a5e | Python | THATDONFC/LedFx | /ledfx/effects/magnitude.py | UTF-8 | 1,081 | 2.53125 | 3 | [
"LGPL-2.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"GPL-3.0-only",
"GPL-3.0-or-later",
"LGPL-2.1-or-later",
"GPL-1.0-or-later"
] | permissive | import voluptuous as vol
from ledfx.effects.audio import AudioReactiveEffect
from ledfx.effects.gradient import GradientEffect
class MagnitudeAudioEffect(AudioReactiveEffect, GradientEffect):
NAME = "Magnitude"
CATEGORY = "Classic"
_power_funcs = {
"Beat": "beat_power",
"Bass": "bass_pow... | true |
939f00cf2c4b3e9d55a208ceb51566bff9c81633 | Python | danielmatoscastro/solucoes-hackerrank | /algorithms/implementation/bon_appetit.py | UTF-8 | 384 | 3.234375 | 3 | [] | no_license | #!/bin/python3
def solve(k, arr, b):
sum_arr = 0
for i, elem in enumerate(arr):
if i != k:
sum_arr += int(elem)
if b == sum_arr / 2:
return 'Bon Appetit'
else:
return int(b - sum_arr / 2)
n, k = input().strip().split(' ')
n, k = int(n), int(k)
arr = input().stri... | true |
436cf0bcb0673c88da1d8a7237325be6a42fac54 | Python | itorricom/Proyecto-Python-UAB | /Ejercicios Omegaup/5ok.py | UTF-8 | 180 | 4.09375 | 4 | [] | no_license | nombre = str(input())
contador = 0
for caracter in nombre:
if contador < 4:
print(caracter, "ASCII value is ", ord(caracter))
else:
break
contador += 1
| true |
ec5e87104dd2ddadd191ef51786adeb1bf1f3260 | Python | stanford-stagecast/equipment | /scenes/backend/media.py | UTF-8 | 276 | 2.828125 | 3 | [] | no_license | class Media:
def __init__(self, name: str, id: int, file: str, type: str):
self.id = id
self.name = name
self.file = file
self.type = type
def __repr__(self):
return f"Media: <{self.id}: {self.name}, {self.file}, {self.type}>"
| true |