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
3a08056d1ff749624cdf0cc19f01d226ab747689
Nadav-Yarkon/Python-Keylogger-with-Shell-command
/Keylogger.py
UTF-8
3,383
2.640625
3
[]
no_license
########### keylogger ######## ########### Author: Nadav Yarkon ############# ##This tool is for educational purposes only. don't use them for illegal activities!## #Author: Nadav Yarkon #Email: Nadavy2469 @ gmail.com #https: https://github.com/Nadav-Yarkon from winreg import HKEY_CURRENT_USER, OpenKey, KE...
true
6510d2f718a885a44b22c72d1071e97bb23fc3df
Fraunhofer-ITMP/PEMT
/src/pemt/chemical_extractor/experimental_data_extraction.py
UTF-8
7,694
2.609375
3
[ "MIT", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
# -*- coding: utf-8 -*- """Script for extracting experimental bioassay information from ChEMBL.""" import json import logging import os from collections import defaultdict from typing import List import pandas as pd from chembl_webresource_client.new_client import new_client from tqdm import tqdm from pemt.constant...
true
6e3379cda38dc2fe35ca83764bffd20c29a61c83
ZYSLLZYSLL/Python
/代码/code/eg/判断字符串是否回文.py
UTF-8
628
3.90625
4
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- # @Time : 2021/1/23 9:10 # @Author : ZY # @File : 判断字符串是否回文.py # @Project : code """ 判断字符串是否回文 全部字符串能对称 """ values = input('请输入一串字符串:') num = 0 if len(values) % 2 == 0: for i in range(len(values) // 2): if values[i] == values[-1 - i]: num += ...
true
334410c7f3b0c4bb8e4de6284e6b469c7b0a4bd2
jkyp91/Projects
/Python/adventure_game.py
UTF-8
3,017
3.578125
4
[]
no_license
import random import time import sys locations = {0: "You Quit the Game!", 1: "You are standing at the end of a road before a small brick building", 2: "You are at the top of a hill", 3: "You are inside a building, a well house for a small stream", 4: "You are in a v...
true
09ae04be68622e6d845f3f99c57e59e552fae8d0
Tsedao/SPDQ
/environment/portfolio.py
UTF-8
22,728
2.890625
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import gym import gym.spaces import copy from matplotlib import pyplot as plt from utils.data import date_to_index, index_to_date from icecream import ic eps=1e-13 def sharpe(returns, freq=30, rfr=0): """ Given a set of returns, calculates ...
true
ae902085974b39c8d804f5c409b9c500ffa7a773
yifan-lee/CS_760
/hw2/tree.py
UTF-8
2,345
2.890625
3
[]
no_license
import numpy as np def isNumeric(type_str): if type_str == "numeric" or type_str == "real" or type_str == "integer": return True else: return False class decisionTreeNode: def __init__(self, i = 0, feature_name = None, feature_value = None, threshold = None, parent = None, children = ...
true
24e1884de2bd899a21b3bd14e6c6d4596fe3a756
donghaeum/board_ver2020
/user/views.py
UTF-8
2,399
2.578125
3
[]
no_license
from django.http import HttpResponse from django.shortcuts import render, redirect from django.contrib.auth.hashers import make_password, check_password from .models import User from .forms import LoginForm def register(request): if request.method == 'GET': # 경로는 템플릿 폴더를 바라보므로 경로를 따로 표현할 필요는 없다 return render...
true
4bbc41964f29b2fb1c9f2bca4f9142f5bb45e335
7MAX1998/sayHello
/delete.py
UTF-8
707
2.875
3
[]
no_license
#-*- coding:utf-8 –*- # chinese.py import sqlite3,sys def delete(x): conn = sqlite3.connect('sayHello.db') c = conn.cursor() print ("Opened database successfully") c.execute("DELETE from COMPANY where 学号 = '%s'" %x) conn.commit() print (("Total number of rows deleted :"), conn.total_changes) cursor = conn.exec...
true
1d794d06bf1d2ab854fb624e540ebf912ba10677
Legedith/Dungeons
/dungeons.py
UTF-8
15,799
3.375
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Fri Aug 7 23:07:40 2020 @author: Legedith """ import os import sys from platform import system from time import sleep import ascii_images path = os.getcwd() def banner(string): operating_system = system().lower() if operating_system == "linux" or operating_system == ...
true
0ab050ff0f06755cc01ce5e86003cd53197d34d5
gowthammk/Leetcode-November-Daily-Challenges
/Day 15.py
UTF-8
995
4.15625
4
[]
no_license
# Range Sum of BST # Given the root node of a binary search tree, return the # sum of values of all nodes with a value in the range [low, high]. # Input: root = [10,5,15,3,7,null,18], low = 7, high = 15 # Output: 32 # Input: root = [10,5,15,3,7,13,18,1,null,6], low = 6, high = 10 # Output: 23 # Definition for a bin...
true
a49297d3cc8a44276bb40df07a7c5f7974d459a7
anb76ru/python_algorithm_task
/check_task_1.py
UTF-8
2,058
3.734375
4
[]
no_license
# Описание программы в файле task1.txt import traceback class TestRunner(object): def __init__(self, name): self.name = name self.testNo = 1 def expectTrue(self, cond): try: if cond(): self._pass() else: self._fail() ex...
true
ec4069b3ac0adb10d1b89fc92e0d8ac40a5f8def
RussellSlighton/Elevator-ad-Parnassum
/tests/lib/constraints/test_simulaneity.py
UTF-8
2,884
2.625
3
[]
no_license
import pytest from src.lib.constraints.simultaneity import * @pytest.fixture def s(): return Optimize() @pytest.fixture def l(): return Line(5, "L") @pytest.fixture def cf(): return [ConstPitch(x) for x in [0, 1, 2, 1, 0]] @pytest.fixture def sm(cf, l): return makeSimMap([makeTemporalisedLine(cf, N...
true
b6dd503db9e08dd696c42bb72f7e7056d8541e53
vky201/tweepy
/timeline.py
UTF-8
933
2.578125
3
[]
no_license
import os import tweepy as tw import pandas as pd import re API_key= 'BNBcJIAN5eQXYMRExMoX6McG9' API_secret_key= 'hXMEXkEjwEnGJaNQgZ6MN048eRwSGUubnbyXMc2sHgY1bDalFl' access_token= '1232552940910432257-gFm2ZPyrwhIK0P4a8W9CyMJar98j8D' access_token_secret= 'AzmHwez2nR1v69HJYY3evjW9pvz0s3Z49u8Lb4WlRlrRQ' auth ...
true
aaeee8178b1f3ddc77a6db310265288c76af2b71
conornewton/BanditAlgorithms
/src/gossip_matrix.py
UTF-8
1,352
3.46875
3
[]
no_license
import random class GossipMatrix: def __init__(self, comm_matrix): self.matrix = comm_matrix def sample(self, i): return random.choices(range(len(self.matrix)), self.matrix[i], k = 1)[0] # TODO: maybe do this the better way class CompleteGossipMatrix(GossipMatrix): def __init__(self, n):...
true
78c67e5c81d47dfab14651309cd699cb74ef5867
kxgames/glooey
/tests/helpers/test_hold_updates.py
UTF-8
3,035
2.765625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 from glooey.helpers import * class UpdateLogger(HoldUpdatesMixin): def __init__(self, hold_updates=False): HoldUpdatesMixin.__init__(self, hold_updates) self.update_log = '' @update_function def update_1(self): self.update_log += '1' @update_fu...
true
e28cd6e0fa52bae7674d20a7c634f2d7b33775c4
EstebanMontelongo/Pac-Man-Portal
/score_board.py
UTF-8
2,429
3.1875
3
[]
no_license
import pygame.font class Scoreboard: """Score Information""" def __init__(self, ai_settings, screen, stats, score_table): """Initialization of attributes""" self.screen = screen self.screen_rect = screen.get_rect() self.ai_settings = ai_settings self.stats = stats ...
true
9c0d91b73946f693ab4c23a56445b93a2e8a500e
qstodder/USwrapUP
/hood_plotter.py
UTF-8
5,878
2.703125
3
[]
no_license
#!/usr/bin/python3 import os import numpy as np import pandas as pd import pylab import matplotlib.pyplot as plt import datetime as datetime f = 'apr opperational.csv' filePath = 'C:/Users/fm-student6/Desktop/US/Hoods/' xls = pd.read_csv(filePath+f) # Want to get the path to file (not including file nam...
true
f6e5c951906efbe6ff90f7b4e8dc29b182f1e808
jimwelagu/url-classifier
/readcorpus.py
UTF-8
1,177
2.828125
3
[]
no_license
#!/usr/bin/python import json, sys, getopt, os from urlclassifier import URLClassifier def usage(): print("Usage: %s --file=[filename]" % sys.argv[0]) sys.exit() def main(argv): file='' myopts, args = getopt.getopt(sys.argv[1:], "", ["file="]) for o, a in myopts: if o in ('-f, --file'): file=a...
true
cd509430351946b96efcbe3649e64e69acaec21a
psusarla95/Precoding_RL
/Source/dqn_rcv_agent.py
UTF-8
15,324
2.671875
3
[]
no_license
import numpy as np import random import math from collections import namedtuple, deque import pickle from Source.nn_model_dqn import QNetwork import torch import torch.nn.functional as F import torch.optim as optim BUFFER_SIZE = int(1e5) #replay buffer size BATCH_SIZE = 60 #minibatch size GAMMA = 0.9...
true
de8c6db09daae7adb20207f9ff324d7fe3f26049
ofirr/tmc_wrapper
/utils.py
UTF-8
1,317
2.703125
3
[]
no_license
import numpy import scipy.special import pandas as pd import subprocess def memory_expensive_random_choose(l, k, n=5000): """ Randomly sample n k-tuples from l without returning """ l = list(l) n = min(int(scipy.special.comb(len(l), k, repetition=False)), n) cvs = set() while len(cvs) < n...
true
4e4020e5cfa854a9357d235f64f430d0a8c2d2e7
XPixelGroup/BasicSR
/basicsr/archs/arch_util.py
UTF-8
11,348
2.53125
3
[ "Apache-2.0" ]
permissive
import collections.abc import math import torch import torchvision import warnings from distutils.version import LooseVersion from itertools import repeat from torch import nn as nn from torch.nn import functional as F from torch.nn import init as init from torch.nn.modules.batchnorm import _BatchNorm from basicsr.ops...
true
9a71f2af1795648935180a3cf75cd77c75e32746
bnb32/project_euler
/problem73.py
UTF-8
404
3.109375
3
[]
no_license
import euler_project as euler import math def farley_length_in_range(f_min,f_max,d): nums=[i for i in range(int(d*f_min),int(d*f_max)+1) if f_min<i/d<f_max and math.gcd(i,d)==1] return len(nums) def main(): N=12000 summa=0 for i in range(2,N+1): val=farley_length_in_range(1/3,1/2,i) ...
true
9d9f20d6143b1771b42f5338c9a68521d7b36154
zcybupt/leetcode
/020_valid_parentheses/Solution.py
UTF-8
407
3.390625
3
[]
no_license
class Solution: def isValid(self, s: str) -> bool: mapping = {')': '(', ']': '[', '}': '{'} stack = [] for ch in s: if stack and stack[-1] == mapping.get(ch): stack.pop() continue stack.append(ch) return len(stack) == 0 if __...
true
5c7091c547ab580158743c3443e05bdeadb0d9e1
scarca/SignLanguageAI
/script.py
UTF-8
3,207
2.765625
3
[]
no_license
# coding: utf-8 # In[1]: import tensorflow as tf import numpy as np from sklearn.model_selection import train_test_split # load data x = np.load("./Sign-language-digits-dataset 2/X.npy") y = np.load("./Sign-language-digits-dataset 2/Y.npy") x_train, x_test, y_train, y_test = train_test_split(x, y) # lets cre...
true
bc07a6dd816739fe13c46bcd9129d575ca034ebe
neelusoni/Python-Code-Samples
/Googlecse.py
UTF-8
1,811
2.8125
3
[]
no_license
# coding: utf-8 # In[72]: #!pip install -U google-api-python-client #!/usr/bin/env python import datetime as dt import json, sys from apiclient.discovery import build if __name__ == '__main__': # Create an output file name in the format "srch_res_yyyyMMdd_hhmmss.json" now_sfx = dt.datetime.now().strftime...
true
5ab3d0f14e13695821936eddb3ff60bbba5e5da3
muskanmahajan37/AlDoesProjectEuler
/projecteuler/problem17.py
UTF-8
1,049
3.78125
4
[ "BSD-2-Clause" ]
permissive
single = 'X one two three four five six seven eight nine'.split() single[0] = '' teens = 'ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen'.split() tens = 'X X twenty thirty forty fifty sixty seventy eighty ninety'.split() tens[0] = '' tens[1] = '' def getNumWord(num): assert 0 <= ...
true
528eb6d6116609f3725b55a87d7ccfbc7f8d8834
ytbilly3636/som_color_quantization
/demo.py
UTF-8
1,688
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- #!/usr/bin/env python3 import numpy as np import cv2 import sys from .som import SOM class ColorQuantization(object): def __init__(self, codebook=(4, 4)): if not len(codebook) == 2: sys.exit('codebook must be (height, width)') self.capture = cv2.VideoCapture(...
true
0219f4db4c641aa28e6e1fccf97159065298b4c7
Arvolear/Visualizers
/Fractals_infinite/Fractal.py
UTF-8
5,472
3.21875
3
[]
no_license
import pygame import colorsys import threading class Fractal: def __init__(self, size, underlyingFractal): self.IMAGE_WIDTH = size[0] self.IMAGE_HEIGHT = size[1] self.MAX_ITERATIONS = 70 self.MAX_MOVE = 0.1 self.zoom = 1.0 self.realOffset = 0.0 ...
true
1038ac0969e73753089c5d6d67a6dfdeced5c1f2
faker-hong/testOne
/leetcode(多线程,DP,贪心,SQL)/二刷DP与贪心LeetCode/动态规划/375.猜数字大小Ⅱ/猜数字大小Ⅱ.py
UTF-8
1,688
4.15625
4
[]
no_license
''' 我们正在玩一个猜数游戏,游戏规则如下: 我从 1 到 n 之间选择一个数字,你来猜我选了哪个数字。 每次你猜错了,我都会告诉你,我选的数字比你的大了或者小了。 然而,当你猜了数字 x 并且猜错了的时候,你需要支付金额为 x 的现金。直到你猜到我选的数字,你才算赢得了这个游戏。 示例: n = 10, 我选择了8. 第一轮: 你猜我选择的数字是5,我会告诉你,我的数字更大一些,然后你需要支付5块。 第二轮: 你猜是7,我告诉你,我的数字更大一些,你支付7块。 第三轮: 你猜是9,我告诉你,我的数字更小一些,你支付9块。 游戏结束。8 就是我选的数字。 你最终要支付 5 + 7 + 9 = 21 块钱。 给定 n...
true
a1420c7de504df951864ecb78049aaa1eed5c45b
JosephLevinthal/Research-projects
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/223/users/4480/codes/1594_820.py
UTF-8
485
3.828125
4
[]
no_license
# Instituto de Computacao - UFAM # Lab 01 - Ex 10 # 20 / 05 / 2016 valor = int(input("Qual o valor do saque? ")) # Quantidade de notas de R$ 50 cinquenta = int(valor / 100) # Valor restante a ser sacado com notas menores que R$ 50 cinquenta = valor % 50 # Quantidade de notas de R$ 10 dez = cinquenta / 10 # Valor r...
true
7b867c25f05a99a2ab4a5a8e4536b3943b74de0e
IvanBrasilico/padma
/padma/gym/Peso2.0/treinador_pesagem.py
UTF-8
10,019
2.734375
3
[]
no_license
"""Permite treinar o modelo definido em models/peso/peso.py. Precisa de um csv no formato: _id,numero,peso,volume sendo _id o ObjectId da imagem no GridFS Uma vez treinado, salva os histogramas e os pesos(em labels) Para treinar novamente, basta excluir arquivos .pkl """ import csv import imageio import matp...
true
bf43fb918d8253c578fd3dcdaf466dcd7ab4a7c7
gaelwjl/Leetcode-Solution
/solutions/0041-first-missing-positive/first-missing-positive.py
UTF-8
1,079
3.71875
4
[]
no_license
# Given an unsorted integer array nums, find the smallest missing positive integer. # #   # Example 1: # Input: nums = [1,2,0] # Output: 3 # Example 2: # Input: nums = [3,4,-1,1] # Output: 2 # Example 3: # Input: nums = [7,8,9,11,12] # Output: 1 # #   # Constraints: # # # 0 <= nums.length <= 300 # -231 <= nums[i] <= ...
true
0726597e57a368877fc0a7b833048e66a660c430
nyk510/guruguru-cli
/guruguru/cli.py
UTF-8
3,076
2.671875
3
[]
no_license
""" Guruguru Cli Entrypoint. """ from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from . import authentication, competitions, submissions, version def main(): parser = ArgumentParser(description=__doc__, formatter_class=ArgumentDefaultsHelpFormatter) parser.add_...
true
ddeca1aa5d4305ff298210e61235d93d8e714425
kukiracle/curso_python
/python1-22/seccion5-7/43LISTAS.py
UTF-8
348
3.625
4
[]
no_license
# listas # INDICE = NUMERO QUE SE LE ASIGNA #1RO DEFINIMOS DE # UNA LISTA DE STR nombres= ["juan","karla","ricardo","maria",0,100,True] #IMPRIMIR LA LISTA DE NOMBRES print(nombres) #acceder a los elementos de manera individual print(nombres[0]) print(nombres[1]) #acceder a los elementos de manera inversa print(nom...
true
efe29cce849b92239d1a87993ff13ded76e2f53a
FMRodrigues97/Lab01-CTC17
/Atividade 2.py
UTF-8
16,588
3.171875
3
[]
no_license
import numpy tabuleiro = numpy.zeros((7, 7), dtype=str) ''' LEGENDA 0, 1, 2, 3, 4: Quantidade de lâmpadas adjacentes L: lâmpada I: iluminado P: preto X: proibido '': Não Iluminada ''' ''' # JOGO 1: https://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/lightup.html#7x7:dBi...
true
2df7ed1c125e189b55f40ea45aad1b300e1c39cc
uiandwe/TIL
/algorithm/codility/9_MaxProfit.py
UTF-8
447
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 if len(A) == 0: return 0 if len(A) == 1: return A[0] n_min = float('inf') n_max = float('-inf') for a in A: ...
true
246fcd9c8be74834366c0b06ff9e54a75c9b8fab
thestrawberryqueen/python
/1_beginner/chapter4/practice/simplify.py
UTF-8
430
2.84375
3
[ "MIT" ]
permissive
""" Simplify Here is a block of code where one tries to determine if someone is a Nobel Prize winner. Rewrite the code to work in one statement. (Remove the multi-line comments when you start working.) """ """ if does_significant_work: if makes_breakthrough: is_nobel_prize_candidate = True else: ...
true
4d7cd445675fbbd7570ea64df67a5da460174f07
tinaba96/coding
/acode/abc195/cans_try.py
UTF-8
94
3.140625
3
[]
no_license
N = int(input()) x = 1000 ans = 0 while(N >= x): ans += N-x+1 x *= 1000 print(ans)
true
fd7634c1e8dc665b1f2741aa1df52999cd2e8c1d
guziy/PlotWatrouteData
/src/data/cell_manager.py
UTF-8
12,557
2.65625
3
[]
no_license
__author__="huziy" __date__ ="$Jul 23, 2011 1:04:49 PM$" from data.rivdis_station_metadata import RivDisStationManager from transforms.affine import AffineTransform from data.basin import Basin from data.cell import Cell from mpl_toolkits.basemap import NetCDFFile from mpl_toolkits.basemap import Basemap import net...
true
4cf9bfeccb9dfcaffa86adf58ffcecf5a3ba4369
PaulaRegal/Python
/ List Comprehension/Tirando informações de listas.py
UTF-8
1,333
3.015625
3
[ "MIT" ]
permissive
vendas_produtos = [('iphone', 558147, 951642), ('galaxy', 712350, 244295), ('ipad', 573823, 26964), ('tv', 405252, 787604), ('máquina de café', 718654, 867660), ('kindle', 531580, 78830), ('geladeira', 973139, 710331), ('adega', 892292, 646016), ('notebook dell', 422760, 694913), ('notebook hp', 154753, 539704), ('note...
true
5538f6a45d8fb7a92a5b12d93a09a6f4f18bee7f
binary2dec/Python
/Edx/Week1/Problemset1probelm3.py
UTF-8
532
3.671875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Sep 11 13:55:53 2016 @author: Binary2Dec """ """ iterates through the string to find the longest sequential character set requires a variable known as "s" for example: s = 'lksjdfgjsdlfkhjnmn' """ b = "" y = "" z = "" for x in range(len(s)): if len(b) > len(z): ...
true
90527642ba60436a371e5a2e37fe19e06ae0b6e7
mudkip201/distributions
/dist/src/dists/exponentiatedexpgeo.py
UTF-8
1,198
2.65625
3
[]
no_license
''' Created on Jul 15, 2017 @author: matthewcowen-green ''' import dists.Distribution.Distribution as Distribution import dists.Distribution as ds import math import scipy.optimize as op class exponentiatedexpgeo(Distribution): #exponentiated exponential-geometric @staticmethod def random(a,l,t): u=...
true
fc6e12ae35428c0c0dcce593c5c26a7f4a848b40
rnmourao/aulas-python-natan
/01-soma.py
UTF-8
382
4.1875
4
[]
no_license
# recebendo o primeiro numero x = input('Digite um número: ') # convertendo numero em forma de texto para numero de fato x = int(x) # recebendo o segundo numero y = input('Digite um número: ') # convertendo numero em forma de texto para numero de fato y = int(y) # cria nova variavel que é a soma dos dois número rec...
true
8081fb2951742fc88a7bdede032f401c9c977a7d
jetli123/python_files
/廖雪峰-python/廖雪峰-面向对象之类的访问限制.py
UTF-8
2,473
4.5
4
[]
no_license
# -*- coding: utf-8 -*- """在 Class 内部,可以有属性和方法,而外部代码可以通过直接调用实例 变量的方法来操作数据,这样,就隐藏了内部的复杂逻辑。""" class Student(object): # 目前 外部代码还是可以自由地修改一个实例的 name、 score 属性 def __init__(self, name, score): self.name = name # self.score = score # def print_score(self): print '%s: %s' % (self.name, se...
true
249c936714e5264b9d8b395b82312bc73cbd6ab5
QnHyn/Python_DataStructureAndAlgorithm
/python数据结构与算法-路飞学院/5. 第五课其它排序算法/count_sort.py
UTF-8
409
3.59375
4
[]
no_license
# 计数排序 已知需要排序的列表元素范围在0-100之间 def count_sort(li, max_count=100): count = [0 for _ in range(max_count+1)] for val in li: count[val] += 1 li.clear() for ind, val in enumerate(count): for i in range(val): li.append(ind) import random list = [random.randint(0,100) for i in range...
true
5787eecc33167514ac8d155fec1698e34f7efad8
DayGitH/Python-Challenges
/DailyProgrammer/DP20170825B.py
UTF-8
1,907
3.65625
4
[ "MIT" ]
permissive
""" [17-08-23] Challenge #328 [Intermediate] Pyramid sliding https://www.reddit.com/r/dailyprogrammer/comments/6vi9ro/170823_challenge_328_intermediate_pyramid_sliding/ #Description Pyramid sliding is a fun sport, but you have to be fast or you'll get burned In this challenge you have to find the quickest path down t...
true
faface4c0b27b9a1bfe140d5e5df04bfbc04098a
bnotified/api
/server/tests/api/test_project_api.py
UTF-8
2,708
2.53125
3
[ "MIT" ]
permissive
import json from server.tests.helpers import FlaskTestCase, fixtures class TestProjectAPI(FlaskTestCase): @fixtures('base.json') def test_get_empty_projects(self): """Test GET /api/projects endpoint with no data""" response, data = self.api_request('get', '/api/projects') assert data[...
true
9908b8f21a00d4f0071adfffb46c7aca51de977f
RLBot/RLBotPack
/RLBotPack/beastbot/maneuvers/kickoff.py
UTF-8
6,625
2.53125
3
[ "MIT" ]
permissive
from rlbot.agents.base_agent import SimpleControllerState from maneuvers.maneuver import Maneuver from utility.curves import curve_from_arrival_dir from utility.rlmath import sign from utility.vec import Vec3, norm, proj_onto_size def choose_kickoff_maneuver(bot) -> Maneuver: # Do we have teammates? If no -> alw...
true
bd80d948df574f9d2bf62f535b85054962a1a9b2
raman934/python-2019
/ce48.py
UTF-8
277
3.546875
4
[]
no_license
# RG # 4.10 def print_armstrong(n1, n2): for i in range(n1, n2+1): temp = i res = 0 while temp > 0: res += pow(temp % 10, 3) temp //= 10 if res == i: print(i) print_armstrong(370, 800)
true
ad52e2f72bda79c7903a9ac80c080a4fb10cbe9b
dongbo910220/leetcode_
/Dynamic Programming/174. Dungeon Game Hard.py
UTF-8
864
3.3125
3
[]
no_license
''' https://leetcode.com/problems/dungeon-game/submissions/ ''' class Solution(object): def calculateMinimumHP(self, dungeon): """ :type dungeon: List[List[int]] :rtype: int """ m = len(dungeon) n = len(dungeon[0]) dp = [[float('inf')] * (n + 1) for _ in rang...
true
444791006837f8937a2d77d05353250c82cf3f8a
j4yj03/Uni
/python/linear/.ipynb_checkpoints/CV-checkpoint.py
UTF-8
1,466
3.015625
3
[]
no_license
from sklearn import metrics import numpy as np class CV: @staticmethod def partition(vector, fold, k): size = vector.shape[0] start = (size/k)*fold end = (size/k)*(fold+1) validation = vector[start:end] if str(type(vector)) == "<class 'scipy.sparse.csr.csr_matrix'>": ...
true
fb1c7a1d5eee56e06d438248cfedb8ab1da1519a
X-DataInitiative/tick
/tick/hawkes/simulation/tests/hawkes_kernel_pickle_test.py
UTF-8
3,293
2.859375
3
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# License: BSD 3 clause import pickle import unittest import numpy as np from tick.base import TimeFunction from tick.hawkes import (HawkesKernel0, HawkesKernelExp, HawkesKernelSumExp, HawkesKernelPowerLaw, HawkesKernelTimeFunc) class Test(unittest.TestCase): def setUp(self): s...
true
fc321d123d3934e9bf238433137c2cc616f4a870
Jewelryland/nlp_naivebayes_textclassifier
/feat_to_test_file_gen.py
UTF-8
593
3.015625
3
[]
no_license
#!/usr/bin/python3 import sys import fileinput import os import math def createtestfile(): feat_file = open(sys.argv[1], 'r') test_file = open(sys.argv[2], 'w+') for line in feat_file: words = [word for word in line.split( )] for word in words[1:]: test_file.write(word) test_file.write(" ") test_file...
true
2509848c0f8b0b4e02c5febc0dd37bc1b2144a15
mwong33/leet-code-practice
/medium/validate_bst.py
UTF-8
902
3.6875
4
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right # O(n) time O(n) space class Solution: def isValidBST(self, root: TreeNode) -> bool: # Step One: Convert Tree to in...
true
a737b18e3a057ca1baa171e035c072949e7c94c9
johnmbaughman/Fiddle
/Fiddle.Compilers/Implementation/Python/PythonDemo.py
UTF-8
85
2.6875
3
[ "MIT" ]
permissive
def sayHi(): print("Print: Hello world!") return "Return: Hello world!" sayHi()
true
63e867aaabcc9d855f4706dcd9c3cc4fbbb708cf
zong-zhen-jiang/ML2016
/hw0/q2.py
UTF-8
188
2.78125
3
[]
no_license
import cv2 import sys # Input image src = cv2.imread(sys.argv[1]) # The -1 means to filp around both x and y axes. dst = cv2.flip(src, -1) # Output image cv2.imwrite('ans2.png', dst)
true
0854def5a53ce2e562e5fb55858ea1591410c411
pangbochen/TextClf
/models/BILSTM.py
UTF-8
2,527
2.828125
3
[]
no_license
# -*- coding: UTF-8 -*- import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class BILSTM(nn.Module): def __init__(self, opt): # laod options super(BILSTM, self).__init__() self.opt = opt self.hidden_dim = opt.hidden_dim sel...
true
f513efe1eac4af7cf2980d32ef45e73f5755d7c9
lixiang2017/leetcode
/leetcode-cn/0223.0_Rectangle_Area.py
UTF-8
1,706
3.765625
4
[]
no_license
''' math T: O(1) S: O(1) 执行用时:60 ms, 在所有 Python3 提交中击败了16.63% 的用户 内存消耗:15.1 MB, 在所有 Python3 提交中击败了33.26% 的用户 通过测试用例:3080 / 3080 ''' class Solution: def computeArea(self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int) -> int: def intersection(ax1: int, ay1: int, ax2: int, ay...
true
e97f4a6013dceceedc608793d681a71a963e3a1f
Daiana89/VOTO-ELECTRONICO-PYTHON
/fecha.py
UTF-8
225
3.0625
3
[]
no_license
class Fecha: def __init__(self, dia, mes, anio): self.dia = dia self.mes = mes self.anio = anio def __str__(self): return '{}/{}/{}'.format( self.dia, self.mes, self.anio, )
true
68d48808ca8a13baa20cfaaa79866acf6bf0eacc
Mariownyou/binary-search
/binary-search.py
UTF-8
3,315
3.40625
3
[]
no_license
import random import pygame import sys from math import ceil from time import sleep # pygame params pygame.init() screen = pygame.display.set_mode((900, 900)) screen.fill((255, 255, 255)) # variables arr = [1, 4, 3, 7, 1, 2, 5, 3, 2, 8, 33, 1, 8, 9, 3] n = 5 # settings COLS = 10 ROW = ceil(len(arr) / COLS) w = 800 /...
true
cd8ea1c3101953b83d49f1a2aee9cd866a974973
amirhosseinarab1414/tele-bot2
/telegram_bot.py
UTF-8
3,891
2.5625
3
[]
no_license
import requests import datetime class BotHandler: def __init__(self,token): self.token = token self.api_url = "https://api.telegram.org/bot{}/".format(token) def get_updates(self,offset=0,timeout=30): method = 'getUpdates' params = {'timeout':timeout,'offset': offset} ...
true
a5047cc8e52d03afa9edb56ee16ab04e57b0972a
RoyceMao/CRNN_ATTN_CTC
/utils/visual.py
UTF-8
3,667
2.828125
3
[]
no_license
# -*- coding:utf-8 -*- """ File Name: visual.py Description : 可视化 Author : royce.mao date: 2020/3/2 16:20 """ import cv2 import json import numpy as np from PIL import Image, ImageDraw, ImageFont # CTPN定位之后的数字串小图 class DigitPic(object): def __init__(self, ): super(DigitPi...
true
9d0fea6b4b7e166f4d3e00d8c8132f103b4c77c0
kevtan/drl-dodgeball
/networks.py
UTF-8
2,144
2.75
3
[]
no_license
import torch.nn as nn import torch.nn.functional as F class Linear(nn.Module): def __init__(self, state_space_size, action_space_size): super(Linear, self).__init__() self.out = nn.Linear(state_space_size, action_space_size) def forward(self, data): return self.out(data) class DN...
true
d401de46dbf6c57821a36d3ed6e444c88a2ff960
Just-CJ/PAT
/PAT (Basic Level) Practise/1020. 月饼/Moon.py
UTF-8
741
2.8125
3
[]
no_license
__author__ = 'Just_CJ' import re if __name__ == '__main__': type, need = map(int, re.split(r'\s+(?!$)', raw_input())) stock = map(float, re.split(r'\s+(?!$)', raw_input())) price_all = map(float, re.split(r'\s+(?!$)', raw_input())) dict = {} for i in range(min(len(stock), len(price_all))): ...
true
33dc0f9f9f235875640b4f212be098bcbd17bcb5
mouadbouras/COMP445
/LA3/python/udp_client.py
UTF-8
2,593
2.59375
3
[]
no_license
# import argparse import ipaddress import socket import sys from packet import Packet def run_client(router_addr, router_port, server_addr, server_port): home = str(socket.gethostbyname(server_addr)) peer_ip = ipaddress.ip_address(home) conn = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) timeout ...
true
03f68406106f49312d6bee926f4162249bbb1fba
PETAR-BOT/yoga-detection
/utils.py
UTF-8
7,028
2.625
3
[]
no_license
import cv2 import matplotlib.pyplot as plt import copy import numpy as np from pytorch_openpose import model from pytorch_openpose import util from pytorch_openpose.body import Body import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import torchvision from torchvision ...
true
7dd01f39bd3a01c05348d8107131503cd9632f8e
alien054/Football_Score
/teamDataScrap.py
UTF-8
1,150
2.625
3
[]
no_license
import http.client import json import csv from datetime import datetime import time now = datetime.now() current_time = now.strftime("%H_%M_%S") teamID = 18 connection = http.client.HTTPConnection('api.football-data.org') headers = {'X-Auth-Token': '7363f87364d44da89e034ab7bf772943'} apiCode = ['PL', 'PD', 'FL1', 'BL...
true
e34cee1cbe3ec95968b1f7347cd0197e0f02e55a
dericksmith87/6020_Submissions
/6020_A3/venv/Newton_hook.py
UTF-8
2,634
2.890625
3
[]
no_license
# Newton-hook iteration. Programmed in lectures 13 -- ... import numpy as np from copy import copy from optimize import optimize from try_step import try_step from globals import objFunc def Newton_hook(x0, f, df, delta, N_max, tol_f, tol_x, alpha, beta, delta_min, finiteDiff=False): x = copy(x0) r = f(x) ...
true
ecfb7a10f09612eade88576cb6ee5e4700aca703
shanthansuresh/SDC-ND
/Term1/projects/P3-Behavior-Cloning/model.py
UTF-8
9,269
3.046875
3
[]
no_license
# # Self-Driving Car Engineer Nanodegree # # ## Deep Learning # # ## Project: Behavioral Cloning # # # ## Step 0: Import packages import numpy as np import pandas as pd import cv2 from sklearn.model_selection import train_test_split import os import sys from keras.models import load_model from keras.models impor...
true
4f68001303c372c3ba50bc44b0d60c6d18e4ae8b
deepakksahu/CreDE
/data_ingestor.py
UTF-8
2,085
2.796875
3
[ "Apache-2.0" ]
permissive
import pandas as pd import requests import datetime import mysql.connector def get_python_datetime(): return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),datetime.datetime.now().strftime("%Y-%m-%d") def currencyapi(run_date, app_id): url = "https://openexchangerates.org/api/historical/{}.json?app_id=...
true
e2d6b66d6479f1e3524d3bde427f8a4fb3c8bcd3
SlesarZel/Yandex-Rover-Contest
/main2.py
UTF-8
4,872
3.0625
3
[]
no_license
import pprint class Path(): def __init__(self, length=0, rover=None, toBase=False, path=[], toCargo=None): self.lenght = length self.rover = rover self.toBase = toBase self.path = path self.toCargo = toCargo # path = [[0,1],[0,2],[1,2],[2,2]] class Cargo(): de...
true
efacbf47abd12a9f74770fbc31ecb5e0bac74b33
quantwizard-com/pythonbacktest
/pythonbacktest/indicatorcalculator/indicatorsnapshot.py
UTF-8
2,938
3.421875
3
[ "Apache-2.0" ]
permissive
import copy # this class is responsible for keeping snapshot of the current status of the Indicators class IndicatorsSnapshot(object): def __init__(self, timestamp): # dictionary keeping status of indicators at the given moment in time, structure: # - key - name of the indicator # - value ...
true
bda623d1da716f82532d6914478ac796d0e3f902
KamilJerzyWojcik/DrugStore_python
/Models/Prescription.py
UTF-8
1,646
3
3
[]
no_license
import sqlite3 class Prescription: def __init__(self, customer_name=None, pesel=None, prescription_number=None, id_prescription=0): self.customer_name = customer_name self.pesel = pesel self.prescription_number = prescription_number self.id_prescription = id_prescription def s...
true
33034abebea3b314cbfb7e0db3297dd9248e39a0
puneetrinity/TwitterSentimentData
/TwitterDataFinal.py
UTF-8
7,054
3.4375
3
[]
no_license
import codecs import json from simplemapplot import make_us_state_map stateAbbrevList = ["AK","AL","AR","AZ","CA","CO","CT","DE", "FL","GA","HI","IA","ID", "IL","IN","KS", "KY","LA","MA","MD","ME","MI","MN","MO", "MS","MT","NC","ND","NE","NH","NJ","NM", ...
true
879a27d6a32f84766da1c280b87686f28657cb82
RIMEL-UCA/RIMEL-UCA.github.io
/chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/010104_rollfwd_swap_fwd_rates.py
UTF-8
2,092
2.9375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[ ]: from gs_quant.markets import PricingContext from gs_quant.session import GsSession, Environment from gs_quant.markets.portfolio import Portfolio from gs_quant.instrument import IRSwap from gs_quant.risk import RollFwd, IRFwdRate import matplotlib.pyplot as plt import pa...
true
308ba0655b89ca6f79c58b3f3b55027dd52cebfe
GINK03/psyche
/rank/Rank.py
UTF-8
814
3.078125
3
[]
no_license
import pandas as pd def rank(input_dfs=[], col=None): assert isinstance(col, str), 'col must be str object' dfTrain, dfTest = input_dfs size = len(dfTrain) dfConc = pd.concat([dfTrain[[col]], dfTest[[col]]], axis=0) dfConc[f'Rank_{col}'] = dfConc[c].rank() dfTrain[f'Rank_{col}'] = dfConc[f'Ran...
true
b35edef078b381391340222bf42044c473723f1c
Davidnaftalin/bloggy-mcblog
/main.py
UTF-8
3,769
2.671875
3
[ "Apache-2.0", "LicenseRef-scancode-generic-cla" ]
permissive
import os import webapp2 import jinja2 from signup import WelcomePage, LoginPage, SignUpPage, User_DB, LogoutPage from google.appengine.ext import db template_dir = os.path.join(os.path.dirname(__file__), 'templates') jinja_env = jinja2.Environment(loader = jinja2.FileSystemLoader(template_dir), ...
true
a813eb604af02a212dea0f9ec0a081b13e718144
marcellinamichie291/Crypto_Algorithmic_Trading
/checkAccountBalanceGDAX.py
UTF-8
2,387
2.90625
3
[ "MIT" ]
permissive
# Name: checkAccountBalanceGDAX.py # Author: Matt Nutsch # Date Created: 2-12-2018 # Last Edited: 2-12-2018 # Description: This script reads the balance of an account from the exchange GDAX. # NOTE: # Requires python-requests. Install with pip: # pip install requests # or, with easy-install: # easy_insta...
true
b2ac4756738bdb4039e2f65b429474871e50b26d
mattzh72/atomate-gui
/atomate_gui/components/slider.py
UTF-8
3,131
2.5625
3
[]
no_license
from components.base import BaseComponent import dash_core_components as dcc import dash_html_components as html from math import floor, log10, ceil class Slider(BaseComponent): type = 'slider' def __init__(self, name, min_val=0, max_val=10, step=1): BaseComponent.__init__(self, name, [min_val, max_v...
true
d440f0475ed368a4a4ac7fbe1a6f0cae05753e68
simrit1/geometric
/geometric/__init__.py
UTF-8
1,327
2.578125
3
[ "BSD-3-Clause" ]
permissive
""" Create, manipulate, and visualize geometric objects with physical properties """ from ._version import get_versions from .primitives import Sphere # Set the version number using versioneer __version__ = get_versions()['version'] del get_versions def test(verbose=True, coverage=False): """ Run the test s...
true
0894437d9a172e0b1cbff722b055c21aa018fb76
RingBDStack/MA-PairRNN
/model.py
UTF-8
14,970
2.546875
3
[]
no_license
import torch import torch.nn as nn from utils import * from node_embedding import * from meta_fuse import * from PairRNN import * import time from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score from sklearn.metrics import classification_report from mytest import * import r...
true
82e2a97cfb742b0bee00f0773701d4391736dc58
antocuni/cffi-shm
/shm/set.py
UTF-8
1,512
3.125
3
[ "BSD-3-Clause" ]
permissive
""" Implement a shm set on top of a shm dict """ from shm.dict import DictType, cfuffi from shm.pyffi import AbstractGenericType class SetType(AbstractGenericType): def __init__(self, pyffi, itemtype, **kwds): self.pyffi = pyffi self.itemtype = itemtype self.DT = DictType(pyffi, itemtype, ...
true
607c1c810fa84d5fc17d6014ce181d41279b491e
zhangyunrui/cookbook
/data_structures_and_algorithms/1_4_finding_the_largest_or_smallest_n_items.py
UTF-8
1,115
3.796875
4
[]
no_license
# -*- coding: utf-8 -*- import heapq import operator nums = [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, nums)) print(heapq.nsmallest(3, nums)) protfolio = [ {'name': 'IBM', 'shares': 100, 'price': 91.1}, {'name': 'AAPL', 'shares': 50, 'price': 543.22}, {'name': 'FB', 'shares': 200, 'pri...
true
d53f6e2a49852e716a0f9daff363176bda3ea1f6
Leanivets/TestScript
/metrics.py
UTF-8
1,439
3
3
[]
no_license
#!/usr/bin/env python3 from sys import argv import psutil def proc_metric(tab = ''): print(tab + 'system.cpu.idle ', psutil.cpu_times().idle) print(tab + 'system.cpu.user ', psutil.cpu_times().user) print(tab + 'system.cpu.guest ', psutil.cpu_times().guest) print(tab + 'system.cpu.iowait ', psutil.cpu_times().i...
true
6b22900d3eb0db19003d539de48164290789971f
Richardwillianx/Exercicios-em-Python
/Desafio34.py
UTF-8
465
4.5625
5
[]
no_license
""" Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento. Para salários superiores a R$ 1.250,00 , calcule aumenteo de 10%. Pra os inferiores ou iguais, o aumento é de 15%. """ salario = float(input('Informe o seu salário: R$')) if salario <= 1.250: novo = salario + (sala...
true
d22e9b894fad74c359ae24ec8af9a402d943eba2
aphp/dsfaker
/dsfaker/noise/modulators.py
UTF-8
1,595
2.890625
3
[ "MIT" ]
permissive
import numpy from dsfaker.generators import Normal, TimeSeries, Generator, BoundingOperator class ModulatorLinearInterpolation(Generator): def __init__(self, time_series: TimeSeries, start_frequency: float=1, modulating_generator: Generator=BoundingOperator(gene...
true
9d8e76d04de46491c76b75aeaf54f4e98a17f301
LeeWoojin-99/Web-Crwaling
/auto_email_send.py
UTF-8
1,482
3.109375
3
[]
no_license
''' 자동으로 구글에 로그인해서 메일을 보내는 프로그램 ''' from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.action_chains import ActionChains #from bs4 import BeautifulSoup from time import sleep driver = webdriver.Chrome('./chromedriver_win32/chromedriver.exe') action = ActionC...
true
6926658120cde59c4c51c9f406900b6afb48d30f
CPJDEV/wms
/app/funcs_.py
UTF-8
2,148
2.578125
3
[]
no_license
from app import db from models import Bin from sqlalchemy.exc import InvalidRequestError, IntegrityError, SQLAlchemyError class Dot_(dict): # Usage: arr = Map(dict) # keyvalue = arr.key def __init__(self, *args, **kwargs): super(Dot_, self).__init__(*args, **kwargs) for arg in args: ...
true
9fb623c02287616594f9dd71b2942a748a052c29
Cubgl/Anagram
/example.py
UTF-8
286
2.671875
3
[]
no_license
a = {'aaa': 3, 'bbb': 'ccc'} with open('a.dat', 'wb') as f: f.write(bytes(str(a).encode())) with open('a.dat', 'rb') as g: data = g.read() data = data.decode() print(type(data)) b = eval(f'{data}') print(type(b)) print(b.get('ccc')) print(b.get('aaa')) print(b.get('bbb'))
true
8bfdc66662a17340fab2313fe2fe01300a4ceb2a
pravin-asp/Python-Learnings
/Addition_of_n_numbers.py
UTF-8
223
3.921875
4
[]
no_license
# Additon of n numbers total = 0 value = int(input()) for i in range(1, value + 1): total += i print(total) # Factorial of n numbers total = 1 value = int(input()) for i in range(1, value + 1): total *= i print(total)
true
2a569f6e068ec7af139f64fe2030c8b1eac281a9
bfaure/ctci
/python_basics/binary_search/main.py
UTF-8
849
4
4
[]
no_license
# performs binary search on input list def binary_search(a,value): if len(a)==0: return False if len(a)==1: if a[0]==value: return True else: return False mid=a[len(a)/2] if value==mid: return True if value<mid: return binary_search(a[:len(a)/2],value) if value>mid: return binary_search(a[len(a...
true
91e35b37113e51b0c20b097b0bbc0ccca175b417
havu73/segmentationClock2016
/stochastic/parameter_analysis/source/refineRanges.py
UTF-8
5,164
2.78125
3
[]
no_license
""" Refine existing ranges into more precise ones based on parameter sets Copyright (C) 2013 Ahmet Ay, Jack Holland, Adriana Sperlea, Sebastian Sangervasi This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundati...
true
3bbe8c381a40fcca9035ceb481f3e44fb04c21fc
rajkshah3/Keras_Multi_InputOutput
/model.py
UTF-8
1,984
2.90625
3
[]
no_license
import keras from keras.layers import Input,Dense,Embedding,Concatenate,Flatten from keras.models import Model from keras.constraints import UnitNorm import numpy as np np.random.seed(12) data_size = 100 input_classes = [6,4,3,4,6] input_data = [ np.random.randint(0,5,data_size), np.random.randint(0,3,data_size), np...
true
6557d6226c3af9c9394d4d9447f56857db8e8fe9
kiwiapple87/CodeCombat-1
/Desert/PreferentialTreatment.py
UTF-8
767
2.96875
3
[]
no_license
# http://codecombat.com/play/level/preferential-treatment?course=56462f935afde0c6fd30fc8c&course-instance=56fc25d7263b0220002aff0e # Сначала цикл для всех врагов enemies = self.findEnemies() enemyIndex = 0 # ...но атаковать только врагов с типом 'thrower' while enemyIndex < len(enemies): if enemies[enemyIndex].typ...
true
3bc9faefa334db8d0c18c8fca4307e9c1f8b4600
Amuel88/my-first-blog
/python_intro.py
UTF-8
637
3.765625
4
[]
no_license
print('Hello, Django girls!') name="Anne" if 5>2: print("Lääääuft!") else: print("Läuft nicht!") if name=="Sonja": print("Hallo Sonja") elif name=="Anne": print("Hallo Anne") else: print("Hallo Fremder!") def hi(): print ("Hallo!") print ("Wie geht's?") hi() def hi(name): if name=="Sonja...
true
4dc081e556af2f358d6f225318f4b7c510bc1cdd
wkxkevin/Smogon-Usage-Stats
/common.py
UTF-8
11,387
2.703125
3
[ "MIT" ]
permissive
#!/usr/bin/python import string import math import js2py import urllib2 import ujson as json def keyify(s): sout = '' for c in s: if c in string.uppercase: sout = sout + c.lower() elif c in string.lowercase + '1234567890': sout = sout + c return sout #our weighting function def weighting(rating,deviatio...
true
d19f32f8985ded4649d04b0615b2f617f32cab8b
tskim218/SimpleIPTrack
/IPaddrTracking.py
UTF-8
1,798
3.578125
4
[]
no_license
import threading class IPs(object): """ data structure {totalOfIP: int, totalRequest: int, ips: {ip1: count, ip2: count, etc}} """ def __init__(self): self.lock = threading.Lock() self.totalOfIP = 0 self.totalRequest = 0 self.ips = {} def addIps(self, ip): """ synchronization """ self.lock.acquire()...
true
c2fa0d3fe927416c4a4d0c7d917d24584feb578b
hristo-genev/uWsgiApps
/webgrab_proxy/webgrab_proxy/utils.py
UTF-8
4,325
2.59375
3
[]
no_license
import json import datetime import requests import time import os from bs4 import BeautifulSoup def normalize(txt): return txt.lstrip().rstrip().replace("\\n","").replace("<span lang=\"BG\">", "").replace("</span>","") def to_dict(programs): return [p.__dict__ for p in programs] def sort(programs, reverse=False)...
true
490104f28fab1c7afc5cc52572a58917eb1df547
xiaobink/python
/python_code/知识点/基础课程知识点/第六讲 数据结构及类型/set()集合.py
UTF-8
1,837
4.53125
5
[]
no_license
'''---知识点:集合set()---''' ''' 1.集合是无序的,不可重复的,元素写入后是可改变的,使用{}创建 2.s={},代表的是一个dict,要创建空set,应写s=set() 3.set()函数,可以将序列(list,dict,tuple)转化为集合 ''' s1=set([1,2,3,4]) print(s1) #{1, 2, 3, 4} s2=set({'a':1,'b':2}) #当将dict转为set时,转化的是dict的键,没有值 print(s2) #{'a', 'b'} s1.add(6) #使用add向集合添加元素 print(s1) #...
true
c8e227ac089d89d45e865f9485e673ea9c5cf76c
olamarche/piui
/servo.py
UTF-8
1,027
2.8125
3
[]
no_license
#!/usr/bin/env python # # Example for Hack Factory Raspberry Pi Class. # David M. N. Bryan, dave@drstrangelove.net # # This is licend under creative commons license: # http://creativecommons.org/licenses/by-nc-sa/3.0/ # Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) # # This needs more work. The c...
true