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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
123ca0d1ad25bc147b91176e98d2ebb5003c020d | Python | vstarman/python_codes | /5day/02.process的使用.py | UTF-8 | 813 | 3.1875 | 3 | [] | no_license | import multiprocessing, time
def show(title, name, age):
for i in range(10):
print(i, " %s; %s; %d" % (title, name, age))
time.sleep(0.1)
if __name__ == '__main__':
# 创建进程,参数以元祖,字典传参(注意字典中key名要和参数名一样)
sub_process = multiprocessing.Process(target=show, args=("hello",), kwargs={"name":... | true |
a2b5d76b2377cb73e68be6b751891fda59b38cc2 | Python | perplexes/whysaurus | /archive/wikiParser.py | UTF-8 | 9,591 | 2.859375 | 3 | [] | no_license | import sys, os, re, cgi, glob, time
class Parser(object):
EOF = 0
def __init__(self, write=None, error=None):
self.text = None
self.pos = 0
if write is None:
write = sys.stdout.write
self.write = write
if error is None:
# example: sys.stderr.write("%s: %s" %... | true |
3493e974018bb57ba17c9eb86228e4314b56baa7 | Python | refresh6724/APS | /Jungol/Lv1_LCoder_Python/pyb0_리스트2/Main_JO_906_리스트2_자가진단5.py | UTF-8 | 505 | 3.546875 | 4 | [] | no_license | # 10개의 정수를 입력받아 100 미만의 수 중 가장 큰 수와
# 100 이상의 수 중 가장 작은 수를 출력하는 프로그램을 작성하시오.
# (입력되는 정수의 범위는 1 이상 10000 미만이다. 각각의 경우, 만약 해당하는 수가 없을 때에는 100을 출력한다.)
a = list(map(int, input().split()))
lt100 = list(filter(lambda x: x < 100, a))
gte100 = list(filter(lambda x: x>= 100, a))
print(max(lt100) if lt100 else 100, min(gte100) ... | true |
dc347924d3fb737055550098015a41dfde6343c3 | Python | byu-dml/d3m-dynamic-neural-architecture | /dna/data.py | UTF-8 | 23,907 | 2.84375 | 3 | [] | no_license | import json
import os
import random
import tarfile
import typing
from collections import defaultdict
import itertools
import numpy as np
import pandas as pd
import torch
import torch.utils.data
from dna.utils import get_values_by_path
def group_json_objects(json_objects: typing.List[typing.Dict], group_key: str) ->... | true |
5e745c581185ba0debf88046f3f3ef06748eaec9 | Python | Donnyvdm/dojo19 | /team_9/cocos/test/test_multiplex_layer.py | UTF-8 | 1,816 | 2.546875 | 3 | [
"LGPL-2.1-only",
"CC-BY-NC-4.0",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-proprietary-license",
"CC-BY-NC-SA-2.0",
"BSD-3-Clause"
] | permissive | from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "t 0.1, s, t 1.1, s, q"
tags = "MultiplexLayer"
autotest = 0
import pyglet
fr... | true |
6d6c2da12c2ade11b00087f0ac32c145e1a11468 | Python | sportwang/convex-optimization | /l1-hw-王协盼-1601214718/代码/l1_cvx_mosek.py | UTF-8 | 645 | 2.515625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 25 04:42:26 2016
@author: hadoop
"""
from datetime import datetime
import numpy as np
from scipy.sparse import random
import cvxpy as cvx
def l1_cvx_mosek(n,A,b,mu) :
x = cvx.Variable(n,1)
exp = 0.5* cvx.square(cvx.norm((A*x-b),2)) + mu *... | true |
9235dbb19af34c1b3890fbd0aaad14bea407f24e | Python | minhthe/practice-algorithms-and-data-structures | /Dequeue SlidingWindow 2Pointers/3sumSmaller.py | UTF-8 | 786 | 3.578125 | 4 | [] | no_license | '''
https://www.lintcode.com/problem/3sum-smaller/description
'''
class Solution:
"""
@param nums: an array of n integers
@param target: a target
@return: the number of index triplets satisfy the condition nums[i] + nums[j] + nums[k] < target
"""
def threeSumSmaller(self, nums, target):
... | true |
bd52c6b81e0e169541abe676cb2a8ea939d229e3 | Python | JonathanRaiman/rsm | /daichi_rsm/utils/utils.py | UTF-8 | 273 | 2.984375 | 3 | [] | no_license | def convert_lexicon_file_to_lexicon(path):
reverse_lexicon = []
lexicon = {}
with open(path, 'r') as lexicon_file:
for index, line in enumerate(lexicon_file):
reverse_lexicon.append(line.rstrip())
lexicon[line.rstrip()] = index
return (lexicon, reverse_lexicon) | true |
5c4af949931245aa1659dfee8649c7e8d5c521ee | Python | aakarshgupta97/106B-Research-Project | /src/Particle.py | UTF-8 | 2,532 | 3.265625 | 3 | [] | no_license | __author__ = 'Aakarsh Gupta'
from graphics import Circle
from graphics import Point
from random import Random
import numpy as np
class Particle:
def __init__(self, window, p=Point(0, 0), isSheep=False):
self.particle = None
self.drawn = False
self.color = "RED"
self.position = p
... | true |
0607760b08b094bfe0c05824bd4888025b3de0e1 | Python | Yuuki-Yoda/Normal-Distribution | /Log-normal.py | UTF-8 | 1,556 | 3.40625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import norm
# 定义标准正态
def cdf(x):
return norm.cdf(x, loc=0, scale=1)
def pdf(x):
return norm.pdf(x, loc=0, scale=1)
# 绘图函数(μ*float, σ*float)
def lognormal(mu, sig):
if sig <= 0:
print("Scale Error")
return
if sig <... | true |
38bf0277ddb4ef56e3671ec30ac72ee7cd0ae35e | Python | aimendez/Udemy_Certification_Dashboards_Plotly | /Excercise_Solutions/Ex_5.py | UTF-8 | 1,897 | 3.5625 | 4 | [] | no_license | #######################################################################################
# EXCERCISE 5: Boxplots Excercise
# Udemy Online Course: "Python Visualization Dashboards with Plotly's Dash Library"
# https://www.udemy.com/course/interactive-python-dashboards-with-plotly-and-dash/
# @Author: AIMendez
# Created... | true |
5fc1339beac0107c891e87b82435911044225ae4 | Python | Aasthaengg/IBMdataset | /Python_codes/p02779/s996292507.py | UTF-8 | 139 | 2.6875 | 3 | [] | no_license | import sys
input = sys.stdin.readline
n, s = int(input()), list(map(int, input().split()))
print('YES' if len(set(s)) == len(s) else 'NO') | true |
0d6d54d74407071e939b7f4ff2b97713c5cd710d | Python | aewens/database | /aes.py | UTF-8 | 941 | 2.671875 | 3 | [
"BSD-3-Clause"
] | permissive | from os import urandom
from hmac import new as HMAC
from hashlib import sha256
from base64 import urlsafe_b64encode as ub64e, urlsafe_b64decode as ub64d
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
def encrypt(message, key=None, nonce=None):
if key is None:
key = AESGCM.generate_key(bit_l... | true |
a29d1fabb9803d1747d55b7e0608d7acbdd12aa5 | Python | JamesMensah/blablamower | /Mower.py | UTF-8 | 2,275 | 3.375 | 3 | [] | no_license | import logging
from Exceptions import WrongFormatInputFileException
class Mower(object):
def __init__(self, x=int, y=int, orientation=str):
self.x = x
self.y = y
self.orientation = orientation
def __str__(self):
return "Mower(" + str(self.x) + ";" + str(self.y) + ";" + self.... | true |
a53e3f5fe807968bf041f0b5c0a075ab9dce38b4 | Python | MrHamdulay/csc3-capstone | /examples/data/Assignment_8/llyjam001/question3.py | UTF-8 | 960 | 4.375 | 4 | [] | no_license | """Assignment 8 Question 3
James Lloyd
4 May 2014"""
#Retrieving message
message = input ("Enter a message:\n")
def encrypt (message):
"""Function to shift letters by plus one"""
#Setting the base case
if message == '':
return ''
#Changing the first character to code the adding to ... | true |
e1dd6941e01fac1529084f539f25ddd0eb88e8df | Python | Nenphys/SofiControl | /connection_db.py | UTF-8 | 6,206 | 2.53125 | 3 | [] | no_license | __author__ = 'Chapo'
import MySQLdb
import serial
import time
import sys
import bitState
messageToSend = ''
respuesta = ''
data_toPrint = ''
cmd =''
def SendCommand(cmd_cfg):
global tenSec, Rx, messageToSend, errorCounter, respuesta,data_toPrint,cmd
data_toPrint = ""
print("TxST: SendCommand Thread Run... | true |
11649412a5ecaed2e15d3bd5bfd6f206de1cd5f5 | Python | zeusone/machine | /pro/test.py | UTF-8 | 564 | 3.40625 | 3 | [] | no_license | #i=1
#print (type(i))
#from random import randrange
#num = randrange(1,9);
#print (num)
#a = input('X : ')
#if int(a) > 0:
# print (a)
#else:
# print (-int(a))
#for x in range(1, 11):
# print (x)
#for ind in 'python':
# if ind == 'h':
# continue
# else:
# print (ind)
tuple_1 = ('shan... | true |
851efce6e752533d4b784ca7e2fb86555b25de27 | Python | aruna09/practice-datasets | /Electric-Meters/hsv.py | UTF-8 | 1,521 | 2.84375 | 3 | [] | no_license | import cv2
import numpy as np
#reading the image
img = cv2.imread('/home/icts/practice-datasets/Electric-Meters/Electric-meters/MAN_5001816631_20170819_OK.jpg')
#median blur to remove the noise and other small characters
median = cv2.medianBlur(img, 3)
#converting to hsv
hsv = cv2.cvtColor(median, cv2.COLOR_BGR2HS... | true |
41f05a3335b1ffcfa4e037a71605fd4bc9f917c0 | Python | rdranch/scripts | /afkPy.py | UTF-8 | 7,198 | 2.625 | 3 | [] | no_license | import win32api, keyboard, multiprocessing, ctypes
from json import dumps, loads
from time import sleep
from os import path, getcwd, startfile
from random import randint, uniform, shuffle
from win32gui import GetWindowText, GetForegroundWindow
from psutil import process_iter
# TODO add randomization to looking... | true |
a3ff108e8cd3b49abc11923636ae3460dee4f397 | Python | AustinAmannVaughan/betAPP | /betApp.py | UTF-8 | 4,699 | 3.171875 | 3 | [] | no_license | import csv
import tkinter as tk
class Team:
name = ""
wins = 0
losses = 0
spreadW = 0
spreadL = 0
oppW = []
oppL = []
def __init__(self,name,wins,losses,spreadW,spreadL, recW, recL):
self.name = name
self.wins = wins
self.losses = losses
self.spreadW = spr... | true |
abe7c5be532e6afcdb6f4ddd43b94dc8f1de7db0 | Python | globalista/sudoku_solver | /methods.py | UTF-8 | 1,465 | 3.234375 | 3 | [] | no_license | def input_to_matrix(vstup):
matrix = []
with open(vstup) as f:
for line in f:
line1 = line.strip().split()
if line1:
final_line = []
for j in line1:
if j in {'1', '2', '3', '4', '5', '6', '7', '8', '9'}:
... | true |
dfdd717ad0f875cea581a20d53c02ef7cd7b3a4c | Python | rexkwong-py/2022-calendar.py | /2022calendar.py | UTF-8 | 378 | 2.71875 | 3 | [] | no_license | import calendar
print(calendar.month(2022,1))
print(calendar.month(2022,2))
print(calendar.month(2022,3))
print(calendar.month(2022,4))
print(calendar.month(2022,5))
print(calendar.month(2022,6))
print(calendar.month(2022,7))
print(calendar.month(2022,8))
print(calendar.month(2022,9))
print(calendar.month(2022,10))
pri... | true |
3d0d39359e574f8d0ee3c027e0c44450af038025 | Python | rdguerrerom/MolecularModelling | /For_Naaman/Polarizability_analysis.py | UTF-8 | 1,982 | 3.390625 | 3 | [] | no_license | import numpy as np
from numpy import linalg as LA
HS_25_polarizability = np.array([[ -616.06509371, -338.23860565, 168.61275949],
[ -339.53209953, -3271.1258288, 49.97796199],
[ 169.52823124, 49.92681813, -3248.46416257]])
HS_13_polarizability = np.array( [[ -632.12055991, 361.8850252, -105.08752708],... | true |
55235514a1c5fe2ac4d4fd9aea14d728ea8cc8f2 | Python | timtim1342/HSE-Programming | /hw2/homework2.py | UTF-8 | 140 | 3.796875 | 4 | [] | no_license | a = str(input('Input word:')).replace("з","").replace("З","").replace("я","").replace("Я","")
for i in reversed(a):
print(i,end='')
| true |
0f3f4fb5203478eaf9d6760a9e36af200b259bcd | Python | steph-mcd/udacity-data-lake-with-spark | /etl.py | UTF-8 | 6,553 | 2.5625 | 3 | [] | no_license | import configparser
from datetime import datetime
import os
from pyspark.sql import SparkSession
from pyspark.sql.functions import udf, col
from pyspark.sql.functions import year, month, dayofmonth, hour, weekofyear, date_format
from pyspark.sql.types import StructType as R, StructField as Fld, DoubleType as Dbl, Strin... | true |
0e15bb314749b3c4fd95447cf896171a1d315d9e | Python | mysqlbin/python_note | /2020-08-01-Python-ZST-4200/01-字符串与正则/2020-08-03-regular.py | UTF-8 | 1,731 | 3.484375 | 3 | [] | no_license | #!/usr/local/bin/python3
#coding=utf-8
""" a|b """
import re
str = "13202095158,13302095158,13402095158"
pattern = re.compile(r'1(32|33)\d')
print(pattern.findall(str))
""" 输出:['32','33'] """
import re
str = "13202095158,13302095158,13402095158"
pattern = re.compile(r'(1(32|33)\d{8})')
print(pattern.findall(str))
"... | true |
fc45353f41a8410f38c75957bca830636fe82bfc | Python | RobertRelyea/adv_homework4 | /scripts/world.py | UTF-8 | 1,956 | 3.421875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from obstacles import Square, Circle
from robot import solve_coeffs, generate_path
from plot_utils import *
# Populate world with obstacles
A = Square(center=(-1.25,0.625), length=0.4)
B = Circle(center=(-1.625,-0.3), radius=0.25)
C = Circle(center=(0.75,0), radius=0.... | true |
b921986b11576101abfe2aacc3c0568a5f30059a | Python | JaiRaga/FreeCodeCamp-Data-Structures-and-Algorithms-in-Python | /Basic_Algorithm_Scripting/cToF.py | UTF-8 | 236 | 4.21875 | 4 | [] | no_license | # Algorithm to convert temperature in celcius to fahrenheit
def convertToF(celcius):
fahrenheit = celcius * (9 / 5) + 32
return fahrenheit
print(convertToF(-30))
print(convertToF(30))
print(convertToF(20))
print(convertToF(0)) | true |
399f22d3d704178ea68cfd50946294c7ca771dcd | Python | LifeLaboratory/Task_platform_backend | /task_lesson/api/task/pass_task.py | UTF-8 | 2,466 | 2.65625 | 3 | [
"MIT"
] | permissive | import json
from django.http import HttpResponse
from task_lesson.api.helpers import names
from task_lesson.models import Task as TaskModel
from task_lesson.models import Solution as SolutionModel
from task_lesson.api.helpers.checkers import set_types
from task_lesson.api.task.task import Task
from task_lesson.api.help... | true |
0cc90ffcb380f388bb70745c3451aa05babe89bb | Python | Jigar710/Python_Programs | /Decorator/test4.py | UTF-8 | 138 | 2.5625 | 3 | [] | no_license | a = 10
b = 20
print(locals())
print("=================================")
print(locals.__doc__)
print("=================================") | true |
14706e2046281a91f7ca610cf7f14fe71f24158b | Python | AlbertoCastelo/Neuro-Evolution-BNN | /tests_non_automated/probabilistic_programming/create_network.py | UTF-8 | 5,132 | 3.015625 | 3 | [] | no_license | import theano
import numpy as np
import pymc3 as pm
def construct_nn(x, y, config):
'''
Follows Twiecki post: https://twiecki.io/blog/2016/06/01/bayesian-deep-learning/
'''
n_hidden = 3
# Initialize random weights between each layer
w_1_init = np.random.randn(config.n_input, n_hidden).astype(... | true |
921b64da3df3c25b25de18d78711c9395f9b0115 | Python | sean1792/socket-http | /client.py | UTF-8 | 758 | 2.703125 | 3 | [] | no_license | import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#addr = input("Please enter the Server IP:")
addr ='192.168.1.9'
h=socket.gethostbyname(addr)
print(h)
port = 8000
#f = input("enter file name:")
f='index.html'
header = 'GET /'
header += f
header+=' HTTP/1.1\r\nHost: '+addr+'\r\nConnection: close\r\n... | true |
e8e9af0807742e5c52e187ffeaba47f655ad016b | Python | timcera/tsgettoolbox | /src/tsgettoolbox/functions/rivergages.py | UTF-8 | 2,117 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | """
rivergages US station:USACE river gages
"""
import pandas as pd
from toolbox_utils import tsutils
from tsgettoolbox.ulmo.usace.rivergages.core import (
get_station_data,
get_station_parameters,
get_stations,
)
__all__ = ["rivergages"]
# def get_station_data(station_code, parameter, start=No... | true |
375a9a7f8283ada1d75b93972a24b3a70e792b86 | Python | gabriellaec/desoft-analise-exercicios | /backup/user_274/ch160_2020_06_22_17_46_52_535308.py | UTF-8 | 231 | 3.3125 | 3 | [] | no_license | import math
a = 0
b = i
for i in range(91):
c = math.radians(i)
x = math.sin(c)
x = math.degrees(x)
y = (4*i*(180-x))/(40500 - x*(180-x))
e = abs(x-y)
if e > a:
a = e
b = i
print(b) | true |
947d3bcf9fadc3bf2a9a1650d24a30d91d69e894 | Python | hoggard/stepik---auto-tests-course | /Lessons/Part2_lesson2_step6.py | UTF-8 | 751 | 2.71875 | 3 | [] | no_license | from selenium import webdriver
from selenium.webdriver.support.ui import Select
import time
import math
link = "http://SunInJuly.github.io/execute_script.html"
def calc(x):
return str(math.log(abs(12*math.sin(x))))
try:
browser = webdriver.Chrome()
browser.get(link)
x = browser.find_element_by_id("in... | true |
959e2de5c726988c5262763169aa25884e717937 | Python | ktzhao/hoppy | /hoppy/nicer/cli/niget_yyyymm.py | UTF-8 | 1,265 | 2.8125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import os
import argparse
from argparse import ArgumentParser
import pandas as pd
__author__ = 'Teruaki Enoto'
__version__ = '0.01'
# v0.01 : 2020-08-01 : original version
def get_parser():
"""
Creates a new argument parser.
"""
parser = argparse.ArgumentParser('niget_yyyymm.py',
formatte... | true |
4134e930f0745d1af6d271d02e5b16cfa58dc06c | Python | waltercoan/ALPC1ano2018 | /fatorial.py | UTF-8 | 157 | 3.71875 | 4 | [] | no_license | print("Digite o numero base")
base = int(input())
fat = 1
while base >= 1:
print(base)
fat = fat * base
base = base - 1
print("Resultado", fat)
| true |
618ca87dd8efc0a0bbd00fca92426800f4069f59 | Python | nicksavers/raiden | /raiden/encoding/format.py | UTF-8 | 4,032 | 2.71875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from collections import namedtuple, Counter
try: # py3k
from functools import lru_cache
except ImportError:
from repoze.lru import lru_cache
__all__ = ('Field', 'BYTE', 'namedbuffer', 'buffer_for',)
Field = namedtuple(
'Field',
('name', 'size_bytes', 'format_string', 'encod... | true |
68c6a765a158ae565cd310609e5f969d7834c096 | Python | couchbaselabs/mobile-testkit | /libraries/testkit/parallelize.py | UTF-8 | 2,166 | 2.578125 | 3 | [] | no_license | import concurrent.futures
from libraries.testkit import settings
import copyreg
import types
from threading import Thread
from keywords.utils import log_info
from keywords.utils import log_debug
# This function is added to use ProcessExecutor
# concurrent.futures.
#
def _pickle_method(m):
if m.__self__ is None:
... | true |
5aa5c58612743d7afe30d7930680b6cac456aec5 | Python | sahana/SAMBRO | /languages/th.py | UTF-8 | 2,630 | 2.65625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
{
'Add New Organization': 'เพิ่มองค์กรใหม่',
'Add Organization': 'เพิ่มองค์กร',
'agree': 'เห็นด้วย',
'all of it': 'ทั้งหมด',
'Dear %(person_name)s': 'เรียน %(person_name)s',
'Delete Catalog': 'ลบแคตตาล็อก',
'Delete Catalog Item': 'ลบรายการแคตตาล็อก',
'Delete Organization': 'ลบองค์กร',
'Departmen... | true |
fa7bb2e37bd4339a2dbc4ab761d64b08bbca8caf | Python | pfuntner/toys | /bin/procchain | UTF-8 | 1,288 | 2.609375 | 3 | [] | no_license | #! /usr/bin/env python3
import re
import os
import logging
import argparse
import subprocess
parser = argparse.ArgumentParser(description='Show process chain from current process')
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='Enable debugging')
args = parser.parse_args()
logging.... | true |
051b6cf31779c316082ce6d217f8e6a91d5328df | Python | sandyskim/bioinfo-algos | /hp2/basic_hasher.py | UTF-8 | 9,896 | 2.703125 | 3 | [] | no_license | import sys
import argparse
import numpy as np
import time
import zipfile
from collections import defaultdict
import pickle
from multiprocessing import Pool
import os.path
from os import path
start_time = time.time()
def parse_reads_file(reads_fn):
"""
:param reads_fn: the file containing all of t... | true |
f0381972dec40230f1513243abb75f63ee126110 | Python | shhuan/algorithms | /py/google/cj2015/round1C/__init__.py | UTF-8 | 825 | 2.765625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
created by huash06 at 2015-05-26 10:51
"""
__author__ = 'huash06'
import datetime
import sys
sys.stdin = open('input/-small-practice.in', 'r')
sys.stdout = open('output/A-small-practice.out', 'w')
# sys.stdin = open('input/A-large-practice.in', 'r')
# sys.stdout = open('output/A-large-pr... | true |
05a6badccfab16946579f40cf3e8c968f33d8b3e | Python | Hironobu-Kawaguchi/atcoder | /Codeforces/Codeforces1466_e_TLE.py | UTF-8 | 1,227 | 2.875 | 3 | [] | no_license | # https://codeforces.com/contest/1466/problem/E
MOD = 10**9+7
P = 60 # 2**60まで
def main():
n = int(input())
x = list(map(int, input().split()))
cnt = [0]*P # 2進数で合算 sum(f(x,c))
for i in range(n):
for j in range(P):
cnt[j] += (x[i] >> j) & 1
ans = 0
for i in ran... | true |
39554e170380e34831a4204e87d108ba009c33d0 | Python | havenshi/leetcode | /141. Linked List Cycle.py | UTF-8 | 863 | 3.515625 | 4 | [] | no_license | # Definition for singly-linked list.
# class ListNode(object):
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution(object):
def hasCycle(self, head):
"""
:type head: ListNode
:rtype: bool
"""
if not head or not head.next: # 0 or 1 it... | true |
26e4122eafb87981861cc958e74b03b43f1a40ca | Python | kaurrachneet6/ShowAndTell-neural-captioning | /Flickr/NIC_Test_5GRU.py | UTF-8 | 22,137 | 2.5625 | 3 | [] | no_license | '''
CS 598 Final Project: Show and Tell
Neural Image Captioning
Team Members: Avinash, Ankit Kumar, Daksh Saraf, Rachneet Kaur
Script to test the Encoder and Decoder model for Flickr Dataset
'''
import torch
import torchvision
import torchvision.transforms as transforms
import torchvision.models as models
from torch.a... | true |
24fbd248f7dc79de1c55b51b69f7202af23dfac7 | Python | oljikeboost/Tracking | /data_utils.py | UTF-8 | 13,676 | 2.53125 | 3 | [] | no_license | import os
import json
import glob
import shutil
import numpy as np
from sklearn.cluster import KMeans
import cv2
from collections import Counter
from tqdm import tqdm
def get_color(lbl):
if lbl==0:
return (0,0,255)
elif lbl==1:
return (0,255,0)
else:
return None
def post_process... | true |
096a1f103afafb9ddb83ac91ee271f9abf58728f | Python | Kishan-Jasani/Python | /02_Object_Oriented_Programming/09_Abstraction.py | MacCentralEurope | 1,536 | 4.6875 | 5 | [] | no_license | # What is Abstraction?
'''
Abstraction in Python is the process of hiding the real implementation of an application from the user and emphasizing only on usage of it.
For example, consider you have bought a new electronic gadget.
Along with the gadget, you get a user guide, instructing how to use the application, but... | true |
dbaf2674cf1deb535de3f0e39e585be8dc38c997 | Python | samdf96/myrepo | /clump_code_1/initialize.py | UTF-8 | 12,174 | 2.765625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 28 15:26:55 2018
@author: sfielder
"""
"""
This piece of code is run to data analyze simulation data
Manual Inputs:
- Overwrite protection: boolean
- True or False for if data is overwritten when code runs
- flist argument: string
... | true |
416f09dfbc35a793ba8c567f2d8ccf1ea106b143 | Python | mcruggiero/Code_and_Presentations | /python/Taoist_Learner/Tao.py | UTF-8 | 9,980 | 3.421875 | 3 | [] | no_license | # This is a fun little script I wrote to memorize the major system and the Stephen
# Mitchell translation Tao. Please do not use this code without my consent.
#All rights reserved.
# 2019
# michael@mcruggiero.com
import pandas as pd
import numpy as np
import os
os.system('cls' if os.name == 'nt' else 'clear')
Tao ... | true |
ff4ac967dc7cc13e23ba1519ba0326789979d680 | Python | s781825175/learnpython | /ExclusiveTimeofFunctions.py | UTF-8 | 754 | 3.0625 | 3 | [] | no_license | class Solution(object):
def exclusiveTime(self, n, logs):
"""
:type n: int
:type logs: List[str]
:rtype: List[int]
"""
a,b,c=[],[],[]
for i in logs:
n,typ,end=i.split(':')
n,end=int(n),int(end)
if typ == 'start':
... | true |
1c9c5132460dc8d05ef3f6932ee0ed78e6692872 | Python | Junebuggi/SYSC3010_TeamW4 | /RoughCode/RPIsender_of_RoomSensorInfo/RoomRPI_Class.py | UTF-8 | 11,827 | 2.78125 | 3 | [] | no_license | #Author: Abeer Rafiq
#Modified: 11/24/2019 9:08 am
#Importing Packages
import socket, sys, time, json, serial, Adafruit_DHT
import RPi.GPIO as GPIO
from datetime import datetime, date
#Creating a room rpi class
class RoomRPI:
#The constructor
def __init__(self, port, server_ip_addrs):
#Setting port
... | true |
5da2d3b70d04e05497c00bb25d2c63bb1dc11965 | Python | hi0t/Outtalent | /Leetcode/132. Palindrome Partitioning II/solution1.py | UTF-8 | 432 | 2.96875 | 3 | [
"MIT"
] | permissive | class Solution:
def minCut(self, s: str) -> int:
dp = [len(s) - i for i in range(len(s) + 1)]
p = [[False] * len(s) for j in range(len(s))]
for i in range(len(s) - 1, -1, -1):
for j in range(i, len(s)):
if s[i] == s[j] and (((j - i) < 2) or p[i + 1][j - 1]):
... | true |
15262ea9451c2c18bf690119cf5482f5acaa2d6a | Python | rpetit3/BIGSI | /scripts/jaccard_index.py | UTF-8 | 344 | 2.9375 | 3 | [
"MIT"
] | permissive | #! /usr/bin/env python
import begin
def load_all_kmers(f):
kmers = []
with open(f, 'r') as inf:
for line in inf:
kmer = line.strip()
kmers.append(kmer)
return set(kmers)
@begin.start
def run(f1, f2):
s1 = load_all_kmers(f1)
s2 = load_all_kmers(f2)
print(len(s... | true |
f32f8fd0694c6961b6323705093ed4a7e7b13838 | Python | lakiw/cripts | /cripts/hash_types/hash_type.py | UTF-8 | 680 | 2.5625 | 3 | [
"MIT"
] | permissive | ## HashType base class.
#
# All hash type plugins shall derive from this class. Class-based plugins enable
# multiple instantiations of a particular type of hash format information with
# potentially different requirements
#
class HashType(object):
## Initializes the basic HashType plugin values.
#
# Deriv... | true |
3c62c8db678f00246b9330b95fe252a6abeaef2f | Python | martinlyra/2DT301 | /components/light_component.py | UTF-8 | 565 | 2.71875 | 3 | [] | no_license | import time
from components.basic.ComponentBuilder import BuilderHint
from components.basic.base_component import BaseComponent
@BuilderHint("light")
class LightComponent(BaseComponent):
state = 0
def toggle(self, override=None):
if override is None:
if self.state == 0:
... | true |
a1c2b8f33b2443ba615901cb8b09b5631fc4cfa6 | Python | ryosuke071111/algorithms | /AtCoder/ABC/rakugaki.py | UTF-8 | 660 | 2.6875 | 3 | [] | no_license | # a,b,x=map(int,input().split())
# print(b//x-(a-1)//x)
# print("".join(list(map(lambda x:x[0],list(input().split())))))
# ls=[input() for i in range(3)]
# print(ls[0][0]+ls[1][1]+ls[2][2])
# a,b,c=map(int,input().split())
# print('Yes' if a+b>=c else "No")
# n=int(input())
# a=int(input())
# print('Yes' if n%500<=a el... | true |
670c17d6405078a7c1008d8012a4ab13f1fa8f9d | Python | Arjun-Ani/python_learn | /specialpattern-2.py | UTF-8 | 102 | 2.984375 | 3 | [] | no_license | a=raw_input("Enter the number\n")
b=lambda a:(int(a+a+a+a))+(int(a+a+a))+(int(a+a))+int(a)
print b(a)
| true |
8ee4759bed050908dca65e17b12e8efb2041b879 | Python | nandopedrosa/snglist | /app/models.py | UTF-8 | 11,609 | 2.625 | 3 | [] | no_license | """
models.py: Domain models
__author__ = "Fernando P. Lopes"
__email__ = "fpedrosa@gmail.com"
"""
from app import db, login_manager
from werkzeug.security import generate_password_hash, check_password_hash
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask.ext.login import UserMixin ... | true |
a572805525402e4fba6cd5ac169f18d8756406e1 | Python | KyleKing/My-Programming-Sketchbook | /Assorted_Snippets/python/socket_prototyping/server_makefile.py | UTF-8 | 1,059 | 2.6875 | 3 | [
"MIT"
] | permissive | """Based on https://stackoverflow.com/q/59978887/3219667.
Update: not working. May want to revisit
"""
import socket
from loguru import logger
HOST = '127.0.0.1'
PORT = 65439
ACK_TEXT = 'text_received'
def main():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.setsockopt(socket... | true |
5a9a3288a497020de54d83b0e428804dce443279 | Python | harveymei/pythoncrashcourse | /formatted_name2.py | UTF-8 | 887 | 4.09375 | 4 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2020/12/1 11:10 上午
# @Author : Harvey Mei <harvey.mei@msn.com>
# @FileName: formatted_name2.py
# @IDE : PyCharm
# @GitHub :https://github.com/harveymei/
# 避免无限循环,加入退出条件
# Define a quit condition
def get_formatted_name(first_name, last_name):
"""Return... | true |
e6ed1d5058717baa542799cc6d3252e96c17a680 | Python | witnessai/MMSceneGraph | /mmdet/patches/visualization/color.py | UTF-8 | 1,616 | 3.09375 | 3 | [
"MIT",
"Python-2.0"
] | permissive | # ---------------------------------------------------------------
# color.py
# Set-up time: 2020/4/26 上午8:59
# Copyright (c) 2020 ICT
# Licensed under The MIT License [see LICENSE for details]
# Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT
# Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com
# -... | true |
808e29e9c6d1aa0768d65144832f1f10f659d537 | Python | dennis2030/leetcodeStudyGroup | /406-queue-reconstruction-by-height/Sony_1.py | UTF-8 | 808 | 3.328125 | 3 | [] | no_license | class Solution(object):
def reconstructQueue(self, people):
"""
:type people: List[List[int]]
:rtype: List[List[int]]
"""
result = []
tall_list =[]
tall_map = dict()
for person in people:
tall = person[0]
if tall not in tall_map... | true |
1eeb2d48325b71b40cae51112084744e45a2477f | Python | jpisarek/JWT | /models.py | UTF-8 | 2,227 | 2.53125 | 3 | [] | no_license | from run import db
from sqlalchemy.orm import relationship
class UserModel(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key = True)
username = db.Column(db.String(120), unique = True, nullable = False)
password = db.Column(db.String(120), nullable = False)
def save_to... | true |
8d6a92ca46671a82d767b6e501980944ddae86f8 | Python | kqvd/IFB104-2017 | /Assignment 2 - News Archivist/news_archivist.py | UTF-8 | 38,190 | 2.859375 | 3 | [] | no_license |
#-----Statement of Authorship----------------------------------------#
#
# This is an individual assessment item. By submitting this
# code I agree that it represents my own work. I am aware of
# the University rule that a student must not act in a manner
# which constitutes academic dishonesty as stated ... | true |
b33c213d6b70f541a837bcd444d90265ef208cea | Python | LibreGamesArchive/galaxymageredux | /lib/gui/messagebox.py | UTF-8 | 656 | 2.65625 | 3 | [] | no_license | import label, container, misc
class MessageBox(container.Container):
widget_type = 'MessageBox'
def __init__(self, parent, pos, size, name=None):
container.Container.__init__(self, parent, pos, size, name)
def set_top_widget(self, widget):
pass
def add_line(self, text):
... | true |
94b839f1bb65660cc5e17f0aecf9bf2c128ff355 | Python | ykaw/PiCW | /tests/iambic.py | UTF-8 | 3,193 | 2.671875 | 3 | [] | no_license | #!/usr/bin/python3
import pigpio
import time
import threading
import readline
# initialization of GPIO
#
pi=pigpio.pi()
if not pi.connected:
exit()
port_dit=23
port_dah=24
pi.set_mode(port_dit, pigpio.INPUT)
pi.set_mode(port_dah, pigpio.INPUT)
pi.set_pull_up_down(port_dit, pigpio.PUD_UP)
pi.set_pull_up_down(po... | true |
f1a5dc64d3ec6c0f4c71b30235923f758048174f | Python | evinpinar/competitive_python | /leetcode/41.py | UTF-8 | 1,631 | 3.5 | 4 | [] | no_license |
def firstMissingPositive(nums):
## Find smallest missing positive integer
mini = float("inf")
for num in nums:
if num>0:
mini = num
break
for num in nums:
if num>0 and num < mini:
mini = num
maxi = nums[0]
for num in nums:
if num>0... | true |
1c208f1ad698529739c1813cab89198488f9d4b6 | Python | Ewan-Selkirk/Advent-of-Code-2020 | /src/day2/day2.py | UTF-8 | 1,784 | 3.3125 | 3 | [] | no_license | psw_req = []
psw_char = []
psw = []
count = 0
def check_password(p_min, p_max, char, password, debug):
if int(p_min) <= password.count(char) <= int(p_max):
if debug:
print(password, "is a valid password!")
return True
else:
if debug:
print(password,... | true |
c69e199c3323fa7df0fdb2bd1740e3cac4b7655f | Python | maciexu/data_manipulation_with_pandas | /Slicing_indexing.py | UTF-8 | 5,232 | 4.625 | 5 | [] | no_license | """ why index?--->>> index can use loc --->>>
Setting an index allows more concise code for subsetting for rows of a categorical variable via .loc[]
"""
# Example 1
# Look at temperatures
print(temperatures)
# Index temperatures by city
temperatures_ind = temperatures.set_index("city")
# Look at temperatures_ind... | true |
410a46591843e2f56f78829ea98af4fe6247fca6 | Python | katie-mata/aoc | /day1/day1.py | UTF-8 | 670 | 3.3125 | 3 | [] | no_license | #!/usr/bin/env python3
import itertools
import operator
from functools import reduce
def read_input_file(filename):
with open(filename, 'r') as f:
return f.readlines()
def parse_input(input):
return list(map(int, input))
def find_tuples(numbers, tuple_len):
combinations = itertools.combinations(... | true |
8fdca9211705a9508d1d2f170e52c629adcf5d55 | Python | EriKKo/adventofcode-2018 | /12/a.py | UTF-8 | 614 | 2.90625 | 3 | [] | no_license | import sys
lines = [l.strip() for l in sys.stdin]
s = lines[0].split()[2]
m = {}
for i in range(len(s)):
if s[i] == '#':
m[i] = True
trans = {}
for l in lines[2:]:
a,b = l.split(" => ")
trans[a] = b == "#"
def simulate(state):
start = min(state.keys()) - 2
end = max(state.keys()) + 2
newState = {}
fo... | true |
47506d12cbc08a3fba76f8419a92c9f3ba0f89fb | Python | TWoolhouse/Python | /Project/Remote/host.py | UTF-8 | 610 | 2.59375 | 3 | [
"MIT"
] | permissive | import libs
import node
import sound
import time
vol = sound.Volume(15)
media = sound.Media()
def volume(self, volume, rel):
try:
print("Volume:", vol.set_volume(int(volume), True if rel == "True" else False))
self.send(vol.volume(), "vol")
except ValueError: pass
def prev(self):
media.pr... | true |
df82300e17423731f91320a071b8fa945422f4b4 | Python | Success2014/Leetcode | /majorityElement.py | UTF-8 | 3,776 | 4.3125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 16 14:10:50 2015
Given an array of size n, find the majority element.
The majority element is the element that appears more than ⌊ n/2 ⌋ times.
You may assume that the array is non-empty and the majority element always
exist in the array.
Tags: Divide and Conquer Arra... | true |
7e784bbfc674d2a5e3e734584b194efba44f2cdc | Python | git123hub121/Python-analysis | /数据化分析-豆瓣/flask_douban/testCloud.py | UTF-8 | 857 | 2.96875 | 3 | [] | no_license | import jieba #分词
from matplotlib import pyplot as plt #绘图,数据可视化
from wordcloud import WordCloud #词云
from PIL import Image #图片处理
import numpy as np #矩阵运算
import sqlite3 #数据库
con = sqlite3.connect('movie.db')
cur = con.cursor()
sql = 'select instroduction from movie250'
data = cur.execute(sql)
text = ""
for it... | true |
18ebf0e2c41bfa7b05db8692731a7175f31c1614 | Python | cirosantilli/python-cheat | /re_cheat.py | UTF-8 | 3,975 | 3.375 | 3 | [] | no_license | #!/usr/bin/env python3
'''
https://docs.python.org/3/library/re.html
'''
import re
if '## Syntax':
if '## Lookahead':
# Don't eat front part or regex
p = re.compile(r'a.')
assert p.sub('0', 'abaac') == '00c'
p = re.compile(r'a(?=.)')
assert p.sub('0', 'abaac') == '0b00... | true |
5112c4f5c46b38bba7246fcd524547aad6bd0ad5 | Python | Linus-MK/AtCoder | /AtCoder_unofficial/iroha2019_day1_f.py | UTF-8 | 1,049 | 3.6875 | 4 | [] | no_license | def factorize(n):
'''
素因数分解をする。
タプルの配列にしようと思ったけど、逐次割り算する過程で次数を増やせないじゃん。
二重配列?
dictにしよう。
'''
if n == 1:
raise('n >= 2')
factor = {}
div = 2
while True:
if div * div > n:
factor[n] = factor.get(n, 0) + 1
return factor
if n % div... | true |
232919676fe30251686df94a145bb9e14ce25489 | Python | techtronics/project-ML | /scripts/filetolist.py | UTF-8 | 123 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
import sys
d = []
with open(sys.argv[1]) as f:
for line in f:
d.append(line.rstrip())
print d
| true |
1ede7636918ecfede7130a9b862eafa14947c337 | Python | rafaelwitter/SelfLearning | /spreadsheet.py | UTF-8 | 686 | 3.0625 | 3 | [] | no_license | import gspread
from oauth2client.service_account import ServiceAccountCredentials
# use creds to create a client to interact with the Google Drive API
scope = ['https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(cred... | true |
ce534bf9030bf3d95ea99a712783254f9a62bd6c | Python | sangwoo7957/Algorithm | /Baekjun17404.py | UTF-8 | 658 | 2.734375 | 3 | [] | no_license | import sys
n = int(input())
s = []
for _ in range(n):
s.append(list(map(int, input().split())))
result = sys.maxsize
for color in range(3):
dp = [[0 for _ in range(n)] for _ in range(3)]
for i in range(3):
if i == color:
dp[i][0] = s[0][i]
continue
dp[i][0] = sys.ma... | true |
2bf19b3f1908ff9a09cafd5da82a20db1cb1efe8 | Python | feelosophy13/buildwithme | /sessionDAO.py | UTF-8 | 2,240 | 2.90625 | 3 | [] | no_license | import sys
import random
import string
import bson
## The session Data Access Object handles interactions with the sessions collection
class sessionDAO:
def __init__(self, database):
self.db = database
self.sessions = database.sessions
def start_session(self, userID, firstname):
ses... | true |
3793cd2cbaaec1f44bbfc262f1f9326a8d034a73 | Python | hermelandocp/tarea1 | /algoritmo1.py | UTF-8 | 365 | 3.53125 | 4 | [] | no_license | nombre_usuario_uno= input("ingresa tu nombre: ")
edad_usuario_uno= input("ingresa tu edad: ")
nombre_usuario_dos = input ("ingresa tu nombre: ")
edad_usuario_dos= input ("ingresa tu edad: ")
if edad_usuario_uno > edad_usuario_dos :
print ("la persona mas grande es: " + nombre_usuario_uno)
else:
print ("la per... | true |
5f68f817a2002f3cd75bf1309d5a4ea4cf5eb3e7 | Python | diserdyuk/parse_finance_yahoo_most_actives | /finance_yahoo.py | UTF-8 | 2,195 | 3.28125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import csv
def get_html(url): # requests and response from url
r = requests.get(url)
if r.ok: # catch
return r.text
print(r.status_code)
def write_csv(d): # function write data to csv
with open('finance_yahoo.csv', 'a') as f:
... | true |
03b4424c018b525661c3fadac52ff37ff708eac9 | Python | kspar/moodle-fetch-test | /tester.py | UTF-8 | 1,352 | 2.890625 | 3 | [] | no_license | from grader import *
from rattad import *
from random import randint
FUNCTION_NAME = 'vahimatest_suurim'
def solution(mat):
return max([min(row) for row in mat])
def random_matrix():
rows = randint(1, 10)
cols = randint(1, 5)
result = []
for i in range(rows):
row = []
for j in ran... | true |
982bb2d818544fa35f1d6ff349dc0760f3bfb0c0 | Python | theadamsacademy/python_tutorial_for_beginners | /18_lists/3_functions.py | UTF-8 | 367 | 4.21875 | 4 | [] | no_license | names = ["Mike", "Kate", "Dan"]
# Length
print(len(names))
# Check if item exists
if "Kate" in names:
print("Kate is in the list")
# Add item
names.append("Dave")
names.insert(2, "Dave")
# Remove item
names.remove("Kate")
print(names.pop())
del names[2]
del names[1:3]
names.clear()
# Join lists
names = names +... | true |
3117905af733cb806f81c58b5d64b4c3dff13181 | Python | inthescales/lyres-dictionary | /src/diachron/table.py | UTF-8 | 989 | 3.15625 | 3 | [
"MIT"
] | permissive | class TableColumn:
def __init__(self, title, elements):
self.title = title
self.elements = elements
def make_table(columns):
output = "<body>\n"
style = '"border: 1px solid black;"'
if not style:
output += "<table>\n"
else:
output += "<table style=" + style + ">\n"
... | true |
47ee788a740abaa47f077b225df014c19e07d0a3 | Python | dinnozap/MinecraftServerMaker | /main.py | UTF-8 | 973 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
########################################
### Minecraft Server Maker #############
### Create Your Own Minecraft Server ###
########################################
from commun import *
import os
import subprocess as sub
if os.path.isfile("install.py"):
os.remove("install.py")
else:
pass
... | true |
b0049225b6f7d906ad1aa692cc021795d554acc5 | Python | jonatanbarkan/loop | /cropper.py | UTF-8 | 3,468 | 2.890625 | 3 | [] | no_license | from __future__ import division
import numpy as np
import cv2
import random
import faces
class Cropper(object):
def __init__(self, window_rows, window_cols, resolution, center1=0, center2=0):
# window_rows is the rows step size we want the sliding window to have
# window_cols is the co... | true |
c9ea40dfc929e4a88de7328f8f6428b86a23a890 | Python | Hectorline/WebAppETSEIB | /app/scripts/calculs.py | UTF-8 | 4,861 | 3.03125 | 3 | [] | no_license | import time
def time_this(func):
"""The time_this decorator"""
def decorated(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
print(func.__name__ + ' rained in', (time.time() - start)*1000, 'ms')
return result
return decorated
@time_th... | true |
73bd7e85738352db16b7158ebbdd590638cac38f | Python | jaybubs/pyprj | /misc/even_fibonacci_numbers.py | UTF-8 | 321 | 3.5 | 4 | [] | no_license | def fib(x,y):
z = x+y
return(z)
def evens():
x=1
y=1
d=0
sm=0
while d<4000000:
d=fib(x,y)
print('x: '+str(x)+' y: '+str(y)+' d: '+str(d))
if d%2==0:
sm+=d
print('i summed here: ' +str(sm))
x=y
y=d
return(sm)
print(evens())... | true |
89f357ee0611eda2fd08ee533c92b53ab1147075 | Python | baubrun/Python-Workbook | /Discount_Table/test_discount_table.py | UTF-8 | 746 | 2.984375 | 3 | [] | no_license | import pytest
from .discount_table import discount_table
@pytest.mark.parametrize("price, expected", [
([4.95, 9.95, 14.95, 19.95, 24.95], (
"Original:\t{:.2f}\tDiscount:\t{:.2f}\tNew:\t{:.2f}".format(4.95, 2.97, 1.98) +
"\nOriginal:\t{:.2f}\tDiscount:\t{:.2f}\tNew:\t{:.2f}".format(9.95, 5.97, 3.98... | true |
eb77a9d65e7f3ded95daa45e38b0aee205673df7 | Python | tutunak/codewars | /python/4 kyu/IP Validation.py | UTF-8 | 755 | 3.84375 | 4 | [] | no_license | # Write an algorithm that will identify valid IPv4 addresses in dot-decimal format. IPs should be considered valid if
# they consist of four octets, with values between 0..255 (included).
#
# Input to the function is guaranteed to be a single string.
#
# Examples
# // valid inputs:
# 1.2.3.4
# 123.45.67.89
#
# // inval... | true |
985c8696a8cbf5de8dde9e106abbd12af0285b6d | Python | damiankoper/ripo | /video_processor/src/processors/Classification.py | UTF-8 | 7,553 | 2.578125 | 3 | [] | no_license | import numpy as np
import random
import pickle
import cv2
import os
import pickle
from tensorflow import keras
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
from imutils import paths
import time
class Classificati... | true |
78d9a47a85c631126f39dfb6e3c44b4297fafb48 | Python | Relph1119/deep-learning-with-python-notebooks | /tensorflow_V2_src/ch03/3-4-classifying-movie-reviews.py | UTF-8 | 2,820 | 3.296875 | 3 | [
"MIT",
"GPL-3.0-only"
] | permissive | #!/usr/bin/env python
# encoding: utf-8
"""
@author: HuRuiFeng
@file: 3-4-classifying-movie-reviews.py
@time: 2020/4/9 14:48
@project: deep-learning-with-python-notebooks
@desc: 3.4 电影评论分类:二分类问题
"""
import matplotlib.pyplot as plt
import numpy as np
from tensorflow.keras import models, layers, losses, metrics, optimiz... | true |
f4b5742b1c8b9ba3672d5eefb8da60ff4aaa3056 | Python | Lyechen/leetcode-python | /leetcode_002.py | UTF-8 | 2,505 | 3.921875 | 4 | [] | no_license | """
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Ex... | true |
55d25a9c0f0a0a3e4bedc027427e6b20bf7c6d8d | Python | olivatooo/redes-final-2019 | /myslip.py | UTF-8 | 2,131 | 2.859375 | 3 | [] | no_license | class CamadaEnlace:
def __init__(self, linhas_seriais):
self.enlaces = {}
for ip_outra_ponta, linha_serial in linhas_seriais.items():
enlace = Enlace(linha_serial)
self.enlaces[ip_outra_ponta] = enlace
enlace.registrar_recebedor(self.callback)
def registrar_r... | true |
a2ff1299efbbd5ae14a8beb99678baf896a83694 | Python | YashChitgupakar9/practice | /014.py | UTF-8 | 259 | 3.0625 | 3 | [] | no_license | #print(dir(tuple))
t = ("yash","rishab","aarti","milind",[2,3,4,5])
t[4].append(6)
print(t)
t1 =('messi','ronaldo','herrera','martial',[{"england":'epl',"spain":"laliga","germany":"bundesliga","france":"ligue1","italy":"seriea"}])
print(t1[4][0]["france"])
| true |
97d08a831d0cc8b2953a08613d9524000cccee52 | Python | ikwon176/ENGI301 | /Assignment_05/blink_USR3.py | UTF-8 | 2,594 | 2.671875 | 3 | [] | no_license | """
--------------------------------------------------------------------------
Blink USR3 LED
--------------------------------------------------------------------------
Credits:
The BeagleBone IO Python library was originally forked from the excellent
MIT Licensed RPi.GPIO library written by Ben Croston.
Basic struct... | true |
197317a1e0a4fd1c24c465b11c552d646678e784 | Python | hyuhyu2001/Python_oldBoy | /src/Day006/Procuder_demo2.py | UTF-8 | 1,649 | 3.40625 | 3 | [] | no_license | #!/user/bin/env python
#encoding:utf-8
'''
函数式编程实现生产者消费者模型
生产者消费者最大特点:为了解耦,解耦就是让程序各个模块之间关联性降到最低
买包子,但是需要等指定厨师做包子,这样便产生了阻塞
但有收银员(Queue,消息队列)后,客户不关心哪个厨师做包子,厨师不关心哪个客户买,这个便是非阻塞模式(支持并发,支持忙闲不均)
再高级一点,客户不用等5分钟,等我做好了包子,我告诉你(即是异步模型)
'''
import threading,time,Queue #不规范写法,正常需要些3行
import random
def Proudcer(name,qu... | true |
c324d1817d44956243279c8a189ca39cb7ef411b | Python | pparmesh/Delta-Autonomy | /delta_rc_car/delta_perception_rc_car/test/cluster_test.py | UTF-8 | 1,683 | 2.71875 | 3 | [
"BSD-3-Clause"
] | permissive | # -*- coding: utf-8 -*-
# @Author: Heethesh Vhavle
# @Date: Nov 20, 2019
# @Last Modified by: Heethesh Vhavle
# @Last Modified time: Nov 20, 2019
import numpy as np
import matplotlib.pyplot as plt
from pyclustering.cluster.dbscan import dbscan
from pyclustering.cluster import cluster_visualizer
from features impo... | true |