blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
ad8e6082099d3a86ab34df2242596bdf99affe95 | JanetMatsen/meta4_bins_janalysis | /compare_bins/support_files/aggregate_mummer_results.py | UTF-8 | 13,889 | 2.734375 | 3 | [
"BSD-2-Clause"
] | permissive | import glob
import numpy as np
import re
import sys
import pandas as pd
sys.path.append('./support_files/')
#import summarise_bins
import name_extractions
def load_individual_bin_summaries():
return pd.read_csv('support_files/available_bins.csv', sep =',')
# def load_bin_length_summary():
# return pd.rea... | true |
416295b215207731bbde4e4db5c1002a1489b9fd | ericktian/nltk | /boggle-1.1.py | UTF-8 | 2,500 | 2.796875 | 3 | [] | no_license | #
# Erick Tian
import sys, re, time
board = sys.argv[1]
#code for th, sh, etc
side = int(len(board)**.5)
print('\n'.join([board[i*side:i*side+side] for i in range(side)]))
print()
wordss = [i.lower() for i in open('scrabble.txt', 'r').read().split('\n') if re.search(r"^[a-zA-Z]*$", i)]
start = time.time()
# print(word... | true |
7d851d7274d4d65ebaae43af76d722e2af58788a | pockerman/simple_openai_gym_server | /messages/messages.py | UTF-8 | 3,787 | 2.796875 | 3 | [] | no_license | """
Classes for building requests to send to pytorch-cpp-rl.
"""
from abc import ABC, abstractmethod
import numpy as np
import msgpack
import logging
class Message(ABC):
"""
Base class for messages.
"""
@abstractmethod
def to_msg(self) -> bytes:
"""
Creates the JSON for the request... | true |
b9e6e37d0917c03d9bf15fa1417171052b6959f6 | 5l1v3r1/web2attack | /w2a/modules/footprintings/domain/harvester.py | UTF-8 | 9,102 | 2.625 | 3 | [] | no_license | # modules/harvester.py
#
# Copyright 2012 VinaKid :">
from w2a.core.templates import Templates
from w2a.lib.searcher import google, bing, yahoo, baidu, exalead, filter
from w2a.config import CONFIG
from w2a.lib.thread import Thread
from w2a.lib.ip import IP
from w2a.lib.file import full_path, read_from_file, append_... | true |
b90b9d19127188dceb51127af89b137043dac4d9 | lucasb-eyer/DeepFried2 | /DeepFried2/tests/layers/test_Embedding.py | UTF-8 | 479 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
import DeepFried2 as df
import unittest
import numpy as np
class TestEmbedding(unittest.TestCase):
def testForward(self):
X = np.array([
[0, 1, 2],
[2, 1, 0],
])
Z = np.array([
[[1,0,0,0], [0,1,0,0], [0,0,1,0]],
[[0,... | true |
f72941eaffb3488e25a437eaf6c637f096864f2e | AnnapurnaThakur/python_code | /anu7.py | UTF-8 | 129 | 3.359375 | 3 | [] | no_license | a=int(input("enter a number :"))
if a<12:
print("you enter a right number ")
else:
print("you enter a wrong number ")
| true |
f4251393b077f9b872798e416b8106f534e26d5d | hy17kwkj/python | /AizuOnlineJudge/dsl2b.py | UTF-8 | 775 | 2.890625 | 3 | [] | no_license | # AOJ DSL_2_B
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B
line = input()
n, q = list(map(int, line.split()))
N = 1
while N < n + 1:
N *= 2
a = [0 for _ in range(0, 2 * N - 1)]
def update(k, v):
k += N - 1
a[k] += v
while k > 0:
k = (k - 1) // 2
a[k... | true |
06fb356286ffb14461ed74fa008aad3b7f8a2033 | Bolizhang518/Machin-learning | /Artificial-Intelligence-and-Machine-Learning-master (1)/Artificial-Intelligence-and-Machine-Learning-master/NLP/HMM_Tagger/gene_tagger.py | UTF-8 | 4,596 | 2.75 | 3 | [] | no_license | from __future__ import division
from collections import defaultdict
from os.path import exists
from count_freqs import Hmm
from eval_gene_tagger import corpus_iterator, Evaluator
def combinations(list_a, list_b):
for a in list_a:
for b in list_b:
yield (a, b)
class GeneTagger:
def __ini... | true |
560272b93a8cf31c9140c066ae3b16e36a82923d | amigleon92/ProyectoIS2 | /Aplicaciones/Linea_Base/tests.py | UTF-8 | 1,503 | 2.828125 | 3 | [] | no_license | from django.test import TestCase
# Create your tests here.
from Aplicaciones.Fase.models import Fase
from Aplicaciones.Linea_Base.models import LineaBase
from Aplicaciones.Proyecto.models import Proyecto
from Aplicaciones.Rol.models import Rol
from Aplicaciones.Usuario.models import Usuario
class TestLineaBase(TestCa... | true |
729660b2947b30d2595ed0c0e9341008d13d2003 | Thinula/Baseball-Sabermetrics | /Scraping Data_Runs Against.py | UTF-8 | 1,411 | 3.03125 | 3 | [] | no_license | import pandas as pd
import scipy as sp
import matplotlib.pyplot as plt
import statsmodels.formula.api as sm
# reads in the teams data
teams = pd.read_csv(r'..\Baseball Analytics\data\Teams.csv')
teams = teams[teams['yearID'] >= 1985] # only takes teams after 1985
teams = teams[['yearID','teamID','Rank','RA','G... | true |
359e72d72c2d203386a6e05d69077e751ef58ad2 | vbelus/tensorforce | /test_deconv/env.py | UTF-8 | 1,370 | 3.015625 | 3 | [
"Apache-2.0"
] | permissive | from tensorforce.environments import Environment
import numpy as np
import time
class MatrixEnv(Environment):
def __init__(self, length_matrix):
self.shape = (length_matrix, length_matrix, 1)
self.n_step = 1
self.length_matrix = length_matrix
self.matrix = np.zeros((self.shape))
... | true |
73ee80a85599ab1d3c7a02017d5085c4452c7556 | MitiaEfimov/Coursera | /AlgorithmicToolbox/Dynamic Programming/Maximum Amount of Gold/maximum_gold.py | UTF-8 | 1,307 | 3.546875 | 4 | [] | no_license | # python3
from sys import stdin
def maximum_gold(capacity, weights):
"""
Given 𝑛 gold bars with weights W1, W2 ... Wn
Finds the maximum weight of gold that fits into a bag of capacity 𝑊.
"""
assert 1 <= capacity <= 10 ** 4
assert 1 <= len(weights) <= 10 ** 3
assert all(1 <= w <= 10 ** 5... | true |
bec9e35af8c9c04228b8e418b1cb605c5e0248f5 | LeiCaroline/PoetryQA | /question_classifier.py | UTF-8 | 5,229 | 2.65625 | 3 | [] | no_license | import os
import jieba
import numpy as np
def get_feature_word(file_path):
words = []
f = open(file_path,encoding='utf-8')
lines = f.readlines()
for line in lines:
words.append(line.strip())
# print(words)
return words
class QuestionClassifier:
def __init__(self):
cur_dir = os.path.split(os.path.realpat... | true |
4406ac0d4f833750dfa7dc71422926d439deccd8 | Yosua1396/K-Nearest-Neighbor | /knn.py | UTF-8 | 5,149 | 3.625 | 4 | [] | no_license | import csv
import random
import math
import operator
def loadDataset(filename,split_ratio,training_data,test_data):
'''
function to load data set.
Make sure that the data file exists in same directory as this python script.
'''
with open(filename,'r') as csvfile:
lines = csv.re... | true |
d6cbb85e669a37ba022c979c3cb08f692d19a00c | TreyMcGarity/PythonPractice | /Python-Practice/0_codingbat.py | UTF-8 | 4,699 | 4.3125 | 4 | [] | no_license | ####CodingBat Problems####
"""
You are driving a little too fast, and a police officer stops you.
Write code to compute the result, encoded as an int value: 0=no ticket,
1=small ticket, 2=big ticket.
If speed is 60 or less, the result is 0.
If speed is between 61 and 80 inclusive, the result is 1.
If spe... | true |
f0a1ec9b3e46eb7fd7c8c2c7748d0408751b0413 | hoffis/bitmarket_pl | /update_swap.py | UTF-8 | 5,270 | 2.78125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import requests
import hmac
import hashlib
import time
import simplejson as json
import logging
from decimal import Decimal
from pprint import pprint
def setupLogger():
logger = logging.getLogger('update_swap')
logger.setLevel(logging.DEBUG)
fh = logging.FileHandler('update_swap.log')
fh.setLevel... | true |
f2b0bc26d2c7dabb7dc4e43aedef669ebdc76b8c | varadtupe/HackerRank | /Algorithms/Search/pairs.py | UTF-8 | 654 | 3.046875 | 3 | [] | no_license | #!/bin/python3
import sys
def pairs(k, arr):
# Complete this function
#print(k)
#print(arr)
#old code works slow for some test cases
'''a=list(set(arr))
cnt = 0
for i in range(len(a)):
sub = a[i+1:]
cur = a[i]
for j in sub:
if abs(cur-j) == k... | true |
111e5abde9266e1b8f6e1a5f253fb801e219cbc6 | krishnajaV/luminarPythonpgm- | /Regular Expression/quantifer/qarule3.py | UTF-8 | 164 | 3 | 3 | [] | no_license | import re
x="a?" #count a as each including zero number of a
matcher=re.finditer(x,"abaaaa")
for match in matcher:
print(match.start())
print(match.group()) | true |
e5729155f17eb1fc99f14ede4b16a7d027d072b8 | wong-way/omim_handler | /data_pick/pick_inheritance.py | UTF-8 | 1,175 | 2.953125 | 3 | [] | no_license | # 提取遗传方式
import xlwt
import xlrd
import re
import util.util as util
def get_inheritance():
table = util.get_modified_data()
minnumber = []
inheritance = []
inheritance_result=[]
for i in range(table.nrows): # 循环逐行打印
if i == 0: # 跳过第一行
continue
else:
inherita... | true |
e73865382e5973b1a582d40bf2847c2fe1d61d67 | radomirbrkovic/algorithms | /hackerrank/other/new-year-chaos.py | UTF-8 | 446 | 3.90625 | 4 | [] | no_license | # New Year Chaos https://www.hackerrank.com/challenges/new-year-chaos/problem
def minimumBribes(q):
counter = 0
for i in range(len(q)):
if q[i] - (i+1) > 2:
print("Too chaotic")
return
for j in range(max(0, q[i] - 2), i):
if q[j] > q[i]:
cou... | true |
533b655655f330c309dd7e5033a71960d83dfe0c | martinfilliau/timetracking | /timetracking/datetime_helpers.py | UTF-8 | 479 | 3.5 | 4 | [] | no_license | """Helpers to manipulate datetime objects
"""
def calculate_time(start, end):
"""Get timedelta from event, based on start/end date
"""
return end - start
def within(test_date, from_date, to_date):
"""Check if given vEvent is between two datetimes
:param test_date: vEvent (iCal)
:param from_d... | true |
620a8690f62171345059ed94bd82a357b1f951f3 | Akashkatte/SimplePrograms | /evenodd.py | UTF-8 | 197 | 4.375 | 4 | [] | no_license | # Python program to check wheather the given number is even or odd
number = input("Enter a number")
x = int(number)%2
if x == 0:
print("number is even")
else:
print("number is odd") | true |
706e3dbca2277dcce093d6de28aa0ed67f3c54f3 | liangcht/yolo_objectdetection | /mtorch/caffetorch.py | UTF-8 | 8,578 | 2.640625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.autograd import Variable
class FCView(nn.Module):
def __init__(self):
super(FCView, self).__init__()
# noinspection PyMethodMayBeStatic
def forward(self, x):
n_b = x.data.size(0)
x = x.view(n_b,... | true |
ec64c3c70fa6f4fbd81934a712dc789117fb4cd5 | maickrau/tangle-resolution | /scripts/indel_to_bubble.py | UTF-8 | 2,623 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
import fileinput
import sys
nodeseqs = {}
max_node = 0
edges = {}
def reverse(n):
return (n[0], '+' if n[1] == '-' else '-')
for l in fileinput.input():
parts = l.strip().split('\t')
if l[0] == 'S':
nodeseqs[parts[1]] = parts[2]
max_node = max(max_node, int(parts[1]))
if l[0] == 'L':
fro... | true |
7c775ff895b956cac0d2ec1353e2c57a2979f69d | hirontan/practice_ml | /practice_data_science_machine_learning/scripts/Moments.py | UTF-8 | 1,163 | 4.15625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # モーメント: 平均、分散、歪度、尖度
# モーメント:確率密度函数の形状の定量化
#
# - 平均:一次
# - 分散:二次
# - 歪度(分布がどれだけ偏っているか):三次
# - 尖度(ピークがどれだけ尖っているか):四次
#
# ほぼ正規分布のランダムなデータセットを用意します。
# In[16]:
get_ipython().run_line_magic('matplotlib', 'inline')
import numpy as np
import matplotlib.pyplot as plt
vals = np.ra... | true |
47cae55c43b84b8e864321c0c98d90cbc7fe7ed9 | thiromi/dotfiles | /.githooks/prepare-commit-msg | UTF-8 | 943 | 2.609375 | 3 | [] | no_license | #!/usr/bin/env python
import sys, os, re
from subprocess import check_output, CalledProcessError
# Collect the parameters
commit_msg_filepath = sys.argv[1]
# Figure out which branch we're on
try:
branch = check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip()
except CalledProcessError:
# when rebas... | true |
2b5d7188d82b71b0195c7be28d09232e1ff8eeee | HappyStorm/LeetCode-OJ | /0448. Find All Numbers Disappeared in an Array/448.py | UTF-8 | 312 | 2.765625 | 3 | [] | no_license | class Solution(object):
def findDisappearedNumbers(self, nums):
"""
:type nums: List[int]
:rtype: List[int]
"""
mask = 1 << 31
for i in nums:
nums[(i & ~mask) - 1] |= mask
return [i + 1 for i in range(len(nums)) if not(nums[i] >> 31 & 1)]
| true |
e848dff45421cd6d593ee00198304d9b67809fd2 | xiaochuan000/emoffice | /misc/test.py | UTF-8 | 1,843 | 2.5625 | 3 | [] | no_license | #!/home/xwang/anaconda3/bin/python3.6
import urllib
import re
from urllib.request import urlopen
from bs4 import BeautifulSoup
start_url='https://egov.uscis.gov/casestatus/landing.do'
def find_sessionid( htmls):
jsids=re.findall('jsessionid=([0-9A-F]*)',htmls);
sessionid=""
if(len(jsids)==0):
pri... | true |
6e4e8f3c87472c32e166a5f15a2831388cc56392 | vmred/Coursera | /coursera/python-basic-programming/week2/hw32.py | UTF-8 | 672 | 3.875 | 4 | [] | no_license | # Определите количество четных элементов в последовательности, завершающейся числом 0.
# Формат ввода
# Вводится последовательность целых чисел, оканчивающаяся числом 0
# (само число 0 в последовательность не входит, а служит как признак ее окончания).
# Формат вывода
# Выведите ответ на задачу.
count = 0
value = -1... | true |
ce1a0804e86151fd9c114ad9438890972243234e | raxgdci/config-parity | /configparity/fields/common.py | UTF-8 | 15,023 | 2.515625 | 3 | [
"Apache-2.0"
] | permissive | from . import Field
from . import FieldValueException
from importlib import import_module
from datetime import datetime
class StrField(Field):
def __init__(self, default=None, allowed=None, readonly=False):
super().__init__()
if allowed and not isinstance(allowed, list):
allowed = [al... | true |
cbe3515680b707ad5b2d382dc16c9e79caf85357 | taherahmadi/self-driving-car-machine-learning | /p13-final-project/ros/src/twist_controller/twist_controller.py | UTF-8 | 4,049 | 2.671875 | 3 | [
"MIT"
] | permissive | import rospy
from yaw_controller import YawController
from pid import PID
from lowpass import LowPassFilter
class Controller(object):
# Class Attributes
Gas_Density = 2.858
def __init__(self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit,
accel_limit, wheel_radius, wheel_bas... | true |
037eb79306810a02a4a22c2f39e09d98b9178014 | fengqiaozhu/RaspberryPiKit | /src/Weather.py | UTF-8 | 638 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import urllib
import json
class Weather():
def __init__(self, cityCode = '101010100'):
self.cityCode = cityCode
request = urllib.urlopen('http://www.weather.com.cn/data/sk/' + cityCode + '.html')
self.weather = json.loads(request.read())
def getTemperature(self):
return int(self.we... | true |
bb43a9f234e99860fd2ddc743b2ce19925ec5ea4 | Jieun-Enna/KoreanRecipeGPT | /ratsnlp/nlpbook/generation/corpus.py | UTF-8 | 5,379 | 2.625 | 3 | [
"MIT"
] | permissive | import os
import csv
import time
import torch
import logging
from filelock import FileLock
from dataclasses import dataclass
from typing import List, Optional
from torch.utils.data.dataset import Dataset
from transformers import PreTrainedTokenizerFast
from ratsnlp.nlpbook.generation.arguments import GenerationTrainArg... | true |
b390fa949a894056868b52296b1b5b151a5e69c2 | bharatrajput2409/coding_practice-DSA- | /Applications/find-element-in-infinite-array.py | UTF-8 | 764 | 4.125 | 4 | [] | no_license | def binary_search(a, left, right, x):
if right >= left:
mid = left + (right - left) // 2
if a[mid] == x:
return mid
if a[mid] > x:
return binary_search(a, left, mid - 1, x)
if a[mid] < x:
return binary_search(a, mid + 1, right, x)
retu... | true |
4e22d9c59128fe214aa6c64b4e20fc904c82b14b | MiguelGuardado/eQTL_Finemapping | /qtl_finemapping.py | UTF-8 | 4,982 | 2.65625 | 3 | [] | no_license | #Author: Miguel Guardado
#Date Created: 03/13/2021
import argparse
import pandas as pd
import numpy as np
import subprocess
import os
from scipy import stats
parser = argparse.ArgumentParser()
def create_fine_map_region(eQTL_subset,kbregion):
"""
This function will take in a list of eQTL regions for snps and... | true |
ebda6eb0a51cf560f9b6275c9aca91e64e5f3e70 | HadiSheybani/Blockchain | /tests/usecase/test_block2dict.py | UTF-8 | 850 | 2.9375 | 3 | [] | no_license | import pytest
from hamcrest import *
from unittest.mock import Mock
from entity.block import Block
from usecase.block2dict import Block2Dict
class TestBlock2Dict:
def test_GivenABlockWhenCallConvertThenItShouldReturnProperDict(self):
block = Mock(return_value = Block)
block.index = 1
bloc... | true |
6e0d5764b93d5568abf00016faded8705ec488c7 | gianfoss/Machine_Learning_Project | /RF_Script.py | UTF-8 | 2,945 | 2.640625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from imblearn.over_sampling import RandomOverSampler
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import confusion_matrix, accuracy_score, classification_report, f1_score, roc_auc_score
from s... | true |
47c1f289263130d586fba931c9489674b04798d0 | qhyun2/advent-of-code | /2018/18sol.py | UTF-8 | 1,994 | 2.890625 | 3 | [] | no_license | rows = []
with open('18.in', 'r') as fp:
for line in fp:
rows.append(list(line.strip()))
width = len(rows[0])
height = len(rows)
def num_adjacent(x, y):
empty, tree, lumber = 0, 0, 0
count = 0
for i in [-1, 0, 1]:
for j in [-1, 0, 1]:
my_x = x + i
my_y = y + j
... | true |
6e6e2734a2b03430f1b4fb2492489f7e9eee074d | sarasana/HackOtberFest2021 | /kadane_algorithm.py | UTF-8 | 793 | 3.640625 | 4 | [] | no_license | def max_sum_subarray(arr):
start, end = 0, 0
max_end, max_so_far = 0, 0
for i in range(len(arr)):
max_end += arr[i]
if max_end < 0:
max_end = 0
start = i + 1
elif max_so_far < max_end:
end = i
max_so_far = max_end
return arr[start... | true |
8274251925ac44352829fbf1cd805742329527c0 | hmedina/KaSaAn | /KaSaAn/core/KappaComplex.py | UTF-8 | 22,244 | 3.015625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
"""Contains `KappaComplex`, a class to represents a list of agents chained into a larger entity, and the `embed_and_map`
function."""
import re
import networkx as nx
from collections import deque
from typing import Deque, Dict, List, Set, Tuple, Union
from .KappaMultiAgentGraph import KappaMult... | true |
33bfc22e8f961cd344102a0aefdf440236845ab8 | deturrisa/personal_finance_project | /test/test_content_handler.py | UTF-8 | 2,403 | 3 | 3 | [] | no_license | import unittest
import os
from main.content_handler import ContentHandler
from unittest.mock import patch
from unittest.mock import MagicMock
from main.file_handler import FileHandler
class ContentHandlerTests(unittest.TestCase):
#look into re-writing this test better to mimic files
def test_get_con... | true |
b047c44d30460d5dd45cbe256d4524253c9f949a | SciLifeLab/scilifelab | /tests/utils/test_slurm.py | UTF-8 | 1,824 | 2.78125 | 3 | [
"MIT"
] | permissive | """Test the utils/slurm.py functionality
"""
import subprocess
import unittest
from mock import Mock
import scilifelab.utils.slurm as sq
from scilifelab.pm.ext.ext_distributed import convert_to_drmaa_time
class TestSlurm(unittest.TestCase):
def test__get_slurm_jobid(self):
"""Extract the jobid f... | true |
13a5b89f8f89ac8c7c30f70fc695c24a57d1c1c5 | AgnieszkaBacia/2017sum_wiet_kol3 | /test_pawtul.py | UTF-8 | 1,859 | 2.953125 | 3 | [] | no_license | #source: https://github.com/pawtul/2017sum_wiet_kol1
from simulators import PlaneSimulator
from planes import Plane
import unittest
class TestPlaneFunctions(unittest.TestCase):
def test_default_correct_position(self):
plane = Plane()
self.assertEqual(plane.correct_position, 0)
def test_position(self):
... | true |
ad7ad8c633f8225a0a3666437b7dc3f6ebaf1048 | gongtian1234/CV2019 | /第六课tensorflow/03_多任务---验证码识别/01_4位数字验证码生成.py | UTF-8 | 1,270 | 3.15625 | 3 | [] | no_license | from captcha.image import ImageCaptcha
import numpy as np
from PIL import Image
import random, sys
number = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
def random_captcha_text(char_set=number, captcha_size=4):
# 验证码列表
captcha_text = []
for i in range(captcha_size):
c = random.cho... | true |
e6fdef5409dedb86ef69bb8dc2c775ddc1857427 | benjaminwaterlot/corewar_visu | /textures.py | UTF-8 | 756 | 2.671875 | 3 | [] | no_license | import arcade
import const
class ENERGY():
fire = 1
plant = 2
water = 3
electricity = 4
# energies = ["fire", "plant", "water", "electricity"]
class Pokemon():
def __init__(self):
print("INITIALIZING POKEMONS")
EMPTY = 0
def load_terrain_textures():
loaded = []
terrains = [
"resources/empty.png"... | true |
3924a467a8534f9fc80b4cbde002fff1246620fd | Anbyew/Proview-Clustering | /Cluster_1_Spectral.py | UTF-8 | 2,063 | 2.59375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.cluster import SpectralClustering
from sklearn.neighbors import kneighbors_graph
from sklearn.manifold import TSNE
from sklearn.manifold import MDS
from sklearn.manifold import LocallyLinearEmbedding
from sklearn.manifold import SpectralEmbedding
from sklearn.decompos... | true |
0e6f4af6b76f34b8322f50d217980ca859a7d6f0 | myJamong/algorism_solved | /dfs_bfs/1260_ DFS와_BFS.py | UTF-8 | 806 | 3.125 | 3 | [] | no_license | # https://www.acmicpc.net/problem/1260
# DFS와 BFS
import sys
from collections import deque
def dfs(idx):
print(idx,end=' ')
chk[idx] = 1
for i in range(1,n+1):
if arr[idx][i] == 1 and chk[i] == 0:
dfs(i)
def bfs(idx):
q = deque()
q.append(idx)
chk[idx] = 0
while q:
... | true |
2590ae302edd60a632865593d786549ecc4a4483 | Henri5710/CMPS5P | /Henri_Geneste_1675311_HW3.py | UTF-8 | 4,206 | 3.640625 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[66]:
#Programmer: Henri Geneste
#Student ID#: 1675311
#Date: 2/01/2019
#Compiler Used: Jupyter Notebooks (Hyperion.ucsc.edu)
#Purpose: Compare 3 applicants and determine the best one
def getInputs():
#Ranking Input:
ranking = input('Enter Undergraduate univers... | true |
20ef7b9a77260f4ca61bf0f0e9baa8b21836e4bc | alpablo11/Python---V1 | /8.Break.py | UTF-8 | 1,072 | 3.8125 | 4 | [] | no_license | # AAI Company - Python
# Break
# break:
# Break => şartlı bir döngünün isteğimizin gerçekleştiği yerde kırılması yani döngüyü durdurması demektir.
# Örnekle açıklayalım isterseniz;
defkullanıcı="AAI Company"
defparola="alperaybak"
while True:
kullanıcı=input("Kullanıcı adı:")
parola=input("Paro... | true |
fdef4515fcdf4126b44e6911605fa4e451b66159 | gondsuryaprakash/Python-Tutorial | /Python /Tuple.py | UTF-8 | 621 | 4.125 | 4 | [] | no_license | # Creating the Tupple
Tuple1=()
print(Tuple1)
Tuple1=('Geeks','For')
print(Tuple1)
list1 = [1, 2, 4, 5, 6]
print(tuple(list1))
a='Surya is don'
print(tuple(a))
# Accessing the Tupple
Tuple1 = ("Geeks", "For", "Geeks")
a,b,c=Tuple1
print(a,b,c)
print(Tuple1[1])
# Concatanation of the tupple
Tuple1 = (0, 1, 2, 3)
Tu... | true |
72e0d4f0f4330a5e39e49429619bae5bc5f9fdc9 | mohd-tanveer/PythonAdvance | /lecture17Super keyword.py | UTF-8 | 3,064 | 4.03125 | 4 | [] | no_license | #lecture 16
''' super();
from child class to call parent class memebers
purpose:Code Reusability
#super key word can be used to invoke parent class constructor.
#similarly be call parent calss method
'''
class Person:
def __init__(self,name,age):
self.name=name
slef.age=age
#simialry 100 propersties... | true |
453a31ccddeb5466d504f12264e981931fc982b1 | 201411096/study_flask | /ex/ex_19_flask-uploadFiles/test.py | UTF-8 | 563 | 2.65625 | 3 | [] | no_license | from flask import Flask, request
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World'
@app.route('/fileUpload', methods=["POST"])
def upload_file():
f = request.files['file']
f.save(secure_filename(f.filename))
return '...'
@app.route('/testFiles', methods=['GET', 'POST'])
de... | true |
4867c687a838a5573070b714846e71c44976ed35 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_135/1849.py | UTF-8 | 829 | 3.265625 | 3 | [] | no_license | with open ("input.in", "r") as myfile:
problem=myfile.read()
lines = problem.split('\n')
cases = int(lines[0])
fo = open('problemA.out', 'w')
def outfile(text):
fo.write (text+"\n")
for k in range(cases):
index = k*10+1
case=lines[index:index+11]
Case1 = case[int(case[0])]
Case2... | true |
0404894494a54aed414edcd2b790b03b2b42d93d | AkioKoneko/Python_course | /2.Cycles._Lines.-Lists/2.6.2.py | UTF-8 | 110 | 3.296875 | 3 | [] | no_license | a = int(input())
count = 1
n = []
while(len(n) < a):
n += [count] * count
count += 1
print(*n[0:a])
| true |
345bcd147400f1c98e22de73549d4328bfc8f348 | nakshatra04/LearningWithDerekBanas_Python | /workingWithFile.py | UTF-8 | 923 | 3.34375 | 3 | [] | no_license | import os
import io
average = 0.0
charcount = 0.0
with io.open("test.txt", mode='w',encoding ="utf-8") as myFile:
myFile.write(u"Hello \nI think it should\nBe able to track the \nNew Lines")
with io.open("test.txt", encoding="utf-8") as myFile:
linenum = 1
while True:
line = myFile.readline()
... | true |
f903c49deaf950cf3ecb6b74462a63e05e417ef4 | ynXiang/LeetCode | /003.LongestSubstringWithoutRepeatingCharacters/solution.py | UTF-8 | 601 | 3.359375 | 3 | [] | no_license | class Solution(object):
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
max_len = 0
cur_len = 0
char_dict = {}
for i in range(len(s)):
if char_dict.get(s[i]) == None or cur_len < i - char_dict[s[i]]:
... | true |
e80ff5fdaba816218dc78d4018af3897d26a6d6d | june6723/algorithm-practice | /writing-python/String/3.IP_validation.py | UTF-8 | 958 | 3.359375 | 3 | [] | no_license | import string
def check_IPv4(str: str) -> str:
arr = str.split('.')
if len(arr) != 4:
return 'Neither'
for digits in arr:
if len(digits) > 3 or len(digits) < 1:
return 'Neither'
if digits[0] == '0':
if len(digits) != 1:
return 'Neither'
if digits.isnumeric():
num = int(... | true |
f35d15f6ad1b29a402dc08afa866ebea5a81d66d | yooseongc/python_msd_kor | /Chapter05/mocking.py | UTF-8 | 852 | 2.796875 | 3 | [] | no_license | # Chapter05
# mocking.py
import json
import unittest
from flask_session import setup_connector, get_connector
from flask_webtest import TestApp
import requests_mock
import sys
sys.path.append('../Chapter02')
class TestAPI(unittest.TestCase):
def setUp(self):
from flask_basic import app as _app
sel... | true |
523ecf8fe307685c6686c2b102c6fcb99affe7c2 | Mactto/LIKELION_Apply_Crawling | /made_find.py | UTF-8 | 3,033 | 2.9375 | 3 | [
"MIT"
] | permissive |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pandas as pd
import json
# Secret.json 읽기 [LikeLion 지원페이지 아이디/비번 숨기기]
def SECRET_KEY_OPEN():
global APPLY_ID, APPLY_PW
with open('secret.json') as token:
json_data = json.loads(token.read())
APPLY_ID = json_d... | true |
3211d72da9be3ae78a88ea7929fd7a5a074fbe9c | GondorFu/Lintcode | /516.房屋染色II/Solution.py | UTF-8 | 736 | 3.28125 | 3 | [] | no_license | class Solution:
# @param {int[][]} costs n x 3 cost matrix
# @return {int} an integer, the minimum cost to paint all houses
def minCostII(self, costs):
# Write your code here
if len(costs) == 0:
return 0
n = len(costs[0])
rlt = [0 for i in range(n)]
for v ... | true |
78f763c0af6d4f088964db3c68e99194dc218596 | pmmilani/boreas | /boreas/main.py | UTF-8 | 40,538 | 2.625 | 3 | [
"Apache-2.0"
] | permissive | #-------------------------------- main.py file -----------------------------------------#
"""
Main file - entry point to the code. This file coordinates all other files and
implements all the functionality directly available to the user.
"""
# import statements
import numpy as np
import joblib
from pkg_resou... | true |
da251c07678533b361b7ac826a1c4ec24c067886 | xchenmeow/glowing-meow | /backtest/portfolio.py | UTF-8 | 1,113 | 2.546875 | 3 | [] | no_license | import pandas as pd
import numpy as np
symbols = ['^GSPC', 'AGG']
return_files = [s + '_returns.csv' for s in symbols]
# print return_files
# ts1 = pd.Series.from_csv(return_files[0])
# print ts1
tss = [pd.Series.from_csv(f) for f in return_files]
two_assets_returns_df = pd.concat(tss, axis=1, join='inner').dropna... | true |
3d215dc82fa150ea0a4d2beff0f7208f36dcbd69 | fgnt/padertorch | /padertorch/data/batch.py | UTF-8 | 5,239 | 2.875 | 3 | [
"MIT"
] | permissive | import operator
from dataclasses import dataclass
import numpy as np
import torch
from typing import Union, Iterable
import paderbox as pb
__all__ = [
'example_to_device',
'example_to_numpy',
'Sorter',
]
def example_to_device(example, device=None, memo=None):
"""
Moves a nested structure to the ... | true |
837b56deb631bc2efd8c1a9692eaa2660d3c78d2 | inkydragon/gc | /python/codewars/sum_dig_pow.py | UTF-8 | 223 | 2.859375 | 3 | [] | no_license | def sum_dig_pow(a, b): # range(a, b + 1) will be studied by the function
fn = lambda g:reduce(lambda y,x: y+int(str(g)[x])**(x+1),range(0, len(str(g))), 0) == g
return filter(fn, range(a, b+1))
#sum_dig_pow(1, 10)
| true |
e9313c5fb1f66ca681ec89efd408a9c5aa1d2827 | s0ap/arpmRes | /functions_legacy/ExponentialDecayProb.py | UTF-8 | 580 | 3.0625 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
from numpy import arange, log, exp
from numpy import sum as npsum
plt.style.use('seaborn')
def ExponentialDecayProb(t_,tau_hl):
#Flexible probabilities computed via exponential decay with half-life
#tau_hl
#INPUTS
# t_end [scalar]: length of the desired vector of proba... | true |
cf93ba7b35dbe5bf61c9a451ab7ea24b7111145b | sankosk/WPCompiler | /Recognizer.py | UTF-8 | 3,330 | 3.21875 | 3 | [] | no_license | import os, re
"""
@Author: Esteban Montes Morales
@Description: Used to recognize reservated words of a while program
"""
#To FIX:
"""
- Soportar multiples condiciones en los while
- Anadir los operadores aritmetico-logicos -> {AND, OR, NOT, XOR}
- Anadir soporte para comentarios
- Asegurarse de que se respetan ... | true |
5f29c02ed6863ad3b9246683f6e318740d90543c | PaulyFleming/flask-postgres-example | /app.py | UTF-8 | 400 | 2.78125 | 3 | [] | no_license | import os
from flask import Flask
from environs import Env
app = Flask(__name__)
env = Env()
env.read_env()
development = os.environ.get('DEVELOPMENT')
@app.route('/')
def hello():
print(f"Develoment environment = {development}", flush=True)
return "Hello World!"
@app.route('/<name>')
def hello_name(name):... | true |
069d34eb24fdbdcf86a18c930d0efd4b8f017538 | gabriellaec/desoft-analise-exercicios | /backup/user_205/ch147_2020_04_08_00_19_33_388398.py | UTF-8 | 315 | 2.90625 | 3 | [] | no_license | def conta_ocorrencias(lista):
dic={}
for palavras in lista:
dic[palavras]=lista.count(palavras)
return dic
def mais_frequente(lista2):
dic = conta_ocorrencias(lista2)
for nome in dic.keys():
for numeros in dic.values():
return dic[nome]=max(dic[numero])
| true |
0f332e0ce350a0b3b673636a867625fc1a6e5cf8 | krishnamohan-seelam/MachineLearning | /mltools/modelwrappers/xgbwrapper.py | UTF-8 | 532 | 2.75 | 3 | [] | no_license |
import xgboost as xgb
class XgBoostWrapper(object):
def __init__(self,seed,params=None):
self.param = params
self.param['seed'] = seed
self.nrounds = params.pop('nrounds', 250)
def train(self,x_train, y_train):
dtrain = xgb.DMatrix(x_train, label=y_train)
self.gb... | true |
9323729011bd1453b1d3972783a978bc7311cf75 | HackerspaceBremen/pixels_menu | /gameloader.py | UTF-8 | 1,996 | 2.546875 | 3 | [] | no_license | from git import Repo
from git.exc import NoSuchPathError, GitCommandError
import json
import os
from game import Game
class GameLoader(object):
def __init__(self):
self.games = []
self.games_loaded = False
self.stopp = False
def load_games(self):
self.load_game_data()
... | true |
25d1343783d17038af2d5072be146c945a5a2c37 | MJKruszewski/pjwstk-miw | /zad2/01b_classes.py | UTF-8 | 3,270 | 4.28125 | 4 | [] | no_license |
# Tak wygląda definicja klasy w Pythonie.
# W odróżnieniu od Javy czy C++ nie deklaruje się oddzielnie pól klasy, tworzone
# są one w chwili inicjalizacji w konstruktorze.
# Możliwe jest dynamiczne dodawanie pól do już istniejących obiektów.
# Nie stosuje się tutaj też zazwyczaj getterów i setterów chyba że mają jakie... | true |
a4677a54d908062dc78d779b987a499e14c0c16a | jerry81/openCv | /src/imageTutorial.py | UTF-8 | 323 | 2.84375 | 3 | [] | no_license |
from cv2 import cv2
import sys
# ord() - integer representing unicode char
img = cv2.imread(cv2.samples.findFile("images/faceSample.jpeg"))
if img is None:
sys.exit("Could not read the image.")
cv2.imshow("Display window", img)
k = cv2.waitKey(7000)
if k == ord("s"):
cv2.imwrite("images/faceSample2.jpeg", i... | true |
5a24fbba41b3e7f011751b43b8ee398a1139c6a6 | Vitosh/PythonHB | /week9/2-Money-In-The-Bank/mail.py | UTF-8 | 1,113 | 2.671875 | 3 | [] | no_license | import smtplib
from email.mime.text import MIMEText
username = "Gosho Ivanov"
password = "!@#@#!#@!@#!SGDASFDAFDSAADFS@#@$#SDAADSsfdafsda"
SMTP_USERNAME = "jobanana500@yahoo.com"
SMTP_PASSWORD = "" #no password for you! :P
SMTP_SERVER = "smtp.mail.yahoo.com"
SMTP_PORT = 587
EMAIL_FROM = SMTP_USERNAME
EMAIL_TO = "joba... | true |
0b11012a25ff0c80c1b91c35c865c7f2383902c0 | ylw12/PythonCourse2017 | /Day02_Aug09/Lab/clock.py | UTF-8 | 1,772 | 3.609375 | 4 | [] | no_license | class Clock(object):
def __init__(self, hour, minutes):
self.minutes = minutes
self.hour = hour
@classmethod
def at(cls, hour, minutes=0):
return cls(hour, minutes)
def __str__(self):
if len(str(self.hour)) == 1:
self.hour = '0%s' %(self.hour)
else: ... | true |
8c3e3cfa76aa173ce18412ddfe6dadbc28bafe7c | grettel13/classifying_hotel_cancelations | /hotels.py | UTF-8 | 5,402 | 3 | 3 | [] | no_license | import pandas as pd
import numpy as np
from datetime import datetime as dt
from datetime import timedelta
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_selection import KFold
def set_arrival_date(func_df):
#Add formatted timestamp column
func_df['ReservationStatusDate'] = pd.to_datetime(fu... | true |
36eda96abe0432454880bd05a6f71b2baf84a8b5 | vololodin/mstestbot | /main.py | UTF-8 | 2,754 | 2.671875 | 3 | [] | no_license |
import telebot
from telebot import types
import os
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), '.env')
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
TOKEN = os.environ['TOKEN']
bot = telebot.TeleBot(TOKEN)
pol = ''
act = 0
wght = 0
keyboard = types.ReplyKeyb... | true |
97271b3e627fc89d55dbdcbee4893d837a374cbc | AK-1121/code_extraction | /python/python_21255.py | UTF-8 | 193 | 3.328125 | 3 | [] | no_license | # Python: Write a list of numeric values on a single row with a repeated format
s = ('{:10.4f} '*len(draw6)).format(*draw6) # s = ' 0.1323 0.1424 0.1524 0.1623'
file.write(s)
| true |
e5f16e3a665d8931650e86cacb04a79be33dd278 | hyram-zhang/leetcode | /501.二叉搜索树中的众数.py | UTF-8 | 1,528 | 2.953125 | 3 | [] | no_license | #
# @lc app=leetcode.cn id=501 lang=python3
#
# [501] 二叉搜索树中的众数
#
# @lc code=start
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def findMode(self, root: TreeNode) -> List[int]:
... | true |
f17b1f5bffc2749b02f4f29f794617dbb2f364a3 | vikineema/flood-detection | /modules/calc_array_mask.py | UTF-8 | 1,881 | 3.296875 | 3 | [] | no_license | ''' The functions in this module can be used to define and apply a mask
to an individual or stack of raster files. The functions were designed
specfically to define and apply a cloud mask to a raster stack.'''
import numpy as np
import numpy.ma as ma
from skimage.morphology import disk, opening
def define_mask(band1... | true |
19c728089b6a656383345eba652468156d57a557 | pedroagrodrigues/SmartCharge | /evaluator.py | UTF-8 | 1,753 | 2.96875 | 3 | [] | no_license | from common import getData
from math import ceil
from Facade import Facade
endDate = '2018-08-31T23:59:59.999Z'
averageInput = []
averageOutput = []
for _ in range(96):
averageInput.append(0)
averageOutput.append(0)
for i in range(1, 6):
plug = str(i)
day = 1
initialDate = ''
data = []
... | true |
cb070efbdb151f19b9aae9d0c81548ac3d04cac4 | irao413/web-scraping-challenge | /Missions_to_Mars/scrape_mars.py | UTF-8 | 2,077 | 2.75 | 3 | [] | no_license | from splinter import Browser
from bs4 import BeautifulSoup
import pandas as pd
import requests
executable_path = {'executable_path': 'C:/Users/astro/Downloads/chromedriver.exe'}
browser = Browser('chrome', **executable_path)
def scrape():
data = {}
output = marsNews()
data["mars_news"] = output[0]
da... | true |
dd2931e030f7d732bd8d710384f41f8d2803a572 | Sjovir/sokoban-robot | /src/drive_behavior.py | UTF-8 | 3,419 | 2.875 | 3 | [] | no_license | from threading import Thread, Timer
import time
from behavior import Behavior
class DriveBehavior(Behavior):
running = False
thread = None
# Constructor.
def __init__(self, next_step, reader):
super().__init__()
self.next_step = next_step
self.reader = reader
self.powe... | true |
8ea7ae5c5d105f3486b1c9fe5e94e2d738513fdc | the-pythoncoder/councelChatbot2 | /example_entry.py | UTF-8 | 6,694 | 3.328125 | 3 | [
"MIT"
] | permissive | """
Each entry in personachat is a dict with two keys personality and utterances, the dataset is a list of entries.
personality: list of strings containing the personality of the agent
utterances: list of dictionaries, each of which has two keys which are lists of strings.
candidates: [next_utterance_candidate_1, ... | true |
885cb5375abdbdef351198ea8de99ef2fc5a08b1 | Soartex-Modded/Resource-Wrangler | /resource_wrangler/scripts/utilities.py | UTF-8 | 962 | 3 | 3 | [] | no_license | import subprocess
import sys
import os
def link_resource(link_dirs, output_dir):
"""
Create symlinks from multiple game instances to a single generated folder
"""
output_dir = os.path.expanduser(output_dir)
for from_dir in link_dirs:
from_dir = os.path.expanduser(from_dir)
if not o... | true |
64a2d3091cc008395a6cab212fc15028db240713 | joun008/20185182_BAEKJOON | /src/sw_1_4/Q.02.py | UTF-8 | 1,141 | 3.25 | 3 | [] | no_license | #1260번
import sys
input= sys.stdin.readline
N,M,V = map(int,input().split())
arr = [[]for i in range(N+1)]
for i in range(M) :
a,b= map(int,input().split())
arr[a].append(b)
arr[b].append(a)
#dfs 재귀함수로 구현
visited=[]
def dfs(start) :
visited.append(start)
arr[start].sort()
for i in arr[start]:
... | true |
c4ccb8377a31c53dcd15a8c542ce6973e9b47b68 | thepaygap/gender_newspaper | /readjson.py | UTF-8 | 123 | 2.546875 | 3 | [] | no_license | import json
with open('output/result.json') as json_data:
d = json.load(json_data)
print(len(d))
json_data.close() | true |
ee876d7f64358e18e40c46f1a0c42715f627b67b | jmschp/mosh-complete-python-course | /05 Data Structures/19 Dictionaries.py | UTF-8 | 2,779 | 4.96875 | 5 | [] | no_license | # # 19 Dictionaries
# Another useful data type built into Python is the dictionary (see Mapping Types — dict).
# Dictionaries are sometimes found in other languages as “associative memories” or “associative arrays”.
# Unlike sequences, which are indexed by a range of numbers, dictionaries are indexed by keys, which ca... | true |
5b59ec522eeb4719183a4401de4e7421c0da976f | hyesungoh/AA_Algorithm | /python/BOJ_1676.py | UTF-8 | 212 | 3.09375 | 3 | [] | no_license | def f(n):
return n * f(n-1) if n > 1 else 1
n = f(int(input()))
ans = 0
for i in reversed(str(n)):
if i == '0': ans += 1
else: break
print(ans)
# n = int(input()) // 5
# print(n + n // 5 + n // 25)
| true |
3d52117220b3533a5b8448dcc9c658e388914139 | ameliamaria/basics02 | /basics02/basics02/script02.py | UTF-8 | 337 | 3.421875 | 3 | [] | no_license | class HeadsCut:
def __init__(self, counter):
self.counter = counter
def raise_counter(self):
# self.counter = self.counter + 1
self.counter += 1
def count(arg1, arg2):
inst1 = HeadsCut(arg1)
while inst1.counter != arg2:
inst1.raise_counter()
print(inst1.counte... | true |
36c352a42553b8a97ddd9fd623c79d6e907d4da6 | m-d-johnson/kapitan | /tests/test_jsonnet.py | UTF-8 | 1,650 | 2.71875 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
#
# Copyright 2019 The Kapitan Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | true |
53a1a2456cda853ee5de47585252cbd2281f7c48 | imitsioni/generic_control_toolbox | /src/generic_control_toolbox/manage_actionlib.py | UTF-8 | 2,944 | 2.671875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import rospy
import sys
import actionlib
"""
@package manage_actionlib
This module provides utility methods for setting up actionlib calls through an overarching actionlib server.
"""
def monitor_action_goal(action_server, action_client, action_goal, action_name = "current action", time_... | true |
3f7214b4245d5a43dbdcde091ad18341fa80b683 | DongDongqq/huijuyunAPP | /spider/pycrypto_code.py | UTF-8 | 1,214 | 3.046875 | 3 | [] | no_license | """
@author: 王帅帅
@project: huijiyunAPP
@file: pycrypto_code.py
@time: 2019/8/20/020 11:31
@desc:
"""
from Crypto.Cipher import DES
import base64
from urllib.parse import unquote_plus, quote
import re
Key = "4d3ce191".encode('utf-8')
#加密
def encrypt_des(cipher):
# ECB方式
cip... | true |
8c4f695b2c649f1a5b675cb2357bdddd56f274f8 | vishmaK94/sdet | /python/Activity16.py | UTF-8 | 771 | 3.53125 | 4 | [] | no_license | class Car:
'This class represents a car'
def __init__(self, manufacturer, model, make, transmission, color):
self.manufacturer = manufacturer
self.model = model
self.make = make
self.transmission = transmission
self.color = color
def accelerate(self):
... | true |
c392cc5e4e6ac93ab6ac538e9655aabe1d5c0195 | jackiewu714/python-stu | /python-runoob/com/yy/stu/socket/client.py | UTF-8 | 440 | 2.875 | 3 | [] | no_license | import socket;
import sys;
# 创建 socket 对象
clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM);
# 获取本地主机名
host = socket.gethostname();
port = 9999;
print("host=%s, port=%d" % (host, port));
# 连接服务,指定主机和端口
clientSocket.connect((host, port));
# 接收小于1024字节的数据
resp = clientSocket.recv(1024);
clientSocket.c... | true |
1018b5721ecfc37f4f73dff7476a15686411f3ce | AidenSmith09/Python | /Day19_Test_Code/shopping_cat_0.py | UTF-8 | 2,106 | 4.1875 | 4 | [] | no_license | # /bin/etc/env Python
# coding: utf-8
"""
功能要求:
要求用户输入总资产,例如:2000
显示商品列表,让用户根据序号选择商品,加入购物车
购买,如果商品总额大于总资产,提示账户余额不足,否则,购买成功。
附加:可充值、某商品移除购物车
goods = [
{"name": "电脑", "price": 1999},
{"name": "鼠标", "price": 10},
{"name": "游艇", "price": 20},
{"name": "美女", "price": 998},
]
"""
"""
money = input一个总的资产,用于存储。
""... | true |
6227dedebae53498e2bd7b92bb3ca69249b5b59f | mohiitgupta/adaboost_decisiontree_mnist | /preprocessing.py | UTF-8 | 2,534 | 3.078125 | 3 | [
"MIT"
] | permissive | from random import shuffle
import pickle
import csv
def shuffle_data():
with open('winequality-white.csv', 'rb') as csvfile:
csvreader = csv.reader(csvfile, delimiter = ';')
# print type(csvreader)
data = []
for i, row in enumerate(csvreader):
if i != 0:
... | true |
0314132c56444e4951612a12884d5bef00189fc8 | zgq346712481/datafaker | /tests/integration/test_datafaker.py | UTF-8 | 8,813 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import sys
from datafaker import main
from datafaker.cli import parse_args
from datafaker.testutils import FileCreator
META_CONTENT = """
id||int||自增id[:id]
name||varchar(20)||学生名字[:name]
nickname||varchar(20)||学生名字[:enum(xiao ming, hah, lele, esd f2... | true |
368254ac46e052804c10c8dad4898045eed01f5a | rchaskar/PycharmWork | /Input and Output function.py | UTF-8 | 204 | 3.78125 | 4 | [] | no_license |
'''s=input()
print(s)
p=input("Please Enter your Name")
print(p)'''
'''
i=int(input("Enter a integer\n")) #typecasting
print(i)
print(type(i))
'''
x=input("enter 3 digits")
t=x.split()
print(t)
| true |
58d55125359be2edf31bad97ce646afa6cfb91b4 | PeithVergil/mathix | /tests/shapes.py | UTF-8 | 2,149 | 3.40625 | 3 | [
"MIT"
] | permissive | from unittest import TestCase
from mathix import Circle, Rectangle, Vector2
class TestCircle(TestCase):
def test_xyr(self):
c = Circle(1.0, 2.0, 3.0)
self.assertEqual(c.x, 1.0)
self.assertEqual(c.y, 2.0)
self.assertEqual(c.r, 3.0)
def test_line_0(self):
"""
... | true |
75e11ecef1816ed147c8cee31b8ac1d187ca040e | Diana2410-start/2021_Yakusheva_infa | /ex.3.py | UTF-8 | 4,066 | 3 | 3 | [] | no_license | import pygame
import math
pygame.init()
FPS = 30
screen = pygame.display.set_mode((600, 400))
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
GRAY = (125, 125, 125)
LIGHT_BLUE = (64, 128, 255)
GREEN = (0, 200, 64)
YELLOW = (225, 225, 0)
PINK = (230, 50, 230)
Tan4 = (139, 90, 43)
Cyan4 = (0, 139, 139)
Firebrick4 = (139, 26... | true |