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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
861f984f83d0773daa3cd97478feaaba72709612 | Python | pitchaim/codecast | /codecast_server.py | UTF-8 | 3,994 | 2.9375 | 3 | [
"MIT"
] | permissive | import sys, os, subprocess
from socket import *
import ssl
from threading import Thread
import jack
class Server():
def __init__(self, password, client_table, sname):
self.password = password
self.client_table = client_table
self.sname = sname
self.max_clients = len(client_table)
... | true |
53ed6ab6b6934d9a2e532de02f7d510e69dc73a3 | Python | mo-mosverkstad/abstract_file_operation | /Mo_cmd_shell/mo_cmd_shell.py | UTF-8 | 2,651 | 2.609375 | 3 | [] | no_license | import os, cmd, file_management
from file_framework import *
from help_print import help
def mo_cmd_shell():
DIRECTORY = 1
TEXTFILE = 2
MODE_DIRECTORY = 'd----- '
MODE_ROOT_DIRECTORY = 'd-r---'
MODE_TEXTFILE = '-a---- '
listfiles = ['dir', 'ls']
PROMPT = '>'
DELIMITOR = '\\'
INP... | true |
dc1652bdd60c01f9d7fcd50ef2c334f4f3491a02 | Python | sangyosigi/python | /chap4_4(2).py | UTF-8 | 210 | 3.8125 | 4 | [] | no_license | """ example_list =["요소A","요소B","요소C"]
i=0
for item in example_list:
print("{}번째 요소는 {}입니다.".format) """
array=[]
for i in range(1,20,2):
array.append(2**i)
print(list(array)) | true |
bef1e50ee50a42d495fc1296c6bd1903750d42c1 | Python | Nmloury/DSI-Projects | /Project 5/Project_5/Project_5/spiders/rv.py | UTF-8 | 951 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from Project_5.items import RVItem
class RvSpider(scrapy.Spider):
name = "rv"
cities = ["newyork","losangeles","chicago","houston", "philadelphia","phoenix","sanantonio","sandiego","dallas", "sfbay"]
city_urls = ["http://%s.craigslist.org/search/rva" % city for city in... | true |
17b66ba763f3172722e2b72ca0d9e76f5bb5972a | Python | AlinGeorgescu/Problem-Solving | /Python/58_length_of_last_word.py | UTF-8 | 374 | 3.953125 | 4 | [] | no_license | #!/usr/bin/env python3
def main() -> None:
s = input("Enter string: ")
found_a_letter = False
length = 0
for i in range(len(s) - 1, -1, -1):
if s[i] != ' ':
found_a_letter = True
length += 1
elif found_a_letter:
print(length)
return
... | true |
4aa4c5376b85a9769b43d5e7a7a5ff87699802ac | Python | abhishek3aj/ML1819--task-101--team-06 | /Assignment_2/Template_Files/Template_Cancer.py | UTF-8 | 3,455 | 3.0625 | 3 | [] | no_license |
# coding: utf-8
# In[1]:
# Import Necessary Libraries
import pandas as pd
import numpy as np
import os
from sklearn import preprocessing
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import scale
from sklearn import metrics
import seaborn as sns
import matplotlib.pyplot as plt
impo... | true |
d40172c0af4073343ea82fca43119cc692bb2b47 | Python | aojha8217/independentStudy | /amZips.py | UTF-8 | 4,057 | 3.171875 | 3 | [] | no_license | import csv
import json
import webbrowser
import collections
import unittest
import sys
import glob
import os
import re
import operator
import requests
google_api_key = "AIzaSyD3cn_utAfFePi70-Ay1KFI9_QgA7VFckI"
googleBaseUrl = "https://maps.googleapis.com/maps/api/geocode/json"
#Because I am storing date as a number... | true |
fffffb48284c70b72a233a27f9d4e55e310a94d9 | Python | SakshiRa/Selenium | /Selenium.py | UTF-8 | 769 | 2.53125 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 06:50:55 2020
@author: sakshirathi
"""
from bs4 import BeautifulSoup
import pandas as pd
from selenium import webdriver
driver = webdriver.Chrome(executable_path='/Users/sakshirathi/Downloads/chromedriver 3')
driver.get('http://kanview.ks.gov/P... | true |
a435cac3342d95c37bf528e98d18fc49a9844ac6 | Python | davll/practical-algorithms | /algo.py/algo/sort/patience.py | UTF-8 | 936 | 3.640625 | 4 | [] | no_license | # Patience Sorting
#
# Worst case: O(n*log(n))
#
from functools import total_ordering
from bisect import bisect_left
from heapq import merge
@total_ordering
class Pile(list):
def __lt__(self, other):
return self[-1] < other[-1]
def __eq__(self, other):
return self[-1] == other[-1]
def patienc... | true |
6592d2f3a69e9fe9516b8811bd796c4ecfa073d9 | Python | wderekjones/CS612Final | /knn_benchmark.py | UTF-8 | 1,436 | 2.9375 | 3 | [] | no_license | import numpy as np
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.model_selection import KFold
from confusionplot import plot_confusion_matrix
max_iters = 100
model = KNeighborsClassifier(n_neighbors=3, metric="minkowski", p=2)
examples ... | true |
b5a457cb74b2d7d0229c46ad83c24685876ce5d9 | Python | abouchard-ds/Land-Real-Estate | /4_Centris_GoogleMap.py | UTF-8 | 4,852 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
"""
import pandas as pd
import pickle
import googlemaps
from datetime import datetime
now = datetime.now()
df = pd.read_excel("data\\6_Centris_Gmap.xlsx")
# instanciate a client
API_key = "yourkey"
gmaps = googlemaps.Client(key=API_key)
home = "Montreal, QC H0H 0H0"
... | true |
ff9b05dadbad3f5017c97a5ac53fb3bda18f5215 | Python | BMariscal/study-notebook | /assignments/ctci/8.7.py | UTF-8 | 464 | 3.203125 | 3 | [] | no_license |
from collections import Counter
def permutations(string):
c = Counter(string)
idx = 0
res = []
stack = [0] * len(string)
def parse(c, res, idx, stack):
if idx == len(stack):
res.append("".join(stack[::]))
return
for key in c:
if c[key] > 0:
stack[idx] = key
c[key]-=... | true |
8464b67ea90adffe05db583d9c1bc8f0bc550bdf | Python | winlaic/winlaic | /numpy/matlab.py | UTF-8 | 395 | 3.046875 | 3 | [] | no_license | import numpy as np
def magic(n):
row, col = 0, n//2
magic = []
for i in range(n):
magic.append([0]*n)
magic[row][col]=1
for i in range(2,n*n+1):
r,l=(row-1+n)%n,(col+1)%n
if(magic[r][l]==0):
row,col=r,l
else:
row=(row+1)%n... | true |
ca090e51eca20c05f24d36dfecf4b0447708a33c | Python | massg/Wallpaper-TV | /extras/try.py | UTF-8 | 2,254 | 2.59375 | 3 | [] | no_license | import cv2
import os
import argparse
import numpy as np
ap = argparse.ArgumentParser()
ap.add_argument("-o", "--output", required=False, default='output.mov', help="output video file")
args = vars(ap.parse_args())
output = args['output']
vid = cv2.VideoCapture("video.mp4")
success=1
count = 0;
s, image= vid.read()
he... | true |
96d99d774f632e95ac7d801e1c7ab7cb8fe9f213 | Python | anand-me/PyLearners | /src/L1.8-Loops/script_a16.py | UTF-8 | 713 | 4.28125 | 4 | [] | no_license | #################### LOOP #####################
######################### Python uses two types of loop for and while
#######Use of else clause for the while loop #####
##### When the loop condition of "for" or "while" statement fails then code part in "else" is executed. If break statement is executed inside for loo... | true |
f81b27caec1236aad08d00497e6355502ec3e2d6 | Python | lisiynos/loo2015 | /day1/1_hall/hall_va.py | UTF-8 | 309 | 2.78125 | 3 | [] | no_license | from math import *
input = open('hall.in', 'r')
output = open('hall.out', 'w')
a, b, c, d = [int(x) for x in input.readline().split()]
ans = 0
for x in range(1, int(sqrt(b)) + 1):
l = max((a + x - 1) // x, (c + 1) // 2 - x, x)
r = min(b // x, d // 2 - x)
ans += max(r - l + 1, 0)
output.write(str(ans)) | true |
be998c2f1bab116e534a1dd537acf653a7bb4b86 | Python | venkatpushpak/BMI-prediction-from-face-images | /testcodes/asmfitting.py | UTF-8 | 4,442 | 2.546875 | 3 | [] | no_license | import numpy as np
import cv2
import time
import dlib
import math
import imutils
from imutils import face_utils
import pandas as pd
import os, os.path
images = []
data =pd.DataFrame()
def midpoint(p1, p2):
return ((p1[0]+p2[0])/2, (p1[1]+p2[1])/2)
def intersectionpt(p1,p2,p3,p4):
# line p1 p2
a1 = p2[... | true |
d890eb618fb3eda6dbb10edcea09142ae03e949e | Python | wzx-ipads/lol-winrate-prediction | /mid/mid_forJava.py | UTF-8 | 1,633 | 2.765625 | 3 | [] | no_license | import pandas as pd
import xgboost as xgb
import sys
def predict(argument):
model = xgb.Booster({'nthread': 4}) # init model
model.load_model("/Users/wzx/python-workspace/lol2/mid/mid.model") # load data
test = pd.DataFrame({'Kills per min.': [argument[0]],
'Deaths per min.': [... | true |
6ae02545723a6ea2146148b55e6344e58fd4f4d0 | Python | Ascend/ModelZoo-PyTorch | /PyTorch/contrib/cv/detection/RetinaMask/maskrcnn_benchmark/data/transforms/transforms.py | UTF-8 | 5,563 | 2.515625 | 3 | [
"GPL-1.0-or-later",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import random
import math
import torch
from torchvision.transforms import functional as F
from maskrcnn_benchmark.structures.segmentation_mask import Polygons
class Compose(object):
def __init__(self, transforms):
self.transforms = t... | true |
960501c4a0a65998bde836d2bf09f07351aa1e89 | Python | anton-pershin/thequickmath | /thequickmath/reduced_models/advection.py | UTF-8 | 1,409 | 3.125 | 3 | [
"MIT"
] | permissive | import numpy as np
from thequickmath.reduced_models.dynamical_systems import DynamicalSystem
class LinearAdvectionModel(DynamicalSystem):
def __init__(self, x_dim, delta_x, U):
"""
This class sets up the linear advection model:
du/dt = -U * du/dx
Periodic boundary conditions are a... | true |
d1763222049cb02f8525c0a7b9c4b4a66e447017 | Python | vidhi013/sample01 | /sample.py | UTF-8 | 255 | 3.375 | 3 | [] | no_license | #largetest of 3
num1=int(input("enter the num1"))
num2=int(input("enter the num2"))
num3=int(input("enter the num3"))
if num1>num2 and num1>num3:
print("num1 is greater")
elif num2>num3:
print("num2 is greater")
else:
print("num3 is greater")
| true |
f63c132ef7e9bef30c199b12d84ea608cc7d74a9 | Python | slavkoBV/solved-tasks-SoftGroup-course | /OOP_and_OOD/todo_list_MVC_FILE.py | UTF-8 | 7,685 | 3.140625 | 3 | [] | no_license | #! /usr/bin/env python3
from datetime import datetime
import os
from collections import OrderedDict
import pickle
# Model ###################################################################################
class Task:
def __init__(self, content='', deadline=None, priority=None, comment=None):
self.conten... | true |
8dd1386e5ff6441f0605efe70cd564281a9ddc10 | Python | Gustee/CodingInterview-Chinese-version2 | /chap3/2.py | UTF-8 | 164 | 3.015625 | 3 | [] | no_license | # 打印从1到最大的n位数
# 输入数字n,按顺序打印出从1到最大的n位十进制数。
# 比如输入3, 打印出1,2,3直到最大的3位数999
| true |
118adcc873bee9052e8795fededb9656d654a026 | Python | PikoLab/ETL-Spotify-Played-Tracks | /spotify_played_tracks.py | UTF-8 | 3,562 | 3.359375 | 3 | [] | no_license | import requests
import pandas as pd
import sqlalchemy
import sqlite3
from datetime import datetime
import datetime
#Global Variables
DATABASE_LOCATION='sqlite:///spotify_played_tracks.sqlite'
TOKEN=' ' #your spotify API token
# Data Validation Function
def check_if_validate(df:pd.DataFrame):
#check if df is empt... | true |
75c58f1a7686045cbc5bc0a0528d56babf4de044 | Python | k323r/numerics | /src/linearConvection/convection.py | UTF-8 | 1,021 | 3.40625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
import numpy as np
from matplotlib import pyplot as plt
import time, sys
### Numerical variables
nx = 81 # number of discrete points
dx = 2.0 / (nx - 1) # cell width (distance between points)
nt = 25 # number of timesteps
dt = 0.025 # Zeitschrittweite
print "Gitterweite: ", dx
print "Zeits... | true |
505485b6d7f51d49f4263e33db0153ef7e93e7f8 | Python | Domainsun/LearnPython | /day2/list.py | UTF-8 | 1,862 | 4.125 | 4 | [] | no_license | # 2018年1月25日21:14:17 列表的使用
names=["domain","ZhanSan","LiSi","WanWu","WuDi","LiYiFeng","WuYiFang"]
# 增
names.append("domain") # 在后面追加
names.insert(2,"insertZhan") # 指定位置插入
print(names)
# 删
names.remove("domain") # 指定值删除
names.pop(1) # 指定位置删除
print(names)
#查
print(names[... | true |
e65193b05bce199fc0a09f9dc35b6844602392f9 | Python | VemburajYadav/Unsupervised-Learning-of-Optical-Flow | /src/core/flow_util.py | UTF-8 | 3,770 | 2.828125 | 3 | [] | no_license | import torch
import numpy as np
from skimage.color import hsv2rgb
import torch.nn.functional as F
import copy
import png
def flow_to_color(flow, mask=None, max_flow=None):
"""Converts flow to 3-channel color image.
Args:
flow: tensor of shape [num_batch, 2, height, width].
mask: flow validity m... | true |
ccde4d4ee95b387981d584b4a14ee29ad2cadf6a | Python | sjanssen2/microprot | /microprot/scripts/processing.py | UTF-8 | 1,305 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Tomasz Kosciolek"
__version__ = "1.01b"
__last_update__ = "12/19/2016"
import click
import sys
from skbio import io, Sequence
def extract_sequences(infile, seqidx=0):
""" Extract sequence(s) from a multi-sequence FASTA file
Parameters
-------... | true |
96734d59cb07d5c856508b1506a831e5b5f31995 | Python | kosicsd12176/Machine_Learning_Regression_Apps | /appStock/embedding_data.py | UTF-8 | 216 | 2.6875 | 3 | [] | no_license | import numpy
def embed_data(x, steps):
n = len(x)
xout = numpy.zeros((n - steps, steps))
yout = x[steps:]
for i in numpy.arange(steps, n):
xout[i - steps] = x[i-steps:i]
return xout, yout | true |
4ce62ad424ec75e250838beb08dea96251d8998c | Python | hausen6/rospy_win_general_msgs | /sample/image_view.py | UTF-8 | 2,804 | 2.515625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
import numpy as np
try:
import cv2 as cv
_cv_imported = True
except (ImportError):
import matplotlib.pyplot as plt
_cv_imported = False
import rospy
from sensor_msgs.msg import Image
class ImageView(object):
... | true |
d3cdc7fcb7114e15de1c5b021c06d05771f3b88c | Python | r0nharley/DataDriven21 | /DataDiffFull/parsers/tests/test_column_chart_parser.py | UTF-8 | 4,755 | 2.640625 | 3 | [] | no_license | import os
from RobotFramework.parsers.column_chart_parser import ColumnChartParser
def get_test_file_path(filename):
"""
Gets the path to a file in the column-chart fixtures folder
:param filename: Name of the file
:return: Path to the file
"""
return os.path.join('parsers', 'tests', 'fixture... | true |
d10ad60220380b56b61288a105de56bc34feefea | Python | AlexisAndresHR/DAIII_Actividad02-AAHR | /controllers/clientes/delete.py | UTF-8 | 707 | 2.859375 | 3 | [] | no_license | import web
import config as config
class Delete:
def __init__(self):
pass
def GET(self, nombre):
clientes = config.model_clientes.select_nombre(nombre) # Selecciona el registro que coincida con nombre
return config.render.delete_cliente(clientes) # Envia el registro y renderiza delete... | true |
51ea662cb8a749fdf79e5616cd0ee5b1155ea7f0 | Python | krzysztof9nowak/PWr-WIP | /lab4/python/mastermind.py | UTF-8 | 1,196 | 3.71875 | 4 | [] | no_license | from collections import Counter
codes = []
def generate_all_posible_codes(dim, array):
if dim == 0:
codes.append(array)
return
for i in range(1,6+1):
new_array = array[:]
new_array.append(i)
generate_all_posible_codes(dim - 1, new_array)
def count_matching_colors(a, b):... | true |
b0ae0fb5c867672686738de041dcf4aa94475aa3 | Python | chanchanu/Algo | /문자열/problem4.py | UTF-8 | 215 | 3.296875 | 3 | [] | no_license | # 문자열 반복
n = int(input()) # 테스트케이스 개수
for i in range(n):
array = list(input())
r = int(array.pop(0))
array.pop(0)
for j in array:
print(j*r,end='')
print(" ") | true |
31f66048c5bdf8c210ff3d3306ce0ff8a1a685c7 | Python | Etienne-Meunier/Learning-Pytorch | /FirstNeuralNetwork/loading_blocks.py | UTF-8 | 4,834 | 2.546875 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import r2_score
from sklearn.ensemble import RandomForestRegressor # Pour le Random Forest
import torch
NUMBER_SELECTED_FEATURES = 80
def write_submission(Y_s... | true |
61023d39df6c54e3b28d8e7b9b9f2f1565c204e1 | Python | liangyf22/test | /02_面向对象/__str__和__repr__魔术方法.py | UTF-8 | 745 | 3.796875 | 4 | [] | no_license | # __str__和__repr__都用于返回字符串
# 重写__str__和__repr__必须有return值且必须是字符串
# object 的__str__和__repr__返回的是对象
#
# 触发条件
# print()/ str()/format() 都是触发__str__(当没有重写__str__,但是重写__repr__时,也可以触发__repr__。都没有重写则查找父类的__str__。
# 可以理解为__repr__是__str__的备胎)
# 交互命令 、 obj repr 触发__repr__
class TestClass(object):
def __init__(self,name):... | true |
e2827b5ba0fa86e99ee25516b5b6f75709d225ea | Python | Jeoungseungho/python-coding-study | /정승호/주식가격/soluton.py | UTF-8 | 207 | 3.046875 | 3 | [] | no_license | def solution(prices):
l = len(prices)
a = [0]*l
for i in range(l-1):
for j in range(i+1, l):
if prices[i] > prices[j]:
break;
a[i] = j-i
return a
| true |
e249a2abbce9ac60f75aefda09c7705c026ec8fa | Python | lch2014/Anomaly-Detection | /Preprocess/csv_utils.py | UTF-8 | 1,389 | 3.140625 | 3 | [] | no_license | import pandas as pd
import glob
#读取csv数据集
def load_single_file_data(file_path, with_header):
if with_header:
df = pd.read_csv(file_path, low_memory=False)
else:
df = pd.read_csv(file_path, header=None, low_memory=False)
return df
#读取csv数据集
def load_all_file_data(dir_path, with_header):
... | true |
7f11b3336dc2631a899a0b7b22feed5ba0c728bd | Python | AlSources/wordsearch_generator | /wordsearch_generator.py | UTF-8 | 3,471 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python3
import random
import string
#setup
def print_puzzle():
for x in range(puzzle_size):
print(' '.join( puzzle[x] ))
print('\n')
def print_list():
for i, word in enumerate(words_list):
space = 20-len(word)
print(word + ' '*space, end=' ')
if i % 4 == 3:
print('\n')
puzzle_size = ... | true |
6f296da7a752b071af2726e5d879b20c3333de8e | Python | Abradat/Unsupervised-Sentiment-Analysis | /plot.py | UTF-8 | 575 | 2.8125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
#read data from csv
data = pd.read_csv('CSVs/FinalResult2.csv', usecols=['created_at','score'], parse_dates=['created_at'])
#set date as index
data.set_index('created_at',inplace=True)
#plot data
fig, ax = plt.subplots(figsize=(30,1... | true |
751156a38b471e645ba080d9180e11cf3b20e340 | Python | irheayadav/Python-Database-Tkinter-SQlite | /database.py | UTF-8 | 2,420 | 3.046875 | 3 | [] | no_license | ##GUI +Database
from tkinter import*
import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
root = tk.Tk()
root.title("Database")
import sqlite3 #split library ##database
connection = sqlite3.connect('student1_detail.db')
print("database opened successfully")
TABLE_NAME = "stu... | true |
96ce1af9ee5ac9f92ad098ddc1a8bac4d234a149 | Python | ProjetPP/PPP-CAS | /ppp_cas/calchasTree.py | UTF-8 | 13,696 | 2.859375 | 3 | [
"MIT"
] | permissive | import re
class List:
def __init__(self, l):
self.list = l
def __str__(self):
if len(self.list)==0:
return 'List([])'
s = 'List(['+str(self.list[0])
for e in self.list[1:]:
s = s + ', ' + str(e)
return s+'])'
def __getitem__(self,index):
... | true |
82c39fccf7f3b4032e23b0cd044b697a6c7754cd | Python | Lucka-B/Learning_python | /turtle_village.py | UTF-8 | 471 | 3.34375 | 3 | [] | no_license | from turtle import forward, shape, left, right, exitonclick
from math import sqrt
from turtle import speed
speed(0)
shape('turtle')
for i in range(10):
left(90)
forward(50)
right(90)
forward(50)
right(135)
forward(sqrt(2)*50)
left(135)
forward(50)
left(90)
forward(50)
left(45... | true |
c6f386e9188b42a0da170de7ec720ba464989983 | Python | ajmaurer12/dots_and_boxes | /dots_and_boxes.py | UTF-8 | 21,093 | 3.390625 | 3 | [] | no_license | import numpy as np
import random
import tensorflow as tf
import pickle
#For ease of testing, you can start a game many different ways
#Rules of Dots and Boxes: Two players take turns connecting pairs of dots on the board, vertically or horizontally.
#If the player completes a box, they score a point, and get to... | true |
0230fe8b1cf0c9eeb91c3af5c480c05eb2dd2e24 | Python | superkuang1997/OpenCV-learning | /arithmetic_operations/subtract.py | UTF-8 | 425 | 2.859375 | 3 | [] | no_license | import cv2
# dst1:img1中颜色值减去255直接为0,颜色为黑色
# dst2:255减去img1中的颜色值,可以得到不同的颜色值,颜色为彩色
img1 = cv2.imread('../image/windowsLogo.jpg', 1)
img2 = cv2.imread('../image/LinuxLogo.jpg', 1)
dst1 = cv2.subtract(img1, img2)
dst2 = cv2.subtract(img2, img1)
cv2.imshow('dst1', dst1)
cv2.imshow('dst2', dst2)
k = cv2.waitKey(0)
... | true |
95ac5c4d1e6f94410c6e831dff934bc513932432 | Python | Bradysm/dataset_splitter | /dataset_splitter.py | UTF-8 | 2,734 | 3.296875 | 3 | [] | no_license | # This Python code is for Python version : 2.7.12
import os
import numpy as np
# Root folder is the directory that contains the folder with all data
# the image data must be in a directory with subdirectories that
# represent a class label with images pertaining to the class label
# root directory with subdirecto... | true |
3d809d103aab99340df843eb98d0f9ec26aef3a1 | Python | erictehyc/GaitWalk | /training/fyp_prepare_img_data.py | UTF-8 | 6,766 | 2.5625 | 3 | [] | no_license | import os, re, pickle, math, copy, random
import cv2
import numpy as np
import matplotlib.pyplot as plt
SEQ_LEN = 30
# MIN_HEIGHT, MIN_WIDTH = 300, 50
MIN_HEIGHT, MIN_WIDTH = 0, 0
#load data as numpy array. Memory problem here
def load_data(frame_dir, debug=False, seq_size=30):
X = []
y = []
min_h, min_w... | true |
1c21af3dc88a3bed39c8750883b315c54da66379 | Python | thatc0der/Sine-Cosine | /sinecosine.py | UTF-8 | 2,242 | 3.671875 | 4 | [
"MIT"
] | permissive | """
sinecosine.py
Author: hAg!n 0nYAnG0
Credit: Glen Passow
Assignment:
In this assignment you must use *list comprehensions* to generate sprites that show the behavior
of certain mathematical functions: sine and cosine.
The sine and cosine functions are provided in the Python math library. These functions are used... | true |
45dae36da44eedf67cbedd05943225723ab70576 | Python | xm-king/python_machine_learning | /pandas/PandasDemo1.py | UTF-8 | 412 | 3.359375 | 3 | [] | no_license | import pandas as pd
### Panda索引
data = pd.read_csv("titanic_train.csv")
print("Data: %s,dType:%s"%(type(data),data.dtypes))
print(data.head())
print(data[['Age',"Fare"]][:5])
print((data.index))
print(data.iloc[0:5])
print((data['Age']>70).sum())
### GroupBy操作
df = pd.DataFrame({"Key":['A','B',"C",'A','B',"C",'A','B',... | true |
4a038bed31a25052a3f7b269cf434b6b4d0a2dfc | Python | kcyang/Python_Testing | /js_call_example.py | UTF-8 | 1,198 | 2.625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
#START - 여기는 javascript에서 call하기 위한 것들
#import sys
#sys.path.append(r'C:\Python27\Lib')
#sys.path.append(r'C:\Python27\Lib\site-packages')
#END
import pymongo
from openpyxl import load_workbook
def stdout(a):
sys.stdout.write(str(a) + "\\n")
def build(filename,document_name):
wb = l... | true |
df3e94c4acf5f680116caa6ca55116d48877afbf | Python | 14Praveen08/Python | /greater_string.py | UTF-8 | 88 | 3.5 | 4 | [] | no_license | a,b = map(str,input().split(" "))
if a>b:
print(a)
elif a<b:
print(b)
else:
print(a)
| true |
155264fa1be9cc9a8bfb8169d61dc5552817bb6b | Python | wdavisf/treehouse-python-techdegree-practice | /u2-practice-disemvowel.py | UTF-8 | 516 | 4.5 | 4 | [] | no_license | # """
# Unit 2 Practice 2:
# Python Collections - Disemvowel Challenge
# -----------------------------------------
# Goal: remove all the vowels to whatever word we pass in the function.
VOWELS = "aeiou"
def disemvowel(word):
letters = list(word)
for letter in word:
if letter.lower() in VO... | true |
81426f81141fb41c8c7213e738f6232b0f32b360 | Python | wozhub/project-euler | /20.py | UTF-8 | 183 | 3.640625 | 4 | [] | no_license | #!/usr/bin/python
def factorial(numero):
if numero == 1: return 1
else: return numero*factorial(numero-1)
suma=0
for n in str(factorial(100)):
suma+=int(n)
print suma
| true |
bc52c50f270083750e59c1b98c3cb7633306c1d5 | Python | Dhruv120/PyThon-Projects | /Projects/13.Kirana_Receipt_Calculator.py | UTF-8 | 571 | 3.828125 | 4 | [] | no_license | items_list = {"biscuit" :50 , "cake" :100 , "chocolate": 30 }
bill = 0
print("Welcome to Kirana.com")
print('''This is our menu :
1 - biscuit
2 - cake
3 - chocolate
''')
while (True):
user_input = input("Enter name of item : ")
if (user_input != "ok"):
quantity = int(input("Enter T... | true |
09e3a69ac9de22324e419576343e6a942f1307ea | Python | rikicop/PythonProjects | /df/searcher_df.py | UTF-8 | 1,748 | 2.875 | 3 | [] | no_license |
import pandas as pd
tipo_form = input("Ingresa Tipo: ")
ubicacion_form =input("Ingresa Ubicación: ")
edo_form =input("Ingresa nuevo/usado(n/u): ")
raw_data = {'cod': ['123', '321', '234', '432', '765','555'],
'tipo': ['casa', 'casa', 'casa', 'galpon', 'galpon','galpon'],
'ubi': ['barr... | true |
ab3c1ff6ca8bb1e58009fa6c37b863ca5dd4a881 | Python | njokdan/Tkinter-GUI-Examples | /Calculator.py | UTF-8 | 4,438 | 3.0625 | 3 | [] | no_license | from tkinter import *
from tkinter import ttk
class Calculator:
addButton = False
subButton = False
mulButton = False
divButton = False
entryValue = 0
def clear_button_press(self):
self.entry_val.set("")
if self.from_equals:
self.prev = 0.0
def e... | true |
62367dff896b11216ca372ec50f6a2e2a5d8c341 | Python | OlyaSlobodyanuk/home-task-2 | /t6.py | UTF-8 | 1,700 | 3.46875 | 3 | [] | no_license | import sys, math # добавление используемых модулей
try:
infilename = sys.argv [1] # читаем со второй позиции имя файла со входными данными
outfilename = sys.argv [2] # читаем с третьей позиции имя файла, куда будем записывать результирующие данные
except:
print("Usage:", sys.argv[0], "infile outfile") # если отс... | true |
3751409d3546bc6c36a008dcb9d4eadcfd1939f4 | Python | JunyoungChoi/baekjoon | /baekjoon_1850_python.py | UTF-8 | 110 | 3.09375 | 3 | [] | no_license | import sys
from math import gcd
A,B=map(int,sys.stdin.readline().rstrip().split())
print('1'*gcd(A,B),end='')
| true |
f1c8e929191314abad5df39ea1a7de6266a70fd8 | Python | Manavsharma96/Firstsite | /firstsite/views.py | UTF-8 | 1,366 | 2.96875 | 3 | [] | no_license | # I have created this site for learning
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
#return HttpResponse("HELLO, Welcome")
para={'name':'Manav','place':'Bengaluru'}
return render(request ,'index.html',para)
def analyze(request):
text=request.GET.get('te... | true |
a72e3b4d0d935e3853aea45456c3c5d9faec0548 | Python | dvon/locv | /example_02-06.py | UTF-8 | 345 | 2.6875 | 3 | [] | no_license | import cv2
import sys
if __name__ == '__main__':
cv2.namedWindow('Example 1', cv2.WINDOW_AUTOSIZE)
cv2.namedWindow('Example 2', cv2.WINDOW_AUTOSIZE)
img1 = cv2.imread(sys.argv[1]) # Book has img instead of img1.
cv2.imshow('Example 1', img1)
img2 = cv2.pyrDown(img1)
cv2.imshow('Example 2', i... | true |
14840c81b563d3929c1da0a9f6114c045755fbef | Python | Airbomb707/StructuredProgramming2A | /UNIT1/activity_03.py | UTF-8 | 573 | 3.921875 | 4 | [] | no_license | ##Start##
print ("Welcome to the payment service")
##Defining variables##
price_hour = 240
min_hour = 40
bon = 1.5
hours_worked = 0
final_salary = 0
##Now it goes the process##
hours_worked = int( input("Enter the hours you worked during the week \n"))
if (hours_worked <= min_hour):
final_salary = hours_worke... | true |
02c0c5b9f27204630469a34b9bffe00f5162f58b | Python | DeepTensors/EmotionsMoji | /FaceDetector.py | UTF-8 | 1,369 | 3.171875 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 10:18:17 2018
@author: anmol
"""
import cv2
faceCascade = cv2.CascadeClassifier('classifier/haarcascade_frontalface_default.xml')
# Function for finding faces
def find_faces(image):
# getting the face coordinates
face_coord = Locate_Fa... | true |
fa6bd112fd97d8e6652ad7d6a0e2d3dd3410d142 | Python | brandoneng000/LeetCode | /easy/1796.py | UTF-8 | 633 | 3.578125 | 4 | [] | no_license | class Solution:
def secondHighest(self, s: str) -> int:
largest = -1
second = -1
for char in set(s):
if char.isnumeric():
check = int(char)
if check > largest:
second = largest
largest = check
... | true |
c166d2e698a7798f1be2b15c60c672248f20fec9 | Python | qcwthu/CrossFit | /tasks/math_qa.py | UTF-8 | 1,598 | 2.765625 | 3 | [] | no_license | import os
import datasets
import numpy as np
from fewshot_gym_dataset import FewshotGymDataset, FewshotGymTextToTextDataset
class MathQA(FewshotGymTextToTextDataset):
def __init__(self):
self.hf_identifier = "math_qa"
self.task_type = "text to text"
self.license = "unknown"
def proc... | true |
95be694435e05b16b37bf244b1a2c643ef9827c3 | Python | forestdussault/geneSipprV2 | /fastqCreator.py | UTF-8 | 19,917 | 2.796875 | 3 | [
"MIT"
] | permissive | import errno
import os
import re
import shutil
import subprocess
import time
from glob import glob
from multiprocessing import Pool
__author__ = 'adamkoziol'
def make_path(inpath):
"""
from: http://stackoverflow.com/questions/273192/check-if-a-directory-exists-and-create-it-if-necessary \
does what is in... | true |
6666d8bb03f0d87e2f4f3fb8a49f9fce7f273b57 | Python | vmadalasa/EVAConsolidated | /EVA15/Code/extrautils.py | UTF-8 | 2,825 | 2.765625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import random
from sklearn.cluster import KMeans
import torch
class extrautils:
def __init__():
super().__init__()
def kmeans_wcss(X, seed_range, init, max_iter, n_init, random_state):
wcss = []
for i in range(1, seed_range... | true |
af006773292a16013cb2f95709f7aac8ac85b1f3 | Python | tomer824/Developers_Institute | /Assignments and Daily Challeneges/Week 4/Day 1/Ninja/ninja.py | UTF-8 | 1,913 | 4.09375 | 4 | [] | no_license | # 1.
# 3 <= 3 < 9 = True
# 3 == 3 == 3 = True
# bool(0) = False
# bool(5 == "5") = False
# bool(4 == 4) == bool("4" == "4") = True
# bool(bool(None)) = False
# x = (1 == True)
# y = (1 == False)
# a = True + 4
# b = False + 10
# print("x is", x)
# print("y is", y)
# print("a:", a)
# print("b:", b)
# 2.
# a = input... | true |
1bab715b0c564a7a2941200a68f23a04ab4bfd58 | Python | zeroistfilm/week04 | /영동/05_11049_행렬 곱셈 순서.py | UTF-8 | 562 | 2.71875 | 3 | [] | no_license | # https://www.acmicpc.net/problem/11049
import sys
#sys.stdin = open("input.txt", "r")
N = int(sys.stdin.readline())
M = [0 for i in range(N+1)]
for i in range(N):
a,b = map(int, sys.stdin.readline().split())
M[i]=a
M[i+1] = b
Matrix = [[0 for i in range(N)] for i in range(N)]
for i in range(1,N):
r... | true |
2710192bc8dcdf3a4a47c13ad5be93d25f5bdb22 | Python | ImSahilShaikh/Object-Detection-and-Tracking | /Face-Tracking/CamShift/camshift.py | UTF-8 | 1,549 | 2.671875 | 3 | [] | no_license | import cv2
import numpy as np
cap = cv2.VideoCapture('face_track.mp4')
ret,frame = cap.read()
face_casc = cv2.CascadeClassifier('Haarcascades/haarcascade_frontalface_default.xml')
face_rects = face_casc.detectMultiScale(frame)
face_x,face_y, w, h = tuple(face_rects[0])
track_window = (face_x, face_y, w, h... | true |
3e117f05a37e1395f92980cede7529568347c974 | Python | darkpicnic/dnd-5e-util | /dnd_util.py | UTF-8 | 3,823 | 3.265625 | 3 | [] | no_license | """
Example output
"""
import click
import random
import constants
import names
import os
import csv
active_location = None
def generate_stats(race, gender, level):
""" Get stats for character
"""
pass
def generate_npc(race, gender, level, show_stats):
global active_location
if race.lower() n... | true |
a81cfb847c548fa3b4c9100d76805713fc4f0d1d | Python | YAGER-Development/grafana-backup-tool | /src/save_alert_channels.py | UTF-8 | 1,953 | 2.640625 | 3 | [
"MIT"
] | permissive | import argparse
from datetime import datetime
from commons import *
from dashboardApi import *
parser = argparse.ArgumentParser()
parser.add_argument('path', help='folder path to save alert channels')
args = parser.parse_args()
folder_path = args.path
log_file = 'alert_channels_{0}.txt'.format(datetime.today().strft... | true |
58b0f64db8c1b7bee823007ed40160e151b298de | Python | ISANGDEV/Algorithm_Study | /3_DFS_BFS/NownS/DFS_BFS_1/2606.py | UTF-8 | 452 | 3.078125 | 3 | [] | no_license | n = int(input())
m = int(input())
graph = [[] for i in range(n+1)]
for i in range(m):
a, b = map(int, input().split())
graph[a].append(b)
graph[b].append(a)
visited = [False] * (n+1)
stack = []
num = -1
def dfs(graph, start, visited):
stack.append(start)
visited[start] = True
global num
... | true |
da5a3124a76bf92232b10fdd6a9ad0ca6c9c3d17 | Python | Onebigbera/automated_testing | /basic/xml_handler_demo.py | UTF-8 | 2,012 | 3.4375 | 3 | [] | no_license | # -*-coding:utf-8 -*-
# File :xml_handler_demo.py
# Author:George
# Date : 2019/10/9
# motto: Someone always give up while someone always try!
from xml.dom import minidom
def xml_handler(file):
"""
get element node
:param file:
:return:
"""
dom = minidom.parse(file)
root = d... | true |
1546b345d656d40a9cfd26153355423e1a213193 | Python | irfreemind/AI-Machine-Learning | /degi_adventure/successive_elimination.py | UTF-8 | 3,321 | 3.5625 | 4 | [] | no_license | #Cuong Nguyen - AI 605.445 Capstone
from operator import *
import copy
import itertools
def remove_column(game, col):
for row in game:
del row[col]
def remove_row(l, row):
l.pop(row)
def compare_lt(l1, l2):
return all(map(lt, l1, l2))
def compare_le(l1, l2):
return all(map(l... | true |
7a166ed824d750d92e76d960cbb3f76efee86715 | Python | mary-alegro/neuralsynthesis | /src/segmentation/svm.py | UTF-8 | 3,013 | 2.828125 | 3 | [] | no_license | import numpy as np
from sklearn.feature_extraction.image import extract_patches_2d
from sklearn.feature_extraction.image import reconstruct_from_patches_2d
import skimage.io as io
import matplotlib.pyplot as plt
from skimage.color import rgb2gray
from skimage.feature import greycomatrix, greycoprops
from skimage import... | true |
1eae71bb50b362a06f4e16de3402a371866cd7be | Python | sobalgi/DS222_Assignment1 | /part2_mapred/get_modelparams_red_n.py | UTF-8 | 4,468 | 2.6875 | 3 | [] | no_license |
# coding: utf-8
# unit test code
# cat unit_train.txt | python get_classwordcount_map.py | LANG=C sort | python get_classwordcount_red.py | LANG=C sort > out_get_classwordcount_red.txt
# cat out_get_classwordcount_map.txt | python get_classwordcount_red.py | LANG=C sort > out_get_classwordcount_red.txt
import sys
p... | true |
c0609462eb10d5ff1b7977890cfb89e92f82bb45 | Python | AndreaCano/machineLearning | /SpyderFiles/heaviside.py | UTF-8 | 352 | 2.75 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 24 14:37:50 2018
@author: Andrea
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn import datasets
# 0 if x < 0
#heaviside(x, h0) = h0 if x == 0
# 1 if x > 0
n... | true |
0e5d40eaf710d39b9aa55df4172a08ea7e84489d | Python | ach5948/Project-Euler | /p006.py | UTF-8 | 131 | 2.875 | 3 | [] | no_license | def main(n):
easy = int((n + 1) * n / 2)
easy = easy * easy
hard = sum(i * i for i in range(1, n + 1))
return easy - hard
| true |
833ab526f5f00760007856f1a2b653a9d5ba08d5 | Python | ShadowErm/cs102 | /homework06/hackernews.py | UTF-8 | 3,286 | 2.828125 | 3 | [] | no_license | from bottle import route, run, template, request, redirect
from scraputils import get_news
from db import News, session
from bayes import NaiveBayesClassifier
@route("/news")
def news_list():
s = session()
rows = s.query(News).filter(News.label == None).all()
return template('news_template', rows=rows)
... | true |
461b6184b190bcf945ebe70d7de314810687540e | Python | appCDI/app_cdi2 | /src/LecteurRecherchePoeme.py | UTF-8 | 1,034 | 2.625 | 3 | [] | no_license | '''
Created on 8 mars 2014
@author: xavier
'''
from PyQt4 import QtGui
class LecteurRecherchePoeme(QtGui.QWidget):
def __init__(self):
super(QtGui.QWidget,self).__init__()
self.setupUi()
self.playlistRecherche = []
def setupUi(self):
searchLine = QtGui.QLineE... | true |
4527ed5693ccb391d2b24d5e094a308bc60916af | Python | noyonict/Pythonist-DP05 | /Class-8/Loop.py | UTF-8 | 2,045 | 3.359375 | 3 | [] | no_license |
# help('range')
# for a in range(4):
# print(a**2)
# for a in range(0,40):
# print(a**2)
# for a in range(4,40,3):
# print(a**2)
# for a in range(4,40,3):
# print(a+2)
# even number
# for i in range(2,51,2):
# print(i)
# for a in range(0,20):
# if a%2==0:
# print(a)
# cod... | true |
68cdee4aef2b2c932a0b8aff336c4a3dd758fc49 | Python | msaad1311/Python-OOPs | /Practice-2.py | UTF-8 | 4,636 | 3.578125 | 4 | [] | no_license | class bankAccount():
def __init__(self,name,balance):
self.name = name
self.balance = balance
def display(self):
print(f'The name is {self.name}')
print(f'The balance is {self.balance}')
def withdraw(self,amount):
self.balance-=amount
def deposit(self,amount):
... | true |
9931828b75ae9bde24448dd5017eefd82e2e5ca3 | Python | Ayub-Khan/random_opencv_work | /Steganography/EnCoder.py | UTF-8 | 466 | 2.953125 | 3 | [] | no_license | import cv2
import numpy
import sys
mat = cv2.imread('1.jpg')
h, w, l = mat.shape
closer = False
if mat[7,7,1] == 7 and mat[8,8,2] == 8 and mat[6,6,3] == 6:
print 'Already have some Encoded Message. . . !'
print 'Want to Overwrite or not'
x = bool(raw_input())
if(x==False):
... | true |
3e627f69e9d46218605b50de1b755b02a59c0aaf | Python | xi-studio/anime | /src/convert_midi.py | UTF-8 | 2,257 | 2.5625 | 3 | [
"MIT"
] | permissive | import pretty_midi
import numpy as np
import cPickle
import gzip
import glob
import matplotlib.pyplot as plt
from scipy.misc import imsave
fs = 10.0
note = (21,109)
def midi2pianoroll(dataset):
files = glob.glob(dataset)
num = 0
l = []
for f in files:
filename = f.replace('.mid','.png')
... | true |
3ab6492c5acaf747140bba4e00236f6c7fb982b7 | Python | ruinanzhang/Leetcode_Solution | /Roblox OA.py | UTF-8 | 1,472 | 3.265625 | 3 | [] | no_license | # 1. Efficient Jar
list = [1.01,1.99,2.5,1.5,1.01]
list.sort()
print(list)
left = 0
right = len(list)-1
count = 0
while left <= right :
if left == right:
count +=1
break
if list[left] + list[right] <= 3:
count +=1
left +=1
right -=1
elif list[left] + list[right] > 3:... | true |
88b0639c66f6d4e80761ebae7c496440a04f6c49 | Python | AntoineFonck/Python_Hacking | /other_scripts/mac_changer.py | UTF-8 | 2,056 | 3.15625 | 3 | [] | no_license | #!/usr/bin/env python
from subprocess import call, check_output, CalledProcessError
from platform import system
from optparse import OptionParser
import re
def get_options():
"""Get options from the args parser"""
parser = OptionParser()
parser.add_option(
"-i",
"--interface",
des... | true |
f51f35bd39940e2a5c545cc28d7e0d56bde2fafd | Python | AG-Systems/programming-problems | /Leetcode/N-ary-Tree-Postorder-Traversal.py | UTF-8 | 926 | 3.4375 | 3 | [] | no_license | """
# Definition for a Node.
class Node(object):
def __init__(self, val, children):
self.val = val
self.children = children
"""
class Solution(object):
def postorder(self, root):
"""
:type root: Node
:rtype: List[int]
"""
container = []
def dfs(roo... | true |
e61a39f5ba512865a769b5eeb0e7d84b658e0096 | Python | Pasinozavr/5th-year-le-man | /Calcul Numeric/TD3/TD3.py | UTF-8 | 1,992 | 2.578125 | 3 | [] | no_license | import numpy.random as rnd
import matplotlib.pyplot as plt
import numpy as np
from scipy.io import wavfile
import math
import random
import wave
def pre():
L=[]
N=100
for i in range(N):
L.append(rnd.random()*10)
#print(L)
y_uni=rnd.uniform(0,10,N)
y_norm=rnd.normal(0,10,N)
... | true |
68ad97d2dac225dcdc2a6211452ffacefb4fb760 | Python | winstonyeu/Present-Engagement-Project | /RetrieveUser.py | UTF-8 | 4,086 | 2.765625 | 3 | [] | no_license | import requests, csv, os.path
from collections import OrderedDict
class RetrieveUser:
def __init__(self):
self.filename = 'users.csv'
self.userList = []
self.initialize()
def initialize(self):
if self.userCount() == 0:
fieldnames = ['firstname', 'lastname', 'id'... | true |
ac72e040d83a71b4b94b41f83dbca3e0aae4a076 | Python | Matts966/IoT | /led_loop.py | UTF-8 | 341 | 2.75 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
input_c = 7
output_c = 5
mode = 0
GPIO.setmode(GPIO.BOARD)
GPIO.setup(output_c, GPIO.OUT)
try:
while True:
if mode:
GPIO.output(output_c, GPIO.HIGH)
mode = 0
else:
GPIO.output(output_c, GPIO.LOW)
mode = 1
time.sleep(0.1)
except KeyboardInterru... | true |
1456aec55f6410d7c947acd6bf844b0ce9b0fa4d | Python | awmanoj/machinelearning | /mlp.py | UTF-8 | 1,501 | 2.625 | 3 | [] | no_license | from numpy import *
import math
def sigmoid(z):
return 1.0 / (1 + exp(-z))
def mlpfwd(inputs, weights):
activations = dot(inputs, weights)
activations = sigmoid(activations)
return activations, weights
def train(inputs, targets, n_hidden, n_output, eta, iteration):
change = range(shape(inputs)[0])
inputs = co... | true |
4787e1bbedd60971d0a69b6584cb083741605cc5 | Python | wh-orange/CodeRecord | /00Python代码/01Malware_Domain2ip2locality_升级版/Domain2ip2locality.py | UTF-8 | 2,693 | 3.125 | 3 | [] | no_license | #-*-coding:utf-8-*-
import sys
import os
import requests
from bs4 import BeautifulSoup
import tablib
import socket
import re
# Domain2ip2locality.py v3.0
# 作者:zzzhhh
# 2017-9-30
# 提取站长之家IP批量查询的结果加强版本-写入到XLS中
# 增加域名解析IP、IP解析地区的部分
## 默认存放路径D:\\0utCode_ip_domain\\ip.xls
path = "D:\\" # 存放路径
filename = "ip" ... | true |
5886d994e30f3fc7cfcf5a140304d3c9961478c4 | Python | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_155/2230.py | UTF-8 | 656 | 3.109375 | 3 | [] | no_license | import sys
def file_loop():
f = open(sys.argv[1])
r = open(sys.argv[2], 'w')
cnt = 0
f.readline()
for l in f:
cnt += 1
infos = l.strip().split(' ')
result = main(infos[1])
r.write('Case #%d: %d\n' % (cnt, result))
f.close()
r.close()
def main(shys):... | true |
28a87a5fab0714d973c229e5526abca4a5cb8b55 | Python | daniel-reich/ubiquitous-fiesta | /kD2CfnakBqfNpBHnX_10.py | UTF-8 | 320 | 3.15625 | 3 | [] | no_license |
import numpy as np
def islands_perimeter(grid):
edges = 0
for k in range(0,2):
grid = np.rot90(np.array(grid)).tolist()
edges += grid[0].count(1) + grid[-1].count(1)
for a,b in zip(grid[:-1],grid[1::]):
for j in range(0,len(grid[0])):
if a[j] != b[j]:
edges += 1
return edges
| true |
601688a5d3e0ffc197f88eafd300a67b7f98ed49 | Python | dmtrbrlkv/homeworks | /cw_5_1.py | UTF-8 | 742 | 3.484375 | 3 | [] | no_license | class Basket():
def __init__(self, max_size):
self.max_size = max_size
self.content = []
def add(self, obj):
if len(self.content) < self.max_size:
self.content.append(obj)
else:
self.max_size_warrning()
def max_size_warrning(self):
print("Кор... | true |
f72761b0e209f17d81a71b0bef26f727f881991b | Python | GRSEB9S/SVDD-Anomaly-Detection-of-Stage-Stage-Outlier-Analysis | /demo/ClusterSvdd-master/scripts/test_exm.py | UTF-8 | 5,457 | 2.578125 | 3 | [
"MIT"
] | permissive | import matplotlib.pyplot as plt
import numpy as np
import sklearn.datasets as datasets
from ClusterSVDD.svdd_primal_sgd import SvddPrimalSGD
from ClusterSVDD.svdd_dual_qp import SvddDualQP
from ClusterSVDD.cluster_svdd import ClusterSvdd
def generate_gaussians(datapoints, cluster, noise_frac=0.1, dims=2):
mean_... | true |
6eb33a2b184fcef3d2a664e02a63cc517d692afb | Python | ksanchezcld/tjctf_datadump | /vinegar_COMPLETE/get_flag.py | UTF-8 | 1,762 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
import itertools
import string
import collections
from hashlib import sha256
lowercase = collections.deque( string.ascii_lowercase + string.digits )
# message = 'uucbx{simbjyaqyvzbzfdatshktkbde}'
# key = 'Kkkkk kkkkKkkkkkkkkKkkkkkkkkKkk'
# I removed the curly braces and spaces in this case
m... | true |
e0fdb15739e4069b1d61feb13c1de11a31e1f38d | Python | gkevinb/MasterThesis | /scraps/plotting_grid.py | UTF-8 | 403 | 2.890625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import math
from scipy.stats import expon, norm, weibull_min, lognorm
import numpy as np
import seaborn as sns
linspace = np.linspace(0, 10, 100)
x = 2 * linspace
fig, subplots = plt.subplots(2, 2, figsize=(7, 7))
subplots[0][0].plot(linspace, x)
subplots[0][1].plot(linspace, 2 * x)
s... | true |
7a4e04970c9aa9f3785e0c4f59571f97c4182417 | Python | Hpshboss/control_robotic_arm_gui_python | /main.py | UTF-8 | 2,588 | 2.5625 | 3 | [
"MIT"
] | permissive | import serial
import sys
import os
from PyQt5.QtWidgets import QMainWindow
import GUI
from PyQt5.QtWidgets import QApplication
class Main(QMainWindow, GUI.Ui_MainWindow):
def __init__(self):
super(self.__class__, self).__init__()
self.setupUi(self)
self.pushButton.clicked.connect(self.impo... | true |
381b8b15b99d756e6ef8151f1b21e05ed23910cd | Python | limh909/XRF_Alignment | /convolution_tool.py | UTF-8 | 999 | 3.453125 | 3 | [] | no_license | """
basic one-D or two-D convolution function
"""
import numpy as np
def conv1D_gauss(inputdata, stdv):
"""
1D convolution with gaussian function.
"""
inputdata = np.array(inputdata)
lenv = len(inputdata)
# xrange is from (-1,1)
xv = np.linspace(-1.0, 1.0, lenv)
gfun = 1./np.sqrt(... | true |