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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a35d84c078796a37977697c5e1b81e714406650d | Python | Boberkraft/Data-Structures-and-Algorithms-in-Python | /chapter5/R-5.7.py | UTF-8 | 352 | 3.484375 | 3 | [] | no_license | """
Let A be an array of size n ≥ 2 containing integers from 1 to n−1, inclusive,
with exactly one repeated. Describe a fast algorithm for finding the
integer in A that is repeated.
i think there was a question like this before.
My solution is O(n)
1. a <- Sum all the numbers
2. b <- Use formula for sumarization (n^2 ... | true |
a6d6e920937ed3713dc80298a9055fdea9105332 | Python | Bubai-Rahaman/CP_2020_Assignment2 | /question_8.py | UTF-8 | 2,606 | 3.28125 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.integrate import solve_bvp as bvp
#1st equation
def fun1(x,y):
return np.vstack((y[1], -np.exp(-2*y[0])))
def bc1(ya,yb):
return np.array([ya[0], yb[0]-np.log(2)])
def y1_true(x):
return np.log(x)
#2nd equation
def fun2(x,y):
return np.vstack((y[1]... | true |
848bf8e1d7225a187e427792f28b54e4326fbb50 | Python | skshoyeb/wop-dev-py | /main.py | UTF-8 | 2,726 | 2.59375 | 3 | [] | no_license | from flask import Flask, request
from flask_cors import CORS, cross_origin
import json
import base64
import requests
import logging
from db import add_to_fb, user_signup, get_posts, user_login, get_user_data, update_favs, upload_to_storage, get_post_by_id
from textAnalysis import get_sentiment_info
app = Flask(__name_... | true |
2410e9f4f01847bdcb964ed9b32d731e39e9d551 | Python | lichao666500/-algorithm015 | /Week_09/reverseStr.py | UTF-8 | 314 | 3.03125 | 3 | [] | no_license | class Solution(object):
def reverseStr(self, s, k):
"""
:type s: str
:type k: int
:rtype: str
"""
result=''
for i in range(0,len(s),2*k):
tmp=s[i:i+k]
tmp=tmp[::-1]+s[i+k:i+2*k]
result=result+tmp
return result
| true |
a30bed534655cf68cc9caf11b3fbedf775bf078d | Python | bsets/Distributed_ML_with_PySpark_for_Cancer_Tumor_Classification | /Tumor_Gene_Classification_using_Multinomial_Logistic_Regression/csv2libsvm1.py | UTF-8 | 1,761 | 3.09375 | 3 | [
"CC0-1.0"
] | permissive | #!/usr/bin/env python
"""
Convert CSV file to libsvm format. Works only with numeric variables.
Put -1 as label index (argv[3]) if there are no labels in your file.
Expecting no headers. If present, headers can be skipped with argv[4] == 1.
"""
import sys
import csv
import operator
from collections import defaultdic... | true |
0e3bfdebf524014edcbb94e4b57c0eb091361c66 | Python | bmiltz/cascade-at | /src/cascade_at/inputs/utilities/covariate_weighting.py | UTF-8 | 7,579 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
from intervaltree import IntervalTree
from cascade_at.core.log import get_loggers
from cascade_at.inputs.utilities.gbd_ids import make_age_intervals, make_time_intervals
from cascade_at.inputs import InputsError
LOG = get_loggers(__name__)
class CovariateInterpolationError(InputsError):
"""Ra... | true |
2487a7143d69e90a633d79ce9dd4a23b6d7b707e | Python | czarjulius/Prime_Factor_py | /test_prime_factor.py | UTF-8 | 757 | 3.140625 | 3 | [] | no_license | from unittest import TestCase
from prime_factor import PrimeFactor
class TestFactor(TestCase):
def test(self):
self.assertEquals(True, True)
def test_0(self):
self.assertEquals(PrimeFactor.of(0), [])
def test_1(self):
self.assertEquals(PrimeFactor.of(1), [])
def test_2(self):... | true |
adf3b7eb59d104a19edc908a3dbdad7a04abb5b5 | Python | saggarwal98/Practice | /Python/sets.py | UTF-8 | 95 | 3.109375 | 3 | [] | no_license | set1={1,2,3,4}
print(set1)
print(type(set1))
set1.add(5)
print(set1)
set1.remove(5)
print(set1) | true |
64b5a41fd6d42b7a2ddde74a2e927a5a9645cc28 | Python | Deviantjroc710/py_automate_indeed | /py_indeed.py | UTF-8 | 3,069 | 2.796875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | #######################################################################################
#
# Author: Conner Crosby
# Description:
# The purpose of the code written is to automate the process of applying to jobs
# on Indeed that can be applied via a 'Indeed Resume'.
#
#
###########################... | true |
e8afc9accb33eeb046cc604b64c35cfade133873 | Python | raulgsalguero82/GithubActions | /tests/test_persona.py | UTF-8 | 2,548 | 2.828125 | 3 | [] | no_license | import unittest
import datetime
from Comunidad.Persona import Persona
from Comunidad.Base import Base, Session
class Test_persona(unittest.TestCase):
def test_prueba(self):
self.assertEqual(1, 1)
def setUp(self):
self.persona1 = Persona(nombre='Alejandra', edad=25)
self.persona2 = Pe... | true |
da49b6b31206d77fbf73ee5d7a7d2a143960b382 | Python | f981113587/Python | /Aula 14/Desafios/067.py | UTF-8 | 530 | 4.09375 | 4 | [] | no_license | """
Faça um programa que mostre a tabuada de vários números,
um de cada vez, para cada valor digitado pelo usuário. O
programa será interrompido quando o número solicitado for
negativo.
Fica
Fica, me queira e queira ficar
Fica
Faz o que quiser de mim
Contanto que não falte tempo pra... | true |
3b7077da5ff8c1106178e76148ea4c170da4a78e | Python | kaixinhouse/pycollections | /utils/xlogger.py | UTF-8 | 4,405 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import sys
import os
import os.path
import logging
import logging.handlers
fmt_standard = logging.Formatter('%(asctime)s %(message)s')
fmt_compact = logging.Formatter("%(asctime)s [%(process)d][%(threadName)s] %(message)s")
fmt_full = logging.Formatter("%(asctime)s %(levelname)s [%... | true |
6cba87d9e594ca10e849124f2333fdbd9f5675a0 | Python | lucipherM/hackerrank | /algo/arrays_and_sorting/counting_sort_3.py | UTF-8 | 510 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
def print_int_list(l):
print " ".join(map(str, l))
def frequences(a):
c = [0] * (max(a) + 1)
for i in a:
c[i] += 1
return c
def starting_points(c):
len_c = len(c)
for idx in range(1, len_c):
c[idx] = c[idx - 1] + c[idx]
return c
if __name__ == '__m... | true |
4a88fb175be8fdeab2e1c8c228466ee4cc09ae4a | Python | alidashtii/python-assignments | /mhmd13.py | UTF-8 | 429 | 3.671875 | 4 | [] | no_license | def count(x):
length = len(x)
digit = 0
letters = 0
lower = 0
upper = 0
for i in x:
if i.isalpha():
letters += 1
elif i.isnumeric():
digit += 1
elif (i.islower()):
lower += 1
elif (i.isupper()):
upper += 1
el... | true |
f25761eb760256d73c003fdf2c10a74352944413 | Python | tejasvm123/Digital_Clock.py | /Digital_Clock.py | UTF-8 | 708 | 3.265625 | 3 | [] | no_license | import time
import datetime as dt
import turtle
t = turtle.Turtle()
t1 = turtle.Turtle()
s = turtle.Screen()
s.bgcolor("white")
sec = dt.datetime.now().second
min = dt.datetime.now().minute
hr = dt.datetime.now().hour
t1.pensize(5)
t1.color('purple')
t1.goto(-20,0)
t1.pendown()
for i in rang... | true |
ec5f2dd176365026f0bf90616c422f1562f3a34a | Python | LArbys/thrumu | /wire_matches_extra_tolerances.py | UTF-8 | 7,464 | 3.109375 | 3 | [] | no_license | import math
import numpy as np
def wire_matching_algo(plane1toplane2_tolerance, plane1toplane3_tolerance, plane2toplane3_tolerance):
fin = open("output_with_y.txt")
lines = fin.readlines()
str_data_list = []
instance_list = []
plane_num_list = []
wire_num_list = []
y_start_list = []
... | true |
100c55f3fdb304ad9b1f170946567a8f7dc1e05a | Python | shenmishajing/minisql | /bplustree.py | UTF-8 | 11,924 | 3.734375 | 4 | [] | no_license | import random
#size = 5 # 为节点中存储的记录数
class TreeNode:
def __init__(self, size):
self.__size = size
self.keys = []
self.next = None
self.parent = None
self.pointers = []
def is_full(self):
return len(self.keys) == self.__size
def is_empty(self):
r... | true |
fbb447a35ce410e023c0add18df34ffcc3dfb1fe | Python | eldoria/Reinforcement_learning | /drl_sample_project_python/drl_lib/to_do/line_world_mdp.py | UTF-8 | 605 | 2.546875 | 3 | [] | no_license | import numpy as np
def reset_line_world():
NB = 5
S = np.arange(NB)
A = np.array([0, 1]) # 0 = Gauche et 1 = Droite
R = np.array([-1, 0, 1])
p = np.zeros((len(S), len(A), len(S), len(R)))
for i in range(1, NB - 2):
p[i, 1, i + 1, 1] = 1.0
for i in range(2, NB - 1):
p[i,... | true |
fd94d2ed64bd6e832c4f8320e19654ad0d8d58b0 | Python | 12wb/OpenCV | /U4/人脸识别.py | UTF-8 | 7,806 | 3.09375 | 3 | [] | no_license | # import cv2
# import os
# import numpy as np
#
#
# # 检测人脸
# def detect_face(img):
# # 将测试图像转换为灰度图像,因为opencv人脸检测器需要灰度图像
# gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
#
# # 加载OpenCV人脸检测分类器Haar
# face_cascade = cv2.CascadeClassifier('./haarcascade_frontalface_default.xml')
#
# # 检测多尺度图像,... | true |
bf4da9267496e3fdfeb3f5be0bb1a12143c69882 | Python | 635r/CSE | /Class notes.py | UTF-8 | 1,666 | 4.03125 | 4 | [] | no_license | # # # Defining a Class
# # class Cat(object):
# # # TWO UNDERSCORES BEFORE AND AFTER
# # def __init__(self, color, personality, pattern):
# # # THINGS THAT A CAT HAS
# # self.color = color
# # self.personality = personality
# # self.pattern = pattern
# # self.state = "hap... | true |
2d6f82cdeb18386f821972958debf906078e412f | Python | alexeipolovin/kids_zadachki | /fourth.py | UTF-8 | 1,876 | 3.09375 | 3 | [] | no_license | import os
from os import walk
from os.path import getsize
from os.path import getctime
def fourth_walk():
f = []
for (dirpath, dirnames, filenames) in walk('./'):
f.extend(filenames)
break
print(sorted(f))
size_list = []
for i in f:
size_list.append(getsize(i))
for j ... | true |
09ddf7f1f714223d03fddcf54c27b076dc48f8e9 | Python | Acuf5928/SimpleLanguage | /SimpleLanguage/code_helper.py | UTF-8 | 1,331 | 2.609375 | 3 | [
"MIT"
] | permissive | import json
import os
from glob import glob
from typing import List
from SimpleLanguage.code_exceptions import DatabaseNotFoundException
def foundDatabasesList(basePath: str) -> List[str]:
"""
return a list of all path of all files .json in a folder (excluding sub folder)
:param basePath: Path of the fo... | true |
9eda76f1774c05fe6c8a6d4c76c49b4def2a6db4 | Python | ziemowit141/GeneticAlgorithm | /main.py | UTF-8 | 3,046 | 3.359375 | 3 | [] | no_license | from Point import PositivePoint, NegativePoint, get_x, get_y
import matplotlib.pyplot as plt
from Function import Function
from DriverCode import algorithm, NUMBER_OF_POINTS
import numpy as np
def generate_points():
points_list = []
positive_points_list = []
negative_points_list = []
for _ ... | true |
55f45071fc173f27342e87c6de5b990869e2931d | Python | falconsmilie/Raspberry-Pi-3-Weather | /models/weatherRS.py | UTF-8 | 8,979 | 2.765625 | 3 | [
"MIT"
] | permissive | from contracts.abstractBaseRS import AbstractBaseRS
from models.weatherRSListItem import WeatherRSListItem
from models.weatherRSListItemForecast16 import (
WeatherRSListItemForecast16
)
from utils.weatherJson import WeatherJson
class WeatherRS(AbstractBaseRS):
""" Reads a server response, or cached file, weat... | true |
db17154b8bb3c59855a61c3d39ada550f15dd795 | Python | rahuladream/job-hunt-practice-2020 | /array/monkAndInversion.py | UTF-8 | 1,044 | 3.453125 | 3 | [] | no_license | """
find out the number of inversion in the matrix M.
defined as the number of unordered pairs of cells
{(i,j), (p,q)} such that M[i][j] & i <=p & j<=q
2 => no of testcase
3 => 3 * 3 matrix input
1 2 3
4 5 6
7 8 9
2 => 2 * 2 matrix input
4 3
1 4
t=int(input())
while(t):
n=int(input())
a=[]
ct=0
for... | true |
591426b77134dd196fd0cd0e5f4d138a7bf00054 | Python | HBinhCT/Q-project | /hackerearth/Data Structures/Disjoint Data Structures/Basics of Disjoint Data Structures/Students and their arrangements (CAST)/solution.py | UTF-8 | 1,084 | 2.828125 | 3 | [
"MIT"
] | permissive | from collections import deque
def find(u, parents):
while u != parents[u]:
parents[u] = parents[parents[u]]
u = parents[u]
return u
def union(u, v, parents, ranks):
pu = find(u, parents)
pv = find(v, parents)
if pu == pv:
return
if ranks[pu] < ranks[pv]:
paren... | true |
03550e7caa00e9b937163a260a4b83c04d852cef | Python | vbondarevsky/ones_analyzer | /analyzer/expression/binary_expression_syntax.py | UTF-8 | 879 | 3.25 | 3 | [
"MIT"
] | permissive | from analyzer.syntax_kind import SyntaxKind
class BinaryExpressionSyntax(object):
def __init__(self, left, operator_token, right):
if operator_token.kind == SyntaxKind.MinusToken:
self.kind = SyntaxKind.SubtractExpression
elif operator_token.kind == SyntaxKind.PlusToken:
se... | true |
1cb933f40081286c7e9cd2659ed72c25961069b1 | Python | Smok323/PiSecurityCam | /website/picam.py | UTF-8 | 368 | 2.640625 | 3 | [] | no_license | from picamera import PiCamera
from picamera.array import PiRGBArray
import cv2
class Camera:
def __init__(self):
self.cam = PiCamera()
self.cap = PiRGBArray(self.cam)
def getframe(self):
self.cam.capture(self.cap, format="BGR")
image = self.cap.array
jpeg = cv2.imdecod... | true |
07785da6f1f4d3a5e751027f42a676ff939d25a0 | Python | julvei/eth-assertion-protocol | /assertion/functions.py | UTF-8 | 1,724 | 3.1875 | 3 | [
"MIT"
] | permissive | """
Author: JV
Date: 2021-04-26
Holds all the functions for validation
"""
from typing import Sequence
class FunctionEntry:
def __init__(self, function_id : int, name : str, function):
self.function_id = function_id
self.name = name
self.function = function
class Functions:
def __ini... | true |
7d43bc0d7abd3b054d765314aa3c5826381dd1d8 | Python | wangr0031/mytools | /src/myxlsx.py | UTF-8 | 3,594 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
__author__ = 'wangrong'
import xlrd
import xlwt
import os, re
from lib.logger_def import logger
class myxlsx(object):
def __init__(self, src_path):
if src_path[-1] == '/':
src_path = src_path[:-1]
self.src_file_list = self.list_all_files(s... | true |
7c513574261b2595ea170d7faff1b2207b9fcec0 | Python | JoshOY/DataStructureCourseDesign | /PROB10/my_sort/mergeSort.py | UTF-8 | 907 | 3.3125 | 3 | [
"MIT"
] | permissive | import copy
merge_step = 0
def merge_sort(sorting_list):
global merge_step
if(len(sorting_list) <= 1):
return sorting_list
def merge(left, right):
global merge_step
rtn = []
while len(left) != 0 and len(right) != 0:
rtn.append(left.pop(0) if left[0] <= right[0] ... | true |
3cba0b3f18eef84b1075d6026693bde60db3c820 | Python | rodrigorahal/advent-of-code-2017 | /10-14/knot_hash_part_1.py | UTF-8 | 1,113 | 3.5625 | 4 | [] | no_license | from itertools import cycle, islice
def tie_knot(elements, pos, length, skip):
size = len(elements)
selected = []
for i in range(pos, pos+length):
if i < size:
selected.append(elements[i])
else:
selected.append(elements[i-size])
for i, el in zip(range(pos, pos+l... | true |
deaba2fc43d825ff05d75c2fa62451ddd62f9356 | Python | Ilovelibrary/Restaurants-Web-Server-based-on-Python | /project.py | UTF-8 | 4,987 | 2.578125 | 3 | [] | no_license | from flask import Flask, render_template, request, redirect, url_for, flash, jsonify
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from database_setup import Base, Restaurant, MenuItem
app = Flask(__name__)
engine = create_engine('sqlite:///restaurantmenu.db')
Base.metadata.bind = engin... | true |
ca2880b761ee3656e3ad941670074f9a56c57cd6 | Python | pelennor/python-holidays | /holidays/countries/vietnam.py | UTF-8 | 3,510 | 3.09375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.montel@gmail.com> (c) 201... | true |
5e9840edaad1e9797434fcb981c2d862eda43599 | Python | abhi-laksh/spotify-clone-react | /src/assets/sass.py | UTF-8 | 898 | 3.21875 | 3 | [] | no_license | #--- DATE : April 08, 2019 | 22:33:19
#--- --- By Abhishek Soni
#--- About (also write in below variable): Execute Sass command
about='Execute Sass command'
print('About :' + about)
import os
curDir = os.getcwd()
dirs = os.walk(curDir)
def checkFile(allDirs):
scssFile = ""
cssFile = ""
for root , d , files in l... | true |
e778d1d3d567c8e022d247c9a7ae263215ec8223 | Python | yangahxu/Python | /课堂练习/第4关 收纳的艺术.py | UTF-8 | 3,270 | 3.390625 | 3 | [] | no_license | # students = ['党志文', '浦欣然', '罗鸿朗', '姜信然', '居俊德', '宿鸿福', '张成和', '林景辉', '戴英华', '马鸿宝', '郑翰音', '厉和煦', '钟英纵', '卢信然', '任正真', '翟彭勃', '蒋华清', '双英朗', '金文柏', '饶永思', '堵宏盛', '濮嘉澍', '戈睿慈', '邰子默', '于斯年', '扈元驹', '厍良工', '甘锐泽', '姚兴怀', '殳英杰', '吴鸿福', '王永年', '宫锐泽', '黎兴发', '朱乐贤', '关乐童', '养永寿', '养承嗣', '贾康成', '韩修齐', '彭凯凯', '白天干', '瞿学义', '那同济'... | true |
04c9de054bf3b9225dbcc1d1f09435ff6a413b60 | Python | shreyakarthik1210/Number-guesser | /numGuess.py | UTF-8 | 401 | 4.34375 | 4 | [] | no_license | import random
topNum = int(input("Please type the maximum number you would like to have in the game: "))
number = random.randint(1,topNum)
while True:
userInput = input("Please type in your guess for the random number: ")
if int(userInput) == number:
print("You got the right number!")
break;
elif int(userInput) ... | true |
ec065b6f4fc705d2168069054c6a586655a9eeff | Python | Lingesh2311/Python-Basics | /Generators_Python/CHAPTER 2/ch02_01.py | UTF-8 | 262 | 3.15625 | 3 | [] | no_license | # Basic Context Manager Framework
from contextlib import contextmanager
@contextmanager
def simple_context_manager(obj):
try:
# do something
obj.some_property += 1
yield
finally:
# wrap up
obj.some_property -= 1
| true |
6d66abd83783f5f028d925db692d2fc069238d64 | Python | arnav8/Bp_Regression_FireworksAlg | /Fireworks.py | UTF-8 | 6,530 | 3.375 | 3 | [] | no_license | #encoding=utf-8
#Date 2017.5.19
#Fireworks Algorithm
from Utils import *
'''Firework algorithm
The purpose is to get better initial values of neural network parameters through the firework algorithm, and then use gradient descent for iteration
parameter:
X: training set sample collection, numpy array
Y: training sect... | true |
2919f0e83762a656160e508c47dddf734e31cc3b | Python | HappyRocky/pythonAI | /LeetCode/141_Linked_List_Cycle.py | UTF-8 | 1,486 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Given a linked list, determine if it has a cycle in it.
To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the linked list where tail connects to.
If pos is -1, then there is no cycle in the linked list.
给定一个链表,判断是否存在一个环。
为了表示... | true |
c508935cb092339e60428846245b5980296ff387 | Python | freysner/freysner | /skip_search.py | UTF-8 | 733 | 3.171875 | 3 | [] | no_license | ASIZE=256
def ArrayCmp(a,aIdx,b,bIdx,Length):
i = 0
while(i < Length and aIdx + i < len(a) and bIdx + i < len(b)):
if (a[aIdx + i] != b[bIdx + i]):
return 1
i+=1
if (i== Length):
return 0
else:
return 1
def SKIP(x,y):
resultado=[]
m=len(x)
n=len(y)
z=[]
for... | true |
a05a02bee65ba4708ea45721f89f224cfc0dbc16 | Python | itagaev/webdev2019 | /10 week/hackerrank/7.py | UTF-8 | 267 | 3.21875 | 3 | [] | no_license | if __name__ == '__main__':
n = int(raw_input())
arr = map(int, raw_input().split())
max = -110
for x in arr:
if(max < x):
max = x
secmax = -110
for x in arr:
if max == x:
continue
if secmax < x:
secmax = x
print(secmax) | true |
db94148e1d11187307d30838842f5432a7153d89 | Python | michael-swift/btreceptor | /build/lib/btreceptor/clustering.py | UTF-8 | 2,194 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | from __future__ import division
import pandas as pd
import numpy as np
import Levenshtein
from scipy.spatial.distance import squareform
from scipy.sparse.csgraph import connected_components
from itertools import combinations
def df_pw_edit(frame):
""" Returns array of pairwise edit distances in square form """
... | true |
d6307c4a2d7f970c35c17bd542fb55a1d9c0b565 | Python | avados/scrumtools | /burnup/features/steps/test_burnup_feature.py | UTF-8 | 2,638 | 2.828125 | 3 | [] | no_license | from behave import *
from burnup.utils import *
from hamcrest import *
from behave import register_type
import parse
use_step_matcher("parse")
# -- REGISTER: User-defined type converter (parse_type).
register_type(NumberList=parse_list_of_number)
@given('i have a "{list:NumberList}" of numbers')
def step_impl... | true |
f1d2d480574e64580ce7b1a9c95a98f40c9c011d | Python | hamidmoghadam/thesis | /tyrion2/lstm.py | UTF-8 | 6,572 | 2.875 | 3 | [] | no_license | '''
A Recurrent Neural Network (LSTM) implementation example using TensorFlow library.
This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/)
Long Short Term Memory paper: http://deeplearning.cs.cmu.edu/pdfs/Hochreiter97_lstm.pdf
Author: Aymeric Damien
Project: https://github... | true |
f369631d63c295bd45ad116d527361cf495e5559 | Python | wangzimeng/weekends | /day4/readCsv2.py | UTF-8 | 2,363 | 3.515625 | 4 | [] | no_license | # 1.之前的csv文件不能被其他testcase调用,所以应该给这段代码封装到一个方法里
# 2.每个testcase路径不同,所以path应该作为参数传到这个方法中
#
# 4.打开了一个文件,但是并没有关闭,造成内存泄露
import csv
import os
def read(file_name):
# 所有重复代码的出现都是程序设计的不合理
# 重复的代码应该封装到一个方法里
current_file_path = os.path.dirname(__file__)
path = current_file_path.replace("day4", "data/" + file_name)... | true |
ac26959f1d735a1fa54add3ebe69640a2dd8d759 | Python | Sonia22545/python-programs | /sum_of_digits.py | UTF-8 | 221 | 4.3125 | 4 | [] | no_license | x = input(" Enter the integer :") # asking for the integer from the user
sum = 0
for i in x: # iterating the integer with a for loop
sum = sum + int(i) # taking the sum of the digits
print(sum) # printing the sum
| true |
b5c158a3ae82d7afd7e21d3ac0b19075d6d9add2 | Python | WallaceLiu/plantask | /coreNewAdjMatrix.py | UTF-8 | 6,739 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 30 11:43:31 2017
@author: liuning11
"""
from coreNewAdj import coreNewAdj
from nodeAdjMatrix import nodeAdjMatrix
import datetimeUtil
import random
class coreNewAdjMatrix(coreNewAdj):
"""创建新的任务图
"""
minmax = None
modelGraph = nodeAdjMatrix()
def __... | true |
b74513fb6699f6e13f593109b05de3e8ae3b2421 | Python | Code7unner/SuschenkoBot | /model.py | UTF-8 | 434 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
class Gift:
gift_id = 0
sex = 0
name = ""
description = ""
link = ""
mark = 0.0
mark_count = 0
def __init__(self, gift_id, sex, name, description, link, mark, mark_count):
self.gift_id = gift_id
self.sex = sex
self.name = name
self... | true |
bc7f5cd0cefd39fd59018c6faaee2ea81f0dad8d | Python | ethyl2/Graphs | /projects/ancestor/ancestor.py | UTF-8 | 2,525 | 4.09375 | 4 | [] | no_license | from graph import Graph
def earliest_ancestor(ancestors, starting_node):
'''
Given a list of ancestors, such as [(1, 3), (2, 3), (3, 6), (5, 6), (5, 7), (4, 5),
(4, 8), (8, 9), (11, 8), (10, 1)]
in the format (parent, child)
And a starting_node,
Return the node at the furthest distance from t... | true |
c5c4374592c61c109efb7f2162e0e78342246454 | Python | v-manju/manju.v | /stringnum.py | UTF-8 | 53 | 2.90625 | 3 | [] | no_license | str=input("enter the number\n")
print(str.isdigit())
| true |
e93e3c1f354f754fddbd1c53612a7986dc22c85b | Python | daniel-reich/turbo-robot | /9AMT6SC4Jz8tExihs_22.py | UTF-8 | 641 | 3.765625 | 4 | [] | no_license | """
Create a function to generate all nonconsecutive binary strings where
nonconsecutive is defined as a string where no consecutive ones are present,
and where `n` governs the length of each binary string.
### Examples
generate_nonconsecutive(1) ➞ "0 1"
generate_nonconsecutive(2) ➞ "00 01 10"
... | true |
8741f7e01fc1097b60867523c68f9f28f8bfd194 | Python | c981890/LTAT.TK.001 | /3.1 Teksti analyys.py | UTF-8 | 775 | 3.109375 | 3 | [] | no_license | def symbolite_sagedus(jarjend):
''' (str) -> dict
Funktsioon võtab argumendiks sõne ja tagastab sõnastiku, mis sisaldab
selles sõnes esinevate tähemärkide esinemiste sagedusi. Tagastatav sõnastik
sisaldab kirjeid, kus võtmeteks on ühetähemärgilised sõned (sümbolid) ja
väärtusteks vastavate sõnede (... | true |
fc7c2d4a45a56963ef8d344659064880a2bc65ab | Python | PratikDPatil17/TCS_Digital_Code | /max sum of subgroup of given length.py | UTF-8 | 298 | 2.71875 | 3 | [] | no_license | s = input()
n = int(input())
output = [(s[i:i+n]) for i in range(0, len(s), n)]
maxsum = cur = 0
k = []
for i in range(0,len(s),n):
k.append(s[i:i+n])
for i in k:
cur = 0
for j in range(len(i)):
cur = cur + int(i[j])
maxsum = max(cur, maxsum)
print(k,maxsum)
print(output)
| true |
6d653739d592a136beec28a1d9901c67b09caacf | Python | GiovanaPalhares/python-introduction | /Letra.py | UTF-8 | 177 | 3.203125 | 3 | [] | no_license | def vogal(z):
vogal = ["a","e","i","o","u", "A", "E", "I", "O", "U"]
if z in vogal:
return True
else:
return False
rep = vogal("d")
print(rep)
| true |
33f7687b9a83ba061502a31a03658c86c1c2a299 | Python | akeyi2018/Python3-1 | /web/testMacro.py | UTF-8 | 1,160 | 2.921875 | 3 | [] | no_license | import webiopi
webiopi.setDebug()
GPIO = webiopi.GPIO
LED1PIN = 19
LED2PIN = 26
LED3PIN = 6
pinList = [19,26,6,13]
forward = [1,0,1,0]
back = [0,1,0,1]
turnLeft = [0,1,0,0]
turnRight = [0,0,0,1]
stop = [0,0,0,0]
g_led1active = 0
g_led2active = 0
g_led3active = 0
g_speed = 50
g_active = 5
def setup():
GPIO.s... | true |
6d431af62191168fe689639ec65419291195edf0 | Python | nikitos219745/lab6 | /C.py | UTF-8 | 1,158 | 3.359375 | 3 | [] | no_license | from enum import Enum
while True:
class month (Enum):
January = 1
February = 2
March = 3
April = 4
May = 5
June = 6
July = 7
August = 8
September = 9
October = 10
November = 11
December = 12
class season (Enum):
... | true |
2b305ed61cb2278f911bc229e23833bac2dd162b | Python | AnnaAndropova/intsit_lab1 | /hierarhical_clustering.py | UTF-8 | 393 | 2.703125 | 3 | [] | no_license | import data_reader
from scipy.cluster.hierarchy import linkage, dendrogram
from scipy.spatial.distance import pdist
import matplotlib.pyplot as plt
def build_graph():
labels, data = data_reader.read_data()
df = pdist(data)
Z = linkage(df, method='ward')
dendro = dendrogram(Z, labels=labels)
plt.... | true |
de2f0696d77f184c4654b10e164c63b6e57a8640 | Python | DJHyun/Algorithm | /SW expert/python/5521_상원이의생일파티.py | UTF-8 | 715 | 2.734375 | 3 | [] | no_license | import sys
sys.stdin = open("5521_상원이의생일파티.txt", "r")
T = int(input())
for test_case in range(1, T + 1):
n, m = map(int, input().split())
guest = []
friend = []
xx, yy = [], []
for i in range(m):
x, y = map(int, input().split())
if x == 1:
friend.append(y)
else:
... | true |
73b1f857e88c39d5f9de524c08fccecb560c3b7d | Python | papercavalier/ftps3 | /ftps3.py | UTF-8 | 1,341 | 2.75 | 3 | [] | no_license | import os
import boto3
import ftplib
import tempfile
class Sync:
def __init__(self):
self.ftp = ftplib.FTP(os.environ['SERVER'])
self.ftp.login(os.environ['USER'], os.environ['PASSWORD'])
self.s3 = boto3.client('s3')
def run(self, dirname):
names = self.ftp.nlst(dirname)
... | true |
23fda8154b6b1542de75d3df1c6ced0752764c05 | Python | DrewOrtego/TORK | /Commands/GeneralCommands.py | UTF-8 | 8,050 | 2.984375 | 3 | [] | no_license | import os
import sys
import time
sys.path.append([os.sep.join(os.getcwd().split(os.sep)[:-1]), 'Stuff'])
class GeneralCommands:
"""
Abstract class containing functions for running harness-centric commands.
"""
function_args = {
'help': ['all', 'assertion', 'browser', 'general', 'page', 'windo... | true |
3f51d3d0b23b64ff6025915af20d0dfbfc2f6439 | Python | jmyh/stepik_autotest | /lesson2/step1_task1_use checkbox&radiobutton.py | UTF-8 | 947 | 3.015625 | 3 | [] | no_license | from selenium import webdriver
import time
import math
link="http://suninjuly.github.io/math.html"
def calc(x):
return str(math.log(abs(12*math.sin(int(x)))))
try:
browser = webdriver.Chrome()
browser.get(link)
x_element=browser.find_element_by_id("input_value")
x=x_element.text
y=calc(x)
... | true |
54496452731cf343783173c86e4908d4347e3586 | Python | HoaxShark/comp260-server | /Client/Scripts/window.py | UTF-8 | 5,867 | 2.90625 | 3 | [] | no_license | from PyQt5 import QtWidgets, uic, QtCore
from PyQt5.QtCore import Qt
from queue import *
import bcrypt
class LoginWidget(QtWidgets.QWidget):
def __init__(self, parent=None):
super(LoginWidget, self).__init__(parent)
self.login_widget = uic.loadUi('login_widget_layout.ui', self)
# Center
... | true |
e240d11b25b6a4b5781d250007d93f0997ea8a7c | Python | leonall/algorithms_homework | /stack/stack.py | UTF-8 | 3,167 | 4.03125 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Stack Abstract Data Type (ADT)
Stack() creates a new stack that is empty.
It needs no parameters and returns an empty stack.
push(item) adds a new item to the top of the stack.
It needs the item and returns nothing.
pop() removes the top item from the stack.
I... | true |
a7730d50c5973f5e0d006218321c0b4513e85202 | Python | somork/plrna | /plrna1.0/scripts/rnafold2tab.py | UTF-8 | 806 | 2.515625 | 3 | [] | no_license | # rnafold2tab.py
# S/ren M/rk
# 13/06/2012
import sys
data_in=sys.stdin.read()[:-1]
d={}
d_keys=[]
data=data_in.split('>')[1:]
input=open(sys.argv[1])
names_in=input.read()
input.close()
names=names_in.split('\n')[:-1]
the_list=[]
#i=0
for i in range(len(data)):
#i+=1
seq=''
score=0
struc=''
x=data[i].spli... | true |
fc0e8b92fa80be73fc8474eb7a48eb1bb6964623 | Python | Pioank/python-games | /calc-game.py | UTF-8 | 3,551 | 3.59375 | 4 | [] | no_license | import random
import operator
import time
pname=input('Choose your player name \n')
calcs = ['+','-','+,-','+,*,/'] # What calculations the player will need to do per level, each list item is a level
rang = ['0,10','0,10','0,10','0,10','0,10'] # What is the range of numbers per level, each list item is a level
ncalc=... | true |
c060e1a710283f43955c6edd892fc61b1c2803ae | Python | lchinmay799/Stock-Market-Prediction-Using-Machine-Learning | /Apple/Stock Market Prediction_Apple.py | UTF-8 | 4,677 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
conda install -c anaconda pandas-datareader
# In[1]:
import pandas_datareader as pdr
# In[2]:
df=pdr.get_data_tiingo('AAPL',api_key='600965445e480ded65188f8485444e6643e71e2a')
# In[3]:
df.to_csv('AAPL.csv')
# In[4]:
import pandas as pd
# In[5]:
df=pd... | true |
ca4450426e5dad2b5a8e40dcd876d2f6e5fbb38d | Python | medo5682/Robotics | /lab_7/lab7.py | UTF-8 | 1,706 | 2.59375 | 3 | [] | no_license | import argparse
import rospy
from geometry_msgs.msg import Pose, Point, Quaternion, PoseStamped
from std_msgs.msg import Header
global prev_x
global prev_y
global prev_theta
def check_start(args):
if args.x_goal == None:
print("X goal set to previous")
args.x_goal = prev_x
if args.y_goal == None:
print("Y go... | true |
3f140da1b4570fc9243843ae8ec6c1bfcc644425 | Python | lsankar4033/programming_gym | /hackerrank/the_quickest_way_up/run.py | UTF-8 | 2,660 | 3.65625 | 4 | [] | no_license | # Challenge here: https://www.hackerrank.com/challenges/the-quickest-way-up
# Solution involves creating a graph and doing BFS. Graph must be altered based on snakes/ladders so that edge
# pointing to the start of a snake/ladder actually points to its end and all start points are just removed.
import sys
BOARD_SIZE =... | true |
84d7660c17b758d3aff11de48d8aff41cbce6ae6 | Python | Ronel-Mehmedov/dissertation2021 | /executeEmpty.py | UTF-8 | 1,656 | 2.78125 | 3 | [] | no_license | import os
import csv
import shutil
# rootDir = "../data/"
empty = 0
notEmpty = 0
singleEntry = 0
emptyFoldersList = []
singleFileFolders = []
def fixName(folderName):
if "10532" in folderName:
website = folderName.split("10532")[0]
return website
return folderName
websites = []
foldersList... | true |
42f11f90ff283dac88e335fe814b2b6dd14c59a6 | Python | aquadros1003/Data-Visualization | /4/Klasy/Robaczek.py | UTF-8 | 649 | 3.03125 | 3 | [] | no_license | class Robaczek:
wspolrzedna_x = 0
wspolrzedna_y = 0
ruch = 1
def __init__(self, x, y, krok):
self.wspolrzedna_x = x
self.wspolrzedna_y = y
self.ruch = krok
def idz_w_gore(self,ile_krokow):
self.wspolrzedna_y += (ile_krokow * krok)
def do_dolu(self,ile_krokow):
... | true |
5bf08c4f2218439698a423c18f9110045ba4864c | Python | LAB-Rio/governoaberto-wikilegis | /wikilegis/core/templatetags/convert_numbers.py | UTF-8 | 2,457 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Library
from collections import OrderedDict
from django.template.defaultfilters import slugify
from django.utils.translation import ugettext_lazy as _
import string
from wikilegis.core.models import BillSegment
register = Libr... | true |
d1d620d60f38b0a427bafae4a156bd931e970f37 | Python | Aasthaengg/IBMdataset | /Python_codes/p03626/s390663489.py | UTF-8 | 543 | 3.03125 | 3 | [] | no_license | n = int(input())
s1 = input()
s2 = input()
if s1[0] == s2[0]:
result = 3
last_pattern = "h"
place = 1
else:
result = 6
last_pattern = "w"
place = 2
while place < n:
if last_pattern == "h":
if s1[place] == s2[place]:
result *= 2
last_pattern = "h"
place += 1
else:
result *=... | true |
0deeb3d911e998c345be69d24930603547461eac | Python | imsahil007/SudokuSolver | /sudoku_grid.py | UTF-8 | 2,134 | 3.484375 | 3 | [
"MIT"
] | permissive | import cv2
import numpy as np
def display_rects(in_img, rects, colour=255):
"""Displays rectangles on the image."""
img = in_img.copy()
for rect in rects:
img = cv2.rectangle(img, tuple(int(x) for x in rect[0]), tuple(int(x) for x in rect[1]), colour)
return img
def distance_between(p1, p2):
... | true |
815391fafaa270b64561229ba75a12f0eb5be410 | Python | cminmins/Pixel_processing | /venv/Lib/site-packages/pydicom/tag.py | UTF-8 | 7,270 | 2.921875 | 3 | [] | no_license | # Copyright 2008-2017 pydicom authors. See LICENSE file for details.
"""Define Tag class to hold a DICOM (group, element) tag and related functions.
The 4 bytes of the DICOM tag are stored as an arbitrary length 'long' for
Python 2 and as an 'int' for Python 3. Tags are stored as a single number and
separated to (grou... | true |
88dcd24e83722729d79c1011df1678d4978f7d8e | Python | sebdiem/euler | /64.py | UTF-8 | 1,045 | 3.21875 | 3 | [] | no_license | from fractions import gcd
def period(n, sq_n, p, current, seen):
# p stores the digits of the continued fraction sequence
# current enables to retrieve the current value of the "remainder": a/(sqrt(n)-b)
# seen stores the old values of current to detect periodicity
a, b = current
sq_diff = n-b**2
... | true |
f91409c4ecb9e300e1fcb2bb1104792eb7616280 | Python | tepharju/Code1--Harjoitusteht-v-t | /CODE1_3_4_Hypotenuusa.py | UTF-8 | 283 | 3.515625 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 23 12:27:35 2021
@author: tepha
Code1 3.4 Hypotenuusa
"""
import math
a = float(input("Anna sivu a: "))
b = float(input("Anna sivu b: "))
c = math.sqrt(a**2+b**2)
print("Kolmion hypotenuusan pituus on:", c)
| true |
991cdc6eb795900cb2e8e9f4976fafea354f3077 | Python | Dandiaz14/invernadero_18B | /menuRegistro.py | UTF-8 | 869 | 3.25 | 3 | [] | no_license | from registro import Registro
from datetime import datetime,date
class MenuRegistro:
def __init__(self,conexion,cursor):
self.registro = Registro(conexion,cursor)
while True:
print("1) Crear Registro")
print("2) Mostrar Registro")
print("0) Salir")
op = input()
if op == '1':
self.agregar()
... | true |
4cbb77eb1f87014a195e270bcf0a861b4f076c2c | Python | ChangXiaodong/Leetcode-solutions | /Introduction_to_algorithm/section_15/LCS_length.py | UTF-8 | 1,624 | 3.21875 | 3 | [] | no_license | def LCS_length(X, Y):
m = len(X)
n = len(Y)
b = [["" for i in range(n + 1)] for i in range(m + 1)]
c = [[0 for i in range(n + 1)] for i in range(m + 1)]
for i in range(1, m + 1):
for j in range(1, n + 1):
if X[i - 1] == Y[j - 1]:
c[i][j] = c[i - 1][j - 1] + 1
... | true |
2d9cb47647f42f7a768f949b781f4e04eaf4044a | Python | tf2keras/image-computer-processing | /project-1-captcha-recognition/captcha_input.py | UTF-8 | 4,523 | 2.625 | 3 | [
"MIT"
] | permissive | """
This module contains captcha generator.
"""
import os
import h5py
import multiprocessing
import threading
import generate_data
import numpy as np
import tensorflow as tf
class CaptchaDataManager(object):
"""
Class for captcha data managment.
"""
def __init__(self, batch_size, captcha_size... | true |
eb6a8d8d9a2cfe215cf5a23765b441bf31bd7764 | Python | Oswald97/Mapcom-Covid-Programming-Challenge | /day 8/telco.py | UTF-8 | 1,406 | 3.0625 | 3 | [] | no_license | n,c,d = map(int,input().split(" "))
a,b = min(c,d),max(c,d)
stations = list(map(int,input().strip().split(" ")))
stations.sort()
min = 0
for i in range(n):
if n==1:
min = -1
break
else:
if i != 0:
if i != n-1:
if (stations[i] - stations[i-1]) <= a:
... | true |
e1522b6b63aa60c0fb2cabb147074d77efde564e | Python | johnberroa/Finger-Counting-Neural-Network | /keras/keras_finger_LargeCNN.py | UTF-8 | 4,959 | 2.5625 | 3 | [] | no_license | #
# LARGE CNN (not really large, but that's how I named it)
#
import os, time
import numpy as np
import cv2
from sklearn.model_selection import train_test_split as split_data
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import Conv2D, Flatten, MaxPool2D, Dense, Dropout,... | true |
89d4512533d85b88e0cb891d8e594f04e18221e2 | Python | taymoorkhan/maze_project | /maze/controllers/app.py | UTF-8 | 5,702 | 3.234375 | 3 | [
"MIT"
] | permissive | # controllers/end.py
# import pygame and required controllers
import datetime
import pygame
import pygame.locals
from controllers.start import StartController
from controllers.end import EndController
from controllers.game import GameController
from models.score_manager import ScoreManager
from models.score import Scor... | true |
31c61c0f4059775cd0a16174fafc15b2af11dcc2 | Python | CHENG-KH/Python | /APCS_哆拉A夢_difficult.py | UTF-8 | 1,577 | 4.03125 | 4 | [] | no_license |
#跟大雄猜拳,大雄任意出拳(random)
#請使用者請使用者輸入一數字,分別代表以下猜拳的手勢
#石頭 -> 0, 剪刀 -> 1, 布 -> 2
#顯示猜拳結果(輸,贏,平手 )
#大0 -> 你0:平手
#大0 -> 你1:輸
#大0 -> 你2:贏
#大1 -> 你0:贏
#大1 -> 你1:平手
#大1 -> 你2:輸
#大2 -> 你0:輸
#大2 -> 你1:贏
#大2 -> 你2:平手
#五戰三勝(平手不算)
import random
nobita_win = list()
usr_win = list()
while len(nobita_win) != 3 and len(usr_win) != 3:
... | true |
49a125da75ff49e3b6756e86abd9bebfee8ad39f | Python | nickcernis/scancat | /scancat/themes.py | UTF-8 | 3,844 | 2.765625 | 3 | [
"Apache-2.0"
] | permissive | """Probe a WordPress site for theme information."""
import logging
import requests
from bs4 import BeautifulSoup
from . import wordpress as wp
from .message import msg
def is_genesis_child_theme(soup=None):
"""Is the active theme a Genesis child theme?
:param soup: The parsed HTML, defaults to None
:pa... | true |
0b5574baac9afa8b98d52750514fc0b6e215faf4 | Python | StepanSZhuk/PythonCore377 | /CODEWARS/Count of positives_sum of negatives.py | UTF-8 | 494 | 4.03125 | 4 | [] | no_license | #Given an array of integers.
#Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers.
#If the input array is empty or null, return an empty array.
def count_positives_sum_negatives(arr):
if not arr:
return []
count_positives = 0
... | true |
32eded7d550c7a8e1ccb61d1894a6c7759a36350 | Python | anchandm/fooof | /tutorials/plot_01-ModelDescription.py | UTF-8 | 3,303 | 3.90625 | 4 | [
"Apache-2.0"
] | permissive | """
01: Model Description
=====================
A theoretical / mathematical description of the FOOOF model.
"""
###################################################################################################
# Introduction
# ------------
#
# A neural power spectrum is fit as a combination of an aperiodic signal ... | true |
2cc640e07f26cdeaa6089fa31afa9c6c12842897 | Python | noisyoscillator/Statistical-Mechanics-1 | /anharm_path_integral_montecarlo.py | UTF-8 | 2,492 | 3.15625 | 3 | [
"MIT"
] | permissive | %pylab inline
import math, random, pylab
# Define the anharmonic (quartic) potential
def V_anharmonic(x, gamma, kappa):
V = x**2 / 2 + gamma * x**3 + kappa * x**4
return V
def rho_free(x, y, beta): # free off-diagonal density matrix
return math.exp(-(x - y) ** 2 / (2.0 * beta))
def read_file(filename):
... | true |
9c86da1507d99f90701457869d7dbf26424fc9f7 | Python | soumendrak/demonetization | /Demonetization.py | UTF-8 | 3,202 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | """
Created by Soumendra Kumar Sahoo
Date: 26th November 2016
Function: This program will calculate the overall sentiment of public
on the demonetization issue by fetching data from twitter
Future plans:
1. Data extraction from twitter functionality will be added
2. Visualization of the sentime... | true |
a8a01ad2a75fe2478e3d9c1e8b33836c48941fcb | Python | sjbober/Most-Common-Death-Row-Last-Words | /clean.py | UTF-8 | 1,667 | 3.640625 | 4 | [] | no_license | import sqlite3
import pandas as pd
import re
from removecontdupes import removeContractionsDuplicates
#connect to the executions db and create a panda Series from the statement row
conn = sqlite3.connect('executions.sqlite')
statements = pd.read_sql_query('SELECT statement FROM Executions', conn)
statements = statemen... | true |
3605eda012bbbdc82374e58cba08581a97dc808f | Python | lilgaage/lilgaage_scripts | /python/05/05Animal_Class.py | UTF-8 | 2,009 | 4.53125 | 5 | [] | no_license | class Animal:
def __init__(self,name,age,gender,weight):
#非私有属性
self.name = name
self.age = age
self.gender = gender
#私有属性 不能被继承,也不能在类的外部被调用
self.__weight = weight
#私有方法 不能被继承,也不能在类的外部被调用
def __eat(self,food):
print("{}不爱吃肉,爱吃{}".format(self.... | true |
af8a4271f1ba012646b1a547352c2abd9c88dcd4 | Python | sererenaa/connected_corridors | /AimsunExtractNetwork.py | UTF-8 | 17,114 | 2.609375 | 3 | [] | no_license | from PyANGBasic import *
from PyANGKernel import *
from PyANGGui import *
from PyANGAimsun import *
#from AAPI import *
import datetime
import pickle
import sys
import csv
import os
def ExtractJunctionInformation(model,outputLocation):
#####################Get the junction information#####################
ju... | true |
f41f5482df71070f71393e47b07ca857cf3372e7 | Python | periyandavart/ty.py | /palin.py | UTF-8 | 147 | 3.40625 | 3 | [] | no_license | n=input()
num=int(n)
orig=num
rev=0
while num>0:
rev=(rev*10)+num%10
num//=10
if orig==rev:
print("yes")
else:
print("no")
| true |
4af85253550220a9e178eb7891300d905361821d | Python | jakestrouse00/image-collection | /requestCollect.py | UTF-8 | 1,216 | 2.703125 | 3 | [
"MIT"
] | permissive | import requests
import urllib.request
import threading
import os
def download(data, number, fileName):
print(f"Downloading image number: {number}")
r = requests.get(data['webformatURL'])
with open(f'imageSets/{fileName}/{number}.jpeg', 'wb') as f:
f.write(r.content)
fileNames = ['human', 'dog',... | true |
7c492198edd2e9f68f757c3b58ccacc90ad8352a | Python | Sandy4321/analysis | /univariate_thresholder.py | UTF-8 | 1,904 | 2.984375 | 3 | [] | no_license | import numpy as np
class UnivariateThresholder:
def __init__(self):
self.threshold = None
self.left_class = None
self.right_class = None
self.classes = None
def fit(self, x, y):
classes = np.unique(y)
self.classes = classes
if len(x.shape == 2):
x = x[:, 0]
thresholds = n... | true |
590ecea73e943641a31e345f66ce79805d95b6ea | Python | id774/sandbox | /python/pandas/demo/by_normal.py | UTF-8 | 460 | 3.234375 | 3 | [] | no_license | from collections import defaultdict
filename = "product.csv"
header_skipped = False
sales = defaultdict(lambda: 0)
with open(filename, 'r') as f:
for line in f:
if not header_skipped:
header_skipped = True
continue
line = line.split(",")
product = line[0]
num... | true |
19bc42ac5223a1a3d782538c50697d6038e40b40 | Python | mycherrylarry/leetcode | /python/python-126/singleNumberII.py | UTF-8 | 998 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python
'''
Solution1. Hashmap
Solution2. convert each number to binary representation, and sum every bit and mod 3(or k)
Result: AC
'''
class Solution:
def singleNumber(self, A):
v = [self.convertToBinary(item) for item in A]
t = [sum(item)%3 for item in zip(*v)]
x = reduce(l... | true |
ec56a4ee9d44610f3b1d9060c485dde18d38f30b | Python | JvN2/NucTool | /NucleosomePositionCore.py | UTF-8 | 4,759 | 2.734375 | 3 | [] | no_license | import numpy as nu
import math, re, random, csv
import matplotlib.pyplot as plt
from matplotlib.widgets import Button
from pylab import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
def SavePlot(y, filename, xtitle = '', ytitle = '', title = ''):
plot = Figure(figsize=(12, 3))
ax =plot.ad... | true |
60bb1bec05cccbd32540763f9522540a9942a176 | Python | sergeymusienko/bowfast | /aligner-compare/scripts/roc-bam.py | UTF-8 | 1,547 | 2.53125 | 3 | [] | no_license | """
generate qual vs count
"""
import collections
from toolshed import nopen
import sys
def counter(fname):
qual_count = collections.defaultdict(int)
for sam_line in (l.split("\t") for l in nopen(fname)):
qual = int(sam_line[4])
qual_count[qual] += 1
return qual_count
# samtools view $BA... | true |
ed369fec7abf7fbf8a6239349c029c72e4d4157c | Python | zstall/PythonProjects | /Automate the Boring Stuff/Chapter 3/The Collatz Sequence.py | UTF-8 | 1,480 | 4.9375 | 5 | [] | no_license | '''
The Collatz Sequence
Chapter 3 Pg. 77
By Zachary Stall
This program asks the user to input a number and using the Collatz
Sequence will reduce the number to one. The program does this with a
collatz() method that if the number is even will //2, if the number is
odd then it will collatz() will return 3*number+1.... | true |