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
e9672fd59354efc95991b6783512354ecd4bc87b
Python
rhsieh91/sife-net
/charades_experiments/old_files/create_single_action_dataset.py
UTF-8
1,626
2.828125
3
[ "Apache-2.0" ]
permissive
# Splits Charades RGBs into single-action samples and copies into a target directory # Contributor: Samuel Kwong import cv2 import argparse import os import pandas as pd import numpy as np import math import shutil if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--csv_path'...
true
ecf91e7b6a2943c6b0004ab9133a467b3fdbc6c0
Python
yufanana/ROStutorial
/ros_navigation/src/bug_zero.py
UTF-8
9,288
3
3
[]
no_license
#!/usr/bin/env python # roslaunch turtlebot3_gazebo turtlebot3_stage_4.launch # rosservice call /gazebo/reset_world ''' This Bug0 alrogithm turns left upon encountering an obstacle. ''' import rospy import math import sys from sensor_msgs.msg import LaserScan from nav_msgs.msg import Odometry from geometry_msgs.msg ...
true
9bb20c57a8cae5f5d31e542e2cbaee1c6048001d
Python
jshreyas/python-serverless-app
/testrail.py
UTF-8
19,062
2.515625
3
[]
no_license
import json import base64 import time import math import datetime import urllib.request import urllib.error import pytz def get_timestamp(): """ Returns timestamp in desired format """ return datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S') class Testrail(object): def __init_...
true
849b341510f5c7bf398912befd6451284eae4903
Python
AungMyatSan/python
/practice/bst/bst.py
UTF-8
1,966
3.6875
4
[]
no_license
from typing import List class Node: def __init__(self, val, left=None, right=None) -> None: self.val = val self.left = left self.right = right class Tree: def __init__(self, root_val) -> None: self.root = Node(root_val) self.height = 0 def insert(self, cnode, ...
true
8e3dfe8b23e3eccbc6636c5f677be2c2dbb0f615
Python
ZAKERR/-16-python-
/软件第四次作业/软件161/夔纭嘉2016021196/计算器的实现.py
UTF-8
738
4.125
4
[]
no_license
#!/user/bin/python #-*-coding:utf-8-*- ''' 编写人:夔纭嘉 编写时间:20181005 功能:计算器的实现 ''' #定义函数 def add(x,y): return x+y def jian(x,y): return x-y def cheng(x,y): return x*y def chu(x,y): return x/y print(u"选择运算:") print(u"+ - * /") choice =input("请输入你的选择:") x = int(input(u'请输入第一个数...
true
9db6c166aa9982c7cc0d4d82fba7752358eb94f8
Python
dmrowan/LommenResearchGroup
/PulseCharacteristics/old_scripts/ampfitcrab.py
UTF-8
5,077
2.953125
3
[]
no_license
#!/usr/bin/env python from astropy.table import Table from astropy import log import datetime import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit import pandas as pd import math from functions import * desc=""" Makes a histogram of the integrated intensities of pulse profiles for e...
true
026564c0f515289c801342d2e8887c9eec7490b6
Python
andaru/netmunge
/netmunge/grammars/cisco_show_arp.py
UTF-8
2,621
2.515625
3
[]
no_license
# "show arp" parser for Cisco IOS # def convert_mac(mac): """Converts cisco xxxx.xxxx.xxxx.format to xx:xx:xx:xx:xx:xx format.""" return '%s:%s:%s:%s:%s:%s' % (mac[0:2], mac[2:4], mac[5:7], mac[7:9], ...
true
ae899a6c7c4d0cd5ca879fd51810fddf685ac428
Python
zfdupont/stockticker
/main.py
UTF-8
1,189
2.609375
3
[ "MIT" ]
permissive
from yahoo_fin import stock_info as si from time import time from datetime import datetime from decimal import Decimal import os; class colors: HEADER = '\033[95m' OKBLUE = '\033[94m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD ...
true
df56e59cf7749b29e91f8524106307b0afdfd1bd
Python
mali0728/cs107_Max_Li
/homework/HW2/HW2_final/P2.py
UTF-8
942
4.28125
4
[]
no_license
# Problem 2 DNA Complement for Homework 2 of CS107 # Author: Max Li def dna_complement(original): '''This function takes in a DNA sequence represented as a string and returns it complement as a string.''' bases = ['A', 'T', 'G', 'C'] if len(original) == 0: return None for x in original: ...
true
d9dd28aac91196449ec7cba7582a01ee7396e8e0
Python
percyliang/sempre
/tables/wikipedia-scripts/weblib/clean_html.py
UTF-8
4,314
2.75
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- import re, sys, os sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'external')) from bs4 import BeautifulSoup, element import tidylib tidylib.BASE_OPTIONS = { 'output-html': 1, 'indent': 0, 'tidy-mark': 0, 'wrap': 0, 'doctype': 'strict', ...
true
825845aeb99e34797ccd7a92264cfe22c251dfcc
Python
Fulldis/dl-course
/week-13/research/experiments/optuna/model.py
UTF-8
964
2.6875
3
[ "MIT" ]
permissive
import torch from torch import nn class SimpleNet(nn.Module): def __init__( self, num_filters1: int = 6, num_filters2: int = 16, num_hiddens1: int = 120, num_hiddens2: int = 84, num_classes: int = 10, ): super().__init__() self.num_hiddens0 = num...
true
c56c956cbd0aff6383e386db0db20aec4cdae69a
Python
arusdef/OpenCSAM
/scrapy-crawlers/scrapy_crawlers/useragents.py
UTF-8
704
2.546875
3
[]
no_license
""" User-Agent Middleware """ import logging from fake_useragent import UserAgent class RandomUserAgentMiddleware(object): """ Random User-Agent Middleware """ default_user_agent = ('''Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) ''' '''AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari...
true
e90a7353f5fe5adfcb08e65fb18e2b0c29d964c2
Python
ChoiYoonSung/Python
/HelloPython/day10/myflask04_forward.py
UTF-8
473
2.75
3
[]
no_license
from flask import Flask, request, render_template app = Flask(__name__) @app.route('/') def home(): title = 'List' mylist = ['a', 'b', 'c', 'd'] objList = {} objList.append({'e_id' : '1', 'e_name' : '이름1', 'e_birth' : '1996'}) objList.append({'e_id' : '2', 'e_name' : '이름2', 'e_birth' : '1997'}) ...
true
00373b0eb385faa3e84177cd0822cf60a147fc13
Python
sachahu1/RL_trading
/network.py
UTF-8
4,232
3.34375
3
[]
no_license
import torch # The Network class inherits the torch.nn.Module class, which represents a neural network. class Network(torch.nn.Module): # The class initialisation function. This takes as arguments the dimension of the network's input (i.e. the dimension of the state), and the dimension of the network's output (i.e...
true
e1ceb3f5ca54d3624ee3f8d44590da8dd7cb0c1b
Python
C3RV1/Prive
/server/generateKeys.py
UTF-8
1,855
2.59375
3
[ "MIT" ]
permissive
import Crypto.PublicKey.RSA as RSA import os import sys import json from config import Config class GenerateKeys: def __init__(self): self.database_directory = Config.DATABASE_PATH self.key_size = Config.CLIENT_KEYSIZE def generate(self): #type: () -> None if not os.path.isdir...
true
068a077d2f580dadbc0234c96ddfe96e1d268da0
Python
NithinNitz12/ProgrammingLab-Python
/CO1/9_exchange.py
UTF-8
62
3.3125
3
[]
no_license
str = input("Enter a string:") print(str[-1]+str[1:-1]+str[0])
true
7b26a8c7065744adde26e32dc5d3278efb80f192
Python
serashioda/code-katas
/src/calculate_years.py
UTF-8
379
3.328125
3
[ "MIT" ]
permissive
"""Implementation of the Kata Money, Money, Money.""" def calculate_years(principal, interest, tax, desired): """Calculate how many years it take to reach desired principle.""" years = 0 while (principal < desired): accrued = principal * interest accrued = accrued - (accrued * tax) ...
true
fdf5608b017eb64ec5d627056d180a5750db1dc6
Python
enriqueee99/learning_python
/ejercicio_12.3.py
UTF-8
200
4.125
4
[]
no_license
lista = [] for x in range(5): num = input('Ingrese un numero: ') lista.append(num) print(f'El mayor de la lista es: ',max(lista)) print(f'El numero {num} se repite {lista.count(num)} veces')
true
a587eb70c3cf901751e707220a9e1b3380de1365
Python
ShaneRich5/fti-programming-training
/solutions/labs/lab5.2/lab.py
UTF-8
1,273
2.734375
3
[]
no_license
import getpass from sqlalchemy import create_engine from sqlalchemy.orm import relationship, backref, sessionmaker import models # Ask user for connection details server = 'tmp-training.c21v9ghziray.us-west-1.rds.amazonaws.com' database = 'training' username = 'ftimaster' password = getpass.getpass() # Format connect...
true
fc5138ae3007b67918acc3c028ac700d4581785e
Python
pfigz/python-files-projects
/Celsius.py
UTF-8
206
4.03125
4
[]
no_license
celsius = float(input("Degrees Celsius")) def fahrenheit(c): return round((1.8 * c + 32), 1) print("The Fahrenheit equivalent of " + str(celsius) + " degrees Celsius is " + str(fahrenheit(celsius)))
true
5a6474ef331ba43d60be0ee52f1978ec2db883c0
Python
Rkluk/uri
/1248 Plano de Dieta.py
UTF-8
1,222
3.15625
3
[]
no_license
u = int(input()) for c in range(u): dieta= input() cafe= input() almoco = input() ldieta = [] cheater = False for v in dieta: if ord(v) not in ldieta: ldieta.append(ord(v)) lcafe = [] for v in cafe: lcafe.append(ord(v)) lalmoco = [] for v...
true
aa77c7009863cc23d04e9ace18c152a33bbccb8c
Python
jsheflin/UnitConverter
/test.py
UTF-8
3,641
2.71875
3
[]
no_license
import unittest import start class TestFactorial(unittest.TestCase): def test_all_temp(self): temp = start.MULTIPLIERS_TO_STD['temp'].keys() source_val = 111.1 answer = 232 for tunit in temp: for to_temp in temp: if (to_temp != tunit): ...
true
de86818ea87db1ae8c64e5855bbce363446a442f
Python
ImNimeshKumar/InitalizePython
/forloop.py
UTF-8
62
3.078125
3
[]
no_license
j=0 for i in range(0,10): i = i+1 j = j+i print(j)
true
bc69d7d99ad4c2fbaf6b3988a8e92bc7f380f452
Python
dAIsySHEng1/CCC-Junior-Python-Solutions
/2011/J3.py
UTF-8
213
3.265625
3
[]
no_license
def sumac(): t1 = int(input()) t2 = int(input()) sumac_num = [t1,t2] while t1>=t2: a = t1 t1=t2 t2 = a-t1 sumac_num.append(t2) print(len(sumac_num)) sumac()
true
e00cc57588e2e8066902af6b5f4c66f81572ef1f
Python
Deniska10K/stepik
/2.4-integer_arithmetic_part_1/7.arithmetic_operations.py
UTF-8
729
4.125
4
[]
no_license
""" Напишите программу, в которой вычисляется сумма, разность и произведение двух целых чисел, введенных с клавиатуры. Формат входных данных На вход программе подаётся два целых числа, каждое на отдельной строке. Формат выходных данных Программа должна вывести сумму, разность и произведение введённых чисел, каждое на...
true
e0e2c0330e7327fe1c692453c88e4e77c3bfbfb6
Python
lemontreeran/adx-automation-monitor
/app/app/models/user.py
UTF-8
206
2.75
3
[ "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
from flask_login import UserMixin class User(UserMixin): def __init__(self, user_id: str, user_name: str): self.id = user_id # pylint: disable=invalid-name self.user_name = user_name
true
952b341742faf36affb6b3def84206118a8c3d0a
Python
willie19971103/test_in_cjcu-master
/4-3.py
UTF-8
102
2.6875
3
[]
no_license
# 10 numbers are given in the input. Read them and print their sum. Use as few variables as you can.
true
612c4a707bf44656dbf7c908475560c5bd50e489
Python
Manideepnizam26/CLOTH-EXTRACTION
/CITY SCAPES/save_data_as_npy.py
UTF-8
1,276
2.828125
3
[]
no_license
import numpy as np import cv2 import glob import matplotlib.pyplot as plt import time train_images = [] train_output = [] test_images = [] test_output = [] t1 = time.time() files = glob.glob('./DATA/train/*') print(len(files)) for image_file in files: image = cv2.imread(image_file) image1, image2 = np.spli...
true
b83f1d8b0c171a18c82eec8325b7db9351ecb882
Python
ajinkyapatankar/Soccer-Team-Management-System
/Diva/Code/DIVAAAAA/diva_backend/diva_backend/djangorest/api/example.py
UTF-8
12,012
2.546875
3
[]
no_license
import pandas as pd import itertools import numpy data = pd.read_csv('api/data.csv') def removeadd(st): return float(st[0:-2]) def preprocessing_data(data, club): list = ['LS', 'ST', 'RS', 'LW', 'LF', 'CF', 'RF', 'RW', 'LAM', 'CAM', 'RAM', 'LM', 'LCM', 'CM', 'RCM', 'RM', 'LWB', 'LDM', ...
true
a68f778c94f180a2dcb45805a775ffa44ad174ea
Python
lauramatchett/hackbright-intro-more-lists-and-loops
/01-list-primes/list_primes.py
UTF-8
121
2.796875
3
[]
no_license
primes = [1,3] primes = primes + [5] primes.append (7) primes.append (11) primes.extend ([13, 17]) print primes
true
cdb0aaac23045a257c540f947a71dc11782277fd
Python
rob-luke/mne-nirs
/examples/general/plot_13_fir_glm.py
UTF-8
12,883
2.765625
3
[]
permissive
""" .. _tut-fnirs-fir: GLM FIR Analysis ================ In this example we analyse data from a real multi-channel functional near-infrared spectroscopy (fNIRS) experiment (see :ref:`tut-fnirs-hrf-sim` for a simplified simulated analysis). The experiment consists of three conditions: 1) tapping with the left hand, 2)...
true
4043513921a71bd2f619ae6a66e9e010ec894662
Python
slott56/navtools
/navtools/olc.py
UTF-8
8,898
3.921875
4
[ "BSD-3-Clause" ]
permissive
"""OLC Representation of latitude/longitude pairs. (Sometimes called a "Plus Code") This is one of many Geocoding schemes that permits simplistic proximity checks. There are two parts to the encoding: most significant 10, least signficant 5. - Most significant is base 20 for 5 digits. Lat and Lon codes are int...
true
59c2e577d0748bf6c3d4110ce6a243797fedbd17
Python
fpt/sendmsgw
/sendmsgw.py
UTF-8
1,930
2.78125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # pywin32 # http://sourceforge.net/projects/pywin32/ # ref # http://mail.python.org/pipermail/python-win32/2005-March/003077.html import win32api import win32gui import win32con import getopt import sys import re def FindWindowRegExp(pat): p = re.co...
true
6884d5389a3362482daebd359dd1ec7714ceeec5
Python
bhaveshpandey29/phpstore
/product.py
UTF-8
2,294
3
3
[]
no_license
from databaseConnector import getDBConnection as connection def registerProduct(product_name,product_price,product_quantity): try: flag=0 db,cursor= connection() insert_sql = f"insert into product(product_name,product_price,product_quantity) values ('{product_name}','{product_price}','{produ...
true
83c76f6091ae0cf0eca04ac870456997217ae729
Python
iverberk/advent-of-code-2018
/day-06/part1.py
UTF-8
1,209
3.359375
3
[]
no_license
from collections import defaultdict def X(point): x, y = point return x def Y(point): x, y = point return y def manhattan_distance(p1, p2): return abs(X(p2) - X(p1)) + abs(Y(p2) - Y(p1)) coordinates = {} max_x, max_y = 0, 0 with open('input') as f: for index, coordinate in enumerate(f): ...
true
e0e0b1f2f48da420f57fbdd77a28dd381543ba00
Python
L3NNY0969/datbananabotheroku
/cogs/idiotic.py
UTF-8
5,051
2.5625
3
[]
no_license
import discord import os import io import idioticapi import random import json from discord.ext import commands class Idiotic: def __init__(self, bot): self.bot = bot self.client = idioticapi.Client(os.environ.get('idioticapi'), dev=True) def format_avatar(self, avatar_url): ...
true
e7e609d3f62b6377cc159f1e8fdeccae08a3271c
Python
lcbasu/Pyhthon-Search-Engine
/greatest.py
UTF-8
147
3.484375
3
[]
no_license
def greatest(list): max = 0 if len(list) > 0 : for e in list : if e > max : max = e return max print greatest([1,2,3,4,5,1,5])
true
479dfc761da13ddca612baa1f50ca30c9318494c
Python
kwohlfahrt/nuc_analyze
/nuc_analyze/util.py
UTF-8
562
2.921875
3
[]
no_license
from collections import defaultdict def flatten_dict(d): r = {} for key, value in d.items(): try: r.update({(key,) + k: v for k, v in flatten_dict(value).items()}) except AttributeError: r[(key,)] = value return r def tree(): def tree_(): return defaultd...
true
d814daf3f093f9e86466d2200a1f37cfdbda2220
Python
steveshogren/GraphFun
/Graph.py
UTF-8
2,167
2.875
3
[]
no_license
__author__ = 'jack' from os.path import exists from subprocess import call G = { 'A': {'B': 10, 'D': 4, 'F': 10}, 'B': {'E': 5, 'J': 10, 'I': 17}, 'C': {'A': 4, 'D': 10, 'E': 16}, 'D': {'F': 12, 'G': 21}, 'E': {'G': 4}, 'F': {'H': 3}, 'G': {'J': 3}, 'H': {'G': 3, 'J': 5}, 'I': {}, ...
true
2d61eb68dede36b38faafbf9e7085ef292d75fcf
Python
oxhead/CodingYourWay
/src/lt_167.py
UTF-8
2,248
4.03125
4
[]
no_license
""" https://leetcode.com/problems/two-sum-ii-input-array-is-sorted Related: - lt_1_two-sum - lt_653_two-sum-iv-input-is-a-bst """ """ Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices...
true
c9e1a0bb1fb9d060b651c1c883bfbc5acdf125bd
Python
muvox/PythonPractice
/functionpractice.py
UTF-8
1,836
4.1875
4
[]
no_license
import random wins = 0 ties = 0 rounds = 0 def computerChooses(playerString): player = int(playerString) computerSelection = random.randint(1, 3) if computerSelection == 2: print("Computer chose: Nuke") elif computerSelection == 1: print("Computer chose: Foot") else: print...
true
6a00be042a1851b24b1b99b717f4d5659b5e1103
Python
Socrats/Axelrod
/axelrod/tests/unit/test_classification.py
UTF-8
7,977
2.984375
3
[ "MIT" ]
permissive
"""Tests for the classification.""" import unittest import axelrod as axl class TestClassification(unittest.TestCase): def test_known_classifiers(self): # A set of dimensions that are known to have been fully applied known_keys = [ "stochastic", "memory_depth", ...
true
06ec6000235923a6f526ce9bc5305d080ef9e882
Python
IgorxutStepikOrg/AlgorithmsTheoryAndPracticeMethods
/Module2_2/Step6/python/solution1.py
UTF-8
209
3.46875
3
[]
no_license
def fib(num): prev, cur = 0, 1 for i in range(1, num): prev, cur = cur, prev + cur return cur def main(): n = int(input()) print(fib(n)) if __name__ == "__main__": main()
true
4e698d55499c70ae0bc5fe3270162686e25b5a80
Python
arlethitgo/pic2map
/tests/test_cli.py
UTF-8
6,128
2.703125
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """Command Line Interface test cases.""" import argparse import logging import os import tempfile import unittest from StringIO import StringIO from mock import ( MagicMock as Mock, patch, ) from pic2map.cli import ( add, count, main, parse_arguments, remove, ...
true
5834bce9b1f5a4868bcd8f11fc644eea9d65e7b8
Python
RodolfoGueiros/PYTHON
/Exercicios/Exerc_lista_3.py
UTF-8
886
4.0625
4
[]
no_license
listaCD = [] def exibirMenu(): print("1 - Inserir novo CD") print("2 - Excluir CD") print("3 - Listar CDs") print("4 - Sair") opcao = int(input("Escolha uma opcao: ")) return opcao def inserirCD(): novoCD = input("Digite o nome do Artista: ") listaCD.append(novoCD) def lis...
true
4975b1dd0a41288f00512424a317b4e6d0f2af19
Python
wfjin/LING570
/HW5/ngram_count.py
UTF-8
1,856
3.53125
4
[]
no_license
""" This python program reads a training file and outputs the ngram count for unigrams, bigrams and trigrams of the training data """ import sys def addebos(line_ebos): """ This function adds BOS and EOS to each sentence """ new_line = ['<s>'] new_line.extend(line_ebos) new_line.append('</s>') ret...
true
551a6f003f0061c7b26f74efa36fad6acc5cf67e
Python
obround/ppci
/ppci/codegen/registerallocator.py
UTF-8
29,548
3.96875
4
[ "BSD-2-Clause" ]
permissive
""" Instructions generated during instruction selection phase use virtual registers and some physical registers (e.g. when an instruction expects arguments in particular register(s)). Register allocation is the process of assigning physical location (register or memory) to the remaining virtual registers. Some key con...
true
5e753ca4f30b2840195ed03afc0d1f7203f98d42
Python
a-pallotto/project-euler
/ex014.py
UTF-8
1,010
4.09375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jun 5 23:22:00 2018 The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1...
true
ec897f4a35b0f9e4a7f18f3092c53221076bbd5c
Python
jianengli/leetcode_practice
/array/43.py
UTF-8
1,001
3.515625
4
[]
no_license
class Solution: def multiply(self, num1: str, num2: str) -> str: if num1 == '0' or num2 == '0' : return "0" l1 = list(map(int,list(num1))) # 用列表储存num1的每一数位 l2 = list(map(int,list(num2))) # 用列表储存num2的每一数位 carry2 = 1 # 帮助 num2 中乘数的进位 res = 0 # 累加 乘数的...
true
fcbbdbdf255b81b93864a140692171b96553d077
Python
welchbj/almanac
/almanac/core/command_engine.py
UTF-8
11,513
2.625
3
[ "MIT", "BSD-3-Clause" ]
permissive
from __future__ import annotations import inspect import pyparsing as pp from typing import ( Any, Callable, Dict, List, MutableMapping, Tuple, Type, TYPE_CHECKING, TypeVar, Union ) from ..commands import FrozenCommand from ..errors import ( CommandNameCollisionError, ...
true
3e89995dd17a33516f8e2d317305b5445d44ee28
Python
mattiagiuri/rubikpy
/CubeSolverTest.py
UTF-8
3,575
3.1875
3
[ "Apache-2.0" ]
permissive
from CubeSolver import CubeSolver import numpy as np # disposition = np.array([[['U', 'G', 'Y'], # ['U', 'W', 'O'], # ['R', 'Y', 'W']], # [['G', 'G', 'U'], # ['Y', 'R', 'G'], # ['O', 'Y', 'U']], ...
true
60b582707e3a0cd64370ec89e38de2f21f559372
Python
WKPlus/phone-address
/crawl_phone_prefix.py
UTF-8
1,494
2.828125
3
[]
no_license
#!/usr/bin/env python # -*- coding:utf8 -*- import requests import re from bs4 import BeautifulSoup import os import time URL = "http://www.nowdl.cn/city/guangdong/{}.php" HEADERS = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) ' 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Sa...
true
ee5fb9db73b16be2b59c3aae95f4d9eb548d1446
Python
Sanjo23Chaval/programming_oscar_sanjose
/exersices/tri_matrix.py
UTF-8
1,019
3.203125
3
[ "MIT" ]
permissive
def read_row_column(text): f = open(text,"r") info = f.readline() info = info.rstrip() info = info.split() for i in range(len(info)): if info[i] == "rows": rows = info[i+2] rows = list(rows) if "," in rows: rows.remove(",") elif inf...
true
6f9b13fd9c8621e629a8a365073fd19d3d7b2ba0
Python
shimy-abd/speech_recognizer
/src/recognizer.py
UTF-8
738
3.203125
3
[]
no_license
import speech_recognition class Recognizer: def main(self): recognizer = speech_recognition.Recognizer() while True: try: with speech_recognition.Microphone() as mic: recognizer.adjust_for_ambient_noise(mic, 0.5) print("Ok, I'm l...
true
548e363588aca045738ebc575fe70ef9ac530dad
Python
pragadish92/wordpress-auto-post
/blogpost.py
UTF-8
2,500
2.78125
3
[]
no_license
from wordpress_xmlrpc import Client, WordPressPost from wordpress_xmlrpc.methods.posts import GetPosts, NewPost from wordpress_xmlrpc.methods.users import GetUserInfo from wordpress_xmlrpc import Client, WordPressPost from wordpress_xmlrpc.compat import xmlrpc_client from wordpress_xmlrpc.methods import media, pos...
true
decea53dc4b713b7333ad773c7c4169075ab73a3
Python
k1713310/Python-Sample
/Python TestScript.py
UTF-8
1,015
3.8125
4
[ "Unlicense" ]
permissive
print() print ("Hello World") fred = 200 print(fred) john = fred print(john) print() number_of_coins = 240 print(number_of_coins) found_coins = 20 magic_coins = 10 stolen_coins = 3 found_coins + magic_coins * 365 - stolen_coins * 52 stolen_coins = 2 magic_coins = 13 found_coins + magic_coins * 365 - sto...
true
7351e72adbbd7316407333b52ad58e869176ba2f
Python
karagg/tt
/logistic/logistic_main.py
UTF-8
2,037
2.546875
3
[]
no_license
import numpy as np import Nor_sta as ns from gradientDesent import gradientDesent from gradientDesent_Reg import grad import sys sys.path.append(r"C:\Users\Lenovo\performance_evaluation") from F1 import F1 import ROC_AUC as ra from Accuray import Accuracy from hold_out import hold_out import Confusion_Matrix as cm fr...
true
07de629782dbd09f1bdee837ee55ddecb6c818df
Python
FredericCanaud/Kattis
/Filip/main.py
UTF-8
277
3.734375
4
[]
no_license
import sys nombres = sys.stdin.readline().split() nombre1 = int(nombres[0]) nombre2 = int(nombres[1]) nombre1 = str(nombre1)[::-1] nombre2 = str(nombre2)[::-1] nombre1 = int(nombre1) nombre2 = int(nombre2) if nombre1 <= nombre2: print(nombre2) else: print(nombre1)
true
d3eeab7b70ffe76cfa72b1ef6de37eed65dd0ab1
Python
vietanhdev/iFirewall
/iWAF/Config.py
UTF-8
3,221
2.65625
3
[]
no_license
from threading import Lock import redis class Config: PUBLIC_PARAMS = ["rate_limit_interval", "rate_limit_warning_thresh", "rate_limit_block_thresh", "rate_limit_block_time", "rate_limit_ddos_thresh", "rate_limit_ddos_interval", "rate_limit_whitelist_expiration_time...
true
ee5ffb295a8b79d322362c5fb23f50e15fb76372
Python
tsl3su/moods
/streaming8emo2.py
UTF-8
8,530
2.734375
3
[]
no_license
from tweepy.streaming import StreamListener from tweepy import OAuthHandler from tweepy import Stream import json import csv import math from collections import Counter import string import nltk from nltk.corpus import wordnet as wn from nltk.stem.wordnet import WordNetLemmatizer import time import datetime # Go to ht...
true
36849aef297944fb64f7b05417e387dacc0023c1
Python
killynathan/Algorithms
/Assign13-Johnson'sAPSP/BellmanFord.py
UTF-8
1,244
3.359375
3
[]
no_license
import math def findShortestPathsFromSource(numOfVertices, edges, source): # constant INF = 99999 # used for stopping early listIsSameAsBefore = True # get data structs #numOfVertices, edges = getGraph2(filename) # !!!!!!! 1 vs 2 A = [INF]*(numOfVertices + 1) # vertices indexed starting from 1 A[source] = 0 ...
true
4ee52bd0afcbb1dc6253e5a3f1b4f4ade9905c26
Python
BigR-Lab/concrete-python
/concrete/util/file_io.py
UTF-8
13,297
2.8125
3
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
"""Code for reading and writing Concrete Communications """ import cStringIO import gzip import bz2 import mimetypes import os.path import tarfile import zipfile import os import pwd import grp import time from thrift import TSerialization from thrift.transport import TTransport from concrete import Communication, ...
true
a92a31caef6680afc6ebdb761cd61a228345a662
Python
TPSGrzegorz/PyCharmStart
/Collections/Collections_deque.py
UTF-8
326
2.859375
3
[]
no_license
from collections import deque n = int(input()) d = deque() for i in range(n): to_uppack= list(input().split()) if len(to_uppack) == 2: command, item = to_uppack arg = int(item) eval('d.' + command + '(arg)') else: command = to_uppack[0] eval('d.' + command + '()') pri...
true
fb12c09623e58c888353d97183078c8e2b1c734d
Python
JuanMazza85/TesisUBA
/Scripts/SOM.py
UTF-8
11,588
2.96875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 12 11:02:48 2017 @author: waldo Función trainSOM ------------- Parámetros: P: es una matriz con los datos de los patrones con los cuales entrenar la red neuronal. filas: la cantidad de filas del mapa SOM columnas: la cantidad de columnas ...
true
77599051f4300e3d3a95d0f1454df3864546e1ca
Python
saetar/pyEuler
/not_done/py_not_started/euler_614.py
UTF-8
896
3.96875
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # ~ Jesse Rubin ~ project Euler ~ """ Special partitions 2 http://projecteuler.net/problem=614 An integer partition of a number n is a way of writing n as a sum of positive integers. Partitions that differ only by the order of their summands are considered the same. We call...
true
4b044a8a7f6774d4418b650224c7ff34d9925241
Python
nonas-hunter/warmup_project
/warmup_project/scripts/test.py
UTF-8
847
3.5
4
[]
no_license
#!/usr/bin/env python3 import numpy import math def point_to_global(x, y): theta = math.radians(0) point = [x, y, 1] rot_matrix = [[math.cos(theta), -math.sin(theta), 0], \ [math.sin(theta), math.cos(theta), 0], \ [0, 0, 1]] ...
true
184de29f33e5dca6d273c1defac3d83e89716f83
Python
algoitssm/algorithm_taeyeon
/Baekjoon/20924_tree_트리의기둥과가지.py
UTF-8
1,159
3.25
3
[]
no_license
import sys sys.setrecursionlimit(10 ** 6) sys.stdin = open("input.txt") # 양방향 처리 해줘야함 12,7일때 (3,7) def dfs(giga_node, giga_length): for node in tree[giga_node]: if visited[node[0]][0] == 0: # 방문하지 않은경우 visited[node[0]][0] = 1 # 방문 표현 dfs(node[0], giga_length + node[1]) ...
true
83ef188bec1f39920efcf302730ec9df4ef22c1b
Python
twarogm/pp1
/03-FileHandling/Exercises/03-19.py
UTF-8
193
3.203125
3
[]
no_license
tab = [] with open('universities.txt', 'r') as file: for line in file: tab.append(line) with open('universities.txt', 'w') as file: for i in sorted(tab): file.write(i)
true
07a18fa5e624a4e59d445d794f8fd51fbbe64fda
Python
lamby/django-slack
/tests/test_escaping.py
UTF-8
2,117
3.125
3
[ "BSD-3-Clause" ]
permissive
import django import unittest from django_slack import slack_message from django_slack.utils import get_backend class SlackTestCase(unittest.TestCase): def setUp(self): self.backend = get_backend() self.backend.reset() def assertMessageCount(self, count): self.assertEqual(len(self.ba...
true
95b9aba31e282dd44f8852b09caeee6b2499901f
Python
admalledd/sublime_text
/keymapper.py
UTF-8
1,818
2.703125
3
[]
no_license
import sublime, sublime_plugin class keymapperCommand(sublime_plugin.TextCommand,sublime_plugin.WindowCommand): """Key Mapper, sadly you still have to define all the keymaps in your .sublime-keymap just point them all here that you want to be able to map around. this subclasses both TextCommand and Windo...
true
a80d7822c73877119cbd81d2af444cc31aaef41d
Python
Kristof95/Security-Tools
/IP Address Scanner/Ip_address_scanner.py
UTF-8
1,284
3.390625
3
[]
no_license
#python34 import requests import json def main(): ip = input("Please add an ip address:") print("\n") try: ip_info = [] response = requests.get('http://ipinfo.io/'+ip) json_resp = json.loads(response.text) print("Hostname: "+json_resp["hostname"]) print("Lo...
true
d62ef5eb94731634ae604bada048fd573fe73d9e
Python
Cooton/Test
/study17.py
UTF-8
169
3.15625
3
[]
no_license
#!/use/bin/env python3 #-*- conding:utf-8 -*- a=[1,2,3,4,5,'a','b'] zong=0 for x in a: if(type(x)==int) or (type(x)==float): zong=zong+x else: continue print(zong)
true
d347204d471b6a8e5d5b442923358ee85ce71ab6
Python
leihong/learn_python
/html_parser.py
UTF-8
1,940
3.21875
3
[]
no_license
#!/usr/bin/env python3 from html.parser import HTMLParser from urllib import request import re class MyHTMLParser(HTMLParser): def __init__(self): super(MyHTMLParser, self).__init__() self.flag=0 self.logdata=0 self.information = [] self.__dataname = 0 def handle_startt...
true
48513fccf0b89b8e04686a6016521e13e6ee14ce
Python
Harry-Rogers/PythonNotesForProfessionals
/Chapter 2 Data Types/2.2 Set Data Types.py
UTF-8
418
3.78125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jul 26 15:05:45 2020 @author: Harry """ basket = {"apple","orange","apple","pear","bannana"} print(basket) #duplicates from a set are removed on print a = set("abracadabra") print(a) # prints the unique letters in a a.add("z") print(a) #can add to a set but w...
true
65f78a399237a7d4afe2751cadc303d4d0478787
Python
smhemel/Problem-Solving-using-Python
/URI Online Judge/Uri 1059.py
UTF-8
69
3.609375
4
[]
no_license
for i in range(100): i+=1 if(i%2==0): print("%d" %i)
true
7282eee89b2b4a07daaea132882d5d40e6b9cd64
Python
DebojyotiRoy15/LeetCode
/268. Missing Number.py
UTF-8
324
3.109375
3
[]
no_license
#https://leetcode.com/problems/missing-number/ #O(n) class Solution: def missingNumber(self, nums: List[int]) -> int: n = len(nums) sum =(n*(n+1))//2 sum_real = 0 for i in range(len(nums)): sum_real = sum_real + nums[i] diff = abs(sum_real - sum) return d...
true
083432c0814b53dedb373e1be67bc6b5b55d150d
Python
feisuxiaozhu/gate-complexity
/one_way_function/sparse_matrix_creater/4_no_hw1.py
UTF-8
4,507
2.75
3
[]
no_license
import numpy as np import random import galois from typing import List, Any import os import pickle import multiprocessing from sympy import Matrix, latex from itertools import combinations, product, permutations def weighted_sample(choices: List[Any], probs: List[float]): """ Sample from `choices` with probab...
true
f91114ebc15ddad18d35615248e622d509f169e1
Python
maxfiedler/breze
/breze/arch/model/gaussianprocess.py
UTF-8
3,913
2.53125
3
[]
no_license
# -*- coding: utf-8 -*- """Module containing models for Gaussian processes.""" import numpy as np import theano.tensor as T from theano.sandbox.linalg.ops import MatrixInverse, Det, psd, Cholesky minv = MatrixInverse() det = Det() cholesky = Cholesky() from ..util import lookup, get_named_variables from ..componen...
true
7a07c5bcf3111fe432429167febdd3b8360c26c5
Python
mr-kkid/sklearn
/test10-Kfold&cross_validation&precision&recall.py
UTF-8
2,227
2.53125
3
[]
no_license
#encoding=UTF-8 #K-fold and cross_validation and precision and recall from sklearn import datasets import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.cross_validation import train_test_split from sklearn.linear_model import Perceptron from sklearn.metrics import accuracy_score import plot...
true
0ad87d83c1fd290fd46a803459a90d2365382075
Python
jordibusoms/APA
/Assignment2/main_cheating.py
UTF-8
7,251
2.828125
3
[]
no_license
# import copy # weakref import re import sys def default_gt(node_a, node_b): """Not to be used outside lnk_list insert_sort but the users may code another one to substitute it if needed, so it's outside the class. Defines how two lnk_nodes should be compared, returning 1 if node_a is greater or equal...
true
3d1129ce24bae925d5f338970367b9d55c5499c5
Python
P4SSER8Y/ProjectEuler
/pr117/pr117.py
UTF-8
295
2.96875
3
[]
no_license
#coding:utf8 def foo(group): n = 50 f = [0] * (n + max(group)) f[0] = 1 for i in range(n): for j in group: f[i+j] += f[i] return f[n] def pr117(): return foo([1, 2, 3, 4]) def run(): return pr117() if __name__ == "__main__": print(run())
true
fc8db291afad84b025ec3013d898c0de46122f02
Python
iwiwi/darkopt
/example/chainer_mnist.py
UTF-8
3,221
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import argparse import chainer import chainer.functions as F import chainer.links as L from chainer import training from chainer.training import extensions import numpy as np import darkopt test_batch_size = 1024 param_space = { 'unit': 2 ** np.arange(3, 10), 'batch_size': 2 ** np.aran...
true
53252245d72f40ca7b0f9be56822801b14f6852e
Python
alexcrichton/wasmtime-py
/wasmtime/_instance.py
UTF-8
3,295
2.671875
3
[ "LLVM-exception", "Apache-2.0" ]
permissive
from ._ffi import * from ctypes import * from wasmtime import Module, Extern, Func, Table, Memory, Trap, Global dll.wasm_instance_new.restype = P_wasm_instance_t class Instance(object): # Creates a new instance by instantiating the `module` given with the # `imports` provided. # # The `module` must h...
true
a42fd149f6f2557ae6e8b61c025a52111e8b2e91
Python
Kimuda/Phillip_Python
/longer_cool_code/movies.py
UTF-8
1,517
3.671875
4
[]
no_license
movie1 = { "name":"The grey", "rating":79, "year":2012, "actors":["Liam Neeson","Frank Grillo","Dermot Mulroney","Dallas Roberts","Joe Anderson","Nonso Anozie"] } movie2 = { "name":"LOTR: TFOTR" } movie2["rating"]=91 movie2["year"]=2002 movie2["actors"]=["Elijah Wood","Ian McKellen","Viggo Mortens...
true
04dcb407acc970f3e68e132d660ea0f7e49c71e6
Python
bopopescu/licorn
/daemon/threads.py
UTF-8
33,467
2.65625
3
[]
no_license
# -*- coding: utf-8 -*- """ Licorn Daemon threads classes. Worth reads (among many others): * http://code.google.com/p/python-safethread/w/list * http://www.python.org/dev/peps/pep-0020/ Copyright (C) 2010 Olivier Cortès <oc@meta-it.fr> Licensed under the terms of the GNU GPL version 2. """ import time, __builtin__...
true
70b36d0a3334a45334be9eb6e8b714b7ad865c22
Python
yienlyu/Python-Implementations
/Data_Structures/server.py
UTF-8
2,193
3.515625
4
[]
no_license
# data format: <user_name> <user_id> <click_timestamp> <product_id> <sale> # store the costumers' information with a list of tuples def store_allInfo(a, all_info): a = tuple(str(x) for x in a.split(" ")) all_info.append(a) # store the products' information with a dictionary {product_id : {(user_id, sale), .....
true
fe36d062eb999af0436b0cff93561c822aede2c5
Python
LValencia24/othellopy
/Othello_def1.py
UTF-8
10,954
3.375
3
[]
no_license
# Autor : Luis Valencia 14-11335 # Variables iniciales PlayerOneBlack = 1 PlayerTwoWhite = 2 turno = 0 # Funcion para crear el tablero def crearTablero(): tablero = [ [0 for j in range(0, 8)] for i in range(0, 8)] tablero[3][4] = tablero[4][3] = PlayerOneBlack tablero[4][4] = tablero[3][3] = PlayerTwoWhit...
true
b59ba71084bc6c5af6827dec115a8fcd27a88595
Python
renll/rongba
/examples/experiments/loggers.py
UTF-8
3,436
2.53125
3
[ "Apache-2.0" ]
permissive
import numpy as np import pandas as pd import pickle from ngboost.evaluation import * class RegressionLogger(object): def __init__(self, args): self.args = args self.log = pd.DataFrame() def tick(self, forecast, y_test): pred, obs, slope, intercept = calibration_regression(forecast, ...
true
9771651a4aa5603f1db8e9f97a86cfce60aed4a2
Python
NotGeobor/Bad-Code
/Physics equations/vf vi a t/a = vf vi t.py
UTF-8
120
3.46875
3
[]
no_license
vf = float(input("vf? ")) vi = float(input("vi? ")) t = float(input("t? ")) a = ((vf - vi) / t) print() print(a) print()
true
682ba4bda9c878651b53eed26dba5a2dd677177e
Python
wangye707/Test
/校招笔试/souhu.py
UTF-8
837
3.0625
3
[]
no_license
#!D:/workplace/python # -*- coding: utf-8 -*- # @File : souhu.py # @Author: WangYe # @Date : 2019/8/29 # @Software: PyCharm def go(num,n): if num and len(str(n))>0: m = 0 for i in range(n+1): for k in str(i): if num in k: print(i) ...
true
731840ae9a21e97e2befa24d3e3d40edbf179685
Python
dr1990/CSE-601-Data-Mining-Bioinformatics
/Project2/ClusteringAlgos/index.py
UTF-8
1,339
3.0625
3
[]
no_license
import numpy as np # Creates the incidence matrix indicating the similarity of cluster assignments to each datapoint def get_incidence_matrix(ground_truth, cluster_group): n = len(ground_truth) incidence_matrix = np.zeros((n, n), dtype='int') for k, v in cluster_group.items(): for i, row in enumer...
true
81313238a49245fdb63ba719594ae5fd12f705f3
Python
georgeerol/LogAnalysis
/reportdb.py
UTF-8
3,089
3.265625
3
[]
no_license
#!/usr/bin/env python3 import psycopg2 # Question 1 popular_art_title = "What are the most popular three articles of all time?" popular_art_query = \ ( "select articles.title, count(*) as views " "from articles inner join log on log.path " "like concat('%', articles.slug, '%') " "w...
true
1f3b9ef27eb193b8433c5d7a6afe966f2190edd3
Python
msergeant/adventofcode
/2019/day10/main.py
UTF-8
2,372
3.28125
3
[]
no_license
from math import atan2, pi def main(): with open('./input') as file: raw = file.read() grid = [i for i in raw.strip().split("\n")] width = len(grid[0]) height = len(grid) max = 0 max_coords = (-1, -1) for i in range(width): for j in range(height): if grid[j...
true
925593027622e9ee4638300352690c936bb606cb
Python
HeyAnirudh/leetcode
/. Find Numbers with Even Number of Digits.py
UTF-8
229
3.1875
3
[]
no_license
#lt=[12,12,333,1234,34545] #print(len(str(lt[2]))) def findNumbers(lt): count=0 for i in range(0,len(lt)): if len(str(lt[i]))%2==0: count+=1 return count lt=[12,345,2,6,7896] print(findNumbers(lt))
true
ffb568c3876b6cb4d87b7f7a9a07889bcf7a8cae
Python
hyeonahkiki/home
/problem_soliving/sw_expert/5789. 현주의 상자바꾸기.py
UTF-8
484
2.953125
3
[]
no_license
import sys sys.stdin = open('input.txt', 'r') T = int(input()) for tc in range(1, T+1): # 상자개수, 반복횟수 N, Q = map(int, input().split()) box = [0] * (N + 1) # 변화값 x = 0 for i in range(Q): x += 1 L, R = map(int, input().split()) if x != Q+1: for j in range(L, R+1...
true
995cbd9ff946b4779c7fbe6b88cc7d88f6bbd440
Python
johny65/acm
/Facebook Hacker Cup/2012/Qualification/c.py
UTF-8
565
2.953125
3
[]
no_license
import sys import math t = int(input()) for f in range(t): s = sys.stdin.readline() h = a = c = k = e = r = u = p = 0 for i in s: if i == 'H': h += 1 elif i == 'A': a += 1 elif i == 'C': c += 1 elif i == 'E': e += 1 elif i == 'R': r += 1 elif i == 'K': k += 1 elif...
true
bf20ff74eafa50b143f851ee79654c2fb272bc1e
Python
JiangHuYiXiao/Web-Autotest-Python
/第六章-pytest框架/pytest_参数化09/test_parametrize.py
UTF-8
962
3.265625
3
[]
no_license
# -*- coding:utf-8 -*- # @Author : 江湖一笑 # @Time : 2020/5/8 8:47 # @Software : Web-Autotest-Python # @Python_verison : 3.7 ''' 使用.parametrize装饰器可以实现测试用例的参数化。 pytest.mark.parametrize('参数',[value]) ''' import pytest # 一个参数 list1 = ['寒山孤影','江湖故人','相逢何必曾相识'] @pytest.mark.parametrize('par1',list1) de...
true
69ff482fb58eb0a1b2f4b808dfa9dbcd5ca71f44
Python
williamejelias/Huffman-EncoderDecoder
/HuffmanDecode.py
UTF-8
1,424
3.21875
3
[]
no_license
import pickle import sys import time start = time.time() infile = sys.argv[1] filename = infile try: # read the file as bytes and unpickle file = open(filename, "rb") list_dictionary_message = pickle.load(file) # extract dictionary huffmanCodes = list_dictionary_message[0] # extract the numbe...
true
8b01c1f8e1edb35f9b72a1445ce0190eaf25b5a6
Python
phamtony/turtle-cross-game
/car_manager.py
UTF-8
820
3.375
3
[]
no_license
from turtle import Turtle import random COLORS = ["red", "orange", "yellow", "green", "blue", "purple"] STARTING_MOVE_DISTANCE = 5 MOVE_INCREMENT = 10 class CarManager(Turtle): def __init__(self): super().__init__() self.shape("square") self.color(random.choice(COLORS)) self.shapes...
true
589d65de2452c265c3c1b43f4d7d401a23cfecc1
Python
5l1v3r1/network-scanner-1
/networkscanner/PortScanner/PortScanExample.py
UTF-8
455
3
3
[]
no_license
import PortScanner as ps def main(): # Initialize a Scanner object that will scan top 50 commonly used ports. scanner = ps.PortScanner(target_ports=50) host_name = input('hostname:') message = 'put whatever message you want here' scanner.set_delay(15) scanner.show_target_ports() scanner....
true