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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9c19e424a840ef7eb0aa461c63cdf0d45a4148b1 | Python | aliyun/alibabacloud-gdb-tools | /GdbDataRemover.py | UTF-8 | 9,639 | 2.5625 | 3 | [
"MIT"
] | permissive | """
File: GdbDataRemover.py
This is an enhencement of `GdbDataRemover` by parallelization to speedup data remover, but
here may be some fails about lock timeout due to update relation data in concurrent, it's OK
to run it or `GdbDataRemover` again
Authors:
Liu Jianping
Qiao Gong
2019/8/22 - initial... | true |
0aa8b0135e7443e2df2de3e256079938cbd261e4 | Python | sjyttkl/TensorFlow_-google- | /codes/Chapter03/3.完整神经网络样例程序.py | UTF-8 | 1,856 | 3 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
"""
===============================================================
author:sjyttkl
email:695492835@qq.com
date:2018
introduction:
===============================================================
"""
import tensorflow as tf
from numpy.random import RandomState
#1. 定义神经网络的参数,输入和输出节点。
batch_size =... | true |
01a4b9b8327a4914cd7a3421cc8084c8798c4894 | Python | lbAntoine/jsProj | /pythonBot/_boataouts.py | UTF-8 | 414 | 3.359375 | 3 | [] | no_license |
import re
class outils:
def clean(self, txt_):
str_txt = str(txt_)
clean_txt = ''
regex = r"[\w -]+"
matches = re.finditer(regex, str_txt, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
#print(match.group())
clean_txt += match.g... | true |
a759c1ba540b309e7455ed9c1d79afef10d9aa6e | Python | AMnitAMn/Machine-Learning | /Machine Learning/Reinforcement Learning/Upper Confidence Bound (UCB)/UpperConfidenceBound.py | UTF-8 | 1,347 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Sep 24 21:41:53 2019
@author: Arpit
"""
# Importing the libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Importing the dataset
dataset = pd.read_csv('Ads_CTR_Optimisation.csv')
# Implimenting the UCB
import math
N = 10000... | true |
baf78a885744ce11876e2215c9feefcccc3589fd | Python | tzungtzu/algo_puzzles | /solutions/12_root.py | UTF-8 | 514 | 3.46875 | 3 | [] | no_license |
def sqrt_shortest_int(n):
n_sqrt = (n**0.5)
sqrt_str = str(n_sqrt).replace('.','')
sqrt_set = (set(list(sqrt_str[0:10])))
return len(sqrt_set)
def sqrt_shortest_noint(n):
n_sqrt = (n**0.5)
sqrt_str = str(n_sqrt).split('.')[1]
sqrt_set = (set(list(sqrt_str[0:10])))
return len(sqrt_set)
if __name__ == "__... | true |
6efb0f15985769da417201a79e3b3ca3513c031a | Python | tkersten09/curio-http-server | /curio_http_server/core/router/__init__.py | UTF-8 | 5,458 | 2.796875 | 3 | [] | no_license | from inspect import iscoroutinefunction
from inspect import isfunction
from re import compile
from uuid import UUID
url_parameter_pattern = compile(r'<(?P<name>[A-Za-z0-9_]+?)(?:\:(?P<pattern>.+?))?>')
class Route(object):
def _add_parameter_converter(self, match):
name = match.group('name')
pat... | true |
c75d35b65d2316dc05e45ab1ce77025e26bce673 | Python | inspirationLG/python_redis | /main/my_thread.py | UTF-8 | 248 | 2.765625 | 3 | [] | no_license | import threading
class mythread(threading.Thread):
def __init__(self, thread_name, work):
threading.Thread.__init__(self)
self.thread_name = thread_name
self.work = work
def run(self) -> None:
self.work()
| true |
09b489f16dabf14f809aafd8052192b24714be27 | Python | levanthanh3005/UserBehaviorChromeExtension | /BehaviorSvr/train.py | UTF-8 | 1,476 | 2.640625 | 3 | [] | no_license | from sklearn.pipeline import Pipeline
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extracti... | true |
d83a96c4f956e265a7b09a3fdf6fde1220b81573 | Python | anusha4999/anusha | /python/tasks/dictionaries/d2.py | UTF-8 | 87 | 2.875 | 3 | [] | no_license | dic1={1:10, 2:20}
dic2={3:30, 4:40}
for i in (dic1, dic2):
dic2.update(i)
print(dic2) | true |
18dc7365934065d14116df15e4e942ba86f13782 | Python | hnhaefliger/RCInterview | /lisp.py | UTF-8 | 884 | 4.0625 | 4 | [] | no_license | def tokenize(expression):
'''
Break expression down into individual terms.
'''
return expression.replace('(', ' ( ').replace(')', ' ) ').split()
def read(tokens):
'''
Create AST from expression.
'''
token = tokens.pop(0)
if token == '(': # Start a sub-tree.
ast = []
... | true |
8288085229a0d975f3bade167cc28fb65adace2d | Python | jeisenma/ProgrammingConcepts | /07-animation/theManyAdventuresOfSine.pyde | UTF-8 | 3,590 | 3.734375 | 4 | [] | no_license | # J Eisenmann 2013
# jeisenma@accad.osu.edu
floor = 60
goingUp = True
timer = 0
def setup():
size(400,400)
textAlign(CENTER,CENTER) # whenever we draw text to the screen, make sure
# it's centered horizontally and vertically
def draw():
# clear the screen every frame... | true |
64db6b4bc1cbdbbd32f0ff61f7ccc9b555a93f62 | Python | pillieshwar/heaven | /dict_of_bdays.py | UTF-8 | 768 | 3.09375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
from datetime import date
from datetime import datetime
def dict_of_bdays():
today = date.today()
d1 = today.strftime("%d/%m")
dict = {
'17/07': 'Eshwar',
'01/03': 'Devi',
'04/11': 'Nana',
'02/06': 'Amma',
'04/09': 'Krishna',... | true |
fb35463108dad4fb8b34b3f3a51a54274c5fa33c | Python | marionleborgne/EIT_Dashboard | /sandbox/sand/OpenEIT/reconstruction/pyeit/mesh/shape.py | UTF-8 | 6,388 | 2.890625 | 3 | [
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"CC-BY-NC-SA-4.0",
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-4.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # coding: utf-8
# pylint: disable=invalid-name, no-member
""" implement distance functions for distmesh """
# Copyright (c) Benyuan Liu. All rights reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division, absolute_import, print_function
import numpy as np
fr... | true |
81878673c64c8390c2ec0a4c5752dbe41f18625d | Python | rjsnh1522/in_bits | /array/wave_array.py | UTF-8 | 1,324 | 3.984375 | 4 | [] | no_license | class Solution:
# @param A : list of integers
# @return a list of integers
def wave(self, A):
n = len(A)
arr = sorted(A)
for i in range(0, n, 2):
# If current even element is smaller than previous
if (i> 0 and arr[i] < arr[i-1]):
... | true |
27dbff7deb87861597475765697459050b15e1a7 | Python | HVoellinger/Mathematics | /(3n+1)-Conjecture.py | UTF-8 | 3,376 | 4.53125 | 5 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# # # Python Program to check the (3n+1) Conjecture
#
# Powered by: Dr. Hermann Völlinger, DHBW Stuttgart(Germany); August 2020
#
# See Wikipedia: https://en.wikipedia.org/wiki/Collatz_conjecture
#
#
# The Collatz conjecture is a conjecture in mathematics that concerns... | true |
b3803f55ae9708e8e389d46be8a48a59726d9cbb | Python | brady-wang/spider-music163 | /get_total_crom.py | UTF-8 | 1,125 | 2.609375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2018/3/15 15:27
# @Author : XueLei
# @Site :
# @File : neteasemusic.py
# @Software: PyCharm
# 抓取某一首歌下面的评论
import time
from lxml import etree
import requests
from requests.exceptions import RequestException
from urllib.parse import urlencode
import json
from multiprocessing i... | true |
235817041159d6641063c40a645d964cb8dfa937 | Python | SaschMosk/hw_8 | /homework_16.py | UTF-8 | 1,459 | 2.796875 | 3 | [] | no_license | # from urllib.parse import urlencode
import requests
APP_ID = 6418314
AUTH_URL = 'https://oauth.vk.com/authorize'
auth_data = {
'client_id': APP_ID,
'display': 'mobile',
'scope': 'friends',
'response_type': 'token',
'v': '5.73'
}
# print('?'.join((AUTH_URL, urlencode(auth_data))))
TOKEN = '0412c0a5... | true |
bee71a9c63b629d2503a1cc830d79c43aed1d23c | Python | javakishore-veleti/Databricks-Spark-ML | /code/HealthCareAnalytics/datagen/ecg_data/main.py | UTF-8 | 3,173 | 2.84375 | 3 | [] | no_license | import pylab
import scipy.signal as signal
import numpy
numpy.set_printoptions(suppress=True) #prevent numpy exponential
#notation on print, default False
print('Simulating heart ecg')
# The "Daubechies" wavelet is a rough approximation to a real,
# single, heart beat ("pqrst") sign... | true |
d8d0fcfc3787dff7e53deda86bb2819cd374f31e | Python | QsingSi/package | /_gradient.py | UTF-8 | 654 | 2.828125 | 3 | [] | no_license | from ._package import np
def _difference_quotient(f, x, h):
return (f(x + h) - f(x)) / h
def _partial_defference_quotient(f, v, i, h):
x = v[i]
return (f(x + h) - f(x)) / h
def _setp(v, direction, step_size):
return [v_i + direction_i * step_size for (v_i, direction_i) in zip(v, direction)]
def ... | true |
ddc7e32bb852c89740be52daee881a19bcc57876 | Python | akashvshroff/DSA_Coursera_Specialisation | /Data_Structures/week4_assignment/hash_chains.py | UTF-8 | 2,270 | 3.75 | 4 | [] | no_license | # python3
class Query:
def __init__(self, query):
self.type = query[0]
if self.type == 'check':
self.ind = int(query[1])
else:
self.s = query[1]
class QueryProcessor:
"""
Simple hashing using chaining amongst user-defined number of buckets.
"""
_mu... | true |
7fedb1e1d91fd586e98b7deb66a5ece119f1dd42 | Python | joohyun333/programmers | /백준/트리/LCA.py | UTF-8 | 1,246 | 2.828125 | 3 | [] | no_license | import sys, collections
input = sys.stdin.readline
N = int(input())
arr = collections.defaultdict(list)
for i in range(N - 1):
a, b = map(int, input().split())
arr[a].append(b)
arr[b].append(a)
def find_depth(n):
discoverd = [False] * (N + 1)
depths = [0] * (N + 1)
queue = [(n, 1)]
disco... | true |
a76fb3f33b8f9a169133c10c92534dfe2e6475f7 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_223/ch72_2020_05_20_00_27_18_616969.py | UTF-8 | 175 | 3 | 3 | [] | no_license | def lista_caracteres(s):
lista = list(s)
lista_final = []
for i in lista:
if i not in lista_final:
lista_final.append(i)
return lista_final | true |
43eabcdc6c6dc8b72728e79045d77d90329707b1 | Python | raeda4/Trivia-API | /backend/test_flaskr.py | UTF-8 | 6,694 | 2.671875 | 3 | [] | no_license | import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from flaskr import create_app
from models import setup_db, Question, Category
from config import database_setup
from sqlalchemy import desc
class TriviaTestCase(unittest.TestCase):
"""This class represents the trivia test case"""
... | true |
8e6f863d96e4684c19fe8f6a9304217b74b687ea | Python | Jinha95/Algorithm | /D2_4871.py | UTF-8 | 656 | 3.0625 | 3 | [] | no_license | # 잘 안되서 일단 Googling..
def dfs(start):
visited[start] = 1
stack.append(start)
for i in range(1, V + 1):
if matrix[start][i] == 1 and visited[i] != 1:
visited[i] = 1
dfs(i)
return stack
T = int(input())
for t in range(1, T + 1):
stack = []
V, E = map(int, input()... | true |
6589a4c7029bd002d1f129cdd7f66486b6bc3333 | Python | Weisswire/Python_Study_Homework-Bilibili | /10_模块/Module_person.py | UTF-8 | 304 | 3.796875 | 4 | [
"MIT"
] | permissive | # Module_person
class student:
def __init__(self,name:str,age:int) -> None:
self.name = name
self.age = age
def show_me(self) -> None:
print(f"{self.name} is {self.age} years old.")
if __name__ == '__main__':
s1 = student('Jesse Cavendish',22)
s1.show_me() | true |
d1223417bed5f3697a5c73121e6e4c7d96df5c88 | Python | mt26691/learning-python | /basic/TransformList.py | UTF-8 | 319 | 3.296875 | 3 | [] | no_license | minutes = [1, 2, 3]
secs = [data * 60 for data in minutes]
for data in secs:
print(data)
lower = ["nguyen", "manh", "tung"]
upper = [data.upper() for data in lower]
for data in upper:
print(data)
testString = "tung,xzc,za"
stringArray = testString.strip().split(",")
for data in stringArray:
print(data) | true |
f135f5563ad143a51eb6ff2c600530dd15520c1d | Python | AfaMadza/holbertonschool-higher_level_programming | /0x11-python-network_1/3-error_code.py | UTF-8 | 561 | 3.453125 | 3 | [] | no_license | #!/usr/bin/python3
"""
Sends request to a URL and displays Body
"""
import sys
import urllib.request
def error_request(url):
"""
Takes in URL as parameter, sends a request and displays Body
"""
try:
request = urllib.request.Request(url)
with urllib.request.urlopen(request) as resp:
... | true |
ec5c1f5745aacc2c66d8a1ce7989f64271eb5b6d | Python | hvnsweeting/states | /test/jenkins/run.py | UTF-8 | 3,122 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Use of this is governed by a license that can be found in doc/license.rst.
"""
Wrapper around integration.py that allow to, optionally, run only a
specific set of test that match the argument in command line.
Argument can be either a string or a chunk such as "2/4" that... | true |
c659879c1ed12eb4ec51a1cff194bf33a7c97ae0 | Python | duygucumbul/pyt4585 | /YSM4585/lesson10/casefold.py | UTF-8 | 502 | 3.59375 | 4 | [] | no_license |
# .endswith() => metninizin parametrede gönderdiğiniz değer ile bitip bitmediğini kontrol eder
metin = "bilge adam beşiktaş python dersleri"
sonuc = metin.endswith("eri")
if sonuc :
print("parametrede gönderdiğiniz değer eri kelimesi ile bitmekte")
else:
print("parametrede gönderdiğiniz değer eri kelimesi ... | true |
169aed3beb7373a02fa18e0a4496dc658b4c0963 | Python | Biocodings/hail | /python/hail/typecheck/check.py | UTF-8 | 5,639 | 2.640625 | 3 | [
"MIT"
] | permissive | from decorator import decorator, getargspec
from types import ClassType, NoneType, InstanceType
import re
def extract(t):
m = re.match("<(type|class) '(.*)'>", str(t))
if m:
return m.groups()[1]
else:
return str(t)
class TypeChecker(object):
def __init__(self):
pass
def ... | true |
a8f6325a44a488c913b22a94ba67826283bf2686 | Python | mrpool404/tpass | /lib/lib2.py | UTF-8 | 2,342 | 3.640625 | 4 | [
"MIT"
] | permissive | #/bin/python3
class Group:
"""Object holds credential for a group.
Members :
Group_Name - String - Name of the group
No_of_Credentials - Integer - Number of credentials in the group
__Credentials - Dictionary - key - name of the credential
... | true |
309428e1c8630a483549c5714e58b1f4ed580196 | Python | harshit28/Leetcode | /Janurary21/1663.py | UTF-8 | 292 | 2.90625 | 3 | [] | no_license | class Solution:
def getSmallestString(self, n: int, k: int) -> str:
k-=n
comb,i=['a']*n,n-1
while i >=0 and k > 0:
comb[i] = chr(ord(comb[i]) + min(k,25))
k-=min(k,25)
i-=1
return "".join(comb)
| true |
3e49c02a72334620bdd3aedbc0f25f1528d9210a | Python | bobejo/Pang | /tests/test_player.py | UTF-8 | 1,812 | 3.359375 | 3 | [] | no_license | import unittest
from src.Character import Character
from src.Player import Player, PlayerDeadException
from src.Cards import BeerCard, Suit
class TestPlayer(unittest.TestCase):
def test_init(self):
character = Character(name='Billie the Kid', health=5)
player_samuel = Player(name='Samuel', role='... | true |
8560a3edc0398c48f42f0cc85949494f4bf6595c | Python | ASU-CodeDevils/Cryptopotamus | /chat/models.py | UTF-8 | 566 | 2.5625 | 3 | [
"MIT"
] | permissive | from django.db import models
class Room(models.Model):
"""
A room for people to chat in.
"""
# Room title
title = models.CharField(max_length=255)
# If only "staff" users are allowed (is_staff on django's User)
staff_only = models.BooleanField(default=False)
def __str__(self):
... | true |
73ca653f7b3fd00791baf1de1df58f446dbfefc5 | Python | kapilggg10/project1 | /opencv_workspace/resize.py | UTF-8 | 479 | 2.5625 | 3 | [] | no_license | import cv2
import os
list_of_files = open("neg.txt","r")
for img in list_of_files:
dim = (300,300)
img = "/home/kapil/Desktop/opencv_workspace"+img[1:len(img)-1]
image = cv2.imread(img)
if(not image is None):
print(img)
height,width,channels = image.shape
if((width >=300) & (height >=300)):
resized = cv2.... | true |
eb64ea9d199b0afe6107c5bc0b58280e61debfe5 | Python | CichoszKacper/SpaceAttack | /bullet.py | UTF-8 | 713 | 3.34375 | 3 | [] | no_license | import pygame
from pygame.sprite import Sprite
class Bullet(Sprite):
def __init__(self, game_settings, screen, spaceship):
super(Bullet,self).__init__()
self.screen = screen
self.rect = pygame.Rect(0,0, game_settings.bullet_width, game_settings.bullet_height)
self.rect.centery = ... | true |
b2c833d0b1bbad379d116c1de1009d921e069721 | Python | sujithpadar/yelp-review-classification | /Classification/code/02-ProjectClassification.py | UTF-8 | 9,124 | 2.578125 | 3 | [] | no_license | from mlclassifiers import LogisticRegression, ConfusionMatrix, KfoldCV, DecisionTree
import pandas as pd
import numpy as np
import random
from patsy import dmatrices, ModelDesc, Term, LookupFactor
from sklearn.metrics import roc_curve
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
#from sklea... | true |
5f6e687453a59076a0f9361852df02d8bfd3dbc8 | Python | ZhongRuoyu/ntu-cz1103-python | /discussion-questions/1a2b.py | UTF-8 | 1,558 | 4.09375 | 4 | [
"MIT"
] | permissive | import math, random
DIGITCOUNT = 4
def Generate():
x = [random.randint(0, 9) for i in range(0, DIGITCOUNT)]
for i in range(0, len(x)):
for j in range(0, i):
while (x[i] == x[j]):
x[i] = random.randint(0, 9)
return x
def PromptForInput():
while (True):
try:
... | true |
70581bcd74160c681b3ac4884a0aa878ab169b13 | Python | HoangAce/ExerciseCodeforcer | /1399B.py | UTF-8 | 408 | 3.03125 | 3 | [] | no_license | #-*- coding: utf- 8-*-
t = int(input())
answers = []
for i in range(t):
n = int(input())
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
count = 0
for j in range(n):
if a[j] - min(a) > b[j] - min(b):
count += a[j] - min(a)
else:
c... | true |
030bd49a78dae6b18aeb1355d07b0046bd14aa7a | Python | liuchaodada/pycharmProject | /animal/Animal_yml.py | UTF-8 | 287 | 2.5625 | 3 | [] | no_license | import yaml
from Animal import Cat, Dog,main_cat,main_dog
if __name__ == '__main__':
with open(r'./data_animal.yml') as f:
data = yaml.safe_load(f)
mimi = Cat(**data['cat'])
main_cat(mimi)
wangcai = Dog(**data['dog'])
main_dog(wangcai)
| true |
14580ed01bccd250c3ed88acabda940b3bb22aa3 | Python | LuckyLub/python-onsite | /week_04/intro_apis/01_countries.py | UTF-8 | 2,814 | 4.40625 | 4 | [] | no_license | '''
Use the countries API https://restcountries.eu/ to fetch information
on your home country and the country you're currently in.
In your python program, parse and compare the data of the two responses:
* Which country has the larger population?
* How much does the are of the two countries differ?
* Print the native ... | true |
bdd5b49565b358b340ff5d8b5e1b5172947d9e4f | Python | Darshak1997/leet-Code | /Walls_And_Gates.py | UTF-8 | 811 | 3.0625 | 3 | [] | no_license | class Solution:
def wallsAndGates(self, rooms: List[List[int]]) -> None:
"""
Do not return anything, modify rooms in-place instead.
"""
max_value = 2147483647
if not rooms:
return
q = deque()
for i in range(len(rooms)):
for j i... | true |
42f9fb3fb22f47aaaef14ed91fd9799fe1dd350e | Python | jaquielajoie/BS-Financial-Analytics | /tweet-streamer/tweet_streamer.py | UTF-8 | 4,501 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | import tweepy
from tweepy import API
from tweepy import Cursor
from tweepy.streaming import StreamListener
from tweepy import Stream
from local_config import *
import json
from collections import Counter
import math
import time
"""
Returns a new Tweepy authentication instance
"""
def authenticate_twitter():
auth =... | true |
b6a4770008611d3485634caa25895476ff1f1b6e | Python | Nick01a/Kafka_Twitter | /analyzer.py | UTF-8 | 3,481 | 2.96875 | 3 | [] | no_license | from collections import OrderedDict
from datetime import datetime, timedelta
import re
class Analyzer:
@staticmethod
def get_user_list(tweets):
user_list = []
for tweet in tweets:
user_list.append(tweet.name)
return list(set(user_list))
@staticmethod
def second_ana... | true |
b90770529400f368b1bcc5885bc77bd378d59145 | Python | PMMAraujo/MSAsitePorportion | /get_proportion_bilogical_sequences_by_site.py | UTF-8 | 7,363 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 3 20:13:16 2017
@author: Araujo
"""
import argparse
from Bio import AlignIO
import pandas as pd
import numpy as np
def This_pos_chars(mutiple_alli, i):
""" Get the characters (nucleotides or aminoacids) in a single position
from all the sequences in the multi... | true |
1ef4afb909715c2bfe423ca1fe4fd0c0fb247ac6 | Python | caseysalvador/Python | /Basics/tuples.py | UTF-8 | 137 | 2.890625 | 3 | [
"MIT"
] | permissive | # Tuples
numbers = [1,2,3] # list
number = (1,2,3) # tuple
# can only get info about tuple does not have methods
# tuples are immutable
| true |
e87fac26f3b78b6b62f3a6370c596fcedff584e3 | Python | MitchellDan/Ch.01_Version_Control | /1.2_turtorial.py | UTF-8 | 2,262 | 3.578125 | 4 | [] | no_license | '''
Modify the starter code below to create your own cool drawing
and then Pull Request it to your instructor. Make sure you
keep the last two lines of code. Your first and last name must be written on your art.
The last line keeps the window open until you click to close.
Turtle Documentation: https://docs.python.org... | true |
73d4b1c91e46aa979a5cf8302ea78ff315e16544 | Python | victormedina1014/intropyclass | /src/Lab2.py | UTF-8 | 573 | 4.15625 | 4 | [] | no_license | #Victor Medina
#Introduction to Python Programming:Lab 2
#October 3rd 2016
numGuessed=int(input('Guess a number from 1-10, Enter "0" to end this simulation.:'))
correctNum=6
while(numGuessed!=correctNum):
if numGuessed > 10 or numGuessed < 0:
print('That is not a number from 1 to 10!')
elif numGuessed==0:... | true |
ff0bae41d0eb24178c11a045de9e943db2681f4d | Python | Coke-Zhang/hta | /hta_stats/hta/utils.py | UTF-8 | 13,548 | 3.046875 | 3 | [
"MIT"
] | permissive | import os
import numpy as np
import csv
import gzip
import scipy.io
import pandas as pd
import matplotlib.pyplot as plt
import math
def apply_tissue_mask(trait_tensor, tissue_mask):
'''
trait_tensor: the trait-tensor -- a numpy ndarray where the first two or three dimensions
represent the spatial dimensi... | true |
2809817c8162bdce227fdc36eff287d57249dfe1 | Python | jannelouisea/CSC495_PrgmLang | /GameProj/projfinal/enums.py | UTF-8 | 1,130 | 2.78125 | 3 | [] | no_license | from enum import Enum
class Suit(Enum):
SPADES = 'S'
HEARTS = 'H'
DIAMONDS = 'D'
CLUBS = 'C'
class FaceCard(Enum):
KING = 'K'
QUEEN = 'Q'
JACK = 'J'
ACE = 'A'
class Color(Enum):
BLACK = 0
RED = 1
class Game(Enum):
BARTOK = 'Bartok'
SPOONS = 'Spoons'
SEVENS = '... | true |
d6d51ca17a833afe924c58336be28a8675ad22f5 | Python | dpopkov/interdis | /interdispy/ch12/leapyear.py | UTF-8 | 269 | 3.25 | 3 | [] | no_license | # Программа 1.2.5. Високосный год (1.2.4 in java)
import sys
import stdio
year = int(sys.argv[1])
isLeapYear = (year % 4 == 0)
isLeapYear = isLeapYear and (year % 100 != 0)
isLeapYear = isLeapYear or (year % 400 == 0)
stdio.writeln(isLeapYear)
| true |
05367c67473468962bcf1402f4a71176f4fd092b | Python | aarti7/Coursera_Python | /user43_kpNkNDzdUJ_13.py | UTF-8 | 5,731 | 4.09375 | 4 | [] | no_license | # PYTHON QUICK GUIDE
# http://www.codeskulptor.org/#user43_kpNkNDzdUJ_11.py
# division example
# if one value is floating, result is floating. Else integer
a = 13/2
print(a)
a= 13.0/2
print(a)
a= 13/2.0
print(a)
a= 13.0/2.0
print(a)
# Modulo Example // # Remainder is dropped. It is not 'not di... | true |
4557eb62c31483a5edd95761bd0b3fbfabe9cd32 | Python | martinzelikovsky/Flora_Captsone_Project | /Methods.py | UTF-8 | 2,750 | 2.71875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jan 25 13:43:40 2020
Methods for Flora
@author: Jonathan
"""
from math import pi,atan,degrees,sqrt,radians
from numpy import sign
import numpy as np
from PIL import Image
def CartesianPolar(x,y):
#Takes x,y gets angle changes reference frame to lidar -> In rad
th... | true |
a963608ff0d0388dab590364c608cb22df7faf66 | Python | sharmishah/guvi | /code kata/playgrt.py | UTF-8 | 280 | 2.953125 | 3 | [] | no_license | def hcf(x3,y3):
if x3 < y3:
sh = x3
else:
sh = y3
for i in range(1,sh+1):
if (x3 % i == 0) and ( y3 % i ==0):
hcf = i
return hcf
af1 = int(input())
af2 = list(map(int,input().split()))
x3=af2[0]
for i in range(1,len(af2)):
x=hcf(x3,af2[i])
print(x3)
| true |
5636595d0ba6ec120008ce94db55d4f072b70dc8 | Python | gabaugusto/python_basic_projects | /rock_paper_scissor_lizard_spock.py | UTF-8 | 1,845 | 4.03125 | 4 | [
"MIT"
] | permissive | print('==================================================================')
print(' Rock Paper Scissor Lizard Spock Game')
print('==================================================================')
from random import randint
choice = ["Rock", "Paper", "Scissor", 'Lizard', 'Spock']
computer = choice[randint(0,2)... | true |
ca09557333e91db6444446e8bc145941999c0bb3 | Python | yuxuan813/emotion_based_spotify | /phptest/read.py | UTF-8 | 138 | 2.578125 | 3 | [] | no_license | import cv2
a=cv2.imread('face.jpg')
while True:
cv2.imshow("aaa",a)
key=cv2.waitKey(2)
if(key==ord('q')):
break
| true |
3551c33dcb686d1bcca1cba3a8907edbf0f31961 | Python | ramgopalV/Movie_Recommender_System_ML | /svd.py | UTF-8 | 2,467 | 2.796875 | 3 | [] | no_license | import pandas as pd
import numpy as np
import math
def pre_processing():
ratings=pd.read_csv('D:/MS/ML/ml-latest-small/ratings.csv')
del ratings['timestamp']
movies=pd.read_csv('D:/MS/ML/ml-latest-small/movies.csv')
final_dataset=pd.merge(ratings,movies,on='movieId')
utility_matrix=pd.pivot_table(final_d... | true |
3b8ab37102b463932c444ea596f486028c34d8e5 | Python | darshan3899/darshan_python | /Dicitionary/fromKeys.py | UTF-8 | 532 | 3.78125 | 4 | [] | no_license | #WAP to implement your own fromkey which ensures if value is list assing single value to each of the keys
#!/usr/bin/python
def fromKeys(dict1,list1):
keys=dict1.keys()
result=dict()
if type(list1)==list:
i=0
for x in keys:
if i<len(list1):
result[x]=list1[i]
i+=1
continue
result[x]=None
else:... | true |
473deb2169a4cc6728e9ca65cd75178bc3c2adfb | Python | gionanide/University_codingProjects | /Distributed_Systems/MapperB.py | UTF-8 | 549 | 2.828125 | 3 | [] | no_license | #!usr/bin/python
import sys
def readFile():
inputFile = sys.argv[1]
#outputFile = sys.argv[2]
print inputFile,outputFile
fileRead = open(inputFile,'r')
#fileWrite = open(outputFile,'w')
dictA=dict()
mapper(dictA,fileRead,fileWrite)
def mapper(dictA,fileRead,fileWrite):
for x in fileRead:
tvshow,channel =... | true |
6f31e86f9a57b9b7aed377e30b7bd512da63e07c | Python | Jyn-Mun/Marbles | /new.py | UTF-8 | 220 | 3.265625 | 3 | [] | no_license | for a in range(30):
for b in range(30):
for c in range(30):
for d in range(30):
if (a + b == 8) & (a + c == 13) & (b + d == 8):
print(a, b, c, d)
| true |
44d60a69f5e8a23688383a63bff1c73b33c0b5bb | Python | yan4702/WebDevelopment_PythonFlask | /app.py | UTF-8 | 8,058 | 2.671875 | 3 | [] | no_license | from flask import Flask, render_template, session, request, redirect, url_for, jsonify
import os
from flask_pymongo import PyMongo
import pymongo, json
from pymongo import MongoClient
import pandas as pd
from werkzeug.utils import secure_filename
app = Flask(__name__)
app.secret_key=os.urandom(24)
#Q2aii... | true |
278c7c19588aabac1cf072e169278693aa4494a2 | Python | y0608/HackTUES-9v1 | /crawler/database.py | UTF-8 | 440 | 2.640625 | 3 | [] | no_license | import sqlite3 as sqlite
import sys
import functools
con = sqlite.connect('ydb.db')
cur = con.cursor()
def MakeTable():
cur.execute("CREATE TABLE IF NOT EXISTS urlvis ( url TEXT )" )
def PushURL(URL):
cur.execute("INSERT INTO urlvis(url) VALUES(?)", (URL, ))
def URLvis(URL):
cur.execute("SELECT COUNT... | true |
53164b8d87c28b8127523a034cc4300b6d74a3ad | Python | rossant/galry | /galry/test/plot_colormap_test.py | UTF-8 | 795 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | import unittest
from galry import *
import numpy as np
from test import GalryTest
class PM(PaintManager):
def initialize(self):
x = np.array([-.5, .5, .5, .5, .5, -.5, -.5, -.5]).reshape((4, 2))
y = np.array([-.5, -.5, -.5, .5, .5, .5, .5, -.5]).reshape((4, 2))
color = np.zeros((4, 3))
... | true |
46e72ba2dd1bf04b13b9e55f81b75b89eef33ad4 | Python | callmewilko/testoob | /tests/large/dummyproject.py | UTF-8 | 235 | 3.03125 | 3 | [
"Apache-2.0"
] | permissive | "Dummy project to write tests for"
def do_things(cond):
if cond:
return 4
else:
return 5
def do_more_things():
x = 1
for i in xrange(10):
x *= 2
if x%3 == 15:
return 5
return 6
| true |
f4851b482a42f911e1eaf28fbf164518c6b8cda4 | Python | andydandy74/ClockworkForDynamo | /nodes/2.x/python/Binary.FromDecimal.py | UTF-8 | 80 | 2.671875 | 3 | [
"MIT"
] | permissive | if isinstance(IN[0], list): OUT = [bin(x) for x in IN[0]]
else: OUT = bin(IN[0]) | true |
58ee4e77d0c35364898c9d8c0c16dfbaab0c8fd8 | Python | Sunil-Y/INFO6205 | /Python/test/test_sort/test_simple/test_quick_sort_3way.py | UTF-8 | 619 | 3.265625 | 3 | [
"Apache-2.0"
] | permissive | import unittest
from sort.simple.quick_sort_3way import QuickSort3way
class TestQuickSort(unittest.TestCase):
def test_sort(self):
xs = [3, 4, 2, 1]
sorter = QuickSort3way()
ys = sorter.sort(xs)
self.assertSequenceEqual([1, 2, 3, 4], ys)
def test_partition(self):
xs ... | true |
5d7c6dff8d3f6664ddd7484262b74dc8d553fbf1 | Python | liulehui/EyeGazePipeline | /pipeline/predictor.py | UTF-8 | 3,827 | 2.78125 | 3 | [
"MIT"
] | permissive | # coding:utf-8
import pandas as pd
import torch
import torch.nn as nn
from torchvision import models, transforms
import io
import time
import os
from PIL import Image
import platform
class Predictor():
def __init__(self, num_of_class = 2):
self.num_of_class = num_of_class
self.predi... | true |
6d8e98a03f91a3bf9c9c85379da27c720c6abfa0 | Python | kute/purepythontest | /com/kute/scientificcomputation/matplotlib/subplot_custom.py | UTF-8 | 2,187 | 2.859375 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = 'kute'
# __mtime__ = '2017/2/5 22:24'
"""
http://matplotlib.org/users/gridspec.html
布局
"""
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from pylab import mpl
# 中文字体设置
mpl.rcParams['font.sans-serif'] = ['SimHei']
# - 符号显示为方块问题
mp... | true |
67dbaccc2c8507bb6335784671baaecb051275bd | Python | jjbeck/artemis | /py_code/artemis_annotation_calculation.py | UTF-8 | 6,087 | 2.65625 | 3 | [] | no_license | import os
import subprocess
import chardet
import pandas as pd
import pims
import yaml
def calculate_frames(video_path):
"""
Calculates total number of frames in video at video path.
:param video_path: Path to video.
:return: Integer of total number of frames.
"""
video = pims.PyAVReaderTimed(... | true |
c3b8219fec32df27542ecd651da5b96c104438f2 | Python | emojicks/PyMojicks | /pymojicks/__main__.py | UTF-8 | 1,059 | 2.78125 | 3 | [] | no_license | from argparse import ArgumentParser, FileType
from traceback import print_exc
import pymojicks
def core(parser, args):
if args.version:
return show_version()
if args.filename is None:
return run_repl()
else:
return run_code(args.filename)
def show_version():
print('Version:',... | true |
30559cf8b4d9be9b9602d27b1464bc5b22c61b54 | Python | aryeko/MITM | /Alice.py | UTF-8 | 2,382 | 3.40625 | 3 | [
"MIT"
] | permissive | __author__ = 'Liran & Rotem '
from Client import Client
PORT = 8886
HOST = ""
DST_IP = "127.0.0.1"
class Alice(Client):
def __init__(self):
super(Alice, self).__init__()
self.dst_port = ""
self.dst_ip = ""
self.my_password = ""
def open_connection(self):
super(Alice,... | true |
23e6b8b49d1571f0bf5265931b0f2f826de4119f | Python | L1xiaolong/hdr_crf_tonemapping | /test.py | UTF-8 | 3,163 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | from crc_mapping import camera_response_curve, hdr_gen, tone_mapping
import os
import time
import cv2.cv2 as cv2
import numpy as np
import matplotlib.pyplot as plt
def load_images_and_exposure_times(path):
print("-----------------------------------------------------")
print("-- images and exposure times loadi... | true |
c4c67900bf989553a9721e10e25ee05a17a5cf94 | Python | greeshma1987/flask-deployment-of-model | /lsl_send_data.py | UTF-8 | 5,075 | 2.625 | 3 | [] | no_license | """Example program to demonstrate how to send a multi-channel time-series
with proper meta-data to LSL."""
import sys
import getopt
import time
from random import random as rand
import pylsl
def main(argv):
srate = 100
name = 'LSLExampleAmp'
stream_type = 'EEG'
channel_names = [
... | true |
f93a964b7786cbc33d1958123f841757a3de293f | Python | pilliravikiran/catalog | /catalog/main.py | UTF-8 | 758 | 2.59375 | 3 | [] | no_license | from flask import Flask,redirect,url_for,render_template
app = Flask(__name__)
@app.route('/admin1')
def index():
return "<h1> Welcome to my saaho wrld</h1>"
@app.route('/hello/<int:a>/<username>')
def hello(a,username):
return 'Hello, {},{}'.format(username,a)
@app.route('/<int:a>')
def hi(a):
re... | true |
657c544165ddef921dbd12882bb5b23c90bf0cd5 | Python | KayakSoftware/KayakPrediction | /ActivityClassifier.py | UTF-8 | 3,213 | 2.5625 | 3 | [] | no_license | from FileFeatureExtracter import FileFeatureManager
import pickle
import numpy as np
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
from sklearn.preprocessing import RobustScaler;
from sklearn.preprocessing import OneHotEncoder;
RANDOM_SEED = 42
RELEVANT_ACTIVITIES = ["Walking"]
n... | true |
20eee5906f070ec26858dcda4c178672ac3fa747 | Python | taoting1234/captcha | /train.py | UTF-8 | 1,477 | 2.53125 | 3 | [] | no_license | import string
from helper import load_data
from keras.applications import *
from keras.callbacks import EarlyStopping, TensorBoard
from keras.layers import *
from keras.models import *
def train():
epoch = 1000 # 训练轮次
batch_size = 100 # 一次输入的大小
test_ratio = 0.1 # 测试集比例
size = (150, 50) # 固定尺寸
... | true |
5107e40fac7769eb5ba67e20a4127fa6152f6e45 | Python | manmeetsingh7781/PYTHON_TK | /Data/Driver.py | UTF-8 | 1,916 | 3.265625 | 3 | [] | no_license | """
Goal To create a ID card based on GUI
Things it should have
1. Name, age, address, sex, address right side of picture
2. Picture on Left corner
create a folder of driver info and read from it
"""
import os
class Driver:
name = None
dob_day, dob_month, dob_year = (None, None, None)
... | true |
01be26dddcc514d08c831537cbb36e56580d79dc | Python | divyajaincs/Python-Practice- | /assign10.py | UTF-8 | 507 | 3.09375 | 3 | [] | no_license | bill_id=1001
customer_id=101
bill_amount=200.0
print("bill_id:%d"%bill_id)
print("customer_id:%d"%customer_id)
print("bill_amount:Rs.%f"%bill_amount)
discounted_bill_amount=0.0;
if ((customer_id>100) and (customer_id<=1000)) is True:
if bill_amount>=500:
discounted_bill_amount=(bill_amount-bill_amount*(10/1... | true |
8b0bd7175d286cb6b223de6f699779e7a4246c47 | Python | nealhorner/Web-Crawler | /crawler.py | UTF-8 | 7,593 | 2.53125 | 3 | [] | no_license | # Simple Python Web Crawler
print("Program Starting\n")
domain = raw_input("Enter Domain: ") #"example.com"
print("")
jsonOkay = True
emailOkay = True
if emailOkay:
print("Email Settings")
FROM = raw_input("Enter From Address: ")
TO = [raw_input("Enter To Address: ")]
SERVICE = "smtp.gmail.com"
... | true |
e01baf54dab761e18f01dbe167932cb6b265fb1e | Python | michael-steiner/homologyProject | /OLDCode/BettiGraph-I.py | UTF-8 | 3,185 | 2.9375 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import graphviz
import numpy as np
import pandas as pd
import itertools as it
#####################definitions###########################
def findPathsNoLC(G,u,n):
if n==0:
return [[u]]
paths = []
for neighbor in G.neighbors(u):
for pat... | true |
ed2b06433dca83977ea5764b4fbbbebca199f53d | Python | khaledai/Data-Scientist-Python | /01_Importing Data in Python/08_Importing_MATLAB_Files.py | UTF-8 | 934 | 3.453125 | 3 | [] | no_license | # Importing MATLAB Files
# .mat Files
# SciPy to the Rescue
# scipy.io.loadmat() - read .mat files
# scipy.io.savemat() - write .mat files
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
filename = '../Dataset/Importing Data From Dataset/albeck_gene_expression.mat'
mat = scipy.io.loadmat(filename)
p... | true |
6193394a58fba5b089b2119cb7cf98929341ccb8 | Python | sunhuiquan/A-Top-Down-Approach | /CH2/BookExample/UDPclient.py | UTF-8 | 443 | 2.875 | 3 | [] | no_license | from socket import *
def main():
serverName = 'localhost'
serverPort = 12000
clientSocket = socket(AF_INET,SOCK_DGRAM)
message = input('Input lowercase sentence:')
clientSocket.sendto(message.encode(),(serverName,serverPort))
modifiedMessage, serverAddress = clientSocket.recvfrom(2048)
... | true |
ccf76f27495b1696b0a5d0741f76c8ab90b6c383 | Python | atulRanaa/problem-solving-directory | /Spoj/MOHIBPIZ.py | UTF-8 | 189 | 2.953125 | 3 | [] | no_license | t = int(input())
for _ in range(t):
# fn = n + fn-1
# fn = n + n-1 + n-2 + ... + f1
# fn = (n + 2)*(n-1)/2 + 2
n = int(input())
# print(n)
print((n*n + n + 2)>>1)
| true |
24cfaca1699bc9194e6859ff5bdb1ad83ca71204 | Python | npurson/machine-learning | /neural_network/nn/modules.py | UTF-8 | 15,099 | 3.265625 | 3 | [] | no_license | import numpy as np
from itertools import product
from . import tensor
class Module(object):
"""Base class for all neural network modules.
"""
def __init__(self) -> None:
"""If a module behaves different between training and testing,
its init method should inherit from this one."""
... | true |
236953eaa85ece19a2eead67cd4cf5db92d5a498 | Python | CharlesRandles/stock_tracker | /summary.py | UTF-8 | 1,782 | 2.546875 | 3 | [] | no_license | #!/usr/bin/python
import cgi
import cgitb
import holdings
import unittest
import configdb
import html
import stockdb
cgitb.enable()
######### HTML Generation ###############
def refresh_form():
f="""
<form method="GET" action="summary.py">
<input type="submit" value="Refresh" />
</form>
"""
... | true |
c622be1eff5b3d4a0c5819d50dc0e63c60b9efc0 | Python | Bunch-O-Fun/battleship | /Computer.py | UTF-8 | 2,651 | 4.21875 | 4 | [] | no_license | import random
from Board import Board
from Ship import Ship
from Tile import Tile
class Computer:
def __init__(self):
"""
Default Constructor
Parameters: n/a
Returns: n/a
Preconditions: n/a
Postconditions: A Computer object is created with a default Board o... | true |
da2a4af1619a945645102ee64c7d5e9fc120091d | Python | Zalasanjay/hacktoberfest2020-1 | /Projects/Python/Machine_Learning_Project/Wine_Quality_Dataset/pca.py | UTF-8 | 6,858 | 4 | 4 | [
"CC0-1.0",
"MIT"
] | permissive | # PCA(Principle Component Analysis)
# PCA mainly tries to learn the relationship between the different values and then project the data from a higher dimension to a lower dimension while retaining most of the information. It is highly affected by the outliers in the data.
# Often, the desired goal is to reduce the dime... | true |
239111a9207591bac23631fdf3194b91f88ee739 | Python | WhalepigJun/CodingTest | /problems/202108/20210824_E_P_10814_나이순정렬.py | UTF-8 | 210 | 2.921875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
N = int(input())
li = []
for _ in range(N):
li.append(list(input().split()))
li = sorted(li,key=lambda x : int(x[0]))
for i in range(N):
print(li[i][0], li[i][1])
| true |
eefc750febb416192b97d0c93ba53b6c99b3296a | Python | jordantrc/ms-project | /analysis/evaluate_predict_ret.py | UTF-8 | 2,040 | 3.296875 | 3 | [] | no_license | # evaluate_predict_ret.py
#
# Provides accuracy summary from a predict_ret.txt
# file produced by predict_c3d_ucf101.py
#
# Usage: evaluate_predict_ret.py <filename>
import sys
def main():
'''main function'''
if len(sys.argv) != 2:
print_help()
sys.exit(1)
file_name = sys.arg... | true |
4d285f4e3b6752e4aed7eab7f5ef228b4efb15f9 | Python | gustavoalisson/consumindo_api_python | /filme.py | UTF-8 | 1,267 | 3.453125 | 3 | [] | no_license | import requests
import json
def requisicao(name_filme):
key = '7d1c5a0d'
try:
req = requests.get(f'http://www.omdbapi.com/?t={name_filme}&apikey={key}').text
filme = json.loads(req)
return filme
except Exception as e:
print('Fail requests ', e)
exit()
def d... | true |
915eeaba5463cf37738f9951e0df3c208fc48572 | Python | Moslemi/MahdiMoslemi_public | /FindNodes/FindNodes.py | UTF-8 | 1,824 | 2.890625 | 3 | [] | no_license | from tkinter import *
from tkinter.filedialog import askopenfile, asksaveasfile, askopenfilename, askopenfilenames
from tkinter import filedialog
import csv
class BuckysButtons(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.grid()
self.create_widgets()
def creat... | true |
207b5ffb8a55f792e309b980bf3a0794eee003f3 | Python | PrimarySite/django-transitions | /testapp/tests/test_workflow.py | UTF-8 | 2,811 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""Workflow Tests."""
# Standard Library
import re
# Django
from django.test import TestCase
from django.utils import timezone
# Local
from ..workflows import LiveStatus
from ..models import Lifecycle
def compare_no_whitespace(a, b):
"""Compare two base strings, disregarding whitespace."... | true |
8b8ce4ecdff25ee833fb9a00a6cdd321e4ad33d8 | Python | nkpro2000sr/DataGenerator | /DataGenerator.py | UTF-8 | 14,580 | 3.03125 | 3 | [
"MIT"
] | permissive | import tensorflow as tf # tf.__version__=='1.14.0' and tf.keras.__version__=='2.2.4-tf'
import numpy as np
import os, multiprocessing, threading
from utils import _list_valid_filenames_in_directory
class DirectoryIterator (tf.keras.utils.Sequence):
"""Iterator capable of reading datas from a directory on disk.
... | true |
856881055fbb4694187cd75a55bdf12cfedf4e2f | Python | mich-chen/tandem-trivia | /tests/pytest_test.py | UTF-8 | 3,313 | 2.75 | 3 | [] | no_license | import pytest
# from pytest_mock import mocker
import os, sys
currentdir = os.path.dirname(os.path.realpath(__file__))
parentdir = os.path.dirname(currentdir)
sys.path.append(parentdir)
import server
from server import app
import random
import helper
# ******************* Globally define test data file ************... | true |
cbafb0d8ced6c6226e67df04dbc142a772625454 | Python | Kevinsiahaan/PA-1-Media-Belajar-Dengan-IoT- | /code/convert.py | UTF-8 | 112 | 2.671875 | 3 | [] | no_license | s = (input("masukkan karakter yang ingin di convert:\n"))
data = print(' '.join(format(ord(x), 'b') for x in s)) | true |
64a0e5c1521e335303007afd782d5c0183e399b5 | Python | odormond/adventofcode | /2021/21/twentyone.py | UTF-8 | 2,680 | 3.40625 | 3 | [] | no_license | #! /usr/bin/env python
from collections import defaultdict, Counter
from itertools import cycle, product
from pathlib import Path
from time import time, sleep
import advent_of_code as adv
def to_start_position(text):
return [int(player.split()[-1]) for player in text.strip().splitlines()]
test_pos = to_start_p... | true |
6dac7ce553b3a59468d2cd2df5872bd1b97d8592 | Python | ZhuMon/dict | /word_distribute.py | UTF-8 | 2,202 | 3.09375 | 3 | [
"BSD-2-Clause"
] | permissive | import sys
import subprocess
def count_first_char(words):
"""from a dict to count each number of first char
:words: dict
:returns: TODO
"""
chars = {}
for word, num in words.items():
chars[word[0]] = 1 if word[0] not in chars.keys() else chars[word[0]]+1
chars = sorted(chars.items... | true |
6b6c3e5f1029f8861dd6726d6fa52af1dbe994ac | Python | MelnikovaK/parsing | /app/app.py | UTF-8 | 1,340 | 2.859375 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
def write_csv(data):
with open('wildb.csv', 'a') as f:
writer = csv.writer(f, delimiter=';', lineterminator='\n')
writer.writerow( (data['brand'], data ['url'], data['price']))
def get_html(url):
r = requests.get(url)
return r.text
def contain_data(h... | true |
cb1d75feba1d0910de71455c886caf07339af403 | Python | axgraf/SarsCov2AminoAcidGrabber | /sarsCov2Lib/RangeDict.py | UTF-8 | 797 | 3.25 | 3 | [] | no_license | import collections
class RangeDict(collections.MutableMapping):
def __init__(self, *args, **kwargs):
self.store = dict()
self.update(dict(*args, **kwargs))
def __getitem__(self, key):
return self.store[key]
#return self.store[self.transform_key(key)]
def __setitem__(self... | true |
58d71528dcdd132fe761cb441c8cd6dcdd60ef81 | Python | Vincent105/python | /01_Python_Crash_Course/0501_if/05T2_if_else.py | UTF-8 | 1,603 | 3.296875 | 3 | [] | no_license | alien_colors = ['green','red','yellow']
user1_color = 'purple'
user2_color = 'green'
if user1_color in alien_colors:
print("Player,Your have get 5 points.")
if user2_color in alien_colors:
print("Player,Your have get 5 points.")
if user1_color == 'green':
print("Player,Your have get 5 points.")
if user2_col... | true |