blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
9bf7f031076168b58c6b2089b82b8ca0e8711e75 | rams1996/Daily-coding-assignments | /longest-palindrome/longest-palindrome.py | UTF-8 | 468 | 2.703125 | 3 | [] | no_license | class Solution:
def longestPalindrome(self, s: str) -> int:
count=defaultdict(int)
odd=0
total=0
for i in range(len(s)):
count[s[i]]+=1
if count[s[i]]==2:
count[s[i]]=0
total+=2
odd-=1
else:
... | true |
a62ec9927641dee3369ec211b9f0168fe383f3e5 | apurbapokharel/Reinforced-Learning | /maze/myMaze.py | UTF-8 | 6,147 | 2.765625 | 3 | [] | no_license | import pygame
import numpy as np
import random
from time import sleep
block = [(3, 0), (1, 1), (6, 1), (2, 2), (5, 2), (2, 3), (6, 3), (0, 4), (1, 4), (6, 4), (6, 5), (3, 5), (1, 6), (3, 6), (4, 6), (6, 6)]
end = (6, 7)
start = (0, 0)
class State:
def __init__(self, currentPos = start):
self.currentPos = c... | true |
a8413dcdd4dbc04f2679d02e304322f1422f985d | Somnus1990/gridcell | /gridcell/shapes.py | UTF-8 | 15,799 | 3.109375 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python
"""File: shapes.py
Module defining objects for geometric shapes, with attributes to retrieve
parameters characterizing the shapes, and plotting methods to include the
shapes matplotlib figure.
"""
# Copyright 2015 Daniel Wennberg
#
# Licensed under the Apache License, Version 2.0 (the "License")... | true |
66ba5e367f70e1d2c3b21f7cb57c7e0a01bb3523 | fikryjay17/Tugas-Pemrograman-Berorientasi-Objek | /Muhammad_Fikry.py | UTF-8 | 1,265 | 3 | 3 | [] | no_license | class Handphone:
def __init__(self, Warna, RAM, Merk):
self.Warna = Warna
self.RAM = RAM
self.Merk = Merk
def printname(self):
print(self.Warna)
print(self.RAM)
print(self.Merk)
class IOS(Handphone):
def __init__(self, Warna, RAM, Merk):
... | true |
63af849608616a8d6b43f31a72a6ccf50b6c2521 | kaylezy/Batch-Three | /Lekki/Python/DocumentCounter.py | UTF-8 | 278 | 3.59375 | 4 | [] | no_license | str=input("input your document")
d=l=s=o=0
for c in str:
if c.isdigit():
d = d + 1
elif c.isalpha():
l = l + 1
elif c.isspace():
s = s + 1
else:
o = o + 1
print("letters", l)
print("digits", d)
print("space", s)
print("other", o)
| true |
9a4523ed5d2757e15064ba5fa08583628f850e55 | misaka-10032/PoseClassification | /test/show_single.py | UTF-8 | 2,190 | 2.890625 | 3 | [] | no_license | #!/usr/bin/python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
#INPUT_IMAGE = os.path.join(CURRENT_DIR, '../../../data/xiyuan/positive_images/Subject01_A_01_+05.jpg')
INPUT_IMAGE = os.path.join(CURRENT_DIR, 'frame.jpg')
INPUT ... | true |
f29f4c29977f7327313e8d1a05a3e15613031d81 | wmkouw/cc-smoothprior | /experiments/tests/test_vGMM_oldfaithful.py | UTF-8 | 1,571 | 2.84375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test variational GMM implementation on Old Faithful data set.
Author: W.M.Kouw
Date: 05-11-2018
"""
import pandas as pd
import numpy as np
import numpy.random as rnd
import numpy.linalg as alg
import scipy.optimize as opt
import scipy.stats as st
from vGMM import vari... | true |
a2f4b9984c03a06efd29e6208b7244a512af8c41 | saar4vardi/pythonClass1 | /SaarFirstClass/9.1TimeDay.py | UTF-8 | 2,243 | 3.984375 | 4 | [] | no_license | """9.1"""
from datetime import *
from time import *
# name = input("enter your name: ")
# age = int(input("enter your age: "))
# g = datetime.now()
# year = g.strftime("%Y")
# year = int(year) + 100 - age
# print(year)
"""9.2"""
# t = datetime.now()
# america = t.strftime("%d/%m/%y")
# europe = t.strftime("%m/%d/%y")... | true |
9b6aa601931acb276e3e462250c8be4d494e98c7 | DevGra/scrap_capes_transparencia | /selenium_ocr.py | UTF-8 | 2,752 | 2.6875 | 3 | [] | no_license | from selenium import webdriver #For Selenium Web Driver
import os #For executing terminal commands as well as accessing directory
import requests #For Session
from time import sleep
url_main = "http://transparencia.capes.gov.br/transparencia/xhtml/index.faces" #Target Url
# url_sec = "http://transparencia.capes.gov.br... | true |
d76bd02893cd751d1ff102d147180d7185767a9b | z5ar/FirstProject | /Translate/Translate.py | UTF-8 | 648 | 2.90625 | 3 | [] | no_license | import programs.Decode as d
import programs.Encrypt as e
from os import system as osys
from platform import system as psys
def func():
print('''请选择:
0->“加密”
其他->“解密”''')
choice=input()
if psys()=="Windows":
osys("cls")
else:
osys("clear")
if choice=='0':
e.func()
else:
... | true |
4aaf2cd68626330576133a2d33e25c3b249a99bb | DaleMcGrew/WeVoteServer | /apis_v1/documentation_source/ballot_item_retrieve_doc.py | UTF-8 | 3,535 | 2.515625 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | # apis_v1/documentation_source/ballot_item_retrieve_doc.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
def ballot_item_retrieve_doc_template_values(url_root):
"""
Show documentation about ballotItemRetrieve
"""
required_query_parameter_list = [
{
'name': '... | true |
c1dc4f5d1af7d0dbf905624fcdb07d782abe83e6 | pombredanne/package-downloader | /pkg-downloader/pkg_downloader.py | UTF-8 | 3,393 | 2.671875 | 3 | [
"MIT"
] | permissive | import zipfile
import argparse
import os
import urllib
import urlparse
import json
global asset_size
asset_size = -1
def show_progress(block_count, block_size, file_size):
global asset_size
size = asset_size if file_size == -1 else file_size
if size >= 0:
progress_string = str(min(
block_count * block_size ... | true |
2bb64ff2a2b974d0f573ea6d2752b2c0ddf428e8 | AshnaJin/BCG_CaseStudy | /src/jobs/veh_make_injury_4.py | UTF-8 | 2,084 | 3.15625 | 3 | [] | no_license | import pyspark.sql.functions as F
from pyspark.sql.window import Window
from utils import Utils
class VehicleMake:
"""
Analysis 4: Which are the Top 5th to 15th VEH_MAKE_IDs that
contribute to a largest number of injuries including death
"""
def __etl(self, session, data_source):
"""
... | true |
0e5bfcc51ba12a999e70911c49ebcfef155b9441 | DolanDark/Socket | /server.py | UTF-8 | 1,303 | 2.859375 | 3 | [] | no_license | import socket
import threading
PORT = 5050
#SERVER = "192.168.31.195"
SERVER = socket.gethostbyname(socket.gethostname())
ADDRESS = (SERVER,PORT)
HEADER = 64
FORMAT = 'utf-8'
DISCONNECT_MESSAGE = "!DISCONNECT"
print(SERVER)
print(socket.gethostname())
server = socket.socket(socket.AF_INET, socket.SOC... | true |
de1c95da0668bdfeadc394ff06d7b8ad77a92189 | dmellosnehal23/Projects | /MOOC/mooc-ws/user.py | UTF-8 | 2,308 | 2.6875 | 3 | [] | no_license | '''
Created on May 1, 2013
@author: SNEHAL D'MELLO
'''
#import from mongodb
from pymongo import Connection
from django.core.exceptions import ValidationError
from course import Course
class User(object):
db = None
'''
classdocs
'''
#constructor
def __init__(self):
self.conne... | true |
672611cae7741b55aeffafe00d98a6a0184d96dd | jiaying-yan/test | /read_lines.py | UTF-8 | 695 | 2.734375 | 3 | [] | no_license | import argparse
import os
import sys
from pathlib import Path
import json
def main(args):
parser = argparse.ArgumentParser(description='Returns sum of two arguments')
parser.add_argument("--read_name", type=str, required=True) # List Item
args = parser.parse_args(args)
print("images:zjr123/read_op:tes... | true |
684cf46f5a6f27a2663f950485b52e6857c1a784 | flysall/OJ | /leetcode/0121-maxProfit.py | UTF-8 | 348 | 3.109375 | 3 | [] | no_license | class Solution:
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
res, cur_max = 0, 0
for i in range(1, len(prices)):
cur_max += prices[i] - prices[i-1]
res = max(cur_max, res)
cur_max = 0 if cur_max <= 0 else... | true |
b275da2a4c3e42391c2ad95b0fed4969ede2455e | ShunqiangBian/lane_detect | /inference.py | UTF-8 | 2,167 | 2.515625 | 3 | [] | no_license | import os
import cv2
import torch
import numpy as np
from model.deeplab import DeepLab
from model.unet import ResNetUNet
from utils.image_process import LaneDataset, ToTensor
from utils.process_labels import decode_color_labels
from torchvision import transforms
from torch.utils.data import DataLoader
from tqdm import ... | true |
7e6f4dd0b90ef5272c3a7a0c5b2f0bc254d35fef | jackBonadies/LCCver1 | /sql.py | UTF-8 | 3,457 | 2.6875 | 3 | [] | no_license | import sqlite3
class DB_SESSION:
def __init__(self,conn):
self.conn=conn
self.cur=self.conn.cursor()
def _query(self,q="""SELECT * from invoices"""):
self.cur.execute(q)
return self.cur.fetchall()
def _find_products(self,val):
print (val)
self.cur.execute("s... | true |
ac5b4ff5f0381c58f321a6b25c6097e61138746f | Luli4n/Bayess_Spam_Filter | /WordSet.py | UTF-8 | 940 | 3.234375 | 3 | [] | no_license | import pandas as pd
class WordSet:
def __init__(self, filepath, separator):
try:
self.set_table = pd.read_csv(filepath, sep=separator,
names=['Type', 'Text'], )
except:
print("Blad wczytania pliku " + filepath)
quit()
... | true |
edc4f16b8c0f237ca16d16f1046517ad911731e6 | u101022119/NTHU10220PHYS290000 | /projects/OH_MY_BANANA/game.py | UTF-8 | 23,303 | 3.046875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat May 31 15:29:34 2014
@author: Saber
"""
import sys,time,pygame,math,random
from pygame.locals import *
from numpy import *
pygame.init()
#mouse collition --------------------------------------------
def mouseclick(x,y,x1,y1,x_,y_):
if x>x1 and x<x1+x_:
if y>y1 a... | true |
bbd89c45d2f9868503914bf5c2d55762731fbb24 | hirosuzuki/atcoder-2020 | /abc192/abc192_a.py | UTF-8 | 56 | 2.75 | 3 | [] | no_license | X = int(input())
result = 100 - X % 100
print(result)
| true |
140796b6ea5661400ed6fcab636d38a9b236fd15 | bpaszko/TIN-Proxy | /tests/test_thread.py | UTF-8 | 843 | 2.71875 | 3 | [] | no_license | import os
import thread
python_str = 'python'
path = os.path.abspath('plc_write3.py')
#path2 = os.path.abspath('plc_write2.py')
start_port = 10000
s_start_port = 20000
register = 2000
value = 120
def send_request(path, port, register, value):
for i in range(10):
command = ' '.join([python_str, path, str(registe... | true |
78c1527d35d3f765e8dce3b334d8c1bd596437d0 | RobertHostler/TCP-Server | /tcpserver1.py | UTF-8 | 3,701 | 3.09375 | 3 | [] | no_license | import socket
import crypt
def login(client, socket):
password_tries = 3
while password_tries > 0:
client.send("Please enter your username:".encode("utf-8"))
username_try = client.recv(1024).decode("utf-8")
client.send("Please enter your password:".encode("utf-8"))
password_try... | true |
471f340ba76a8ca8e2a871419f2a55959491187d | voropaevp/NBU_App | /default/bin/wrapper_utils.py | UTF-8 | 1,496 | 2.921875 | 3 | [] | no_license | import subprocess, threading
import os
import signal
import tempfile
import sys
class Command(object):
#arguments - arguments to execute in subprocess.Popen
def __init__(self, args, debug = False, logger = None):
self.args = args
self.process = None
self.success = True
self.debu... | true |
cfbb61d02b85d538ccface01c6a19871cfb9d9c0 | cdeeran/witty | /src/dataManager.py | UTF-8 | 6,707 | 3.4375 | 3 | [
"MIT"
] | permissive | import time
import pandas as pd
from pathlib import Path
import constants
from queue import Queue
from threading import Thread
import subprocess
class DataManager():
'''
This class manages all saving and exporting of data
for witty
'''
def __init__(self):
'''
Initialize the DataMa... | true |
f0aa18e7add24611c421ff83c72c1e92d2411171 | MiHHuynh/rmotr-intro-to-python | /GettingStarted/check_out_of_boundaries.py | UTF-8 | 310 | 4.25 | 4 | [] | no_license | # Check out of boundaries
# Define a function check_out_of_boundaries that receives a number and returns
# True if it is greater than 10 OR less than 0 and False otherwise.
# Examples:
# >>> check_out_of_boundaries(7)
# False
# >>> check_out_of_boundaries(12)
# True
# >>> check_out_of_boundaries(-3)
# True | true |
ca5416e78355ec03963bfe20f2f31c119863c2e7 | chungonion/codeforces | /Q1089L.py | UTF-8 | 1,062 | 2.734375 | 3 | [] | no_license | from itertools import zip_longest
from operator import itemgetter
def persuade(idler_nos, job_nos, job_chosen, idlers_persuade_time):
persuade_time = 0
job_chosen_nos = 0
job_item_chosen = {}
job_tuples = sorted(list(zip_longest(job_chosen, idlers_persuade_time)), key=itemgetter(1), reverse=True)
... | true |
40f1f3a9555b873a7244816d12f48b2de9ccc64c | samhaldenby/HLA | /hla/align.py | UTF-8 | 26,702 | 2.78125 | 3 | [] | no_license | import math
import logging
from hla.utils import *
import commands
'''
Created on 17 May 2012
@author: sh695
'''
class Aligner(object):
'''
for carrying out alignments and storing subsequent data.
NB: This is an abstract base class. Use either DnaAligner or AaAligner
'''
_counts = {}#{cluste... | true |
f760fe5cd37bf2fa571a8c3b9b2db6e52b566fd4 | HDFGroup/hsds | /tests/perf/nrel/wtk/wtk_conus.py | UTF-8 | 5,142 | 2.640625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import random
import os
import sys
import time
import logging
from multiprocessing import Pool
import s3fs
import h5py
import h5pyd
cfg = {}
def get_argval(arg):
# get text after '=' char
fields = arg.split("=")
if len(fields) != 2:
raise ValueError(f"Unexpected argument: {arg}")
return field... | true |
0faa89c09506c7e1ef031f06f034f4b9ac7febc2 | Sunnyfred/Machine-Learning-Models | /ML_models/Polynomial_regression_model.py | UTF-8 | 6,044 | 3.171875 | 3 | [
"MIT"
] | permissive | import numpy as np
import pandas as pd
import math as m
import matplotlib.pyplot as plt
def train_test_split_po(X, Y, train_size, shuffle):
''' Perform tran/test datasets splitting '''
if shuffle:
randomize = np.arange(len(X))
np.random.shuffle(randomize)
X = X[randomize]
... | true |
7ebd9c565dcab48d8d896230c71e92a36d3863e0 | OnlinePhylo/sts-online-experiments | /comparison_to_mrbayes/bin/sts_to_nexus.py | UTF-8 | 1,423 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python
import argparse
import json
import logging
import math
import sys
import dendropy
def parse_weighted_trees(fp, **kwargs):
max_log_weight = -sys.float_info.max
trees = []
jtrees = json.load(fp)
for i, tree in enumerate(jtrees['trees']):
sys.stderr.write('{0:10d}\r'.format(... | true |
740a1459b16668e73370a3a1fc2978d2a69aeeaf | Jaxwood/daily | /problems/problem018.py | UTF-8 | 440 | 3.5625 | 4 | [] | no_license | def maximum_value(arr: [int], k: int) -> [int]:
"""Given an array of integers and a number k, where 1 <= k <= length of
the array, compute the maximum values of each subarray of length k."""
m = []
res = []
for i in range(len(arr)):
if len(m) == k:
res.append(max(m))
if l... | true |
4ff73847d997ba9370f93c3e19a918ba8da2ad80 | gianttomatoes/leetcode | /16_3sumClosest.py | UTF-8 | 877 | 2.921875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue May 21 16:42:03 2019
@author: victor
"""
class Solution:
def threeSumClosest(self, nums: List[int], target: int) -> int:
if len(nums)<=3:
return sum(nums)
res = 0
nums.sort()
closest = 9999
for i in range(len(nums)-2):
... | true |
53481c95c7b37b8b9cd67e09be5ec7fe95cae67d | strin/curriculum-deep-RL | /pyrl/gridworld.py | UTF-8 | 13,223 | 3.359375 | 3 | [] | no_license | import random
import environment
import numpy as np
import matplotlib.pyplot as plt
class Grid(environment.Environment):
''' Basic gridworld environment'''
N = (0, 1)
E = (1, 0)
W = (-1, 0)
S = (0, -1)
actions = [N, E, W, S]
curr_state = None
hit_wall = False
def __init__(self, ... | true |
7fef33c6412494749f368bdb6ca259249a58f3d9 | Caiya-Zhang/pypkpd | /project/mf7.py | UTF-8 | 4,207 | 2.546875 | 3 | [
"MIT"
] | permissive | """
#' The full Fisher Information Matrix (FIM) for one individual Calculating one model switch at a time, good for large matrices.
#'
#' Compute the full FIM for one individual given specific model(s), parameters, design and methods.
#' This computation calculates the FIM for each model switch separately. Corre... | true |
cb378b5950d968272e23860d975a30f8b3f454bd | leo606/python1 | /aulas/aula007/aula7.py | UTF-8 | 433 | 3.875 | 4 | [] | no_license | #nome = str(input('qual seu nome?'))
#print('prazer em te conhecer {:|^20}!'.format(nome))
n1 = int(input('primeiro numero '))
n2 = int(input('segundo numero '))
soma = n2+n2
multiplicacao = n2*n2
divisao = n1/n2
divisaoint = n1//n2
expo = n1**n2
print('a soma é {}, a multiplicação é {},\na divisão é {}'.format(soma, ... | true |
6bf943bc94eea23b1b225128befb2a08e763ee71 | LiYan1988/simulationsYuxin | /milp_before_cluster/read_24nodes.py | UTF-8 | 1,043 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 23 22:51:13 2017
@author: misWin
"""
import pandas as pd
import numpy as np
nsf = []
idx = 0
with open('nsf-24-map.txt', 'r') as f:
for line in f:
if idx==0:
idx += 1
continue
line = line.lstrip('<')
line = line.rstrip(... | true |
fdae86094fafa04f1e3c82715ed5d7a60d3e204e | johnlgtmchung/handwritten-text-recognition | /neuralnetwork.py | UTF-8 | 11,436 | 2.6875 | 3 | [] | no_license | # import os
# import numpy as np
# import glob
# from PIL import Image, ImageFilter
# # neural network class based on makeyourownneuralnetwork book
# class neuralNetwork:
# def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):
# """
# initializer of neuralNetwork
# inp... | true |
74f16f5e42cc036f161696f431e87e07c97caf1f | LTSchmiddy/dungeon-commander | /src/dungeonsheets/spells/spells_h.py | UTF-8 | 21,757 | 3.40625 | 3 | [] | no_license | from dungeonsheets.spells.spells import Spell
class HailOfThorns(Spell):
"""The next time you hit a creature with a ranged weapon attack before the spell
ends, this spell creates a rain of thorns that sprouts from your ranged weapon
or ammunition. In addition to the normal effect of the attack, the target... | true |
cbf340c33e9190f253090b58cb2b8fbeef40fd0d | Aroy231/InfyTQ_Problem_Solved | /Python_Fundamentals/Day_1/PROBLEM_5.py | UTF-8 | 2,543 | 3.65625 | 4 | [] | no_license | ''' JIT University offering degree courses to students has decided to provide
scholarship based on the following details:
Branch of study | Score (%) | Scholarship % | Remarks
| | |
Arts | Score is at | ... | true |
67940dc68affaa1945cc45e8b84e372b359afde4 | Fondamenti18/fondamenti-di-programmazione | /students/1811897/homework01/program02.py | UTF-8 | 2,433 | 2.984375 | 3 | [] | no_license | def conv(n):
centinaia = n % 1000
n = n // 1000
migliaia = n % 1000
n= n // 1000
milione = n % 1000
n= n // 1000
miliardo = n % 1000
n = n // 1000
bilione = n % 1000
n= n // 1000
trilione = n % 1000
n= n // 1000
risultato = ''
if trilione>1:
risultato += scomponi(trilion... | true |
ee1f5a71967dae92fef4a094e0d31fa5cb75ef02 | adiboy6/python-practice | /data_structures.py | UTF-8 | 1,540 | 4.3125 | 4 | [] | no_license | # LISTS - mutable
# map usage
squares = list(map(lambda x: x ** 2, range(10)))
# simplified form of the above using List Comprehension
squares = [x ** 2 for x in range(10)]
print(squares)
result = [(x, y) for x in [1, 2, 3] for y in [3, 1, 4] if x != y]
print(result)
"""
Equivalent to:
>>> combs = []
>>> for x in [1... | true |
95e3eeb8461b7ba5b45f073d11019713f250b51a | matteoNunz/N-Puzzle-Solver | /N-Puzzle-Solver.py | UTF-8 | 10,374 | 4.09375 | 4 | [] | no_license | """
Author: Matteo Nunziante
Date: 30/09/2021
Algorithm: A*
OpenList -> contains all the nodes that are being generated
ClosedList -> contains each node explored after it's neighboring nodes are discovered
Optimization -> new node already present in the closedList or in the openList won't be put in the openList
Cal... | true |
f5bea3becddba887fa6ab00ac3e101851e710597 | junfuture1103/kAFL | /kAFL-Fuzzer/debug/log.py | UTF-8 | 1,417 | 2.546875 | 3 | [] | no_license | # log.py
#
# Implemented functions for debugging and logging
# Written by Juhyun Song
# prefix
EXCEPT_PREFIX = '\033[1;31m[EXCEPT]\033[0m '
ERROR_PREFIX = '\033[1;31m[EXCEPT]\033[0m '
FLOW_PREFIX = '\033[1;31m[FLOW]\033[0m '
WARN_PREFIX = '\033[1;31m[WARNING]\033[0m '
KAFL_PREFIX = '\033[1;34m[KAFL]\033[0m '
INFO_PREF... | true |
b6bca4addd3103ae06de18c5abf917b77943e1a4 | feignwf/Spider | /ZhenAiSpider/ZhenAi/ZhenAi/spiders/mymongo.py | UTF-8 | 916 | 2.796875 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import pymongo
import traceback
class MyMongo(object):
def __init__(self, host='127.0.0.1', port=27017):
self.client = None
self.db = None
try:
self.client = pymongo.MongoClient(host=host, port=port)
except:
traceback.print_exc()
... | true |
a3eee79f927c61c9003e2bd2e44d3d80d99c6019 | PoojaUkey/Learningpython | /Even | UTF-8 | 164 | 3.625 | 4 | [] | no_license | #!user/bin/python
n=input("enter a number")
sum=0
i=1
while i<=n:
if i%2==0:
sum+=i
i+=1
print("Sum of % number from 0 is %d"%(n,sum))
| true |
a8f02533dab7f85a52a10ba470a0a0ade0388aeb | zihuan-yan/Something | /Others/StringAppendAnalyse/__init__.py | UTF-8 | 529 | 3.8125 | 4 | [
"Unlicense"
] | permissive | if __name__ == '__main__':
document = ["a"] * 10000
# instance 1
letters = ''
for c in document:
if c.isalpha():
letters += c
print(letters)
# instance 2
temp = []
for c in document:
if c.isalpha():
temp.append(c)
letters = "".join(temp)
... | true |
8539ffbf925b85b1bcbb3457cd9d8fa1f58cc606 | archenRen/learnpy | /leetcode/graphs/code-207.py | UTF-8 | 2,158 | 4.09375 | 4 | [] | no_license | # 207. Course Schedule
# There are a total of n courses you have to take, labeled from 0 to n-1.
#
# Some courses may have prerequisites, for example to take course 0 you have to first take course 1,
# which is expressed as a pair: [0,1]
#
# Given the total number of courses and a list of prerequisite pairs, is it poss... | true |
40510221a8e6f03e1c89701c88ccec7a5b8d7a8f | StoicSecurity/385Backups | /hello_world.py | UTF-8 | 156 | 3.421875 | 3 | [] | no_license | # First Day class, garbage programs, introduction
print("Hello World")
a = 5
print(a)
b = "Hello World"
print(b)
c = 10 ; d = 20
print(c)
print(d)
| true |
5ce617578bef56c5eae92610cacbe85a64d845b3 | surajhanvate07/Hackerrank_Interview_Prep_Kit | /Mark_and_Toys.py | UTF-8 | 375 | 3.296875 | 3 | [] | no_license |
def maximumToys(prices, k):
sm,count=0,0
prices.sort()
for i in range(len(prices)):
if sm + prices[i]<=k:
sm += prices[i]
count += 1
else:
break
return count
nk = input().split()
n = int(nk[0])
k = int(nk[1])
prices = list(map(int, input().rstrip().s... | true |
15181d5bf4e64d23d9a2e9349c97d52a71b6886c | YuzhouZhu/RaspberryPi | /w2d23.py | UTF-8 | 1,513 | 3.15625 | 3 | [] | no_license | #~ yuzhou zhu_w2d2 3
from matplotlib.pyplot import*
from numpy import*
t = arange(0,1,0.01)
y = 2*sin(2*pi*t)
#~ Way 1
N = len(y)
y_sat1 = zeros(N)
for i in range(N):
y_i = y[i]
if -0.5 < y_i < 0.5 :
y_sat1[i]=0
elif y_i > 0.5:
y_sat1[i]=y_i-0.5
elif y_i<-0.5:
y_sat1[i]=y_i+... | true |
d73216df0f0ea3bdc27673e428ccfbfa4f9a0987 | wulazhou/hello | /game_stats.py | UTF-8 | 793 | 2.796875 | 3 | [] | no_license | import json
class GameStats():
"""跟踪游戏的统计信息 """
def __init__(self, ai_settings):
""" 初始化统计信息 """
self.ai_settings = ai_settings
self.reset_stats()
# 让游戏开始处于非活动状态
self.game_active = False
# self.high_score = 0
def read_high_scroe(self):
"""... | true |
953f3013872dec8148c0732daa12539ee3ec5aa7 | DelanoBannister/Python-Projects | /Homework.py | UTF-8 | 1,154 | 3.296875 | 3 | [] | no_license | print("Welcome to my Favorite Song Characteristics Chart\n")
Name= "Day Rave"
#The Name of the song
def artist():
Artist= "Vybz Kartel"
return Artist
#The Name of the artiste the sings the song
Featuring= "None"
#The name of the other artists that sing in the song
def genre():
Genre= "Dancehall"
return ... | true |
125749de43c2a8cf3770cb0ef36e7052d9000437 | swooshcode/AlterEgo | /Core/ctc_cnn_tf_1k_phonemes30_vis.py | UTF-8 | 25,426 | 2.640625 | 3 | [] | no_license | import numpy as np
import tensorflow as tf
from sklearn.utils.class_weight import compute_class_weight
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from display_utils import DynamicConsoleTable
import math
import time
import data
def transform_data(sequence_groups, sample_rate=1000):
... | true |
da3d23818b73cc570cdb2dd88491c8e462756dcf | cosecdelta/Computer-Vision-Basic-Codes | /LucasKanade.py | UTF-8 | 1,981 | 3 | 3 | [] | no_license | ## Default modules imported. Import more if you need to.
import numpy as np
from scipy.signal import convolve2d as conv2
# Use these as the x and y derivative filters
fx = np.float32([[1,0,-1]]) * np.float32([[1,1,1]]).T / 6.
fy = fx.T
# Compute optical flow using the lucas kanade method
# Use the fx, fy, ... | true |
cd1f47b75bc8b74eff1f1ad8b151f6d708f0944e | Ahead180-103/ubuntu | /python/shell.py/max_min_avg.py | UTF-8 | 213 | 3.265625 | 3 | [] | no_license | #!/usr/bin/python3
l=[]
while True:
a=input('请输入数字: ')
if a=="exit" or a=="quit" or a=="e" or a=="q":
break
l.append(int(a))
print(l)
print(max(l))
print(min(l))
s=sum(l)/len(l)
print(s)
| true |
409e7ec36321a8feebf58878249abc7e918a8dc0 | Sandy4321/DecentralizedRL | /src/model.py | UTF-8 | 6,386 | 2.75 | 3 | [] | no_license | from src import graph
import numpy as np
import matplotlib.pyplot as plt
seed = 0
class DecentralizedTD:
"""Decentralized Temporal Difference Learning or TD(λ) with accumulating traces.
The version implemented here uses general value functions (GVFs), meaning that
the discount factor, γ, and the bootstrap... | true |
98573881b0d54ba5aced99b29aaea30bfd4abb6e | akimi-yano/algorithm-practice | /lc/1328.BreakAPalindrome.py | UTF-8 | 2,661 | 4.3125 | 4 | [] | no_license | # 1328. Break a Palindrome
# Medium
# 554
# 383
# Add to List
# Share
# Given a palindromic string of lowercase English letters palindrome, replace exactly one character with any lowercase English letter so that the resulting string is not a palindrome and that it is the lexicographically smallest one possible.
# ... | true |
a473c86a59daf72a02e04b41b84d3d35858a1dd9 | treygilliland/HottestBets | /handler.py | UTF-8 | 5,334 | 2.890625 | 3 | [] | no_license | import json, config, requests, random
from twython import Twython, TwythonError
""" Example method
def retweet(event, context):
twitter = Twython(config.APP_KEY, config.APP_SECRET, config.OAUTH_TOKEN, config.OAUTH_TOKEN_SECRET)
search_results = twitter.search(q='serverless', result_type='mixed', lang='en')
... | true |
8c0775676431b6285fdc11325078d62e9633fd1a | DiveCoders/AOS_Thread_Work | /Tesk1/testRaise_Q4.py | UTF-8 | 774 | 3.0625 | 3 | [] | no_license | # !/usr/bin/env python
# -*- coding:utf8 -*-
# Author:simonLTS
# Q4:是否可以消除test.exe多次运行时其结果的不一致性?请给出解决方案,测试其可行性。
# A4:可以消除,使用线程锁,实现如下。
import time, threading
sum = 0
lock = threading.Lock()
def thread_T1(n):
global sum
while True:
lock.acquire()
if sum<n:
sum+=1
else:
print... | true |
1ba67bd16d485429e06f6fd1c8a138863c926f84 | PraisyPrasad/luminarpythonprograms | /test/re.py | UTF-8 | 131 | 3.125 | 3 | [] | no_license | import re
x='[A-Z]+[a-z]+$'
matcher=re.finditer(x,"AaBbGg")
for match in matcher:
print(match.start())
print(match.group()) | true |
8cafd3ee6861af039e014903c3ea0cab25ac67dd | phibzy/Contests | /Leetcode/May20/310520/reorderRoutes.py | UTF-8 | 1,307 | 3.796875 | 4 | [] | no_license | #!/usr/bin/python3
class Solution:
# Pretty cool solution
# Make graph bidirectional but weighted
# Assign weight of 0 to paths that don't need changing, weight of 1 to ones that do
# Do BFS, add up the total weights and return it
def minReorder(self, n, connections):
# Step 1 - Create gr... | true |
932853ab7534871e1c9c8d7c04831a75abc059d7 | khoamai0202/JBA-Zookeeper | /Problems/Good rest on vacation/task.py | UTF-8 | 322 | 3.59375 | 4 | [] | no_license | # put your python code here
number_of_days = int(input())
number_of_nights = number_of_days - 1
food_cost_per_day = int(input())
one_way_flight_cost = int(input())
hotel_cost_per_night = int(input())
print(food_cost_per_day * number_of_days
+ hotel_cost_per_night * number_of_nights
+ one_way_flight_cost * 2... | true |
2cdd9a1b64c928399e0eb0d2f16ca0a03326158e | PreciousLiu/Representation-of-text-document-using-wordnet-and-lexical-chains | /lexical_chain.py | UTF-8 | 3,941 | 3.0625 | 3 | [] | no_license | import networkx as nx
import matplotlib.pyplot as plt
import nltk
from nltk.wsd import lesk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize, sent_tokenize
from nltk.corpus import wordnet as wn
stop_words = set(stopwords.words('english'))
sent =[' I like beer. Miller just launched. A new pils... | true |
74bb8bf77a543ba9438f300fc9096a92a7a4e5b3 | Abcbc/CAS | /SelectionRules.py | UTF-8 | 5,172 | 3.265625 | 3 | [] | no_license | import random
from Graph import KEY_OPINIONS, KEY_EDGE_ID, findPaths
def selectItemFromSet(set, weight_getter, predicate, maxChoiceTries):
filtered_set = [item for item in set if predicate(item)]
if len(filtered_set) == 0:
return None
weights = []
for item in filtered_set:
weights.appe... | true |
9bcb3abf5c73987ce95b887a23f8c15ae6cdac62 | niilante/py-face | /face detect(computer vision)/computerVc.py | UTF-8 | 562 | 2.703125 | 3 | [] | no_license | import cv2
import numpy
# get haar casscade (trainer file)
trainerfile= "haarcascade_frontalface_default.xml"
image="fa.png"
trainer=cv2.CascadeClassifier(trainerfile)
img= cv2.imread(image)
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
#detect face
face= trainer.detectMultiScale(
gray,
scaleFactor=1.1,
minNeig... | true |
ea7e8c65b80e6a885993da6a4c249c7fa95b02f8 | omondi9004/python-sequence | /lst.py | UTF-8 | 159 | 2.609375 | 3 | [] | no_license | #lists
my_hardware = ["Nut", "Sheets"]
my_hardware.append("plyWood")
my_tools = ["saw", "nailgun"]
my_collection = my_hardware + my_tools
print(my_collection)
| true |
bc7aeceac48aaa339c9516c4ad41beec481304d2 | dnond/celery_scraping | /MyApp.py | UTF-8 | 1,836 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import time, datetime
from celery import Celery
from celery.contrib.methods import task_method
import config
from Scraping import Scraping
import pprint
##### logger
from celery.utils.log import get_task_logger
logger = get_task_logger(__name__)
now_str = datetime.datetime.fromtimestamp(tim... | true |
75e6a1858a5d6b794d23b46f5f559e0341fb1107 | Oliviahelen95/Trying-out-Control-Flow | /Practice 1.py | UTF-8 | 590 | 2.84375 | 3 | [] | no_license | Python 3.9.0 (v3.9.0:9cf6752276, Oct 5 2020, 11:29:23)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license()" for more information.
>>>
>>> print 'Hello World'
SyntaxError: Missing parentheses in call to 'print'. Did you mean print('Hello World')?
>>> print ('Hello World')
Hello Wo... | true |
50888a37f09621361eb6181961b4922851f3f941 | ken2190/ProgramPractice | /DLFCV/pyimagesearch/preprocessing/meanpreprocessor.py | UTF-8 | 813 | 3.171875 | 3 | [] | no_license | #
# Mean subtraction is used to reduce the affects
# of lighting variations during classification
# a : zhonghy
# date: 2018-8-31
#
# import the necessary packages
import cv2
class MeanPreprocessor:
def __init__(self, rMean, gMean, bMean):
# store the Red, Green, and Blue channel averages across a
... | true |
19ba6f2dd47c7267253eb9a0d0c3f78d897ed9e0 | leticiarobledo/bag-of-words | /nlp_chatbot.py | UTF-8 | 3,510 | 3.625 | 4 | [] | no_license | # Bag of Words Chatbot Model
import pandas as pd
import nltk
import re
# Text preprocessing and BoW model
from nltk.stem import wordnet # to perform lemmatization
from nltk import pos_tag # parts of speech
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics import pairwise_distances # cos... | true |
9082d5b347fa341f34e106ba90e2a7a4cd527b30 | EmaPajic/Intelligent-Drone-Safety-Systems | /scripts/navigation.py | UTF-8 | 2,652 | 2.890625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: EmaPajic
"""
import rospy
import numpy as np
from geometry_msgs.msg import Twist
from nav_msgs.msg import Odometry
from tf.transformations import euler_from_quaternion
from point import Point
from math import atan2
class Navigator:
def __init__(self):
... | true |
91e5fa35bc4ea64c7cc65e096d10ed0d91d8d88b | bperard/PDX-Code-Guild | /python/lab04-grading.py | UTF-8 | 320 | 3.78125 | 4 | [] | no_license | score = int(input('On a scale of 0-100, how well did you?'))
grade = ''
if score > 100:
grade = 'Overachiever'
elif score > 89:
grade = 'A'
elif score > 79:
grade = 'B'
elif score > 69:
grade = 'C'
elif score > 59:
grade = 'D'
elif score >= 0:
grade = 'F'
else:
grade = 'Leave'
print(grade)
| true |
7c2423e28eb859b25302586f02109d4a81962d29 | sammyjankins/my_python_checkio | /Electronic Station/army_battles.py | UTF-8 | 1,719 | 4.09375 | 4 | [] | no_license | class Warrior:
health = 50
damage = 5
is_alive = True
class Knight(Warrior):
damage = 7
def fight(first_unit, second_unit):
while second_unit.is_alive and first_unit.is_alive:
second_unit.health -= first_unit.damage
second_unit.is_alive = second_unit.health > 0
if second_... | true |
3a83084780251afc04cf2bf4ee79d84454604bff | ZhongyaoMa/cs224-a5 | /cnn.py | UTF-8 | 892 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2018-19: Homework 5
"""
### YOUR CODE HERE for part 1i
import torch
import torch.nn as nn
class CNN(nn.Module):
def __init__(self, e_char, e_word):
super(CNN, self).__init__()
kernel_size = 5
self.e_word = e_word
self.conv ... | true |
058b666b827b56bf9f4622086298d35356f38965 | blue0712/blue | /demo43.py | UTF-8 | 450 | 2.796875 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
url1 = "https://www.mobile01.com/"
r2 = requests.get(url1)
print(r2.status_code)
headers = {
'User-Agent': "My super computer",
'from': "Trump Donald"
}
r1 = requests.get(url1, headers=headers)
print(r1.status_code)
soup1 = BeautifulSoup(r1.content, 'html.parser... | true |
a3f0273dc906dab230528fb8f5f16602ea0b5078 | ThiaguinhoLS/Code | /django/_class_based_views/training/accounts/forms.py | UTF-8 | 1,623 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from django import forms
from django.contrib.auth import get_user_model
User = get_user_model()
class LoginForm(forms.Form):
'Formulário de login'
username = forms.CharField(label = 'Username', max_length = 50)
password = forms.CharField(label = 'Senha', max_length = 30, widget = forms.P... | true |
6aa04517762fa38529eef8fcedd909cd82bed0f9 | BlueCapacitor/Tree-Of-Life | /exampleBranchMaker.py | UTF-8 | 447 | 2.796875 | 3 | [
"MIT"
] | permissive | def fix(branch):
if(type(branch) == str):
return([branch])
else:
return([fix(b) for b in branch])
import sys
sys.path.append("/Users/gosha/Google Drive/Programming/EclipseProjects/ASTEAMS2019")
from Main import *
def example():
branch = fix(eval(input("branch: ")))
print(branch)
t =... | true |
edc13aae0153aa465f6d9aa3af79924498a5dddc | santanubiswas948/create-own-server | /xyz.py | UTF-8 | 286 | 3.09375 | 3 | [
"MIT"
] | permissive | a = 2
b = 3
c = a + b
print ("""<html>
<head></head>
<body>
<h1>Total="""+ str(c) +"""</h1>
<h1>Welcome</h1>
<img src="welcome.jpg" alt="free image" width="300">
<p>Welcome this is a test message</p>
</body>
</html>""")
| true |
6c432cdf378a639322db242ef7711a323a1081a3 | goobily/Tools | /src/IceResultAnalyze/parse_fx_report.py | UTF-8 | 2,566 | 2.515625 | 3 | [] | no_license | import os
import sys
import json
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.cElementTree as ET
'''
report_file = r'F:\work\EvasiveSourcing\LLTrendXPatchedReport\winxp-sp3m\6236d295b73a364b060e34ed54c775ce772ddd573d5f1e51e29bc39d0319d0bf.xml'
tree = ET.ElementTree(file=repor... | true |
9f145e00dea88168d441db505aa8efa1ce633b5f | sabitrayan/webdev | /week 10/Informatics/Задача №343. Сумма чисел.py | UTF-8 | 84 | 3.375 | 3 | [] | no_license | a = int(input())
ans = 0
for i in range(a):
ans += int(input())
print(ans)
| true |
c25fa34f5cd0560a91606a9a4bd2be33b01c64d4 | wechto/bysj | /src/data/GEFCom2014_Task1_P.py | UTF-8 | 2,181 | 2.546875 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 20:53:20 2018
@author: Ljx
"""
import os
from torch.utils import data
import numpy as np, pandas as pd
import torch as t
class GEFCom2014_Task1_P(data.Dataset):
def __init__(self, o):
# print(os.getcwd())
a = pd.read_csv('data/GEFCom2014_Ta... | true |
36d410af845b19012b32428ffcaa8a0a1d29a67b | sabinaturkusic/Datenbanksysteme | /airline_new/airline_server.py | UTF-8 | 7,351 | 2.59375 | 3 | [] | no_license | #!/usr/bin/env python
# import libraries
from flask import Flask, render_template, request, Response
from datetime import date
import sqlite3
# start server
app = Flask(__name__)
# establish database connection
DATABASE = 'airline_database_new.db'
# functions
def create_running_number(attribute, relation):
con... | true |
b0aa607b4d3e0e65cd6938b15f8da159f5d76d01 | kyosukekita/ROSALIND | /Algorithmic Heights/topological_sorting.py | UTF-8 | 1,350 | 3.734375 | 4 | [] | no_license | #topological_sorting.py
グラフ G は閉路の無い有向グラフ DAG である ⇔ グラフ G はトポロジカルソートできる
from collections import deque
file= open('Desktop/Downloads/rosalind_ts.txt').read()
tmp=[int(i) for i in file.split()[2:]]
edges=[tmp[i:i+2] for i in range(0,len(tmp),2)]
#頂点数と辺数
n,k= int(file.split()[0]), int(file.split()[1])
def topological... | true |
61d67d957e998b03778620f427a62361334d9d08 | avryhof/personal-assistant | /personal_assistant/model_helpers.py | UTF-8 | 868 | 3.3125 | 3 | [
"MIT"
] | permissive | import hashlib
import importlib
import pprint
def lazy_load_class(module_name):
loaded_module = importlib.import_module(module_name)
return loaded_module
def get_val(input_obj, key, default=None):
retn = default
if isinstance(input_obj, dict):
retn = input_obj.get(key, default)
elif k... | true |
2656ec55c6a32b2d09336aeee363fea0d384248b | m0t/ida-scripts | /filter_funcs.py | UTF-8 | 1,503 | 3.015625 | 3 | [
"MIT"
] | permissive | #find relevant functions
#names = [ [name, addr], ..]
def cs_get_all_function_names():
names=[]
for f in Functions():
fn = GetFunctionName(f)
demangled = demangle_name(fn, INF_SHORT_DN)
if demangled:
name = demangled
else:
name = fn
#skip jumpers
... | true |
91afbbaeb2371e90db83991c952eb27cdfc964bd | madHatter106/MyRethinking | /ch6_1.py | UTF-8 | 1,974 | 2.546875 | 3 | [] | no_license | import numpy as np
import pandas as pd
import pymc3 as pm
import arviz as ar
from sklearn.preprocessing import scale
import matplotlib.pyplot as pl
from causalgraphicalmodels import CausalGraphicalModel
np.random.seed(1914)
N = 200 # num grant proposals
p = 0.1 # selection proportion
# uncorrelated newsworthiness and ... | true |
6e68682fd9b73733a8b5f74315512dfe05bdaaf7 | annaliisamoter/climate-disasters-api | /testing.py | UTF-8 | 1,553 | 2.8125 | 3 | [] | no_license | import unittest
from csv_parse import parses_csv
from server import app
import json
class FlaskTestcase(unittest.TestCase):
"""Testing of app routes, both functional and unittest."""
def setUp(self):
"""Stuff to do before every test."""
self.client = app.test_client()
app.config['TES... | true |
0fe62695711640dfdebc673d6c4d6d5e315b7a8e | samkh918/PythonScripts | /2016_0920_VT_counter.py | UTF-8 | 4,363 | 2.6875 | 3 | [] | no_license | import os, sys, re, string
import datetime, subprocess
inputFile = sys.argv [ 1 ]
myInput = open(inputFile,'r')
myList = myInput.readlines()
VT_list=[] #Holds all different variant types
#################################################################################################
# Following code gets a list ... | true |
aa4e2f5e2b78e32d4a53dbf82b52d0477b478a97 | shakeelashaik/python | /loops class/demo7.py | UTF-8 | 227 | 3.59375 | 4 | [] | no_license | name=input("enter name:")
no=0
for x in range(1,len(name)+1):
for y in range(x):
print(name[no],end=" ")
no+=1
if no == len(name):
break
if no == len(name):
break
print() | true |
7ffff7078ec2c560c3cb1f7a5c873048ebf57bba | jinxu06/hmaml | /data/load_data.py | UTF-8 | 4,181 | 2.859375 | 3 | [] | no_license | import numpy as np
import os
import random
class Dataset(object):
def __init__(self, data_source, which_set='train', task_type='classification'):
self.data_source = data_source
self.task_type = task_type # classification | regression | density estimation
self.which_set = which_set
de... | true |
f8c0c577f39bb8e5506e124b5d0ee86607904128 | wrapose/trend-ai-mikethemouth | /PokerProtocol.py | UTF-8 | 4,882 | 2.53125 | 3 | [] | no_license |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
import time
import json
import hashlib
from IDecisionEngine import OneRound
class PokerProtocol:
def __init__(self, ws, decisionEngine):
self.ws = ws
self.myMd5 = ""
self.decisionEngine = decisionEngine
self.currentRound = None
de... | true |
02f80af9370f7b31b1a1e22402ef8ecb856787c3 | GracefulFinn/MultiVision | /utils/featureExtractor.py | UTF-8 | 11,396 | 2.921875 | 3 | [] | no_license | from scipy import stats
import numpy as np
import itertools
import math
import re
from dateutil.parser import parse
from typing import List
def is_date(string, fuzzy=False):
"""
Return whether the string can be interpreted as a date.
:param string: str, string to check for date
:param fuzzy: bool, ign... | true |
f6351db3a411b96241b6d00804cc1be362ff418c | mossygr/android_server | /server.py | UTF-8 | 314 | 2.765625 | 3 | [] | no_license | import http.server
import socketserver
from requests import get
PORT = 8000
ip = get('https://api.ipify.org').text
Handler = http.server.SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("Visit the following url: ", ip, ":", PORT,sep='')
httpd.serve_forever()
| true |
7325b566e336517095c1653f0b97c200911ca79e | papatwo/PythonNoob | /leetcode_py3/253_Meeting_Room_II.py | UTF-8 | 671 | 3.3125 | 3 | [] | no_license | class Solution:
def minMeetingRooms(self, intervals):
starts = sorted([interval[0] for interval in intervals])
ends = sorted([interval[1] for interval in intervals])
print(starts)
print(ends)
min_room = 0
count = 0
s, e = 0, 0
while s < len(starts):... | true |
6eba4653fd52cfd19e3cf460fe6f6fa803273386 | mallikkommaraju/ml | /learn_nlp_project_1/step_2_classification.py | UTF-8 | 3,498 | 2.53125 | 3 | [] | no_license |
X = X_train_corpus_tfidf_df
Y = Y_train
Xv = X_validate_corpus_tfidf_df
Yv = Y_validate
############################################################
# Multi-label random forest
############################################################
colormap = plt.cm.jet(np.linspace(0,1,Y.shape[1]))
from sklear... | true |
053eb7599c371423d9405534ec48bb7a437bf3ed | dorbo/NetworksProject | /Features/Degrees.py | UTF-8 | 780 | 3.046875 | 3 | [] | no_license | import networkx as nx
import numpy as np
def max_out_deg(graph):
if graph.is_directed():
out_deg = graph.out_degree().values()
else:
out_deg = graph.degree().values()
return max(out_deg)
def avg_out_deg(graph):
if graph.is_directed():
out_deg = graph.out_degree().values()
else:
out_deg = graph.degree()... | true |
f07c5534ade3626618bab9b4c64968504dc98d50 | niolabs/nio | /nio/modules/web/response.py | UTF-8 | 918 | 2.71875 | 3 | [] | no_license | from nio.modules.proxy import ModuleProxy
class Response(ModuleProxy):
""" A class encapsulating HTTP response information.
Your module implementation will proxy this class with its own
implementation details. An instance of a response will be passed to
web handlers.
"""
def set_header(sel... | true |
8e099eb7d5fda6ba8464af9c026addfd21b7c0e5 | Ryuya1995/leetcode | /q39_Combination_Sum.py | UTF-8 | 759 | 3.0625 | 3 | [] | no_license | class Solution:
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
def Sum(candidates, target, pres=[]):
res = []
if candidates:
x = candidates[0]
... | true |