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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
5741706ca30f39ec558cfca8281448e8a632b827 | Python | Mouse321/python | /Lesson_2/lesson2.5.py | UTF-8 | 180 | 2.8125 | 3 | [] | no_license | from pycat.window import Window
window = Window()
s = window.create_sprite()
s.image = "bat-b.png"
x = input("Enter bat position: ")
s.x = int(x)
s.y = 300
window.run() | true |
ead587e3fb66a1d8ec174a24afbe5957783337f0 | Python | BaoBao0406/Machine-Learning | /Python Basic for ML and DL Book3/Ensemble method Majority Vote Classifier.py | UTF-8 | 2,306 | 2.9375 | 3 | [] | no_license | from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder
import warnings
warnings.filterwarnings("ignore")
iris = datasets.load_iris()
X, y = iris.data[50:, [1, 2]], iris.target[50:]
le = LabelEncod... | true |
4d68b18633bd4669612a063b88c6bed47a5b645a | Python | samodle/VAE-Job-Analysis | /get_model.py | UTF-8 | 1,215 | 2.703125 | 3 | [] | no_license | from keras.models import Model
from keras.layers import *
import keras.backend as K
def get_simple_model(timesteps = 2500, input_dim = 100, latent_dim = 25):
inputs = Input(shape=(timesteps, input_dim))
masked = Masking(mask_value=-1)(inputs)
encoded = LSTM(2*latent_dim)(masked)
z_mean = Dense(latent_dim)(encode... | true |
8b475e1a8b36bb546a6c50440aa337a49489347f | Python | Alexbelobr/online-shop | /re_num1.py | UTF-8 | 89 | 3.0625 | 3 | [] | no_license | import re
text = 'abcdfghjk'
parser = re.search('a[b-f]*f', text)
print(parser.group()) | true |
9a4d08910cb05246cac680c41297921dadae45e9 | Python | shraddha1261/DS | /prac6.py | UTF-8 | 1,272 | 3.90625 | 4 | [] | no_license | list_student_rolls = [1,90,51,12,48,6,34]
print("Selection sort")
for i in range(len(list_student_rolls)):
min_val_index = i
for j in range(i+1,len(list_student_rolls)):
if list_student_rolls[min_val_index] > list_student_rolls[j]:
min_val_index = j
list_student_... | true |
2fd5f3ccd5ec025d5d22e177847e2d1c1695b0e9 | Python | nikita1998ivanov/Lab-rabota | /5_2.py | UTF-8 | 300 | 3.09375 | 3 | [] | no_license | import csv
my_list = []
with open("students.csv") as f:
next(f)
for line in f:
temp = []
h, nm, a, db = line.split(";")
temp.append(h)
temp.append(nm)
temp.append(a)
temp.append(db)
my_list.append(temp)
my_list.sort()
print(my_list)
| true |
40b35283ff02d271e561cc7633239617a28f3630 | Python | zxjzel/spider | /code/proxies_spider.py | UTF-8 | 3,882 | 2.578125 | 3 | [] | no_license | from lxml import etree
import requests
class ProxiesSpider():
def __init__(self):
self.url = 'https://www.kuaidaili.com/free/'
self.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36"}
self.proxies = [... | true |
6eb30fd837578c22b9e211ebdf62663c32263dd6 | Python | Eddie02582/Leetcode | /Python/137_Single Number II.py | UTF-8 | 2,054 | 3.78125 | 4 | [] | no_license | '''
Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
Example 1:
Input: [2,2,3,2]
Output: 3
Example 2:
... | true |
33c986cdc8fe8831afc7cc9b88fc2aa3d3093b19 | Python | idiom/pywinrm | /winrm/__init__.py | UTF-8 | 1,127 | 2.5625 | 3 | [
"MIT"
] | permissive | from winrm.protocol import Protocol
class Response(object):
"""Response from a remote command execution"""
def __init__(self, args):
self.std_out, self.std_err, self.status_code = args
def __repr__(self):
#TODO put tree dots at the end if out/err was truncated
return '<Response co... | true |
d6e544eeb9905128d4d8e9b2b35ba74b3254bdb5 | Python | OscarCruz65/Oscar-Cruz | /trimmed mean 08-11-19.py | UTF-8 | 2,068 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
n=1
suma=0
lista=[]
n5=1
n6=1
while n<2:
n3=int(input('dame un valor'))
lista.append(n3)
suma=suma+n3
cantidad=len(lista)
lista.sort()
print(lista)
n4=int(input('Calculas porcentaje? 1=si, cualquier otro numero no'))
if n4==1:
por... | true |
31200863db490d3f411c27842a825c2de4563db7 | Python | taro-masuda/leetcode | /0681_NextClosestTime.py | UTF-8 | 1,757 | 3.171875 | 3 | [
"MIT"
] | permissive | class Solution:
def nextClosestTime(self, time: str) -> str:
l = []
l.append(int(time[0]))
l.append(int(time[1]))
l.append(int(time[3]))
l.append(int(time[4]))
if l[0] == l[1] == l[2] == l[3]:
return time
min_positive_dist = 24*60... | true |
82f492fcbbecc1da77e41b7962608c41650f09c3 | Python | krenevych/algo | /labs/L06/task2/user.py | UTF-8 | 1,394 | 3.4375 | 3 | [] | no_license | """
Реалізуйте інтерфейс асоціативного масиву, ключами якого є цілі числа,
а значеннями – рядки.
Реалізацію здійсніть як хеш-таблицю з розв’язанням колізій методом ланцюжків.
"""
def init():
""" Викликається 1 раз на початку виконання програми. """
pass
def set(key: int, value: str) -> None:
""" Встанов... | true |
b97e448da17ae8b33d24c370731c663ef19bd102 | Python | arinaafan/Tutorial_answers | /python_mod8_answers.py | UTF-8 | 635 | 3.578125 | 4 | [] | no_license | # Module 8
#
# 1. Create two lists, one for each species, containing the first gene identifiers of each line (the so called seed orthologs)
import re
specie1 = []
specie2 = []
my_file = open("Inparanoid_table.txt", 'r')
header_line = my_file.readline()
for line in my_file.readlines():
specie1.append(re.findall(r'E... | true |
52c32437d5b842fa433580a07897149034c0e478 | Python | strymsg/01-p4 | /solid-01/invoices.py | UTF-8 | 2,528 | 2.53125 | 3 | [] | no_license | from abc import ABC, abstractmethod
from abstract_invoice import AbstractInvoice
class PhysicialInvoice(AbstractInvoice):
def __init__(self, seller_id, seller_name, date, number,
physical_id, branch_location, products=[], buyer=None, ):
self.physical_id = physical_id
self.branch_lo... | true |
7d3a10af6c05f2d7dc6d2c0d7505fee832a61ac5 | Python | bhardwajat/PythonProjects | /gasoline.py | UTF-8 | 631 | 3.984375 | 4 | [] | no_license | gallons = float(input('Please enter the number of gallons of gasoline: '))
liters = 3.7854 *gallons
print (gallons, ' gallons is the equivalent of ',liters,' liters ')
barrels = float(gallons/19.5)
print (gallons, ' gallons of gasoline requires ',barrels,' barrels of oil ')
pounds = float(gallons*20)
print (gallons, ' ... | true |
f5a9413e44d08a806094f84432197e1c5d1b0e32 | Python | priyanshthakore/deep_learning | /neural_network_basics/loss_optimiser/fuel_example.py | UTF-8 | 1,737 | 2.8125 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.compose import make_column_transformer, make_column_selector
from sklearn.model_selection import train_test_split
from tensorflow import keras
from tensorflow.keras import layers
fuel = pd.read_csv('./fu... | true |
cb2c06a06a4956c0ea610ac91ef5ce783dc8848d | Python | NeoBro/ncaa-predict | /predict_score.py | UTF-8 | 3,218 | 2.875 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python3
import argparse
import numpy as np
from ncaa_predict.data_loader import load_ncaa_players, load_ncaa_schools, \
load_ncaa_games, get_players_for_team
from ncaa_predict.estimator import *
from ncaa_predict.util import list_arg, team_name_to_id
def get_historical_score(team_id, all_games):
... | true |
d0f2cbcd1d7674438d3ba5cab8b5489599b1b31b | Python | aayushsin/AdvancedTopicForSignalProcessing | /symbol_status_updater.py | UTF-8 | 2,898 | 3.046875 | 3 | [] | no_license | #! /usr/bin/env python
# encoding: utf-8
# Copyright Steinwurf ApS 2016.
# Distributed under the "STEINWURF EVALUATION LICENSE 1.0".
# See accompanying file LICENSE.rst or
# http://www.steinwurf.com/licensing
import os
import sys
import copy
import kodo
def main():
"""Example showing the result of enabling the... | true |
8b2ad64c105059b3f2631a221af25be627ebf560 | Python | Aasthaengg/IBMdataset | /Python_codes/p03214/s931279357.py | UTF-8 | 171 | 2.734375 | 3 | [] | no_license | n=int(input())
A=list(map(int,input().split()))
mu=sum(A)/n
diff=1000
ans=0
for i,a in enumerate(A):
if abs(a-mu)<diff:
diff=abs(a-mu)
ans=i
print(ans) | true |
e2e123c3665664a8e798d4e19d47942f46fd9914 | Python | RybaPila-IT/Random-Forest | /RandomForest.py | UTF-8 | 2,584 | 3.59375 | 4 | [] | no_license | # Author: Julia Skoneczna
from pandas import DataFrame
import numpy as np
import math
from DecisionTreeClassifier import DecisionTree
class RandomForest:
"""
Creates random forest with a specified number of trees.
"""
def __init__(self, number_of_trees: int, data: DataFrame, target_column_name: str, ... | true |
cd981dbf2f41beddb4365450623734aea1af4084 | Python | NataliaZar/iu5_web | /lab3/get_vkfriends.py | UTF-8 | 601 | 2.90625 | 3 | [] | no_license | from vk_client import *
get_user = GetVkID('g_s_f_o')
user = get_user.execute()
user_id = user.get('id')
get_friends = GetVkFriends(user_id)
friends = get_friends.execute()
now = datetime.now()
ages = [0] * 1000
for fr in friends:
try:
date_str = fr.get('bdate')
date = datetime.strptime... | true |
d203a5b3e607651bf24b54f49688d7f8c5775d54 | Python | akshittyagi/TakBot | /Tak-sim/client.py | UTF-8 | 10,579 | 2.96875 | 3 | [
"MIT"
] | permissive | from Communicator import Communicator
import socket,sys,json,os,time,pdb
import math
from Game import Game
from Board import Board
import argparse
class Client(Communicator):
def __init__(self):
self.GAME_TIMER = 100000 # in Milli Seconds
self.NETWORK_TIMER = 500
super(Client,self).__init__()
pass
def setNe... | true |
b9f3acd2683090c899fd8d24ace7d2ebd173f5ef | Python | ashwani8958/Python | /PyQT and SQLite/M6 - Developing a GUI with PyQT/assignment/M6_Assignment.py | UTF-8 | 10,914 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'M6_Assignment.ui'
#
# Created by: PyQt5 UI code generator 5.12.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import re
import sqlite3
#from findprice import * #Import module from anoth... | true |
e447025f4cb17955e9a65729fcc0e0acc7e7200f | Python | 1274085042/Algorithm | /Offer/HUAWEI/明明的随机数.py | UTF-8 | 1,394 | 3.921875 | 4 | [] | no_license | #coding=utf-8
'''
题目描述
明明想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤1000),
对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,
按照排好的顺序去找同学做调查。请你协助明明完成“去重”与“排序”的工作
(同一个测试用例里可能会有多组数据,希望大家能正确处理)。
Input Param
n 输入随机数的个数
inputArray n个随机整数组成的数组
Return Value
OutputArray 输出处理后的随机整... | true |
236afe64e9fd10484715e4644b405b71231add42 | Python | open-mmlab/mmpretrain | /tools/dataset_converters/convert_imagenet_subsets.py | UTF-8 | 1,524 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) OpenMMLab. All rights reserved.
"""SimCLR provides list files for semi-supervised benchmarks
https://github.com/google-research/simclr/tree/master/imagenet_subsets/"""
import argparse
def parse_args():
parser = argparse.ArgumentParser(
description='Convert ImageNet subset lists provided by... | true |
3ef3b154fad1e0a1c1d0bb38f2f44298cffdb298 | Python | nikitaborisov/maxmin_flowsim | /flow_sim/max_min.py | UTF-8 | 2,556 | 2.890625 | 3 | [] | no_license | from typing import Set, List, Sequence, Collection, Union
from sortedcontainers import SortedList
from math import inf
def max_min_bw(circ_list: Sequence[Collection[int]], bw: List[float]) -> List[float]:
"""
Calculates the bandwidth allocated to each circuit in `circ_list` using the max-min bandwidth alloc... | true |
966a053235cb661c74426023b6ca61bc756f5a4a | Python | Silentsoul04/FTSP_2020 | /Summer Training ML & DL/Sentiment_Analysis_18.py | UTF-8 | 3,535 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 14:42:25 2020
@author: Rajesh
"""
import pandas as pd
import numpy as np
dataset = pd.read_csv('E:\ML Code Challenges\ML CSV Files\Restaurant_Reviews.tsv' , delimiter = '\t')
dataset.head()
*****************
Review Lik... | true |
3800f6b7387fccf93db4ac1c126afdf1bedb2432 | Python | DaniCnTs7/InteligentesPracticas | /SimpleRandomSearch.py | UTF-8 | 4,496 | 3.375 | 3 | [] | no_license | #import java.util.ArrayList;
#import java.util.Hashtable;
#import java.util.Random;
# this class implements a simple search method which explores a single sequence of actions.
# The process is quite simple. At each state we look for the agent possible actions and choose one at random.
# The action is then applied and ... | true |
d3f7c137eaadf9ad9be5fd4d86573b10e79bb550 | Python | xypan1232/treeCl | /treeCl/utils/phymlIO.py | UTF-8 | 2,095 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
from __future__ import print_function
import re
"""
TO DO: Add PAML class to estimate these kinds of parameters better then
can dispense with this
"""
def extract_gamma_parameter(tree):
gamma_regex = re.compile(r'(?<=Gamma shape parameter: \t\t)[.\d+]+')
try:
gamma = float(gamma... | true |
d4d7730e4880cd0b4eb5fb9c880c177c38d45483 | Python | BogdanIancu/PythonExamples | /day_3/functions.py | UTF-8 | 3,105 | 4.3125 | 4 | [] | no_license | def func1(salary):
print(salary+300)
# storing reference to func1 in bonus
bonus = func1
bonus(3000)
bonus(5000)
bonus(1000)
def func2(value):
print('Starting execution of func2')
#defined inner function inside func2 function
def innerFunc():
print(value)
innerFunc()
print('Finished e... | true |
f4ab1bcd04b184cadebe34a388824baeebd8ac09 | Python | ashwani-bhat/doc-sumsim | /main.py | UTF-8 | 1,405 | 2.828125 | 3 | [] | no_license | from doc import DocumentFeature
import argparse
from pdftotext import PdfConverter
if __name__ == '__main__':
parser = argparse.ArgumentParser()
requiredNamed = parser.add_argument_group('required named arguments')
requiredNamed.add_argument('--threshold', help=" should be between 0 (same) and 2 (tota... | true |
a331962f5e5077e4c57a1ab807ff22eeaee5a0e4 | Python | justinpolackal/text-clean | /datakettle/csv_reader.py | UTF-8 | 5,999 | 2.78125 | 3 | [] | no_license | import os
from datakettle.cleantext.textcleaner import TextCleaner
from datakettle.cleantext.filereader import TextFileReader
import datakettle.cleantext.utils as utils
import logging
class CSVReader (object):
def __init__(self, source_config):
self.source_config = source_config
self.logger = logg... | true |
7a5ffb97c10b862f2e1f541bb6be472f8a74da2b | Python | geetha60/PythonDemosApril29_2014 | /04_Functions/program.py | UTF-8 | 1,295 | 3.921875 | 4 | [] | no_license | import math
def find_cool_numbers(test=None):
nums = []
for n in range(0, 25):
if test is None:
nums.append(n)
elif test(n):
nums.append(n)
return nums
def even_nums(n):
return n % 2 == 0
def thirds_nums(n):
return n % 3 == 0
def filter_nums():
print... | true |
2804be5c444cf0e76f6f5e5130d7179149203476 | Python | hymanc/purpleproject1 | /model/planarTagTest.py | UTF-8 | 3,185 | 2.53125 | 3 | [] | no_license | from socket import socket, AF_INET, SOCK_DGRAM, error as SocketError
from numpy import asarray,zeros_like,kron,concatenate,newaxis
from numpy.linalg import lstsq, svd, inv
from json import loads as json_loads, dumps as json_dumps
from sys import stdout
if __name__ != "__main__":
raise RuntimeError("Run this as a scr... | true |
a0247ccc56379ff4c576ed220f03e1a461c5af1a | Python | vt0311/python | /FaceBook/matplotlibTest1.py | UTF-8 | 97 | 2.53125 | 3 | [] | no_license | import matplotlib.pyplot as plt
plt.plot([1,2,3,4])
plt.xlabel('x축 한글 표시')
plt.show() | true |
6fedc2b8dab451e31e3ffee5370ee505f8158be9 | Python | Jmaihuire/wqu | /MScFE650/.ipynb_checkpoints/Kmean-checkpoint.py | UTF-8 | 591 | 2.75 | 3 | [] | no_license | # %%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs
from sklearn.cluster import KMeans
# %%
X, y = make_blobs(n_samples=200, centers=4, cluster_std=0.5, random_state=0)
plt.scatter(X[:, 0], X[:, 1], s=50)
# %%
k_means = KMeans(n_clusters=4)
k_means.fit(X)... | true |
541f3420290a01f48671c8a25aeac09dd71a0c1a | Python | patrickgtafoya/autonomous_vehicle_design | /MPU6050 Bias Offset and Calibration/estimatingOrientation.py | UTF-8 | 6,368 | 2.78125 | 3 | [] | no_license | import biasOffsetCalibration as b
from copy import deepcopy
def state_two(port, dict_1, dict_2, dict_3, k, sig):
next_state = False
# iteration count to write to table file
index = 1
while not next_state:
# receive data, looking for 7 bytes
if port.inWaiting() > 6:
... | true |
f9078a6b1366c61cbe3fb56e9f1945ca7aa5cb03 | Python | yuminc03/1320_python_AfterSchool | /hello.py | UTF-8 | 66 | 2.765625 | 3 | [] | no_license | #hello.py
print("hello world")
a=3
if a>1:
print("a is big")
| true |
3aa8aa83ddcb552e81fc27f77706cc2e20b0dbb1 | Python | weffschneider/asl_cheesebot | /scripts/astar.py | UTF-8 | 7,938 | 3.65625 | 4 | [] | no_license | import numpy as np
# Represents a motion planning problem to be solved using A*
class AStar(object):
def __init__(self, statespace_lo, statespace_hi, x_init, x_goal, occupancy, resolution):
self.statespace_lo = statespace_lo # state space lower bound (e.g., (-5, -5))
self.statespace_hi = s... | true |
f4a25394577050ac2791285b896dc37ddcdb0a58 | Python | ritua2/gib | /middle-layer/greyfish_storage/base_functions.py | UTF-8 | 2,541 | 2.953125 | 3 | [
"MIT"
] | permissive | """
BASICS
Contains a set of functions that are called accross the other APIs
"""
import os
import datetime, time
from pathlib import Path
import redis
import mysql.connector as mysql_con
# Checks if the provided user key is valid
def valid_key(ukey, username):
if ukey == os.environ['greyfish_key']:
... | true |
1ab782cba214630c6b075db90da5b237d2e83332 | Python | akulakov/explore | /explore/avkutil.py | UTF-8 | 7,840 | 3.375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
"""Miscellaneous small utility functions.
vol(vol=None) - Get or set volume using aumix.
progress(ratio, length=40, col=1, cols=("yellow", None, "cyan"),
nocol="=.")
Text mode progress bar.
yes(question, [default answer])
i.e. if yes("erase file?", 'n'): ... | true |
58f576c5b45b4443e3b49bee925dfdfcaebd4c69 | Python | mirjanic/RLudo | /src/players/NeuralNets/reinforce.py | UTF-8 | 2,451 | 2.96875 | 3 | [] | no_license | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
# Constants
GAMMA = 0.9
LR = 0.003
DROPOUT = 0.6
class ReinforceNet(nn.Module):
def __init__(self, state_size, action_size):
super(ReinforceNet, self).__init__()
self.neuraln... | true |
4d65919c77322a4fd20067f8154b5aabfd6395ac | Python | mgrbic12/i210 | /mgrbic_HW4_416.py | UTF-8 | 260 | 3.953125 | 4 | [] | no_license | #Getting the user input
first = input("Enter first word: ")
print()
second = input("Enter second word: ")
print()
third = input("Enter third word: ")
print()
#Checking to see if first < second < third
if first <= second <= third:
print(True)
| true |
1acc3bb840602700735e353b084b8238c553e716 | Python | AllenHW/nengo-extras | /nengo_extras/dists.py | UTF-8 | 6,665 | 2.890625 | 3 | [] | no_license | from __future__ import absolute_import
import numpy as np
from nengo.dists import Distribution
from nengo.params import NdarrayParam, NumberParam, TupleParam
def gaussian_icdf(mean, std):
import scipy.stats as sps
def icdf(p):
return sps.norm.ppf(p, scale=std, loc=mean)
return icdf
def logga... | true |
f9dabe3523e53a0ea03e7c7237348c7d7a579a1e | Python | jaebradley/leetcode.py | /test_k_closest_points_to_origin.py | UTF-8 | 2,264 | 3.25 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from k_closest_points_to_origin import Solution
class TestEmptyPoints(TestCase):
def setUp(self) -> None:
self.points = []
def test_returns_empty_array_when_k_is_0(self):
self.assertListEqual(Solution().kClosest(self.points, 0), [])
def test_returns_empty_a... | true |
0fcac16e80cdf05cce0db062fb782331a6f2bc2b | Python | NOAA-PMEL/EcoFOCI_Jupyter_Notebooks | /2020/KWood/ICOADS/icoaads_antarctica/download_ds548.0.py | UTF-8 | 2,376 | 2.53125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
#################################################################
# Python Script to retrieve 5 online Data files of 'ds548.0',
# total 29.17M. This script uses 'requests' to download data.
#
# Highlight this script by Select All, Copy and Paste it into a file;
# make the file executable and run i... | true |
08c2946898f68db410d4c07f0cfc89bf2e165531 | Python | RosePasta/BugTypeBasedIRBL | /bench4bl/spring/shdp/sources/SHDP_2_3_0/spring-hadoop-build-tests/src/test/resources/org/springframework/data/hadoop/scripting/basic-script.py | UTF-8 | 616 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | from java.util import UUID
from org.apache.hadoop.fs import Path
print "Home dir is " + str(fs.homeDirectory)
print "Work dir is " + str(fs.workingDirectory)
print "/user exists " + str(fs.exists("/user"))
name = UUID.randomUUID().toString()
scriptName = "src/test/resources/test.properties"
fs.copyFromLocalF... | true |
0118117046f56bda1e82ca0d681073a961d80823 | Python | edervishaj/spotify-recsys-challenge | /utils/bot.py | UTF-8 | 4,449 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | import time
import logging
from telegram.bot import Bot
from functools import wraps
import threading
token = '512720388:AAHjYnJvvNld3rb70J1vp40gDEiRdcPHxsE'
chat_id = "-262107883"
# chat2 = "-314364535"
chat2 = "-1001356251815"
def bot_wrap(f):
direct = Bot(token=token)
def wrap(*args):
direct.send_... | true |
7fc15b0a2e3885031ef86c1d78971001d47b9c5a | Python | bahkobg/CodeWars | /SumOfDigits.py | UTF-8 | 179 | 3.21875 | 3 | [] | no_license | def digital_root(n: int) -> int:
root = sum([int(x) for x in str(n)])
if len(str(root)) == 1:
return root
return digital_root(root)
print(digital_root(16))
| true |
2f272d0f64de25bb6a7b8711c29d04181f29e59c | Python | juan518munoz/CS50x | /pset7/houses/roster.py | UTF-8 | 601 | 3.453125 | 3 | [] | no_license | import sys
import csv
from cs50 import SQL
# Check correct user input
if len(sys.argv) != 2:
print("Please specify a house")
exit()
# Query database for students in house
db = SQL("sqlite:///students.db")
# Print student's name, birth
text = db.execute("SELECT * FROM students WHERE house = ? ORDER BY last, ... | true |
b5ebdedda47f22bf97849e4aff1776cb2e83595f | Python | EliseCheng/Daily-Coding | /python/fileworks/test_filecontent.py | UTF-8 | 1,190 | 3.015625 | 3 | [] | no_license | # coding: utf-8
import struct
# 支持文件类型
# 用16进制字符串的目的是可以知道文件头是多少字节
# 各种文件头的长度不一样,少半2字符,长则8字符
def typeList():
return {
"514649FB": 'QCOW2',
}
# 字节码转16进制字符串
def bytes2hex(bytes):
num = len(bytes)
hexstr = u""
for i in range(num):
t = u"%x" % bytes[i]
if len(t) % 2:
... | true |
afef9a38b8acc1936a0926dbed9e7801d59841cc | Python | marshellhe/FreshmanTodo | /PythonLearning/SeleniumWebTest/easonhan007/button_dropdown.py | UTF-8 | 924 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from time import sleep
import os
if 'HTTP_PROXY' in os.environ: del os.environ['HTTP_PROXY']
dr = webdriver.Chrome()
#file_path = 'file:////' + os.path.abspath('button_dropdown.html')
... | true |
0b28cb821fd1cad2c643224ecc21bbcb69e0a039 | Python | Nur99/yandex_lyceum | /2nd_year/WEB9.flask-sqlalchemy/home_work/query_6.py | UTF-8 | 920 | 2.546875 | 3 | [] | no_license | from flask import Flask
from data.db_session import global_init, create_session
from data.users import User
from data.jobs import Jobs
app = Flask(__name__)
app.config['SECRET_KEY'] = 'yandexlyceum_secret_key'
def main():
global_init(input())
session = create_session()
# dictionary of job_id and len of ... | true |
09561e7252efaa96f45b17fde0b47078425cf60b | Python | faisaldialpad/hellouniverse | /Python/tests/trees/common.py | UTF-8 | 783 | 3.390625 | 3 | [
"MIT"
] | permissive | class Common:
@staticmethod
def serialize(root):
"""
:type root: TreeNode
:rtype: string
"""
pre_order = Common.__pre_order(root)
pre_order.append('#') # separator
pre_order.extend(Common.__in_order(root))
return ",".join(pre_order)
@staticme... | true |
f6d748a722e7f2853c8eedce1772f904481e87f4 | Python | malanb5/m5_forecasting | /yj/Plotter.py | UTF-8 | 1,041 | 3.1875 | 3 | [] | no_license | import matplotlib.pyplot as plt
class Plotter:
@staticmethod
def scatter(x, y, alpha):
plt.scatter(x, y, alpha=alpha)
plt.show()
@staticmethod
def plotDf(df, fig_name):
labels = []
df.drop(columns=["index"], inplace=True)
for i, (name, row) in enumerate(df.iterrows()):
if name != "index":
plt.p... | true |
36958af1149320ac9284b65479d6f708f9d54790 | Python | neutron-L/PycharmProjects | /IntroductionToPragrammingUsingPython/ch01/Ex20.py | UTF-8 | 656 | 3.328125 | 3 | [] | no_license | import turtle
# 下底
turtle.forward(200)
turtle.left(45)
turtle.forward(80)
turtle.left(135)
turtle.forward(200)
turtle.left(45)
turtle.forward(80)
# 上底
turtle.right(135)
turtle.forward(80)
turtle.right(45)
turtle.forward(80)
turtle.right(45)
turtle.forward(200)
turtle.right(90)
turtle.forward(80)
turtle.right(45)
tur... | true |
918bef2dee4254dc954ea9f530701dd3eb074c65 | Python | foleymd/boring-stuff | /regex/dot_star_caret_dollar.py | UTF-8 | 2,426 | 3.90625 | 4 | [] | no_license | # . * ^ $ characters
# ^ match the start and $ match the end
import re
# caret for beginning
begins_with_hello_regex = re.compile(r'^hello')
mo = begins_with_hello_regex.search('hello') #match
print(mo.group())
mo = begins_with_hello_regex.search('yo hello') #no match
print(mo)
# dollar for ending
ends_with_worl... | true |
6dda35b641dfba4c8486168736fc96543a6911f0 | Python | antske/coref_draft | /multisieve_coreference/mention_data.py | UTF-8 | 11,094 | 2.515625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """
This module parses the term layer of a KAF/NAF object
"""
from __future__ import print_function
import os
from .offset_info import (
convert_term_ids_to_offsets,
get_offset,
get_offsets_from_span,
get_pos_of_term,
)
stop_words = []
def initiate_stopword_list(lang='nl'):
global stop_words
... | true |
d3981f175f526c39200c8e4ffda2b3353a2c4598 | Python | mcclure/bitbucket-backup | /repos/64bot/contents/mario/run/float.py | UTF-8 | 331 | 3.28125 | 3 | [] | no_license | # Force mario continually in a particular direction
load("mario/basics")
class Float(Runnable):
def __init__(self, x, y, z):
self.set(x,y,z)
def set(self, x, y, z):
self.x = x
self.y = y
self.z = z
# Continually move.
def onBlank(self):
move_mario(self.x, self.y, self.z)
result(Float... | true |
545b28738a1593a4ed35bd4ae33fa5d55a352075 | Python | srikanthpragada/PYTHON_19_MAR_2021 | /demo/funs/return_value.py | UTF-8 | 202 | 3.484375 | 3 | [] | no_license | def next_even(n):
if n % 2 == 0:
return n + 2
else:
return n + 1
def next_odd(n):
return n + 2 if n % 2 == 1 else n + 1
v = next_even(11)
# v = next_even('abc')
print(v)
| true |
96855badf23205b8d07541d7d05d5e8aae479407 | Python | thethomasmorris/CSC310 | /ThomasMorrisAssign3/ThomasMorrisAssign3Q3.py | UTF-8 | 2,259 | 4.46875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Thomas Morris
Assignment 3
October 17, 2019
Implement a queue using linked lists. You should use your own class with the methods
(enqueue(object), dequeue(), first(), len(), is_empty(), search()) and include a testing.
Note that search(object) returns True (or False) to check if an ... | true |
12af014c58b2d131c5ac5d4a465838905cc68624 | Python | aleynakof/coinmarketcap | /para_formatla.py | UTF-8 | 838 | 3.390625 | 3 | [] | no_license | import locale
def standart_formatla(para):
currency = "${:,.2f}".format(para)
return currency
def tl_formatla(para):
# dolar formatında yazmak istersek binlik =, ve ondalik=.
# olmalı. Bunları parametrik de verebiliriz.
binlik = "."
ondalik = ","
currency = "{:,.2f}".format(para)
i... | true |
0666b1bceefb9d9c9bab9c7289659915467b92c9 | Python | shehbajbajwa/session3 | /venv/session2F.py | UTF-8 | 152 | 2.546875 | 3 | [] | no_license | #conditional constructs
total = 500
if total >= 500:
print("flat 40% off") #PEP , 4 spaces auto leave hundia
else:
print("sorry no discount")
| true |
253c1f7bc0bf57ed20050b50f676ca5b930fc5a1 | Python | NatsukiPrayer/TestTask | /main.py | UTF-8 | 941 | 2.890625 | 3 | [] | no_license | import Visualization
import Crawler
import Writer
import DBConnection
import time
if __name__ == '__main__':
t_start = time.time()
new = Crawler.Crawler('http://crawler-test.com/') #Здесь создаётся объект-паучок, в аргументах ссылка на сайт
new.main_crawl(2)
print(time.time() - t_start)
links = ne... | true |
1f2154eea4478ce3ced1d6fd49b5f40032a4e0d9 | Python | aniozen/AppleMusicToMP3 | /main.py | UTF-8 | 3,688 | 2.90625 | 3 | [
"MIT"
] | permissive | import os
import os.path
import eyed3
import urllib.request
import urllib
import re
from datetime import date
import youtube_dl
import concurrent.futures
def metadata(path, title, artist, album):
audiofile = eyed3.load(str(path))
audiofile.tag.artist = artist
audiofile.tag.title = title
audiofile.tag.... | true |
b76c407d76a93d15e5ff99056be3f3b603cc5770 | Python | odidev/numcodecs | /numcodecs/base64.py | UTF-8 | 784 | 2.890625 | 3 | [
"MIT"
] | permissive | import base64 as _base64
from .abc import Codec
from .compat import ensure_contiguous_ndarray, ndarray_copy
class Base64(Codec):
"""Codec providing base64 compression via the Python standard library."""
codec_id = "base64"
def encode(self, buf):
# normalise inputs
buf = ensure_contiguou... | true |
a82077cf8ad4446a2f829cd19be6a7106cf1b602 | Python | alexandraback/datacollection | /solutions_2692487_0/Python/applepie/osmos.py | UTF-8 | 924 | 3.109375 | 3 | [] | no_license | from math import ceil, log
f = open('osmos.in');
out = open('osmos.out', 'w')
cases = int(f.readline());
def diff(start, end):
if start == end:
return 1
return ceil(log((end-1)/(start-1), 2))
def add(start, num):
return (start - 1) * (2** num) + 1
for CASE in range(1, cases+1):
def calc(size, start_index):
... | true |
5d16dd1708155b81cb68aa5fc1880e30154cae9f | Python | sherlockwu/838_BigData | /stage2/toSubmit/test.py | UTF-8 | 1,353 | 3.015625 | 3 | [] | no_license | import os
import re
import sys
from nltk.corpus import wordnet as wn
def contains_The_Prefix(value,text,category):
if(value == 'Earth'):
print 'Test'
if(category == 1):
value = '<p>' + str(value) + '</p>'
else:
value = '<n>' + str(value) + '</n>'
prefix = '((\w+ ){2})' + str(va... | true |
8c4627d09013e8b30b103d45964ac51a419afb95 | Python | SophiaMeGooda/Happy | /My1stcode.py | UTF-8 | 96 | 2.796875 | 3 | [] | no_license | print("I love Pizza!")
print("pizza " * 33)
print("yum " * 66)
print("I'm full.")
print('yeah')
| true |
b57c5ce55c60506bfe7a0c2947b7790210d3582c | Python | newmansw93/intro_to_python_solns | /week3/day6-functions_practice/beginning_functions_practice/part2.py | UTF-8 | 4,795 | 4.28125 | 4 | [] | no_license | # The solution for question 1.
def get_month_season(month, unk_month):
'''
Input: Str - Abbreviation of month
Output: Str - Season of inputted month
'''
season = None
if month in ('dec', 'jan', 'feb'):
season = 'Winter'
elif month in ('mar', 'apr', 'may'):
season = 'Spring'... | true |
9dd161ce41b136e05e37be5d12accdee63cb647f | Python | joaogehlen91/calculo_numerico | /Trabalho2/questao1/questao_1_a.py | UTF-8 | 258 | 2.84375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import numpy as np
from math import *
h = 0.125
a = -3.0
b = 3.0
n = int(((b-a)/h)+1)
x = np.linspace(-3.0, 3.0, n)
y = 2.71828182846**-(x**2)
for i in range(1, n-1):
y[i] = 2*y[i]
AT = (h/2)*sum(y)
AT = AT*(2/sqrt(pi))
print AT | true |
760d099db311547e1bf29788c76c18e98c898769 | Python | Tobias-GH-Schulz/H.G.I.2 | /hand_gesture.py | UTF-8 | 5,210 | 2.671875 | 3 | [] | no_license | import cv2
import mediapipe as mp
import time
import HandTrackingModule as htm
import math
import numpy as np
from pymemcache.client import base
def hand_gesture_run():
# initialize the base client to store information used in different scripts
hand_client = base.Client(("localhost", 11211))
hand_client.s... | true |
36f9e0a075433c3bd1a2434c126b531b07d026ff | Python | gatneil/azurerm | /examples/deploytemplate-cli.py | UTF-8 | 1,928 | 2.625 | 3 | [
"MIT"
] | permissive | # deploytemplate.py
# authenticates using CLI e.g. run this in the Azure Cloud Shell
# takes a deployment template URI and a local parameters file and deploys it
# Arguments: -u templateUri
# -p parameters JSON file
# -l location
# -g existing resource group
# -s subscription... | true |
c5912bb51e47d1de197af7ba98c4c40cee479ef1 | Python | jayceazua/wallbreakers_work | /data_structures/bst.py | UTF-8 | 6,450 | 3.90625 | 4 | [] | no_license | from bst_node import Node
class BST:
def __init__(self):
self.root = None
# insert
def insert(self, data):
"""
Best case: when binary tree is a completely balanced tree
O(log n) runtime complexity
"""
if self.root:
self.root.insert(data)
e... | true |
a8797e746cc05bf87101e41032101dcf9a44fe63 | Python | Gateway2745/Web-Scraper | /index.py | UTF-8 | 1,133 | 2.734375 | 3 | [] | no_license | from selenium import webdriver
import bs4,re,string
browser=webdriver.Firefox()
url="https://codeforces.com/ratings"
browser.get(url)
html=browser.page_source
soup=bs4.BeautifulSoup(html,"html.parser")
ratings=soup.select(".ratingsDatatable .rated-user")
file1=open("top200names.txt",'w')
for name in ratings:
file1.wri... | true |
bbe3c2fff2446461bc5de2759661e8dca11c412e | Python | vadosdubr/basic-python-selenium-test | /features/test.py | UTF-8 | 406 | 2.625 | 3 | [] | no_license | from selenium import webdriver
driver = webdriver.Chrome("D:\Install programs\Python and Selenium\chromedriver")
driver.get("https://wikipedia.org")
search_field = driver.find_element_by_id("searchInput")
search_field.send_keys("test text")
search_button = driver.find_element_by_xpath("//*[@id='search-form']/fieldse... | true |
d6a8409069e90c84ff413b95f5d11c1a1fd19ef1 | Python | Jeckjun/MyPythonLearnWay | /oneDay.py | UTF-8 | 428 | 3.671875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
name = '张三'
age = 20
print('Art %5d, piece per Unit %8.2f' %(453, 59.058))
print(complex(1, 2))
print('{0:s},,,,{1:d},,,,,,,{0:s}'.format(name, age))
'''while 1:
print('提示:break为退出指令')
num = input('输入数字或指令:')
print(type(num))
if num=='break':
break
else:
pr... | true |
f01ec1f9404f8977ce867700527ade6a52e8e0ce | Python | rahulkrishnan98/med_ner | /pytorch/vocab.py | UTF-8 | 3,459 | 3.078125 | 3 | [] | no_license | from itertools import chain
from collections import Counter
import json
import os
import utils
class BuildVocab:
'''
input_params
words- List[List]
tags - List[List]
output
returns vocab object
that has mapping for every word - idx pair
__id2word is simply an array (ea... | true |
5e2b8b8443e4ecf9d7e193b65487531aaf1c4e43 | Python | Neriitox/Portfolio | /Fungal Friends.py | UTF-8 | 343 | 4.3125 | 4 | [] | no_license | # (yeast 1 hr later) = (yeast now) + 0.6× (yeast now)
s = float(input("Start (g): "))
e = float(input("Finish (g): "))
n = s
hrs = 0
while n < e:
hrs += 1
na = n + 0.6 * n
n = na
print(f"The loaf would need to rise for {hrs} hours.")
# Tells you how long it would take for a loaf of bread to ri... | true |
540894ad48c4fe123bc66b66fe81ae5d38cd162d | Python | menasheep/CodingDojo | /Python/BookReviews/apps/first_app/models.py | UTF-8 | 2,312 | 2.609375 | 3 | [] | no_license | from __future__ import unicode_literals
from django.db import models
import os, binascii, bcrypt
class UserManager(models.Manager):
def validateUser(self, postData):
errorStr = []
if len(postData['name']) < 3:
errorStr.append("First name can't be less than 3 characters")
if len(... | true |
3bd4d49b14a9fc8d1005889330097045966a192d | Python | JergeRG/SDEBARR | /Source/clean.py | UTF-8 | 495 | 2.578125 | 3 | [] | no_license | import csv
import re
from os import path
def cleanData(col):
for doc in col.find({}):
lstSentences = []
CleanReview = re.sub('[^.,a-zA-ZñÑáÁéÉíÍóÓúÚ0-9. \n\.]', '', doc['Review'])
for sentence in doc['Sentences']:
lstSentences.append(re.sub('[^.,a-zA-ZñÑáÁéÉíÍóÓúÚ0-9. \n\.]... | true |
b7de1fa1bc38ce4a19afce4f2e0ed229ddd4415f | Python | SamanthaCorner/100daysPython-DAY-8 | /prime_number.py | UTF-8 | 631 | 4.59375 | 5 | [] | no_license | """
100 days of Python course
DAY 8
"""
# user defined function using the modulo for comparison
def prime_checker(number):
"""
Parameters
----------
number : TYPE
DESCRIPTION.
Returns
-------
None.
"""
is_prime = True
for i in range(2, number - 1):
... | true |
b11a47f2cf5525f863e8cb22b33c4d419e271fd6 | Python | fans656-deprecated/clrs | /11 max subarray.py | UTF-8 | 2,400 | 2.8125 | 3 | [] | no_license | from clrs import *
import random
def std(a):
n = len(a)
beg = end = 0
ma = a[0]
for i in xrange(n):
cur = a[i]
for j in xrange(i, n):
if j != i:
cur += a[j]
if cur > ma:
ma = cur
beg = i
end = j
... | true |
933c728881ddf78d6b72d7d9dad08d5a49ce1766 | Python | Natanev92/Python | /Flask/fundamentals/html table/hello.py | UTF-8 | 1,383 | 3.515625 | 4 | [] | no_license | from flask import Flask, render_template
# Import Flask to allow us to create our app
app = Flask(__name__)
# Create a new instance of the Flask class called "app"
@app.route('/')
# The "@" decorator associates this route with the function immediately following
def hello_world():
return 'Hello There. ... | true |
226f1b33e6f0a11203748538bf55ad64410979af | Python | its-Kumar/Python.py | /5_Functions/goldbach's_conjecture.py | UTF-8 | 692 | 3.59375 | 4 | [] | no_license | import random
import sys
def isprime(num):
if num == 2:
return True
if num % 2 == 0:
return False
for i in range(3, int(num ** 0.5) + 1, 2):
if num % i == 0:
return False
return True
def goldbach(num):
a, b = 0, 0
while True:
... | true |
5b78560bb0d318b51fd003a6c20b453eafdf5d53 | Python | vigneshmoha/python-100daysofcode | /day008_caeser_cipher/prime_number.py | UTF-8 | 264 | 4.40625 | 4 | [] | no_license | def isPrimeNumber(num):
for i in range(2, num):
if num % i == 0:
return False
return True
num = int(input("Enter a number: "))
if isPrimeNumber(num):
print(f"{num} is a prime number")
else:
print(f"{num} is not a prime number") | true |
d395bf1760ada43313834ca58c31cdf5f8404523 | Python | sorgerlab/famplex | /famplex/api.py | UTF-8 | 16,829 | 3.234375 | 3 | [
"CC0-1.0"
] | permissive | """Provides utilities for working with FampPlex entities and relations
FamPlex is an ontology of protein families and complexes. Individual terms
are genes/proteins. There are higher level terms for families and
complexes. Terms can be connected by isa or partof relationships.
X isa Y expressing that X is a member of... | true |
0463255976de81512791e385674d0a230e0abeae | Python | coderhh/go_30_minutes_a_day | /GoByExample/Pointers/swap.py | UTF-8 | 37 | 2.96875 | 3 | [
"MIT"
] | permissive | a = 3
b = 4
a,b = b,a+b
print(a,b)
| true |
4690f4bbc7128e1a98aa2d01234f8382410f2b0d | Python | pikuch/AOC19 | /intcode.py | UTF-8 | 5,306 | 2.953125 | 3 | [] | no_license | from collections import deque
class Intcode:
def __init__(self):
self.pc = 0
self.code = []
self.rb = 0
self.inputs = deque()
self.outputs = deque()
self.inst = {"01": self.add,
"02": self.mul,
"03": self.inp,
... | true |
335fab4b2a95d1430884d452bd40b952196e7c93 | Python | chris-code/rnn | /src/pg_predict.py | UTF-8 | 2,060 | 2.90625 | 3 | [] | no_license | #!/usr/bin/env python3
import argparse
import csv
import keras
import numpy as np
from pg_train import load_data
import signal
import sys
def parse_args():
parser = argparse.ArgumentParser(description="Train recurrent network")
parser.add_argument("-l", "--limit", type=int, help="Maximum number of data points to l... | true |
815a8049821405c73e5a2ebcb1a81ebfcce936e3 | Python | thangcest2/DataStructureAndAlgorithm | /python/codility/1_iterations/star.py | UTF-8 | 1,689 | 3.484375 | 3 | [] | no_license | # n = 10
# for i in range(n):
# for j in range(n - i):
# print(' ', end='')
# for j in range(2 * i - 1):
# print('*', end='')
# print()
# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")
# def solution(N):
# # write your code in Python 3.6
# ... | true |
4340d0c9827a4e436f870bdfb33d7c87d9e7008c | Python | binchen15/leet-python | /greedy/prob1338.py | UTF-8 | 456 | 3.1875 | 3 | [] | no_license | # Reduce Array size to half
class Solution:
def minSetSize(self, arr: List[int]) -> int:
m = len(arr)
d = {}
for n in arr:
d[n] = d.get(n, 0) + 1
candies = list(d.items())
candies.sort(key=lambda x: x[1], reverse=True)
answer = 0
size = 0
... | true |
59f2adc2d3a354b9e1fe311a107d65caa928f584 | Python | WenXiaowei/branching_bound_with_simplex | /branching_bound/Tree.py | UTF-8 | 2,909 | 3.078125 | 3 | [] | no_license | class Tree:
# UNSATISFIABLE = "Constraints are not satisfiable in this node."
UNSATISFIABLE = -1
# BEST_SOL = "The current node contains the optimal solution."
ADMISSIBLE_SOL = 1
# TO_BE_PROCESSED = "The current node needs to be processed."
TO_BE_PROCESSED = 0
PROCESSED = -3
ROOT_NODE = ... | true |
520082a795199dd694e83b76a8a406e30be0cf30 | Python | hantong91/python_work | /Hello/test/Step07_set.py | UTF-8 | 1,881 | 4.15625 | 4 | [] | no_license | #-*- coding: utf-8 -*-
'''
- set type'
1. 순서가 없다
2. 중복을 허용하지 않는다.
3. 집합(묶음) 이라고 생각하면 된다.
'''
# set type 데이터 만들기
set1 = {10,20,30,40,50}
print set1
print "len(set1)", len(set1)
# set type 에 데이터 추가하기
set1.add(60)
set1.add(70)
set1.add(70)
set1.add(70)
set1.add(... | true |
2ffe49f275aa2b383e0320af7d536ec917f8d19f | Python | takutyan318/master | /output2.py | UTF-8 | 4,994 | 2.765625 | 3 | [] | no_license | #! /usr/bin/env python
# coding: utf-8
import Tkinter as Tk
from PIL import Image, ImageTk
from ttk import *
import sys
class App(Tk.Frame):
EXIST_OR_NOT = False #ウィンドウの二重展開防止のための関数
#bestok = False #bestが選ばれたかどうか
#ウィンドウ全体の設定
def __init__(self,smpimg,master=None):
Tk.Frame.__init__(self, master)
self.... | true |
0dd7d5634ce38f2531062f53a8b0b6411b5daf6b | Python | wbornus/Technologia-Mowy---Rozpoznawanie-Cyfr | /mfcc_loader/mfcc_loader.py | UTF-8 | 368 | 3.078125 | 3 | [] | no_license | import pickle
# wczytanie mfcc_dict z pliku pickle
with open('mfcc_dict.pickle', 'rb') as handle:
mfcc_dict = pickle.load(handle)
# indexy dla 'id_mówcy'
print(mfcc_dict.keys())
# indexy dla 'wypowiedzianej_liczby'
print(mfcc_dict[0].keys())
# przyklad wczytania mfcc dla id_mówcy = 2 i wypowie... | true |
e9211498b54cfae0d3d1f71d0e2a5c1aa2a63f82 | Python | tsujio/ml-play | /neural_network/neural_network.py | UTF-8 | 3,372 | 3.125 | 3 | [] | no_license | from matplotlib import pyplot as plt
import numpy as np
from sklearn import datasets, model_selection
def plot_decision_boundary(data, predict):
"""ref: http://scikit-learn.org/stable/auto_examples/svm/plot_iris.html"""
x_min, x_max = data[:, 0].min() - .5, data[:, 0].max() + .5
y_min, y_max = data[:, 1]... | true |
9013fb244f054b7aa90dd477e0d821891f174ff9 | Python | macbymac/myfirst | /testfile.py | UTF-8 | 184 | 2.6875 | 3 | [] | no_license | import json
import requests
url = "https://api.coinmarketcap.com/v2/ticker"
resp = requests.get(url)
data = json.loads(resp.text)
btc = data['data']['1']
print(btc['quotes']['USD']) | true |
686d8d8ace005704dbfeb9108e0422ae46bf012b | Python | wangyum/Anaconda | /pkgs/fastcache-1.0.2-py27_0/lib/python2.7/site-packages/fastcache/tests/test_clrucache.py | UTF-8 | 4,436 | 2.96875 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | import pytest
import fastcache
import itertools
import warnings
try:
itertools.count(start=0, step=-1)
count = itertools.count
except TypeError:
def count(start=0, step=1):
i = step-1
for j, c in enumerate(itertools.count(start)):
yield c + i*j
def arg_gen(min=1, max=100, repea... | true |
ec19fda5a5903be169fc0d326311ee31e4c9178d | Python | AayushK47/twitter-sentiment-analysis | /script.py | UTF-8 | 2,936 | 3.359375 | 3 | [] | no_license | """
Project name: twitter sentiment analysis
Author: Aayush Kurup
Libraries used: tweepy, nltk, pandas, flask, pickle, sklearn and os
Start Date: 22-12-2018
End Date: 01-02-2019
"""
# Imports
import re
import tweepy
import pickle
import pandas as pd
# nltk.download("stopwords") # Uncomment this line if you do not have... | true |