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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
9a1b9bd6f73050cb215613bdf1e0923e4c200866 | Python | nyucusp/gx5003-fall2013 | /jsa325/Assignment 1/problem2.py | UTF-8 | 536 | 3.03125 | 3 | [] | no_license | import sys
import math
<<<<<<< HEAD
jollyValue = True
=======
>>>>>>> d6f40eeb85f30f87d7da17a58e366c13cf23b728
n = int(sys.argv[1])
inp = sys.argv[2:]
intList = map(int, inp) # map integers to list
out = []
for i in range(1, n):
out.append(math.fabs(inp[i] - inp[i - 1]))
out.sort()
val = 0
for i in ran... | true |
f1f77f7d8fd15a27a4413f68f1e5b632846d7b2e | Python | darkismus/mooc-ohjelmointi-21 | /osa04-07a_alkioiden_arvojen_muutokset/test/test_alkioiden_arvojen_muutokset.py | UTF-8 | 2,547 | 2.71875 | 3 | [] | no_license | import unittest
from unittest.mock import patch
from tmc import points
from tmc.utils import load_module, reload_module, get_stdout, check_source
from functools import reduce
from random import randint
exercise = 'src.alkioiden_arvojen_muutokset'
def f(d):
return '\n'.join(d)
def getcor(l):
ls = list(range(... | true |
e0302440874c23a58d11fe527d89f264b1457e25 | Python | senecal-jjs/IMBD | /Revenue_Prediction.py | UTF-8 | 8,177 | 3.125 | 3 | [] | no_license | import numpy as np
import random
import collections
from operator import itemgetter
from scipy.stats.stats import pearsonr
from scipy.stats.stats import spearmanr
from sklearn.neighbors.kde import KernelDensity
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from Tki... | true |
6e51c67de8b6d43e05ba3f30950702f02f1de368 | Python | huomanyan/old_build | /untitled1/train.py | UTF-8 | 1,431 | 2.53125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu May 16 15:51:16 2019
@author: lenovo
"""
import tensorflow as tf
from tensorflow.contrib.learn.python.learn.datasets.mnist import read_data_sets
import numpy as np
from sklearn.utils import shuffle
from lenet_slim import Lenet
tf.reset_default_graph()
mnist = read_data_s... | true |
146d4ab1ddaa0d9d414d9d6db91bbb6f65eaf987 | Python | iamzhanghao/Security_Lab | /lab6/present.py | UTF-8 | 3,868 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python3
# Present skeleton file for 50.020 Security
# Oka, SUTD, 2014
#constants
fullround=31
#S-Box Layer
sbox=[0xC,0x5,0x6,0xB,0x9,0x0,0xA,0xD,0x3,0xE,0xF,0x8,0x4,0x7,0x1,0x2]
#S-Box Layer inverse
sbox_inv=[]
for i in range(16):
sbox_inv.append(0)
counter = 0
for i in range(16):
sbox_inv[sb... | true |
dc830daab6218a6f6224ecfac6283f6612f89ffb | Python | SharanyaMarathe/Advance-Python | /calci.py | UTF-8 | 288 | 3.65625 | 4 | [] | no_license | def add(num1,num2):
return num1+num2
def sub(num1,num2):
return num1-num2
if __name__ == "__main__":
alpha=10
beta=20
total=add(alpha,beta)
print("sum: ",total)
subtarct=sub(alpha,beta)
print("Difference: ",subtarct)
| true |
75d6d6fa327a2087b47a98cbbffcb6a7e51cfd7a | Python | momendoufu/foldersorter | /FolderSorter_v2.py | UTF-8 | 2,498 | 2.890625 | 3 | [] | no_license | import sys
import os
import shutil
import pathlib
from pathlib import Path
import glob
import re
#############################################################
print(f'\ncwd: {os.path.dirname(__file__)}\n')
PATH = sys.argv[1]
if not os.path.exists(PATH):
print(f'specified folder does not exist')
sys.exit()... | true |
7351bb01713806b1397577dbb7e9bd10e63ac893 | Python | watir/nerodia | /nerodia/elements/button.py | UTF-8 | 704 | 2.890625 | 3 | [
"MIT"
] | permissive | import six
from .input import Input
from ..meta_elements import MetaHTMLElement
@six.add_metaclass(MetaHTMLElement)
class Button(Input):
"""
Class representing button elements
This class covers both <button> and <input type="submit|reset|image|button" /> elements
"""
VALID_TYPES = ['button', 're... | true |
c2cfd7f9ee4aa1a6ea3d6a80b5af13c2f7ecc4e2 | Python | tmu-nlp/100knock2021 | /pan/chapter06/X58.py | UTF-8 | 1,683 | 3.25 | 3 | [] | no_license | #正則化パラメータの変更
import time
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
if __name__ == '__main__':
start = time.time()
X_train = pd.read_table('train.feature.txt', header = None)
Y_train = pd.read_table('tr... | true |
7246520b4773032de34d90e147332f78084880c1 | Python | richard9219/predict_api_by_flask-tensorflow | /train.py | UTF-8 | 1,293 | 2.890625 | 3 | [] | no_license | # -*- coding:utf-8 -*-
# 导入panda,keras 和tensorflow
import pandas as pd
from tensorflow.keras.models import Sequential #顺序模型
from tensorflow.keras.layers import Dense #全链接层
# 加载样本数据集,划分为x和y DataFrame
df = pd.read_csv("https://github.com/bgweber/Twitch/raw/master/Recommendations/games-expand.csv")
df_data = df.drop([... | true |
6fbaf595b812927579de3154aa0deed6001ae126 | Python | millerjl1980/student_spotlight_map_filter | /main.py | UTF-8 | 426 | 4.0625 | 4 | [] | no_license |
add_one = lambda num: num + 1
# print(add_one(5))
# add_together = lambda x, y: x + y
# print(add_together("Hello", " World"))
# odd_nums = [num for num in range(20) if num %2 != 0]
# even_nums = [num for num in range(30) if num %2 == 0]
# print(odd_nums)
# print(even_nums)
# sums = list(map(add_together, odd_nums... | true |
6637ce8016d1ea774dd9faa378b3cd0863665f0d | Python | sxg133/code-to-html | /code_to_html.py | UTF-8 | 6,218 | 2.90625 | 3 | [] | no_license | import re
class CommentStyle:
SCRIPT, C = range(2)
class CodeConverter:
"""Convert code to HTML markup"""
def keyword_class():
doc = "The CSS class of language keywords."
def fget(self):
return self._keyword_class
def fset(self, value):
self._keyword_class = value
return loca... | true |
0def8a4e7c74aaad4c1bb8f14867e39b5f6e78f6 | Python | AleKiller21/crud-rest-api | /services/GameService.py | UTF-8 | 2,718 | 2.578125 | 3 | [] | no_license | from services.UtilService import check_fields_existance_in_payload
import services.MessageService as MessageService
from dao.GameDao import create_game, retrieve_game, get_games, update_game, delete_game
def add_game(payload):
try:
if check_fields_existance_in_payload(payload, 'name', 'developer', 'publis... | true |
29477801414fbb1cbc03b33cec7e6eecb2ce9e52 | Python | brudolce/codewars | /4-kyu/Breadcrumb Generator.py | UTF-8 | 1,354 | 3.109375 | 3 | [] | no_license | def generate_bc(url, separator):
if '//' in url:
url = url[url.index('//') + 2:]
url = url.rstrip('/')
try:
for i, c in enumerate(url):
if c in ['?', '#']:
url = url[0:i]
break
menus = url.split('/')[1:]
if menus and 'index.' == ... | true |
8ee0fd697d457e7d5c994acec752f00afe408251 | Python | yoryos/dragonfly | /Visualiser/StdpVisualiser.py | UTF-8 | 3,014 | 2.546875 | 3 | [] | no_license | from pyqtgraph.Qt import QtCore, QtGui
from Visualiser.RasterVisualiser import RasterVisualiser
from Visualiser.VisualiserComponent import VisualiserComponent
class StdpVisualiser(VisualiserComponent):
def __init__(self, afferent_data=None, output_data=None, default_history=50):
VisualiserComponent.__init... | true |
258697bf9ceee23b81f042c7387fa0e979e53d2b | Python | lisaong/mldds-courseware | /05_Deploy/web/models.py | UTF-8 | 2,021 | 2.96875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import pickle
import os
import boto3
class AutoMpg_Sklearn:
def __init__(self, model_path):
"""Loads the model files"""
self.X_scaler = pickle.load(open(os.path.join(model_path, 'X_scaler.pickle'), 'rb'))
self.y_scaler = pickle.load(open(os.path.join(m... | true |
c3050066c34c76a83137010998bce17790c4c9d1 | Python | caiknife/test-python-project | /src/ProjectEuler/p014.py | UTF-8 | 878 | 3.875 | 4 | [] | no_license | #!/usr/bin/python
# coding: UTF-8
"""
@author: CaiKnife
Longest Collatz sequence
Problem 14
The following iterative sequence is defined for the set of positive integers:
n n/2 (n is even)
n 3n + 1 (n is odd)
Using the rule above and starting with 13, we generate the following sequence:
13 40 20 10 5 16 8 4... | true |
1cdf72d694a5e85ea5e7c83daf412980c58f1b09 | Python | yangwenbo99/CityHack-Team7-HongTakAgreement | /shitty_code/entity_name.py | UTF-8 | 2,306 | 2.578125 | 3 | [] | no_license | import re
import wf
MAX_FREQUENT_WORDS = 300
MAX_TESTED_FREQUENT_WORDS = 100
MAX_FRONT_PAGES_NUMBER = 3
with open('./postal_address_words.txt', 'r') as f:
_address_word_list = [r for r in f]
with open('./word_frequencies.txt', 'r') as f:
_word_requency_list = wf.read_word_frequence(f, MAX_FREQUENT_WORDS)
de... | true |
d7f882756ccae902bee289e75a2f025bf59e66af | Python | JorgeCCV/Taller2 | /Primera_Letra_JorgeC.py | UTF-8 | 308 | 3.453125 | 3 | [] | no_license | import turtle
t=turtle.Pen()
t.forward(100)
t.left(90)
t.forward(200)
t.left(180)
t.left(90)
t.forward(80)
t.left(90)
t.forward(40)
t.right(270)
t.forward(200)
t.right(270)
t.forward(40)
t.right(270)
t.forward(80)
t.left(270)
t.forward(160)
t.left(270)
t.forward(60)
t.right(270)
t.forward(50)
| true |
6c12a15c41416bbde87641c54368a2978fec34cc | Python | matrixleon18/SHUFE | /basic/day1.py | UTF-8 | 769 | 4.1875 | 4 | [] | no_license |
# basic data type
# int
print(int(32))
# float
print(float(32))
# string
print(str(32))
# bool: True/False
print(bool(32))
# nothing
print()
# bool
print(32 == 0)
# bool
print(32 is 0)
# bool
print(32 and True)
print(32 and False)
print(0 and True)
print(0 and False)
# Tuple
a = (1, 2, 3)
# index start from 0
print(a... | true |
ca65763e120d7b8d6e41a44dbb9bd395dc206c65 | Python | Greyvar/client | /var/makeResourceSheet.py | UTF-8 | 1,307 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python3
import sys
from PIL import Image
import argparse
parser = argparse.ArgumentParser();
parser.add_argument("--paper_width", default = 2480)
parser.add_argument("--paper_height", default = 3508)
parser.add_argument("--tile_size", default = 256)
parser.add_argument("--tileMargin", default = 40)
p... | true |
4fecf2050fdfc27341cc2ee73e2d8597a88d87e1 | Python | agatanyc/RC | /algorithms_DS/basic_ds/queue_2stacks.py | UTF-8 | 1,224 | 4.4375 | 4 | [] | no_license | """Implement a queue with 2 stacks. Your queue should have an enqueue
and a dequeue function and it should be "first in first out" (FIFO)."""
class Stack():
def __init__(self):
self.items = []
def add(self, item):
return self.items.append(item)
def pop(self):
return self.item... | true |
46ca5f6b14ac52c628d120c5e6a2b2f7ea9eac73 | Python | Kitware/vtk-examples | /src/Python/Tutorial/Tutorial_Step5.py | UTF-8 | 4,891 | 2.984375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""
=========================================================================
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without... | true |
0f7f074783c90de68dc1f57b2e9a9d6423e9c922 | Python | Silver-L/keras_projects | /vae/ResVAE.ver3/predict_spe.py | UTF-8 | 3,117 | 2.78125 | 3 | [
"MIT"
] | permissive | """
* @predict specificity
* @Author: Zhihui Lu
* @Date: 2018/09/03
"""
import os
import time
import numpy as np
import argparse
import SimpleITK as sitk
import csv
from keras import backend as K
from keras.models import load_model
import dataIO as io
# os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
def predict_spe():
... | true |
7b5a77a3425bfd1036be983def717bbd44a3d3bb | Python | Kiran8206/TakeAway-Data-Aggregation | /TakeAway.py | UTF-8 | 1,468 | 2.859375 | 3 | [] | no_license | # Databricks notebook source
from pyspark.sql import SparkSession
import pyspark.sql.functions as F
from pyspark.sql.types import DoubleType
# Creation of Spark Session object and initial Dataframe
spark = SparkSession.builder.getOrCreate()
df = spark.read.format("Json").option("inferSchema", "true").load("/FileStore/... | true |
0e6d5d0bb7562a02e24a229b260cb399d2972a5f | Python | asdfasadfasfa/Some_Scripts | /service/ldap_unauth.py | UTF-8 | 961 | 2.5625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import ldap3
import re
def get_plugin_info():
plugin_info = {
"name": "ldap 未授权",
"desc": "导致数据库敏感信息泄露,严重可导致服务器被入侵。",
"grade": "高",
"type": "service",
"keyword": "service:ldap port:389",
}
return plugin_info
def poc(ar... | true |
20402cca9bf3590c52a35755453d2fa0ae3e16b0 | Python | jmnosal/GA-DSI-projects | /project-02/Project2_Classes.py | UTF-8 | 4,731 | 3.515625 | 4 | [] | no_license | class OSM:
#Creates a new Online Store Machine that creates new stores of a given inventory type
def __init__(self, name, *args):
self.number_of_stores = 0
self.list_of_stores = []
self.type_of_inv = list(args)
self.name = name
def createOnlineStore(self, store):
# c... | true |
2bc04973dbd1af6c4821e8e6d50cfd0f97cb8932 | Python | paaja90/pyladies | /lekce 06/rodnecislo_2.py | UTF-8 | 2,149 | 3.78125 | 4 | [] | no_license | def spravny_format(cislo):
while True:
if cislo.isalpha(): #tady se mě ty try/except bloky nezdály, když bych tím ověřovala zda zadal integer, tak to neuzná '/' a s tím .isalpha si to nerozumnělo
print('Rodné číslo neobsahuje pismena')
cislo = input('Zadej rodné číslo znovu:')
... | true |
513ba0024a28d9872f63d86023a3c7b15228c067 | Python | coomdan/codebase | /python/key-renamer/key-renamer.py | UTF-8 | 885 | 2.875 | 3 | [] | no_license | #
import glob, os.path, shutil
key_path = "key-files/"
input_dir = key_path + "unverified"
archive_dir = key_path + "archive"
pattern = "test-keyfile*.keys"
def find_files(pattern):
files = glob.glob(input_dir + '/' + pattern)
return files
def verify_keyfiles(files):
verified_files = []
for file ... | true |
c91c3d8b0b69ec6ed9cf8b8c8f8fac64cbd25da2 | Python | AnthonyZero/python-accumulation | /custom_scrapy.py | UTF-8 | 3,169 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# encoding: utf-8
'''
@author: AnthonyZero
@file: custom_scrapy.py
@time: 2018/11/20 10:46
@desc: 自定义简单scrapy框架
'''
import types
from twisted.internet import defer #特殊的socket对象(不会发请求 手动移除)
from twisted.web.client import getPage #socket对象
from twisted.internet import reactor #事件循环
import queue... | true |
2955dc07b1947c84836956342061647950104c50 | Python | tokuD/atcoder | /Practice/031.py | UTF-8 | 1,383 | 2.609375 | 3 | [] | no_license | # from __future__ import annotations
from typing import List,Union
import sys
input = sys.stdin.readline
from collections import deque
# from itertools import permutations,combinations
# from bisect import bisect_left,bisect_right
# import heapq
# sys.setrecursionlimit(10**5)
def main():
X,Y = map(int, input().spl... | true |
02721c9e4a39f1efddfc2df38384dc249760f268 | Python | hwinter/practicecodes | /dih_create_goes_times.py | UTF-8 | 1,049 | 2.859375 | 3 | [] | no_license | from datetime import datetime
from datetime import timedelta
#
#
#Needs Docs!
#
#Name: dih_create_goes_times
#
#Purpose: takes times created by IDL goes finder and puts them in '%d-%m-%Y %H:%M:%S.%f' format
#
#Inputs: list of GOES times
#
#Outputs: list of AIA suitable times
#
#Examples gah = dih_create_goes_times(['01... | true |
70b81494d57119f2f3e07e4b2ab23b1400c050ad | Python | creek0810/sic-macro-processor | /macroProcessor/macroProcessor.py | UTF-8 | 4,147 | 2.796875 | 3 | [] | no_license | class MacroProcessor:
def __init__(self, file_path):
self.def_table = {}
self.path = file_path
def _is_comment(self, cur_line):
return cur_line.startswith(".")
def _is_macro_def(self, cur_line):
split_data = cur_line.split()
return len(split_data) >= 2 and... | true |
fbf864e62058623e24e7933aa18f5205eca92601 | Python | Jungerson/Manual | /scripts/insert_items.py | UTF-8 | 867 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import sys
import csv
import json
import boto3
if len(sys.argv) != 3:
print("Usage: python3 insert_items.py <csv file> <deploy stage>")
sys.exit(-1)
client = boto3.client('dynamodb', region_name='us-east-1')
csv_file = sys.argv[1]
stage = sys.argv[2]
with open(csv_file) as f:
reader = c... | true |
a4f30db37646e31ef265212ad47dda4476957214 | Python | konchunas/pyrs | /examples/monkeytype/main.py | UTF-8 | 278 | 3.765625 | 4 | [
"MIT"
] | permissive | # please refer to __init__.py file for an explanation
def has_even(numbers):
for num in numbers:
if num % 2 == 0:
return True
return False
def main():
vec = [1,9,2,5,4]
even_exists = has_even(vec)
print("Has even number", even_exists)
| true |
9206d9a745da78a0ce01b50908c23c08f1e2eac7 | Python | DanishKhan14/DumbCoder | /Python/Expression/Tree/minDepth.py | UTF-8 | 1,006 | 3.515625 | 4 | [] | no_license | #!/usr/bin/python
def minDepth(self, root): # Recursive
"""
:param self:
:param root:
:return:
"""
if root is None:
return 0
if root.left is None and root.right is None:
return 1
if root.left is None:
return 1... | true |
22b521ca6644618be9ba10b9b5cb5fb7c653ab78 | Python | ammeyer/genetics-curriculum | /rosalind.py | UTF-8 | 11,665 | 2.796875 | 3 | [] | no_license | import math
import itertools
import re
def count_nucleotides(s):
"""Description here"""
return s.count('A') + ' ' + s.count('C') + ' ' + s.count('G') + ' ' + s.count('T')
#sequence = "CCTGAGAACGCTACAGCGGCGAGCGACGTACAGGCAAGGAGGCTACTGAGTACATTTATGTTGATTCTATACAATGGTCGTCACAATAATAGGACACCCCCATAAAGTGGCAAGTTAGTTAGGTGGGGGTTA... | true |
fe16ab3a1249f0fa8c93b3616ab962e746459049 | Python | tobikausk/Python-Module-of-the-Week | /session1_Decorators/printtime.py | UTF-8 | 389 | 3.109375 | 3 | [
"MIT"
] | permissive | """
Exercise — a decorator which times function execution
Write 'printtime' decorator which prints
how long a function took to execute.
@printtime
def loooong():
s = 0
for i in range(1000000):
s += i**2
return s
>>> looong()
looong took 5.0323423 s
333332833333500000
>>> time.time()
>>> time.tim... | true |
dff9ffa93f01a8d38bc426d30a79f071b22eac5e | Python | vivek1262/Initialprog.github.io | /simpleIf.py | UTF-8 | 102 | 3.53125 | 4 | [] | no_license | x=10
if (x==10):
print('x value is ',x);
else:
print('x value is ',x,'from else');
| true |
9bf55038a43a5cb94b419091170ee89444b6a416 | Python | filmackay/flypy | /flypy/compiler/frontend/utils.py | UTF-8 | 1,110 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | # -*- coding: utf-8 -*-
"""
Utilities for working with bytecode.
"""
from __future__ import print_function, division, absolute_import
import collections
import functools
class SortedMap(collections.Mapping):
'''Immutable
'''
def __init__(self, seq):
self._values = []
self._index = {}
... | true |
b1e38ba5a6ee837853fb424306b994fbe5f0566b | Python | ml-in-programming/ml-on-source-code-models | /psob_authorship/features/java/line_metrics/LineMetricsCalculator.py | UTF-8 | 5,878 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import logging
import os
import subprocess
from collections import defaultdict
from typing import Dict, Set, List
import torch
from psob_authorship.features.utils import get_absfilepaths, \
divide_ratio_with_handling_zero_division, \
divide_nonnegative_with_handling_zero_division
class LineMetricsCalculator... | true |
4ad18e0796dd70f419112be7815e3f21df281d6e | Python | soongon/python-auto | /ask-money.py | UTF-8 | 1,351 | 2.859375 | 3 | [] | no_license | import openpyxl
import smtplib
import email
import pprint
def get_not_paid_members(ws):
not_paid_list = []
for row_index in range(2, ws.max_row + 1):
if '미결제' in ws.cell(row_index, 4).value:
not_paid_list.append(
[ws.cell(row_index, 1).value,
ws.cell(row_ind... | true |
8e015026ae3c4b2fc98288e09eb5b4cff27edff8 | Python | Jeremy277/exercise | /pytnon-month01/month01-shibw-notes/day01-shibw/demo01-input&print.py | UTF-8 | 574 | 3.90625 | 4 | [] | no_license | #注释 给别人看的 不是让计算机执行的
#注释写的是对代码的描述
#input叫做一种函数 作用是接受用户的输入内容
# = 的作用是将右边得到的结果赋值给左边
#写程序时 可能先写右侧 后写左侧
str1 = input('请输入...')
#print也是一种函数 作用是向终端输入内容
print('hello world')
#有交互
#接受用户输入内容 输出对应的结果
str2 = input('请输入第二次内容...')
#ctrl + z 撤销上次操作
#shift+alt + 上下箭头移动行
print(str2)
| true |
2d22f9f05596a6d2eeb5ba07be2fd819ce931425 | Python | bobby-palko/100-days-of-python | /33/ui.py | UTF-8 | 2,166 | 3.40625 | 3 | [] | no_license | from tkinter import *
from quiz_brain import QuizBrain
THEME_COLOR = "#375362"
QUESTION_FONT = ("Arial", 14, "italic")
SCORE_FONT = ("Arial", 10, "bold")
class QuizInterface:
def __init__(self, quiz_brain: QuizBrain):
self.quiz = quiz_brain
self.window = Tk()
self.window.title("Quizzler")... | true |
d0e3fe268012e5a3087c48a2f4b673b78a8574df | Python | all1m-algorithm-study/2021-1-Algorithm-Study | /week2/Group6/boj2839_donghoonKang.py | UTF-8 | 359 | 3.171875 | 3 | [] | no_license | N = int(input())
M = N // 5
five, three = 0, 0
flag = False
while M != 0:
Ncopy = N
Ncopy = Ncopy - M*5
if Ncopy % 3 == 0:
five = M
three = Ncopy // 3
break
M -= 1
if M == 0:
flag = True
if flag == True and N % 3 == 0:
print(N//3)
elif flag == True and N % 3 != 0:
... | true |
9df7685ee95a0c8480dc2efea89c6e014dac7faf | Python | pseudogram/pendulum_v0 | /optimizers.py | UTF-8 | 10,966 | 2.71875 | 3 | [] | no_license | from deap import creator
from deap import base
from deap import tools
import numpy as np
import random
import gym
from rnn import Basic_rnn, FullyConnectedRNN
from pprint import pprint
import environment
# ------------------------------------------------------------------------------
# SET UP: O... | true |
60333008a07d076a1f5b35144d6372e90bc9910a | Python | MagicWishMonkey/artofoldindia | /scrape.py | UTF-8 | 5,354 | 2.6875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from selenium import webdriver
from fuze import toolkit, util
driver = webdriver.Chrome()
def scrape_category(category):
uri = "http://www.artofoldindia.com/product-category/%s" % category
driver.get(uri)
breadcrumb = driver.find_element_by_id("breadcrumb")
breadcrumb = brea... | true |
239a5babfec5b5fecb3e9a11f6a168d75fa779b6 | Python | LadislavVasina1/PythonStudy | /ProgramFlow/trueFalse.py | UTF-8 | 285 | 3.875 | 4 | [] | no_license | day = "Monday"
temperature = 30
raining = True
if (day == "Saturday" and temperature > 27) or not raining:
print("Go swimming.")
else:
print("Learn Python")
name = input("Enter your name: ")
if name:
print(f"Hi, {name}")
else:
print("Are you the man with no name?")
| true |
7cd84097affd4516f216d295526853bc252eb7e7 | Python | standardgalactic/kuhner-python | /mutation_clusters/classify_bysize.py | UTF-8 | 4,800 | 2.875 | 3 | [] | no_license | # classify.py Mary Kuhner and Jon Yamato 2018/04/02
# This program receives the output of bamscore.py
# to answer the question "For two mutations close enough together
# that they might be in the same read, how often are they actually both
# present on a read spanning both their positions?"
# NOT... | true |
96e2a52db5d6e3a9014b3bd2fdff198a005bdd21 | Python | andreaowu/IPaddresses | /onesify.py | UTF-8 | 1,187 | 2.96875 | 3 | [] | no_license | from scapy.all import *
import re
import json
class ProcessPacket:
def __init__(self):
''' Initializes constants needed to process the packet and then
processes the packet
'''
self.get_input()
def get_input(self):
'''Reads given pcap file and parses it'''
... | true |
923f7091e165c3f8a0a628e27db832bdd1b7ab21 | Python | jzraiti/Coverage_Algorithm_Enviornmental_Sampling_Autonomous_Surface_Vehicle | /Project_Files/Jasons_Functions/trim_edges.py | UTF-8 | 3,205 | 3.109375 | 3 | [] | no_license | #Jasons script for trimming edges
import matplotlib.pyplot as plt
# import sys
# sys.path.append("/home/jasonraiti/Documents/GitHub/USC_REU/Project_Files/Jasons_Functions/")
from skeleton_to_graph import * # graph = skeleton_to_graph(path)
from open_or_show_image import * # image = open_image(path) , show_image(ima... | true |
a52eaf4bec2109785b15c32b97f6bbde875f8fa4 | Python | roiei/algo | /leet_code/1652. Defuse the Bomb.py | UTF-8 | 934 | 3.203125 | 3 | [] | no_license |
import time
from util.util_list import *
from util.util_tree import *
import copy
import collections
class Solution:
def decrypt(self, code: [int], k: int) -> [int]:
res = []
n = len(code)
reversed = False
if k < 0:
code = code[::-1]
... | true |
8e6264e959113ac87e6928c2f8ffee467fe7aace | Python | yumendy/LeetCode | /Python/Next Greater Element I.py | UTF-8 | 547 | 3.34375 | 3 | [] | no_license | class Solution(object):
def nextGreaterElement(self, findNums, nums):
"""
:type findNums: List[int]
:type nums: List[int]
:rtype: List[int]
"""
self.nums = nums
return map(self.next_num_in_nums, findNums)
def next_num_in_nums(self, num):
t... | true |
d953612de31d5b43e19ce926c26529997040681d | Python | A-Amani/gfkTasks | /Task3/Modelling/Model.py | UTF-8 | 4,192 | 2.78125 | 3 | [] | no_license | import os
from pathlib import Path
import pickle
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.linear_model import SGDClassifier, LogisticRegressio... | true |
fe94424473237809ce3c5f0be9a40181e219949e | Python | emplam27/Python-Algorithm | /SWE_Ploblems/D2_1979_단어퍼즐.py | UTF-8 | 918 | 2.734375 | 3 | [] | no_license | import sys
sys.stdin = open("input.txt", "r")
T = int(input())
for t in range(1, T + 1):
N, K = map(int, input().split())
board = [list(map(int, input().split())) for _ in range(N)]
New_board = [[0] * N for _ in range(N)]
cnt = 0
for i in range(N):
sum_num = 0
for j in range(N):
... | true |
17fe94a87be4767a9513211760d44e4635c4252e | Python | dambac/NTU | /scripts/definitions/models/m_classic_xavier.py | UTF-8 | 2,289 | 2.859375 | 3 | [] | no_license | import torch
encoder_hidden_size = 2048
classifier_hidden_size = 2048
output_size = 2
class MClassicXavier(torch.nn.Module):
@staticmethod
def create(input_size):
net: MClassicXavier = MClassicXavier(input_size)
# initialization function, first checks the module type,
# then applies... | true |
8c5696eadc00cc8e9053b0a9bb0a6406a6674e25 | Python | shweta2425/ML-Python | /Week2/Array3.py | UTF-8 | 438 | 4.25 | 4 | [] | no_license | # Write a Python program to get the number of occurrences of a specified element in an array.
from Week2.Utilities import utility
class Array3:
# creating class obj
obj = utility.User()
# Accepts array from user
arr1 = obj.accepts()
def Count(self):
num = int(input("enter ele to count")... | true |
92c71e98d4cafea278ca94cf43f30c765987082c | Python | GuidoPaul/Deep-Learning-Nanodegree-Foundation | /intro-to-tensorflow/miniflow/nn.py | UTF-8 | 3,210 | 2.890625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Filename: nn.py
import numpy as np
from sklearn.datasets import load_boston
from sklearn.utils import shuffle, resample
from miniflow import Input, Linear, Sigmoid, MSE, topological_sort, forward_pass, forward_and_backward, sgd_update
# ---------------------------------... | true |
24089e78e3040e37a8954861b3d4866eae0402d6 | Python | jnech1997/hash-code | /main.py | UTF-8 | 4,452 | 2.984375 | 3 | [] | no_license | import networkx as nx
from submit import create_submit_file
# HashMap key: streets, val: # of times hit by any path
streetHits = {}
carStarts = {}
streetTimes = {}
totalDuration = 0
def createGraph(filename):
f = open(filename, "r")
DG = nx.DiGraph()
Lines = f.readlines()
count = 0
numIntersectio... | true |
e7136a53586ba4ee5022b86970bce3b835902dce | Python | melalex/NM2_RGR1 | /bin/power_method/max_eigen_pair.py | UTF-8 | 880 | 2.546875 | 3 | [] | no_license | import numpy as np
import itertools
def max_eigen_pair(matrix, eps, p, delta):
dimension = len(matrix)
y = np.ones(dimension).reshape(dimension, 1)
lambda_next = np.full(dimension, 9.)
z_next = y / np.linalg.norm(y)
s = [i for i in range(dimension)]
k = 0
for k in itertools.count(1):
... | true |
19bdd0ce59e5e736a0bf4ed06ac70155b45d5a4c | Python | ZoranPandovski/al-go-rithms | /cryptography/steganography/python/steganography.py | UTF-8 | 4,403 | 2.71875 | 3 | [
"CC0-1.0"
] | permissive | import getopt
import math
import os
import struct
import sys
import wave
def hide(sound_path, file_path, output_path, num_lsb):
sound = wave.open(sound_path, "r")
params = sound.getparams()
num_channels = sound.getnchannels()
sample_width = sound.getsampwidth()
num_frames = sound.getnframes()... | true |
10f2932c8db894ab19afcb847f455d69de9b0e40 | Python | welcomeying/movie_trailer_website | /entertainment_center.py | UTF-8 | 1,154 | 2.9375 | 3 | [] | no_license | import media
import fresh_tomatoes
# My favorite movies
despicable_me = media.Movie("Despicable Me",
"Despicable masters and his Minions",
"https://upload.wikimedia.org/wikipedia/en/thumb/d/db/Despicable_Me_Poster.jpg/220px-Despicable_Me_Poster.jpg",
... | true |
992239bdc29910de44bedbaf400ab9783e1752be | Python | PeizeSun/OneNet | /tests/layers/test_roi_align.py | UTF-8 | 5,389 | 2.625 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
import unittest
import cv2
import torch
from fvcore.common.benchmark import benchmark
from detectron2.layers.roi_align import ROIAlign
class ROIAlignTest(unittest.TestCase):
def test_forward_output(self):
input = np... | true |
44321594545280581ac469e900190f0bee5d27e3 | Python | phoenixperry/Python_101_class | /day18/scratch_c.py | UTF-8 | 175 | 3.453125 | 3 | [] | no_license | #empty dictionary
letter_count = {}
letter_count ["one"] = 2
print(letter_count.get("one",0)+5)
# letter_count[letter] = letter_count.get(letter, 0)+1
print(letter_count)
| true |
1c8a9a0a14213ee1a6d318d56e1d64e492293f3c | Python | ajross/AirMetBot | /Weather.py | UTF-8 | 787 | 2.875 | 3 | [] | no_license | from config import CHECKWX_API_KEY
import requests
class Weather:
'Class for providing weather reports, and caching them for performance.'
def __init__(self):
self.__apiKey = CHECKWX_API_KEY
def __getRemoteWeather(self, icaoCode):
headers = {'X-API-Key': self.__apiKey}
resp = requ... | true |
9d4de14c9de61be007f9295cb6f553975357a580 | Python | martinrein/BarberShopTracker | /registration.py | UTF-8 | 27,789 | 2.796875 | 3 | [] | no_license | from tkinter import *
from tkinter import messagebox
import json
import os
import ast
class Registration(Tk):
def __init__(self, *args, **kwargs):
Tk.__init__(self, *args, **kwargs)
self.initial_values()
self.setup_window()
def initial_values(self):
"""
"""
s... | true |
ef85149740680a0067bdb0d88c5407b2e3d4026e | Python | gil9red/SimplePyScripts | /get_geolocation.py | UTF-8 | 1,393 | 2.59375 | 3 | [
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "ipetrash"
import json
from urllib.request import urlopen
def get_geolocation() -> dict:
# SOURCE: https://github.com/Pure-L0G1C/FleX/blob/da8f30f9204a65df57063ed74b3e79a2a79a7bfc/payload/modules/geo.py
location = {
"Ip": None,
"Co... | true |
08b121438849a4abd88d762d16b037fc14437a49 | Python | priyankstilt/flask-token-validation-with-compression-boilerplate | /models/authentication/v1/token_validation.py | UTF-8 | 1,654 | 3.015625 | 3 | [] | no_license | ''' Class to handle the basic authentication token matching '''
from flask import g, jsonify
from flask_httpauth import HTTPBasicAuth
from itsdangerous import (TimedJSONWebSignatureSerializer
as Serializer, BadSignature, SignatureExpired)
class TokenValidator(object):
''' Class using basi... | true |
0b9a42862060a6f1c670cc038ab74167621585f0 | Python | s22615/cwWPR7-8 | /FizzBuzz.py | UTF-8 | 409 | 3.890625 | 4 | [] | no_license | n=int(input("Podaj liczbe"))
#liczby
for i in range(1, n+1):
if i%3==0:
print(i, "Fizz")
if i%5==0:
print(i, "Buzz")
if i%3==0 and i%5==0:
print(i, "FizzBuzz")
#stringi
for i in range(1, n+1):
fizz_buzz=[]
if i % 3 == 0:
fizz_buzz.append("Fizz")
if i % 5 == 0:
... | true |
0180b0834898ad5759800266ab3bc96ab54a8c41 | Python | javawizard/afn | /afn/python/src/afn/processutils.py | UTF-8 | 1,910 | 3.421875 | 3 | [] | no_license |
"""
(This is still a work in progress, and doesn't actually work yet.)
Library similar to subprocess but that should fix a number of issues I have
with it.
For instance, the existence of subprocess.call/check_call/check_output as
separate from, say, methods on subprocess's Popen class always drove me nuts.
processut... | true |
9996a7f14f72f3e0f9e7755d8303e26f2812d155 | Python | andriisoldatenko/fan | /uva_answers/10783/main.py | UTF-8 | 421 | 3.0625 | 3 | [
"MIT"
] | permissive | import pprint
import sys
import re
FILE = sys.stdin
#FILE = open('sample.in')
test_cases = int(FILE.readline().strip())
def gen_odds(n, m):
results = []
for x in range(n, m+1):
if x % 2 != 0:
results.append(x)
return results
for t in range(test_cases):
a = int(FILE.readline().str... | true |
18734b11475c3ad7d38d5cdf2e9df16aa7a535c0 | Python | nachosca/python-practice | /session28_map.py | UTF-8 | 741 | 3.46875 | 3 | [] | no_license | # map
# filter
# lambda
# def sqr(num):
# return num**2
# l = [10,20,30,40,50,60]
# l2=list(map(sqr,l))
# print(l2)
# def add(num1, num2):
# return num1+num2
# l1 = [100,200,300,400,500]
# l2 = [10,20,30,40,50]
# result = list(map(add,l1,l2))
# print(result)
# l = [100,115,120,125,130,140]
# def check_... | true |
63e8d0de4a9d725a4fd59948a3307f8aaf49228e | Python | linjiafengyang/Python | /DataAnalysis/learnNumpy4.py | UTF-8 | 626 | 3.296875 | 3 | [] | no_license | import numpy as np
"""
通过数组来进行文件的输入和输出
"""
# np.save和np.load
# 数组会以未压缩的原始二进制模式被保存,后缀为.npy
arr = np.arange(10)
np.save('./some_array', arr)
print(np.load('./some_array.npy'))
# 用np.savez能保存多个数组,还可以指定数组对应的关键字,
# 不过是未压缩的npz格式
np.savez('./array_archive.npz', a=arr, b=arr)
# 加载.npz文件的时候,得到一个dict object
arch = np.load('./a... | true |
6b6cae51331339745afff9dcd81975dc80be54c9 | Python | yuchiu54/google-foobar-chanllenge | /level3/FindTheAccessCodes/solution.py | UTF-8 | 410 | 3.5625 | 4 | [] | no_license | def solution(l):
# store the possibility of each node for future use
possibilities = [0] * len(l)
triples = 0
for i in range(len(l)):
for j in range(i):
if l[i] % l[j] == 0:
# update possibility
possibilities[i] += 1
# add possibility... | true |
d5c6cb078dbb91e50711c5060704e0415c0d2556 | Python | wangtonylyan/Algorithms | /ds/tree/binary/size.py | UTF-8 | 577 | 2.765625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# data structure: size balanced tree
from bst import SelfBalancingBinarySearchTree, BinarySearchTreeTest
class SizeBalancedTree(SelfBalancingBinarySearchTree):
class Node(SelfBalancingBinarySearchTree.Node):
__slots__ = ['size']
def __init__(self, key, value):
... | true |
3ff86873ad75374b39081e959e89c082c4f75dc8 | Python | trefalmadore/week7.visualisation.matplot | /main.py | UTF-8 | 493 | 3.375 | 3 | [] | no_license | from matplotlib import pyplot as plt
agesX = [20, 25,30, 35, 40, 45, 50,55, 60,65]
salaryY = [18000, 20000,25000,28000,30000,35000,40000,45000,50000,50000]
agesX2 = [20, 25,30, 35, 40, 45, 50,55, 60,65]
salaryY2 = [16000, 18000,22000,24000,28000,30000,32000,35000,40000,45000]
plt.plot(agesX, salaryY,"--", label = '... | true |
92f2af6341e116c6e50b382373156beb953e0f59 | Python | ssh0/growing-string | /triangular_lattice/interactive.py | UTF-8 | 8,437 | 3.015625 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
# -*- coding:utf-8 -*-
#
# written by ssh0, October 2014.
from __future__ import print_function
__doc__ = '''Jupyter Notebook like Gtk wrapper class.
You can create Scalebar, Switch, ComboBox via simple interface.
usage example:
>>> from gtk_wrapper import interactive
>>> def f(a, b=20):
...... | true |
c0802ff18906d122c186c8b97d5bc9a3aff4b43f | Python | hailua54/algorithm | /ai/python/matplotlib_test.py | UTF-8 | 1,134 | 3.1875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
x = np.arange(-5., 5., 0.1)
np.set_printoptions(precision=3)
with np.printoptions(precision=3, suppress=True):
print(x*x)
y = x*x + 10*np.sin(x)
plt.plot(x, y)
plt.axis([0, 5, -10, 20])
#plt.show()
#momentum Gradient Descent ----------------
'''
v0 ... | true |
5a27f174f80b348d4ea9be6fde44743784926f4e | Python | Parth-Shah-Tool-Kit/complete-python-tutorial | /part3/string_functions.py | UTF-8 | 331 | 3.625 | 4 | [] | no_license | statement = "He is a good boy. He is a good singer."
s = "Hi"
print(len(statement)) # print the length
print(statement.lower()) # lower case
print(statement.upper()) # upper case
print(statement.title()) # do captial of initial character
print(statement.count("o")) # counts the presence of the arg... | true |
9e631d28d9f3611f87b5b528e464f7202f34cfe2 | Python | R-Fischer47/Intro-to-Data-Science | /Assignment4/linked_list.py | UTF-8 | 1,511 | 4.0625 | 4 | [] | no_license | ##
# Simple linked list classes
#
# Nothing to see here folks
##
class Node:
def __init__(self, data):
self.item = data
self.ref = None
class LinkedList:
def __init__(self):
# Currently Empty
self.start_node = None
# Current Size
self.size = 0
def insert_at_front(self,... | true |
871b1ce48b77fa17cf4f0701484cfa9607389b1f | Python | subarna-sahoo/Python3_Practice | /+tv & -tv aug\18.py | UTF-8 | 204 | 3.53125 | 4 | [] | no_license | # Separeting positive numbers & negetive numbers >
p_list = []
n_list = []
for i in range(-5,10):
if i > 0:
p_list.append(i)
if i < 0:
n_list.append(i)
print(p_list)
print(n_list)
| true |
7ae7575587ff985925b7885fe11b298a7e636a81 | Python | SamalAbenova/seminar2 | /main.py | UTF-8 | 228 | 3.171875 | 3 | [] | no_license | from mybox import MyBox
box = MyBox()
box.add(1)
box.add('Two')
box.add(4.5)
box.add('box')
box.add(7)
box.add('Done')
box.remove('Two')
if ('One' in box) and (len(box) > 0):
box.remove('One')
for i in box:
print(i) | true |
211a58154707e80fbaa14119b73a9db6282535ed | Python | fujimuram/sfmmesh | /python/houghLines.py | UTF-8 | 2,022 | 3.375 | 3 | [] | no_license | import numpy as np
import cv2
IMAGE_PATH = "./thinning4_2_hough/net2.png" # 読み込む画像
def main():
image = cv2.imread(IMAGE_PATH) # 画像読み込み
image2 = cv2.imread(IMAGE_PATH) # 画像読み込み
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) # グレースケール化
outLineImage = cv2.Canny(gray, 120, 250, apertureSize = 3) ... | true |
21683102bdac1e77ff682500481f8417fa81419a | Python | Furkanbstm/GlobalAIHubPythonCourse | /hub/hw1,2,3/hw1.py | UTF-8 | 309 | 3.078125 | 3 | [] | no_license | list_of_evens = [0, 2, 4]
list_of_odds = [1, 3, 5]
list_of_both = list_of_evens + list_of_odds
list_of_both = list_of_evens + list_of_odds
list_of_merge = list_of_both.sort()
final_liste = list(list_of_both)
final_list = list([ i*2 for i in list_of_both])
for i in final_list:
print(i) | true |
d6de695c9176c7c94bebc7b2320b5786f73f1749 | Python | i2sheri/puzzles | /pythonchallenge.com/level_09.py | UTF-8 | 214 | 2.953125 | 3 | [] | no_license | """first and second are available in Level 9"""
import Image, ImageDraw
img = Image.open('good.jpg')
draw = ImageDraw.Draw(img)
draw.polygon(first, 'red')
draw.polygon(second, 'red')
img.save('super.png', 'png')
| true |
b07e28a1026767fbc72c6dd0ddd7496bde7596e9 | Python | srajulu/Cricket-match-ML | /61.py | UTF-8 | 1,369 | 3.546875 | 4 | [] | no_license | import pandas as pd
df=pd.read_csv("E:\matches.csv")
#list of cities where match conducted using unique()
print("Unique cities where matches were conducted")
print(df.city.unique())
#list of teams played the match using unique()
print("List of all teams played for T20")
print(df.team1.unique())
#total num... | true |
1b0f37a667195d7419b733da16be96c5257a16bb | Python | navrobot/ros_monitor | /src/ros_monitor/socket_monitor.py | UTF-8 | 2,100 | 2.65625 | 3 | [] | no_license | import time, copy, threading
import dpkt, pcap
import rospy
def parse_bin_ip(bin_ip):
'''
Parse a string containing the binary data for an IPv4 IP.
Returns a string with the human readable ip of the form xxx.xxx.xxx.xxx
'''
if not len(bin_ip) == 4:
raise ValueError('Cannot parse IP; invali... | true |
d94a692d2ad37a703d904b340df95b5c08099c5f | Python | uktechreviews/pioneers | /Code_ninjas.py | UTF-8 | 722 | 2.828125 | 3 | [] | no_license | #This bit is set up by Mr Organ our mentor
import time
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
pin = 17
pin2 = 18
GPIO.setup(pin,GPIO.OUT)
GPIO.setup(pin2,GPIO.OUT)
GPIO.setwarnings(False)
#This is our code from here
print("")
print ("")
print("")
print("")
print("")
print("")
print("")
print("")
print (... | true |
7fb97bbe1cb81ddd1452e6852e89017a8985331b | Python | brukidm/AoC2020 | /Day09/2.py | UTF-8 | 529 | 2.953125 | 3 | [] | no_license | with open(r"input") as f:
lines = f.read().split("\n")
for i in range(len(lines)):
if int(lines[i]) > 22406676:
limit = i
break
start = 0
end = 2
while start < limit:
while end < limit:
seq = lines[start:end]
total = sum(map(int, seq))... | true |
503699c556dc71d11449dc86b600ae819df5bf8c | Python | IT-eng-max/python | /Twitter bot.py | UTF-8 | 1,056 | 3.046875 | 3 | [
"MIT"
] | permissive | #library to access twitter api
#pip3 install tweepy
import tweepy
import time #built in
#verify our account
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
user = api.me()
#print(user.name) --> all in the library
#... | true |
b320f274e546eee96aa9e3a01943a7cb05484be6 | Python | lawhw/opencv_tf_py | /c4/03_dlib.py | UTF-8 | 2,533 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import face_recognition
import cv2
from PIL import Image, ImageDraw
import numpy
def dlib():
video_capture = cv2.VideoCapture(0)
while cv2.waitKey(1) == -1 and True:
ret, frame = video_capture.read()
find_facial_features(frame)
def find_facial_features(image):
# ... | true |
4857cd3567846abf60bf378299b19e4ea1048ad4 | Python | brandonmorgan01/beer_recommendation_final_project | /model.py | UTF-8 | 2,372 | 2.609375 | 3 | [] | no_license | import sklearn
from sklearn.neighbors import KNeighborsClassifier
import pandas as pd
import os
import numpy as np
# import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction import text
from sklearn.cluster import KMeans
from sklearn.metrics import adju... | true |
386fa079f750b402f70cb6c7055e9332d4939a37 | Python | umangbhatia786/PythonPractise | /GeeksForGeeks/Strings/remove_nth_char.py | UTF-8 | 550 | 4.5625 | 5 | [] | no_license | #Python code to remove nth character from a string
def remove_nth_char(input_str,n):
if n > len(input_str):
raise ValueError('Value of n cannot be greater than the length of the string')
else:
if n == 1:
return input_str[1:]
elif n == len(input_str):
return input... | true |
3f8134798c88cba3ea1a7f09eb1fea48c31a7cab | Python | bunshue/vcs | /_4.python/__code/機器學習基礎數學第二版/ch20/ch20_5.py | UTF-8 | 620 | 3.515625 | 4 | [] | no_license | # ch20_5.py
import numpy as np
import matplotlib.pyplot as plt
x = np.array([8, 9, 10, 7, 8, 9, 5, 7, 9, 8])
y = np.array([12, 15, 16, 18, 6, 11, 3, 12, 11, 16])
x_mean = np.mean(x)
y_mean = np.mean(y)
xpt1 = np.linspace(0, 12, 12)
ypt1 = [y_mean for xp in xpt1] # 平均購買次數
ypt2 = np.linspace(... | true |
375c885a6d620763d2efe137f01d318dbbd77f78 | Python | mkudamatsu/election_campaign_promises | /SConstruct | UTF-8 | 1,821 | 2.578125 | 3 | [] | no_license | # Comments are copy-and-pasted from
# http://zacharytessler.com/2015/03/05/data-workflows-with-scons/
# https://github.com/gslab-econ/ra-manual/wiki/SCons
import os
env = Environment(ENV = {'PATH' : os.environ['PATH']}, IMPLICIT_COMMAND_DEPENDENCIES = 0)
# The Environment() call sets up a build environment that you c... | true |
ab4f8511d3a74b80b264dbbab60040dfc6dd3cf5 | Python | Emilyyyyyyyyyyyyyy-prog/Pygame-project | /танки.py | UTF-8 | 28,216 | 2.828125 | 3 | [] | no_license | import pygame
import os
import random
import sys
import uuid
class Tank:
def __init__(self, level, side, pos=None, direction=None):
global sprites
self.health = 100
self.speed = 1
self.side = side
self.level = level
self.control = [pygame.K_SPACE, pygame.K_w, pygame... | true |
061257ea67c9f6625d2bb7c9f63c52d86e5e7e8a | Python | hbobenicio/python-examples | /asyncio-examples/multiple-requests/server.py | UTF-8 | 650 | 2.84375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""A simple http server using aiohttp.
Note here the difference between time.sleep (blocking) and asyncio.sleep (non-blocking).
Remember that we must avoid blocking the event loop thread to let the event loop
switch the execution context to other coroutines.
"""
import ... | true |
f1b523ea3fcebc66ccf9569b0368be74ba87a766 | Python | vamotest/yandex_algorithms | /12_02_basic_data_structures/O. Encryption.py | UTF-8 | 205 | 3.28125 | 3 | [] | no_license |
def anagram(f, d):
n = 0
for i in range(len(f)-len(d)+1):
if sorted(d) == sorted(f[i:len(d)+i]):
n += 1
print(n)
if __name__ == '__main__':
anagram(input(), input())
| true |
47874600b8aba5e1fa1a952e6ac2ff6f4521169f | Python | ai-jpl/pre-jlp-r | /test.py | UTF-8 | 221 | 2.5625 | 3 | [] | no_license | import cabocha
from cabocha.analyzer import CaboChaAnalyzer
analyzer = CaboChaAnalyzer()
tree = analyzer.parse("日本語の形態素解析はすごいです。")
for chunk in tree:
for token in chunk:
print(token)
| true |
9c4d2a405972fc7d53919c386846e59719b00322 | Python | Aasthaengg/IBMdataset | /Python_codes/p03806/s864116878.py | UTF-8 | 846 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
D - Mixing Experiment
https://atcoder.jp/contests/abc054/tasks/abc054_d
"""
import sys
def solve(N, Ma, Mb, items):
d = dict()
d[(0, 0)] = 0
for a, b, c in items:
nd = dict()
for k, v in d.items():
t = d.get((k[0], k[1]), float('inf')) + c
... | true |