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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
08275cf355e65d402a39c08e55ff848e83134f46 | Python | raychorn/svn_rackspace | /python/maintcal/maintcal/tests/unit/times_available/test_calculator.py | UTF-8 | 58,276 | 3.328125 | 3 | [] | no_license | """
THE MOST IMPORTANT THING TO REMEMBER WHEN TESTING TIMES AVAILABLE IS:
Possibilites for scheduling a gived service into a given period
with no blocks and no other schedules:
max possibilities = (2 * period length in hours + 1) - length of service in quanta
If you decompose the ... | true |
106d2d962c1f97e5934fc55f5196cde2ce25dfa6 | Python | tehhuu/Atcoder | /ABC/075/75-C.py | UTF-8 | 1,653 | 2.65625 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i... | true |
74af05d36e078ede6743d0edef50aa1655336241 | Python | sudhakar-sah/python-codes | /stack.py | UTF-8 | 5,406 | 3.765625 | 4 | [] | no_license | # from pythonds.basic.stack import Stack
# this is where stack is implemented but we have implmented our code here for practice
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.po... | true |
200c9221f55b1d326f41fde5016a3a24b29a8048 | Python | hisck/boxfilter-py | /boxFilter.py | UTF-8 | 3,443 | 2.8125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 16 23:25:50 2020
@author: Mateus Tenorio dos Santos & Antonio Roberto dos Santos
"""
import cv2
import numpy as np
import sys, getopt
def main(argv):
proportion = 1
inputfile = ''
outputfile = ''
try:
opts, args = getopt.getopt(ar... | true |
f6d63ca325866b75d1191a20db0b57197da97380 | Python | jd2207/pythonSandbox | /TurtleDemos/jd_yinyang.py | UTF-8 | 1,420 | 3.75 | 4 | [] | no_license | #! /usr/bin/python3.3
""" turtle-example-suite:
tdemo_yinyang.py
Another drawing suitable as a beginner's
programming example.
The small circles are drawn by the circle
command.
"""
class yingyang:
def __init__(self,radius):
self.radius = radius
def render(self,tu... | true |
6994b8a6909cc8c459d6baf0cd26f5cf310a055d | Python | Andmontc/holbertonschool-higher_level_programming | /0x09-python-everything_is_object/100-magic_string.py | UTF-8 | 105 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python3
def magic_string(nlist=[]):
nlist.append("Holberton")
return ", ".join(nlist)
| true |
b308929b9d20e32952d1058f3e42b693b0ed99d9 | Python | rvalusa2108/PySparkExercises | /PySparkExercise_WordCount.py | UTF-8 | 1,436 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # import pydevd_pycharm
# pydevd_pycharm.settrace('localhost', port=9999, stdoutToServer=True, stderrToServer=True)
from sys import platform
# from pyspark import SparkConf, SparkContext
#
# conf = SparkConf().setMaster("yarn-client").setAppName("WordCount")
# sc = SparkContext(conf=conf)
#
# inputData = sc.textFile(... | true |
ade0bab0949a61d72e2f44cac75c3d54ea43c4a2 | Python | grussorusso/serverledge | /examples/isprime.py | UTF-8 | 273 | 3.046875 | 3 | [
"MIT"
] | permissive | def handler(params, context):
try:
n = int(params["n"])
result = is_prime(n)
return {"IsPrime": result}
except:
return {}
def is_prime(n):
for i in range(2, n//2):
if n%i == 0:
return False
return True
| true |
07b20040fd721a2817bc344510b656608fb4af6a | Python | hsantoyo2/management-sdk-python | /cohesity_management_sdk/models/cassandra_backup_job_params.py | UTF-8 | 2,193 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
# Copyright 2020 Cohesity Inc.
import cohesity_management_sdk.models.cassandra_additional_params
class CassandraBackupJobParams(object):
"""Implementation of the 'CassandraBackupJobParams' model.
Contains any additional cassandra environment specific backup params at
the
job ... | true |
9824054ae86ee7d00c69636e5f89fdff923e7923 | Python | TamasSmahajcsikszabo/Python-for-Data-Science | /ML/ch3_classification.py | UTF-8 | 4,597 | 3.15625 | 3 | [] | no_license | from scipy.io import loadmat
import numpy as np
mnist = loadmat("C:\\Users\\tamas\\scikit_learn_data\\mnist-original.mat")
x = np.transpose(mnist["data"])
y = np.transpose(mnist["label"])
## examine one picture
digit = x[36000]
digit_image = digit.reshape(28,28)
import matplotlib
import matplotlib.pyplot a... | true |
66418213299b4846c64d2cae437d8aa079b25a27 | Python | KelbyBSandvick/DatabaseManagement | /pages.py | UTF-8 | 7,599 | 2.875 | 3 | [] | no_license |
import tkinter as tk
import tkinter.messagebox
import databaseConnection as dbc
class Container(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_row... | true |
0ec7b399b42585f4bf0205e4f9a63e792e4112a3 | Python | ageroosi/thonny-logfile-analysation | /eesliides.py | UTF-8 | 13,393 | 2.71875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
from tkinter import *
from tkinter import (ttk, filedialog)
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
import csv
from collections import Counter
from tkinter import messagebox
import numpy as np
import analysation
filepath = ""
initialdir =... | true |
fb10c0770c2bdb1c7b6e6f7d05b1ac0f3fdd1cca | Python | fabianod/game-tools | /quake/utils/bsp2wad.py | UTF-8 | 3,238 | 2.84375 | 3 | [
"MIT"
] | permissive | """Command line utility for creating and creating WAD files from BSP files
Supported Games:
- QUAKE
"""
__version__ = '1.0.1'
import argparse
import io
import os
import sys
from quake import bsp, wad
class ResolvePathAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None... | true |
157d4cf294c8b22d97a9f111a21a705dcddeed28 | Python | veseliy/coursera | /mfti_python/c1/solution2.py | UTF-8 | 109 | 3.03125 | 3 | [] | no_license | import sys
num_steps = int(sys.argv[1])
for i in range(1,num_steps + 1):
print((num_steps-i)*' '+'#'*i)
| true |
04acf1a61e79faef35a4629c4bdcf33fbd0e3422 | Python | seo01/TweetNgrams | /src/io/document_publisher.py | UTF-8 | 303 | 2.921875 | 3 | [] | no_license |
class DocumentPublisher():
def __init__(self):
pass
def publish(self,document):
print document
print "\n"
class FilePublisher():
def __init__(self,fh):
self.fh = fh
def publish(self,document):
self.fh.write('%s\n'%document)
| true |
e02037c7a1298b04c4c95e40aed8769c76774a6d | Python | jinxucn/Ruhomeworks | /DeepLearning/hw3/fcnnTorch.py | UTF-8 | 3,019 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# coding=utf-8
'''
@Author: Jin X
@Date: 2020-04-08 14:18:58
@LastEditTime: 2020-04-08 23:10:30
'''
import pickle
from torch.utils.data import DataLoader, TensorDataset
from time import perf_counter
import torch
def load():
with open("mnist.pkl", 'rb') as f:
mnist = pickle.load(f)
... | true |
b9d0d75a7d7bb04119e9fdc328a34c947bd202c7 | Python | AveryHuo/PeefyLeetCode | /src/Python/801-900/884.UncommonFromSentences.py | UTF-8 | 532 | 3.421875 | 3 | [
"Apache-2.0"
] | permissive |
class Solution:
def uncommonFromSentences(self, A, B):
"""
:type A: str
:type B: str
:rtype: List[str]
"""
from collections import Counter
c = Counter(A.split(' ') + B.split(' '))
return [v for v in c if c[v] == 1]
if __name__ == '__main__':... | true |
b94f9ab196cfb8c7a32745040648231c75b2ba3e | Python | chesterharvey/RecursiveRouteChoice | /tests/docs/test_simple_example.py | UTF-8 | 3,778 | 2.53125 | 3 | [] | no_license | """Script which is presented in the Sphinx documentation, reading appropriate sections of this
file. If this file is updated, the line numbers in Sphinx (docs/source/simple_example.rst)
need to be updated too.
"""
import numpy as np
from recursiveRouteChoice import RecursiveLogitModelPrediction, ModelDataStruct
... | true |
56695886eb0c1c910437a04abf5b6b96374e062f | Python | MeetLuck/works | /pygame/makinggamewithpygame/tetromino/constants4.py | UTF-8 | 2,196 | 2.78125 | 3 | [] | no_license | import pygame, sys, random, time, copy
from pygame.locals import *
from pygame import Color as pyColor
from rotateXY import rotate90
fps = 25
screenwidth,screenheight = 800,600
boxsize = 25
boardwidth,boardheight= 10,20
blank = '.'
up,down,left,right = 'up','down','left','right'
xmargin = (screenwidth - boardwidth... | true |
3c8d656a737716be82299b335f6412b7af0c3b7e | Python | pmamberti/lpthw | /ex38_test.py | UTF-8 | 105 | 3.3125 | 3 | [] | no_license | alist = ["one", "Granny", "Apple", "Strong", "calm"]
i = 0
while i < 5:
print(alist[i])
i += 1
| true |
b64bf5e2d77cbd858d88139d424d28c6dc0bea1c | Python | biemann/Collaboration-and-Competition | /ddpg.py | UTF-8 | 3,020 | 2.6875 | 3 | [] | no_license | # individual network settings for each actor + critic pair
# see networkforall for details
from model import Network
import os
import torch
import torch.nn.functional as F
import torch.distributed as dist
from torch.autograd import Variable
from torch.optim import Adam
from torch.optim.lr_scheduler import StepLR
impor... | true |
0132207b6d3e55e0eb378c1040eb3d57909cba3f | Python | agahkarakuzu/anat-processing-book | /_build/_build/jupyter_execute/results/2-test.py | UTF-8 | 19,974 | 2.71875 | 3 | [
"CC0-1.0"
] | permissive | # Example notebook (brain data)
## 1: Read and organize data
Data used in notebook is avilable [here](https://github.com/courtois-neuromod/anat-processing/releases).
import pandas as pd
df = pd.read_csv("./../neuromod-anat-brain-qmri/results-neuromod-anat-brain-qmri.csv", converters={'project_id': lambda x: str(x)... | true |
1982539f9061dbb6541b2c7debb10db004a16893 | Python | pythonvietnam/pbc032015 | /NguyenCongDuc/3.2-sticker.py | UTF-8 | 671 | 3 | 3 | [] | no_license | #!/usr/bin/python
# PCB032015
# Chuong trinh hien thi sticker!
print "Chuong trinh hien thi sticker!"
print '''Cac Sticker he thong ho tro:
\t1: :)
\t2: :x
\t3: :D
\t4: =)
\t5: :P
\t6: T_T
\tq: quit'''
xxx = raw_input("Nhap vao sticker mong muon: ")
while xxx != 'q':
if xxx == '1':
print ":)"
b... | true |
1c7a8de07e042beec6e7bf351b7094a0e7f70cb9 | Python | bklimko/phys416-code | /Chapter 3b Work/chap3b_problem22.py | UTF-8 | 3,993 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
# Program for problem 22 to calculate the trajectory of predator and prey populations
# Benjamin Klimko, PHYS 416, Spring 2018
def rk4(x,t,tau,derivsRK):
## Runge-Kutta integrator (4th order)
## Input arguments -
## x = current value of dependent variable
#... | true |
0c4e8e5e1346664b850af9b3685f9153e21d6080 | Python | namsoojang/Play_with_Data_2nd | /7. 이미지와 딥러닝/ch7/avhash-search.py | UTF-8 | 2,371 | 2.765625 | 3 | [] | no_license | from PIL import Image
import numpy as np
import os, re
# 파일 경로 지정하기
search_dir = "./image/101_ObjectCategories"
cache_dir = "./image/cache_avhash"
if not os.path.exists(cache_dir):
os.mkdir(cache_dir)
# 이미지 데이터를 Average Hash로 변환하기 --- (※1)
def average_hash(fname, size = 16):
fname2 = fname[len(search_dir):]
... | true |
7e72304dc9c641ac6ab06f061260859c9d8a1a86 | Python | ryanmattos/qr-code-generator | /script.py | UTF-8 | 667 | 2.5625 | 3 | [
"MIT"
] | permissive | import pyqrcode
import png
import flask
from pyqrcode import QRCode
from flask import request
app = flask.Flask(__name__)
app.config["DEBUG"] = True
@app.route( '/qr-code', methods=['GET'] )
def genQR():
if 'string' in request.args:
QRString = request.args['string']
else:
return "You must provide a... | true |
a9de6e2d339333f5ed5708a71367ec1ec574020d | Python | c-yan/yukicoder | /yc259/1140-1.py | UTF-8 | 763 | 3.671875 | 4 | [
"MIT"
] | permissive | def make_prime_table(n):
sieve = [True] * (n + 1)
sieve[0] = False
sieve[1] = False
for i in range(4, n + 1, 2):
sieve[i] = False
for i in range(3, int(n ** 0.5) + 1, 2):
if not sieve[i]:
continue
for j in range(i * i, n + 1, i * 2):
sieve[j] = False
... | true |
2fa041b7353ee817556f408b63b98e15b3ee7cd3 | Python | xjhello/spider | /正则表达式/匹配单个字符.py | UTF-8 | 1,607 | 4.25 | 4 | [] | no_license | import re
# 1. 匹配某个字符串:
# text = 'hello'
# ret = re.match('he', text) # match按照'he'规则匹配
# print(ret.group())
# 2. 点. 匹配任意的一个字符 但是不能匹配换行符(\n)
# text = 'hello'
# ret = re.match('.', text)
# print(ret.group())
# 3. \d 匹配任意的数字(0-9)
# text = '1231hello23'
# ret = re.match('\d', text)
# print(ret.group())
# 4. \D 匹配任意的非... | true |
c4f8003fb8f51835492d9146079ca21f49d9941a | Python | okmechak/SandBox | /some_course/week6/caesar.py | UTF-8 | 1,625 | 3.671875 | 4 | [] | no_license | from cs50 import get_string
from sys import argv
if len(argv) == 2 and argv[1].isalpha() and len(argv[1]) == 1:
key = ord(argv[1][0])
i = 0
plain_text = get_string('Plain text: ')
plain_text
"""
#include <stdio.h>
#include <stdlib.h>
#include <cs50.h>
char cipher(const char c, const in... | true |
f2dbbff5a45bed78f3eae11d9d7c047b11de3c98 | Python | MihaiBlebea/CarGiant-MachineLearning | /cg_predict_price/serializer/serializer.py | UTF-8 | 162 | 2.765625 | 3 | [] | no_license | import pickle
def save_obj(obj, file_path):
pickle.dump(obj, open(file_path, 'wb'))
def load_obj(file_path):
return pickle.load(open(file_path, 'rb'))
| true |
5f6a19b638faded692690e3733d8ce759601555d | Python | yhlam/project-euler | /project_euler/p004.py | UTF-8 | 745 | 3.828125 | 4 | [
"MIT"
] | permissive | """Largest palindrome product
A palindromic number reads the same both ways.
The largest palindrome made from the product of two 2-digit numbers is
9009 = 91 * 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Answer: 906609
"""
def solve():
maxProduct = 0
for i in range(100, 1... | true |
4320bd650120e3d1fcd843c1f57aa20ea03ba7a7 | Python | AdilsonTorres/programming-problems | /uri/2533.py | UTF-8 | 238 | 3.3125 | 3 | [
"MIT"
] | permissive |
while True:
try:
T = int(input())
except EOFError:
break
a, b = 0, 0
for i in range(T):
n, c = map(int, input().split(' '))
a += n * c
b += c * 100
print("{:.4f}".format(a / b)) | true |
bff52dbcbf9f8863e29b70651fdeeb0c614b999b | Python | rataichifish/relearn | /03/03.py | UTF-8 | 2,710 | 3.859375 | 4 | [] | no_license |
year = 2020 # 年份
result = "是闰年" if (year%4==0 and year % 100 !=0) or (year%100 == 0) else "不是闰年"
print("\n"+str(year) + "年" + result + "!") # 输出结果
print("面包店正在打折,活动进行中……") # 输出提示信息
strWeek = input("请输入中文星期(如星期一):") # 输入星期,例如,星期一
intTime = int(input("请输入时间中的小时(范围:0~23... | true |
1542098e65d9d122e02d7243832674054c81f847 | Python | lucasstevanin/LearningPythonfromCursoemVideo | /ProjetosPython/PraticandoPython/P33-GerenciadorDePagaemntos.py | UTF-8 | 793 | 3.671875 | 4 | [] | no_license | preco = float(input('Preço do Produto: '))
condicao_pagamento = int(input('''--Formas de Pagamentos Disponíveis--
1 - À Vista, Dinheiro / Cheque (10% Desconto)
2 - À Vista, Cartão (5% Desconto)
3 - 2x No Cartão (Preço Normal)
4 - 3x No Cartão (20% Juros)
Opção: '''))
desconto5 = preco - (preco * 0.05)
desconto10 = pre... | true |
e494e833f001a895b9e8fed3bdc8a7794f1b59e6 | Python | wjv/cloudrunner | /CloudRunner/IntrinsicFunctions.py | UTF-8 | 1,439 | 2.953125 | 3 | [] | no_license | """AWS CloudFormation Intrinsic Functions"""
__all__ = ['Fn_Join', 'Fn_Base64', 'Fn_GetAtt', 'Ref']
class IntrinsicFunction(object):
pass
class Fn_Base64(IntrinsicFunction):
def __init__(self, obj):
self.obj = obj
@property
def template(self):
return {"Fn:Base64": self.obj}
class Fn_FindInMap(I... | true |
c28665393ba375fbd25c252f550bf1b4ac0a08ec | Python | JingChufei/Coding-Interview | /19.正则表达式匹配.py | UTF-8 | 1,625 | 4.1875 | 4 | [] | no_license | """
题目: 正则表达式匹配
题: 请实现一个函数用来匹配包括'.'和'*'的正则表达式.
模式中的字符'.'表示任意一个字符, 而'*'表示它前面的字符可以出现任意次(包含0次).
在本题中, 匹配是指字符串的所有字符匹配整个模式. 例如, 字符串"aaa"与模式"a.a"和"ab*ac*a"匹配, 但是与"aa.a"和"ab*a"均不匹配.
"""
"""
递归
"""
class Solution:
def match(self, s: str, pattern: str) -> bool:
# 递归终止条件
if len(s) == 0 and len(pattern) == 0:
... | true |
97a6bca61d130cb031fa6fc459d2c9b27194115b | Python | rabbit-run/POS_tagger | /viterbi.py | UTF-8 | 3,573 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
Viterbi.py
Created by Zehua Mai on 2012-03-01.
Copyright (c) 2012 __MyCompanyName__. All rights reserved.
"""
from __future__ import division
import pickle
from math import log
import sys
class Viterbi:
def __init__(self):
with open('likelihood.pkl', 'rb') as o... | true |
86d7fbbbd43edb568f175a782294d54a43aa8d5c | Python | CoolNamesAllTaken/mojo-bike | /src/ledtest.py | UTF-8 | 326 | 2.75 | 3 | [] | no_license | import board
import neopixel
PIXEL_PIN = board.D18
NUM_PIXELS = 30
ORDER = neopixel.RGBW
pixels = neopixel.NeoPixel(PIXEL_PIN, NUM_PIXELS, brightness=0.2, auto_write=False,
pixel_order=ORDER)
pixels.fill((255, 255, 255, 255))
# pixels[0] = (255, 0, 0, 255)
pixels.show()
while(True):
pri... | true |
10da966c7a51ca3336b7c458324c0d5e0f26bff8 | Python | diegorodriguezv/Dora | /util/servotester_pigpio.py | UTF-8 | 1,857 | 2.921875 | 3 | [] | no_license | """ Servotester lets you test a set of servos."""
import platform
import readchar
# Don't use the raspberry pi in debug mode
DEBUG_MODE = platform.linux_distribution()[0] != 'debian'
if not DEBUG_MODE:
import pigpio
pi = pigpio.pi()
if not pi.connected:
print "pigpiod not running"
# exit(1... | true |
b1c3c528970fa3026e67f105fd77fc7f154c5814 | Python | raj13aug/Python-learning | /Course/5-Data-Structure/comprehensions.py | UTF-8 | 372 | 3.921875 | 4 | [] | no_license | items = [
("Product1", 10),
("Product2", 20),
("Product3", 13)
]
# comprehensions is cleaner and more performance
prices = list(map(lambda item: item[1], items))
prices = [item[1] for item in items]
# explanation:
# expression for item in items
filtered = list(filter(lamnda item: item[1] >= 10, items))
f... | true |
56fce28cf4ddcb1d4466d34a98b50c7025f775ba | Python | marcrobbins1019/kaggle_pulmonary_embolism | /representations.py | UTF-8 | 4,782 | 2.5625 | 3 | [] | no_license | import os
import pickle
import numpy as np
import pandas as pd
import pydicom
from image_preprocessing import get_representation
SLICE_LEVEL_DICOMS = ["Pixel Data", "InstanceNumber", "SOPInstanceUID"]
def save_by_type(object, file_path):
if isinstance(object, np.ndarray):
np.save(file_path, object)
... | true |
02359b01bc8fcd56e1ab69ae4d72fbdff00239cb | Python | jogusuvarna/jala_technologies | /overl_main.py | UTF-8 | 392 | 4.0625 | 4 | [] | no_license | #Write two methods with the same name and same number of parameters of different type and call from main method
class Operationd:
def __init__(self):
print("overloading with same function")
def sum(self, a,b):
s = a + b
return s
def sum(self,c='good ',d='mornig'):
e=c+d
... | true |
18310703c5881beb58e64ceee8d28674a0d50108 | Python | 921kiyo/algorithms | /cracking_coding/8_dynammic_programming/1_triple_step/main.py | UTF-8 | 494 | 3.484375 | 3 | [] | no_license | # def triple_step(n):
# memo = [-1]*(n+1)
# return recursive(n, memo)
#
# def recursive(n, memo):
# if(n < 0):
# return 0
# memo[0] = 1
#
# if(n == 0):
# return 1
# return recursive(n-1) + recursive(n-2) + recursive(n-3)
#
# print(triple_step(3))
def foo(a,b):
x = a
y = ... | true |
03f7460ba3e74df419b0bc0dfefe38ca06631ee1 | Python | ydtools/agr-ydtools | /decks/ydtools.st223.test-plex/src/rclonepy.py | UTF-8 | 2,772 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive |
import spur
# https://docs.python.org/3/library/shlex.html
import shlex
# from pathlib import Path
Path = str
def sh(cmd, **kw):
shell = spur.LocalShell()
cmd_tokens=shlex.split(cmd)
import os
update_env = {
'RCLONE_CONFIG': os.environ.get('RCLONE_CONFIG_FILE__HOST_EXT'),
}
res = shell... | true |
3030718095b1c71bfa1eccad589d5c7fbde4e8f0 | Python | d4rkr00t/leet-code | /python/leet/1290-convert-binary-number-in-a-linked-list-to-integer.py | UTF-8 | 789 | 4.1875 | 4 | [] | no_license | # Convert Binary Number in a Linked List to Integer
# https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/
# easy
#
# Time: O(n)
# Space: O(1)
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
def getDecimalValue(head: ListNode) -> int:
result = ... | true |
cdf140b3e2748a6aeead846a347a7380528baa91 | Python | werkaj/pythonLessons | /TestFranctions.py | UTF-8 | 1,006 | 2.96875 | 3 | [] | no_license | import unittest
import fracs
class TestFractions(unittest.TestCase):
def setUp(self):
self.zero = [0, 1]
def test_add_frac(self):
self.assertEqual(fracs.add_frac([1, 2], [1, 3]), [5, 6])
def test_sub_frac(self):
self.assertEqual(fracs.sub_frac([2,3],[1,4]),[5,12])
... | true |
d3c3c46b71125745c7691067d0098ded32c08b9f | Python | moritztiedje/lionfish | /src/mapGeneration/tileMap.py | UTF-8 | 280 | 2.765625 | 3 | [] | no_license | def array_from_file(file_path):
dummy_map_file = open(file_path, mode="rb")
content = dummy_map_file.readline()
content_lines = content.split(b'\x02')
area_map = []
for line in content_lines:
area_map.append(list(map(int, line)))
return area_map
| true |
a80218160235a8461850c92e603c645bb036a85f | Python | L-avender/AID1905 | /PycharmProjects/python_file/month01/day06/demo02.py | UTF-8 | 628 | 3.9375 | 4 | [] | no_license | #元祖
#基础操作
#1.创建元祖
#tuple01=()
#具有默认值
#tuple01=(1,2,3)
#元祖只有一个元素,在元素后加,号
#tuple01=(100,)
#print(tuple01)
#不能变化
#2.练习:在控制台中录入日期(年月),计算这是这一年的第几天,
#例如3月5日
day_of_month=(31,28,31,30,31,30,31,31,30,31,30,31)
month=int(input("请输入月份"))
day=int(input("请输入日"))
total_day=0
for i in range(month-1):
total_day+=day_of_month[i]
to... | true |
1ae469004092fab6e18ac8b1362e6396d920d68e | Python | cameronphchen/brainiak | /tests/utils/test_fmrisim.py | UTF-8 | 12,080 | 2.859375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | true |
42ca91f7cc083ce31457081c5e5b4612cd2f1f1b | Python | mclaughc/ppproject | /ppproject/channels/audiochannel.py | UTF-8 | 2,695 | 2.890625 | 3 | [] | no_license | from ppproject.native.samplebuffer import SampleBuffer
from ppproject.metadata import Metadata
class AudioChannel:
def __init__(self, sample_rate, channels, buffer_size = 0, name = ""):
if (sample_rate <= 0):
raise ValueError("sample_rate must be a positive integer")
if (channels <= 0):
raise Val... | true |
0a21e6da8560d61cdda458b898ebd8f62edaeac4 | Python | tbemsi/FirstStepsInPython | /Geometry/file_input.py | UTF-8 | 3,363 | 3.125 | 3 | [] | no_license | __author__ = 'bemsibom'
import csv
from objects import *
myfile = open("shapes_and_dimensions.csv", 'r')
shape_dict = {'circle': 2, 'rhombus': 3, 'parallelogram': 3, 'polygon': 2, 'cone': 3, 'cylinder': 3, 'pyramid': 4,
'prism': 4, 'sector': 3, 'icosahedron': 2}
with open("shapes_and_dimensions.csv",... | true |
eb7494337cc14f6dde9aa5360d52299df0df3328 | Python | dinhbaouit/Fridace | /app.py | UTF-8 | 5,479 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import frida
import sys
import getopt
def printusage():
print """
Usage:
Trace class : python app.py [option] -c -p [process] class1 class2 class3 ...
Trace function: python app.py [option] -f -p [process] function1, function2, function3 ...\n
Option:
-n Set no backtrace
"""
sys.exit(2)
... | true |
493ccd6b650d3bbd7548bc48f1a45b449215d97d | Python | dorje/iLQG | /oneLegDynamicModel.py | UTF-8 | 7,687 | 3.078125 | 3 | [
"MIT"
] | permissive | """
@Copyright (C) 2020--2030
@Author: Haoxi Zhang
dynamic model class for moving a simply leg
- usage:
a single 2-link leg dynamics
- inputs:
x = [q1, q2, q1_dot, q2_dot] # State vector: joint angles (2); joint velocities (2)
u = [F1, F2] # Control vector: torques for servo_1 & ser... | true |
8fe1c446fb758c3915d1ca30bee99911cb32eb98 | Python | rajat1994/Pygame_Programs | /pygame_4.py | UTF-8 | 1,130 | 2.84375 | 3 | [] | no_license |
import pygame
import sys
from pygame.locals import *
pygame.init()
white = (255,255,255)
black =(0,0,0)
red =(255,0,0)
green = (0,255,0)
blue = (0,0,255)
yellow = (255,255,0)
cyan = (0,255,255)
purple = (255,0,255)
setDisplay = pygame.display.set_mode((800,800))
pygame.display.set_caption('epic game')
FPS = 45... | true |
ec4421e9a9a4a1bb689715064337ad21d1582d82 | Python | Kioans/devops_python | /hw12.py | UTF-8 | 367 | 4.1875 | 4 | [] | no_license | '''
Написать функцию Фиббоначи fib(n), которая вычисляет
элементы последовательности Фиббоначи:
1 1 2 3 5 8 13 21 34 55 .......
'''
def fib(n):
a = 0
b = 1
for i in range(n):
a, b = b + a, a
print(a, end=' ')
n = int(input("Введите чило: "))
fib(n)
| true |
2f6548a29d3c55c6ed8ec0d074c115067de7222b | Python | waynerbarrios/lab16 | /db.py | UTF-8 | 960 | 2.875 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
def conectar():
dbname= 'mydatabase.db'
conn= sqlite3.connect(dbname)
return conn
def getUsers():
conn= conectar()
cursor= conn.execute("select * from usuuser;")
resultados= list(cursor.fetchall())
conn.close()
return resultados
def addUser(use... | true |
31d179a7a1098194668a54956a5ce9c4e3e7b731 | Python | audgk52/cs344 | /HW1/Scheduling.py | UTF-8 | 2,087 | 3.328125 | 3 | [] | no_license | '''
This program shows the schedule of CS courses with non-conflicting condition with faculty, time, and classroom
'''
from csp import parse_neighbors, CSP, min_conflicts
def Scheduling():
Courses = ['cs108', 'cs112', 'cs214', 'cs344', 'cs212']
Faculty = ['Schuurman', 'Adams', 'Vanderlinden', 'Plantinga']
... | true |
88487fe49d0b6d3d6f4b65a31e46868030ff650e | Python | lwlxwang/Network_Automation | /Python Scripts/serialization_json.py | UTF-8 | 301 | 2.765625 | 3 | [] | no_license | import json
friends = {"Nikhil": [28, "Pune", 4211215], "Ninad": [
32, "Pune", 4244215], "AK": [32, "Aurangabad", 45445471], "Khushi": [32, 'Pune', 474474744]}
with open("7M-friends.json", "w") as f:
json.dump(friends, f, indent=4)
json_str = json.dumps(friends, indent=4)
print(json_str)
| true |
927810b52a235d763e5439ddb0f7e866aadfc5e5 | Python | Marco2018/leetcode | /leetcode8.py | UTF-8 | 703 | 3.21875 | 3 | [] | no_license | class Solution:
def myAtoi(self,str1):
MAX_INT = 2147483647
MIN_INT = -2147483648
n,result,i,sign=len(str1),0,0,1
while i<n and str1[i]==" ":
i+=1
if i<n and str1[i]=="-":
sign=-1
i+=1
elif i<n and str1[i]=="+":
... | true |
8aad0a67c5212b1d01dc88e2376342492e48d326 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_374/ch15_2020_03_09_19_16_11_846974.py | UTF-8 | 116 | 3.359375 | 3 | [] | no_license | def nome(x):
if x == "Chris":
return "Todo mundo odeia o Chris"
else:
return ("Olá, ") + x | true |
1f370e0f74e21857f11c2bdbdd867817e91b1498 | Python | Analyticsworld-hash/Data-Science | /Data Pre-processing (1).py | UTF-8 | 7,783 | 3.21875 | 3 | [] | no_license |
# coding: utf-8
# In[2]:
#import pandas, numpy, matplotlib, pickle and math
# In[3]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import pickle
from math import pi
# In[4]:
#import file by using pandas
# In[5]:
data = pd.read_csv('E:\R\credit.csv')
# In[6]:
#look at the inf... | true |
846ed9ce5814833c291e7b43f123258ea0b385af | Python | starVader/cryptography | /fixed_xor.py | UTF-8 | 335 | 3.125 | 3 | [] | no_license | def calculate_xor(buffer1, buffer2):
buffer1 = bytes.fromhex(buffer1)
buffer2 = bytes.fromhex(buffer2)
return bytes([b1 ^ b2 for b1, b2 in zip(buffer1, buffer2)])
if __name__ == '__main__':
input_str = "1c0111001f010100061a024b53535009181c"
print(calculate_xor(input_str, "686974207468652062756c6c2... | true |
0241a654dda1268ab47a00af395021bc10c04ea6 | Python | NaClemon/Korean_Emergency_Analysis | /Visualization/19. Gender_Age_Bar.py | UTF-8 | 1,310 | 2.96875 | 3 | [] | no_license | # 성별, 나이 막대그래프
import numpy as np
import pandas as pd
import plotly.graph_objects as go
data1 = pd.read_csv('Data/2017년 상반기 구급활동현황.csv', sep=',', encoding='ANSI')
data2 = pd.read_csv('Data/2017년 하반기 구급활동현황.csv', sep=',', encoding='ANSI')
data = pd.concat([data1, data2], sort=False)
data = data[['환자성별', '환자연령']]
data ... | true |
76ca37847fc24062061cfb111632cd7243d6cc55 | Python | piyushgoyal1620/HacktoberFest2021 | /src/Python/Programs/Add_Candies.py | UTF-8 | 242 | 3.59375 | 4 | [] | no_license |
# Problem From codeforces https://codeforces.com/contest/1447/problem/A
# Add Candies
T = int(input())
while T != 0:
n = int(input())
print(n)
# Complexity: O(n)
for i in range(1, n+1):
print(i, end=' ')
T -= 1
| true |
f7fa7e56fdd4bf1cb45cee495dc3aa01e4aa73fa | Python | Fawad-Javed-Fateh/GRIP_TASK2_SEPT2021 | /task2.py | UTF-8 | 1,864 | 3.5 | 4 | [] | no_license | #%%
#Fawad Javed Fateh
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.sparse import data
import sklearn.cluster as cluster
#importing and cleaning the dataset
dataSet=pd.read_csv('Iris.csv',usecols=[i for i in range(5)])
dataSet.head()
dataSet=dataSet.iloc[:,[1,2,3,4]]... | true |
029b09c5e51f2ffba4fe18746594b4929b2c586d | Python | leviv/TwitterStyleTransfer | /train_vae.py | UTF-8 | 3,196 | 2.515625 | 3 | [] | no_license | import os
import torch
import argparse
from torch.utils.tensorboard import SummaryWriter
import torch.optim as optim
from dataset import TwitterDataset
from vae import VAE
def main(args):
# tensorboard writer
writer = SummaryWriter()
log_runs = args.log
lr = args.lr
epochs = args.epochs
gpu =... | true |
7e30588732280a4da406086d6bf1b53dfcae82c2 | Python | sasakishun/atcoder | /ABC/ABC047/A.py | UTF-8 | 132 | 3.296875 | 3 | [] | no_license | a, b, c = [int(i) for i in input().split()]
if (a + b) == c or (b + c) == a or (c + a) == b:
print("Yes")
else:
print("No") | true |
0c8aa401ec5d102edd2ba63fc37debc0bcb9c977 | Python | Alfagu/final-project-Ironhack-0419mad | /demo/gui.py | UTF-8 | 2,121 | 3.03125 | 3 | [] | no_license | import tkinter as tk
from tkinter import *
from tkinter.ttk import *
from tkinter import ttk
import time
root = Tk()
#### CENTER THE WINDOW
# Gets the requested values of the height and widht.
rootWidth = root.winfo_reqwidth()
rootHeight = root.winfo_reqheight()
print("Width",rootWidth,"Height",rootHeight)
# Gets b... | true |
35de75cb0a4433b4e8c6989ed3f6852a6c95106d | Python | MatheusNascimentoS/100_days_of_code_python | /day_26/Interactive_coding_exercise/main.py | UTF-8 | 279 | 3.078125 | 3 | [
"MIT"
] | permissive | with open(r"day_26\Interactive_coding_exercise\file1.txt") as file_1:
list_1 = file_1.readlines()
with open(r"day_26\Interactive_coding_exercise\file2.txt") as file_2:
list_2 = file_2.readlines()
result = [int(num) for num in list_1 if num in list_2]
print(result) | true |
9a5d48240efbcc077916360981a69fb144815737 | Python | jsec/fake_person_creator | /fake_person_creator/scraper.py | UTF-8 | 235 | 2.59375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def get_page_data():
page = requests.get('https://fakepersongenerator.com')
if page.status_code != 200:
return None
return BeautifulSoup(page.content, 'html.parser')
| true |
741f4f977054d674b6570a9cbd439392f1bdf378 | Python | natanaelfelix/Estudos | /Sessão 4/Atributos de classe/Encapsulamento.py | UTF-8 | 1,553 | 3.703125 | 4 | [] | no_license | #esconde codigos em python
'''
public, # metodos e atributos podem ser acesso dentro e fora da class,
protect # atributos que podem ser acesso apenas dentro da classe ou nas filhas da classe
private # atributo ou metodo só está disponível dentro da classe
em python:
isso é chamado de convenção
_ = é o mesmo que é pr... | true |
0aea182b485c58498aa84fe329cf44cae42e4279 | Python | sivilov-d/HackBulgaria | /week3/Baby steps/grades_that_pass.py | UTF-8 | 355 | 3.765625 | 4 | [] | no_license | students = ["Rado", "Ivo", "Maria", "Nina"]
grades = [3, 4.5, 5.5, 6]
def grades_that_pass(students, grades, limit):
passed = []
for i in range (0, len(grades)):
if grades[i] >= limit:
passed = passed + [students[i]]
return passed
result = grades_that_pass(stu... | true |
9db8ad95250bb4305a20604b88fbc992d3ff8920 | Python | bopopescu/Daily | /gc_test.py | UTF-8 | 811 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import wraps
import time
import gc
def time_it(func):
@wraps(func)
def wrapper(*args, **kwargs):
st = time.time()
res = func(*args, **kwargs)
print("Time cost {duration}".format(duration=time.time() - st))
return res
... | true |
4726101f40c74376c01c2cc0774a012eb58975da | Python | pkelchte/predictive_autocorrect | /predictive_autocorrect.py | UTF-8 | 4,811 | 3.296875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# coding: utf-8
# Copyright Pieter Kelchtermans 2017
# Tested on latest Windows, macOS and GNU/Linux versions.
# This file sets up a window with two text fields: one you can type in,
# and one that the computer uses to suggest words you would want to type next.
#
# Those words are 'learnt' from the... | true |
1f0d2e39926692450a6ad9c591a1d86ba3aad856 | Python | vxda7/pycharm | /제출/김승연_bumuk.py | UTF-8 | 389 | 3.125 | 3 | [] | no_license | t = int(input())
for tc in range(1, t+1):
N, D = map(int, input().split())
maplist = input().split()
zeros = 0 # 제로갯수
need = 0 # 설치갯수
for i in range(N):
if maplist[i] == '0':
zeros += 1
else:
zeros = 0
if zeros >= D:
need += 1
... | true |
4b3f9099be75f86d4c0be9e023f75c163b5f390d | Python | trytogotoschool/satisfaktion | /satisfaktion/src/nltk_test.py | UTF-8 | 357 | 3.1875 | 3 | [] | no_license | # coding: utf-8
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
text = 'Dans ce tutoriel, j\'apprends NLTK. c\'est intéressant.'
stop_words = set(stopwords.words('french'))
words = word_tokenize(text)
new_sentence = []
for word in words:
if word not in stop_words:
new_sentenc... | true |
92550ab85445337e08ed7f32de2a1ba87d58ed1c | Python | nunenuh/idcard_datagen | /datagen/imgen/transforms/func_line.py | UTF-8 | 5,249 | 3.03125 | 3 | [
"MIT"
] | permissive | import math
import random
import numpy as np
import cv2 as cv
__all__ = ['draw_random_lines',]
# Rotation matrix function
def rotate_matrix(x, y, angle, x_shift=0, y_shift=0):
x, y = x - x_shift, y - y_shift
angle = math.radians(angle)
# Rotation matrix multiplication to get rotated x & y
xr = (x * ma... | true |
f9b36449e16e280eac9477831f4b52260734d33f | Python | loginaway/DecisionTree | /DecisionTree.py | UTF-8 | 19,612 | 3.171875 | 3 | [
"MIT"
] | permissive | # coding: utf-8
import sys
import numpy as np
from Node import Node
# set the maximal recursion limits here.
sys.setrecursionlimit(10000)
class baseClassDecisionTree(object):
'''
The main class of decision tree.
'''
def __init__(self, feature_discrete=[], treeType='C4.5'):
'''
featur... | true |
903a10f84d1ef5268303bce3d388db51d2d299a6 | Python | guidumasperes/testing-fundamentals | /pytest/automation/test_compare.py | UTF-8 | 268 | 3.328125 | 3 | [] | no_license | #To execute the tests from a specific file, use the following syntax: "python -m pytest <filename> -v"
def test_greater():
num = 100
assert num > 100
def test_greater_equal():
num = 100
assert num >= 100
def test_less():
num = 100
assert num < 200 | true |
4f442902fe5c1064c5fd13bcbfcc23f112933519 | Python | Cprocc/chatLog | /visualization/Wordcloud.py | UTF-8 | 3,219 | 2.78125 | 3 | [] | no_license | # -*- coding=utf-8 -*-
import sys
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from pymongo import MongoClient
from wordcloud import WordCloud, ImageColorGenerator
class wordcloud():
def __init__(self):
self.client = MongoClient() # 默认连接 localhost 27017
self.db = self... | true |
f8840a741867cb12f3d42fc1ecc62dbed86e64d9 | Python | yennanliu/CS_basics | /leetcode_python/Binary_Search/find-first-and-last-position-of-element-in-sorted-array.py | UTF-8 | 8,691 | 4.125 | 4 | [] | no_license | """
34. Find First and Last Position of Element in Sorted Array
Medium
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value.
If target is not found in the array, return [-1, -1].
You must write an algorithm with O(log n) runtime complexity.
... | true |
3041b60b8077c1276e88a7633669f52aef74224d | Python | Donzaur/Wedding | /Donzaur_Flask/Donzaur_Flask/views.py | UTF-8 | 1,952 | 2.640625 | 3 | [] | no_license | """
Routes and views for the flask application.
"""
from datetime import datetime
from flask import render_template
from flask import request, redirect, url_for
from Donzaur_Flask import app
@app.route('/')
@app.route('/landing')
def home():
"""Renders the home page."""
return render_template(
... | true |
2d774b262493fe53352f647c028e0e1cdbf23592 | Python | radhigulati/Leetcode-Problems | /3sum.py | UTF-8 | 1,819 | 3.375 | 3 | [] | no_license | class Solution:
# @return num[i]list of lists of length 3, [[val1,val2,val3]]
def threeSum(self, num):
num.sort()
result = []
i = 0 # For the first item
while i < len(num) - 2:
j = i + 1 # For the middle item
k = len(num... | true |
f9784ca5b9c2c4b5e9059bb3b4c1a20717929fca | Python | LordBozo/Python | /Boredom.py | UTF-8 | 966 | 3.40625 | 3 | [] | no_license | from turtle import *
import time
import random
from tkinter import *
setup()
Wi = 10
title('Squares')
Square = Turtle()
colors = ['red', 'green', 'blue', 'orange', 'cyan', 'magenta',
'dodgerblue', 'turquoise', 'yellow', 'red', 'pink']
Square.up()
Square.goto(-(1900/2),510)
Square.down()
Square.speed('fastest... | true |
88c85d0c73c8e51b151317e439e55aa58076f88c | Python | vikpattabi/QuantumTSP | /tsp_funcs.py | UTF-8 | 965 | 3.171875 | 3 | [] | no_license | import numpy as np
import networkx as nx
def read_in_graph(path):
G = nx.read_weighted_edgelist(path)
return nx.to_numpy_matrix(G)
def construct_B_matrix(adj_matrix):
B = np.exp(1j * adj_matrix)
# print(B)
return B
def construct_unitaries(B):
N = B.shape[0]
U_mats = []
for j in range(... | true |
d397a7278aece81cce26fb00dbeb436a81ed02e3 | Python | stavros11/Time-Evolution | /optimization/sampling.py | UTF-8 | 4,889 | 2.921875 | 3 | [] | no_license | """Methods for VMC optimization of Clock using sampling.
TFIM model is assumed!
"""
import numpy as np
from machines import base
from typing import List, Tuple
def energy(machine: base.BaseMachine, configs: np.ndarray, times: np.ndarray,
dt: float, h: float = 0.5
) -> Tuple[List[float], List[fl... | true |
521714ad6168a240bbb70b26ecc5625a71511b26 | Python | arthurtorrs/Processamento-de-Sinais | /PDS/getplate.py | UTF-8 | 10,100 | 2.65625 | 3 | [] | no_license | import numpy as np
import cv2
import PossibleChar
import PossiblePlate
import math
import pytesseract
MIN_DIAG_SIZE_MULTIPLE_AWAY = 0.3
MAX_DIAG_SIZE_MULTIPLE_AWAY = 5.0
MAX_CHANGE_IN_AREA = 0.5
MAX_CHANGE_IN_WIDTH = 0.8
MAX_CHANGE_IN_HEIGHT = 0.2
MAX_ANGLE_BETWEEN_CHARS = 12.0
MIN_NUMBER_OF_MATCHING_CHARS = 3
RESIZED... | true |
bd38b67fd9911ce2758504e32bf72f4a748cec41 | Python | Tella-Ramya-Shree/Python-Assignment7 | /321810304048;Count occurrences of a substring in a string.py | UTF-8 | 109 | 3.75 | 4 | [] | no_license | #Count occurrences of a substring in a string
str= "abc def abc ghi abc"
print(str)
print(str.count('abc'))
| true |
b9f406be6a8f6940c9f13e2320dbabb1cca55a45 | Python | hyili/SendSwitch | /modules/server-side/mq/returnmq.py | UTF-8 | 3,312 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python3
import pika
import uuid
import time
import datetime
import json
import requests
class Receiver():
def __init__(self, logger, exchange_id="random", routing_keys=["random"],
host="localhost", port=5672, silent_mode=False):
# rabbitmq host
self.host = host
self.... | true |
40e1b3bf77e71e588675b82579815b4b96029212 | Python | barbaraneves/machine-learning-2020-1 | /Trabalho 1/modules/utils.py | UTF-8 | 3,454 | 2.9375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from decimal import Decimal
from modules import metrics
def plot_line_graphic(X, y, y_pred, X_name, y_name):
plt.figure(figsize=(10, 5))
plt.scatter(X, y, marker='o', s=10, color='slategray')
plt.xlabel(X_name)
plt.ylabel(y_name)... | true |
d36e0a486a29dbe87aaebc8b169c4bda0a68c7b3 | Python | yydcnjjw/anki-jp-tools | /api/anki/tool.py | UTF-8 | 2,665 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | def format_simple(simples, is_descs=False):
result = ""
if is_descs:
descs = simples
result += """<dl>"""
for desc in descs:
word_type = desc.get('word_type', '')
result += """<dt>%s</dt>""" % word_type
result += """<dd>"""
result += """<ul... | true |
7e34dca0997eb2204ac94536d2ffb118b6a42fb7 | Python | Fokko/evol | /evol/helpers/utils.py | UTF-8 | 2,102 | 3.140625 | 3 | [
"MIT"
] | permissive | from inspect import signature
from typing import Callable, Generator, List
from evol import Individual
def offspring_generator(parents: List[Individual],
parent_picker: Callable,
combiner: Callable,
**kwargs) -> Generator[Individual, None, None]... | true |
abf192c9ba7e892233b715cec332ec874a2b57d3 | Python | randompeople404/health_indicator_2020 | /data/data_ready.py | UTF-8 | 1,221 | 2.59375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from scipy.io.arff import loadarff
import os
def data_github_monthly(repo_name, directory, goal):
df_raw = pd.read_csv(directory + repo_name, sep=',')
df_raw = df_raw.drop(columns=['dates'])
last_col = ''
if goal == 0:
last_col = 'monthly_commits'
eli... | true |
0b4b357c8b9cf6f521ad46eb4916f99fb1651d45 | Python | parkjh4550/PyTorch | /RNN/classification/IMDBDataset.py | UTF-8 | 1,902 | 2.734375 | 3 | [] | no_license | import torch
from torch import nn, optim
from torch.utils.data import Dataset, DataLoader, TensorDataset
import pathlib
import glob
from utils import text2ids, list2tensor
class IMDBDataset(Dataset):
def __init__(self, dir_path, train=True, max_len=100, padding=True):
self.max_len = max_len
... | true |
f2d77a547cf44866fa0c9d2207960cae4e9fce12 | Python | zurda/python-exercises-shecodes | /week08/HW08_04_recursion.py | UTF-8 | 122 | 2.921875 | 3 | [] | no_license | #04
def paths(m, n):
if m==1 or n==1:
return 1
return paths(m, n-1) + paths(m-1, n)
#print(paths(3, 3)) | true |
18e19dbbc6289fe775813541654368a49ec0c7f2 | Python | lcg5450/algorithm | /BOJ/[BOJ]11399/[BOJ]11399.py | UTF-8 | 258 | 2.75 | 3 | [] | no_license | # boj 11399
import sys
n = map(int, sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split(" ")))
arr.sort()
sum = 0
dp = []
dp.append(arr[0])
for i in range(1, len(arr)):
dp.append(dp[i-1] + arr[i])
for i in dp:
sum += i
print(sum)
| true |
7bbcbb3a08c92b7a5d35f6ecef5f2afe23956af8 | Python | suthirakprom/Python_BootcampKIT | /week02/ex/27_mean_of_list.py | UTF-8 | 97 | 3.5 | 4 | [] | no_license | def mean_of_list(lst):
n = len(lst)
return sum(lst)/n
print(mean_of_list([50,10,62,32])) | true |
d20aa677f910a2e59e5c96f1b11547a4a8dcc5c2 | Python | NatanCC/rotten_sentimental | /review_crawler.py | UTF-8 | 3,926 | 2.625 | 3 | [] | no_license | import scrapy
from scrapy.crawler import CrawlerProcess
class ReviewSpider(scrapy.Spider):
def __init__(self, url, user_review = True, output_file = "output"):
self.name = "rotten crawler"
self.allowed_domains = ["rottentomatoes.com"]
self.max_pages = 1
self.ma... | true |
686be50bbb34cd1b4fe745f43e47e91cc6c06977 | Python | Mschnuff/FlaskWebSpiel | /gothonweb/planisphere.py | UTF-8 | 14,632 | 2.953125 | 3 | [] | no_license | from gothonweb import lexicon
from gothonweb.ork import Ork
import re
class Room(object):
def __init__(self, name, title, description):
self.name = name
self.title = title
self.description = description
self.alt_description = ""
self.paths = {}
s... | true |
e80c40da78c9b4c1610f17b99efe31fc63c3a677 | Python | Adedsec/scrapping-from-divar-with-python | /main.py | UTF-8 | 3,200 | 2.6875 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time
import json
import csv
import io
from pathlib import Path
from utility.data_getter import get_data
import utility.get_links
import utility.elastic_config as elastic
# the fetch() gets the data from the base url and prin... | true |