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 |
|---|---|---|---|---|---|---|---|---|---|---|
7cc3f90cc7e8678bd1bf63e9e2847068ba7d3b49 | benwei/Learnings | /pySamples/inspectSamples/testFindNumArgsOfFunc.py | UTF-8 | 469 | 3.046875 | 3 | [] | no_license | #!python
# info from http://docs.python.org/library/inspect.html#inspect.getargspec
import inspect
def testFunc(a, b):
print a, b
def testHello(b):
print b
print inspect.stack()
def main():
cblist = [testFunc, testHello]
for cb in cblist:
cbspec = inspect.getargspec(cb)
print cbs... | true |
1e59c38ca7767e85869f85c66817cd7e1283f693 | jtan381/miniURL | /url_shortener.py | UTF-8 | 1,824 | 2.875 | 3 | [] | no_license | class URL_Shortener():
def __init__(self):
self.url2miniurl = None
self.id = 1
def shortener_url(self, formData):
orginal_url = formData['orginalURL']
extension = formData['extension']
status = ""
update = False
if(orginal_url[-1]=="/"):
orgi... | true |
06bcec579c62b970543eac52e409fd2adf17b1c7 | jdhurwitz/IMU | /stepcounter.py | UTF-8 | 8,607 | 2.984375 | 3 | [] | no_license | import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from scipy import signal, fftpack
import math
class stepcounter:
def __init__(self, src, cols):
"""
src is the path to the raw data file
cols contains the set of columns we want to pull into the dataframe
"""
self.src = src
self.cols =... | true |
e155eba699cefa0d39f21a9011668a20f2387f3d | Techne3/Intro-Python-II | /examples/rps.py | UTF-8 | 1,471 | 4.40625 | 4 | [] | no_license | import random
# Create a rock paper scissors game in Python
# Player should be able to type r, p, or s
# Computer will pick r, p or s
# Game will print out the results and keep track of wins, losses and ties
# Type q to quit
# Build a REPL
choices = ["r", "p", "s"]
wins = 0
losses = 0
ties = 0
# Define a func... | true |
7c49261aabbfbd6ce57b09d59e4fbddd8742a529 | LudovicLemaire/Bootcamp-Py-ML-42 | /day00/ex08/sos.py | UTF-8 | 1,131 | 3.59375 | 4 | [] | no_license | import sys
morse = {
"a": ".-",
"b": "-...",
"c": "-.-.",
"d": "-..",
"e": ".",
"f": "..-.",
"g": "--.",
"h": "....",
"i": "..",
"j": ".---",
"k": "-.-",
"l": ".-..",
"m": "--",
"n": "-.",
"o": "---",
"p": ".--.",
"q": "--.-",
"r": ".-.",
"s": ... | true |
e20f4bb9563b2611d1263e9ac8ee32b31e77a1b0 | eladeliav/PythonProjects | /School2018PY/GettingStarted/Calculator.py | UTF-8 | 858 | 4.15625 | 4 | [] | no_license | """
Elad Eliav Inc.
"""
def calculator(num1, operation, num2):
"""calculates the answer from the given numbers and operation"""
result = eval("{} {} {}".format(num1, operation, num2))
# runs in python console num1 opeator num2 with .format and saves the answer in result
print("{} {} {} = {}".format(nu... | true |
9c9f1915c808b9af6f526bdc1f2e062fafa34912 | zhanren/Pokemon-Simulator-in-Python | /Pokemon.py | UTF-8 | 17,534 | 3.40625 | 3 | [] | no_license | # Creating the Pokemon Class
class Pokemon(object):
import math
POKEMON_DICTIONARY = {}
NATURE_DICTIONARY={}
LEVEL = 50
STAB=1.5
def __init__(self,pokemon,gender,iv=[31,31,31,31,31,31],ability=None,item=None,nature='timid',ev=[100,100,100,100,100,10],moves=None,dynamax_level=10,friendship=255):
... | true |
fa25d47b751f0d8e2a8f8e21affc6b195be6cd56 | vincent861223/NTU_COOL_VM_TOOL | /info.py | UTF-8 | 6,633 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python3
import sys
import argparse
import json
import os
import subprocess
def create_parser():
parser = argparse.ArgumentParser(description='show info of the VM')
sp_action = parser.add_subparsers()
sp_list = sp_action.add_parser('list', help='Show all VM on MAAS')
sp_list.set_defaults(fun... | true |
072a7ab6356b1c2062425800f5a3819edc3a33c1 | sandy98/playground | /uploads/public/cgi-bin/upload.py | UTF-8 | 602 | 2.625 | 3 | [] | no_license | #!/usr/bin/env python2
import os, sys
#import cgi, cgitb
#cgitb.enable()
#form = cgi.FieldStorage()
data = sys.stdin.readline()
sys.stdout.write('Content-Type: text/html\n\n')
sys.stdout.write('<h2 style="text-align: center; color: #ff4400;">Hello, World!</h2>')
sys.stdout.write("<p>This is %s in a %s platform</p... | true |
73729f4cfaeefd625d8a6a0a9b92739b80ca764a | RuslanSayfullin/1_introduction_to_algorithms | /check_sorted.py | UTF-8 | 256 | 2.765625 | 3 | [] | no_license | def check_sorted(a, aserding=True):
"""Проверка отсортерованности за o(len(a))"""
n = len(a)
flag = True
for i in range(0, n-1):
if a[i] > a[i+1]:
flag = False
break
return flag | true |
c569d406baef5ebab227f73f3abab35fa97def14 | kmakeev/fnsservice | /fnsservice/fns/models_/СвНОТип.py | UTF-8 | 916 | 2.703125 | 3 | [] | no_license | from django.db import models
class СвНОТип(models.Model): #4.96
КодНО = models.CharField(max_length=4,
verbose_name='Код органа по справочнику СОУН')
НаимНО = models.CharField(max_length=250,
verbose_name='Наименование налогового органа')
def __str__... | true |
3c6479a747783f7f14f8b38c7886cbb995ded456 | gavj/chechio-puzzles | /mooreNeighbourhood.py | UTF-8 | 902 | 3.203125 | 3 | [] | no_license | def count_neighbours(grid, row, col):
countVal = 0
if row-1>=0 and col-1>=0 and grid[row-1][col-1] :
countVal += 1; ###print countVal,'A'
if row-1>=0 and grid[row-1][col] == 1:
countVal += 1; ##print countVal,'B'
if row-1>=0 and col+1<len(grid[0]) and grid[row-1][col+1] == 1 :
... | true |
9f4a59b8593f0f4e707e3354b4a82e2fff0d4b56 | Sharkigamers/204ducks | /204ducks | UTF-8 | 2,852 | 3.546875 | 4 | [] | no_license | #!/usr/bin/env python3
##
## EPITECH PROJECT, 2020
## 204ducks
## File description:
## 204ducks
##
import sys
import math
import time
class Ducks():
def __init__(self, a):
self.a = a
def F(self, t):
return (self.a * math.exp(-t) + (4 - 3 * self.a) * math.exp(-2 * t) + (2 * self.a - 4) * math... | true |
94c966fa5882498144c172a549c8d18cf2b96674 | songsong945/crawler | /location.py | UTF-8 | 860 | 3.140625 | 3 | [] | no_license | import json
from urllib.request import urlopen, quote
import xlrd
def getlnglat(address):
url = 'http://api.map.baidu.com/geocoder/v2/'
output = 'json'
ak = '0XyetZluX2PavwFSkd1Yku8Zz0D0unQP' # 浏览器端密钥
address = quote(address) # 由于本文地址变量为中文,为防止乱码,先用quote进行编码
uri = url + '?' + 'address=' + a... | true |
67433d6142daf154152ba63ed8226ac932cea715 | liyixuan1993/Fake-Smile-Detection | /fake_smile_detection_main.py | UTF-8 | 6,508 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Nov 26 19:42:52 2017
@author: kcchiu
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import cv2
from PIL import Image
from skimage.transform import resize
from sklearn.model_selection import train_test_split
folder_fake... | true |
b03fd87a476d7d6252251a953e661e1b3a14c015 | CH-YYK/leetcode-py | /LeetCode-221-Maximum-square.py | UTF-8 | 725 | 2.640625 | 3 | [] | no_license | class Solution(object):
def maximalSquare(self, matrix):
"""
:type matrix: List[List[str]]
:rtype: int
"""
if len(matrix) == 0:
return 0
if len(matrix[0]) == 0:
return 0
m = len(matrix)
n = len(matrix[0])
for row in rang... | true |
dfd886bd5ae17a2869df4e09ead0751cb41c8d0a | syurskyi/Python_Topics | /125_algorithms/_exercises/templates/Practice_Python_by_Solving_100_Python_Problems/80.py | UTF-8 | 804 | 3.375 | 3 | [] | no_license | # #Create a script that lets the user create a password until they have satisfied three conditions:
# #Password contains at least one number, one uppercase letter and it is at least 5 chars long
# #Give the exact reason why the user has not created a correct password
# w__ ?
# notes = ? #list
# psw = ? Enter p... | true |
27b092a9a3050abaedbea2f708634e6f12ab031f | AnnemijnD/safariteam | /code/classes/room.py | UTF-8 | 265 | 3.140625 | 3 | [] | no_license | class Room(object):
"""
Representation of a room in Schedule
"""
def __init__(self, name, room_id, capacity):
self.name = name
self.room_id = room_id
self.capacity = capacity
def __str__(self):
return self.name
| true |
deb8ba6c2250ffb14543efef024201e13c3056c9 | dremok/mustard-lime-emerald | /src/mle/data_loader.py | UTF-8 | 182 | 2.546875 | 3 | [
"MIT"
] | permissive | import pandas as pd
def load_train_csv(train_path):
print('Loading training data...', end='')
train_data = pd.read_csv(train_path)
print('done!')
return train_data
| true |
754d193b03b2e0845cef48fc51317249f48a28f9 | zhengpuas47/ImageAnalysis3 | /io_tools/data.py | UTF-8 | 6,936 | 2.640625 | 3 | [
"MIT"
] | permissive | import os, glob, sys, time
import numpy as np
import re
import tifffile
# Import here to avoid making astropy mandatory for everybody.
try:
from astropy.io import fits
except ImportError:
pass
### This sub package is aiming to manage data folders ###
def get_hybe(folder):
#this sorts by the region numb... | true |
0edf2bd1b561dfb281bf549dcc526db412f74ab1 | alyssa1996/CodingExercise | /백준/[백준_10816] 숫자카드2_2차.py | UTF-8 | 405 | 2.890625 | 3 | [] | no_license | import sys
from collections import defaultdict
input = sys.stdin.readline
n = int(input())
number_card = list(map(int, input().split()))
m = int(input())
target_numbers = list(map(int, input().split()))
count_cards = defaultdict(int)
for card in number_card:
count_cards[card] += 1
result = []
for target in targe... | true |
84598e080d2e232f20f06e9048b030afbfa27e41 | michelleon/dominion | /core/loggers/human.py | UTF-8 | 2,312 | 3.421875 | 3 | [] | no_license | from core.counters import CounterName
from core.events import CardEventType
from core.events import CardMoveEvent
from core.events import CounterEvent
from core.events import ShuffleEvent
from core.loggers.base import GameLogger
from core.locations import LocationName
from core.card_stack import StackPosition
class H... | true |
f11c482d700b493bfb3c0afc4266d4a708532cba | daniel-reich/ubiquitous-fiesta | /2iETeoJq2dyEmH87R_17.py | UTF-8 | 117 | 3.1875 | 3 | [] | no_license |
def count_digits(n, d):
res = [str(pow(i,2)) for i in range(n+1)]
return sum([el.count(str(d)) for el in res])
| true |
d5cd23636815b3fd6bf77f34ae99fef514bb560d | yuyichao/jlab2s13 | /doppler/identify_peaks.py | UTF-8 | 2,985 | 2.734375 | 3 | [] | no_license | #!/usr/bin/env python
from jlab import *
from os import path as _path
from matplotlib.widgets import CheckButtons
class PeakIdentifier:
def __click_cb(self, label):
self.all_names[label] = not self.all_names[label]
def __init_fig__(self, data_name):
self.fig = figure()
self.ax = subplo... | true |
d81a5b83a36cd649f822194525128e69253253c9 | WHJR-G8/G8-C10_For_Teacher_Reference | /Sol_Project.py | UTF-8 | 627 | 3.625 | 4 | [] | no_license | import turtle
speed=[10,20,30,40,50]
colors=["orange","red","green","blue","yellow"]
def draw_star(c,s,size,x,y):
for i in c:
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
turtle.fillcolor(i)
turtle.begin_fill()
c.pop()
c.append("cyan")
for i in ran... | true |
d89a317cdabe9a59baa2a6cf3672a0e6d396e82e | pgoldberg/CS50FinalProject | /helpers.py | UTF-8 | 1,488 | 2.578125 | 3 | [] | no_license | """This file was a part of pre-written CS50 Distribution Code"""
import csv
import os
import sqlalchemy
from flask import redirect, render_template, request, session, url_for
from functools import wraps
def login_required(f):
"""
Decorate routes to require login.
http://flask.pocoo.org/docs/0.11/patterns... | true |
a55ed49922286fcf92a55e0af5272afde6cbd887 | lingjieM/M1_exercise | /No8-3_step_2-3.py | UTF-8 | 1,508 | 2.890625 | 3 | [] | no_license | import csv
import re
infile = open("/Users/menglingjie/PycharmProjects/M1_exercise/No8/16Sread_merged/Frequency.csv", "r")
reader = csv.reader(infile)
d1 = {}
d2 = {}
for line in reader:
taxa = re.split(";", line[1])
phylum = taxa[1]
class_ = taxa[2]
freq = [float(_s) for _s in line[2:11]]
if phyl... | true |
df36e29086a8f948391ab4778df438c0cba2ad9c | ms10596/titanic | /load.py | UTF-8 | 2,037 | 3.046875 | 3 | [] | no_license | import numpy as np
import pandas as pd
def load(features, file_name):
dataset = pd.read_csv(file_name)
m = len(dataset)
features_data = []
bias = np.array([np.ones(m, )])
features_data.append(bias)
for i in range(len(features)):
features_data.append(load_feature(features[i], file_name... | true |
6f5e45ca877e1916645426a05b805ca5b12fe61c | Eason7663/dzhTestWeb | /appaction/zkClient.py | UTF-8 | 1,384 | 2.6875 | 3 | [] | no_license | #!/usr/bin/python
"""
-------------------------------------------------
File Name: zkClient
Description :
Author : Eason
date: 2018/4/20
-------------------------------------------------
Change Activity:
2018/4/20:
-------------------------------------------------
""... | true |
240da06852ab02f0827300590ddda0f19d006ff2 | bavaria95/Bioinformatics-I | /Week 2/minin_skew.py | UTF-8 | 578 | 3.09375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def skew(genome):
d = 0
s = []
for k in range(len(genome)):
if genome[k] == 'G':
d += 1
if genome[k] == 'C':
d -= 1
s.append(d)
return s
# genome = raw_input()
genome = 'GATACACTTCCCGAGTAGGTACTG'
d = skew(genome)
i = list(range(1, len(genome) + 1... | true |
b7df0426c30f72697dad527d4de23eb25c9eaffe | ndminh21/kogida | /source/service/math/Solver/INEQ_Radical_C2.py | UTF-8 | 9,166 | 2.765625 | 3 | [] | no_license | import json
from sympy import *
import time
from sympy.parsing.sympy_parser import parse_expr
def eq_json(function, val):
data = {}
data["val"] = latex(Eq(function, val))
res_data = {}
res_data["eq"] = data
return res_data
def eq_json_string(function, val):
data = {}
data["val"] = function... | true |
d256b0e32dc37028c92ac531cbf06ff2d46cba85 | mmsbrggr/diofant | /diofant/tests/polys/test_rootisolation.py | UTF-8 | 40,995 | 2.71875 | 3 | [] | permissive | """Tests for real and complex root isolation and refinement algorithms. """
import pytest
from diofant.core import I, prod
from diofant.domains import EX, QQ, ZZ
from diofant.functions import sqrt
from diofant.polys.polyerrors import DomainError, RefinementFailed
from diofant.polys.rings import ring
from diofant.poly... | true |
9f4025f8ca9ecd24e3f2d4216d6c97dca6f76765 | jetperch/pyjoulescope | /joulescope/time.py | UTF-8 | 2,126 | 3 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | # Copyright 2018 Jetperch LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | true |
2596fe08257c57ae85cc8ddd5365d2ae47c73e70 | sky-boy777/django | /django基于类的视图/CBV/app/views.py | UTF-8 | 2,836 | 2.578125 | 3 | [] | no_license | from django.shortcuts import render, HttpResponse, redirect
from django.views.generic import View, TemplateView, ListView, DetailView, CreateView # 导入views下的子类generic,类视图要继承generic
from app.models import Data # 数据表
from django.utils.decorators import method_decorator # 类视图使用装饰器要导入的类
# 路由保护装饰器
def check_login(fun):
... | true |
dcb2b4b18e428cb8c05c2ded5f79832ce6f1e2d0 | amydoan586/CIS-2348---14911 | /Homework #1/zyLab 3.18.py | UTF-8 | 1,127 | 4.125 | 4 | [] | no_license | #Amy Doan ID:1895125
import math #Add math functions
Height = int(input("Enter wall height (feet):\n")) #User is asked to input height
Width = int(input("Enter wall width (feet):\n")) #User is asked to input width
Wall_Area = Height * Width #Calculate area of given height and width
print("Wall area:", Wall_Area, "... | true |
eea82c795e9f0e4e9e59d262e35b5365d804fea1 | adamvest/keypoint-baseline | /demo/visualize_rectified_segments.py | UTF-8 | 4,677 | 2.609375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import os
import json
import shutil
import numpy as np
from matplotlib import pyplot as plt
def reorder_clockwise(points):
points = np.array(points)
top_idx = np.argmin(points[:, 1])
if len(points) != 4:
reordered_points = [points[top_idx].tolist()]
points = np.delete(points, top_idx, axi... | true |
1350c557336c895961c6c3dfd223e89c621dcee4 | juliemcbaker/python-challenge | /PyBank/main.py | UTF-8 | 2,867 | 3.4375 | 3 | [] | no_license | #PyBank Assignment
#Julie Baker
#May 2021
import os
import csv
import operator
# need to read in PyBank/Resources/budget_data.csv
budget_csv = os.path.join(os.getcwd(), "PyBank", "Resources", "budget_data.csv")
with open(budget_csv) as csv_file:
csv_reader = csv.reader(csv_file, delimiter = ',')
... | true |
c3cea35794c1043ea0f016a7b9f6521ae26773ac | LucestDail/python.DataAnalysis | /20210218/test1.py | UTF-8 | 1,688 | 2.734375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 18 21:40:43 2021
@author: dhtmd
"""
import time
from selenium import webdriver
import pandas as pd
driver = webdriver.Chrome("C:/Users/dhtmd/Documents/pythonRepo/python.DataAnalysis/20210218/chromedriver")
time.sleep(2)
driver.get("https://nid.naver.com/nidlogin.login?mo... | true |
8ae532b4ba88941e314e6b24c8b5d5a4a426caa4 | ShreyaDhananjay/repobee | /src/_repobee/command/repos.py | UTF-8 | 12,690 | 2.734375 | 3 | [
"MIT"
] | permissive | """Top-level commands for working with repos.
This module contains high level functions for administrating repositories, such
as creating student repos from some master repo template. All functions follow
the conventions specified in :ref:`conventions`.
Each public function in this module is to be treated as a self-c... | true |
1b76420b854f4e7415e1108c9162ffc10138cee6 | binary-machinery/secret_santa_backend | /common/email_sender.py | UTF-8 | 776 | 2.546875 | 3 | [] | no_license | import smtplib
import ssl
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
class EmailSender:
def __init__(self, config):
self.sender_email = config["email"]
self.sender_name = config["name"]
self.password = config["password"]
def send_email(self, re... | true |
82a2ce41cf346138854044389cb36ed26ca8cb04 | SopiMlab/magenta | /magenta/models/gansynth/gansynth_pad_audio.py | UTF-8 | 2,305 | 2.546875 | 3 | [
"Apache-2.0"
] | permissive | import argparse
import os
import re
import sys
parser = argparse.ArgumentParser()
parser.add_argument(
"in_dir"
)
parser.add_argument(
"out_dir"
)
parser.add_argument(
"--length",
type=int,
default=64000
)
parser.add_argument(
"--sample_rate",
type=int,
default=16000
)
parser.add_argument(
"--pitch"... | true |
a3224d52a98f8d0813bafbf9a7a9178316eb089d | billbai0102/SGMT | /MRI Model/data.py | UTF-8 | 762 | 2.875 | 3 | [] | no_license | import torch
from torch.utils.data import Dataset, DataLoader
import cv2
class MRIDataset(Dataset):
def __init__(self, df, transform=None):
"""
Initializes dataset class
:param df: DataFrame containing MRI and segmentation mask paths
:param transform: Image transforms
"""
... | true |
1fcbc56187a072c5cf99d755206b783883599c62 | mattiaslinnap/pyshortcuts | /pyshort/colls.py | UTF-8 | 1,658 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
from __future__ import absolute_import, division, print_function, unicode_literals
from future_builtins import * # ascii, filter, hex, map, oct, zip
class deepdict(dict):
"""A defaultdict of infinitely recursive defaultdicts.
Examples:
>>> a = deepdict(); a[1] = 10; a
{1: 10}
... | true |
b2dc1aae3f5f7e9104dca93120d1eb3ced0a5c71 | LukeStanislawski/Medilanac | /test/fault_tolerance.py | UTF-8 | 2,599 | 2.671875 | 3 | [] | no_license | import sys, os
sys.path.insert(0,os.path.dirname(os.path.dirname(__file__)))
from reconstruct import reconstruct
from utils.config import Config
import random
import shutil
import json
def test(subject_id, k=Config.ec_k, m=Config.ec_m):
"""
For a given blockchain, sequentially remove other blockchains, attempting t... | true |
cb2b37e44f63cd2c5b8a68ab83a54c09fb6bf7db | the1pawan/bluetooth-led-control | /GUI/Mobile/SymbainS60/RGB_led_controller.py | UTF-8 | 1,029 | 2.578125 | 3 | [] | no_license | import appuifw
import btsocket as socket
import e32
class BTReader:
def connect(self):
global sock
arduino_addr='00:19:a4:02:44:2a' #add your arduino BT adress here
sock=socket.socket(socket.AF_BT, socket.SOCK_STREAM)
target=(arduino_addr,1) # serial connection to arduino BT
sock.connect(target)
def r... | true |
fcb9327d8f62d2e0063c2dca53fc3dbbbe68673b | flolebobo/PyCurve | /test/test_Ns_Nss.py | UTF-8 | 6,596 | 2.78125 | 3 | [
"MIT"
] | permissive | import unittest
from PyCurve.curve import Curve
from PyCurve.nelson_siegel import NelsonSiegel
from PyCurve.svensson_nelson_siegel import NelsonSiegelAugmented
class Test_ns_nss(unittest.TestCase):
def setUp(self) -> None:
self.curve_1 = Curve([0.25, 0.5, 0.75, 1., 2., 3., 4., 5., 6.,
... | true |
b184243626f767d2822f6e824353315711dfe8a5 | jiyali/python-target-offer | /计数排序.py | UTF-8 | 912 | 3.53125 | 4 | [] | no_license | class Solution:
def countSort(self, arr):
# 获取arr中的最大值和最小值
maxNum = max(arr)
minNum = min(arr)
# 以最大值和最小值的差作为中间数组的长度,并构建中间数组,初始化为0
length = maxNum - minNum + 1
tempArr = [0 for i in range(length)]
# 创建结果List,存放排序完成的结果
resArr = list(range(len(arr)))
... | true |
d5bb15c0e437f434343218e8e2dec17bc2686072 | bludek/codility | /lesson04/frogRiverOne.py | UTF-8 | 541 | 3.15625 | 3 | [] | no_license | def solution(X, A):
return golden_cross(X, A, len(A))
def cross(X, A, n):
array = range(1, X + 1)
for i in range(0, n):
if A[i] in array:
array.remove(A[i])
if not array:
return i
return -1
def golden_cross(X, A, n):
cover = [-1] * X
uncovered = X
... | true |
846a5c865415d2e9a81cef8caa1118ce5020be93 | GetTuh/RaportCheckerSlim | /old/waitForLoadingToFinish.py | UTF-8 | 340 | 2.515625 | 3 | [] | no_license | from selenium import webdriver
import time
def waitForLoadToFinish(driver):
while True:
try:
time.sleep(.3)
driver.find_element_by_class_name('k-loading-image')
time.sleep(.5)
print("Loading...")
except Exception as e:
break
... | true |
c875b6cbdb528b1c08c1b6fe21b8c0d083653517 | nroldanf/DashPortfolio | /utils/utils.py | UTF-8 | 983 | 2.578125 | 3 | [] | no_license | import base64
import librosa
import librosa.display
import numpy as np
import matplotlib.pyplot as plt
def parse_contents(contents):
_, content_string = contents.split(',')
decoded = base64.b64decode(content_string).decode('ascii')
return decoded
def load_audio(audio_filename):
v_signal, fs = librosa... | true |
9cfe8b1394f1ad5c9b26eea82f00e6e15d95e784 | teranishii/program | /keitaiso/morphologicalanalyzer.py | UTF-8 | 7,798 | 2.703125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import subprocess as proc
import sys
import io
import os
import time
class Mecab():
def __init__(self):
self.name = "Mecab"
self.char = "utf-8"
self.b_size = 8192 * 3
self.s_size = 0
self.temp = "bbb.txt"
## 形態素解析して表層表現の集合を得る.
#INP... | true |
f95795d34e95997988a579bc277315c61be1ab4f | jeremyCtown/data-structures-and-algorithms | /data_structures/sorting_algos/selection/selection.py | UTF-8 | 761 | 4.03125 | 4 | [
"MIT"
] | permissive |
def selection_smallest_first(lst):
"""Find smallest element and put it in index 0, sort from there."""
for i in range(len(lst)):
smallestIndex = i
for j in range(i + 1, len(lst)):
if lst[j] < lst[smallestIndex]:
smallestIndex = j
if smallestIndex != i:
... | true |
35cce69688c2f4266a68df765d9c9c23e3d84873 | Yogesh11-12/Machine-Learning-Code- | /ML_LR_7.py | UTF-8 | 763 | 2.71875 | 3 | [] | no_license | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
#import statsmodels.api as sm
data=pd.read_csv("FuelConsumptionCo2.csv",squeeze=True,use... | true |
dc157773c3fb1ad43c4917a5ad8d077c50c11e66 | atanx/web_crawler | /ultraracing/ultraracing/spiders/Ur.py | UTF-8 | 2,458 | 2.5625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
import re
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class UrSpider(scrapy.Spider):
name = "Ur"
allowed_domains = ["ultraracing.my"]
start_urls = (
'http://ultraracing.my/ecatalog/',
)
def parse(self, response):
urls = response.xpat... | true |
e71d2d9ef53950d0a3151ff806a97698e40058e5 | sunnyyong2/algorithm | /folder/1545.py | UTF-8 | 99 | 3.53125 | 4 | [] | no_license | N = int(input())
num = N
print(N, end=' ')
for i in range(N):
num -= 1
print(num, end=' ')
| true |
8f4cfff8bf547908a63d1eaf7e822ac6ca43d877 | lmad13/dmcPy3 | /2H2_H2_dummy_outputfiles/object_oriented_guest_script.py | UTF-8 | 12,625 | 2.75 | 3 | [] | no_license | #this script should save your coordinates as a variable, and then find the relationship(plot maybe?) between the position
#of the guest molecule and the position of two oxygen atoms? Or maybe the position of the oxygen atoms and energy?
#Or maybe guest molecules and energy?
#For this code, you will have to know which ... | true |
7d6de7bed40778d2d224f6193baf851c14261db0 | sokolovdp/otus_refactoring_homework | /code_analysator.py | UTF-8 | 3,983 | 2.703125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import argparse
import re
import subprocess
from typing import Iterable
from code_parser import start_parsing, PYTHON_FILES, JAVA_FILES
from data_out import print_results, TOP_VERBS_AMOUNT, VALID_OUTPUT_TYPES
allowed_file_extensions = {
'python':... | true |
d2b8944486a241c2e9f150ad39e71e61de5cb41f | xiacijie/Information-retrieval-Project | /search.py | UTF-8 | 6,350 | 3.1875 | 3 | [] | no_license | import re
full_out = False
# change the flag indicating whether to do the full output or the key output
def change_full_out(full):
global full_out
full_out = full
#do the equaliy search
def equality_search(curs_ye, curs_te, curs_re, match, key):
key = key.lower()
curs1 = curs_te
curs2 = curs_... | true |
073191841e2638d2736d451a0de6b25efb9777bd | cremyos/Grade1_MachingLearning | /DeepLearning/Task5/MnistTest.py | UTF-8 | 5,166 | 2.6875 | 3 | [] | no_license | # -- coding: UTF-8 --
# Name: MnistTest.py
# Date: 2018.06.06
# Author: Lniper
# Aim: 使用tensorboard中的embedding projector工具,对lenet模型提取的数据特征进行可视化
# 要求:训练过程参数记录:
# 1. 在tensorboard中记录查看训练过程中参数(W,b)的分布变化。
# 2. 记录训练过程中loss和ACC的变化
# 测试过程记录:
# 1. 分别记录两次graph,在tensorboard... | true |
bdd4ffde636d1314afc64159f246392887124669 | kyleyoung14/artificialIntelligence_Assig3 | /BIC.py | UTF-8 | 1,245 | 3.390625 | 3 | [] | no_license | import np
#Hey, this will not work. A bunch of these variables need to be replaced with actual shit
class BIC:
#BIC is equal to:
# ln(n)k - 2ln(Lhat)
#
# n is the number of data points
# k is the number of clusters
# Lhat is the resulting likelihood of the model with k clusters
def ... | true |
38bd20d4810f067c91ec9b7e523f1909c779f146 | antsfee/demo-py | /sim_py.py | UTF-8 | 1,249 | 2.640625 | 3 | [] | no_license | import textwrap
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
from tornado.options import define , options
define("port",default=7888,help="run on the given port", type=int)
class ReverseHandler(tornado.web.RequestHandler):
#--------------------------------------... | true |
72e8d0dcfb6fa24e40f88f1eceec00e62acb8c03 | initfortherekt/PyMuleTools | /utilities.py | UTF-8 | 991 | 3.015625 | 3 | [] | no_license | import random
import string
from hashlib import sha256
def hash256(payload):
return sha256(sha256(payload).digest()).digest()[::-1]
def get_message_id(id_length=8):
# In the java version, the toJSON method has multiple concerns and global side-effects
# The construction of message_id should be broken o... | true |
6caae0d8fa719900d4aaa9b659a928cffa80d37e | yejikk/Algorithm | /알고리즘실습/AD/숫자카드.py | UTF-8 | 494 | 3.25 | 3 | [] | no_license | import sys
sys.stdin = open('숫자카드.txt')
T = int(input())
for tc in range(1, T+1):
N = int(input())
cards = input()
cnt = [0] * 10
for card in cards:
n = int(card)
cnt[n] += 1
idx = 0
num = 0
for i in range(len(cnt)):
if cnt[i] > num:
num = cnt[i]
... | true |
8813672c06242c89e58eb4918b8166429eeedee9 | vruyr/scripts | /open-messages.py | UTF-8 | 1,277 | 2.703125 | 3 | [] | no_license | #!/usr/bin/env python3
"""
Usage:
{prog} [--message=TEXT] [--just-print] (ADDRESS)...
Positional Parameters:
ADDRESS Message recipients
Options:
--message, -m TEXT The message text to pre-fill.
--just-print, -n Do not open Messages, just print the url that will.
"""
import sys, locale, os, urllib.par... | true |
f7bd46af3b343582f1d57030dec8db8a7a7072d4 | MJC598/Python | /simpleCalculator.py | UTF-8 | 1,879 | 4.5 | 4 | [] | no_license |
"""Simple Four Function Calculator"""
class Calculator(object):
def __init__(self, numberOne, numberTwo):
self.numberOne = numberOne
self.numberTwo = numberTwo
def add(self):
answer = self.numberOne + self.numberTwo
return answer
def multiply(self):
answer = ... | true |
bceb63d6d4cb059938eceb62a54ffcedefc08154 | DanglaGT/code_snippets | /pandas/outer_join.py | UTF-8 | 455 | 3.828125 | 4 | [] | no_license | # this code demonstrates how to outer join
# two pandas dataframes
import pandas as pd
import numpy as np
df1 = pd.DataFrame({'key': ['A', 'B', 'C', 'D'],
'value': np.random.randn(4)})
df2 = pd.DataFrame({'key': ['B', 'D', 'D', 'E'],
'value': np.random.randn(4)})
print(df1)
p... | true |
11ca0eba713e6989e1a73293e1ec57d7399667d9 | mdarfilal/python-training | /histoVote.py | UTF-8 | 2,107 | 3.546875 | 4 | [] | no_license | import sys
import os
import matplotlib.pyplot as plt
import random
#Name of script without path
script_name = os.path.basename(sys.argv[0])
usage = "Usage : " + script_name + " name_first_candidate name_second_candidate number_of_citizens"
#Check number of parameters, Three required
if(len(sys.argv) != 4):
print("... | true |
b6ccf482c8e3b71b023dee3cf952612347916299 | agdelig/bfs_maze_solution | /tests/find_path_tests.py | UTF-8 | 816 | 3.125 | 3 | [] | no_license | import unittest
from app.find_path import BFSMaze
class TestBFSMaze(unittest.TestCase):
def test_path_to_right(self):
maze = [
[1, 1, 1, 1],
[1, 0, 0, 1],
[1, 0, 0, 1],
[1, 1, 1, 1]
]
start = (1, 1,)
end = (1, 2,)
path = BF... | true |
59624c59cee163c9de1270b48dd93ad3bb7a2979 | MatiasPineda/projecteuler | /problems/problem7.py | UTF-8 | 388 | 3.421875 | 3 | [] | no_license | def n_th_prime(num:int):
primes = [2]
is_prime = True
number = 3
while len(primes) < num:
for i in primes:
if number % i == 0:
is_prime = False
break
if is_prime:
primes.append(number)
number += 2
is_prime = True
... | true |
28a78dfbeaf8696fcb753f1c633aa96680a2a09b | amcmaste/travelapp | /app/functions.py | UTF-8 | 1,066 | 2.78125 | 3 | [] | no_license | #Imports
from app import db
from app.models import Reservation
from flask import jsonify
from datetime import datetime
#Functions
def write_db(con, typ, com, sta, end, cos):
#Convert to Python datetime
sta = datetime.strptime(sta, '%Y-%m-%d')
end = datetime.strptime(end, '%Y-%m-%d')
#Add new entry
entry = Reser... | true |
1156185298064577225d756f672bed2ed9a6b5c0 | Komoldin/myProject | /Камалдин/Milli.py | UTF-8 | 7,286 | 2.578125 | 3 | [] | no_license | from tkinter import*
import pygame
pygame.init()
root = Tk()
root.title("Who Wants to be a Millionaire")
root.geometry('1352x652+0+0')
root.configure(background ='black')
ABC = Frame(root, bg='black')
ABC.grid()
ABC1 = Frame(root, bg='black',bd=20, width=900, height=600)
ABC1.grid(row=0,column =0)
ABC2... | true |
8c92f083eb442f1d8a107994342fcd2f46189b3d | dertilo/coreference-resolution | /scoring.py | UTF-8 | 1,377 | 3.21875 | 3 | [] | no_license | import torch
from torch import nn as nn
from utils import to_cuda
class FFNN(nn.Module):
def __init__(self, embeds_dim, hidden_dim=50):# paper says 150
super().__init__()
self.score = nn.Sequential(
nn.Linear(embeds_dim, hidden_dim),
nn.ReLU(),
nn.Dropout(0.20)... | true |
5fa7879d95a5d3c0fe23b5e4e327fd683c958805 | b1ru/limited-internet | /limitedinternet | UTF-8 | 2,915 | 2.59375 | 3 | [] | no_license | #!/usr/bin/python3
import subprocess
import shutil
import sys
import os
def enable_limited_access():
try:
shutil.copy('/etc/.nsswitch.conf.limited.internet.on', '/etc/nsswitch.conf')
build_hosts()
print("[+] limited internet = ON.")
except PermissionError:
print("[-] Permission... | true |
ce986708daa0899adeb5f691dc599ba0c7e9eafd | andrewjoliver/OptimalGridSearch | /DSFBidirectionalSearch.py | UTF-8 | 4,799 | 3.015625 | 3 | [] | no_license | import multiprocessing
from multiprocessing import Process
from GridSetUp import generate_grid
from Printers import print_map, print_path
class UpperGridCell:
def __init__(self, x, y, n):
self.x = x
self.y = y
self.down_expanded = True if (self.x + self.y) == n else False
self.righ... | true |
569a9c7ae2f171502228b7adc8599f20ae44da9e | jeeva91/my_eclipseworkspace | /hello/jeeva/hello/text_pad.py | UTF-8 | 317 | 2.875 | 3 | [] | no_license | '''
Created on Mar 15, 2017
@author: jee11
'''
from tkinter import *
root = Tk()
T = Text(root, height=2, width=30)
T.pack()
T.insert(END, "Just a text Widget\nin two lines\n")
def insertotext():
T.insert(END,"i love harika")
T.see(END)
T.after(500,insertotext)
T.after(50, insertotext)
root.mainloop()
| true |
44af81b591c3bfdb079331a63e1faf14f3223046 | obi-ml-public/echoAI-PET-measurements | /src/echoai_pet_measurements/TFRprovider.py | UTF-8 | 7,049 | 2.640625 | 3 | [
"MIT"
] | permissive | """
This file is part of the echoAI-PET-measurements project.
"""
#%% Imports
import os
import sys
import numpy as np
import tensorflow as tf
import tensorflow_addons as tfa
#%% Functions and classes
class DatasetProvider:
''' Creates a dataset from a list of .tfrecords files.'''
def __init__(self,
... | true |
3ff98fe691d25a69fd2122d5b394fd5d16ee56e8 | kevinyu/astro121 | /lab_digital/code/1_1_1_plots.py | UTF-8 | 2,111 | 2.625 | 3 | [] | no_license | from pylab import *
import numpy as np
from scipy.optimize import curve_fit
from dft import dft
t = np.arange(1e-4, 257e-4, 1e-4)
t2 = np.arange(1e-4, 257e-4, 1e-6)
f, subplotaxes = plt.subplots(9, 2, sharex="col", sharey=False)
for x in range(1, 10):
filedict = np.load("../data/1_1_1/fsig_%s.0.npz" % (x*1000))... | true |
630b576b9325dbba4800439a005a5a923cba2779 | angel-robinson/validadores-en-python | /#boleta5.py | UTF-8 | 600 | 3.671875 | 4 | [] | no_license | #input
clientes=int(input("ingrese la cantidad de clientes:"))
compras_por_dia=int(input("ingrese la cantidad de compras por cliente"))
#procesing
efectivo=(clientes*compras_por_dia)
#vereficador
clientes_regulares=(clientes>=20)
#output
print("###############################")
print("# BOLETA DE VENTA ")
p... | true |
4556cb4914fd13fe49d814c8dc74384cfa5b3ead | J3ff3rs0nP4z/rep1 | /Exercicios aula 02/Aula02 Ex04-Função Reduce.py | UTF-8 | 165 | 2.734375 | 3 | [] | no_license | import os
os.system('cls')
#Execute a Função REDUCE em uma tupla onde umas das funções a serem utilizadas tem que ser uma função lambda.
print('-=-'*30) | true |
e5bafd17969c6ad525997bc7ea9c09f36898f724 | Antonji-py/parcel-tracking-python | /modules/upsApi.py | UTF-8 | 2,735 | 2.609375 | 3 | [] | no_license | import requests
import json
class UpsParcel:
def __init__(self, tracking_number):
self.tracking_number = tracking_number
self.get_data()
def get_tracking_number(self):
return self.tracking_number
def get_data(self):
response = requests.get(f"https://tracking.pb.com/api/{... | true |
60a893903c7d2a8cf78537dbbdeed10e208ed676 | kkneomis/python_class1 | /in_class/problem_7_answer_game_machine.py | UTF-8 | 1,892 | 3.96875 | 4 | [] | no_license | import random
class GameMachine:
def __init__(self, coins):
self.coins = coins
def play_game(self):
while self.coins > 0:
print "1: Guess the number"
print "2: Rock, Paper, Scissors"
choice = int(raw_input("Choose a game"))
if choice == 1... | true |
41de1059dbb2c3c65fdcc53064ac8a87e81766f7 | deepa-karthik/Python_assignments | /task3/task3_2.py | UTF-8 | 771 | 4.75 | 5 | [] | no_license | #2)Create a list of size 5 and execute the slicing structure
new_list=[10,20,30,40,50]
print(len(new_list)) # 5
#print list as is
print(new_list[:]) #[10, 20, 30, 40, 50]
#slice from start.. get items from start until item number 4...index not considered
print(new_list[:4]) #[1... | true |
36abc94426f3a29fbf3660da48a6619c05683b7a | KRHS-GameProgramming-2017/Thrudore | /main.py | UTF-8 | 4,820 | 2.671875 | 3 | [] | no_license | import sys, pygame, math
from Player import *
from UIManager import *
from SceneManager import *
from Item import *
from TextManager import *
from playeranimation import *
from Text import *
mult = 1
mult2 = 1
#Inital stuff
pygame.init()
clock = pygame.time.Clock()
width = 800
height = 600
size = width, height
screen... | true |
e9469dc0df99c59d22ba3d831de6d0e9197c8abe | AndersonFSP/Curso-em-V-deo-Python | /032-AnalizandoOAno.py | UTF-8 | 309 | 3.46875 | 3 | [] | no_license | from datetime import date
ano = int(input('Qua ano quer analisar ? Coloque 0 se quiser o numero atual '))
if ano == 0:
ano = date.today().year
if ano % 4 == 0 and ano % 100 !=0 or ano % 400 == 0 :
print('O ano {} é Bissexto'.format(ano))
else:
print('O ano é {} Não é Bissexto'.format(ano))
| true |
87f51658bb8f3cccc550cc19579a7514bc0e74e6 | nrqzdhlsc/OpenHealth | /AI_Models/clicr/neural-readers/ga-reader/utils/utils.py | UTF-8 | 4,282 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | import json
import os
import subprocess
DATA_KEY = "data"
VERSION_KEY = "version"
DOC_KEY = "document"
QAS_KEY = "qas"
ANS_KEY = "answers"
TXT_KEY = "text" # the text part of the answer
ORIG_KEY = "origin"
ID_KEY = "id"
TITLE_KEY = "title"
CONTEXT_KEY = "context"
SOURCE_KEY = "source"
QUERY_KEY = "query"
CUI_KEY = "c... | true |
f4aa4cf9063cc396624f668aded0f86844eb2615 | sebodev/smash-utils | /utils/maintenance_utils/updates.py | UTF-8 | 2,355 | 2.703125 | 3 | [] | no_license | from lib import wp_cli
from runner import smash_vars
import datetime
#remove these once I don't have to prompt for the google drive folder
import os
from pathlib import Path
from lib import webfaction
from lib import domains
import lib.password_creator
from lib import errors
def main(server, app, save_results=None):
... | true |
57d3dfcaf724e9d91c274a732184c0dbe151b027 | MisaelAugusto/computer-science | /programming-laboratory-I/p3bo/colegas.py | UTF-8 | 275 | 3.234375 | 3 | [
"MIT"
] | permissive | # coding: utf-8
# Aluno: Misael Augusto
# Matrícula: 117110525
# Problema: Colegas de Sala!
def colegas_de_sala(salasprofs, professor):
lista = []
for prof in salasprofs:
if prof != professor and salasprofs[prof] == salasprofs[professor]:
lista.append(prof)
return lista
| true |
84fd3f761c425e2acb98f4a59705bf3584a98078 | dhurataK/Django | /time_display_assignment/apps/timedisplay/views.py | UTF-8 | 348 | 2.53125 | 3 | [] | no_license | from django.shortcuts import render
import datetime
# Create your views here.
def index(request):
day_format = "%b %d, %Y"
time_format = "%I:%M %p"
today = datetime.datetime.today()
day = today.strftime(day_format)
time = today.strftime(time_format)
return render(request, "timedisplay/index.html... | true |
f5db979514680672c44b012b50822330e7fa611f | wenzel-felix/Pathfinder | /Node.py | UTF-8 | 1,002 | 2.953125 | 3 | [] | no_license | import colors
class Node:
start_node = False
end_node = False
is_wall = False
curr_height = 1
size = 9
path_predecessor = []
exhausted = False
best_path = False
step = 1000
def __init__(self, x_cord_input, y_cord_input):
self.x_cord = x_cord_input * 10
self.y_... | true |
83f1ecad3558e2778c1e74ccdbeded900b88e2e2 | PTracana/BD2021 | /Web/updateProducts.cgi | UTF-8 | 1,098 | 2.75 | 3 | [] | no_license | #!/usr/bin/python3
import psycopg2
import cgi
import login
form = cgi.FieldStorage()
ean = form.getvalue('ean')
descr = form.getvalue('descr')
print('Content-type:text/html\n\n')
print('<html>')
print('<head>')
print('<title>Supermarket</title>')
print('</head>')
print('<body>')
connection = None
try:
#To preve... | true |
41dc0ab03e89be0bf5e145a589650ca297ac063a | FinnFun/douban_books_scraping | /books_data.py | UTF-8 | 3,870 | 2.65625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-05-07 08:19:57
# @Author : Your Name (you@example.org)
# @Link : http://example.org
# @Version : $Id$
import pandas as pd
import numpy as np
from bs4 import BeautifulSoup as bs
import requests
import re
import random
books = {'Book_name':[], 'Author'... | true |
0daf86f4400a2478d2c712cbff83cae45c764c93 | ScrummyBears/TIC | /unittests/CheckCatsGame_Unittest.py | UTF-8 | 1,746 | 2.84375 | 3 | [] | no_license | #This can run independently
import unittest, sys, os
#modifying sys path to import winLogic
lib_path = os.path.abspath(os.path.join('..','Game'))
sys.path.append(lib_path)
from checkWinLogic import WinLogic
#Each def test a specific patern. Hardcoded, yes, but the failure output list per function so
class CheckCats... | true |
178e1b48ddc82842e0ebc0319b454dea5866ad08 | XiaoTu1/qishi_algorithm | /back_tracking/Combinations.py | UTF-8 | 509 | 3.171875 | 3 | [] | no_license | class Solution(object):
def combine(self, n, k):
"""
:type n: int
:type k: int
:rtype: List[List[int]]
"""
self.results = []
path = []
self.dfs(path, n, 1, k)
return self.results
def dfs(self, path, n ,p... | true |
e3d01255b673ec36e5c04bb7dbe31b020a3c2d5e | pololee/oj-leetcode | /companies/airbnb/round_prices/RoundPrices.py | UTF-8 | 2,196 | 3.421875 | 3 | [] | no_license | import math
import unittest
class PriceWrap:
def __init__(self, idx, price):
self.idx = idx
self.price = price
self.floorPrice = math.floor(price)
self.floorDiffAbs = abs(self.price - self.floorPrice)
self.ceilPrice = math.ceil(price)
self.ceilDiffAbs = abs(self.cei... | true |
f2517f98c314471560612b15aca03282384b024f | pauleveritt/htm.py | /htm/__init__.py | UTF-8 | 8,582 | 2.765625 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import re
import functools
from tagged import tag, ParseError
RE_COLLAPSE = re.compile(r"^[^\S\n]*\n\s*|[^\S\n]*\n\s*$")
def collapse_ws(string):
return RE_COLLAPSE.sub("", string)
def get_simple_token(scanner, regex):
match = scanner.match(regex)
if not match:
raise ParseError("no token found... | true |
34efc23695de59d7d665c9f8edb638eb051d7950 | hopeaktian/practice | /exam1.py | UTF-8 | 1,247 | 3.21875 | 3 | [] | no_license | #!/usr/bin/env python
#coding:utf-8
"""
file:.py
date:2018/9/20 19:56
author: peak
description:
有一个分布式服务集群,集群内含有N个服务节点,分别记为1到N。
基于一个列表times,表示消息从两个节点间有向传递需要的时间。times[i]=(s,d,t),其中s 表示
发出消息的源节点,d表示接收到消息的目标节点,t表示信息的有向传递的时间。
现在K节点发送了一个信号,请问至少需要多少秒才能使所有的服务节点都接收到该消息?如果消息
不能传递给集群内全部节点,则返回-1。
"""
def ... | true |
a4681394e73c8c3713987da1dc4962b3a0dd510a | naveenameganathan/python3 | /O14XOR.py | UTF-8 | 213 | 2.734375 | 3 | [] | no_license | p,q=map(int,input().split())
l=list(map(int,input().split()))
for i in range(q):
r,s=map(int,input().split())
t = l[r-1:s]
u = t[0]
for i in range(1,len(t)):
u = u ^ t[i]
print(u)
| true |
ebe4ab8cc161b83468f178a6e48cddd355cb08d7 | jonathanyakubov/Algorithmic-Stock-Trading-Program- | /project.py | UTF-8 | 9,471 | 2.875 | 3 | [] | no_license |
def date_extraction():
import csv
apple_stock_data=open('AAPL.csv')
apple_stock_data_f=csv.reader(apple_stock_data)
Date_list=[]
for row in apple_stock_data_f:
Date,Open, High, Low, Close, Adj_close, Volume =row
Date_list.append(Date)
Date_list.pop(0)
return Date_list
def opening_extraction... | true |
4acc1c0469de9f657d15274f89a725dbdbb0cc4e | ManhND27/Training_VMO_TwoMonth | /day12/crawl.py | UTF-8 | 1,473 | 2.671875 | 3 | [] | no_license | import time
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.keys import Keys
import pandas as pd
#1. Khai bao bien brower
brower = webdriver.Chrome(executable_path="D:\Coder\src\PROJECT AI\ketquasoxo\chromedriver.exe")
data = []
years = []
month = []
cve = [[[]]]
idx = 0
url = 'ht... | true |
cc65a1bfb1e9e75e24ba214169340c3992b59449 | CSC510-Group-25/ClassMateBot | /cogs/ping.py | UTF-8 | 2,114 | 2.859375 | 3 | [
"MIT"
] | permissive | # Copyright (c) 2021 War-Keeper
from discord.ext import commands
# ----------------------------------------------------------------------------------------------
# Returns the ping of the bot, useful for testing bot lag and as a simple functionality command
# ----------------------------------------------------------... | true |