blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
a48eeed53d7025c694f075e7a9fec206de58c792 | Python | jdf/processing.py | /mode/examples/Basics/Transform/Rotate/Rotate.pyde | UTF-8 | 797 | 3.9375 | 4 | [
"Apache-2.0"
] | permissive | """
Rotate.
Rotating a square around the Z axis. To get the results
you expect, send the rotate function angle parameters that are
values between 0 and PI*2 (TWO_PI which is roughly 6.28). If you prefer to
think about angles as degrees (0-360), you can use the radians()
method to convert your values. For example: s... | true |
e10d6cde11dbf05ba699566e7372f9b0ea6d144f | Python | berinhard/sketches | /s_028/s_028.pyde | UTF-8 | 1,076 | 3.515625 | 4 | [] | no_license | # Author: Berin
# Sketches repo: https://github.com/berinhard/sketches
import time
from datetime import datetime
from random import choice, shuffle
def equation_1(teta, x_offset=0, y_offset=0):
r = 1 - (cos(teta) * sin(teta))
x = r * cos(teta) * 150
y = r * sin(teta) * 90
return x + x_offset, y + y_of... | true |
b44448709e843c1c5b82aa19f4472b22a0d40ae0 | Python | SabaDD/Model-Interpretation | /Prediction.py | UTF-8 | 1,178 | 2.578125 | 3 | [] | no_license | import numpy as np
from sklearn.metrics import roc_curve, auc
from image_preprocessing import change_data
def model_prediction(custom_resnet_model, X_test, y_test, left,right,upper,lower):
roc_auc_cv = []
new_list = change_data(X_test,LEFT = left,RIGHT = right,UPPER = upper,LOWER = lower)
new_list =... | true |
d09a2b002d574074d72ba3254d5515df4b5ccbaa | Python | loovien/jokercrawl | /jokers/spiders/test.py | UTF-8 | 2,174 | 3.171875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import MySQLdb
import datetime
import time
import random
from MySQLdb.cursors import DictCursor
def str_test():
string = list("我是一个中国人")
print(string[0:4])
print("".join(string))
def time_parse():
now = datetime.datetime.now()
str_time = now.strftime("%m-%d %H:%M")
p... | true |
e5db5b8ba51628cb4eae9e8013c5e25cd669c010 | Python | namonai/UebungSS19 | /Session5/session5_uebung_loesung.py | UTF-8 | 3,946 | 3.71875 | 4 | [] | no_license | #!/usr/bin/python3
import matplotlib.pyplot as plt
from numpy.random import rand
import pandas
#------------------scipy-------------------
# https://www.scipy.org/
# SciPy (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering.
#----------------... | true |
ad5fc7b18f1795a71546e4909c238cfc55a8e7a8 | Python | uwubackup/Cloud-Nine | /cogs/mod.py | UTF-8 | 5,270 | 2.53125 | 3 | [
"MIT"
] | permissive | import json
import dotenv
import discord
import io
import asyncio
from discord.ext import commands
from dotenv import load_dotenv
import aiohttp
from io import BytesIO
class Mod(commands.Cog):
def __init__(self, commands):
self.commands = commands
@commands.command()
@commands.has_p... | true |
510bd6038e2c8f27e92994e801b09dc89ac9913d | Python | yiyang186/autostatest | /utils.py | UTF-8 | 2,174 | 2.921875 | 3 | [
"MIT"
] | permissive | import numpy as np
from scipy.stats import t
from scipy.stats import norm
def compare0(_p, alpha):
print("p = {0}, alpha = {1}".format(_p, alpha))
if _p >= alpha:
print("p >= {0}".format(alpha))
print("差异无统计学意义")
else:
if _p > alpha * 0.4:
print("{0} < p < {1... | true |
4d95d920337062c170398fed2c89fbe177e8377c | Python | MaherBhasvar/Hackout3 | /backend Server/fetch.py | UTF-8 | 4,728 | 2.609375 | 3 | [] | no_license | from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from time import sleep
import numpy as np
import re
def lat_lon(city):
try:
driver = webdriver.Chrome(ChromeDriverManager().install())
driver.get('https://www.google.com/maps')
driver.find_element_by_xp... | true |
2fe3f770fb091e92723dac74a9a83aafc83c7a1f | Python | venky5522/venky | /oops_concept/polymorphism/method_overload.py | UTF-8 | 146 | 3.296875 | 3 | [] | no_license | class a:
def hello(self,*args):
print("hello")
obj = a()
obj.hello()
obj.hello(10)
obj.hello(10,20,30)
obj.hello(10,20,30,40)
| true |
96c603af0051ec6b2e1341824037dbb9dce2190d | Python | andy-keene/AI | /alpha-beta/minimax.py | UTF-8 | 862 | 3.25 | 3 | [] | no_license | from node import Node
pos_inf = float('inf')
neg_inf = float('-inf')
def alpha_beta_search(node):
v = max_value(node, neg_inf, pos_inf)
node._value = v
return v, node
def max_value(node, alpha, beta):
#print('in max player: ', node._player, ' state ', node._state)
if node.is_terminal():
return node.utility_... | true |
789e028464443997e9881fcba5e74d66193d88ce | Python | d-chambers/spype | /spype/utils.py | UTF-8 | 10,013 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | """
A number of utilities for sflow
"""
import copy
import inspect
import os
import time
import types
from collections import Sequence, OrderedDict
from inspect import signature, Signature
from typing import Optional, Callable, Tuple, Set, Mapping
from spype.constants import adapt_type, args_kwargs_type
from spype.exc... | true |
67ab18d2844c9bf312c82362758b7e7f85b210cc | Python | brianwachira/Tesserect | /run.py | UTF-8 | 3,784 | 3.796875 | 4 | [
"MIT"
] | permissive | #!/usr/bin/env python3.6
from password_locker import Password_Locker
def initialize_password_locker(username,password):
'''
Function to initialize password locker
'''
new_password_locker = Password_Locker(username,password)
return new_password_locker
def create_account(password_locker):
'''
... | true |
f5cba8070b9d9055ddcc15f293d90b98a68341d8 | Python | Miralan/Meta-TTS | /lightning/callbacks/utils.py | UTF-8 | 6,216 | 2.5625 | 3 | [] | no_license | import os
import json
import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot as plt
from scipy.io import wavfile
from utils.tools import expand, plot_mel
def synth_one_sample_with_target(targets, predictions, vocoder, preprocess_config):
"""Synthesize the first sample of the batch given target pit... | true |
57cc39ab8e409511fac6308fc85ecdc9b83b761e | Python | uchicago-bio/final-project-bdallen-uchicago | /allvall_rmsd.py | UTF-8 | 3,300 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python
"""
Compute pairwise RMSD of all pdbs listed in the input file, restricting
the calculation to the atoms provided in the second argument, which must
be present in all pdbs. Designed to be used in conjunction with
the "ALL" atom list from calc_presenting_surface.py.
Usage:
find /path/to/project-... | true |
804509a8e733c1185004800f9cd049da21aa05e3 | Python | bfkg/jupyterhub-options-spawner | /tests/tests_checkbox_input_field.py | UTF-8 | 3,696 | 2.65625 | 3 | [
"BSD-3-Clause"
] | permissive | # Copyright (c) 2018, Zebula Sampedro, CU Research Computing
import unittest
from traitlets import (
Unicode,
Bool,
)
from optionsspawner.forms import CheckboxInputField
class CheckboxInputFieldTestCase(unittest.TestCase):
"""Tests for optionsspawner.forms.checkboxfield.CheckboxInputField."""
def t... | true |
d0580f90e72ea073b797da05e90da4b5728ea35f | Python | 2100030721/Hackerrank-Artificial-Intelligence | /Statistics-and-Machine-Learning/multiple-linear-regression-predicting-house-prices.py | UTF-8 | 1,995 | 3.75 | 4 | [] | no_license | # Charlie wants to buy a house. He does a detailed survey of the area where
# he wants to live, in which he quantifies, normalizes, and maps the desirable
# features of houses to values on a scale of 0 to 1 so the data can be assembled
# into a table. If Charlie noted F features, each row contains F space-separated ... | true |
871fefcfd603a7abbeb77656c89f6046ef390d0c | Python | vicchu/Unsupervised-Learning-PCA-K-Means | /K-Means-PartII.py | UTF-8 | 846 | 3.40625 | 3 | [] | no_license | ###Exemplifies K-Means with classes generated from normal distributions
#Import modules
import aux_funcs
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
#Initializes the seed for the random numbers
np.random.seed(42)
#Sets parameters
nPoints=800 #sets total number of points
nCl... | true |
e2079334f78864ec2c5375c5402968976b75dfe3 | Python | masenov/code-exercises | /cracking-the-coding-interview/data_structures/arrays/4.py | UTF-8 | 616 | 3.78125 | 4 | [] | no_license | def replaceCharacter(s,pos,char):
return s[0:pos]+char+s[pos+1:]
def replaceSpaces(s,true_length):
actual_length = len(s)-1
for i in range(true_length-1, -1, -1):
if (s[i]==' '):
s=replaceCharacter(s,actual_length,'0')
s=replaceCharacter(s,actual_length-1,'2')
s=... | true |
13d3ed722112a315e7321eb808712df9e599de29 | Python | xiaoyuhen/An-Introduction-to-Interactive-Programming-in-Python | /week4/exercises/prime_list.py | UTF-8 | 279 | 3.046875 | 3 | [] | no_license | # Prime number lists
###################################################
# Student should enter code below
print_lists = [2, 3, 5, 7, 11, 13]
print print_lists[1], print_lists[3], print_lists[5]
###################################################
# Expected output
#3 7 13
| true |
8cb55843f17bc26c8e894b377d64c24682021d02 | Python | alexandrabrt/calculator_grupa2 | /to_do.py | UTF-8 | 847 | 3.109375 | 3 | [] | no_license | import datetime
class Todolist:
def __init__(self):
self.task = input('Introduceti task-ul: ')
self.list_task = []
self.choice = 'D'
self.data = input('Introduceti data dupa urmatorul format zz.ll.aaaa ')
try:
datetime.datetime.strptime(self.data, '%D.%M.%Y')
... | true |
3719bae1117fbf69bc94ca0464c9c8a05bcac6e1 | Python | Litterman/EZClimate | /ezclimate/damage.py | UTF-8 | 15,898 | 2.796875 | 3 | [
"MIT"
] | permissive | import numpy as np
from abc import ABCMeta, abstractmethod
from ezclimate.damage_simulation import DamageSimulation
from ezclimate.forcing import Forcing
class Damage(object, metaclass=ABCMeta):
"""Abstract damage class for the EZ-Climate model.
Parameters
----------
tree : `TreeModel` object
provides the tree ... | true |
3fc148923dadc232841ce60b47405535a73dcbd2 | Python | bgoonz/UsefulResourceRepo2.0 | /MY_REPOS/Lambda-Resource-Static-Assets/1-projects/lambda/LambdaSQL/LambdaSQL-master/module1/buddymove_holidayiq.py | UTF-8 | 955 | 3.453125 | 3 | [
"MIT"
] | permissive | """
Unit 3 Sprint 2 SQL Module 1
Part 2 Creating a Database
"""
import sqlite3 as sql
import pandas as pd
connection = sql.connect("buddymove_holidayiq.sqlite3")
curs = connection.cursor()
buddy = pd.read_csv(
"https://github.com/BrokenShell/DS-Unit-3-Sprint-2-SQL-and-Databases/raw/master/module1-introduction-to... | true |
0e146ff1087daf9712c60d45b4d823cd7fb5311d | Python | drazenzen/pybreak | /pybreak.py | UTF-8 | 15,420 | 2.765625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import random
import argparse
try:
from tkinter import * # noqa py3
from tkinter import ttk
from tkinter import filedialog
from tkinter import messagebox
except ImportError:
try:
from Tkinter import * # noqa py2
... | true |
68c9fff6349e988beb4486e5303227d9bdda537e | Python | JonhFiv5/aulas_python | /aula_32_1_teste.py | UTF-8 | 86 | 3.234375 | 3 | [] | no_license | def myfunc(n):
return lambda a: a * n
mydoubler = myfunc(2)
print(mydoubler(5))
| true |
43baae96e493cdea8119717468fb39c4e300dd8a | Python | xvanov/brilliant | /daily/stand_slide_fall.py | UTF-8 | 1,210 | 3.09375 | 3 | [] | no_license | class problemMetaInfo():
def __init__(self):
self.url = 'https://brilliant.org/daily-problems/table-cloth-pull/'
self.area = 'Science and Engineering'
self.featured_course = 'Classic Mechanics'
self.title = 'Stand, Slide, or Fall'
self.difficulty = 3 # from 1 to 5
sel... | true |
6703371d0d21ac3dbed9b9decf0f38eeb8e0b64c | Python | wmytch/IntroToAlgorithms | /tools/tools.py | UTF-8 | 1,502 | 3.140625 | 3 | [] | no_license | import time
import random
class AlgorithmTools:
def __init__(self):
self.totalTime=0
def getSortedList(self,rangeStart,rangeEnd,step=1):
return [x for x in range(rangeStart,rangeEnd,step)]
def getUnSoredList(self,rangeStart,rangeEnd,length,step=1):
return random.sample(range(ran... | true |
0494c78b9869a400c158b266641993505b1c4c35 | Python | DianaTs1/SC106A-Assignments | /Python-SC106A-Assignment3-main/forestfire.py | UTF-8 | 681 | 3.109375 | 3 | [] | no_license | from simpleimage import SimpleImage
INTENSITY_THRESHOLD = 1.05
def highlight_fires(filename):
image = SimpleImage(filename)
for pixel in image:
average = (pixel.red + pixel.blue + pixel.green) // 3
if pixel.red >= average * INTENSITY_THRESHOLD:
pixel.red = 255
pixel.gr... | true |
60729eda7c7ef67d0b4ae21c60c093a929f225b7 | Python | PGScatalog/PGS_Catalog | /release/scripts/run_copy_scoring_files.py | UTF-8 | 3,187 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | import os
import shutil
import argparse
from release.scripts.CopyScoringFiles import CopyScoringFiles
from release.scripts.CopyHarmonizedScoringFilesPOS import CopyHarmonizedScoringFilesPOS
def copy_scoring_files(new_ftp_dir,staged_scores_dir,scores_dir,md5_sql_filepath):
print("\n#### Copy the new formatted scor... | true |
836e0e11372f05720f3f980e083b481fea8e2dc0 | Python | kylebejel/blood-analysis | /blood-analysis.py | UTF-8 | 1,519 | 3.3125 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
import warnings
warnings.filterwarnings('ignore')
#import necessary data as panda dataframe
train = pd.read_csv('blood-train.csv')
test = pd.rea... | true |
bc5111aaeb90e09e833563e93a2c4d90a9c4bfce | Python | prakritidev/bitcoincharts | /chart.py | UTF-8 | 797 | 2.71875 | 3 | [] | no_license | import socket
import sqlite3
import json
db = sqlite3.connect("chart.sqlite")
cur = db.cursor()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("bitcoincharts.com", 27007))
try:
started = False
data = []
while True:
d = s.recv(1)
if d == "{":
started = True
... | true |
5956674e6c0958c4a45141b225868fdd8661624c | Python | vinnihoke/ca-sprint | /cpu.py | UTF-8 | 9,557 | 3.609375 | 4 | [] | no_license | """CPU functionality."""
import sys
class CPU:
"""Main CPU class."""
'''
TERMINOLOGY
* `SP`: Stack pointer. Address 244 if stack is empty
* `PC`: Program Counter, address of the currently executing instruction
* `IR`: Instruction Register, contains a copy of the currently executing instructio... | true |
9ed4f8b81b8d744d34e3ae5536e6946c95b5f876 | Python | t12343/Quoridor | /quoridor/data.py | UTF-8 | 1,772 | 3.203125 | 3 | [] | no_license | WIDTH, HEIGHT = 800, 850 # The dimensions of the window
ROWS, COLS = 9, 9 # The amount of rows and columns on the board
GAP = (WIDTH / 9) / ROWS - 1 # THE distance between two adjacent squares
SQUARE_SIZE = (WIDTH - GAP * 8) / ROWS # The size of a square
SQUARE_DISTANCE = SQUARE_SIZE + GAP # The distance betwe... | true |
77f1a4c00306cc597072919a254dd9cb32107f5d | Python | JackW987/opencv_practice | /L18.py | UTF-8 | 1,537 | 2.8125 | 3 | [] | no_license | import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
# img = cv.imread('img-1.jpg')
# hist = cv.calcHist([img],[0],None,[256],[0,256])
# hist_numpy,bins = np.histogram(img.ravel(),256,[0,256])
# plt.subplot(121),plt.imshow(img),plt.title('original')
# plt.subplot(122),plt.hist(img.ravel(),256,[0,256... | true |
3b68ce024b8e91ed0cfa5eec448074c1b0bb5730 | Python | Zahirgeek/learning_python | /OOP/6.2.5-4.py | UTF-8 | 807 | 3.96875 | 4 | [] | no_license | #继承中的构造函数4
class Animal():
pass
class PaxingAni(Animal):
def __init__(self,name):
print("Paxing Dongwu {0}".format(name))
class Dog(PaxingAni):
#__init__就是构造函数
#每次实例化的时候,第一个被自动调用
#因为主要工作是进行初始化,所以得名
def __init__(self):
print("I am init in dog")
#Cat没有写构造函数
class Cat(PaxingAni):
... | true |
36ab27079745c0446a43ae02740f7145bdfd206e | Python | Dylandelon/mytest | /HeapSort.py | UTF-8 | 600 | 3.4375 | 3 | [] | no_license | #!/usr/bin/python3
def sift(list,left,right):
i = left
j = 2*i + 1
temp = list[left]
while j <= right:
if j+1 <= right and list[j] < list[j+1]:
j = j+1
if temp < list[j]:
list[i] = list[j]
else:
break
i = j
j = 2*i + 1
li... | true |
e9f8cdb6f1b77e9a5d6a1f240a2971c2c2cde999 | Python | rfindra/fundamental-python | /fundamental1-konstruksi-dasar.py | UTF-8 | 649 | 4.03125 | 4 | [] | no_license | # Konstruksi Dasar Python
# Sequential: Eksekusi code secara berurutan
print("Hello World")
print("by Indra Rizky Firmansyah")
print("12 July 2021")
print("-" * 25)
# Percabangan : Eksekusi Terpilih
ingin_cepat = True # ingin_cepat adalah variabel bernilai "True"
if ingin_cepat:
print("Jalan Lurus") # Jika Nila... | true |
dbb43d72998fc7d2bca9826f5cd2d82f4d5700e2 | Python | Toufique-Sk/IOT-geolocaton-HomeAutomation | /publishmqttpython.py | UTF-8 | 2,177 | 2.71875 | 3 | [] | no_license | import paho.mqtt.client as mqttClient
import time
import requests
import json
from geopy.distance import vincenty
'''def geolocation():
g=geocoder.ip('me')
lat,lon=g.latlng
lat2,lon2= radians(20.985),radians( 80.3697)
R= 6373.0
lat1=radians(lat)
lon1=radians(lon)
dlon=lon2-lon1
dlat=lat2-lat1
... | true |
c76eb0f1bd95c88b518a116374e24ee64badc6ce | Python | sbairishal/CodePath-Alumni-Professional-Interview-Prep-Course | /interviewbit-trees-min-depth-of-binary-tree.py | UTF-8 | 694 | 3.25 | 3 | [] | no_license | # Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import deque
class Solution:
# @param A : root node of tree
# @return an integer
def minDepth(self, A):
if not (A):
... | true |
a2db6bd5e35d7891e9bfd0599dd9b56f4fa4d1fc | Python | se7ven012/TrafficFlowPrediction | /train.py | UTF-8 | 3,621 | 2.71875 | 3 | [] | no_license | #%%
import numpy as np
import pandas as pd
from data.data import process_data
from sklearn.preprocessing import MinMaxScaler
from keras.layers import Dense, Dropout, Activation
from keras.layers.recurrent import LSTM, GRU, SimpleRNN
from keras.models import Sequential
from keras.utils.vis_utils import plot_model
from k... | true |
9a5a2686f43faca9ff76fca7c95c15e855225c46 | Python | ymirthor/T-201-GSKI | /WeeklyGlossary/Vika 5/Recursive programming.py | UTF-8 | 859 | 3.5625 | 4 | [] | no_license | def length_of_string(string):
if len(string) == 0:
return 1
return len(string)
length_of_string(string[1:])
print(length_of_string("Hello world"))
def linear_search(lis, value):
if lis == []:
return False
if lis[0] == value:
return True
return linear_search(lis[1... | true |
ed7003d6cd4fc1a17c1807c74f72b3cd2512001a | Python | clovery410/mycode | /leetcode/337house_robber3.py | UTF-8 | 945 | 2.875 | 3 | [] | no_license | class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def rob(self, root):
def dfs(root, status):
if root is None:
return 0
elif (root, status) in cache:
retu... | true |
915df0fed33a28d668ae40d4ec8d76fab398589d | Python | AtTheMatinee/Roguelike-Core | /gameLoop.py | UTF-8 | 8,340 | 2.578125 | 3 | [
"MIT"
] | permissive | '''
game.py
'''
import libtcodpy as libtcod
import worldMap
from config import *
import objects
import objectClass
from actors import Actor
#import actorStats
import textwrap
import factions
import actorSpawner
import itemSpawner
import spellSpawner
import commands
import statusEffects
import shelve
imp... | true |
e61e89969c943d754a9c71bd47db2bcb2cd3f1dc | Python | pseudobabble/python-tdd | /test_fizzbuzz.py | UTF-8 | 611 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python
import pytest
def multipleOf(multiple, factor):
return (multiple % factor) == 0
def fizzbuzz(multiple):
if (multipleOf(multiple, 3) and (multipleOf(multiple, 5))):
return 'FizzBuzz'
if multipleOf(multiple, 3):
return 'Buzz'
if multipleOf(multiple, 5):
ret... | true |
8837a921df1171ff3f00cbc1b2723747f57a6eab | Python | nvseenu/tech-practices | /bookapi/books/book.py | UTF-8 | 6,366 | 2.734375 | 3 | [] | no_license | from abc import ABC, abstractmethod
import psycopg2
import json
import logging
from datetime import datetime
logger = logging.getLogger(__name__)
class BookRepo:
def __init__(self, cpool):
self._cpool = cpool
def get_books(self, **filters):
conn = None
try:
query = self.... | true |
b7f64c02ac0db70cb94809a49a453d90627e905a | Python | jacquelineawatts/d3_tester | /states.py | UTF-8 | 529 | 3.109375 | 3 | [] | no_license | import pickle
import requests
def pickle_state_names(data):
"""Make call to API to find state names from ID, pickles object."""
file_object = open('state_names', 'w')
state_names = {}
for state_details in data:
state_id = state_details['geo']
geo_url = 'http://api.datausa.io/attrs/ge... | true |
4fcd081cd3d0f4b7d243be311c02e842a33e848c | Python | jixinfeng/leetcode-soln | /python/147_insersion_sort_list.py | UTF-8 | 888 | 3.78125 | 4 | [
"MIT"
] | permissive | """
Sort a linked list using insertion sort.
"""
# Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def insertionSortList(self, head):
"""
:type head: ListNode
:rtype: ListNode... | true |
8321166512950c316ada5f17dee2bc9a7002b518 | Python | Abdullah-khan399/Docker | /p_dkr_images.py | UTF-8 | 3,006 | 2.609375 | 3 | [] | no_license | def images():
import os
import p_docker_menu
x = 0
while x != 9 :
os.system("clear")
os.system("tput setaf 1")
os.system("tput bold")
print('''
\t###### ######## ######## ## ## ######## ########
\t## ### ## ## ## ## ## ## ## ##
\t## ... | true |
5f2bb93905fcde76a2dfa7abcdf8e8bef451057b | Python | Aasthaengg/IBMdataset | /Python_codes/p03102/s487218100.py | UTF-8 | 309 | 2.578125 | 3 | [] | no_license | import sys
sys.setrecursionlimit(10**6)
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
readline = sys.stdin.readline
A = [[int(i) for i in readline().split()] for _ in range(n)]
ans = 0
for a in A:
if sum([i*j for i,j in zip(a,b)]) + c > 0:
ans += 1
print(ans) | true |
4b1806d8fb1e1bf6255929fd8570da53832092e5 | Python | nortikin/nikitron_tools | /pythonism/деньнедели.py | UTF-8 | 940 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Городецкий
# Licensed GPL 3.0
# http://nikitron.cc.ua/
# Python 3
import sys
import calendar
if __name__ == "__main__":
if len(sys.argv) != 5:
print ('''да, нужно ввести год начала, год конца, месяц и день
например: $python3.5 де... | true |
3306a9ff08d0dce49977b1c4da8e6f467b8bb3f1 | Python | SaNDy4ortyFivE/python_mini_project_2k19 | /main.py | UTF-8 | 2,367 | 2.625 | 3 | [] | no_license | #importing all written scripts
import nmap,scapy
import nmapScanner, scapy_main_file, banner, os
def main():
os.system('clear')
banner.banner_print()
#defining colors
G = '\033[92m'
Y = '\033[93m'
B = '\033[94m'
R = '\033[91m'
W = '\033[0m'
choice = int(input())
if choice =... | true |
435fbef678cba55f226ebc3960273153ece38a78 | Python | jren10/Simple-Spacetime-Crawler | /QuerySearch.py | UTF-8 | 1,970 | 2.984375 | 3 | [] | no_license | import json
import operator
from collections import Counter
def search():
count_docs = 0
count_tokens = 0
results = []
doc_list = []
ranker = {}
index = {}
with open("dict.json", "rb") as file_in:
index = json.load(file_in)
# print index
with open("bookkeeping.json") as jso... | true |
a3edf6694bae20a0102321e7ea8cb4814a50dd09 | Python | ofirofir85/CoPilot | /modules/module_utils.py | UTF-8 | 647 | 2.578125 | 3 | [] | no_license | import win32api
import pyperclip
import keyboard
import time
import winsound
def show_popup(title, message):
win32api.MessageBox(0, message, title)
def put_in_paste(data):
pyperclip.copy(data)
def get_copied_data():
return pyperclip.paste()
def get_highlighted():
orig_clip = get_copied_data()
ke... | true |
cce2298b3e3a387f7884998e769eb45e29295fa8 | Python | MarcAntoineSchmidtQC/hdfe | /tests/test_groupby.py | UTF-8 | 1,031 | 2.875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
from hdfe import Groupby
import pytest
@pytest.fixture
def df() -> pd.DataFrame:
np.random.seed(0)
n_obs = 100
n_categories = 10
return pd.DataFrame(
{
"first category": np.random.choice(n_categories, n_obs),
"y": np.random.normal(... | true |
bc2091deefc5d033ee873373918ff6f1e61b5522 | Python | PiotrDabkowski/Js2Py | /js2py/internals/speed.py | UTF-8 | 974 | 2.703125 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
from timeit import timeit
from collections import namedtuple
from array import array
try:
#python 2 code
from itertools import izip as zip
except ImportError:
pass
from collections import deque
class Y(object):
UUU = 88
def __init__(self, x):
self.x... | true |
e3ab1cadf68b65548834efee00a65b3cebd01ff5 | Python | ArkiWang/math | /divide_difference.py | UTF-8 | 634 | 3.375 | 3 | [] | no_license | import numpy as np
x = [0, 2, 3, 4, 5, 7, 8]
def f(x):
return x**3 + 70*x**2 + 10*x + 5
x = [0, 1, 2, 3, 4]
y = [0, 0, 6, 24, 60]
x = [-2, -1, 0, 1, 2, 3]
y = [-5, -2, 3, 10, 19, 30]
def divide_difference(x, y):
n = len(x)
ans = []
for l in range(1, n+1):
tmp = []
if l == 1:
... | true |
da67ef58b84e77641a6e7b2ce454c1538611a672 | Python | bombthanthap/SKILL_63 | /week3/truck.py | UTF-8 | 425 | 3.109375 | 3 | [] | no_license |
N,W = input().split()
N = int(N)
W = int(W)
while(N != 0 and W != 0):
arr = []
inp = input()
for i in inp.split():
arr.append(int(i))
tmp = 0
tructCount = 0
for i in range(N):
if(tmp < arr[i]):
tmp = W
tructCount += 1
tm... | true |
f3d5764507f4e695d3af7fdd3f64da98c4bfe843 | Python | pgj-ctrl/pgj-Repository | /py01/day3/mtalbe.py | UTF-8 | 174 | 3.5625 | 4 | [] | no_license | n=int(input('you want to number: '))
k = n+1
p = k-1
for i in range(1,10):
for j in range(p,k):
print('%s*%s=%s' % (i,j,i*j),end='\t')
print(end=' ')
print()
| true |
efa87a7d01c424fc2bf6061ea9b9376f09f9ced9 | Python | MasterOfBrainstorming/Python2.7 | /Simple_TCP_Chat/chat client.py | UTF-8 | 956 | 2.78125 | 3 | [] | no_license | import socket, time, threading
tLock = threading.Lock()
shutdown = False
def receiving(name, sock):
while not shutdown:
try:
tLock.acquire()
while True:
data, addr = sock.recvfrom(1024)
print str(data)
except:
p... | true |
a888625f3fe8bcdfd62a047bec5c8de8f54b8587 | Python | vidartf/globmatch | /globmatch/translation.py | UTF-8 | 4,139 | 2.96875 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"Python-2.0"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) Simula Research Laboratory.
# Distributed under the terms of the Modified BSD License.
#
# Copyright © 2001-2019 Python Software Foundation; All Rights Reserved
"""Utilities for matching a path against globs."""
import os
import re
try:
from functools import ... | true |
e43687fae2932c964e15335ae6a7d9f618c40622 | Python | sabarish-gurajada/python | /date_file_check.py | UTF-8 | 659 | 3.046875 | 3 | [] | no_license | import subprocess
from datetime import date
today = date.today()
# dd/mm/YY
today_date = today.strftime("%d/%m/%Y")
record_date = subprocess.check_output(['head', '-1', 'test.txt'])
record_size_line = subprocess.check_output(['tail', '-1', 'test.txt'])
record_size = record_size_line.split(':')[1]
print(record_size)
fil... | true |
22b13c74941e482915076eaa70e425bc38d3d219 | Python | LukasErekson/pyrisk | /ai/mctsstate.py | UTF-8 | 4,198 | 2.765625 | 3 | [] | no_license | #!/bin/python3
import math
import random
from itertools import islice
from world import AREAS
import hashlib
def define_neighbours(world):
for te in list(world.territories.values()):
MCTSState.TERRITORIES_NEIGHBOUR[te.name] = list([t.name for t in list(te.adjacent(None, None))])
class MCTSState(object):... | true |
85584f86d704f1f6b7c8e07ad8ab2e345ec96103 | Python | luismi-gamo/Lambda_Arch_Spark | /Query.py | UTF-8 | 3,074 | 2.671875 | 3 | [] | no_license | import sqlite3
import threading
import pandas as pd
from pandas import Series, DataFrame
import matplotlib.pyplot as plt
import time
from pymongo import MongoClient
class QueryClass(threading.Thread):
# Singleton for DB connections
bd = None
mongodb = None
def __init__(self, db, mongodb, sleeptime):
... | true |
3ddd0d4df4b526d0d5a061bfe923a068047e856a | Python | doom2020/doom | /one_csv.py | UTF-8 | 13,747 | 2.640625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Author:doom
datetime:2019.2.26
email:408575225@qq.com
function:pdf file change csv file
comment:if you update my code,please update comment as too,thanks
this is format case 12:
format:
author
position
email
"""
import codecs
import re
import csv
import time
im... | true |
3da6db15dffa30dc962a5679e7680d7ff3a81454 | Python | THODESAIPRAJWAL/candlestick_model | /code/model_paper.py | UTF-8 | 901 | 2.546875 | 3 | [] | no_license | """
論文のcnnモデル再現
https://www.arxiv-vanity.com/papers/1903.12258/
"""
import tensorflow as tf
import tensorflow.keras.layers as layers
def create_paper_cnn(input_shape=(80, 80, 3), num_classes=3, activation="softmax"):
inputs = layers.Input(input_shape)
x = inputs
for ch in [32, 48]:
x = layers.Conv... | true |
f3c30f9889682cf61e395839b16264c34b0a0a4e | Python | lrondi/Python-challenge | /PyBank/pybank.py | UTF-8 | 2,096 | 3.203125 | 3 | [] | no_license | import os
import csv
month=0
date=[]
total_amount=0
total_change=[]
total_change_av=[]
total_change_av_sum=0
max_inc=0
min_inc=0
file_path=os.path.join("..","Resources","budget_data.csv")
with open(file_path,newline='') as budget_csv:
budget_reader=csv.reader(budget_csv,delimiter=',')
#remove... | true |
e1468d56ada1b788182f3a59b40dfb623212ff12 | Python | moritz-wundke/hg-incpush | /hgincpush/__init__.py | UTF-8 | 6,636 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Just a simple script that adds/commits/pushes all changes by parts.
# Used to push very large changesets in an incremental manner
#
# The MIT License (MIT)
#
# Copyright (c) 2014 Moritz Wundke
#
# Permission is hereby granted, free of charge, to any person obtaining
# a ... | true |
2d0633a5fa2973642f44bd75e9e742203f3c9f10 | Python | lkjhgff11/BaekJoon | /2614저작권.py | UTF-8 | 54 | 3.0625 | 3 | [] | no_license | a,b = map(int,input().split())
x=(a*(b-1))+1
print(x)
| true |
a9f5fba7fbd4a7a1f9ac46665d9d45a9a4a25094 | Python | fhafb/glyphosate | /get_ades_by_station.py | UTF-8 | 850 | 2.71875 | 3 | [] | no_license | import sys
import requests
import csv
stations=set()
with open(sys.argv[1],newline='') as f:
reader=csv.reader(f,delimiter=';',quotechar='"')
for row in reader:
if len(row)>=11 and row[10] in ("35","39","63"):
stations.add(row[0])
total=len(stations)
i=0
for sta in stations:
i=i+1
p... | true |
23521cea2aad55d18f1af7c15263ed0513f2a50a | Python | DxW9617888/count_networks | /count_netmask.py | UTF-8 | 1,349 | 2.75 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
import sys
try:
import ipaddress
except Exception as e:
exit(-1)
def count_networks(netmask):
count = 2 << (32 - int(netmask) - 1)
print('ip address count:', count)
n = 0
while n < 255:
yield n
n += count
def hosts(network):
for x in network.hosts():
... | true |
e8e6075b933bbfd8c953e8d2ad528a72ac5e0024 | Python | gen4438/vtk-python-stubs | /typings/vtkmodules/vtkIOExportPDF.pyi | UTF-8 | 21,261 | 2.609375 | 3 | [
"BSD-3-Clause"
] | permissive | """
This type stub file was generated by pyright.
"""
import vtkmodules.vtkIOExport as __vtkmodules_vtkIOExport
import vtkmodules.vtkRenderingContext2D as __vtkmodules_vtkRenderingContext2D
class vtkPDFContextDevice2D(__vtkmodules_vtkRenderingContext2D.vtkContextDevice2D):
"""
vtkPDFContextDevice2D - vtkConte... | true |
704e0d2accbd7565e8e7563e31a1ba721ba600ac | Python | open-mmlab/mmengine | /mmengine/optim/optimizer/base.py | UTF-8 | 4,472 | 2.6875 | 3 | [
"Apache-2.0"
] | permissive | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
from typing import Dict, List
import torch
class BaseOptimWrapper(metaclass=ABCMeta):
def __init__(self, optimizer):
self.optimizer = optimizer
# The Following code is used to initialize `base_param_settings... | true |
268fa2d9d2d059f3d71bff57cb3387558ef31e53 | Python | phousanakhan/CMPUT355_ASN4 | /main.py | UTF-8 | 2,824 | 3.421875 | 3 | [] | no_license | import numpy as np
import connect4 as c4
import os
boardWidth = 7 #col
boardHeight = 6 #row
quit = False
def main():
print("Welcome to the Connect4 game!\n")
print("Type 'quit' if you want to quit\n")
print("Type 'man' if you want to see the manual\n")
print("Type 'hist' if you want to see the a br... | true |
ec8e11f5fdc43c5e13b92064d25d598de300a4e4 | Python | LoveMuzi/statsvninfoparser | /svnfileinfo.py | UTF-8 | 1,704 | 2.796875 | 3 | [] | no_license | # coding:utf-8
class SvnFileInfo:
def __init__(self):
self._total_files = ''
self._average_file_size = ''
self._average_revision_per_file = ''
self._file_types_summary_dict_list = []
self._largest_files_detail_dict_list = []
self._files_with_most_revisions_dict_list... | true |
58fc0301a8168e32cb671aa45cf9c5a16c257a78 | Python | MadMrCrazy/ChocolateAgeCounter | /chocolate.py | UTF-8 | 999 | 4.25 | 4 | [] | no_license | year = input("What is the year?:")
year = int(year)
chocolate = input("pick the number of times a week that you would like to have chocolate. Cannot be 0:")
chocolate = int(chocolate)
print("Multiplying the number by 2")
print(str(chocolate) + " times 2")
print(chocolate * 2)
chocolate = chocolate * 2
print("adding 5..... | true |
05e8bf1407813aa20d0ba69cfeb6175b1620212a | Python | Barud21/ActivityMonitor | /tests/testsHelper.py | UTF-8 | 1,651 | 2.796875 | 3 | [
"MIT"
] | permissive | import datetime
import json
import os
import ApplicationObjects as Ao
import jsonFormatter as jF
def createTimestamp(timeDigitsTup):
t1 = datetime.time(timeDigitsTup[0][0], timeDigitsTup[0][1], timeDigitsTup[0][2])
t2 = datetime.time(timeDigitsTup[1][0], timeDigitsTup[1][1], timeDigitsTup[1][2])
return Ao... | true |
5779cc1cd677941c20da6c261a3ce38fa5683b01 | Python | jar398/tryphy | /tests/test_ts_all_species.py | UTF-8 | 4,216 | 2.53125 | 3 | [
"BSD-2-Clause"
] | permissive | # 6. ts/all_species
# Get all species that belong to a particular Taxon.
import sys, unittest, json
sys.path.append('./')
sys.path.append('../')
import webapp
service = webapp.get_service(5004, 'ts/all_species')
class TestTsAllSpecies(webapp.WebappTestCase):
@classmethod
def get_service(self):
return... | true |
5f4438087e49d3e023ec2ed400edfaa5cb206103 | Python | JonathanLoscalzo/catedra-big-data | /spark/Entrega3/02/02.py | UTF-8 | 1,618 | 2.90625 | 3 | [] | no_license | from pyspark import SparkConf, SparkContext
from pyspark.streaming import StreamingContext
import sys
if len(sys.argv) < 2:
persistent = "/tmp/data/Entrega3/02/"
else:
persistent = sys.argv[1]
conf = SparkConf().setMaster("local[2]").setAppName("ContarDestinos")
sc = SparkContext(conf=conf)
sc.setLogLevel("OF... | true |
dc6a79eb649df55c526833471cbf82c16c983feb | Python | allanlykkechristensen/random_survey_results | /random_survey_results.py | UTF-8 | 3,484 | 3.125 | 3 | [
"MIT"
] | permissive | from faker import Faker
import numpy as np
import pandas as pd
import datetime
import argparse
import json
fake = Faker()
def init_argparse() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(
usage="%(prog)s [OPTION]",
description="Generate random survey dataset."
)
parser.ad... | true |
7ce2e6bb940bd0d79116099b589c9bd69c398469 | Python | brandonholderman/snakes-cafe | /snakes_cafe.py | UTF-8 | 5,133 | 2.9375 | 3 | [
"MIT"
] | permissive | import uuid
menu = {
'Appetizers': {
'Wings': 8.00,
'Spring Rolls': 5.00,
'Cookies': 2.00,
'Grilled Squid': 8.00,
'Crab Wonton': 6.00,
'Satay': 7.00
},
'Entrees': {
'Salmon': 15.00,
'Steak': 20.00,
'Meat Tornado': 25.00,
'A Li... | true |
c872adb28f24d8d62744c9bf6b8a1fe70840bcdc | Python | lf2225/Blackjack | /Deck.py | UTF-8 | 929 | 3.640625 | 4 | [] | no_license | import random
import itertools
Suits = 'cdhs'
Ranks = '23456789TJQKA'
class Deck(object):
def __init__(self):
#print 'I am entering the init routine of Deck'
self.CardShoe = tuple(''.join(card) for card in itertools.product(Ranks, Suits))
self.NumberOfCards = len(self.CardShoe)
self.shuffle()
#print 'I am ... | true |
0330589ed4653be6b59e00fe84bf9f7199f0cb96 | Python | dosart/Graph_algorithms | /tests/test_kruskal.py | UTF-8 | 2,139 | 3.078125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
"""Tests of Kruskal's algorithm."""
from graph_algorithms.algorithms.kruskal.kruskal import kruskal
from graph_algorithms.data_structure.graph.graph import Graph
def test_kruskal1():
graph = Graph()
graph.create_vertex_by_id('A')
graph.create_vertex_by_id('B')
graph.create_ve... | true |
6e6561f2c85cb0cb4fb0f0359992bde5b61b8da6 | Python | ELORCHI/python-bootcamp | /ex04/operations.py | UTF-8 | 1,247 | 3.828125 | 4 | [] | no_license | import sys
def elementary_operations(a, b):
summ = a + b
Difference = a - b
Product = a * b
if b == 0:
Quotient = "err"
Remainder = "err"
else:
Quotient = a / b
Remainder = a % b
return (summ, Difference, Product, Quotient, Remainder)
error = False
nb_args = len(s... | true |
8f94bd3b14aa7657dd22e692cb374999b50bf519 | Python | msjuck/DC_INSIDE_VR | /VR_WASABI.PY | UTF-8 | 3,221 | 2.578125 | 3 | [
"Apache-2.0"
] | permissive | from bs4 import BeautifulSoup
import requests
import time
def get_doc():
BASE_URL = "https://gall.dcinside.com/mgallery/board/view/"
url = 'https://gall.dcinside.com/mgallery/board/lists?id=vr_games_xuq'
# 파라미터 설정
params = {'id' : 'vr_games_xuq'}
# 헤더 설정
headers = {
'Accept' : 'text/html,application/x... | true |
ae821c002801d5c14276234b3603a2e8e62415e8 | Python | olugboyegaonimole/machine_learning | /supervised learning/regression/Random Forest Regression/random_forest_regression.py | UTF-8 | 6,413 | 3.0625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 00:15:18 2018
@author: onimo
"""
### ### PLAN ### ###
### FIND ###
# import libraries
# load dataset
# database
# nosql
# csv
# spreadsheet
# web service
# web socket
# api
### EXPLORE ###
# summarize
# shape
#... | true |
b8bc713c5f760995eef235140af2fb0b72c2d4d4 | Python | AndresBena19/rolly_interpreter | /XETLast/ast.py | UTF-8 | 8,045 | 2.6875 | 3 | [] | no_license | from __future__ import division
from datetime import datetime
from XETLlexer.tokens import DATE_FORMATS_VALUES
from uuid import uuid4
class Equality:
def __eq__(self, other):
return isinstance(other, self.__class__) and \
self.__dict__ == other.__dict__
def __ne__(self, other):
... | true |
3f430e64e1c86f07c721293e3d3f46fb8a0c36d0 | Python | shuaiweixiaozi/sklearn_examples_experiment | /data_clear/nan_value_clear/nan_value_clear.py | UTF-8 | 1,175 | 3.6875 | 4 | [] | no_license | from io import StringIO
import pandas as pd
csv_data = '''A,B,C,D
1.0,2.0,3.0,4.0
5.0,6.0,,8.0
0.0,11.0,12.0,'''
csv_data = pd.read_csv(StringIO(csv_data))
# 使用isnull方法返回一个值为布尔类型的DataFrame,判断每个元素是否缺失,如果缺失为True
# 然后使用sum方法,得到DataFrame中每一列的缺失值个数
print(csv_data.isnull().sum())
... | true |
28b7d4331021833857dabd53d23a91ae0f0bc3db | Python | sunnyyeti/Leetcode-solutions | /1320 Minimum Distance to Type a Word Using Two Fingers.py | UTF-8 | 2,833 | 3.984375 | 4 | [] | no_license | # You have a keyboard layout as shown above in the XY plane, where each English uppercase letter is located at some coordinate, for example, the letter A is located at coordinate (0,0), the letter B is located at coordinate (0,1), the letter P is located at coordinate (2,3) and the letter Z is located at coordinate (4,... | true |
51002c6c090d96eb31eb3e1ec55e6728557c8918 | Python | kazuhumikobayashi/tp-paperwork | /application/domain/model/immutables/status.py | UTF-8 | 1,263 | 2.90625 | 3 | [] | no_license | from enum import Enum
class Status(Enum):
start = 1
placed = 2
received = 3
done = 4
failure = 99
@property
def name(self):
if self._value_ == self.start.value:
return '01:契約開始'
elif self._value_ == self.placed.value:
return '02:発注完了'
elif s... | true |
29d36678f5df361bfa4dca642c81d88a0f91a8b7 | Python | shaunrong/image-fun | /colorHistograms/grayScale.py | UTF-8 | 491 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
import cv2
import matplotlib.pyplot as plt
__author__ = 'Shaun Rong'
__version__ = '0.1'
__maintainer__ = 'Shaun Rong'
__email__ = 'rongzq08@gmail.com'
image = cv2.imread('grant.jpg')
cv2.imshow('image', image)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow('gray', gray)
hist = cv2.c... | true |
354c8b70812e06e8d16f31e6c2add4b4ecaefcff | Python | maluethi/laser_plot | /plot_test_template.py | UTF-8 | 294 | 2.9375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
plt.style.use('./mythesis.mplstyle')
x = np.linspace(0,2*np.pi, 100)
y = np.sin(x)
fig, ax = plt.subplots(2, 1)
ax[0].plot(x, np.sin(x))
ax[1].plot(x, np.cos(x))
ax[1].set_xlabel('Phase')
for a in ax:
a.set_ylabel('Ampli')
plt.show()
| true |
e2e65a94b402a76356404975a85245e69f462356 | Python | mrliuzhao/OpenCVNotebook-Python | /22TemplateMatch.py | UTF-8 | 1,590 | 2.9375 | 3 | [] | no_license | import cv2
import numpy as np
img = cv2.imread(r".\resources\dog1.jpg", cv2.IMREAD_COLOR)
template = cv2.imread(r".\resources\dog1Face.png", cv2.IMREAD_COLOR)
h, w = template.shape[:2] # rows->h, cols->w
# 在图片上进行模板匹配。匹配过程类似Valid模式的卷积,即将模板作为核在图片上进行滑动,使用不同方法计算滑动窗口下原图与模板的相似度,具体计算方法有多种:
# TM_SQDIFF方法,原图与模板每个像素的平方差之和,返回的... | true |
9dfb635cf74278a19764867bdb80c8a9a3de178a | Python | decebel/dataAtom_alpha | /bin/plug/py/sources/weby/WikipediaDataCommand.py | UTF-8 | 2,608 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive |
import os, sys
basePlugPath = os.path.join("..", "..")
sys.path.insert(0, os.path.join(basePlugPath, "api"))
sys.path.insert(0, os.path.join(basePlugPath, "external"))
# TODO - know difference between module import vs package import?
import drawingboard
from pattern.web import Wikipedia
import pprint
pp = pprint.Pr... | true |
b7912fd6a64924a429a419fda080a58c92ce5d00 | Python | wooloba/LeetCode861Challenge | /650. 2 Keys Keyboard.py | UTF-8 | 685 | 3.328125 | 3 | [] | no_license | ####################
# Yaozhi Lu #
# Aug 19 2018 #
####################
# Origin: https://leetcode.com/problems/2-keys-keyboard/description/
class Solution(object):
def minSteps(self, n):
"""
:type n: int
:rtype: int
"""
#1. DP
if n == 0:
ret... | true |
6d1ff823af557831a46afed102666c564448f626 | Python | Hubert-Guzowski/RealTimePoseEstimation | /src/mesh.py | UTF-8 | 1,153 | 3 | 3 | [] | no_license | from csv_reader import CsvReader
import numpy as np
class Triangle:
def __init__(self, V0: np.ndarray, V1: np.ndarray, V2: np.ndarray):
self.V0 = V0
self.V1 = V1
self.V2 = V2
class Ray:
def __init__(self, P0: np.ndarray, P1: np.ndarray):
self.P0 = P0
self.P1 = P1
cl... | true |
f1f3ee8f560fe8cf1a419c6742335dea133ca1c2 | Python | MitsurugiMeiya/Leetcoding | /问题/bishi.py | UTF-8 | 236 | 2.921875 | 3 | [] | no_license |
import sys
if __name__ == "__main__":
# 读取第一行的n
data =[]
while True:
line = sys.stdin.readline().strip()
if not line:
break
data.append(line)
| true |
c81b3c09cedfcda0476684b9fe1c19de3cd85282 | Python | Gedanke/graduationProject | /data/dealData/car.py | UTF-8 | 695 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from core.dealData import *
"""
将 original_path 路径的txt文件,以 separator 为分割符,以 attribute_name 为列名(含标签)
使用 TransformData 类,得到与txt文件同一路径下的csv文件
"""
original_path = "../originalDataSet/car/car.txt"
separator = " "
attribute_name = [
"buying", "maint", "doors", "persons", "lug_boot", "safety", "L... | true |
be022b2e43b7fc0dfbf1ac314df17a06d877071b | Python | manuelpepe/FacebookWorkPoster | /FacebookWorkPoster_en.py | UTF-8 | 4,139 | 3.578125 | 4 | [] | no_license | #!/usr/bin/env python
import os
import time
import fb
# You can get a token on https://developers.facebook.com/tools/explorer
TOKEN = 'YourToken'
def is_valid_line(line):
if not line.startswith('//') and not line.startswith(':'):
return True
return False
def read_projects():
""" Open the project ... | true |
8b82a39aa2900f064ec79da0f17fc9d63ef929bb | Python | wlgn123/pcap_parser | /python/pcap_parser.py | UTF-8 | 22,862 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# coding: utf-8
# os 패키지
import os
# 시스템 패키지
import sys
# 파이썬 아규먼트를 위해사용
import argparse
# 소켓 통신 모듈 불러오기
from socket import AF_INET, socket, SOCK_STREAM, SOL_SOCKET, SO_REUSEADDR
# 텍스트 포맷 관련 import
from TextFormat import bcolors, MENU_PRINT_FORMAT, TITLE_PRINT_FORMAT
# Pcap 클래스
from Pcap import ... | true |
b4c5dffa22ceb9fc4ee2eb19aff5e7539213cf17 | Python | Sel14/Proyecto- | /Carpeta/proyecto clienteCasiFinal.py | UTF-8 | 3,913 | 2.578125 | 3 | [] | no_license | from Tkinter import *
import socket
import threading
from threading import *
mi_socket=socket.socket()
raiz=Tk()
raiz.title("Cocina")
frame=Frame(raiz, width=500, height=400)
frame.pack(fill="both",expand="True")
#---import socket---#
while True:
try:
mi_socket.connect(("localhost",8000))
break
except:
continu... | true |
5bb5e42e02a13a83d2840bfd5a3600780c61f7ad | Python | selvesandev/python-ess | /input-output/io.py | UTF-8 | 339 | 3.390625 | 3 | [] | no_license | file = open('file.txt')
print(file.read())
file.seek(0)
print(file.read())
file.seek(0);
print(file.readlines())
file.close()
# No Need to close the file
with open('file.txt') as myNewFile:
contents = myNewFile.read()
print(contents)
with open('file.txt', mode='a') as myFileWrite:
myFileWrite.write('Hell... | true |