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
5620f288287530c68353a5618621d68372ac995d
look4aritra/be_my_voice
/analyzer/scrapper.py
UTF-8
1,935
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- # %% import glob import json import sys from contextlib import suppress import pandas as pd from newsapi import NewsApiClient from newspaper import Article from utilities import print_dataframe # %% newsapi_key = '38b178162f2e497cb564c6a6dafc6c9a' # %% def process_article(url): article_...
true
ed80ed0a50e3976b36cbe80c676c107c73d6b4e7
zzhyzzh/Leetcode
/leetcode-algorithms/762. Prime Number of Set Bits in Binary Representation/countPrimeSetBits.py
UTF-8
420
3.328125
3
[]
no_license
class Solution(object): def countPrimeSetBits(self, L, R): """ :type L: int :type R: int :rtype: int """ count = 0 for i in range(L, R + 1): if str(bin(i)).count("1") in [2, 3, 5, 7, 11, 13, 17, 19]: count += 1 return count...
true
db8c7dd92492bbebcec98027133a3f21e88097bd
TobleMiner/psydewalk
/psydewalk/transport/__init__.py
UTF-8
1,453
2.765625
3
[ "MIT" ]
permissive
import random class Transport(): """docstring for Transport""" BEHAVIOR = None def __init__(self, registry): super(Transport, self).__init__() registry.registerTransport(self) class TransportRegistry(): """docstring for TransportRegistry""" def __init__(self): self.transports = [] self.collectTransports...
true
310eff67fb7b80667ccc3ed54fe57fea52232237
Damianofds/pycanvas
/rest_fibonacci.py
UTF-8
1,160
3.484375
3
[]
no_license
from flask import Flask import time app = Flask(__name__) @app.route('/') def hello_world(): return 'Fibonacci plain vs with memoization!' @app.route('/fibonacci/<int:nth>/<string:mode>') def fibonacci_endpoint(nth, mode): start = time.time() print str(start) fib = 0 if mode == "plain": fi...
true
69f41f7d193b06a72c3c3e4751e09376614306b7
karstendick/project-euler
/euler086/euler086.py
UTF-8
1,560
3.40625
3
[]
no_license
#PE #86 from math import floor, sqrt import time def timing(f): def wrap(*args): time1 = time.time() ret = f(*args) time2 = time.time() print '%s function took %0.3f ms' % (f.func_name, (time2-time1)*1000.0) return ret return wrap def memoize(fn): memo={} def m...
true
4cd53b8888197c7f9ecaaca2042918d7cfcdea99
ptyork/au-aist2120-21sp
/Code_Before_Jan_21/ATh/hello_0114.py
UTF-8
749
4.4375
4
[]
no_license
# COMMENT C# -- // ''' MULTI-LINE COMMENT c# -- /* */ using ...; class Program { public void Main(object args[]) { // YOUR CODE GOES HERE (Entry point) Console.Writeline("hello"); } } ''' print('hello') 'single quote' "double quote" ''' multi-l...
true
53fbea5b261d7efd4654dcf5148f4997c9cc05f8
wimpykid26/Zeus
/src/client/retrieve_similarity.py
UTF-8
500
2.546875
3
[]
no_license
from pymongo import MongoClient import pprint import json import unicodedata def retrieve(id, category_article): links=[] category=[] client=MongoClient() db=client.mydb content=db.meta_data id=unicodedata.normalize('NFKD', id).encode('ascii','ignore') category_article=unicodedata.normaliz...
true
bba7a6b14038257f49cabdcd5bcd656ca6228f28
JoaoCostaIFG/MNUM
/exams/unknown_date_exam/3_gauss_elim.py
UTF-8
1,396
3.28125
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 n = 4 A = [[0.1, 0.5, 3, 0.25], [1.2, 0.2, 0.25, 0.2], [-1, 0.25, 0.3, 2], [2, 0.00001, 1, 0.4]] b = [0, 1, 2, 3] # Gauss elim for i in range(n): pivot = A[i][i] b[i] /= pivot for j in range(n): A[i][j] /= pivot for j in range(i + 1, n): times = A[j][i] ...
true
60493061ca8b9bc3504cfa2248926b486906167c
odcolares/ExerciciosPython
/ex071.py
UTF-8
1,272
3.671875
4
[]
no_license
#Aqui são as firulas!!! print('SIMULADOR DE CAIXA ELETRÔNICO BANDO OPC') print('=' * 30) print('{:^30}'.format('Banco OPC')) print('=' * 30) #Solicitando o valor a ser sacado. valor = int(input('Qual o valor que vc deseja sacar? R$')) total = valor #total recebendo o valor solicitado pelo cliente ced = 200 #Variave...
true
1a9a5fd092e76c9267242e6189c31986fba1e344
hedgelawn6/bike_gps
/make_db.py
UTF-8
7,399
3.03125
3
[]
no_license
import csv import sqlite3 import sys import datetime as dt from dateutil.parser import parse from geopy.distance import vincenty, great_circle from sql_queries import get_sql #Returns the distance between 2 coords def get_dist(a, b): '''Takes 2 arguments - both lat, lon tuples. Returns km distance between 2 la...
true
4a76aa53829946904aa0e49b7dc97b6153948311
buffosens/InteractiveMap
/py/edit.py
UTF-8
674
2.734375
3
[]
no_license
import fileinput new_file_content = "" filepath = 'Data/map.svg' id = 0 with open(filepath) as fp: line = fp.readline() cnt = 1 while line: text = format(line.strip()) if(text.startswith('<path style="fill-rule:evenodd;fill:rgb(85.098039%,81.568627%,78.823529%')): text = text[:6...
true
1a8a9c6f2d419329f57393c3a03db2459da337f5
hrithikguy/leetcode
/827_making_a_large_island.py
UTF-8
2,129
2.859375
3
[]
no_license
class Solution(object): def largestIsland(self, grid): """ :type grid: List[List[int]] :rtype: int """ visited = set() sizes = {0: 0} cur_component_index = 1 for i in range(len(grid)): for j in range(len(grid[0]))...
true
aa9db87143b6c23f8d377c13a37f8f1d3dbbb5d5
FaroudSADIKOU/3DBLEND
/BlenderAddOn/leaplib/AddOn_SaveAndLoad.py
UTF-8
1,712
2.546875
3
[]
no_license
import bpy import mathutils as math # This class will generate dialog and ask user the name of the scene it will save class saveDialogOperator(bpy.types.Operator): bl_idname = "object.save_dialog" bl_label = "save mesh" # Here you declare everything you want to show in the dialog name = bpy.props.Str...
true
dee7c89a9236ece4d7fe2a57ccab68921e23e701
cylblinds/Python
/calpi.py
UTF-8
325
2.953125
3
[]
no_license
from random import random from time import perf_counter darts = 10000*10000 hits = 0.0 start = perf_counter() for i in range(1,darts+1): x,y = random(),random() dis = pow(x**2+y**2,0.5) if dis<=1: hits = hits+1 pi = 4*hits/darts end = perf_counter() dur = end - start print('{0:.10f},{1}'.format(pi,d...
true
b0bd8b7e76cb8a6772df829567a23b37f7f3cce0
wangduizhang/myex
/ex10.py
UTF-8
159
3.203125
3
[]
no_license
#!/usr/bin/python #_*_coding:utf-8_*_ def lenRecur(aStr): if aStr == '': return 0 else: return 1+lenRecur(aStr[1:]) s = raw_input('>') print lenRecur(s)
true
92c8a9e9e65aba74c1664095e133c34bcd9bb2f9
Parply/Advent-of-Code-2020
/day-13/solutions.py
UTF-8
705
2.96875
3
[]
no_license
import numpy as np data=[] with open("input.txt","r") as f: for i in f.readlines(): data.append(i.rstrip().split(",")) earliestTime = int(data[0][0]) buses = np.array([int(i) for i in data[1] if i!='x']) cont =True time = earliestTime while cont: for i in buses: if not time % i: c...
true
f945ca66f9a898986648948bd0d8a51fbf93fbd2
pushkarlanka/starwars-wiki
/app/models.py
UTF-8
8,279
2.875
3
[]
no_license
# pylint: disable = bad-whitespace # pylint: disable = invalid-name # pylint: disable = missing-docstring # pylint: disable = too-many-arguments # pylint: disable = bad-continuation # pylint: disable = too-few-public-methods # pylint: disable = no-member # pylint: disable = import-error # pylint: disable = redefined-bu...
true
5ffa8baf76919fab95bbefb68bba40918a595792
Emiya2098212383/Lesson02-
/01-string.py
UTF-8
791
4.375
4
[]
no_license
# ------------------------------- # 练习一 s = input("输入一串全部小写的英语:") print("全部转化为大写后:%s\n" % (s.upper())) # 把所有字符中的小写字母转换成大写字母 s = input("输入一串全部大写的英语:") print("全部转化为大写后:%s\n" % (s.lower())) # 把所有字符中的大写字母转换成小写字母 s = input("输入一串全部小写的英语句子:") print("首字母转化为大写后:%s\n" % (s.capitalize())) # 把第一个字母转化为大...
true
2b9dbb170211cd527682548111b07b9c6b8076cb
debainhit/PythonDataAnalysis
/DescriptiveStatistics.py
UTF-8
826
3.5
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-02-05 16:12:48 # @Author : debainhit (18068920049@163.com) # @Link : https://github.com/debainhit # @Version : $Id$ import pandas as pd import numpy as np #Create a Dictionary of series (columns) d = {'Name':pd.Series(['Tom','James','Ricky','Vin','St...
true
d7a7d059544c1a13947de30c3ea3ba3f55dd868e
panchaldeep009/imageToText
/using Python/run.py
UTF-8
1,423
3.03125
3
[]
no_license
from PIL import Image from array import * def convertColorintensityToText(x): x = 255-x if(x < 16): return ' ' elif(x < 32): return '`' elif(x < 48): return '.' elif(x < 64): return '-' elif(x < 80): return ':' elif(x < 96): return '|' el...
true
85cb8633b668955d56e1727d0cedafad86210afd
like3110/file2oracle
/bin/passwdUtil.py
UTF-8
1,340
2.703125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import base64 import sys import os from Crypto import Random from Crypto.Cipher import AES FILE_PATH = os.path.realpath(__file__) BIN_PATH = os.path.split(FILE_PATH)[0] # CONFIG_PATH = os.path.split(BIN_PATH)[0] + '\conf\\auth.xml' # print CONFIG_PATH # 加密函数 def encryp...
true
e0c9372c8884814d67aeae219240b783149c94ea
luchak/radiosity-viewer
/viewer.py
UTF-8
3,601
2.609375
3
[]
no_license
#!/usr/bin/env python import sys import numpy import OpenGL.GL as GL import geometry.triangle_mesh as triangle_mesh import util.gl.viewer_app as viewer_app USE_PRECOMPUTED_NORMALS = False def DrawMesh(mesh): GL.glEnable(GL.GL_LIGHTING) GL.glEnable(GL.GL_LIGHT0) for material, faces in mesh.materials.iteritem...
true
45a2d37354d7e739d18daac2a411b8f55568caca
bezsovesty/learning
/python/num_analysis/NumAnalysis/Matrix.py
UTF-8
2,240
3.71875
4
[]
no_license
from typing import List, Union from copy import deepcopy class Matrix: def __init__(self, matrix: List[List[Union[float, int]]]): self.__matrix = deepcopy(matrix) def __getitem__(self, item: Union[List[int], int]) \ -> Union[List[Union[float, int]], int, float]: if isinstance(ite...
true
816728029ba6ef7d1b809723c5f9adb3a852b824
tankle/TARSQI
/code/components/preprocessing/tokenizer.py
UTF-8
5,151
3.09375
3
[]
no_license
import re from abbreviation import * def Split_Punctuation(token): """Split punctuation at beginning and end of token. Maximum of three punctuation marks at end of token is allowed. Possibly better not to split closing brackets if token contains corresponding closing bracket (but what about putt...
true
7c5cc3ece7c83455057005ca52262a2525ac440c
lianglee123/leetcode
/200~300/251~260/255.verify-preorder-sequence.py
UTF-8
668
3.15625
3
[]
no_license
from typing import * class Solution: def verifyPreOrder(self, preorder: List): if len(preorder) == 0: return True return self.helper(preorder, 0, len(preorder)-1) def helper(self, preorder: List, start: int, end: int): if start >= end or start + 1 == end: return...
true
c5a12d70932a717acd27fb716e15b9cab6feeeeb
DEIB-GECO/PyGMQL
/test/test_high_level.py
UTF-8
8,765
2.703125
3
[ "Apache-2.0" ]
permissive
import unittest import gmql as gl from gmql.dataset.GDataframe import GDataframe from gmql.dataset.GMQLDataset import GMQLDataset from pkg_resources import resource_filename import os from glob import glob import shutil gl.set_progress(False) class GMQLQueryTester(unittest.TestCase): def setUp(self): se...
true
0e86887a441b371c8037579f5858c8a83675e052
tanerkmz/unliving_p
/unliving.py
UTF-8
1,662
2.59375
3
[]
no_license
#!/usr/bin/python #Taner Körükmez #e-mail: tnr.kmz@yandex.com import RPi.GPIO as GPIO import sys import os import subprocess import time GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(27,GPIO.OUT) GPIO_PIR = 23 print "PIR Module Video Trigger (CTRL-C to exit)" # Set pin as input GPIO.setup(GPIO_PIR,GPIO.I...
true
45eba3552abb31b7ee7d75aef2c2bac32b702629
okaysidd/Interview_material
/Extras/Rotate Array.py
UTF-8
1,398
4.375
4
[]
no_license
""" 189. Rotate Array Given an array, rotate the array to the right by k steps, where k is non-negative. Follow up: Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. Could you do it in-place with O(1) extra space? Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Outp...
true
66960e2ff3262bbd10eb2ba75f274174ca25393a
GuoHongke/coursera-ml-py
/machine-learning-ex8/ex8/multivariateGaussian.py
UTF-8
238
2.703125
3
[ "MIT" ]
permissive
import numpy as np def multivariate_gaussian(X, mu, sigma2): k = mu.size x = X - mu exp = - (1 / 2) * (x @ np.linalg.pinv(sigma2) @ x.T) p = (2 * np.pi) ** (-k / 2) * np.linalg.det(sigma2) ** (-0.5) * exp return p
true
6555ec2cb9231119ac3ec56e4287527f007ff707
gabrielpython32/python3-curso-em-video
/mundo-02/exercicio-062.py
UTF-8
822
4.3125
4
[]
no_license
''' Melhore o exercício 061, perguntando para o usuário se ele quer mostrar mais alguns termos. O programa encerra quando ele disser que quer mostrar 0 termos. ''' print('Progressão aritimética') n1 = int(input('Informe o primeiro termo: ')) rz = int(input('Informe a razão da PA: ')) nn = int(input('Informe a quantid...
true
16db16b1a9a79d1e5eca776cc55f862e4dc45a05
lubeina/python-foundations
/calculator.py
UTF-8
607
4.09375
4
[]
no_license
firstnum = input("Enter the first number: ") if firstnum.isalpha() is True: print('The first number is invalid') secondnum= input("Enter the second number: ") if secondnum.isalpha() is True: print('The second number is invalid') operation = input("Choose the operation (+,-,/,*):") if operation == '+': result = in...
true
75bf40bffdb6ccd6d16aa4be978708d1030651b8
mattyws/tcc_deep
/TideneMisc.py
UTF-8
1,610
2.953125
3
[]
no_license
''' ====== Misc Routines ========== Version 15-12-2016 Python 3.4.3 ''' from sklearn.cross_validation import * import pandas as pd from gensim.models.doc2vec import LabeledSentence ''' input: list structure [[cat,text],[cat,text],...] output: pandas data frame ''' class LstToDataFrame(object): def transform(corpu...
true
9294b9d576d5465b55e356edda9b65854c71afbe
DaHuO/Supergraph
/codes/CodeJamCrawler/CJ/16_0_1_15kingben_CountingSheep.py
UTF-8
1,085
3.03125
3
[]
no_license
from __future__ import print_function output = open("output.txt", "w") with open("input.txt") as f: lines = f.readlines() length = int(lines[0].split()[0]) for i in range(0, length): startNum = int(lines[1+i].split()[0]) if(startNum == 0): outline = "Case #" + str( i + 1) + ":...
true
7935241b79bd5c1832c025545cd9a9609530bbeb
RishabhBrajabasi/SmartClassroom
/RFID Attendance System/Read.py
UTF-8
3,785
2.71875
3
[]
no_license
#!/usr/bin/env python import RPi.GPIO as GPIO import time import csv from datetime import date import datetime from mfrc522 import SimpleMFRC522 import threading timer_1 = 0 timer_2 = 0 timer_3 = 0 random_timer = 0 def reset_time_1 (): global timer_1 timer_1 = 0 # print "Timer Reset_1" def reset_time_2 (): global...
true
cb5eb074dc92d7ac359bb67dce489c4fbf5621ef
LuisDiego19FV/Proyecto-Graficas
/run.py
UTF-8
1,762
2.8125
3
[]
no_license
#SR5 #Luis Diego Fernandez import sys import BMP WIDTH = 800 HEIGHT = 800 def makeTable(): print("Painting Table...") image.clear_zbuffer() image.setShaderTable() x = int(0.500*WIDTH) y = int(0.350*HEIGHT) image.objMaker("Table/Table",435,x,y,False,True,True) def makeSword(): print("Paint...
true
3fbfd0ac7121ec94b5082d70976805246c20926e
warna720/TDP002
/Labb 6/labb6.py
UTF-8
3,267
3.75
4
[]
no_license
#! /usr/bin/env python3 #-*- coding: utf-8 -*- """6a__________________________________________________________________""" def linear_search(haystack, needle, field = lambda l: l['title']): for obj in haystack: if str(field(obj)).lower() == str(needle).lower(): #More correct search retu...
true
f55599afbfc130fa678ed62f03d91409e074e114
sborland/pyLDFI
/src/utils/tools.py
UTF-8
14,729
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/env python ''' tools.py A storage location for generally applicable methods used to sanity-check particular properties. ''' import inspect, os, random, re, string, sys, numbers # ------------------------------------------------------ # # import sibling packages HERE!!! packagePath = os.path.abspath...
true
c2c6aadd7e049df96d88f3f849be7cf5d7e468e3
MaximBazarov/gcpy
/gcpy/functions/BinaryPayload.py
UTF-8
1,359
3.203125
3
[ "MIT" ]
permissive
import json class BinaryPayload: """ Binary payload to use in HTTP handlers. Subclasses __init__ **must** have default values for all the parameters to be able to instantiate via calling `cls()` """ @classmethod def by_decoding(cls, binary_payload: bytes): """ Decodes byt...
true
d8281743bd0b553ce7c239b99e157bbe84078b7f
AmandaShuman/pythonFunamentals
/weeks1-2/builtin_functions.py
UTF-8
359
4.6875
5
[]
no_license
print("Math Functions") # absolute value function abs_int = abs(-1) print(abs_int) # float function will turn any number into a floating point value int_to_float = float(100) print(int_to_float) # turns any float into an integer print(int(1.23)) print(max(1, 2, -5, 10, 0)) print(min(1, 2, -5, 10, 0)) print(pow(2, 3...
true
8ad9ea8e6bec9ec85366439eacb6a59ed3f66a21
transientlunatic/badger
/badger/core.py
UTF-8
3,714
2.78125
3
[ "ISC" ]
permissive
import ConfigParser import os from os.path import expanduser, join from slugify import slugify import datetime import frontmatter class Configuration(): """ Handle the configuration of Badger """ def __init__(self): home = expanduser("~") self.config = ConfigParser.ConfigParser() ...
true
8e65dbbece05a1fe3b99c96fc8897a92b526b20a
skojaku/core-periphery-detection
/cpnet/Rossa.py
UTF-8
2,635
2.6875
3
[ "Apache-2.0" ]
permissive
import numpy as np from scipy.sparse import diags from scipy.sparse.linalg import eigs from . import utils from .CPAlgorithm import CPAlgorithm class Rossa(CPAlgorithm): """Rossa's algorithm for finding continuous core-periphery structure. This algorithm finds multiple core-periphery pairs in networks. ...
true
e955eb67421bfe45089d549f2aa23ab42e5227dc
kadnan/MadinaPopulation
/population_2011.py
UTF-8
720
2.84375
3
[ "MIT" ]
permissive
import pandas as pd import matplotlib.pyplot as plt #Read Excel xls_population = pd.ExcelFile('Madina-pop.xlsx',index_col=False) names = xls_population.sheet_names df = xls_population.parse('population-Madinah-Region-2011') #df.set_index('Governorate', inplace = True) df.index.name = None df.columns = ['Region','Saudi...
true
9daf765131a7c8662b9ccbabf0ca7f4a10a75d3b
Arash67/cardiovascular
/generate-1d-mesh/c-interface/gen_1d.py
UTF-8
276
2.6875
3
[]
no_license
#def run(arg): def run(*args, **kwargs): print("---- Execute run ----") print("args: ", args) print("kwargs: ", kwargs) #krun(**vars(args)) return 1 def krun(**kwargs): print("---- Execute run ----") print("Arguments: ", kwargs) return 12345
true
78727079a8180bf2f5939e57b3cdbfb429da3abc
computerhong/PyRed
/algorithm.py
UTF-8
4,800
2.96875
3
[]
no_license
''' ' ' @file algorithm.py ' ' @brief Any algorithmic implementations ' ' @version 1.0 ' ' @date 2019/12/10 20:53:59 ' ' @author Red, 735467224@qq.com ' ''' from Hungary import Hungary from EdgeCluster import EdgeCluster from OcclusionDetect import OcclusionDetect from ImageClarity import ImageClarity ...
true
4f7b4407d53ea56ee85b4d7a2cfcc8cc5f34c9e8
DarshanGowda0/LC-Grind
/Bloomberg/heap_impl.py
UTF-8
1,505
3.96875
4
[]
no_license
class MinHeap: # making the assumption that heap starts at idx 1 def __init__(self): self.size = 0 self.heap = [0] # append at end and then sift up def insert(self, x): self.heap.append(x) self.size += 1 self._sift_up(self.size) # take out first ele, put ...
true
21d50d98c680f18eb1efcef23d94f29a0465a8c5
W-echo/20T2
/Sentiment_Analysis/BNB_sentiment.py
UTF-8
3,319
2.984375
3
[]
no_license
import sys import numpy as np from sklearn.naive_bayes import MultinomialNB, BernoulliNB from sklearn.feature_extraction.text import CountVectorizer from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, classification_report from sklearn import tree import string from nltk.sentiment.vader...
true
53cb844fedb3bbfa4aef32b268a6e45ab96cedea
bcogrel/webid-delegated-auth
/webid_delegated_auth/signing.py
UTF-8
3,670
2.90625
3
[ "LicenseRef-scancode-mit-old-style", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
""" Tools for building an auth URL """ from datetime import datetime from urllib import quote_plus from M2Crypto import RSA, EVP from base64 import urlsafe_b64encode from dateutil.tz import tzlocal from .exceptions import * def gen_signed_url(auth_req_issuer, webid, ts): sep = "&" if "?" in auth_req_issuer el...
true
c36e6657168c858ed71c396d1bf6912d324fce51
akaresh/MCB_185
/MCB185-master/Lesson03/at_seq.py
UTF-8
793
3.640625
4
[]
no_license
#!/usr/bin/env python3 import random #random.seed(1) # comment-out this line to change sequence each time # Write a program that stores random DNA sequence in a string # The sequence should be 30 nt long # On average, the sequence should be 60% AT # Calculate the actual AT fraction while generating the sequence # Rep...
true
377dc9e99ec111bcad5dc9002bd89e2734764d92
layne0031/python-100-day
/day-002/print.py
UTF-8
47
3.03125
3
[]
no_license
x="a" y="b" print(x, end=' ') print(y, end=' ')
true
c34f364393db4faf98f47aa4fe1f6cb5e636a85f
wpy-111/python
/Spider/day05/02_mzbspider.py
UTF-8
2,489
2.875
3
[]
no_license
""" 行政区划分代码抓取 """ import re import sys import requests import redis from lxml import etree from hashlib import md5 class MzbSpider: def __init__(self): self.url ='http://www.mca.gov.cn/article/sj/xzqh/2020/' self.headers = {'User-Agent':'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;...
true
8017e6a4167c7e140ec36a7b12bd1038e31d03eb
LA-Toth/dewi_utils
/dewi_utils/xml.py
UTF-8
1,886
2.859375
3
[ "Apache-2.0" ]
permissive
# Copyright 2017-2021 Laszlo Attila Toth # Distributed under the terms of the Apache License, Version 2.0 from xml.etree import ElementTree def create_dict_from_xml_string(xml: str): root = ElementTree.fromstring(xml) return create_dict_from_xml_element(root) def create_dict_from_xml_element(elem: ElementT...
true
3ea66d1077972cdd80120e5ad71180836d6226aa
desouradeep/Expense-Manager
/source/sort_file.py
UTF-8
187
2.984375
3
[]
no_license
import sys def main(s): #print s,type(s) f=open(s,'r') lines=[] lines=f.readlines() lines.sort() f.close() #print s,type(s) f=open(s,'w') for i in lines: f.write(i)
true
425ef08a75f0a175f1c088b17193fdfbc5af833a
parapente/AoC2017
/5a.py
UTF-8
378
3.15625
3
[]
no_license
#!/usr/bin/python3 valid = 0 with open('5.dat') as f: data = f.read() jumps = data.split("\n") jumps.pop() for i, item in enumerate(jumps): jumps[i] = int(item) # print(jumps) lenj = len(jumps) pos = 0 steps = 0 while pos < lenj: jumps[pos] += 1 pos = pos + j...
true
c7e5c88ff63d3c61f4e2d559c07a067525cba3b6
aa18514/machine_learning
/netflix_regression/linear_regression.py
UTF-8
10,933
2.640625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import scipy import math import argparse import textwrap import datetime import itertools from sklearn import linear_model from itertools import chain from sklearn.cross_validation import KFold from datetime import timedelta from file_reader import * from joblib import...
true
d993cbf4708c72b1ffa8286dd9b33019be28e279
wulinghua/wulinghua.github.io
/与孩子一起学编程/hotdog1.py
UTF-8
407
3.1875
3
[]
no_license
print "\tDog \tBun \tKetchup\tMustard\tOnions" count=1 for dog in [0,1]: for bun in [0,1]: for ketchup in [0,1]: for mustard in [0,1]: for onion in [0,1]: print "#",count,"\t", print dog,"\t",bun,"\t",ketchup,"\t", ...
true
754c549077a820df4d9f88ab4d14818e2e5d4471
jtbuter/studentenwoningweb_scraper
/checker.py
UTF-8
537
2.625
3
[]
no_license
import parser import json def get_new_in_radius(radius): houses = parser.results_in_radius(radius) with open("cache/checked.json", "r") as json_file: checked = json.load(json_file) new = [] for house in houses: if house["PublicatieId"] in checked: continue ...
true
db3fb2015aa035667613896909ff1cf86b549054
cywputao/Thesis_Social_Interactions
/Experiments/Analyse_Results/ClassLoss/Classified_Loss.py
UTF-8
22,388
2.578125
3
[]
no_license
import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import cv2 import os from os import strerror import sys sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))) import errno import pandas as pd import numpy as np import socket import visdom import...
true
249811108a7a4a8d74536be524615137c3634421
AdamColton/Ann
/Genome.py
UTF-8
14,365
2.984375
3
[]
no_license
import random import Ann from config import Genome as config """ I would like a mechanism where a gene expression passes data into a gene at the time that it is expressed. Think of fingers and toes. Toes are different than fingers and they all have different lengths, but they could all be expressed with the same gene....
true
f788af8eb243a680277a47ab80bea878d2f097d5
jsayles/TwitterBox
/twitterbox.py
UTF-8
7,606
2.71875
3
[]
no_license
#!/usr/bin/python from settings import * import RPi.GPIO as GPIO import logging import Queue import threading import tweepy import time import os PRIORITY_LOW = 10 PRIORITY_HIGH = 1 ######################################################################## class CustomStreamListener(tweepy.StreamListener): #---------...
true
e916db5552749591e4b54d9a79beb36e10305432
3zk1m0/aoc-2019-py
/day_13.py
UTF-8
5,118
3.21875
3
[]
no_license
from itertools import permutations from collections import defaultdict with open("day_13.txt") as f: inputs = list(map(int, f.readline().strip().split(","))) STEPS = {1: 4, 2: 4, 3: 2, 4: 2, 5: 3, 6: 3, 7: 4, 8: 4, 9: 2} class EndOfCode(Exception): pass class IntCode_Computer: def __init__(self): ...
true
6f46dcada7f0043333f4a04a4bbf200589858de7
ericvui/movie-mining
/src/playground/report-insights.py
UTF-8
2,497
3.359375
3
[ "MIT" ]
permissive
import matplotlib.pyplot as plt import pandas as pd df = pd.read_csv('../../data/raw/movies_metadata.csv') df df.describe() #Count zero values of budget and revenue zeros = df.query('revenue == 0 & budget == 0') zeros not_zero = df.query('revenue > 0 & budget > 0') not_zero.sort_values(by='revenue') relevant = df.q...
true
a4e0eb2e35660f2d3b98e24eb99fa95f31211e4b
SiChiTong/D-Hand
/script.py
UTF-8
638
2.890625
3
[]
no_license
# Author : Thibault Barbie from driver import * import time b=Servo("ttyUSB0",False) b.alarm_reset() b.modbus_on() b.servo_on() # Should have a sleep if not it does not work time.sleep(1.5) i=0 while i<4: if(i%2==0): b.move_absolute_position(0.1,20,0.1,0.2) else: b.move_absolute_position(13...
true
4c01435b59b0b9cc9bcd5a430814d9c8281564ac
nicxdknight/AWP-Python-
/BT18CSE148/q9/q9.py
UTF-8
375
4.125
4
[]
no_license
#question 9 word_list = [] word1= input('Enter string One: ') word2 = input('Enter string second :') if len(word1) == len(word2): i = 0 while i<len(word1): # word_list.append(word1[i]) word_list.append(word2[i]) i+=1 print(*word_list, sep = "") else: print('...
true
b326e6f15f677785a2be7867783d13d45d5c2d46
aljaserm/Threads
/Flights.py
UTF-8
602
3.28125
3
[]
no_license
from threading import * class Flight: def __init__(self, ReaminingTickets): self.ReaminingTickets=ReaminingTickets def ticketBuy(self, OrderedTickets): if self.ReaminingTickets >= OrderedTickets: print("Purchase Confirmed") print("Print your tickets\n") self...
true
5d424a9cf5f60381ce6e764f5883e2d87abe9754
jinurajk/PythonProject
/TwitterPgm3.py
UTF-8
2,243
3.0625
3
[]
no_license
import json import TwitterLogin from collections import Counter #This method is used for Twitter login, defined in TwitterPgm3.py twitter_api = TwitterLogin.login_twitter() # XXX: Set this variable to a trending topic, # or anything else for that matter. The example query below # was a trending topic when this conten...
true
887ff11e00a3fa2b1543625bdb0c9d50a9703fae
Vladmir-dev/alien_invasion
/alien_invasion.py
UTF-8
8,449
3.171875
3
[]
no_license
import sys import pygame from settings import Settings from ship import Ship from bullet import Bullet from alien import Alien from time import sleep from game_stats import GameStats from button import Button from scoreboard import ScoreBoard class AlienInvasion: """Overall class to run the other classes""" ...
true
bc88ef12685a050e83eaa913d2999e49eb0171d1
germarr/youtube_trending
/backend/scripts/countries.py
UTF-8
1,111
2.984375
3
[]
no_license
from helper import build_df import pandas as pd # ['AR', 'AU', 'BO', 'BR', 'CA', 'CL', 'CO', 'CR', 'DE', 'EC', # 'ES', 'FR', 'GB', 'IN', 'IT', 'JP', 'KR', 'MX', 'PE', 'PT', 'US', 'UY'] def create_df(list_of_countries): countries = list_of_countries empty_list = [] for i in range(len(countries)): ...
true
1c63cf54e391abd9dd853807cd751491876228f5
Prathik95/A-variation-of-N-Queens
/main.py
UTF-8
1,950
3.34375
3
[]
no_license
from node import Node from bfs import bfs_search from dfs import dfs_search def write_output(node, arrangement): f = open("output.txt", "w") if node == None: f.write("FAIL\n") f.close() return else: f.write("OK\n") for x,y in node.queens: arrangement[x][y] = 1 for line in arrangement: s = "" f...
true
acb8c42cdb9ee58a1bf1950ab1bfa18b46ff4518
Dycast/crypto-signal
/app/behaviours/ui/backtesting/backtest.py
UTF-8
1,394
3.0625
3
[ "MIT" ]
permissive
from behaviours.ui.backtesting.chart import Chart from behaviours.ui.backtesting.strategy import BacktestingStrategy """ A Backtesting engine """ class Backtester(object): def __init__(self, coin_pair, period_length, exchange_name, exchange_interface, capital, stop_loss, start_time, buy_strategy, ...
true
2009a2899767c6ec41736a34c5196505bce98a99
ssswzh/cromwell_wdl
/src/Step3a.Format_Convert.py
UTF-8
1,057
3.140625
3
[]
no_license
#!/usr/bin/env python3 # coding: utf-8 import argparse def GetArgs(): parser = argparse.ArgumentParser(description='Script for change bed file to chr:start-end format.') parser.add_argument('--bed', dest='bed', help='bed file', required=True) parser.add_argument('--type', dest='typ', help='region or csv',...
true
a2fda1af8607a0d16dcd1165c9f126a2876b92d4
Aasthaengg/IBMdataset
/Python_codes/p02419/s010373163.py
UTF-8
156
3.046875
3
[]
no_license
W = input().lower() T = '' while True: txt = input() if txt == 'END_OF_TEXT': break T += txt.lower() + ' ' print(tuple(T.split(' ')).count(W))
true
3582914d696cafbc470315653e22ed893e3a8ed1
jcisio/adventofcode2019
/day05/d05-intCode.py
UTF-8
2,858
2.96875
3
[]
no_license
values = [] relative_base = 0 # Param position with mode 0, 1, 2 def getParam(mode, position): global relative_base if (mode == 0): target_position = values[position] elif (mode == 1): target_position = position else: target_position = values[position] + relative_base if target_position not in v...
true
f329610aa882ccc9b11e8639131ab5da129816f9
belamenso/AOC_2018
/14/14_2.py
UTF-8
328
3.28125
3
[]
no_license
def go(goal): scores = '37' e1, e2 = 0, 1 while goal not in scores[-10:]: scores += str(int(scores[e1]) + int(scores[e2])) e1 = (e1 + 1 + int(scores[e1])) % len(scores) e2 = (e2 + 1 + int(scores[e2])) % len(scores) print(scores.index(goal)) if __name__ == '__main__': go('1...
true
558f515fcf9c95b8392808e1ae88b33ba15424c6
Aasthaengg/IBMdataset
/Python_codes/p02841/s225323855.py
UTF-8
119
2.71875
3
[]
no_license
x = list(map(int, input().split())) x = list(map(int, input().split())) if x[1] == 1: print(1) else: print(0)
true
6e43967327e503bfc2067f15e450835465c2de0c
goodndntwin/python
/rock_paper_scissors.py
UTF-8
1,027
3.34375
3
[]
no_license
from random import random is_game_ended=False comp_choice="" possible_choices=['rock', 'paper', 'scissors'] while (is_game_ended==False) : prompt="Pick one: rock, paper, scissors>" user_choice=input(prompt) if user_choice not in possible_choices : print("Invalid choice.") continue rand_num = random(...
true
434616e265fced642f74b0bfc4a859d246428a52
owusu-king/pdsnd_github
/bikeshare_code.py
UTF-8
13,060
4.03125
4
[]
no_license
""" A program to explore the US bikeshare data Name: Owusu King State: Ghana """ # importing the necessary modules import time import pandas as pd import os # Declaring the files needed as input for our program CITY_DATA = {'Chicago': 'chicago.csv', 'New York City': 'new_york_city.csv', 'W...
true
8ec78425ad669995de492d34e3f20dcc2405733a
CCQC/extrap
/extrap.py
UTF-8
3,140
2.765625
3
[ "MIT" ]
permissive
import numpy as np from scipy.optimize import curve_fit #if #variables = #datapts this produces an analytic fit yolo from scipy.special import zeta #fnclist = [exp,xm3,schwartz4,schwartz6,exp2,expGaus,RZ2,RZ3] def exp(x,a,b,c): #exp 3 point fit (analytic), most often used for uncorrelated energy return a ...
true
1d1b6d563df81a179448690898df8677426a0537
private-octopus/ithitools
/stats/compute_m9x.py
UTF-8
8,760
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/python # coding=utf-8 # # This script takes as input a summary of IP address file produced # by "cout_ip.py", and produces a summary of the results. # # There are four metrics defined in the M9.3 set: # # M9.1 - IMRS Query Load (Number of queries per month at all IMRS servers) # M9.2 - IMRS traffic by Resol...
true
bd22fc35f2e56e01b51b753109fac896c2022ccb
mjsmyth/abiquo-wiki-scripts
/release/abqreltools.py
UTF-8
4,055
2.84375
3
[]
no_license
# #!/usr/bin/python3 # Python script: release/abqreltools.py # --------------------------------------- # Module with common tools to use in scripts # - create master pages for new version # - publish draft pages (do release) # # Tools # ------------------ # 1. Get the draft pages with vXXX in name # 2. Strip version fr...
true
a42310bc051265fabccdf9426430e6179d431cf0
lvmt/mongoDB
/demo_use/count.py
UTF-8
405
2.640625
3
[]
no_license
#!/usr/bin/env python #-*- coding:utf-8 -*- from pymongo import MongoClient """ 登陆 """ client = MongoClient('localhost', 27017) db = client.test db.authenticate('lmt1', 'lmt1') collection = db.col9 """ count 全部item """ count = collection.find().count() print(count) # 6 """ count 符合某个条件的 """ count2 = colle...
true
2084bbc400cf22cfb1613a6e467921cbab724c4b
JayatiD93/EE5609_Assignment_1
/codes/test_3dplot.py
UTF-8
365
2.859375
3
[]
no_license
from mpl_toolkits.mplot3d import axes3d import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') fig = plt.figure() ax1 = fig.add_subplot(111, projection='3d') x = [1,2,3] y = [5,6,7] z = [1,2,6] ax1.plot_wireframe(x,y,z) ax1.set_xlabel('x axis') ax1.set_ylabel('y axis') ax1.set_zl...
true
6263b6b5041a4394dac67f17b02a04f63a5b7ba4
lsjsss/PythonClass
/PythonBookAdditional/第10章 网络程序设计/code/pachong.py
UTF-8
2,608
3.046875
3
[ "MIT" ]
permissive
import sys import multiprocessing import re import os try: #Python 3 import urllib.request as lib python3 = True except Exception: #Python 2 import urllib as lib python3 = False def craw_links(url, depth, keywords, processed): '''url:the url to craw depth:the current depth to craw ...
true
58dd914c6773c2c71a32efc4c726724f323d7ee5
thekdorm/packet_drop_analyze
/packet_drop/stats_db.py
UTF-8
806
2.921875
3
[]
no_license
import sqlite3 def create_db(db): action = ("CREATE TABLE IF NOT EXISTS stats (" "id INTEGER PRIMARY KEY, " "datetime CHAR(19) NOT NULL, " "per FLOAT NOT NULL, " "min FLOAT NOT NULL, " "avg FLOAT NOT NULL, " "max FLOAT...
true
38bf5665abe5483cc7e8674a9845e0b3cf617379
Chewie23/fury-train
/PyProjects/sqlite_test.py
UTF-8
558
3.25
3
[]
no_license
""" Testing out sqlite3 """ import sqlite3 sql_db = 'test.sqlite' #defining name of tables and column table_1 = 'my_table_1' table_2 = 'my_table_2' new_field = 'my_1st_column' field_type = 'INTEGER' #connecting to db conn = sqlite3.connect(sql_db) c = conn.cursor() #creating a table with 1 column...
true
20628994d1549c507c061b48374ef5e8b27720e4
gomesgr/python-exec
/container_water.py
UTF-8
526
4.1875
4
[]
no_license
# Dada uma lista de alturas # Encontre um container com a maior area que possa ser # preenchida por agua def container_with_most_water(heights): max_area = 0 left, right = 0, len(heights) - 1 while left < right: area = min(heights[left], heights[right]) * (right - left) max_area = max(max_a...
true
55b7308a251c4ba4fb639568327932ace599155d
navazl/cursoemvideopy
/ex109/moeda.py
UTF-8
485
3.328125
3
[]
no_license
def aumentar(n, p, format=False): ans = n + (n * (p / 100)) return ans if format is False else moeda(ans) def diminuir(n, p, format=False): ans = n - (n * (p / 100)) return ans if format is False else moeda(ans) def dobro(n, format=False): ans = n * 2 return ans if format is False else m...
true
2f0cdd01b00ad6990d94983dbda3fda1fb51d210
OGBigCarl/aoc2020
/day4/day4.py
UTF-8
3,832
3.453125
3
[]
no_license
import re #Parsing input data def createDictionaryFromList(data): dic = {} for ll in data: splitArr = ll.split(" ") for ss in splitArr: splitKV = ss.split(":") dic[splitKV[0]] = splitKV[1] return dic def createPassportList(data): finalData = [] ...
true
05a5cdc61b6958808cf740eb452839009a77a6f0
kaylaandersen/twitter-graph
/datacollect/graph_links.py
UTF-8
1,893
2.515625
3
[]
no_license
from datacollect import oauth, tgdb import time def tgdb_walk(host_port, user, password, json_file, rel, source_sn=None): """Valid input for rel is 'FOLLOWING' or 'FOLLOWERS'""" graph = tgdb.TwitterGraph(host_port, user, password) # connect to twitter API tapi = oauth.TwitterAPI(json_file) if sourc...
true
786c4687a4ed6ee62ed6af22d77787f858e97e37
jim1949/QboStuff
/qbo_random_move/src/qbo_random_move_avoid_obstacles.py
UTF-8
2,709
2.640625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import rospy from sensor_msgs.msg import PointCloud from geometry_msgs.msg import Twist class randomMoveObstacleDetector: def __init__(self): #initialize node rospy.init_node('qbo_random_move_avoid_obstacles') self.wallDetectionDistance = 0.4 self.leftDis...
true
c69bd3594ee216ac13fe2ad69dcf1d3a10a6d445
belfhi/pencil-code
/python/pencil/files/zaverages.py
UTF-8
1,935
2.796875
3
[]
no_license
#!/usr/bin/env python class zaverage: """A dummy class for explicitly adding attributes. Something like collections.namedtuple may be a better solution. """ pass class ZAverage(): def __init__(self,filename='zaverages.dat',datadir='data',infile='zaver.in', record_length=4,read_deltay=...
true
29dc77a3c965c6906380ed66e47c03cc9370fd8d
Shuvo001/tovoc_tococo
/make_voc.py
UTF-8
2,112
2.921875
3
[]
no_license
''' 本文件是得到images和xml之后制作VOC2007数据集 分两步走:01、创建voc2007的文件夹,然后把所有xml文件放进VOC2007/Annotations中,所有image放进VOC2007/ImageSets 02、按照比例划分训练集、测试集,并生成相应的txt文件 ''' import os import random ##############第一步##################### # make voc_dir def make_voc_dir(): os.makedirs('VOC2007/Annotations') os.makedirs('VOC20...
true
3ca0259d0f7ecaf300c33882d6ac0b5ad9009e59
ZhangHang95/Torchrec
/torchrec/ann/sampler.py
UTF-8
13,060
2.625
3
[]
no_license
import torch import numpy as np from torchrec.model import scorer import torch.nn.functional as F def kmeans(X, K_or_center, max_iter=300, verbose=False): N = X.size(0) if isinstance(K_or_center, int) is None: K = K_or_center C = X[torch.randperm(N)[:K]] else: K = K_or_center.size(0)...
true
fabd18c6fe21dd5e07ba07464f516ab7d3f58c00
cjmugs/udemy_class_python
/ZTM Class Data/python_basics_2/methods_vs_functions.py
UTF-8
231
4.375
4
[]
no_license
# Methods vs Functions # Example of a function --> list() # Example of a method --> .capitalize() # A basic function with a method in it (also has a default args) def name(name='melanie'): print(name.capitalize()) name('max')
true
be67a7ee600154e3c3e8f57f09e5911f14b29441
Bugvoid/LearningPython
/college_time/Exerc_Answer_4/Velocidade.py
UTF-8
483
3.84375
4
[]
no_license
def getVelo(d,t): res = d/t return(res) d = float(input("Digite a distancia de d ")) t = float(input("Digite o tempo de t ")) d2 = float(input("Digite a distancia de d2 ")) t2 = float(input("Digite o tempo de t2 ")) d3 = float(input("Digite a distancia de d3 ")) t3 = float(input("Digite o tempo de t3 ")) prin...
true
ba8ddd2178590849e9d83e1c0846d90a115fab71
houxiaoqin/Python
/python/tf-idf/src/tf-idf/tf.py
UTF-8
1,411
2.71875
3
[]
no_license
#!usr/bin/env python # coding=utf-8 """idf-ok.py -- this is a idf algorithm demo @version: 1.0 @author:Bin Xu and hope @see: """ from __future__ import division import os import sys import math text_length=0 word_count = {} word_idf = {} #idf权重记录 info="E:/workspace/TF-IDF/text_data" f = open(info+"/predict/t.txt") ...
true
aa921215ae2f6fb8fb7ed382d57bddc05482f66d
htoutlook/Mytest2
/ex44e.py
UTF-8
949
3.609375
4
[]
no_license
#1. Actions on the child imply an action on the Other. #2. Actions on the child override the action on the Other. #3. Actions on the child alter the action on the Other. from sys import exit import os os.system('cls') class Other(object): def override(self): print "Other override()" def implicit(...
true
c4ecd7b95f4e5c1a5b411c0aa90c9b4c3516116b
7201krap/COMS30014_AI-Prolog
/AI/labs/lab4/lab4/t_test.py
UTF-8
2,554
4.0625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 1 10:17:54 2020 @author: sb15704 """ # This code is provided as additional "bonus" code for the first GA lab class for the AI unit (COMSM0014) # It implements a simple statistical test - the "t-test" - for checking whether two data sets are significantly diffe...
true
94b1c84413a3bd577a57cb3a1456023a381c384c
GreatStephen/MyLeetcodeSolutions
/H-Index/H-Index.py
UTF-8
427
2.71875
3
[]
no_license
class Solution: def hIndex(self, citations: List[int]) -> int: b = [0]*(len(citations)+1) for n in citations: b[min(n,len(citations))]+=1 s = 0 for i in range(len(citations), -1, -1): s += b[i] # 目前为止总共有s篇引用次数>=i。s中只要有i篇>=i,i就是答案 ...
true
1e802e0b344cf59addf70ee3a653c692413f833a
VamsikrishnaNallabothu/URLShortener
/URLShortener.py
UTF-8
3,336
2.734375
3
[]
no_license
from flask import Flask, request, render_template, redirect, url_for, session from flask_bootstrap import Bootstrap from flask_wtf import Form from wtforms import StringField, SubmitField from wtforms.validators import DataRequired, URL from flask_sqlalchemy import SQLAlchemy import os try: from urllib.parse import...
true
a859fe1372f1571d744aa3752c298548a2eaf25a
PhilHuang-d/python---
/Note/Spider/1.22-mongodb/mongodb_pymongo.py
UTF-8
3,615
3
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from bson import ObjectId __author__ = 'Terry' from pymongo import MongoClient # http://www.baidu.com # mongodb://[username:password@]host1[:port1][,host2[:port2] # ....[,hostN[:portN]]][/[database][?options]] # conn = MongoClient('localhost', 27017) conn = MongoClient('...
true