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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
e3979d3404ec5226d7b7dd4c482498b834abfe48 | Python | xinzhusun/On-fire_CMSC12300 | /data preparation/get_url_list_by_year.py | UTF-8 | 708 | 3.03125 | 3 | [] | no_license | import bs4
import requests
import csv
def get_file_by_year(start_year, end_year):
lst = []
for i in range(start_year, end_year +1):
url = 'https://www.ncei.noaa.gov/data/global-hourly/access/{}/'.format(i)
r = requests.get(url)
soup = bs4.BeautifulSoup(r.text, 'lxml')
tag_list = soup.find_all('a')
for ta... | true |
2abe0f39e1de807aa32a1107603684e86f4fdfdd | Python | niemasd/Tree-Based-Clustering-Paper | /scripts/cluster_growth_rates.py | UTF-8 | 1,755 | 3.234375 | 3 | [] | no_license | #!/usr/bin/env python3
'''
Given two clusterings in the Cluster Picker format, output cluster growth rates.
'''
# growth rate function
def growth(n1,n2):
return (n2-n1)/(n2**0.5)
# run main program
if __name__ == "__main__":
import argparse; from gzip import open as gopen
parser = argparse.ArgumentParser(... | true |
08f79339f4e4e016e68379a7076e5635ed280b1d | Python | neket521/DSTextEditor | /Server/queue.py | UTF-8 | 1,249 | 2.65625 | 3 | [] | no_license | class Queue: # also history
def __init__(self):
self.__counter = 0
self.__msgs = []
def reinit(self):
if len(self.__msgs) > 0:
self.write_to_file()
self.__counter = 0
self.__msgs = []
def add(self, tuple):
if len(self.__msgs) == 25:
... | true |
bdc37e358505503a49d4b341190793abe0f15caa | Python | md6410/six11hacks | /radio/warble.py | UTF-8 | 2,408 | 3.140625 | 3 | [] | no_license | #!/usr/bin/env python
# warble.py - GNU Radio script demonstrating how to dynamically update block
# parameters. Every second it calculates two pitches (constrained
# by the command-line parameters, e.g. 200 and 800) and plays them.
# It produces a science-fiction-like "warble" soun... | true |
96dc4a43c9bbeb3b04699a3ddf1b3a1d4760436a | Python | vikasrtr/pyDist | /distributions/gamma_dist.py | UTF-8 | 1,610 | 3.40625 | 3 | [] | no_license | """
Gamma Distribution
__author__ : 'vikas_rtr'
__date__ : June 2015
"""
import numpy as np
from numpy import (exp, sqrt, pi)
from scipy.special import gamma
import matplotlib.pyplot as plt
class gamma_dist():
"""Gamma Distribution
shape = k = a
scale = theta = 1/rate
pdf = ((b**a)*(x**(a-1))*... | true |
b24627c15ccef05f26a9d2015b35ec43a2deefa6 | Python | tangq/zppy | /zppy/templates/readTS.py | UTF-8 | 1,621 | 2.546875 | 3 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | import cdms2
import cdutil
class TS(object):
def __init__(self, filename):
self.filename = filename
self.f = cdms2.open(filename)
def __del__(self):
self.f.close()
def globalAnnual(self, var):
# Constants, from AMWG diagnostics
Lv = 2.501e6
Lf = 3.337e... | true |
de3baaeea09589c70d2f928e6d11103cbcee59b6 | Python | Dolinin2021/all-hw-lecture-10 | /iq_hero.py | UTF-8 | 603 | 3 | 3 | [] | no_license | import requests
def get_intelligence_hero(list_name):
iq_list = []
for name in list_name:
url = "https://superheroapi.com/api/2619421814940190/search/" + f'{name}'
resp = requests.get(url)
for value in resp.json()['results']:
if value['name'] == name:
IQ_h... | true |
a7f4791ffea04ed0ad191fe6d6d3361a85f37e7f | Python | EryclesIc/Fila-e-Arvore | /main.py | UTF-8 | 1,630 | 3.46875 | 3 | [] | no_license | from estruturaFila import Queue
from estruturaArvore import BinaryTree
import pandas as pd
import random
fila = Queue()
# efetua a leitura do csv com a biblioteca pandas
df = pd.read_csv("https://raw.githubusercontent.com/EryclesIc/Fila-e-Arvore/main/metadata.csv", encoding="UTF-8")
# calcula a quantidade total de l... | true |
57a33d3d3131bbd9d5afefe47d7d26cf7a0d363e | Python | cdueltgen/dtr | /test-tweepy.py | UTF-8 | 1,054 | 2.734375 | 3 | [] | no_license | from time import sleep
from keys import *
import tweepy
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(OAUTH_TOKEN, OAUTH_SECRET)
api = tweepy.API(auth)
def sleepy():
timeline = api.home_timeline()
timeline.reverse()
print timeline[-1].id
while True:
sleep(3... | true |
3dad3d80f7e92bb8e0cd59e1e843dd4ce85e8605 | Python | cogito666/Subtitle-video | /synchronization_path.py | UTF-8 | 5,118 | 3.21875 | 3 | [] | no_license | from scipy.signal import savgol_filter
import numpy as np
def dpcore(M, pen):
"""Core dynamic programming calculation of best path.
M[r,c] is the array of local costs.
Create D[r,c] as the array of costs-of-best-paths to r,c,
and phi[r,c] as the indicator of the point preceding [r,c] to
... | true |
2322553061a60324394d0d1e949a52f9fe45e00f | Python | jhonyxf/python-ransomwares | /discovery.py | UTF-8 | 524 | 3.046875 | 3 | [] | no_license | import os
def discover(initial_path):
extensions = ['jpg', 'png','pdf']
for dirpath, dirs, files in os.walk(initial_path):
for _file in files:
absolute_path = os.path.abspath(os.path.join(dirpath,_file))
ext = absolute_path.split('.')[-1]
if ext in extensions:
... | true |
46c167d628a9ba794cfc1ebf1ea058c13323a46c | Python | georgelok/crimsononline-assignments | /assignment2/tests.py | UTF-8 | 1,539 | 2.890625 | 3 | [] | no_license | from question1 import *
# Testing Content, Article, and Picture classes.
# remember to delete test article-me3 to test saving.
c = Content("test content", "content subtitle", "me1", 2013, 7, 1, "slug1")
#c.show()
p = Picture("test picture", "picture subtitle", "me2", 2012, 10, 2, "test.png")
#p.show()
a= Article("t... | true |
c2d050b421244b3dde32c253b080c5a7f2838855 | Python | chuangying2017/mao_yan | /hongyou.py | UTF-8 | 2,513 | 2.84375 | 3 | [] | no_license | import requests
from pyquery import PyQuery
import lxml
import csv
url = 'https://www.hongxiu.com/'
headers = {'User-Agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/76.0.3809.100 Safari/537.36",
'Host': 'www.hongxiu.com'
... | true |
19e3606288c9919429c8b876835ba720f5f6a1e8 | Python | lingxiao/adj-relation | /experiments/regression/utils/nu.py | UTF-8 | 2,460 | 2.984375 | 3 | [] | no_license | ############################################################
# Module : feature representation nu based on neighbors
# Date : April 24th, 2017
# Author : Xiao Ling
############################################################
import math
import numpy as np
from utilities import *
#################################... | true |
4d8c935e527b9d0899ebfa16d7af14ee5074c6c2 | Python | cmeon/AndyImage | /andy_image_resize.py | UTF-8 | 1,293 | 2.71875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
import sys
from os import path, mkdir
from vipsCC import *
sizes = { 'ldpi':3, 'mdpi':4, 'hdpi':6, 'xhdpi':8, 'xxhdpi':12, 'xxxhdpi':16 }
if ( len(sys.argv) < 2):
print """
(H)Andy Image Resize
-----------------------------------
This program resizes images into ldpi to xxxhdpi
** I... | true |
17e46104902d5d44ca1e5cb74ad94fab4f1a35f1 | Python | taxintt/sample-socket-prog | /echo.py | UTF-8 | 1,791 | 2.9375 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
def main():
# prepare IPv4/TCP socket
## SOCK_STREAM: TCP connection (byte stream)
serversocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Addressのreuseを許可する('Address already in use' の回避策)
serversocket.setsockopt(socket.SOL_SO... | true |
643f42791438a1d995e6d3f90917373d81192112 | Python | ShinDongHyeop/2DGP | /dist/Resource/Character2/Cookie2_Sprite_Sheet.py | UTF-8 | 5,256 | 2.671875 | 3 | [] | no_license | from pico2d import *
open_canvas()
grass = load_image('grass.png')
character = load_image('Cookie2_Slide.png')
def handle_events():
global running
events = get_events()
for event in events:
if event.type == SDL_QUIT:
running = False
elif event.type == SDL_KEYDOWN and event.key =... | true |
1ec22a7d26d134e04bce8e820ea7934e826a0bed | Python | smadacm/game-word-generator | /Render/views.py | UTF-8 | 1,166 | 2.53125 | 3 | [] | no_license | import json
from django.shortcuts import render
from django.views.generic import TemplateView
from django.http import HttpResponse
# Create your views here.
class Index(TemplateView):
template_name = 'render/home.html'
def wordsForApp(request):
data = {
'categories': {
1: 'Easy',
... | true |
de12138b1bfe12607af70142134a991ebc429ca9 | Python | georgesk/irem-jongle | /jongle/objetphysique.py | UTF-8 | 4,082 | 3.125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from copy import deepcopy
from .matrix import matrix
class ObjetPhysique():
def __init__(self, parent, ident, group, matrice, vx=0, vy=0):
"""
Définit un objet 2D par ses coordonnées dans l'espace de phase
(position, vitesse)
:param parent: un parent, qui c... | true |
02f2265eff5f9942bee4b490caeac618c91cbf57 | Python | millerJK/pythonTest | /函数定义.py | UTF-8 | 459 | 4.03125 | 4 | [] | no_license | def test(name):
if name == '小明':
print("欢迎您")
else:
print("不知道您在说什么")
test("阿花")
# 写架构的时候,在定义方法的时候先定义方法,暂不实现方法可以使用pass
def firstBlood(strs):
pass
print(firstBlood("哈哈"))
# 函数返回多个值
def move(x, y):
return x, y
x, y = move(4, 5);
print("函数返回多个结果:x: %d y:%d... | true |
9dd40b9e39638cbb51725c5edb00d2658afe2ebd | Python | dabay/LeetCodePython | /38CountAndSay.py | UTF-8 | 1,839 | 4.125 | 4 | [] | no_license | # -*- coding: utf8 -*-
'''
__author__ = 'dabay.wang@gmail.com'
38: Count and Say
https://oj.leetcode.com/problems/count-and-say/
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off a... | true |
e18a7ab6d9436437fc56a3a59f95e515e7e1b188 | Python | samarv/Knapsack | /.ipynb_checkpoints/knapsack-checkpoint.py | UTF-8 | 1,206 | 3.359375 | 3 | [] | no_license | #!/usr/bin/python
import sys
from collections import namedtuple
import random
Item = namedtuple('Item', ['index', 'size', 'value'])
def knapsack_solver(items, capacity):
maxval = []
for i in range(0,1000000):
size = 0
value = 0
its = []
nums = list(range(0,len(items)))
... | true |
cef1787efd5ca11ca128cd2945e1e12b059ecb4b | Python | kartoffeln777/BaseballSim | /Functions/practice.py | UTF-8 | 409 | 3.46875 | 3 | [] | no_license | from pylab import *
# Generate some random data...
x = linspace(55478, 55486, 100)
y = random(100) - 0.5
y = cumsum(y)
y -= y.min()
y *= 1e-8
# plot
plot(x,y)
# xticks
locs,labels = xticks()
print locs
print labels
xticks(locs, map(lambda x: "%g" % x, locs))
# ytikcs
locs,labels = yticks()
ytick... | true |
f294777f11a521d1fe1507a8ab744271b48af040 | Python | eempc/PythonScripts | /chromedriver.py | UTF-8 | 858 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
import time
import os
import datetime
# Google search
chromedriver_path = 'D:/chromedrivers/74.0.3729.6/chromedriver.exe'
url = 'http://www.google.com/xhtml'
search_string = 'ChromeDriver'
file_name = str(datetime.datetime.now().strftime('%Y-%m-%d %H%M%S')) + " " + "Test.txt"
save_path ... | true |
8e5e1c3a8f2dc0008980ecbff21bfc87c18d0b73 | Python | aruplightlab/letter-lighting | /fixture_manager.py | UTF-8 | 3,472 | 2.640625 | 3 | [] | no_license | import pysimpledmx
from threading import Timer
from fixtures import RGBFixture, RGBWFixture
from states import STATE_LIST, STATE_LISTS
PATCH = [
# (1, 1, RGBWFixture),
(2, 5, RGBFixture),
# (3, 8, RGBWFixture),
(4, 12, RGBFixture),
# (5, 15, RGBWFixture),
# (6, 19, RGBFixture),
# (7, 22, RG... | true |
fd520d1f0e3c10ee7ac0884841588ae37ec6d69c | Python | falconair/ProgrammingForAnalytics | /programs/killings_per_season.py | UTF-8 | 386 | 3.28125 | 3 | [] | no_license | data_file_location = "../datasets/deaths-in-gameofthrones/game-of-thrones-deaths-data.csv"
season_d = dict()
#Open file
file = open(data_file_location, encoding='utf8')
#Go through each line in file
for line in file:
tokens = line.split(',') #separate line into columns
s = tokens[1]
if s not in season_d: seaso... | true |
8ada27aa23030c43dc6f4b19fc41a8b9ac9e09ac | Python | wiinakau/learning-python | /python - curso em video/ex016.py | UTF-8 | 225 | 3.828125 | 4 | [] | no_license | from math import pi, trunc
inteiro = float(input('Digite um número real: '))
print('O valor digitado foi {}, e a porção inteira é : {}'.format(inteiro, trunc(inteiro))) #retorna a parte inteira do número real
print(pi) | true |
ff191e6dac073343203af88b2b4cfd376a9d98cc | Python | EgorRodrigues/catalog | /src/units/services.py | UTF-8 | 362 | 2.640625 | 3 | [] | no_license | from src.units.repository import Repository
from src.units.schemas import UnitIn, UnitInDB
class UnitService:
def __init__(self, repository: Repository):
self.repository = repository
async def prepare_create(self, unit: UnitIn) -> UnitInDB:
result = await self.repository.add(unit.to_model())
... | true |
b5597d076a6d51cab1c97a6b529666400594cfcb | Python | mihir6598/python_competitive | /eduraca/Determine if the sum of two integers is equal to the given value.py | UTF-8 | 237 | 3.109375 | 3 | [] | no_license | def solve(arr,n):
final = {}
for i in arr:
if n-i in final:
return True
else:
final[i] = "1"
return False
if __name__ == "__main__":
arr = [5,7,1,2,8,4,3]
print (solve(arr,100)) | true |
018c460a586c25850a4c85288f8c2a5a5c57799e | Python | Singapore17/team-10 | /address.py | UTF-8 | 689 | 2.9375 | 3 | [] | no_license | import requests
import json
def address(locationA, locationB):
locationA = 'Singapore ' + str(locationA)
locationB = 'Singapore ' + str(locationB)
token = 'AIzaSyDt1sdk_E9Xiauy2xb2V7otwS2qp-2xvfs'
api = 'https://maps.googleapis.com/maps/api/distancematrix/json?'
payload = {
'origins... | true |
5a926ba1f767ad260a1c6c86aaecf35c8e59c9e8 | Python | strongholder/mathapi | /mathapi/services/factorial.py | UTF-8 | 311 | 3.375 | 3 | [] | no_license | import functools
import math
class InvalidInputError(Exception):
pass
@functools.lru_cache(1000)
def factorial(n):
"""
Compute `n!` for a given positive integer `n`
"""
if n < 0:
raise InvalidInputError("Factorial not defined for negative values")
return math.factorial(n)
| true |
183ece082dd479585165dc544c0e2f6354c3abee | Python | esergly/Python_Tasks | /Task 74.py | UTF-8 | 1,550 | 4.28125 | 4 | [] | no_license | """
Task 74
Дробь x/n называется правильной несократимой, если выполнены условия:
1.0 < X < N
НОД(X,N) = 1,
где N - натуральное число, где N<10**6
Необходимо вывести количество правильных несократимых дробей со знаменателем N.
Например:
N = 11, Result = 10
N = 12, Result = 4
N = 17, Result = 16
"""
'''
идея: ищем ... | true |
11e845e92e56d0a4df62b83f26d5b7e1bc482353 | Python | errord/chbook_jtoh | /json_to_html.py | UTF-8 | 2,970 | 2.75 | 3 | [] | no_license | #! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright: error.d
# Date : 2013-12-31
# Create by: error.d<error.d@gmail.com>
#
import sys
import json
def usage():
print "usage: %s bookmarks html_bookmarks" % sys.argv[0]
class Bookmark:
def __init__(self):
self._json_bookmark = None
self... | true |
523ecda2b0c8b9b7e99f5ed03006d5badc9b6201 | Python | vvvin333/face_edit | /linear_interpolations.py | UTF-8 | 1,823 | 2.859375 | 3 | [] | no_license | import argparse
import json
from utility_functions import linear_interpolations
def parse_args():
"""Parses arguments."""
parser = argparse.ArgumentParser(description='Generate photo of persons that do not exist.')
parser.add_argument('-m', '--model_name', type=str, default='stylegan_ffhq',
... | true |
05b1b988117d6273214cb330d0f39513841cfbf5 | Python | ronniemaor/timefit | /shapes/scaled.py | UTF-8 | 1,250 | 2.890625 | 3 | [] | no_license | from shape import Shape
class ScaledX(Shape):
""" An adapter to other shapes that transforms the x input before
calling the underlying shape, so the resulting function is
g(x) = f(s(x))
"""
def __init__(self, shape, scaler):
Shape.__init__(self, shape.priors)
self.... | true |
c8b0e03dc5d8af362fec00d4b7602a052d4cd75d | Python | NeuralEnsemble/ephyviewer | /ephyviewer/datasource/video.py | UTF-8 | 10,959 | 2.625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
#~ from __future__ import (unicode_literals, print_function, division, absolute_import)
from .sourcebase import BaseDataSource
import sys
import numpy as np
try:
import av
HAVE_AV = True
except ImportError:
HAVE_AV = False
AV_TIME_BASE = 1000000
def pts_to_frame(pts, time_base... | true |
6bbeb7c2a0588fa34772c1c1a69468a7c9ee297d | Python | snowwayne1231/Nccu-109-AI | /109-1-ai/8-queen/searchs.py | UTF-8 | 10,048 | 2.890625 | 3 | [] | no_license | from nodes import Node
from enums import SearchStatus
import math, time
class BasicSearch():
"""
"""
STATUS_SOLUTED = SearchStatus.SOLUTION
STATUS_FAILURE = SearchStatus.FAILURE
problem = None
node = None
node_goal = None
num_nodes = 0
frontier = []
explore... | true |
7bfcf3f63abbd53aeffde3ec5d30845c9a511717 | Python | Ysunil016/Python_Coding_Challenges | /LinkedList/SearchInLinkedList.py | UTF-8 | 1,077 | 4.1875 | 4 | [] | no_license | class Node:
def __init__(self, data = None):
self.data = data
self.next = None
class SingleLinkedList: # Single Linked List Implementation
def __init__(self):
self.head = None
def print_element_in_linked_list(self, key):
head = self.head
while head is not None:
... | true |
fbb6ee4716baf24ebef3e8b3f957421bbc65bff5 | Python | aidiss/codefights | /sdk-Python/boilerplate/Commentator.py | UTF-8 | 1,961 | 3.140625 | 3 | [] | no_license | from model.GameScoringRules import GameScoringRules
class Commentator(object):
fighter1 = "Fighter1"
fighter2 = "Fighter2"
lp1 = GameScoringRules.LIFEPOINTS
lp2 = GameScoringRules.LIFEPOINTS
def setFighterNames(self, fighter1name, fighter2name):
self.fighter1 = fighter1name
self.fighter2 = fighter2name
... | true |
cdfa6af2ed71a4c93f16d4de6729d24ede955da0 | Python | ConnectBox/connectbox-pi | /python/chat/datasource.py | UTF-8 | 3,291 | 2.75 | 3 | [
"MIT"
] | permissive | """ Database access module """
import sqlalchemy
STATE = {}
STATE['connected'] = False
def connected():
""" Returns true if connected """
return STATE['connected']
def open_connection(conn_info):
""" Open database connection """
STATE['conn'] = sqlalchemy.create_engine(conn_info)
STATE['connected... | true |
7b60baf4412268a7c55ced3b27af1239be293dee | Python | art567/bf2-stats | /webapp/processors/awards/nomad.py | UTF-8 | 2,081 | 3.0625 | 3 | [] | no_license |
from processors.awards import AwardProcessor,Column,PLAYER_COL
from models.vehicles import AIR
from models import model_mgr
from stats import stat_mgr
import collections
class Processor(AwardProcessor):
'''
Overview
This processor tracks the maximum distance travelled between kills.
Implementatio... | true |
4c98683861525f4d7674d4f5dd96843d360b6f41 | Python | Gianine12/e12 | /app/services/feactures_sql.py | UTF-8 | 1,520 | 2.828125 | 3 | [] | no_license | def create_table(connect,cur):
cur.execute(
"""
CREATE TABLE IF NOT EXISTS animes (
id BIGSERIAL PRIMARY KEY,
anime VARCHAR(100) NOT NULL UNIQUE,
released_date DATE NOT NULL,
seasons INTEGER NOT NULL
);
"""
)... | true |
1e3d818d86420c1467a9066f3a502704b4283d6f | Python | gaoyang1224/UI | /lianxicode/test_start_selenium.py | UTF-8 | 420 | 2.640625 | 3 | [] | no_license | from selenium import webdriver
def test_start_selenium():
driver = webdriver.Chrome()
url = 'http://www.douban.com'
driver.get(url)
input_el = driver.find_element('xpath', '//*[@id="anony-nav"]/div[3]/form/span[1]/input')
input_el.send_keys('老友记')
input_el.submit()
# 断言
actual = driv... | true |
214ab7cfd2c3b567ee452966a0660b497576c9a4 | Python | ananthapadmanabhan-o/basic_python | /http_bs4_01.py | UTF-8 | 335 | 3.078125 | 3 | [] | no_license | import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
#url = input('Enter the url - ')
url = 'http://www.dr-chuck.com/page1.htm'
html = urllib.request.urlopen(url).read()
soup = BeautifulSoup(html,'html.parser')
#Retrieve all the anchor tag
tags = soup('a')
for tag in tags:
print(tag.ge... | true |
7f96a358c29601d9ae96bf9941d884b1690510c7 | Python | mobiiin/artificial-neural-network | /hw1/1.py | UTF-8 | 9,808 | 2.71875 | 3 | [] | no_license | import numpy as np
import glob
import cv2 as cv
import os
import operator
from matplotlib import pyplot as plt
import sys
# change rgb image data to binary or bipolar list
def imgtodata(img, method):
img_list = []
for pixel in img:
for r, g, b in pixel:
if r > 128:
img_list... | true |
d88dd95a7ed12b909adb90d662802684e6cd2f64 | Python | mohammadsilwadi/data-structures-and-algorithms-1 | /python/code_challenges/sorting-algorithms/labs_solution/merge_sort/demo.py | UTF-8 | 3,085 | 4.15625 | 4 | [
"MIT"
] | permissive | ############################
#####code challenge 27######
############################
# making insertion sort function takes an array and return the array sorted
# def merge_sort(array):
# """merge sort"""
# n = len(array)
# if n > 1:
# mid = n // 2
# left = array[:mid]
# right = ... | true |
a8a3a4f64f890008728a246f89f0123b034b88ab | Python | dingdaojun/HMUIComponentsSDK | /Carthage/Checkouts/weather/Carthage/Checkouts/log/scripting/anylysis_sqlite.py | UTF-8 | 1,864 | 2.90625 | 3 | [] | no_license | #coding=utf-8
import sqlite3
import time
import datetime
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
def timestamp_string(timestamp):
miliSeconds = timestamp - int(timestamp)
#print "seconds:" + str(timestamp) + " to mili seconds: " + str(miliSeconds)
timeObj = time.localtime(timestamp)
dat... | true |
f3c461bda1e7676e97dfa8cb0ec190484e9e2e70 | Python | biswas101/H2-Ionization-Cross-Section | /cross_section_area.py | UTF-8 | 1,567 | 2.84375 | 3 | [] | no_license | #This script is specially designed to find int(sigma .dE)
# after running cross_section_reiser.py, one can use it to get sigma.dE
# sigma.dE is needed to calculate the Flux of Trapped ions in DC gun
# More info can be found on https://journals.aps.org/prab/pdf/10.1103/PhysRevSTAB.10.083501
'''
Created on July 2... | true |
f894f5167f0785cf44e1f3aff7d78d2eb6d67293 | Python | Beno71/GoNet | /PolicyNet.py | UTF-8 | 25,234 | 3.171875 | 3 | [
"MIT"
] | permissive | """
Created on Wed Nov 8 11:00:05 2017
@author: Stefan Peidli
License: MIT
Tags: Policy-net, Neural Network
"""
import numpy as np
import matplotlib.pyplot as plt
from Hashable import Hashable
from TrainingDataFromSgf import TrainingData
import os
def softmax(x):
"""Compute softmax values for each sets of sco... | true |
3a9e56e5017a68a591dd5c417ea43b76370b3386 | Python | AlazzR/Computer-Vision-Cpp-ML | /Computer_Vision/Cats_vs_Dog_Project/deep_learning/data_loader.py | UTF-8 | 4,253 | 2.921875 | 3 | [
"CC0-1.0"
] | permissive | #%%
import os
import numpy as np
import torchvision
import torch
from torch.utils.data import Dataset, DataLoader, ConcatDataset
import PIL
import matplotlib.pyplot as plt
#Cat is 0 and dof is 1
# %%
def loadFileNames(trainTestFlag=True, start=0, end=12500, root=os.getcwd()):
fileNames = []
for ind in range(st... | true |
45498572e66042fc1784d77ec6478e41b8d0adfc | Python | nicolasteri/simulazione_NicolaLosito | /main.py | UTF-8 | 2,035 | 3.640625 | 4 | [] | no_license |
class Catalogo():
def __init__(self, nome, prezzomin, prezzomax):
self.nome = nome
self.prezzomin = prezzomin
self.prezzomax = prezzomax
self.lista = []
def inserisci(self):
lista.append(self)
print("\nL'immobile è stato inserito con successo!\n")
class Immobi... | true |
37c2efd97092374d9d9159a01817460be580747e | Python | AlexanderLundin/PythonFileTree | /webapp/ajax.py | UTF-8 | 10,615 | 2.71875 | 3 | [] | no_license | import json
from django.http import Http404, HttpResponse
from django.views.decorators.http import require_http_methods
from .file_operations import *
from .folder_operations import *
import os
from django.conf import settings
# get is used when you don't need to access the webpage elements
# post is used to access th... | true |
1b409e44ab82bfac0dcb264ca174730f5bc0cbfb | Python | lalka-anka/searching-substring | /timing_and_capacity.py | UTF-8 | 4,409 | 3.1875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Модуль, фиксирующий время и объем затрачиваемой памяти при работе алгоритмов"""
import timeit
from program import BruteForce
from program import BoyerMoore
from program import RabinKarp
from program import KnuthMorrisPratt
from generator import Generator
from functools ... | true |
ec39102f6edd85b70910ca203974a7726d72c728 | Python | lissiechin/lissiechin.github.io | /Content/CSCI/HW/Homework2.py | UTF-8 | 677 | 4.1875 | 4 | [] | no_license | ### Lissie Chin
### Homework 2 (#7,8, 10, 12)
### Due February 15, 2019
#problem 7
P = 10000
n = 12
r = 8/100
t = int(input ("number of years"))
Final_Amount= P*( 1 + (r/n))**(n*t)
print ("The final amount after", t, "years is $", Final_Amount)
#problem 8
R= int(input("radius of the circle"))
Pi= 3.1415926... | true |
85849d38ac03694abfd73516f533f6a6f4c130d5 | Python | Hongdi-LAI/Object-Oriented-Python-Practices | /Static/Class_Method_And_Class_Attribute.py | UTF-8 | 678 | 3.84375 | 4 | [] | no_license | class Person:
number_of_people = 0
def __init__(self,name):
self.name = name
Person.add_people()
@classmethod
def People_Number(cls):
return cls.number_of_people
@classmethod
def add_people(cls):
cls.number_of_people += 1
p1 = Person("Tim")
p2 = Person("J... | true |
4ce37ef227aed52c15aaec77b780c9df517fd702 | Python | daniel-reich/ubiquitous-fiesta | /pj5yRacNC8huzhy85_22.py | UTF-8 | 108 | 3.171875 | 3 | [] | no_license |
def shhh(txt):
return "\"{}\", whispered Edabit.".format(txt[0].upper()+txt[1:].lower() if txt else '')
| true |
e47a6d3f8e38c06e1af1ebde0b740be35e3d24ce | Python | chriswegmann/drone_steering | /app/generate_training_data.py | UTF-8 | 3,725 | 2.796875 | 3 | [] | no_license | from datetime import datetime
import numpy as np
import pandas as pd
import timeit
import json
import websockets
import asyncio
import warnings
warnings.filterwarnings("ignore")
columns_coord = ['leftShoulder_x',
'leftShoulder_y',
'rightShoulder_x',
'rightShoulder_y',... | true |
66d867c667515e180ab8731cd69e5e4a995a5466 | Python | dahlbaek/goodtables-py | /tests/checks/test_duplicate_row.py | UTF-8 | 1,317 | 2.65625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
from goodtables.checks.duplicate_row import DuplicateRow
# Check
def test_check_duplicate_row(log):
errors = []
cells1 = [
{'nu... | true |
2d9cb66cb3ed3517ec2a900e0db8f3f5009c38c4 | Python | Raman-rd/NLP-Spam-Classifier-Streamlit | /app.py | UTF-8 | 776 | 2.953125 | 3 | [] | no_license | import streamlit as st
import pickle
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.naive_bayes import MultinomialNB
from sklearn.externals import joblib
import pickle
filename = 'nlp_model.pkl'
clf = pickle.load(open(filename,'rb'))
cv = pickle.load(open('tranform.pkl','rb'))
st.... | true |
7791f26c4ab98cd088e529b72bb5d950afc25088 | Python | muhamuttaqien/python-algorithm | /sorting/quick-sort.py | UTF-8 | 825 | 4.46875 | 4 | [] | no_license |
def quick_sort(collection):
length = len(collection)
if (length <= 1):
return collection
else:
pivot = collection[0]
greater = [item for item in collection[1:] if item > pivot]
lesser = [item for item in collection[1:] if item <= pivot]
return quick_sort(lesser) +... | true |
6edf97915ba8beada64ddd3b9161dc79ea7e6157 | Python | Hurrieam/QWER | /QWER.py | UTF-8 | 748 | 3.765625 | 4 | [] | no_license | import random
data = ["Q", "W", "E", "R"]
# 试验次数
time = 100000000
q=w=e=r=0
for i in range(0, time, 1):
num = random.randint(0, 3)
# print("第" + str(i + 1) + "次系统随机按的技能是" + str(data[num]) + "技能。")
if num == 0:
q = q + 1
if num == 1:
w = w + 1
if num == 2:
... | true |
a2a57500f6ffd94fa9d8f8945b4e3dc0e068fc5c | Python | fujitch/word2vec-master | /words_sentence_maker_random_order_kodama.py | UTF-8 | 24,350 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import random
import MeCab
from Parser import Parser
class Maker():
def __init__(self):
self.year_master = []
for i in range(1950, 2050):
self.year_master.append(str(i))
self.number_master_smaller = []
for i in range(10):
... | true |
1cc1804f77591db4b856d101607746459562740f | Python | AthulJoseph27/AI | /Character/csvTOimg.py | UTF-8 | 4,134 | 2.53125 | 3 | [] | no_license | import numpy as np
import csv
from PIL import Image
import matplotlib.pyplot as plt
import os
counter = dict()
cur_path = os.path.dirname(__file__)
k = 0
with open('Data.csv') as csv_file:
csv_reader = csv.reader(csv_file)
next(csv_reader)
for row in csv_reader:
k+=1
pixels = row[:-1] # without label
p... | true |
ac369ef82729d30a911596125cfee80ca25546ba | Python | mpss2019fn1/embedding-testing | /test/Testing/Result/test_case_result.py | UTF-8 | 722 | 2.59375 | 3 | [] | no_license | from src.Testing.Result.case_result import CaseResult
class TestCaseResult:
def test_success_representation(self):
test_result = CaseResult("Angela_Merkel", "AKK", "AKK", True)
assert str(test_result).startswith(CaseResult.PASSED_PREFIX)
assert test_result.__str__() == test_result.__repr... | true |
e4fcea8f452fe29558ae9351ce3a3f2520327cb0 | Python | romech/museum-search | /server.py | UTF-8 | 2,631 | 2.515625 | 3 | [] | no_license | import random
from flask import Flask, request, abort, jsonify
import elastic
from data_store import buildings
import qa
from utils import normalize_coord
app = Flask(__name__)
app.config['JSON_AS_ASCII'] = False
@app.route('/ping')
def ping():
return "ok"
@app.route('/search')
def search():
query = req... | true |
7bdc3f40da34efd98130f78e44b9522f6592578d | Python | JasperHupkens/scripts | /script_select.py | UTF-8 | 908 | 3.15625 | 3 | [] | no_license | #!/usr/bin/python3
import os
dirs = os.listdir(".")
scripts = []
for item in dirs:
if item.endswith(".py") or item.endswith(".sh"):
scripts.append(item)
while True:
print("Please select one of the following scripts:")
for i, script in enumerate(scripts):
print(str(i) + " " + script)
... | true |
85e2c06548e875e762460096e2547fd511eeb3dd | Python | xuanyuwang/ctci | /ch4/4_3_list_of_depths.py | UTF-8 | 946 | 3.71875 | 4 | [
"MIT"
] | permissive | import unittest
class node():
def __init__(self, value=None):
self.value = value
self.left = None
self.right = None
def solution(root):
res = []
queue = []
queue.append(root)
while queue:
numberOfNodesInThisLevel = len(queue)
level = [queue.pop() for _ in r... | true |
651cf8c0098b73217661b843865c507f32909ccf | Python | OweN98/Crawler | /DoubanMovieTop250/asyncDoubanTop.py | UTF-8 | 2,084 | 2.734375 | 3 | [] | no_license | import aiohttp
import time
import asyncio
import requests
import re
import json
import sqlite3
from lxml import etree
from requests.exceptions import RequestException
sem = asyncio.Semaphore(5)
htmls = []
def get_url():
url = 'https://movie.douban.com/top250?start='
urls = []
for i in range(10):
ur... | true |
bc0f6d3279f0d8c1dd1c65950b02c776204c61bc | Python | ZhengWeihao/kmcrm | /LcsInterfaceAutomation/Common/Excel_Handing1.py | UTF-8 | 2,599 | 2.578125 | 3 | [] | no_license | #coding=utf-8
import xlwt,xlrd,requests,time,sys
from xlutils.copy import copy
from Common.logger import Logger
import ConfigParser
from urllib import urlencode
from Common import get_cookie
from read_config import readconfig
reload(sys)
sys.setdefaultencoding('utf-8')
class ExcelHanding1(object):
def __init__(se... | true |
4a74e6aee4d35b58c484da27b8a46e3af20c54d0 | Python | niranjansahoo1143/python-code-demo | /print.py | UTF-8 | 66 | 2.84375 | 3 | [] | no_license | x=10
y=20
z=x+y
print(z)
print(id(z))
print("hello")
print("babu") | true |
84bca5a1b15b36cff3552750912246f4f2668796 | Python | dingzishidtc/dzPython | /mypy/10.模块/10.2.模块查询方式.py | UTF-8 | 1,872 | 3.359375 | 3 | [] | no_license | # 前面介绍了 import sys 时,python 自己知道该去何地查询
# 那么有没有一种方式,能够在程序执行前让 python 知道该去何地查询,而不是每次都要调用 sys.path.append(xx)
#
# 这就要了解一下 python 查询模块的原理:
# python 在导入模块时,是从 sys.path 保存的路径中依次查询指定模块是否存在,存在即导入。
# 因此可以通过修改sys.path 来增加 python 查询的路径,打印 sys.path 可以查看 python 的搜索范围
# 一般来说 python 会从三个地方获取路径,然后存入 sys.path 中
#
# 1. ... | true |
78a6d95d440ea3ccd00c71787e5774b515525121 | Python | bottest123/anything | /stockSD.py | UTF-8 | 2,009 | 2.890625 | 3 | [] | no_license | from nsepy import get_history
import numpy as np
import pandas as pd
from datetime import date, timedelta
import os
import csv
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
# retrieves the names of stock
companies_file = (open('st... | true |
76d509b833c041ab34e80d0731e76be91fc584fc | Python | DavidKimDY/fastapi-practice | /main.py | UTF-8 | 2,374 | 2.71875 | 3 | [] | no_license | from enum import Enum
from typing import Optional, List
import datetime
from fastapi import FastAPI, Query, Path
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: Optional[str] = None,
price: float = 10.0
tax: Optional[float] = None
@app.post('/item/')
de... | true |
9afe4927c6dd84dd955adaec0def1ddfaa879d10 | Python | xiongchenyan/QueryExpansion | /base/AggregateExpTermFinal.py | UTF-8 | 2,047 | 2.546875 | 3 | [] | no_license | '''
Created on May 6, 2014
final one
@author: cx
'''
import site
site.addsitedir('/bos/usr0/cx/PyCode/Geektools')
site.addsitedir('/bos/usr0/cx/PyCode/cxPyLib')
site.addsitedir('/bos/usr0/cx/PyCode/QueryExpansion')
import sys
from ExpTerm import *
from copy import deepcopy
from operator import attrgetter
from cxBas... | true |
b9c6485143fcfae8dd0541e092bf20099e49f367 | Python | JEmbry2019/tickets_python | /flowers.py | UTF-8 | 643 | 4.46875 | 4 | [] | no_license | # Flowers.py - This program reads names of flowers and whether they are grown in shade or sun from an input
# file and prints the information to the user's screen.
# Input: flowers.dat.
# Output: Names of flowers and the words sun or shade.
# Open input file
flower = open("flowers.dat", "r")
flowerData = None
growD... | true |
7d7fc7a927adad5f42f38066cd780f7a4125067f | Python | Aasthaengg/IBMdataset | /Python_codes/p02889/s878165749.py | UTF-8 | 802 | 2.703125 | 3 | [] | no_license | import numpy as np
from scipy.sparse.csgraph import floyd_warshall
def solve(N,L,edges,queries):
graph = np.zeros((N,N),dtype=int)
for a,b,c in edges:
graph[a-1,b-1] = c
graph[b-1,a-1] = c
dist = floyd_warshall(graph, directed=False)
dist = (dist<=L)
dist = floyd_warshall(dist, d... | true |
e8501edc071a06a18063dc1349a42032276eff68 | Python | zhangkun16/PyIT2FLS | /examples/ex_8.py | UTF-8 | 1,365 | 2.734375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 19 13:22:01 2020
@author: arslan
"""
from pyit2fls import TSK, IT2FS_Gaussian_UncertStd, IT2FS_plot, \
product_t_norm, max_s_norm
from numpy import linspace
from time import time
domain = linspace(0., 1., 100)
Small = IT2FS_... | true |
112a1ef3cee6d663f7ea87235282f035d6054629 | Python | zjr35897/information-retrieval | /word2vec.py | UTF-8 | 1,858 | 2.953125 | 3 | [] | no_license | # coding = utf-8
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
from utils import *
import collections
def build_vocab(data_path, vocab_path, w2id_path, id2w_path, min_cnt = 3):
'''
构建字典
Args:
data_path str 数据路径
vocab_path str 词典路径
min_cnt int ... | true |
c45e208a37947946f66ae7b09f7233df768d9cb2 | Python | sdgennari/compilers | /basic_blocks.py | UTF-8 | 9,569 | 2.9375 | 3 | [] | no_license | from tac_objects import *
import copy
import re
import sys
class TACBasicBlock:
def __init__(self, instr_list):
self.parents = []
self.children = []
self.parent_labels = []
self.child_labels = []
self.instr_list = instr_list
# Initialize empty liveness sets
self.live_in = set()
self.live_out = set()... | true |
1aaab057cfd9b1a076d4e889aedd70771ade34c8 | Python | admarkov/PHPChess | /e2e/cc.py | UTF-8 | 878 | 2.78125 | 3 | [] | no_license | import argparse
import json
import client
import util
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--host', help='backend host', required=True)
parser.add_argument('-g', '--game-id', help='game id')
parser.add_argument('action', type=str, help='one of `status`, `s... | true |
40aa1a7418efc800d9d2f462186273e3d8c6114a | Python | DincerDogan/Data-Science-Learning-Path | /Data Scientist Career Path/3. Python Fundamentals/6. Python Loop/1. Intro to Loop/6. infinite loop.py | UTF-8 | 203 | 2.9375 | 3 | [
"MIT"
] | permissive | students_period_A = ["Alex", "Briana", "Cheri", "Daniele"]
students_period_B = ["Dora", "Minerva", "Alexa", "Obie"]
for student in students_period_A:
students_period_B.append(student)
print(student) | true |
afed478266af09823569c8819ec41cbe4a873b8e | Python | ddgvv/dd | /bsp70.py | UTF-8 | 145 | 3.765625 | 4 | [] | no_license | val=int(input("Enter Value"))
if val == 0:print(1)
if val & (val - 1) == 0:print(val)
while val & (val - 1) > 0:val &= (val - 1)
print(val << 1)
| true |
01f9d0492e96cbd6764f1ef5f91b6acf26638f75 | Python | cristianpera/Proyecto-Final-Sistemas-Operativos | /script.py | UTF-8 | 393 | 2.65625 | 3 | [] | no_license | #!/usr/bin/python
import sys
import Adafruit_DHT
import urllib2
url = 'https://api.thingspeak.com/update?api_key=RYORGFJXS5TGVH4V&field1='
humedad, temperatura = Adafruit_DHT.read_retry(11, 4)
print 'Temp: {0:0.1f} C Humed: {1:0.1f} %'.format(temperatura, humedad)
if humedad < 100:
ur = urllib2.urlop... | true |
fb318f9215e9f59cbe4b57d7ac16db63f3101959 | Python | AkuHiltunen/Data-Analytics | /twitter-create-network.py | UTF-8 | 1,201 | 2.828125 | 3 | [] | no_license | #a script for creating a graph file out of a csv file output from TAGS
#graph files are used in Gephi
import pandas as pd
from ttp import ttp as prep
import networkx as nx
#enter filepath for your data
filename = "../twitterdata/samsung.csv"
df = pd.read_csv(filename, sep=',', encoding="utf-8")
print(df.head())
parse... | true |
1fecfa4f6a8eec441eb9cfbe462faa7cddb3f3c3 | Python | momintariq570/stocks-analysis-python | /technicals.py | UTF-8 | 6,380 | 2.796875 | 3 | [] | no_license | import pandas as pd
import talib
date = 'date'
open = 'open'
high = 'high'
low = 'low'
close = 'close'
volume = 'volume'
#################################################################################
# INDICATORS
#################################################################################
#Moving Average
def... | true |
5ca216bebce4334f2521c93b9a22a50c21504234 | Python | lpmi-13/awlify-python | /tests/test_check_word.py | UTF-8 | 1,096 | 3.265625 | 3 | [
"MIT"
] | permissive | import unittest
from awlify.utils.check_word import check_word_in_list
class CheckWordTest(unittest.TestCase):
def test_word_not_in_awl(self):
word = 'simple'
result = check_word_in_list(word)
self.assertEqual(result, None)
def test_head_word_in_awl(self):
word = 'economy'
... | true |
3c99f75cb736850a9d7f7c844bb49424ef038891 | Python | highly-talented/excel | /venv/python 循环.py | UTF-8 | 681 | 4.25 | 4 | [] | no_license | #集合:
# for XX in xxxx:
# pass
# while xx:
# pass
# 程序题:将“社会我杨哥,人狠话不多”反向打印出来
# notice = "社会我杨哥,人狠话不多"
# noticeNew = ""
# for name in notice:
# noticeNew = name + noticeNew
# print(noticeNew)
# 程序题:打印1-100间的偶数
for i in range(1,101):
if i % 2 == 0: # 判断是否是偶数
print(i,end="\n")
print('以上是1-100间的偶数')... | true |
a96012e7fecfdded090aadb8d5d866e6b70d469f | Python | kogsio/coursecatalog | /merge.py | UTF-8 | 387 | 3.1875 | 3 | [
"MIT"
] | permissive | from os import walk
# get filenames
_, _, filenames = next(walk('./data'))
# append data file
def append(data):
with open("data.txt", "a") as file:
file.write(data)
# loop through files, read data, call append function
for filename in filenames:
with open('./data/'+filename, 'r') as file:
da... | true |
64af3fa63966fd2ca6a067ef674850aa9286c44c | Python | mochba/Python-Regular-Expression | /Example3.py | UTF-8 | 654 | 3.265625 | 3 | [] | no_license | import re
count = 0
filename = input("Enter a file name:")
try:
stream = open(filename)
for eachline in stream:
eachline = eachline.rstrip()
if re.search('^From:.+@',eachline):
print(eachline)
x = re.findall('\S+@\S+', eachline)
if len(x) > 0:
... | true |
8730888280a38bd120fc81f1ef1bdf22e6219409 | Python | mao/python_study | /chapter03/01_names.py | UTF-8 | 143 | 3.453125 | 3 | [] | no_license | names = ['Chao Jing', 'wu ping', 'Ling Lu', 'Liu Yi Ming', 'Peng Xiang', '周毅']
print('Some of my friends: ' )
for name in names:
print(name.title()) | true |
402af03cd198fbed3c5f690ea7b7d39cc12e49a8 | Python | tjddus9597/Proxy-Anchor-CVPR2020 | /code/dataset/sampler.py | UTF-8 | 1,179 | 2.6875 | 3 | [
"MIT"
] | permissive | import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data.sampler import Sampler
from tqdm import *
class BalancedSampler(Sampler):
def __init__(self, data_source, batch_size, images_per_class=3):
self.data_source = data_source
self.ys = np.array(data_source.ys)
... | true |
c2797c38c832bd59fd7b3707e187ecd08eeb0824 | Python | abel1502/Metaparser | /metaparser.py | UTF-8 | 20,806 | 2.671875 | 3 | [] | no_license | import string
import importlib.util
import os, pathlib
#import sys; sys.setrecursionlimit(10 ** 5)
_isChar = lambda s: isinstance(s, str) and len(s) == 1
_DEBUG = False
_dbgCategories = {"general": True, "match": False, "matchres": False, "error": True, "mptest": True, "ctrl": True}
dbg = lambda *args, **kwargs: prin... | true |
a26b4011216fb417401a8ead2a727193c04455df | Python | werdegars/crackMd5 | /PasswordsGenerator.py | UTF-8 | 1,086 | 3.3125 | 3 | [] | no_license | import random
import threading
import string
class PasswordsGenerator:
def __init__(self):
self.lock = threading.Lock()
def generatePasswords(self, buffer):
self.lock.acquire(blocking=1)
passwordsGenerated = 0
for index, entry in enumerate(buffer):
try:
... | true |
aec59bc66124b1eb781405ce446d6e19e73e7762 | Python | VaibhavRangare/python_basics_part1 | /StringMethods.py | UTF-8 | 441 | 3.5625 | 4 | [] | no_license | course = 'Python'
print(course.upper()) # PYTHON
print(course.lower()) # pythn
print(course.capitalize())
print(course.casefold()) #
print(course.replace("P", "J")) # Jython
print(course)
# check if string or char in String
print(course.find('y')) ... | true |
1448502b6e9bd101335a44beced4fe4390d8942e | Python | fandi-peng/Project_Euler | /code/euler85.py | UTF-8 | 858 | 3.171875 | 3 | [] | no_license | from math import sqrt
def all_divs(n):
g = int(sqrt(n))
l = []
for i in range(1, g+1):
if n % i == 0:
l.append((i, n / i))
l.append((n / i, i))
return set(l)
def a_d(n):
g = int(sqrt(n))
l = []
for i in range(1, g+1):
if n % i == 0:
l.app... | true |
8e0848000ef6f2179e2260b901e4531ef896f934 | Python | shapely/shapely | /shapely/strtree.py | UTF-8 | 20,314 | 2.90625 | 3 | [
"BSD-3-Clause",
"LGPL-2.1-only"
] | permissive | from typing import Any, Iterable, Union
import numpy as np
from shapely import lib
from shapely._enum import ParamEnum
from shapely.decorators import UnsupportedGEOSVersionError
from shapely.geometry.base import BaseGeometry
from shapely.predicates import is_empty, is_missing
__all__ = ["STRtree"]
class BinaryPred... | true |
556d7ef3509d41dc07fe86bc8af92552614f0aa0 | Python | clovisleoncio/problemsolve | /hackerrank/warmup/filling-jars/filling-jars.py | UTF-8 | 257 | 3.203125 | 3 | [] | no_license | #!/usr/bin/env python
numberOfJars, testCases = [int(x) for x in raw_input().split()];
total = 0;
for i in xrange(testCases):
a, b, number = [int(x) for x in raw_input().split()];
total = total + (b - a + 1) * number;
print total / numberOfJars
| true |
7fdd1da77a16c202b0c1bfdb6230af1116bac4b3 | Python | daniellozuz/Cars | /simulate.py | UTF-8 | 770 | 2.515625 | 3 | [] | no_license | # TODO add project preparation step (downloading images and setting up the folder structure)
# TODO try working with mnist set, and resolve issues there
import os
import yaml
import pprint
CONFIGS = [
# '1.yml',
# '2.yml',
# '3.yml',
'4.yml',
# '5.yml',
# '6.yml',
# '7.yml',
# '8.yml'... | true |
c6e41f063c3e748de8a51173bde77250dbb928f2 | Python | ejohnso9/programming | /kattis/python/other/aaah.py | UTF-8 | 219 | 2.796875 | 3 | [] | no_license | #!/usr/bin/env python
# Python 2.7
"""
aaah: https://open.kattis.com/problems/aaah
2019Mar16
"""
import sys
# main
lines = sys.stdin.readlines()
if len(lines[0]) >= len(lines[1]):
print "go"
else:
print "no"
| true |
1ea27a32b5349a5224537d344f14a5730f693bd6 | Python | lHunniche/PyCom | /test.py | UTF-8 | 179 | 2.84375 | 3 | [] | no_license | import time
steps = 10000
timestamps = []
while True:
timestamps.append(time.time())
if len(timestamps) > steps:
break
print(timestamps[steps] - timestamps[0])
| true |