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 |
|---|---|---|---|---|---|---|---|---|---|---|
0a630e5a855b5a659799b7ad9e775ea3f6d4b725 | joaompinto/2DExplorer | /Game/data/tiles/Tile-StoneBack.py | UTF-8 | 259 | 2.640625 | 3 | [
"MIT"
] | permissive | from Tile import tile
class stoneBack (tile):
def __init__(self,parentWorld,colRow):
super().__init__(parentWorld,colRow,13,0,255)
self.durability = 30
def setter(parentWorld, colRow):
x = stoneBack(parentWorld, colRow)
return x
| true |
31fa351dd2fbf425163727ca9e3efcb474220012 | VarunRustomji/bridging_languages | /Q2/camel.py | UTF-8 | 444 | 3.359375 | 3 | [] | no_license | import sys
def main():
data = sys.stdin.read()
data[0].upper()
ans = ''
capflag = False
for i, char in enumerate(data):
if (char == '_' or char == '-'):
capflag = True
else:
if capflag:
ans += str(char).upper()
else:
... | true |
a87ad49e7e868f34363bde84686853983c2aa33c | dejailson/ProjetoPesquisa | /prototipo/sicov/bin/processamento/util/ProcessadorTarefa.py | UTF-8 | 760 | 3.078125 | 3 | [] | no_license | import abc
from .Iteravel import Iteravel
def processar(tarefas, recurso):
for tarefa in tarefas:
recurso = tarefa(recurso)
return recurso
class ProcessadorTarefa (metaclass=abc.ABCMeta):
def __init__(self):
self.__iteravel = Iteravel()
@abc.abstractmethod
def executar(self):
... | true |
919f54237541aac524d2b57183d692496b1a5acb | MadisonThompson5/TextProcessingFunctions | /PartA.py | UTF-8 | 2,168 | 2.96875 | 3 | [] | no_license | import fileinput
import sys
import tokenize
import time
import StringIO
##returns filename from command line
def getFile():
file_name = sys.argv[-1]
return file_name
##counts the current ammount of tokens and stores in a dictionary
def countTokens(tokens, token_dict ):
for t in tokens:
if t in tok... | true |
4b6b82d037bd2353a2f0798e8eeca28ff3dfcdde | rmedina0531/algorithms_assignments | /lab4/mergesort.py | UTF-8 | 1,085 | 3.65625 | 4 | [] | no_license | import random
import sys
def randomArray():
output = []
for i in range(0,10):
output.append(random.randint(0,10))
return output
def join(left, right):
i = 0
j = 0
#to make it similar to infinite
left.append(99999)
right.append(99999)
output = []
while (i < len(left)-... | true |
510cebc5e236ab2493ec2655cd2e4b6a3a842097 | zhxfei/monitor | /agent/collect/collector.py | UTF-8 | 2,554 | 2.515625 | 3 | [] | no_license | import time
import logging
from datetime import datetime
import gevent
from agent.collect.sys_status_collect import ps_utils_collect_funcs
from agent.config.default_config import DEFAULT_HOST_NAME, DEFAULT_IP
class Collector:
"""base collector"""
def __init__(self, hostname=None, ip=None, interval=None, ig... | true |
391f66dc1ceff347f8d85f795588e93c251aea5b | theakozakis/TESS | /find_tp.py | UTF-8 | 3,618 | 3.109375 | 3 | [] | no_license | # Code to determine tp file location from TIC ID
# Full documentation at: https://archive.stsci.edu/tess/all_products.html
import requests
# File location: tid/s{sctr}/{tid1}/{tid2}/{tid3}/{tid4}/
# File name: tess{date-time}-s{sctr}-{tid}-{scid}-{cr}_tp.fits
# Notes on file location:
# {sctr} = A zero-padded, four-... | true |
49785ad42bf38a45e04a6fd38ef5a1fe822e2dad | dgaponcic/color_contrast | /colors.py | UTF-8 | 2,943 | 3.34375 | 3 | [] | no_license | CONTRAST = 7
BREAK_POINT_LUMINANCE = 0.003
def get_color_val4luminance(val):
return val / 12.92 if val <= 0.03928 else ((val + 0.055) / 1.055) ** 2.4 #https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
def get_denormalized_color(color):
return {"r": color["r"] * 255, "g": color["g"] * 255, "... | true |
cbe7b6a1f52a6704c23e1a801df7f6d732ba6d64 | anakrish/encutils | /objdump_parser.py | UTF-8 | 3,728 | 3.015625 | 3 | [
"LicenseRef-scancode-generic-cla",
"MIT"
] | permissive | import subprocess
import re
import shutil
from utility import Function, FunctionTable, get_locations_table_through_nm
class ObjDumpParser():
def __init__(self, binary_file_name, show_symbol_files):
self.binary_file_name = binary_file_name
self.show_symbol_files = show_symbol_files
self.fun... | true |
f898a48bc85c50138775ca3fc787b04e9cf4aaaa | lukasab/IA_car_racing | /IA_car_racing/train.py | UTF-8 | 4,349 | 2.5625 | 3 | [] | no_license | import argparse
from model import BehavioralCloningModel
from prepare_data import CarV0GymDataset
from util import available_actions, data_transform
import torch
import os
import time
from torch.utils.data import DataLoader, random_split
from torch.utils.tensorboard import SummaryWriter
writer = SummaryWriter()
def ... | true |
e7b5b5c63fe69f506eafafdf307e8478b39df53b | zac112/adventOfCode | /code2018/py3/day23/day23_2.py | UTF-8 | 1,491 | 2.984375 | 3 | [] | no_license | import re
class Bot:
def __init__(self, posx, posy, posz, r):
self.posx=int(posx)
self.posy=int(posy)
self.posz=int(posz)
self.r=int(r)
def getPos(self):
return [self.posx, self.posy, self.posz]
def getRelativePos(self, other):
return [abs(other.posx-self.... | true |
df8e6d3365ae2ccfb2fca8fd82c32311278c169f | bchan01/covid-19-data-analysis | /data_extractor_pa.py | UTF-8 | 6,685 | 2.703125 | 3 | [
"MIT"
] | permissive | import pandas as pd
import requests
from bs4 import BeautifulSoup
from dateutil.parser import parse
import os
from datetime import datetime
import json
# Output CSV Files
SUMMARY_FILE = 'pa_summary.csv'
COUNTY_FILE = 'pa_county.csv'
COUNTY_GEOLOCATION_FILE = 'pa_county_geolocation.csv'
# Cutoff Date to extract data f... | true |
d0e1229ccea99143d6a32d25bc5da76cf83afe77 | sauravgsh16/DataStructures_Algorithms | /g4g/DS/Trees/Binary_Trees/Traversals/RN_5_post_from_pre_BST.py | UTF-8 | 1,569 | 3.984375 | 4 | [] | no_license | '''Python3 program for finding postorder traversal of BST from preorder traversal '''
INT_MIN = -2**31
INT_MAX = 2**31
# Function to find postorder traversal
# from preorder traversal.
def findPostOrderUtil(pre, n, minval, maxval, preIndex):
# If entire preorder array is traversed
# then return as no more ele... | true |
34258028271303745b4d25826b77857476571166 | luyuhang80/rn_model | /lib/mlnet_rs_bak.py | UTF-8 | 4,374 | 2.59375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import lib.mlnet
import tensorflow as tf
class MLNet(lib.mlnet.MLNet):
"""
Metric Learning Net restructured
This class defines the basic structure of a dual-input metric learning network.
The two feature extraction modals needs implementation.
The descriptors produced by the ... | true |
8074a4aa295a2474b4fd3a03a23c9f31121b45bd | xinkez/EfficientConformer | /models/attentions.py | UTF-8 | 49,098 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | # Copyright 2021, Maxime Burchi.
#
# 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 applicable law or agreed to in writi... | true |
887621ff3fb71fe86f0126fbed2911a81427cb5c | frank217/Algorithm-study | /LinkedList/25. Reverse Nodes in k-Group.py | UTF-8 | 2,445 | 4.125 | 4 | [] | no_license | '''
https://leetcode.com/problems/reverse-nodes-in-k-group/
'''
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def reverseKGroup(self, head: Optional[ListNode], k: int) -> Optional[ListNode]:
returnHead,t = self.ReverseHe... | true |
5859979a5122355320830a7aafcf09707672a971 | DragonDuma/Another_repo | /Simple Login.py | UTF-8 | 342 | 3.671875 | 4 | [] | no_license |
username = input("Enter a Username:")
password = input("Enter a Password:")
print("You now have an account.")
print("Login:")
username2 = input("Enter Username:")
password2 = input("Enter Password:")
if username == username2 and password == password2:
print("You have logged in successfully.")
else:
print("I... | true |
edf00b5169afc2c58488b5e3ceb274af0a67eead | SPEAR3-ML/spear3-opt-pkg | /opt/evaluators/inj_eff_spear3_fake.py | UTF-8 | 1,719 | 2.609375 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2019-2020, SPEAR3 authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import asyncio
import numpy as np
import datetime as dt
async def get_inj_eff(connection):
await asyncio.sleep(0.5)
return 6 * np.random.rand()
async def get_objective(x, connection):
... | true |
32f887c27b9b369fd20832b53fafe8a5676bab79 | singerZhai/selenium-groupcontrol | /demo.py | UTF-8 | 1,416 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/1/2 13:03
# @Author : zhaihuide@jiandan100.cn
# @Site :
# @File : demo.py
# @Software: PyCharm
# demo = '2020年01月02日'
# # print(len(demo))
# res = demo[0:5]
# for i in demo[5:]:
# if i != '0':
# res += i
# print(res)
# import datetime
#
# now = datetime.da... | true |
72776e1aa3d2b3c9a695717ef1d5f517f4a47eff | Lunchesque/udemy | /fullpythontutorial/folder/driver/driver.py | UTF-8 | 2,296 | 2.578125 | 3 | [] | no_license | import requests
from data.data import Data
class Driver(Data):
def __init__(self, headers, verify):
self.headers = headers
self.verify = verify
def get_locations(self):
response = requests.get(self.locations_url(),
headers=self.headers,
verify=self.verify,
... | true |
405b732b55dc72cb96757e8086a41230ec5a5e33 | iota-cohort-dc/Daniel-Perez | /Python/OOP/bike.py | UTF-8 | 589 | 3.59375 | 4 | [] | no_license | import random
class bike(object):
def __init__(self):
print 'New Bike!!!'
self.price = 300
self.max_speed = 23
self.miles = 0
def display_all(self):
print [self.price, self.max_speed, self.miles]
return self
def ride(self):
print "Riding"
se... | true |
59a1bea3d683da8c13020a02f24f5c7d09e3e660 | MarkJiYuan/Youtube-Iqiyi-difference | /getall/tools.py | UTF-8 | 5,924 | 2.71875 | 3 | [] | no_license | '引入模块'
import time
import json
import re
import os
import jieba
'全局变量'
'类'
class Timer:
start = time.time()
init_start = start
def time_past(self):
end = time.time()
print('************************************')
print('程序用时:%f' % (end - self.start))
print('****************... | true |
240bdc95001e9c2076a20adf0fdc31464d4bcdab | RahulARanger/My_Qt-Py_Book | /Complex Widgets/Editors/Text_Document/Cursor/basics.py | UTF-8 | 1,023 | 2.828125 | 3 | [] | no_license | from refer import *
test = Test()
cur: QtGui.QTextCursor = test.textCursor()
for _ in test.document().rootFrame():
block: QtGui.QTextBlock = _.currentBlock()
print(block)
print(69 * "=") # for every iteration object changes (since it changes) (so text blocks are created while iterating)
cur.insertText("tes... | true |
12a85bb894efdbb57f8c99da9b191c4750f9fd12 | argoel/coding | /leetcode/jumpGame.py | UTF-8 | 443 | 3.234375 | 3 | [] | no_license | class Solution(object):
def jump(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
jumps = 0
farthest = 0
curfarthest = 0
i = 0
n = len(nums)
while(i < n-1):
curfarthest = max(curfarthest, i + nums[i])
if ... | true |
6f7418b48cf7c4ceaa252b04e72e512abb208be1 | mrnsapple/AlgorithmIntrotek5 | /Part1/snowplowProblem.py | UTF-8 | 394 | 2.984375 | 3 | [] | no_license | def parcours(l):
#Get a sorted version of the list
sorted_l = sorted(l)
#Get value in list closer to 0, start in middle of list
min_val, idx = min([(abs(val), idx) for (idx, val) in enumerate(sorted_l)])
#split list in idx and revert position of left side
final_list = sorted(sorted_l[:idx], key=... | true |
0bad757ec4f2bfdc35bd3f0e1ba6ea0795a891b0 | getlogbook/logbook | /tests/test_test_handler.py | UTF-8 | 1,615 | 2.921875 | 3 | [
"BSD-3-Clause"
] | permissive | import re
import pytest
@pytest.mark.parametrize(
"level, method",
[
("trace", "has_traces"),
("debug", "has_debugs"),
("info", "has_infos"),
("notice", "has_notices"),
("warning", "has_warnings"),
("error", "has_errors"),
("critical", "has_criticals"),... | true |
64e8ad8193975b9de6a2c731f26bdd83e5a05590 | gravitrix/neural-networks-from-scratch | /digit-classifier/mnist_numpy.py | UTF-8 | 4,673 | 2.65625 | 3 | [] | no_license | import numpy
import random
import time
import struct
import requests
import os
import gzip
def download_mnist_data(filename):
print('downloading', filename)
os.makedirs('data', exist_ok=True)
r = requests.get('http://yann.lecun.com/exdb/mnist/' + filename)
if r.status_code != 200:
return False
... | true |
3372e93b65da8c9fcd508b77ed3eca3943660195 | Karagul/mksvm_price | /kernels/multi-kernel2.py | UTF-8 | 3,416 | 2.828125 | 3 | [] | no_license | from sklearn.svm import SVR
import numpy as np
import pandas as pd
import math
import matplotlib.pyplot as plt
import itertools
def rbf(gamma=1.0):
def rbf_fun(x1,x2):
# print(gamma)
return math.exp((np.linalg.norm(x1-x2))*(-1.0*gamma))
return rbf_fun
def lin(offset=0):
def lin_fun(x1,x2):
return x1.dot(x2.... | true |
4c3bad63b1787f4c084ed7e7e8932f6cc54ab40f | GlueckWolfgang/RaspberryPiRobot | /Robot_Toolbox/Edge.py | UTF-8 | 872 | 3.203125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
###############################################################################
# Class of Edge
# Version: 2016.04.18
#
# fromP from position
# toP to position
# weight distance in cm of |x-x'| or |y-y'| for x <> x' or y <> y'
# relativeAngle Realtive angle of fromP... | true |
6bcde5b20fb38bd6387a6d8860998a9717a93e29 | nkahlor/code-challenges | /python/project-euler/10001st-prime/solution.py | UTF-8 | 761 | 4.3125 | 4 | [] | no_license | """
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
"""
# This problem wasn't super fun, I just stole the isPrime method I wrote for a previous problem and chucked it in here :/
from math import sqrt
def is_prime(x):
# Eve... | true |
cb0e24b40042d83d7b6edf1f0c83b8da77811189 | mksoc/ISA-digital-arithmetic | /common/samples_generator.py | UTF-8 | 1,829 | 3.453125 | 3 | [] | no_license | #! /usr/bin/python3
from sys import exit
import random
def gen_samples():
# define possible modes
modes = {1: "Random", 2: "Special (only 0 and extremes)"}
for key, value in modes.items():
print("\t{}) {}".format(key, value))
# prompt user for mode selection
try:
mode = int(input(... | true |
c5d995bc83c152b70ffa39629725d57057d4bd1f | darcyfzh/algorithm | /剑指offer代码/31_greatestSumOfSubArrays.py | UTF-8 | 456 | 3.703125 | 4 | [] | no_license | '''
@Author: Darcy
@Date: May, 17, 2017
@Topic: maximum of subarray
'''
def greatestSumOfSubArray(a):
if a == None or a == []:
return 0
curSum = 0
nGreatest = float('-inf')
for i in range(len(a)):
if curSum <= 0:
curSum = a[i]
else:
curSum += a[i]
if curSum > nGreatest:
nGreatest = curSum
return n... | true |
8a41ae81032547cde9069cd7bc447cda4e311941 | e102y/CS-480-Homework-4-4 | /homework 4.py | UTF-8 | 3,982 | 2.96875 | 3 | [] | no_license | import random as rand
def F(x): # correct assuming a par tof getIn as input
r1 = x[1]*4 + x[2]*2 + x[3]
#print(r1)
r2 = x[4]*4 + x[5]*2 + x[6]
#print(r2)
if(r1 > r2):
return 1
return 0
class neuron:
def __init__(self): #correct
imin = 0
imax = 1
... | true |
b0db69d40eb8566377fe784587e021ec6594b5c8 | anxie/girlswhocode | /Obamafication/Obamafication.py | UTF-8 | 631 | 2.828125 | 3 | [] | no_license | from Myro import *
filename = "obama.jpg"
pic = makePicture(filename)
DarkBlue = makeColor(0,51,76)
Red = makeColor(217, 26, 33)
Blue = makeColor(112,150,158)
Yellow = makeColor(252, 227, 166)
for pixel in getPixels(pic):
red = getRed(pixel)
green = getGreen(pixel)
blue = getBlue(pixel)
if red > 240 ... | true |
7fba2311969409bc4250252e2ab1d950bd688a9f | haoruizh/CS322Project | /chatProject/server/UserIdentify_str.py | UTF-8 | 2,076 | 2.8125 | 3 | [] | no_license | import json
# from UserIdentify import *
class UserIdentify_dic:
all_name = {}
filename = './UserIdentify_1.txt'
def __init__(self):
pass
def load_store(self):
with open(self.filename, "r") as file:
f = file.readlines()
for line in f:
data = line... | true |
b8670c5aaf471c6fa46c46bcd823dc3286c9e1b8 | wuweijia1994/SmartSpeaker | /DenoisingNetwork.py | UTF-8 | 1,044 | 2.65625 | 3 | [] | no_license | import torch.nn as nn
class DenoiseNN(nn.Module):
def __init__(self):
super(DenoiseNN, self).__init__()
#Input layer
self.conv1 = nn.Conv2d(1, 1, 3, padding=1)
self.relu_0 = nn.ReLU()
self.linear_1 = nn.Linear(161*11, 1600)
self.relu_1 = nn.ReLU()
self.li... | true |
e6a5182144e7d58cee3f14a648d36670039ab6c2 | dwiajik/twit-macet-mining-v3 | /calculate_pair.py | UTF-8 | 2,144 | 2.9375 | 3 | [
"MIT"
] | permissive | '''
This script is used to calculate similarity index (Cosine, Dice, Jaccard, Overlap, LCS) of tweets dataset,
producing file containing list of tweets together with their similarity indices.
'''
import argparse
import csv
from datetime import datetime, timedelta
from difflib import SequenceMatcher
import os
from mod... | true |
08d1b189c279b3c07b9a7ba3d5a1761389958dca | thurpe/dna_auth | /get_auth.py | UTF-8 | 785 | 2.734375 | 3 | [] | no_license | import requests
from requests.auth import HTTPBasicAuth
from dnac_config import URL, USERNAME, PASSWORD
requests.packages.urllib3.disable_warnings()
def get_auth_token():
# Building out Auth request. Using requests.post to make a call to the Auth Endpoint
url = 'https://sandboxdnac.cisco.com/dna/system/api/v1/au... | true |
b43fb31a5e7b4f4e4c80b2edae27d5f1b862d4d1 | pmagalhaes2/Tabuada | /tabuada-com-função.py | UTF-8 | 168 | 3.6875 | 4 | [] | no_license | def tabuada(x):
for cont in range (1, 11):
print("{} x {} = {}".format(x, cont, x*cont))
num = int(input("Digite um número inteiro: "))
tabuada (num)
| true |
aaddce8de3bc90c8e83f99a8be7658bdd0a05ff6 | Endo12/Tic-Tac-Toe | /Tic_Tac_Toe.py | UTF-8 | 3,793 | 4.1875 | 4 | [] | no_license | play_again = True
while play_again:
winner = 0
current_player1 = True
p1_letter = input('Would Player 1 like to be X or O? ')
p2_letter = 'placeholder' #will later be assigned to player 2's letter
if p1_letter.lower() == 'x':
p2_letter = 'o'
else:
p2_letter = 'x'
mo... | true |
85f9f51e2ddc91221734040fd1d94e520819e8d1 | maxkutovoy/watching-storage | /datacenter/models.py | UTF-8 | 1,623 | 2.75 | 3 | [] | no_license | from django.db import models
from django.utils.timezone import localtime as lt
def get_duration(visit):
if visit.leaved_at:
finish_time = lt(visit.leaved_at)
else:
finish_time = lt()
start_time = lt(visit.entered_at)
duration_in_seconds = (finish_time - start_time).total_seconds()
... | true |
bb9a3a06c1eafa230b285dbad8ba41c2c7c46524 | n-wbrown/asyncio_pytools | /async-tools/multipleFutures.py | UTF-8 | 2,812 | 2.6875 | 3 | [] | no_license | """
zmqClientServer.py
Try to make zmq and asnycio play nice together in a client/server model.
Bonus objective: Also use the zmq asyncio tools
"""
import asyncio
import datetime
import zmq
import time
async def server(loop,port,socket):
end_time = loop.time() + 2.0
while True:
print(datetime.da... | true |
05fa848af9fafc96452a9af6a6d4b03fd6e62aff | kiiiswa/kiiiswa.github.io | /gdragonpastel.py | UTF-8 | 1,587 | 3.953125 | 4 | [] | no_license | from PIL import Image
#import image
im = Image.open("gdragon.jpg")
im.show()
new_image = Image.new(im.mode, im.size)
new_image.save("output.jpg", "jpeg")
# RGB values for recoloring.
darkBlue = (100, 100, 100)
red = (231, 207, 207)
lightBlue = (208, 253, 247)
yellow = (252, 227, 166)
# Import image.
#my_image = Image... | true |
262454bf256ba256f8a2712e0e2ef0a36f653d9d | busegungor/Cloud | /fish.py | UTF-8 | 522 | 2.734375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import pickle
df = pd.read_csv('fish.csv')
X = np.array(df.iloc[:, 0:3])
y = np.array(df.iloc[:, 3:])
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
y = le.fit_transform(y.ravel())
from sklearn.model_selection import train_test_split
X_train... | true |
2768d84f5ce9fb58d9519f546b886469a10fae7a | aristidesvara/realcause | /models/distributions/flows.py | UTF-8 | 4,555 | 2.8125 | 3 | [
"MIT"
] | permissive | import gc
from torch.nn import functional as F
from models.distributions.functional import *
def sigmoid_flow(x, logdet=0, ndim=4, params=None, delta=DELTA, logit_end=True):
"""
element-wise sigmoidal flow described in `Neural Autoregressive Flows` (https://arxiv.org/pdf/1804.00779.pdf)
:param x: input
... | true |
8bfab0549fb6ab7c749b1d727180532ac1c8eca5 | vatsuak/lstm_pm_tf | /lstm_pose/final_code/util.py | UTF-8 | 3,241 | 2.671875 | 3 | [] | no_license | import numpy as np
import os
import scipy.misc
from sklearn.preprocessing import MinMaxScaler
scaler_model = MinMaxScaler()
def calc_loss(predict_heatmaps, label_map, criterion, temporal=21):
'''
:param prediction(predict_heatmap(list of size (temporal+1)*[batch_size,46,46,21])),
:param label_map the gro... | true |
f5c133090525085657e9d1c75ceeddbcbd02c03b | adityarkelkar/clouddevops | /infrastructure/aws/boto3/networking/networking.py | UTF-8 | 3,198 | 3.171875 | 3 | [] | no_license | import boto3
import sys
import os
def main():
ec2 = boto3.resource('ec2')
args = sys.argv
try:
vpcname = args[1]
vpc = createVPC(ec2, vpcname)
ig = createIG(ec2, vpc)
public_subnet = createSubnet(ec2, vpc, 'public')
private_subnet = createSubnet(ec2, vpc, 'private')
... | true |
afa66f3ab3ead504034cedd6f7a6823663c340e3 | caichunbing/kmeans | /kmeans.py | UTF-8 | 3,007 | 3 | 3 | [] | no_license | #================================================================
# Copyright (C) 2019 * Ltd. All rights reserved.
#
# Editor : pycharm
# File name : kmeans.py
# Author : caichunbing
# Created date: 2019-10-18
# Description :kmeans聚类算法及可视化
#
#====================================================... | true |
cade92fb9dc19c7cd20bf6ff8d7e913316e9b811 | seth-paxton/sensu | /sensu_jsongen.py | UTF-8 | 2,385 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python
#
# Generate sensu client file. This is mainly used with Salt to generate the
# file when deploying a new Sensu agent. This can also be used to remotely
# modify the client subscriptions.
#
# Takes three optional arguments:
# --subscriptions: Creates new subscriptions, overwriting previous entries... | true |
4659a3b8253d1eb6018a00c4cc0be63e20f885d3 | CyberMaryVer/ITC_Project_prepare_Data | /resources/scraper.py | UTF-8 | 15,374 | 2.65625 | 3 | [
"MIT"
] | permissive | import requests
from resources.element import ShallowQuestion, ShallowAnswer
from db.manager import EntityManager
from bs4 import BeautifulSoup
import pandas as pd
import datetime
from api_test import *
import logging
import sys
logger = logging.getLogger('logs/logfile')
logger.setLevel(logging.DEBUG)
# Create Format... | true |
0fdcb3d57d80de268e9b550c89d7cfabf1be9da8 | Maitreyee1/Basic-Machine-Learning | /Practice_Iris_Dataset/iris_SVM.py | UTF-8 | 2,018 | 3.296875 | 3 | [] | no_license | # Program using Support Vector Machine to classify Iris dataset
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import metrics
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
df = pd.read... | true |
926b11bcd4cd2f2daa02d4dd78005a3164929ff7 | aliirmak/ML-SHM | /analytical example/aann_6freqmodes_era_final_paper_version.py | UTF-8 | 7,456 | 2.609375 | 3 | [] | no_license | """
Spyder Editor
This is a temporary script file.
"""
import numpy as np
from time import time
from keras.layers import Input, Dense
from keras.models import Model
from keras.callbacks import TensorBoard
from keras.callbacks import EarlyStopping
from sklearn.preprocessing import StandardScaler
import matplotlib.pypl... | true |
b6cb27b9f0d46e8b53db6e9119df123c8ff04d73 | edu-athensoft/ceit4101python | /stem1400_modules/module_12_oop/oop_06_instance/s4_access_member/access_attribute_2.py | UTF-8 | 685 | 4.46875 | 4 | [] | no_license | """
Accessing instance members
updating and accessing an instance attribute
"""
class Cat:
def __init__(self, name, color):
self.name = name
self.color = color
def eat(self):
print("I eat.")
def sleep(self):
print("I sleep.")
# main program
# creating an object of Cat ... | true |
4c5141f78846558468c0d0063838394610fe74dc | UWPCE-PythonCert-ClassRepos/Wi2018-Classroom | /students/TracyA/session03/list_lab3.py | UTF-8 | 602 | 3.96875 | 4 | [] | no_license | #!/usr/bin/env python
# Programming in python B Winter 2018
# February 5, 2017
# list Lab #3
# Tracy Allen - git repo https://github.com/tenoverpar/Wi2018-Classroom
# Series 3 of list lab exercises
# Create a list with Apples, Pears, Oranges, and Peaches. Print the list.
fruits3 = ["Apples", "Pears", "Oranges", "Peac... | true |
58ee650a9b8b836105fabf6298a7a0b16bf622b3 | JaumVitor/HOMEWORK-PYTHON | /PYTHON-SALA DE AULA/Exercicios condicionais/exe-13.py | UTF-8 | 407 | 3.90625 | 4 | [
"Apache-2.0"
] | permissive | valor = float ( input (' TRABALHADORES -> Valor recebido por hora de trabalho: '))
hora1 = float ( input (' TRABALHADOR 1 -> Digite horas trabalhadas: '))
hora2 = float ( input (' TRABALHADOR 2 -> Digite horas trabalhadas: '))
sal1 = ( valor * hora1 )
sal2 = ( valor * hora2 )
if ( sal1 > sal2 ):
print ('Salario... | true |
519669298a31f1eb78d389e6b57e5c8a6a778f37 | Vladimare/opcode_diff | /opdiff | UTF-8 | 4,915 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import argparse
from sortedcontainers import SortedDict
import subprocess as sp
# local import
from bcolors import colors
# commands
parser = argparse.ArgumentParser()
parser.add_argument('--mode', '-m', action='store', default='arm', choices=['arm', 'thumb'],
help='instruct... | true |
5fc701855206854fd85e9e91f3865221819f1a9e | sincere-Hwang/algorithm-study | /Intermediate/02_List2/Problem_01_Coloring/Coloring_shinsil.py | UTF-8 | 563 | 2.921875 | 3 | [] | no_license | T = int(input())
for test_case in range(1, T + 1):
N=int(input())
a = [[0]*10 for k in range(10)]
cnt = 0
for n in range(N):
x1, y1, x2, y2, color = map(int, input().split())
for i in range(y1, y2+1):
for j in range(x1, x2+1):
... | true |
fb45221b465621c837de01a0ce3a3fa0d227f568 | OskarKozaczka/pp1-OskarKozaczka | /03-FileHandling/Programs/3.20.py | UTF-8 | 280 | 3.578125 | 4 | [] | no_license | tab=[]
with open('../numbers.txt', 'r') as file:
for line in file:
x=int(line)
if x%2==0:
tab.append(x)
with open('evennumbers.txt', 'w') as file:
for i in range(0, len(tab)):
file.write(str(tab[i])+" ")
| true |
39065651fadfe30570ef6e7037a85b35c876c26e | niranjan-sa/MerkelScience | /src/MinSliceSumProblem.py | UTF-8 | 1,708 | 3.984375 | 4 | [] | no_license | """
Created on Tue May 15 18:31:50 2019
@author: niranjan_agnihotri
"""
def min_sum(numbers):
"""
This function returns minimum absolute sum. This is a trivial brute force approach with an O(n^2) time complexity.
:param numbers:
:return: Minimum absolute sum
"""
if len(numbers) == 0:
... | true |
65ca68c54a964b1c90aabd5efaf65b744cd2d38f | cooper-mj/Nifty-Coding-Projects | /positional_string_hash.py | UTF-8 | 537 | 4.21875 | 4 | [] | no_license | '''
Function: hash_string
Description: Takes in a string, returns a large number. This is a simple hash I
devised today. For each character in the string, it multiplies the character's
ASCII value by its positional placement (1-indexed). The natural logarithm of
that result is then returned (to avoid overflow when has... | true |
1a0f5b1c50c716a685889777e48d38b7a79214da | dipikarpawarr/TQ_Python_Programming | /PythonPracticePrograms/Database_MySQL/DB_Connect.py | UTF-8 | 661 | 2.84375 | 3 | [] | no_license | import mysql.connector as mcn
class DbConnect:
def __init__(self):
self.con = ''
self.cursor = ''
def createConnection(self):
try:
self.con = mcn.connect(host="localhost", database="tq_db", username="root", password="root")
except Exception as e:
print("... | true |
a54df42076474ceaa5395db20fee941b9a57d5c4 | Hiten-chan/python_course | /homeworks_spring/homework2/task2.py | UTF-8 | 722 | 3.1875 | 3 | [] | no_license | n = int(input())
lst = []
for i in range(n):
t = input().split(' ')
if len(t) == 1:
lst.append(t)
else:
t.pop(1)
lst.append(t)
dic = {}
for i in lst:
if len(i) == 1 and i[0] not in dic:
dic[i[0]] = None
elif i[0] not in dic:
dic[i[0]] = i[1:] ... | true |
0d52840d31e7524ff969a6ccb763ea19cf85ea80 | All3yp/Daily-Coding-Problem-Solutions | /Solutions/186.py | UTF-8 | 1,272 | 4.34375 | 4 | [
"MIT"
] | permissive | """
Problem:
Given an array of positive integers, divide the array into two subsets such that the
difference between the sum of the subsets is as small as possible.
For example, given [5, 10, 15, 20, 25], return the sets {10, 25} and {5, 15, 20}, which
has a difference of 5, which is the smallest possible difference.... | true |
bd75032694f0c7dfdb0c6a76b21f45be7449752a | charzharr/BIBM-SSL | /src/lib/utils/statistics.py | UTF-8 | 6,574 | 2.890625 | 3 | [] | no_license |
import numbers
import matplotlib.pyplot as plt
import numpy as np
import collections
import wandb as wab
class ExperimentTracker:
""" All-in-one concise experiment tracking after each epoch completion.
- Tracks all essential iteration and epoch metrics.
- Automatically logs epoch stats to wandb.
"""
... | true |
02068e83c129f22148ff2356e92a6c823d3d1227 | Som94/Pandas-Repo | /27 numpy test 1.py | UTF-8 | 105 | 3.015625 | 3 | [] | no_license | import numpy as np
lst=[[[1,2,4],[4,5,6]],[[7,8,9],[10,11,12]]]
print(lst)
arr=np.array(lst)
print(arr) | true |
12e7411d595180e0bd268b0fa61300230054ccb7 | RunningGump/crawl_xiciproxy | /xiciproxy/spiders/xici.py | UTF-8 | 2,016 | 2.921875 | 3 | [] | no_license | import scrapy
import json
'''
scrapy crawl xici -o out.json -a num_pages=50 -a typ=nn
其中`out.json`是输出json文件,`num_pages`是爬取页数,`typ`表示代理类型,`nn`是高匿代理,`nt`是普通代理。
'''
class XiCiSpider(scrapy.Spider):
name = 'xici'
# 使用-a选项,可以将命令行参数传递给spider的__init__方法
def __init__(self, num_pages=5, typ='nn', *args, **kwargs):... | true |
68f4ca197980e100d2e0987ba7d6824b4972d4f6 | Thomas-cat/my-school-sys | /PrintTable.py | UTF-8 | 3,167 | 2.953125 | 3 | [] | no_license | import re
color_dict = {'green':"\033[1;32m",
'yellow':"\033[1;33m",
'red':"\033[1;31m",
'blue':"\033[1;34m",
'purple':"\033[1;35m",
'green_blue':"\033[1;36m",
'no_color':"\033[0m"}
class printtable():
reg_color = re.compile(r'^{(.*?)}')
reg_code =re.compile(r'\x1b.*?m')
def... | true |
e448b1d51fba0252ca8732dfedbabef74c41804b | Tadele01/Competitive-Programming | /week-05/find_k_pairs_smallest_sum.py | UTF-8 | 600 | 2.828125 | 3 | [] | no_license | from heapq import heappush, heappop
class Solution:
def kSmallestPairs(self, nums1: List[int], nums2: List[int], k: int) -> List[List[int]]:
if not nums1 or not nums2:
return []
min_heap, result = [], []
for i in range(len(nums1)):
for j in range(len(nums2)):
... | true |
8f0e264e228aab5a80c04c346ae1bc07003401b7 | cao93821/creeper | /coroutines03.py | UTF-8 | 2,969 | 3 | 3 | [] | no_license | """重构coroutines02"""
import socket
import logging
from selectors import EVENT_READ, EVENT_WRITE
from coroutines02 import Future, selector, Task
logging.basicConfig(level=logging.DEBUG,
format='levelname: %(levelname)s output msg: %(message)s')
left_tasks = 10
def connect(sock, address):
f... | true |
3d643963aec9e9a73ed7028a37f9dba2dcd8a423 | robbintt/fort_gen | /separated_functions.py | UTF-8 | 13,004 | 3.3125 | 3 | [] | no_license | """
The goal is to display data, e.g. d,i,j,u,` in an indexed format.
The array this data is stored in can expand in both the negative
and positive directions on the x, y, and z axis.
There is no disadvantage each room node onto a table, and then when
generating the next node, check for collisions.
Process:
Gene... | true |
a75eed0bd568d6b2532a8c08e063737e180d4d84 | anushadevelopment/LearnPython | /function.py | UTF-8 | 383 | 3.25 | 3 | [] | no_license | #def func():
#print ("first function")
# def func1():
#print ("seond function")
# def func2():
#print ("third function")
# func1()
# func2()
#unc()
#
def func(n):
def fun1():
print("Sri")
def fun2():
print("Akshu")
if n ==1 :
return fun1()
else:
... | true |
dab832cbd5f3a47d9c479bd9feb6f8c59a14ed6b | Guo-lab/BilibiliDatabase | /ciyun.py | UTF-8 | 1,058 | 2.921875 | 3 | [
"MIT"
] | permissive | import jieba
import wordcloud
import pandas as pd
import csv
with open('/Users/gsq/Desktop/DatabasePractice/Final/csv/danmu.csv','r',encoding='utf-8') as csvfile:
reader = csv.reader(csvfile)
column = [row[7] for row in reader]
txt_list = jieba.cut(str(column)) # 处理 分词数据(返回数据类型列表)
string = ' '.join(... | true |
f214b1497d481fb0d8d0f6217451fddb1fa7705b | shikixyx/AtCoder | /ABC/162/162_D.py | UTF-8 | 1,150 | 2.921875 | 3 | [] | no_license | import itertools
import bisect
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(input())
S = list(input())
R = []
G = []
B = []
for i in range(N):
s = S[i]
if s == 'R':
R.append(i)
elif s == ... | true |
434ae807d4b16481dc29dc261184f3c422240428 | Irwin1985/mylang | /samples/py/rand_sort.py | UTF-8 | 192 | 3.421875 | 3 | [
"BSD-2-Clause"
] | permissive |
import random
# Pre-alloc the array
ar = [ None for x in range(100 * 1000) ]
i = 0
while i < len(ar):
ar[i] = random.randint(0, 1000 * 1000 * 1000)
i += 1
ar.sort()
print(ar[:10])
| true |
b2516d9d5714161f69a8bbb8e6c9ecc1fc1906f4 | pktippa/hr-python | /sets/strict_superset.py | UTF-8 | 652 | 3.5 | 4 | [
"MIT"
] | permissive | # Reading the main set
main_set = set(map(int, input().split()))
# Reading loop count
loop_count = int(input())
# setting flag for strict superset
is_strict_superset = True
# Looping through counter
for i in range(loop_count):
# Reading the input set
superset_check_set = set(map(int,input().split()))
# as p... | true |
d1cdbfd1867b7582544827bd7e4d3e24a03a8de0 | animeshprasad/richtext-net | /models/evaluate_new.py | UTF-8 | 11,990 | 3.046875 | 3 | [] | no_license | # A match is counted as correct if 100% overlap with truth
def discovery_exact_match(pred_file, truth_file):
with open(pred_file, 'r') as fp:
with open(truth_file, 'r') as ft:
pred_list = fp.readlines()
true_list = ft.readlines()
assert len(pred_list) == len(true_list), "... | true |
4fd91a8dbe7013e1119dcb0e899bac51ce7e6e4e | jiyali/python-target-offer | /25_合并两个排序的链表.py | UTF-8 | 981 | 3.9375 | 4 | [] | no_license | # 题目:输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。
class ListNode(object):
def __init__(self, data):
self.val = data
self.next = None
class Solution(object):
def Merge(self, pHead1, pHead2):
if pHead1 is None:
return pHead2
if pHead2 is None:
return p... | true |
016158df4cb2a6679e3881ccee6fb42c4758b096 | Shuricky/Intro-to-Computer-Science | /lab6.py | UTF-8 | 3,450 | 3.9375 | 4 | [] | no_license | '''
Created on Mar 2, 2017
@author: Shurick
Alex Rozenblit
CS115 - Lab 6
I pledge my honor that I have abided by the Stevens Honor System.
'''
def isOdd(n):
'''Returns whether or not the integer argument is odd.'''
return (n%2 != 0)
""" 42 - 32 = 10 (Left-most digit 1), 10 - 16 = -6 (No go... | true |
e05451876bca9ac4a4e0082c83dd8198b447ec03 | HirraAbdulMalik/gfa-nn_auc | /GFA-NN_AUC/extract_graph_features/extract_graph_features.py | UTF-8 | 5,212 | 2.796875 | 3 | [] | no_license | import networkx as nx
import numpy as np
import os
import argparse
def parse_args(args=None):
parser = argparse.ArgumentParser(
description='Generating graph features for datasets',
usage='python extract_graph_features.py --path <path to dataset folder>'
)
parser.add_argument('--path', de... | true |
573e717ca0b23489bfcfb38bee0218563fa5e994 | jamwomsoo/Algorithm_prac | /Dijkstra_Floyd-wareshall/백준/택배_FW.py | UTF-8 | 846 | 2.671875 | 3 | [] | no_license | n, m =map(int, input().split())
board = [[[int(1e9),0]]*(n+1) for _ in range(n+1)]
for i in range(m):
a,b,cost = map(int ,input().split())
board[a][b] = [cost,b]
board[b][a] = [cost,a]
for i in range(1,n+1):
for j in range(1,n+1):
if i == j:
board[i][j] = [0,0]
for k in rang... | true |
72de4f8a4caca9de4ccdf732a988b664f8ee3b4f | kelvinchumbe/ALX_Submission | /brighter_monday_spider.py | UTF-8 | 2,143 | 2.828125 | 3 | [] | no_license | import scrapy
from scrapy.http import HtmlResponse
class BrighterMonday(scrapy.Spider):
name = "brighter_monday_spider"
# allowed_domains = ['https://brightermonday.co.ke']
start_urls = ['https://brightermonday.co.ke/jobs']
def parse(self, response):
# Get the no. of jobs currently ... | true |
1d51a3c02dc94009f4ccb5be4c287430d0d3479f | jgalaz84/eman2 | /programs/e2stacksort.py | UTF-8 | 14,243 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python
#
# Author: Steven Ludtke, 01/03/07 (sludtke@bcm.edu)
# Copyright (c) 2000-2007 Baylor College of Medicine
#
# This software is issued under a joint BSD/GNU license. You may use the
# source code in this file under either license. However, note that the
# complete EMAN2 and SPARX software package... | true |
12e7c805ce14d20afe174f5185fbcba0ec9ed7f2 | LucasSGomide/Python | /Códigos/Exercicios_estruturas_controle/ex2_mod7.py | UTF-8 | 147 | 3.578125 | 4 | [] | no_license | a = []
limite = 0
while limite < 6:
a.append(int(input('Insira um número: ')))
limite = limite + 1
for numeros in a:
print(numeros)
| true |
8cde4c05a21a058123dcfda107bc0f7ebf5aa8b1 | liuzey/FaceRecognitionATK | /util_c.py | UTF-8 | 2,675 | 2.515625 | 3 | [] | no_license | import numpy as np
import os.path
import sys
import time
import argparse
import cv2
import matplotlib.pyplot as plt
import matplotlib.patches as patches
from align import AlignDlib
import contaminate_c
parser = argparse.ArgumentParser()
parser.add_argument("data", type=str, help='dataset type: adding pattern or T-shi... | true |
8ba7aa6d84970f85c857f2216d5681c43ab7869c | kemball/karkadann | /unit_test/prodigal_test.py | UTF-8 | 5,501 | 2.71875 | 3 | [] | no_license | from context import karkadann
from karkadann.prodigal import *
from karkadann.database import data_location
import unittest as ut
class TestOverlap(ut.TestCase):
def test_overlap(self):
from Bio.SeqFeature import FeatureLocation
def overlap_exercise(one, two, result):
self.assertEqual(overlap(one, two), over... | true |
53aa3bd231da037005802c9beeebcc95c45f6c55 | Chitransh219/chitransh-web-capg | /python/regular_expression.py | UTF-8 | 280 | 3.078125 | 3 | [] | no_license | import re
hand = open('words.txt')
numlist = list()
for line in hand:
line = line.rstrip()
temp= re.findall('[0-9]+', line)
if len(temp) == 0: continue
for i in range(len(temp)):
num = int(temp[i])
numlist.append(num)
print(sum(numlist)) | true |
12e09558896064c623558aba86d4708187afa860 | arnlen/ksp_navball | /navball.py | UTF-8 | 904 | 2.75 | 3 | [] | no_license | from OpenGL.GLU import *
from OpenGL.GL import *
from PIL import Image as Image
import numpy
class NavBall():
"""Main NavBall object, based on a sphere"""
def __init__(self, texture_path):
self.texture_path = texture_path
self._read_texture_file()
self._create_quadric_object()
def create(self):
gluSphere(s... | true |
1e00998b3e262ae1749c4cb31743f7e96c20abc8 | constance-scherer/PLDAC_Recommandation_analyse_sous_titres | /interface/similarities.py | UTF-8 | 2,317 | 2.578125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from utils.preprocessing_cleaned_data import *
from utils.swSets import *
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.model_selection import train_test_split, cross_val_score
# def get_corpus(path, liste_filenames):
# """each text in c... | true |
34562c65053b06af0ee136f50cf99fd51dce7081 | manvillej/fun_examples | /google_fire/google_fire/simple_func.py | UTF-8 | 121 | 2.859375 | 3 | [] | no_license | import fire
def hello(name):
return f'Hello {name}!'
def main():
fire.Fire(hello)
if __name__ == '__main__':
main() | true |
6e7a7fd445251e572f6ef4ac4fc9d5ad6498b062 | mknotts623/BioinformaticsAlgorithms | /Chapter_1/frequent_words_with_mismatches.py | UTF-8 | 1,674 | 3.828125 | 4 | [] | no_license | from neighbors import neighbors
def frequent_words_with_mismatches(text, k, d):
'''
Finds most frequent k-mers within the text with at most d mismatches. Does so by sliding a
k-sized window down the text to find a pattern, generates the likely d-neighborhood for that
pattern, and stores the frequency of... | true |
48d09a8948215d72689fae822616bf79fa967774 | traciarms/textminer | /textminer/extractor.py | UTF-8 | 435 | 2.75 | 3 | [] | no_license | import re
def phone_numbers(text):
return re.findall(r'[\(]?[0-9]{3}[\-\)\.\s]?[\s]?[0-9]{3}'
r'[\-\.\s]?[0-9]{4}', text)
def emails(em):
return re.findall(r'[a-z0-9!#$%&\'*+/=?^_`{|}~-]+(?:\.[a-z0-9!'
r'# #$%&\'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*'
... | true |
38f7f6927714f996c4418398e922d5c1852c4301 | samirsaravia/ubiquitous-octo-fortnight | /AC/IntroPython/python-if/b5.py | UTF-8 | 442 | 3.96875 | 4 | [
"MIT"
] | permissive | # quando é verdadeiro e quando é falso
print(bool('True'))
print(bool('False'))
print(bool(''))
print(bool(' '))
print(bool('ola mundo'))
print(bool(7))
print(bool(1))
print(bool(0))
print(bool(-1))
print(1 + 1 == 3)
print(1 + 1 == 2)
# print(1 + 1 = 2) existe um erro
print(1 == 2)
print(1 != 4) # != diferente de
... | true |
91e606acc6c194bc45d0476f64a8fe2faab864c8 | ghotiv/python_rabbitmq_multiprocessing_crawl | /track_excel/test_excel.py | UTF-8 | 432 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# author:ghoti
from read_excel import Read_Excel, Export_Excel
def main():
headings = ['no', 'date']
values = [['12345', '2012-12-12'], ['12346', '2012-12-13']]
Export_Excel(headings, values, file_name='a.xls')()
r = Read_Excel(file_name='a.xls')()
print r
[{'no': '123... | true |
ea36d7e6b3bbf031892fb0fd6dd5c41312c55051 | HyeonsooChang/MLearning_Study | /MLearning07.py | UTF-8 | 2,330 | 3.46875 | 3 | [] | no_license | import pandas as pd
fish = pd.read_csv('http://bit.ly/fish_csv')
fish.head()
#species열에서 고유한 값 추출
print(pd.unique(fish['Species']))
fish.columns
#species열을 타깃으로 만들고 나머지를 input값으로 설정.
fish_input = fish[['Weight', 'Length', 'Diagonal', 'Height', 'Width']].to_numpy()
print(fish_input[:5])
fish_target = fish... | true |
6266a6835885852d0773335db05f31bdcc5e1d36 | mallang327/Facenet_prac | /Facenet_prac_img.py | UTF-8 | 2,671 | 2.734375 | 3 | [] | no_license | import cv2
import torch
from PIL import Image, ImageDraw
import numpy as np
from facenet_pytorch import MTCNN
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
class FaceDetector(object):
"""
Face detector class
"""
def __init... | true |
5fb2fd7b1cc1f22b6f3b83997c6f108010fdb44d | mysqlbin/python_note | /2020-03-24-Python-ZST-base/2020-03-23-面向对象/2020-03-28-01-class.py | GB18030 | 2,444 | 3.515625 | 4 | [] | no_license | #!/usr/bin/ptyhon
#coding=gbk
"""
"""
import time
class Hero:
def __init__(self, health, output1, time1, output2, time2):
self.health = health
self.output1 = output1
self.time1 = time1
self.output2 = output2
self.time2 = time2
def skill(self):
print("ͷŵ... | true |
a25c0db16dfe5a040edf0222f1ce9dfa7334e37a | Hyvjan/Cookbook | /tests.py | UTF-8 | 1,261 | 2.65625 | 3 | [
"MIT"
] | permissive | from datetime import datetime, timedelta
import unittest
from server import app, db, User, Recipe, Ingredient
class ModelCases(unittest.TestCase):
def setUp(self):
app.config['SQLALCHEMY_DATABASE_URI']= 'sqlite://'
db.create_all()
def tearDown(self):
db.session.remove()
db.drop... | true |
de7caa64b8ffad239bcf528541a389fe7a8a50dd | Exploit89/PyQt-Learning | /Chapter 13/Listing 13.4.py | UTF-8 | 562 | 4.5 | 4 | [] | no_license | # Атрибуты объекта класса и экземпляра класса
class MyClass: # Определяем пустой класс
pass
MyClass.x = 50 # Создаем атрибут объекта класса
c1, c2 = MyClass(), MyClass() # Создаем два экземпляра класса
c1.y = 10 # Создаем атрибут экземпляра класса
c2.y = 20 # Создаем атрибут экземпляра класса
print(c1.x, c1... | true |
cabaca16da94696ed74aa2622277b4c991cfec72 | CarvalhoGabriell/Python_Nanocourse | /Cap3_E_4_Tuplas_E_Dicionarios/ModuloTeste.py | UTF-8 | 492 | 2.71875 | 3 | [] | no_license | from Pacote_funcoes.identificarFuncoes import *
listaEmpresa = []
print("Preenchendo a lista")
preecherInventario(listaEmpresa)
print("EXIBINDO OS ITENS DA LISTA\n")
exibirInventario(listaEmpresa)
print("BUSCANDO ITEM DO INVENTARIO")
buscarEquipamento(listaEmpresa)
print("ALTERANDO VALOR DO EQUIPAMENTO")
depreciacao... | true |
9569716002c0c77cfe55bf8d76c228c105171eb9 | DTomusk/Scraping | /scrap/scrap/spiders/wiki_spider.py | UTF-8 | 705 | 2.921875 | 3 | [] | no_license | import scrapy
class WikiSpider(scrapy.Spider):
name = "wiki"
allowed_domains = ['wikipedia.org']
start_urls = [
#'https://www.wikipedia.org/',
'https://en.m.wikipedia.org/wiki/Special:Random#/random',
]
# first off, print the title of every page linked to the homepage
def parse(self, response):
self.log... | true |