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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ccc305892412697db28679ed2c773dd313c2e3e6 | Python | austinchen15/Austin-Chen-Python-Battleship | /Battleship.py | UTF-8 | 87,377 | 2.65625 | 3 | [] | no_license | #
# Battleship
#
# Austin Chen
#
# This module contains the code for the Human player board and the landing screen.
#
from graphics import *
import math
import random
import time
#list of column possibilities
#the x is there in place of 10, because of the method of searching for coordinates
column = ["1"... | true |
74cda632f6c3ad6f03bf733799cce4ab82edf695 | Python | qspin/python-course | /exercise4.py | UTF-8 | 1,249 | 3.390625 | 3 | [] | no_license | import timeit
__author__ = 'kristof'
# one
L = range(0, 20)
print(L)
L[0] = 33
print(L)
# two
# del L[2]
L[2:6] = range(19, 27)
print(L)
# three
L.extend((61, 62, 63, 64, 65))
print(L)
# four
L.pop()
print(L)
# L[-1:] = []
L = L[0:-1]
print(L)
L.pop(len(L)-1)
print(L)
# five
L[::-1]
print(L)
# six
L1 = [1, 2, ... | true |
fedfdd6ed756c3676b37845713b2e5e38d4d5d70 | Python | kowsoleea/hypercube | /python/hypercube.py | UTF-8 | 8,982 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=C0111, C0103
#
# hypercube.py
#
# Copyright 2015 ivan <ivan@ivan-X55A>
#
#
import math
import ConfigParser
INIFILE = "hypercube.ini"
IMAGEFILE = "hypercube.svg"
#a hypercube is a collection of lines, wich are point pairs.
#each point is a n-list.
#th... | true |
061e7ad6e96ccfd977ac00c558b542de1cf924ea | Python | gabriellaec/desoft-analise-exercicios | /backup/user_148/ch168_2020_06_29_18_19_44_550720.py | UTF-8 | 210 | 2.90625 | 3 | [] | no_license | def login_disponivel(nome, lista):
i = 0
while i<len(lista):
if nome != lista[i]:
return nome
else:
nome = nome + str(i+1)
return nome
i += 1
| true |
50ab0773058dc23dca1d7c5d7088795c2a4bca8a | Python | TQ24/CS251 | /Project2/exttest.py | UTF-8 | 1,003 | 3.109375 | 3 | [] | no_license | # Tracy Quan
# CS251 Project2
# Extension1&2 test file
import numpy
import sys
import data
def main():
numpy.set_printoptions(suppress=True)
print("\n----- Database Info -----")
if len(sys.argv) < 2:
print( 'Usage: python %s <csv filename>' % (sys.argv[0]))
exit(0)
# create a data obj... | true |
34a0a20f08585861ee6c8180c98e1276e5943483 | Python | sotirisnik/projecteuler | /prob34.py | UTF-8 | 419 | 3.34375 | 3 | [] | no_license | memo = {}
def f( n ):
if n == 0:
return 1
if n in memo:
return memo[ (n) ]
memo[n] = n * f(n-1)
return ( memo[n] )
def sum_fact( x ):
ret = 0
while x > 0:
ret += f( x%10 )
x /= 10
return ( ret )
ans = 0
fo... | true |
a38c0eb0e3e4bc7fda80e4a9eb5474e4a3e4919d | Python | puconghan/Data_Structure_and_Algorithms_Python_practices | /python_version/problem_solving/problem_set_one.py | UTF-8 | 19,273 | 4 | 4 | [] | no_license | '''
Implementation for regular expression pattern matching for '.' and '*'
'''
def pattern_matching(string, pattern):
if len(pattern) == 0:
return len(string) == 0
if len(pattern) == 1:
if pattern[0] != '.':
return (string[0] == pattern[0] and len(string) == 1)
else:
... | true |
0614ffc6fbaea7edbe6faddcfb51802bab0a532c | Python | simonowen/pacemuzx | /remove_rom.py | UTF-8 | 977 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import argparse
parser = argparse.ArgumentParser("Remove ROM placeholder from pacemu master disk image")
parser.add_argument("tapfile", help="input TAP file containing ROM")
parser.add_argument("romfile", help="start of ROM image to remove")
parser.add_argument("romsize", type=int, hel... | true |
dca6ca56712e5fc5c4cac2948353fdb8329964e9 | Python | adap/flower | /src/py/flwr_example/pytorch_cifar/cifar.py | UTF-8 | 5,121 | 2.609375 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2020 Adap GmbH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | true |
ccada25ed2d929a59375e54743be94a8289b8e3a | Python | yosefsklar/Physics-Engines | /pygame_basics/samples/ex2.py | UTF-8 | 783 | 3.59375 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Drawing a circle
"""
import sys, pygame
background_color = (255,255,255)
(width, height) = (320, 240)
class Particle(object):
def __init__(self, pos, radius):
self.x = pos[0]
self.y = pos[1]
self.radius = radius
self.color = (0, 0... | true |
06e632955f118650bfd029538f599d984e882b80 | Python | hiroto-kazama/CS-362_In-class_activity_2 | /palindrome.py | UTF-8 | 355 | 4.34375 | 4 | [] | no_license | def isPalindrome(x):
y = x[::-1]
return y == x
"""
x = input("Input a string to check if it's a palindrome: ")
if isPalindrome(x):
print(x, "is a palindrome")
else:
print(x, "is not a palindrome")
"""
def test_isPalindrome():
example = 'Testset'
expected = True
result = isPalindrome(exa... | true |
c62668c428999e31af0a93c3ec91e4d01ecc612e | Python | renanmpimentel/python-para-zumbis | /primeira_lista/exercicio04_renan_01.py | UTF-8 | 286 | 3.90625 | 4 | [] | no_license | #!/usr/bin/python
salario = input("Digite o salario atual: ");
aumento = input("Digite a porcentagem do aumento: ");
valorAumento = float(salario) * (float(aumento)/100);
print 'Valor do aumento: R$', float(valorAumento);
print 'Valor do novo salario: R$', valorAumento+salario; | true |
cdc3f63179279c0ccc6f8b50f4cf5bb2f43d3bf1 | Python | georasaq/Python-Programs | /Exception1.py | UTF-8 | 342 | 3.75 | 4 | [] | no_license | try:
a = 10
b=int(input("enter a value"))
c=a/b
print(c)
except ZeroDivisionError:
print("Exception Occured Because Zero Denominator")
except TypeError:
print("Exception Occured Because Invalid Input")
except Exception:
print("Some Error Occured")
finally:
print("En... | true |
027a85f6d0eb86a713260d33447c79f7a05bdc3a | Python | seanlucrussell/computing | /Python/Project Euler/even_fib_num.py | UTF-8 | 138 | 2.828125 | 3 | [] | no_license | low = 1
high = 2
sum = 0
mid = high
while high < 4000000:
if high % 2 == 0:
sum += high
mid = high
high += low
low = mid
print sum | true |
8374267953af75a8cc39dd62b17f6608d0672fcf | Python | dohy12/coding_test | /greedy/greedy5c.py | UTF-8 | 749 | 3.75 | 4 | [] | no_license | # https://programmers.co.kr/learn/courses/30/lessons/42862
# 프로그래머스 코팅테스트 연습 > 탐욕법(Greedy) > 큰 수 만들기
# 강의 풀이
def solution(number, k):
collected = []
for i, num in enumerate(number): # enumerate 튜플로 (index, num)값을 넘겨준다.
while len(collected) > 0 and collected[-1] < num and k > 0: # 마지막 글자 체크할때 collected[... | true |
e3ed4e9be70275c5d89fa7dd00a6a594c9f5223e | Python | imasnyper/ltd-priority-list | /vacation/calendar.py | UTF-8 | 7,173 | 2.703125 | 3 | [
"MIT"
] | permissive | import datetime
from calendar import HTMLCalendar, monthrange, month_name, day_abbr, weekday
from operator import attrgetter, methodcaller
from django.db.models import Q
from django.urls import reverse
from workalendar.america import Ontario
from vacation.models import Vacation
class VacationCalendar(HTMLCalendar):... | true |
83af1085c0dac96d8b03e41be45da961cde87165 | Python | faketeam555/Fake-Team-2 | /ml_models/tv_nb_clr.py | UTF-8 | 1,612 | 2.609375 | 3 | [] | no_license | import pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.svm import LinearSVC
from datastore.models import Message
def get_tv_nb_clr():
print('Getting classifier')
ftr_tr, ftr_tt, ... | true |
19049bbcf87f99d4c08b30660666a44669e45590 | Python | pasudo123/ComputerVision | /LectureOfCV/Chapter07/05_PerspectiveTransform.py | UTF-8 | 660 | 2.59375 | 3 | [] | no_license | import cv2
import numpy as np
import matplotlib.pyplot as plt
from tkinter.filedialog import askopenfilename
def geometricTransform():
filename = askopenfilename()
img = cv2.imread(filename, cv2.IMREAD_GRAYSCALE)
height, width = img.shape[0:2]
pts1 = np.float32([[0, 0], [300, 0], [0, 300], [300, 300]]... | true |
597d8eaf16181ee0aeff5715a7c53f24fed5d2b1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03221/s810729862.py | UTF-8 | 352 | 2.84375 | 3 | [] | no_license | n,m = map(int,input().split())
L = [[] for i in range(n)]
ans = [0]*m
l = [list(map(int,input().split())) for i in range(m)]
for i in range(len(l)):
L[l[i][0]-1].append([l[i][1],i+1])
for ind,lis in enumerate(L):
lis.sort()
for j in range(len(lis)):
ans[lis[j][1] - 1] = str(ind+1).zfill(6) + str(j+1).zfil... | true |
9501552d25fddcaa0a8da22ec89a31871b06219a | Python | tttokiooo/AtCoder_python | /ABC101_200/ABC135/c.py | UTF-8 | 630 | 2.90625 | 3 | [] | no_license | # https://atcoder.jp/contests/abc135/tasks/abc135_c
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(input())
a = list(map(int, input().split()))
b = tuple(map(int, input().split()))
ans = 0
for i in range(n):
ai = a[i]
bi = b[i]
if ai >= bi:... | true |
330bace10f4bfb93da5316755c2c9b5822e801c9 | Python | datainpoint/classroom-introduction-to-python | /test_cases/test_cases_07.py | UTF-8 | 1,469 | 3.34375 | 3 | [
"MIT"
] | permissive | import unittest
class TestFunctions(unittest.TestCase):
def test_product(self):
self.assertEqual(product(0, 1, 2), 0)
self.assertEqual(product(1, 2, 3, 4, 5), 120)
self.assertEqual(product(1, 3, 5, 7, 9), 945)
def test_iso_country(self):
self.assertEqual(iso_country(TWN='Taiwan'... | true |
7b25107b5dcb5b9a334dd9582b0e6d69aa207150 | Python | rrudd/jore2gtfs | /fix-metro-locations.py | UTF-8 | 1,166 | 2.75 | 3 | [] | no_license | from tempfile import NamedTemporaryFile
import shutil
import csv
fileName = 'stops.txt'
tempFile = NamedTemporaryFile(mode='w', delete=False)
with open(fileName) as csvFile, tempFile:
reader = csv.reader(csvFile, delimiter=',')
writer = csv.writer(tempFile, delimiter=',')
for row in reader:
# Tap... | true |
0e9be038721dea3717a0a7ec0f4651d169daa5c4 | Python | Guinas-7/fm2618 | /EightClass/spaceinvaders.py | UTF-8 | 3,425 | 3.03125 | 3 | [] | no_license | import pygame, sys
from pygame.locals import *
import random
pygame.init()
clock = pygame.time.Clock()
pygame.display.set_caption("title of game")
shootdelay = 25
enemiespawn = 30
clockspeed = 60
screenx = 1000
screeny = 800
screen = pygame.display.set_mode((screenx, screeny))
bullets = []
enemies = []
enemie_image = p... | true |
4292cdb2c5cb589eb31c18a43fc052f38c6281bf | Python | RodrigoEC/Prog1-Questions | /unidade10/agrupa_matriculas/agrupa_matriculas.py | UTF-8 | 782 | 3.171875 | 3 | [] | no_license | # coding: utf-8
################################################
# Disciplina: Programação 01 - 2018.1 #
# Nome: Rodrigo Eloy Cavalcanti #
# Matrícula: 118210111 #
# E-mail: rodrigo.cavalcanti@ccc.ufcg.edu.br #
# Atividade: Agrupa Matrículas #
# Unidade... | true |
6eef74d6d87ed3ed85dd07fbb7259b225c50cf2f | Python | UnyieldingOrca/multi_digit_mnist | /dapnn/data.py | UTF-8 | 1,061 | 2.703125 | 3 | [] | no_license | '''
Created on Jun 27, 2018
@author: david
'''
from torch.utils.data.dataset import Dataset
import gzip
import pickle
import torch.utils.data
def identity(item):
return item
def build_DataLoader(dataset, batch_size=100, shuffle=True):
return torch.utils.data.DataLoader(dataset=dataset, batc... | true |
dae9ac724277ec49feaee0cf70fcd86cc1927c53 | Python | bhavish14/Machine-Learning-UTD | /Long Project 1/utilities/Scripts/DengAIColabNote.py | UTF-8 | 6,430 | 2.625 | 3 | [] | no_license |
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_absolute_error
from sklearn.svm import SVC
from sklearn.preprocessing import StandardScaler
import numpy as np
import matplotlib.pyplot as plt
from sklearn.preprocessing import LabelEncoder
from sklearn... | true |
afb58bf42ba624e52bccd2071d7142cb587143ae | Python | AodhanDalton/AdventOfCode | /Day_11/day11.py | UTF-8 | 4,158 | 3.3125 | 3 | [] | no_license | import time
grid = [list(line.strip()) for line in open('day11')]
#########################################################
# Part 1
#########################################################
# starting timer
start1 = time.time()
# method for calculating number of occupied seats
def count_... | true |
178f28a9df564cfd543c27d58b6013a0ecb60800 | Python | kurisu39/PY4E | /python2.7/Assignment 5.2.py | UTF-8 | 961 | 4.5625 | 5 | [] | no_license |
#5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'.
#Once 'done' is entered, print out the largest and smallest of the numbers.
#If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message
#and ignore the n... | true |
40fc13635ec1ba28574d160a9dd92d20339a3358 | Python | awhitney1/cmpt120Whitney | /rover.py | UTF-8 | 237 | 3.734375 | 4 | [] | no_license | # Andrew Whitney
# Introduction to Programming
# A program calculating the time it takes to send pictures from a mars rover to earth
def main():
distance = (34000000)
speed = (186000)
time = (distance/speed)
print(time)
main()
| true |
d2f861e561351e3c82ed47c6969faa6ea91a5230 | Python | Number0000009/ioctl_skeletal | /pyletal.py | UTF-8 | 747 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
import skeletal
def main():
f = skeletal.Skeletal()
arg = f.call(f.IOC_CALL1N)
print(hex(arg))
arg = f.call(f.IOC_CALL2N)
print(hex(arg))
arg = f.call(f.IOC_CALL3N)
print(hex(arg))
arg = f.call(f.IOC_CALL1R)
print(hex(arg))
arg = f.call(f.IOC_CALL2R)... | true |
b78d20792d34809132712f9cb6be15ce5167b709 | Python | pjana/ADS | /codeword_lda.py | UTF-8 | 3,355 | 3.21875 | 3 | [] | no_license | """
Codeword LDA - injects positive and negative words to ensure sentiments in
topic modeling
@author - Prerana Jana
"""
import pandas as pd
from nltk.corpus import stopwords
from nltk.stem.wordnet import WordNetLemmatizer
import string
from stemming.porter2 import stem
import gensim
from gensim import corpora
stop =... | true |
31c40c7ce33ec48832ed829ddbc2495c3fe645fa | Python | hinak1/contact-api | /main.py | UTF-8 | 21,882 | 2.640625 | 3 | [] | no_license | import json
import datetime
from app import app
from db_conf import mysql
from flask import jsonify
from flask import flash, request, Flask
from flask_restful import Resource, Api
from flask_swagger_ui import get_swaggerui_blueprint
import os
app = Flask(__name__)
api = Api(app, prefix="/api/v1")
### swagger specific... | true |
4d85e7d163a4195cc3e787be865422229ff5cc95 | Python | jesseditson/VinylScrobbler | /raspberrypi/capture-audio.py | UTF-8 | 1,355 | 2.515625 | 3 | [] | no_license | import pyaudio
from match_file_acrcloud import recognize
import wave
# ACRCloud wants PCM 16 bit, mono 8000 Hz
form_1 = pyaudio.paInt16 # 16-bit resolution
chans = 1 # 1 channel
samp_rate = 44100 # 44.1kHz sampling rate
chunk = 4096 # 2^12 samples for buffer
record_secs = 30 # seconds to record
audio = pyaudio.... | true |
28b34f35a665a56ec0694bc1e955aa8299025785 | Python | UncleBob2/100_day_python_solution | /day_8_Caesar_Cipher_final.py | UTF-8 | 1,670 | 3.6875 | 4 | [] | no_license |
import day_8_art
import string
num_sym = list(string.digits + string.punctuation + " ")
alphabet = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x"... | true |
d6fffab2384757120893a67b03b736d10d197284 | Python | himu999/Python_Basic | /F.list/#L#list_comprehension.py | UTF-8 | 418 | 3.8125 | 4 | [] | no_license | fruits = ["apple", "banana", "cherry", "kiwi", "mango"]
# newlist = [expression for item in iterable if condition == True]
lst = [x for x in fruits if "a" in x]
print(lst)
lst1 = [x for x in fruits if "a" not in x]
print(lst1)
lst2 = [m.upper() for m in fruits]
print(lst2)
lst3 = [z.capitalize() for z in fruits]
... | true |
c7ae143fc6817ae33f8d71f64052b566b8378855 | Python | c109156147/py20 | /17.py | UTF-8 | 206 | 3.171875 | 3 | [] | no_license | n=input("")
a1=n.replace("A","1")
a2=a1.replace("J","11")
a3=a2.replace("Q","12")
a4=a3.replace("K","13")
a5=a4.split(" ")
a6=int(a5[0])+int(a5[1])+int(a5[2])+int(a5[3])+int(a5[4])
print(str(a6))
| true |
362a17aaf57d35e1c1513d4f8730833be418d639 | Python | micimize/frictionless-code-generator | /frictionless_code_generator/module_classes.py | UTF-8 | 5,645 | 2.703125 | 3 | [] | no_license | import re
import typing as t
from textwrap import TextWrapper, dedent, indent
import attr
from tableschema import Field, Schema # type: ignore
from ._types import TypeInfo, get_type_info
_NL = "\n\s*"
wrapper = TextWrapper(width=70, break_long_words=False, replace_whitespace=False)
def _clean_newlines(snippet: s... | true |
8c36e3a42cf2201afaf7b4ea6cd8c6e25e278b11 | Python | jhyang12345/algorithm-problems | /problems/reverse_dag.py | UTF-8 | 1,039 | 4.09375 | 4 | [] | no_license | # Given a directed graph, reverse the directed graph so all directed edges are reversed.
#
# Example:
# Input:
# A -> B, B -> C, A ->C
#
# Output:
# B->A, C -> B, C -> A
# Here's a starting point:
from collections import defaultdict
class Node:
def __init__(self, value):
self.adjacent = []
self.va... | true |
5b25b3d1d480ff99d13ecaf026c052fdaf85d72d | Python | cog-isa/htm-core | /temporalPooler/htm_dendrite.py | UTF-8 | 1,772 | 2.875 | 3 | [] | no_license | from apps.settings import TemporalSettings
from temporalPooler.htm_synapse import Synapse
class Dendrite:
"""
дендрит,подключенный к клетке
"""
def __init__(self, temporal_settings: TemporalSettings, cells=None):
"""
инициализация дендрита
:param cells: клетки к которым он под... | true |
9296673992931e22fa3eb2bfa1fc94a9b3ba2293 | Python | AdamOSullivan46/ACM | /2012/P1testGen.txt | UTF-8 | 198 | 3.03125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import random
from sys import argv
N = argv[1]
#N = 1000000 # random.randint(1, 10000000)
print(N)
N = int(N)
for i in range(N):
print(random.randint(-N, N), end=' ')
| true |
170145433b0f44ad00daac9d6f7c088813931307 | Python | vikipatel1995/oop-basic-data3 | /venv/run.py | UTF-8 | 715 | 3.65625 | 4 | [] | no_license | from opp_animal_class import *
def sleep():
return 'Snoring'
#init. a animal, then call method sleep
# print(Animal().sleep())
# print(sleep())
#print(' hello '.strip())
print(type('hello'))
animal_instance_ringo = Animal('Ringo', 10)
animal_instance_hugo= Animal('Hugo', 2)
animal_instance_baltazar= Anima... | true |
5b33dfa1a9169c78662f3db210bc2746766ae4e9 | Python | ad1lf/NLP2020_Assignment_03 | /03_M.py | UTF-8 | 1,473 | 2.90625 | 3 | [] | no_license | import spacy
import pandas as pd
import numpy as np
from string import punctuation
from sklearn.metrics import accuracy_score, f1_score, precision_score, recall_score
df = pd.read_csv('C:/Users/fatkh/OneDrive/3 course 2 term/Natural Language Processing/assignmnet 3/IMDB Dataset.csv')
nlp = spacy.load('en_core_w... | true |
d2bd8d1feb3b66bbed91f9873ee1464e13550c04 | Python | taylormitchell/roam_orbit | /tests.py | UTF-8 | 9,537 | 2.734375 | 3 | [] | no_license | import unittest
import datetime as dt
from roam_orbit import *
from date_helpers import strftime_roam
class TestRoamOrbiterManager(unittest.TestCase):
def setUp(self):
self.maxDiff=None
def test_init_review(self):
text = "Some thing I want to review later"
output = RoamOrbiterManager.f... | true |
e30cec65aac193e24a11f6d2ac130308ea74500a | Python | osandadeshan/python_training | /4_Inheritance/inheritance_1/shape.py | UTF-8 | 225 | 3.890625 | 4 | [] | no_license | class Shape:
def __init__(self, name):
self.name = name
def get_name(self):
print("Shape is a {}".format(self.name))
class Circle(Shape):
pass
circle1 = Circle("Circle")
circle1.get_name() | true |
3602022546198b4f0c6c4d4f55e6da0507d59301 | Python | dybber/forenings_medlemmer | /members/management/commands/find_families_without_email.py | UTF-8 | 635 | 2.75 | 3 | [] | no_license | from django.core.management.base import BaseCommand
from members.models.person import Person
from members.models.family import Family
class Command(BaseCommand):
help = 'Finds families who has no email at all and print the familys pk'
def handle(self, *args, **options):
for family in Family.objects.a... | true |
f89c83a49725c26bd9fa36a7f363c964c49cbd15 | Python | ckhoward/iNat-SDM | /id_string_getter.py | UTF-8 | 126 | 2.765625 | 3 | [
"MIT"
] | permissive | import csv
ids=[]
with open('taxon_list.txt','r') as f:
for x in f:
ids.append(x.strip().split('\t'))
print(ids) | true |
3bcd0ae6625da04f0a8706b8b0424c024d72a01c | Python | kenpu/2014-01-csci2020u | /lecture-code/2014-01-30-merge-sort/python/trysort.py | UTF-8 | 392 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import csci2020u.mergesort as merge
import sys
import helper
if len(sys.argv) == 3:
strlen = int(sys.argv[1])
arrlen = int(sys.argv[2])
else:
print "Usage: <strlen> <arrlen>"
sys.exit()
array = helper.makeArray(strlen, arrlen)
helper.resetTimer()
array2 = merge.sort(array)
t = helper.readTimerMillise... | true |
1012d9ead7acb4be96397633f17b6f7d6ff845c8 | Python | as8709/camstat | /camstat/groups.py | UTF-8 | 2,292 | 3.0625 | 3 | [
"MIT"
] | permissive | import abc
import collections
TIMESTAMP_COLUMN_INDEX = 1
CLASS_COLUMN_INDEX = 2
TOTAL_TIME_COLUMN_INDEX = 3
CHAIN_COLUMN_INDEX = 4
CHAIN_TIME_COLUMN_INDEX = 5
class GroupBase(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def group_rows(self, rows):
return
def group(self, groups):
... | true |
484b3327b5a2d0034f365ed52f5daac7ee02b9ad | Python | honeston/gomoku | /GomokuPlay.py | UTF-8 | 2,245 | 3.125 | 3 | [] | no_license | import numpy as np
class GomokuPlay:
def play(self,create_input):
board = self.create_base_stracter(self.BOARD_LENGTH,self.BOARD_LENGTH,0)
boardmask = self. create_base_stracter(self.BOARD_LENGTH,self.BOARD_LENGTH,1)
return self.main_loop(board,boardmask,create_input)
def crea... | true |
2eb2a9b13c9a9688032ee79d0b1e0916c6d4b85f | Python | HarrySng/itoi | /dbSetup/dbSetup.py | UTF-8 | 3,226 | 2.703125 | 3 | [
"MIT"
] | permissive | import sys
import mysql.connector
from mysql.connector import Error
def create_itoi_db(pswd):
connection = mysql.connector.connect(
host='localhost',
database='ITOI_DB',
user='root',
password=pswd)
queryList = [
"""
CREATE TABLE ORG (
ID INT NOT NULL PRIMARY KEY AUT... | true |
ab7ea763f5a0609cbec576c4bba1fd30e0d36959 | Python | rahuls321/ML-Projects- | /IRIS/6.Performance of ML wih Resampling/Leave One Out Cross Validation.py | UTF-8 | 682 | 3.34375 | 3 | [] | no_license | # Evaluate using Leave One Out Cross Validation
from pandas import read_csv
from sklearn.model_selection import LeaveOneOut
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression
filename = 'Iris.csv'
names = ['Id', 'SepalLengthCm', 'SepalWidthCm', 'PetalLengthCm',... | true |
0ae934dc7134fbe0e343d182c7af475db278d18d | Python | svfat/zendesk-status-notifier | /send_all.py | UTF-8 | 8,826 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
import requests
from utils import calculate_available_time
from datetime import timedelta
import logging
logging.basicConfig(filename="sender.log", level=logging.DEBUG)
try:
import config
except ImportError:
raise ImportError(msg="config.py not found")
from core import agents
DT_FORM... | true |
5395486e16930e81f78649dc5837665bd149f2e6 | Python | anto-pravin/Epilepsy-detection-using-ECG | /Dataset/convert-txt-to-csv.py | UTF-8 | 615 | 2.734375 | 3 | [] | no_license | from os import path
for i in range(1,420):
for j in [1,2,3]:
try:
txt_file = str(i)+'_'+str(j)+'.txt'
file_txt = open(txt_file)
directory = 'C:/Users/Anto Pravin/Desktop/sample/csv'
file_name = str(i)+'_'+str(j)+'.csv'
file_path = path.join(directo... | true |
199bcf8d16f3da10c847145937b5aba7c5e17c00 | Python | wan-h/Brainpower | /Code/leetcode/code/remove-covered-intervals.py | UTF-8 | 1,485 | 3.828125 | 4 | [] | no_license | # coding: utf-8
# Author: wanhui0729@gmail.com
# https://leetcode.com/problems/remove-covered-intervals/
'''
Given a list of intervals, remove all intervals that are covered by another interval in the list.
Interval [a,b) is covered by interval [c,d) if and only if c <= a and b <= d.
After doing so, return the number... | true |
0b956a7c506621da3478089f274c3e5ee29a2608 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_75/824.py | UTF-8 | 1,248 | 3.109375 | 3 | [] | no_license | #!/usr/bin/env python
#-*- coding: utf-8 -*-
def magicka(data):
data = data.split(" ")
data.reverse()
comb = list()
oppo = list()
for i in range(int(data.pop())):
s = data.pop()
comb.append(((s[0], s[1]), s[2]))
for i in range(int(data.pop())):
s = data.pop()
... | true |
ec3c28d882064b3434cf4c18760a5f5973bfce78 | Python | aveepsit/SnackDown19-Qualifier | /FndngTeam.py | UTF-8 | 729 | 2.734375 | 3 | [
"MIT"
] | permissive | for testcase in range(int(input())):
n = int(input())
dict = {}
comb = 1
m = (10**9)+7
for x in input().split():
no = int(x)
try:
dict[no] = dict[no] + 1
except:
dict[no] = 1
dict = list(dict.items())
dict.sort(key=lambda x: x[0], reverse=Tru... | true |
152a6ddcf413406e5368d929933869398c2226e2 | Python | Julian-Chu/leetcode_python | /leetcode/leetcode28.py | UTF-8 | 1,278 | 3.609375 | 4 | [] | no_license | from unittest import TestCase
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
if not needle:
return 0
n = len(needle)
for i in range(len(haystack) - n + 1):
if haystack[i:i + n] == needle:
return i
return -1
class Test... | true |
fd4cc95c8b1f6561d1eff683e97969b226f41c72 | Python | galoscar07/college2k16-2k19 | /1st Semester/Fundamentals of Programming /Seminary/Code/Problems Arthur/seminar09/controller/UndoController.py | UTF-8 | 1,439 | 3.375 | 3 | [] | no_license | class UndoController:
def __init__(self):
self._operations = []
self._index = -1
self._recorded = True
def recordOperation(self, operation):
if self.isRecorded() == True:
self._operations[-1].append(operation)
def newOperation(self):
if self.isRecord... | true |
f1379ec14e549553916186cb37ad15e21bb44f62 | Python | mrcx-pku/UER-py | /cloze.py | UTF-8 | 7,507 | 2.546875 | 3 | [] | no_license | # -*- encoding:utf-8 -*-
"""
This script provides an exmaple to wrap bert-pytorch for cloze test.
We randomly mask some characters and use BERT to predict.
"""
import sys
import torch
import argparse
import random
from bert.utils.act_fun import gelu
from bert.utils.constants import *
from bert.utils.tokenizer impor... | true |
1eb3b7fdd9d02eacd998b8c2b44f40980d3e6857 | Python | ujjwalmishra1987/python_project1 | /edx_exercise.py | UTF-8 | 3,263 | 3.84375 | 4 | [] | no_license |
'''n = 12
while n > 10:
print('Hello!')
n -= 2
while n >=2:
print(n)
n -= 2'''
'''end = 6
mysum = 0
while end > 1:
mysum += end
end -= 1
while end == 1:
mysum += end
print(mysum)
end -... | true |
5ba6f63c23f9f47013cc84dbe11a2eaca8ec4bb5 | Python | Shastri-Lab/DEAP | /deap/mappers.py | UTF-8 | 8,079 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | import numpy as np
from deap.helpers import bisect_min, getOutputShape
from deap.photonics import MRRTransferFunction
from deap.photonics import MRMTransferFunction
from deap.photonics import PWB
from deap.photonics import LaserDiodeArray
from deap.photonics import ModulatorArray
from deap.photonics import PWBArray
fr... | true |
ee88aa5637d7ea30db861439235a164ad29738f8 | Python | DenisChesnokov/SimpleTasks | /Matrix/NumbersOnDgnls.py | UTF-8 | 1,255 | 3.59375 | 4 | [] | no_license | #Fills diagonals of the matrix n * m with numbers from 1 to n * m.
n, m = map(int, input().split())
d_len = min(n, m)
count = 1
diagonals = []
mtrx = [[0] * m for _ in range(n)]
#Fills list of diagonals
for k in range(n + m -1):
if k < d_len: #Fills diagonals less than maximum diagonal lenth
diagona... | true |
73104fbd0e8eee18b9853445482cd4ac87af6b31 | Python | adiladnan327/CS563-Image-Analysis | /meanshift2.py | UTF-8 | 3,290 | 2.828125 | 3 | [] | no_license | import cv2
# Importing opencv library
import numpy as np
# Importing NumPy,which is the fundamental package for scientific computing with Python
img = cv2.imread('E:\Images\image1.ppm')
# Read the image from disk
cv2.imshow("Original image", img) # Display image
img_float = np.float32(img) # Convert image fro... | true |
a937b2bd53aec9d49f64976b33146633236010f3 | Python | syeeuns/week03 | /seung/danji_boj_2667.py | UTF-8 | 802 | 3.234375 | 3 | [] | no_license | import sys
sys.stdin = open("./seung/input.txt","r")
n= int(input())
matrix = [list(map(int,sys.stdin.readline().strip())) for _ in range(n)]
print("처음:")
for row in matrix:
print(row)
print("-----")
count = 0
danji_unit = 0
danji_lst = []
def danji_dfs(matrix,i,j):
global count,danji_unit
if 0<= i < n and... | true |
d97daa036ae959b53723e5416b0e9f922ab1a1b3 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/1238.py | UTF-8 | 1,383 | 2.859375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
"""
googjam1.py
Aditya
"""
import pdb
import sys
import getopt
from collections import defaultdict
def getOutput(g1, mat1, g2, mat2, case):
p1 = set(mat1[g1])
p2 = set(mat2[g2])
l1 =[k for k in (set(p1) - (set(p1) - set(p2)))]
l2 =[k for k in (set(p2) - (set(p2) - set(p1)))]... | true |
90e5bf8016f21b5b18aa620befc20a627beeb9b2 | Python | arup-group/genet | /genet/modify/change_log.py | UTF-8 | 7,544 | 2.75 | 3 | [
"MIT"
] | permissive | import pandas as pd
import dictdiffer
from datetime import datetime
from typing import Union, List
class ChangeLog(pd.DataFrame):
"""
Records changes in genet.core.Network into a pandas.DataFrame
Change Events:
• Add :
• Modify :
• Remove :
"""
def __init__(self, df=None):
if... | true |
4ac9ac2736b4eb381a421fc160222b2da85b70ce | Python | LPLhock/huobi_swap | /matploat/sigle_linear_regression_pic1.py | UTF-8 | 7,738 | 2.625 | 3 | [] | no_license | import pandas as pd
import matplotlib as mpl
from matplotlib import pyplot as plt
from collections import deque
from utils import sigle_linear_regression_util
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import copy
import talib
# 图形参数控制
import pylab as pl
impor... | true |
3aaf3b4d0e3c7e19cc0525d959b5b5ed5d782331 | Python | burrmit/python-practice-programs | /lesson10/pickleTest.py | UTF-8 | 554 | 3.671875 | 4 | [] | no_license | import pickle
outfile = open('data.txt', 'wb')
letters = ['a', 'b', 'c']
pickled_letters = pickle.dumps(letters)
print("Pickled letters stored as a string variable")
print(pickled_letters)
pickle.dump(letters, outfile)
outfile.close()
print("~" * 40)
print("Unpickled letters stored as a string variable")
unpickled_l... | true |
4d476638ca0c0374ead1b095efc2a4ea643d5340 | Python | surajkumar19/twitterSentimentAnalysis | /temp.py | UTF-8 | 445 | 2.6875 | 3 | [
"MIT"
] | permissive | import re
def clean(tweet):
tweet = re.sub('(http\S+)', '', tweet, flags=re.MULTILINE)
return ' '.join(re.sub("(@[A-Za-z0-9]+)|([^0-9A-Za-z \t]) | (\w +:\ / \ /+ \S +) ", " ", tweet).split())
tweet = "Apple's @hello https://t.co/WY97HGHyau next iPhone may #apple have a ‘secret weapon’ https://t.co/WY97H... | true |
774ed7311c0b92aa1c1bccef081676e94242a0c0 | Python | NamCheolKim/programmers | /programmers/level_1/String.py | UTF-8 | 167 | 3.6875 | 4 | [] | no_license | # 프로그래머스 Level 1 문자열 다루기 기본
s = "1234"
def solution(s):
return s.isdigit() and len(s) in (4, 6)
result = solution(s)
print(result)
| true |
b1d621b94ffd1e591bdf303cfacb4922a084380e | Python | Elkaito/HackerRank | /Python/Regex and Parsing/Group(), Groups() & Groupdict()/Solution.py | UTF-8 | 115 | 2.75 | 3 | [] | no_license | # Author: Kai Tanaka
import re
match = re.search(r"([a-z0-9])\1+", input())
print(match.group(1) if match else -1)
| true |
e2d39ccbf7278055484d5045657a2566469f7406 | Python | xuweixinxxx/HelloPython | /nowcoder/foroffer/Solution2.py | UTF-8 | 892 | 4.03125 | 4 | [] | no_license | '''
Created on 2018年1月17日
题目描述
输入一个链表,从尾到头打印链表每个节点的值。
知识点:链表
@author: minmin
'''
class ListNode:
def __init__(self, x):
self.val = x;
self.next = None
class Solution:
# 返回从尾部到头部的列表值序列,例如[1,2,3]
def printListFromTailToHead(self, listNode):
list1 = [listNode.val]
whi... | true |
c33da78bdc01dd19c2e72d2d9ac80f7a084d64a3 | Python | shubh24/WalmartCodesprint | /predict.py | UTF-8 | 1,171 | 2.75 | 3 | [] | no_license | import pickle
import csv
with open('cos_dict.pickle', 'r') as handle:
cos_dict = pickle.load(handle)
train = open("train_tag.csv", "r")
train_reader = csv.reader(train)
train_arr = {}
for row in train_reader:
if row[0] == "item_id":
continue
item = int(row[0])
shelf = list(row[... | true |
6947428a44ff6c52fa2d664163032b72ba2b1218 | Python | Alibek120699/BFDjango | /week1/CodeingBat/string2/end-other.py | UTF-8 | 272 | 3.03125 | 3 | [] | no_license | def end_other(a, b):
if len(a) == len(b):
return a == b
mn = min(len(a), len(b))
long_string = ''
short_string = ''
long_string = a if len(a)>len(b) else b
short_string = a if len(a)<len(b) else b
return short_string.lower() == long_string.lower()[-mn:]
| true |
038f33203efa4685f9da688ae750d43361bdd85e | Python | stockenja/holdem_hand_rank | /rank_holdem_hands.py | UTF-8 | 3,739 | 3.0625 | 3 | [
"MIT"
] | permissive | import json
import pandas as pd
import csv
NUM_PLAYER_LIST = ["6p", "9p"]
def transformHand(handsStr):
handList = handsStr.split(",")
hand1 = handList[0].strip()
hand2 = handList[1].strip()
hand1Num = hand1[0]
hand1Suit = hand1[1]
hand2Num = hand2[0]
hand2Suit = hand2[1]
# Data is ... | true |
7c4d6e9a06cd48d4b8878942da69f737bf190a48 | Python | happysmileboy/piro | /python-hw/2-10.py | UTF-8 | 179 | 2.71875 | 3 | [] | no_license | print("'응답하라 1988'은 많은 시청자들에게 사랑을 받은 드라마에요.");
print('데카르트는 "나는 생각한다. 고로 존재한다."라고 말했다.'); | true |
8de04dfd1d12abade9dd0d0afd7c2cba678cd986 | Python | chaosWsF/Python-Practice | /leetcode/0235_lowest_common_ancestor_of_a_binary_search_tree.py | UTF-8 | 1,776 | 4.1875 | 4 | [
"BSD-2-Clause"
] | permissive | """
Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two
nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be
a desc... | true |
52ace68557858e9532a86c1e853969c5367572c9 | Python | acheronfail/pyatvui | /index.py | UTF-8 | 5,408 | 2.859375 | 3 | [] | no_license | import asyncio
import curses
import pyatv
import sys
async def connect_to_atv(window, loop, i=0):
window.addstr(i, 0, 'Scanning for devices...')
window.refresh()
devices = await pyatv.scan(loop, timeout=5)
if not devices:
return await connect_to_atv(window, loop, i=i+1)
# TODO: support mu... | true |
f5cf90577b68d5668b3689776f6aa1afb34a7fb7 | Python | MJK0211/bit_seoul | /ml/m16_pipeline2.py | UTF-8 | 2,496 | 2.890625 | 3 | [] | no_license | #pipeline
import pandas as pd
from sklearn.model_selection import train_test_split, KFold, cross_val_score, GridSearchCV, RandomizedSearchCV
from sklearn.metrics import accuracy_score
import warnings
warnings.filterwarnings('ignore')
from sklearn.pipeline import Pipeline, make_pipeline #Pipeline, make_pipeline 추가 - S... | true |
c85d8c3a541b664681904a43e4974e723129c3e3 | Python | Jeky/thesis | /twcnb.py | UTF-8 | 3,428 | 2.609375 | 3 | [] | no_license | import numpy as np
from data import *
from scipy.sparse import csr_matrix as spmatrix
import utils
from sklearn.cross_validation import KFold
from sklearn.metrics import *
from numpy import log2
import sys
from multiprocessing import Pool
from collections import deque
def loadSparseDS():
return loadDataset(PATH + ... | true |
503db8857ab80c5ce7307b2f4bfccd5155bf9fbf | Python | CityOfZion/neo-smart-contract-examples | /examples/python/constant/local_variable.py | UTF-8 | 675 | 2.71875 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | """
Date Created: 2018-03-08
Date Modified: 2018-03-08
Version: 1
Contract Hash: f8c1e4600b8f9a08b015c7c549f0eeeb1e2d8b61
Available on NEO TestNet: False
Available on CoZ TestNet: False
Available on MainNet: False
Example:
Test Invoke: ... | true |
60520d46cc76b110a83f8fc61dd4f31711f8fc68 | Python | juanibutter/Curso_2 | /#37 - IG V.py | UTF-8 | 2,511 | 3.625 | 4 | [] | no_license | #Widgets text y button
from tkinter import *
raiz=Tk()
myframe=Frame(raiz, width=1280, height=720)
myframe.pack()
#Cuadros
minombre=StringVar()#Esto tiene que ver con el boton
cuadronombre=Entry(myframe,textvariable=minombre)
cuadronombre.grid(row=0, column=1)
cuadronombre.config(fg="red", justify="center")
cuadr... | true |
b80208ff4af4213dd0c385f2632a94d9c55c1701 | Python | shanlihou/pythonFunc | /addLogMutex/addLogMutex.py | UTF-8 | 545 | 2.671875 | 3 | [] | no_license | import sys
import re
def addLogMutex(fileName):
pattern = re.compile(r'm_Mutex')
fileRead = open(fileName, 'r')
fileWrite = open(fileName + '.new', 'w')
strLog = 'errorf("shanlihou mutex add line:%d\\n", __LINE__);\n';
strLogEnd = 'errorf("shanlihou mutex add enter line:%d\\n", __LINE__);\n';
for line in fileRead... | true |
0b61000728d656c70ed81f9d73a6a160f0cdbf08 | Python | Drakoula/poulstar | /term2/example_clock.py | UTF-8 | 269 | 3.03125 | 3 | [] | no_license | from time import sleep
secend = 0
mineute = 0
hour = 0
while True:
secend += 1
print(hour,":",mineute,":",secend)
sleep(1)
if secend == 59:
mineute += 1
secend = 0
if mineute == 59:
hour += 1
mineute = 0
| true |
680f8836ac0bbd04885654679c80214b67a78e07 | Python | masadmalik71/countries_name_json_maker | /main.py | UTF-8 | 3,097 | 2.84375 | 3 | [] | no_license | import pandas
import json
# deals with input file which have countries and languages
re_countries_dataframe = pandas.read_csv("required Countries.txt")
df_re_countries_dataframe = pandas.DataFrame(re_countries_dataframe)
countries_and_languages = df_re_countries_dataframe.columns.tolist()
countries_and_languages_r = [... | true |
b60f1a31cee7b20a7259f9f6e1da9f6299a0fd30 | Python | eguldur/gaih-homework-final-repo | /Homeworks/HW3.py | UTF-8 | 5,287 | 3.328125 | 3 | [] | no_license | #Explain your work
"""
Generate dataset using make_classification function in the sklearn.datasets class. Generate 10000 samples with 8 features (X) with one label (y). Also, use following parameters
n_informative = 5
class_sep = 2
random_state = 42
Explore and analyse raw data.
Do preprocessing for classification.
Spl... | true |
50eae25f360ac23ebb82bf94e067efb39a6dbb67 | Python | maxjing/LeetCode | /Python/895.py | UTF-8 | 598 | 3.359375 | 3 | [] | no_license | class FreqStack:
def __init__(self):
self.d = {}
self.maxHeap = []
# use as sequence
self.count = 0
def push(self, x: int) -> None:
self.count += 1
self.d[x] = self.d.get(x, 0) + 1
heappush(self.maxHeap, (-self.d[x], -self.count, x))
def pop(self) -> ... | true |
54c193b758b174df3c5507b2d179f25562e4b41b | Python | SkyLHtech/WEB_REGX | /data_random/password_random.py | UTF-8 | 1,571 | 3.15625 | 3 | [] | no_license | import random
import string
import sys
import createfile as cf
def str_chinese():
val = random.randint(0x4e00,0x9fa5) #(0x4e00,0x9fa5) = Chinese
return chr(val)
def str_korean():
val = random.randint(0xac00,0xd7a3) #(0x3130,0x318f) = Korean
return chr(val)
# def str_janpanese():
# val = rand... | true |
6e99339a106a19b9ae526f557baf8c964b34faac | Python | sholaybhature/hindu_texts | /scripts/Ramayana/YuddhaKanda/yuddhakanda.py | UTF-8 | 2,851 | 2.625 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
import nltk
import re
import pandas as pd
import xlrd
import numpy as np
from PIL import Image # To open image
from wordcloud import WordCloud, ImageColorGenerator # To make WordCloud
from collections import Counter
import os
from cltk.stop.sanskrit.stops impor... | true |
3d3023f144feb2349d9e61e24f643237d8c16033 | Python | mitnk/euler | /python/p019.py | UTF-8 | 243 | 2.9375 | 3 | [] | no_license | from datetime import date, timedelta
d1 = date(1901, 1, 1)
d2 = date(2000, 12, 2)
count = 0
while 1:
if d1 == d2:
break
if d1.day == 1 and d1.weekday() == 6:
count += 1
d1 += timedelta(days=1)
print count
| true |
f813a0b73ee17ab90a1abe9c552a79dc61f16214 | Python | jorgesmu/algorithm_exercises | /others/ways_to_decode_message.py | UTF-8 | 1,606 | 2.984375 | 3 | [] | no_license | # Asumming message containg digits only.
# O(n)
# In this case we would need to implement it with a hashmap as we dont want to store a vector full
# of 0's because most likely (assuming) the distribution for a given lenguage will be not uniformed
# distributed and a lot of combinations wont be used.
def ways_to_decode(... | true |
c18f0624d89b9677e1dcc0af0ffd7506ccc29f18 | Python | crystalplaza/Credit-Card-Fraud-Dection | /creditcard.py | UTF-8 | 25,435 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# ## Credit Card Fraud Detection
# Three predictive models to see how accurate they are in detecting whether a transaction is legit or fraud.
# - Support vector machine
# - Random Forest
# - Logistic Regression
# Two Approaches are applied to handle the inbalanced dataset
# - Und... | true |
9d41388c432f2e4d67463ad205205399de0fe5c9 | Python | hakami1024/femicide | /wsgi.py | UTF-8 | 707 | 2.78125 | 3 | [] | no_license | import re
from multiprocessing import Process
from time import sleep
from flask import Flask
from news_crawler import crawl
application = Flask(__name__)
_link = re.compile(r'(https?://\S+)', re.I)
def convert_links(text):
def replace(match):
groups = match.groups()
return '<a href="{0}" targe... | true |
bc860786b61848d9b6b1f161d549ec9a9fb2bac6 | Python | csdev/datacheck | /tests/unit_tests/test_type.py | UTF-8 | 971 | 2.578125 | 3 | [
"MIT"
] | permissive | from __future__ import (absolute_import, division,
print_function, unicode_literals)
import unittest
from datacheck.core import Type
from datacheck.exceptions import SchemaError, TypeValidationError
class TestType(unittest.TestCase):
def test_type_ok(self):
t = Type(int)
... | true |
b15e7d4916aa1c81a3c168594b9e42fb52397a7a | Python | D-vid-1997/beautiful-soup | /main.py | UTF-8 | 699 | 3.1875 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
response = requests.get('https://www.empireonline.com/movies/features/best-movies-2/')
website_html = response.text
soup = BeautifulSoup(website_html, 'html.parser')
movie_titles = soup.find_all(name='h3', class_='title')
reverse_movie_list = [movie.getText() for movie i... | true |
04c224138b5054164990947010fc3ef72104b0f6 | Python | smohapatra1/scripting | /python/practice/start_again/2021/01082021/Binary_Decimal_Vice_Versa.py | UTF-8 | 529 | 3.9375 | 4 | [] | no_license | # Write script to convert decimal to Binary and vice versa
def convert(b,d):
#Decimal to Binary
print ("Decimal to Binary - ", bin(d)[2:])
#Binary to Decimal
ar = [int(i) for i in b]
ar = ar[::-1]
result = []
for i in range(len(ar)):
result.append(ar[i]*(2**i))
Total = sum(... | true |
22d78a3c09b30f739f1cb19472e29f0e7bf17d3a | Python | yavoratanassov/softuni_python_fundamentals | /14_functions_exercise/factorial_division.py | UTF-8 | 267 | 4.0625 | 4 | [] | no_license | def calc_factorial(n):
result = 1
for num in range(2, n+1):
result *= num
return result
a = int(input())
b = int(input())
a_factorial = calc_factorial(a)
b_factorial = calc_factorial(b)
result = a_factorial / b_factorial
print(f"{result:.2f}") | true |
9a52c7764b5ab862ce8d290035ba6ab7b064cf72 | Python | yyht/BERT | /t2t_bert/utils/tensor2tensor/utils/misc_utils.py | UTF-8 | 1,305 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# 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... | true |
bdede940644659db08c74cc13369a00b5dae0afe | Python | yuzixun/algorithm_exercise | /main/20170419-114.py | UTF-8 | 812 | 3.421875 | 3 | [] | no_license | from tree_generator import TreeGenerator
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
prev = None
def __init__(self):
Solution.prev = None
def fla... | true |
f3878b97a571971c5a7cdbc0f90ed94f2ffd5f7d | Python | tgrie/ABB_Webservice | /RestAPITestingSignals.py | UTF-8 | 3,726 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 10:48:11 2019
@author: KRDOKIM13
"""
import sys, requests, json
from requests.auth import HTTPDigestAuth
#import parse
class methods:
def __init__(self,host,username,password,payload,dataType):
self.host=host
self.username=username
... | true |