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
321cdb0fa94d3607279a84828a31dcc53698d55c
jizhi/huangqizhi_git
/Note/mean-std_Gaussian.py
UTF-8
2,115
3.234375
3
[]
no_license
#! /usr/bin/env python import numpy as np import jizhipy as jp ''' Gaussian noises: a: a.mean()=0, a.std()=astd b: b.mean()=0, b.std()=bstd (== or != astd) Auto-correlation: chi-squared distribution with k=1 A = <a a*> A.mean() = astd**2 A.std() = sqrt{2} * astd**2 = sqrt{2} * A.mean() Cross-cor...
true
2a28ce07f037cddcbff766ffc906e5961bc15067
ASatiricalDalek/Tally2.0
/__init__.py
UTF-8
2,329
2.6875
3
[]
no_license
import sqlite3 as sql import importlib.util, sys from flask import Flask, render_template, request import importlib.util from datetime import datetime # Import the database.py file. Have to specify its full path spec = importlib.util.spec_from_file_location("database", "/var/www/tally2/tally2/database.py") dbpy = impor...
true
bbfe35c4291f87f43d2a0824607089b74980539d
hyzcn/VQD
/plot_params.py
UTF-8
1,000
2.53125
3
[]
no_license
import argparse import os import utils import seaborn as sns import numpy as np import matplotlib.pyplot as plt def parse_args(): parser = argparse.ArgumentParser() parser.add_argument('--save', help='save folder name',default='0') args = parser.parse_args() return args if __name__ == '__main__': ...
true
2742a576c02e4ddab1f76b91821b0a917010a89a
nwiizo/workspace_2017
/blog/blog_Document_Summarization/Basic_Summarization_Model.py
UTF-8
3,818
3.484375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import MeCab as mc import numpy as np m = mc.Tagger("-Ochasen") def mecab_senter(text): if type(text) is bytes: text = text.decode("cp932") node = m.parseToNode(text) sentences = [] sentence = [] while node: sentence.append(node.surf...
true
d1b996732de36fe391e81a17f73e01f24c835595
Zhouyinyun/lpthw2018
/ex3.py
UTF-8
629
4.1875
4
[]
no_license
# right, i will now count my chickens print("I will now count my chickens:") # first Hens print("Hens", 25.3 + 30.3 / 6.3) # then Roosters print("Roosters", 100.3 - 25.3 * 3.3 % 4.3) # third eggs print("Now I will count the eggs:") # how many print(3 + 2 + 1 - 5 + 4 % 2 - 1.3 / 4 + 6) # is that true? print("Is it t...
true
eb9214f89bf8b79e6011c6dae40d719752e1c47d
thomwiggers/hackover
/ish_1/ish_client.py
UTF-8
1,857
2.59375
3
[]
no_license
#!/usr/bin/env python2 from __future__ import print_function # Insecure Shell 2 hacker - Hackover 2016 # Thom Wiggers <thom@thomwiggers.nl> import socket import os from binascii import hexlify import struct def send(s, data): try: s.send(struct.pack('!h', len(data))) s.send(data) except: ...
true
4a30109de6fb67631a142fa530b30f99a753f0a5
Kyoroid/ahc001
/A/strategy_2.py
UTF-8
6,299
2.75
3
[]
no_license
from __future__ import annotations import sys input = sys.stdin.readline import math import random import logging import numpy as np logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) def read(): N = int(input().strip()) IXYR = [] for i in range(N): x, y, r = map(int, i...
true
ee4d3ce6f0b7a0e1733752101dd73af6a1b3ed9f
yukiskate/AtCoder_Python
/abc131/B.py
UTF-8
246
3.140625
3
[]
no_license
N, L = map(int, input().split()) sum = 0 if L >= 0: for i in range(1, N): sum += int(i) + L elif abs(L) < N: for i in range(N): sum += int(i) + L else: for i in range(0, N-1): sum += int(i) + L print(sum)
true
3e4295b699e847b70189f690aae2c908802bd73b
Aasthaengg/IBMdataset
/Python_codes/p03168/s292599009.py
UTF-8
663
3.0625
3
[]
no_license
import sys readline = sys.stdin.readline # dp[i][j] = i個目までのコインで、表の個数がj個である確率 # dp[i][j] = dp[i - 1][j] * (1 - P[i]) + dp[i - 1][j - 1] * P[i] # dp[0][0] = 1 # 0個目までのコインで、表の個数が0個である確率は1 N = int(readline()) P = list(map(float,readline().split())) dp = [[0] * (N + 1) for i in range(N + 1)] dp[0][0] = 1 for i in range(...
true
e34e4335bd7e8a57795e1268d2c7dfc3a968341a
sudhirshahu51/projects
/Algorithms/Graph/Graph_undirected.py
UTF-8
1,891
3.78125
4
[]
no_license
# To implement undirected graph data structure class Vertex: # Class of vertex def __init__(self, key): self.id = key self.connected = {} # dictionary of all the connected vertices with tht vertice def add_neighbor(self, nbr, weight=0): # adding a adjacent neigh...
true
ce39e4787d002219e6c460de23259ad320e5eb35
brunofonsousa/python
/pythonbrasil/exercicios/listas/LT resp 04.py
UTF-8
287
3.3125
3
[ "MIT" ]
permissive
vetor = [] consoantes = [] cons = 0 for i in range(1,11): letra = str(input("Digite a %iª letra: "%(i))) if letra not in ("a", "e", "i", "o", "u"): cons += 1 consoantes.append(letra) print("") print("Consoantes: ", cons, " = ", consoantes) print("")
true
24d72c50a65849744faa105e156c836f7766b12b
bolimath/Attempts
/2018-01-tiramisu_GRU/tiramisu.py
UTF-8
10,150
2.65625
3
[]
no_license
# coding: utf-8 import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from torch.autograd import Variable def center_crop(layer, max_height, max_width): #https://github.com/Lasagne/Lasagne/blob/master/lasagne/layers/merge.py#L162 #Author does a center crop which crops b...
true
55c0accb2e1d92239f4f20e03a0a49b758d63aca
sd911223/qp
/server/server/utils/twisted_tools.py
UTF-8
1,008
3.015625
3
[]
no_license
import time from twisted.internet import reactor from twisted.internet import task class DelayCall(object): def __init__(self, seconds, f, *args, **kw): self.__timer = reactor.callLater(seconds, f, *args, **kw) def cancel(self): """取消延时调用 """ if not self.__timer: ...
true
8d8c4e2af68f6d852cca90cc0cc5ecc3553e72c0
berquist/pyints
/pyints/args.py
UTF-8
4,356
2.828125
3
[]
no_license
def getargs(): """Get command-line arguments.""" import argparse parser = argparse.ArgumentParser() # One-electron integrals parser.add_argument('--S', action='store_true', help="""Calculate overlap integrals.""") parser.add_argument('--FC', ...
true
50f9c4f5ecb8a3fb4dcad14b526c5eab063c05fa
mhrizi/Python
/Chapter_2_1.py
UTF-8
5,795
4.1875
4
[]
no_license
#Do, or do not. There is no try. --Yoda ############### # CHAPTER 2: Py Ingredients: Numbers, Strings, and Variables ############## # booleans: whihc have the value True and False: # integeres: whole number such as 42 adn 10000000 # floats : numbers with decimal points such as 3.12 or sometimes exponents line 10.0e...
true
048231160f055477c5113108f5534ba46071949b
kurla-sreevalli/Python_MODULEWISE-assgnmt-
/List Assignment__solutions.py
UTF-8
2,169
4.25
4
[]
no_license
#1) Select all the correct options to join two lists. listOne = ['a', 'b', 'c', 'd'] listTwo = ['e', 'f', 'g'] # a) newList = listOne + listTwo # b) newList = extend(listOne, listTwo) # c) newList = listOne.extend(listTwo) # d) newList.extend(listOne, listTwo) print( listOne + listTwo) listOne.exte...
true
4fcc3ca9fbd511add1def7daf7dc56440985fd39
sangjinsu/python_basic
/chapter03_05.py
UTF-8
726
3.921875
4
[]
no_license
# dictionary # 순서 없음, 키 중복 불가 a = { 'name': 'jinsu', 'phone': '01012345678', 'birth': '950309' } aT = dict([ ('name', 'jinsu'), ('phone', '01012345678'), ('birth', '950309') ]) f = dict( name='jinsu', city='seoul', age=27 ) print(f['name'], f.get('name')) print(f['name']) # 존재 X...
true
2cf8a3565245dbf8ded9049940190852ce75f3e4
QuantumElephant/manifold
/test/Function_setting.py
UTF-8
6,439
2.53125
3
[]
no_license
import numpy as np from scipy import stats import matplotlib matplotlib.use('Agg') from scipy.spatial.distance import cdist from matplotlib import pyplot as plt class Parameters: def __init__(self, molecule_number, atomic_number, method, mode ): self.molecule_number = molecule_number self.atomic_nu...
true
ca4f5113000ed663c653daf4ca7917a94fa135c6
yaozezhen/programming
/eveningTheOdds.py
UTF-8
1,614
4.03125
4
[]
no_license
import random die_1 = [1, 2, 3, 4] die_2 = [1, 1, 1, 1, 1] die_3 = [1, 2, 3, 4, 5, 6] def eveningTheOdds(diceList,k): die1 = diceList[0] die2 = diceList[1] sumDict = {} for i in range(max(die1) + max(die2) + 1): sumDict[i] = 0 for i in range(k): outcome = random.choice(die1) + random.choice(die2...
true
7812af3aed5e6e051dce3946b8202d7d0bb64ac2
ghsbhatia/xray-poc
/Source/message_server.py
UTF-8
2,666
2.53125
3
[]
no_license
from flask import Flask, Response, request from urllib.request import Request as UrlRequest from urllib.request import urlopen as urlopen import instrumentation import time import json import random import uuid # Configure instrumentation for flask app app = Flask(__name__) instrumentation.configure(app, 'message-ser...
true
5ec4aa2f645282d249395d6e18f3de43dd96760c
dsoumyadip/namoragatwitterbattle-clientapp
/app.py
UTF-8
3,183
2.71875
3
[]
no_license
# Importing dependencies from flask import Flask,jsonify,request from flask import render_template import ast app = Flask(__name__) # Initializing values for chart def initialize_value(return_params): count_values = [] for i in range(360): count_values.append(0) labels_values = []...
true
37f7c25edb3d444c902ff47606e6a2ec01e5df55
ptkang/python-advanced
/chapter12/s05_yield_from_caller_generator.py
UTF-8
479
2.96875
3
[]
no_license
def sales_sum(pro_name): total = 0 nums = [] while True: x = yield print(pro_name + '销量: ', x) if not x: break total += x nums.append(x) return total, nums if __name__ == '__main__': gen = sales_sum('bobby牌电脑') gen.send(None) gen.send(1500...
true
4f5c5079e8107772c7091a2248966f1bc8e88eb6
dyrnfmxm/codeit
/0309_vocabulary_quiz.py
UTF-8
371
3.609375
4
[]
no_license
with open('vocabulary.txt', 'r') as f: for line in f: voca = line.strip().split(': ') kor_word = voca[1] eng_word = voca[0] answer = input(f"{kor_word}: ") if answer == eng_word: print("맞았습니다!\n") else: print(f"아쉽습니다. 정답은 {...
true
781282c73cf5d00880b17fa53b34b5e99d49daa8
Windows87/estudos-introducao-a-visao-computacional
/5.2 Histograma de Cores/gerandoHistogramaCinza.py
UTF-8
325
3.265625
3
[]
no_license
import cv2 import numpy from matplotlib import pyplot image = cv2.imread('rubiks-cube.jpg') image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # Cria o gráfico # 1: .ravel() -> transforma imagem em vetor # 2: Número distintos representados # 3: Intervalo dos elementos pyplot.hist(image.ravel(), 256, [0, 256]) pyplot.sho...
true
0c33984f5d55688935b12253106ba03a2e5b292f
k3v1nn90/api
/test/test.py
UTF-8
4,626
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- import requests import hashlib import os import sys import argparse import subprocess # Helper functions def flatten(list): if len(list) > 1: return list else: return list[0] encoding = 'utf-8' # Grab the HOSTNAME and PORT to use for the HTTP...
true
485fa27be65e3c389486052a689d5036971b804d
Erwan-k/Robot_bouge
/donner_coordonnees.py
UTF-8
64,066
2.984375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue May 29 08:58:42 2018 @author: kerbr """ from math import sin,cos,pi import matplotlib.pyplot as plt import numpy as np def rotation_d_angle_teta_autour_de_U(Vect,U,teta): U = normer(U) V = rechercher_V_orthogonal_à_(U) V = normer(V) W = produit_vectoriel(U,...
true
61d7c6523e0b184ef2dbbbf042b0419f131aed1c
robehickman/raspi_notification
/pinotify/module_system.py
UTF-8
2,875
2.828125
3
[]
no_license
from multiprocessing import Process import ConfigParser import collections import time #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ def read_config(file): """ Read configuration file into a dict """ conf_file = ConfigParser.ConfigParser() conf_file.read(file) config = ...
true
fb99a07150980236e86027db9cb74930443134fe
remotejob/seq2seq
/seq2seq/model/decoder.py
UTF-8
5,444
2.65625
3
[]
no_license
import torch.nn as nn import torch.nn.functional as F from seq2seq.utils.masked_cross_entropy import * from seq2seq.model.attention import Attn class BahdanauAttnDecoderRNN(nn.Module): def __init__(self, itos, output_size, max_length, n_layers=1, dropout_p=0.1, emb_vecs=None): super(BahdanauAttnDecoderRNN...
true
a3bf7bfc5f0e7f5fbbadab0a6dc2c92f83b7ac57
wandonye/carnd_P5
/LaneFinder.py
UTF-8
13,114
2.578125
3
[]
no_license
import cv2 import numpy as np from Lane import Lane class LaneFinder: def __init__(self, original_image_size, mask_vertices, anchor_points, tranformed_image_size, cali_mtx, cali_dist, convert_x, convert_y, window_width=50, window_height=80, margin=100, left_lane_b...
true
478bf8cce51dfbb488283ba7a26399e409ba8a6a
LopesAbigail/UFABC-PI-2021
/cash-machine.py
UTF-8
822
3.75
4
[]
no_license
bank_note_input = float(input()) bank_notes = 100 # inicializa com o maior valor disponivel no caixa count_current_note = 0 count_bank_notes = 7 # 1, 2, 5, 10, 20, 50, 100 while count_bank_notes > 0: if bank_note_input >= bank_notes: bank_note_input -= bank_notes count_current_note += 1 else:...
true
9f2134a0845b0d64b770ecd5c7216e53a438ff65
joelzhao-nc/MyStudy
/10.py
UTF-8
169
3.265625
3
[]
no_license
prompt="\nTell me:" prompt+="\nEnter 'quit'." message ="" while True: message =input(prompt) if message=='quit': break else: print(message)
true
c8caf4e6d353b39f6c017d86fd4d00c2f0ee8ebe
SriramJothiswaran/srirampnr
/public/example/bluewasblack.py
UTF-8
2,334
3.0625
3
[]
no_license
import tkinter as tk from tkinter import END import json from pprint import pprint root = tk.Tk() root.title("City Information") variable = tk.StringVar(root) variable.set("Adelanto") initialName = "Adelanto" cityList = [] with open('ca.json') as f: data = json.load(f) for nameList in data: cityList.appen...
true
e9b20c68f9d4e9ddfffafd880e6fd832d1b33594
LeighGriffith/python-projects
/code-studio/s1level39.py
UTF-8
502
2.921875
3
[]
no_license
'''s1level39 for (var count2 = 0; count2 < 36; count2++) pen_Colour(colour_random()); for (var count = 0; count < 3; count++) { moveForward(100); turnRight(120); } } turnRight(10) ''' import random import turtle artist = turtle.Turtle() artist.pensize(7) artist.speed(100) for count in range(36...
true
2ebf8fbd614946ed475d0e601c304818dc1ca04d
SethBatcha/Exploring_Movie_Lengths_with_Python
/movielength.py
UTF-8
12,060
3.828125
4
[]
no_license
# Import matplotlib.pyplot under its usual alias and create a figure import matplotlib.pyplot as plt fig = plt.figure() # Draw a line plot of release_years and durations plt.plot(years,durations) # Create a title plt.title("Netflix Movie Durations 2011-2020") # Show the plot plt.show() 4. Loading the rest of the da...
true
f61777b49dae5b39b97f651c6e268db0da82bfba
jonathancaxton/BMI
/BMI_calculator_function.py
UTF-8
653
3.4375
3
[]
no_license
#BMI calculator for men #from BMI_library weight = int(input("What is your weight in kg ?:")) height = int(input("What is your height cm ?:")) def BMI (x,y) : bmivalue = x/((y/100)*(y/100)) if bmivalue < 18.5: return "Your BMI is " + "{:.2f}".format(bmivalue) + "," + "your're underweight." elif bm...
true
af517c2cc84c209e9b4976bcb1ff0fa3fc76d025
Yanyu9872/scrapy_x
/scrapy_x/http/request.py
UTF-8
222
2.59375
3
[]
no_license
"""request请求对象""" class Request(): def __init__(self, url, method='GET', data=None, headers=None): self.url = url self.method = method self.data = data self.headers = headers
true
e7203de798099843276ddbe26db75cd413ad249d
milesbelli/social-event-store
/social/app/twitter.py
UTF-8
13,225
2.734375
3
[ "MIT" ]
permissive
import urllib.request import json import datetime import common, eventdb from pathlib import Path import requests def retrieve_from_twitter(post_id): tweet_url = "https://twitter.com/milesbelli/status/" + str(post_id) tweet_page = urllib.request.urlopen(tweet_url) data = tweet_page.read() text = data...
true
4ae1a13f1efb61668090d1aa4a7059f94560101a
tadders/PANEL
/DataLoader/TestUtils.py
UTF-8
466
2.953125
3
[]
no_license
import unittest import numpy as np from numpy.testing import assert_array_equal from utils import * class TestUtils(unittest.TestCase): def test_get_unique_edges(self): netmat = np.array([[0, 1, 2, 3], [1, 0, 4, 5], [2, 4, 0, 6], [3, 5, 6, 0]]).reshape((1, 16)) unique_edges = get_unique_edges(netm...
true
e6fcbb40b5c22827a681b94eb881fbbf740156f1
lycantropos/lz
/tests/iterating_tests/chopper_tests/test_definition.py
UTF-8
815
2.625
3
[ "MIT" ]
permissive
from typing import (Any, Iterable) from hypothesis import given from lz.iterating import (chopper, flatten) from lz.replication import duplicate from tests import strategies from tests.utils import are_iterables_similar @given(strategies.iterables, strategies.non_negati...
true
c96cf73d3cb16b88a597d41b20ba98d6c25e2edc
Aasthaengg/IBMdataset
/Python_codes/p02583/s552346931.py
UTF-8
359
2.90625
3
[]
no_license
def main(): n = int(input()) a = list(map(int, input().split())) cnt = 0 for i in range(n): for j in range(i+1, n): for k in range(j+1, n): if a[i]+a[j] > a[k] and a[j]+a[k] > a[i] and a[k]+a[i] > a[j] and a[i] != a[j] and a[j] != a[k] and a[k] != a[i]: ...
true
e3a1ee639765b33fb95cf93b4a44984778ea7c4b
sikor/TK-lab6
/sikora_wilaszek.py
UTF-8
13,887
2.78125
3
[]
no_license
#!/usr/bin/python import sys; import ply.lex as lex; import ply.yacc as yacc; from AST import *; from pprint import pprint; from typesOf import Types; INT_TYPE = "int" FLOAT_TYPE = "float" STRING_TYPE = "str" def addToClass(cls): def decorator(func): setattr(cls,func.__name__,func) ...
true
954ef1d56ceff3789d07dbfac9b2960dc893a310
chenyanqa/example_tests_one
/do_contextlib.py
UTF-8
4,562
4.21875
4
[]
no_license
#!/usr/bin/env python3 # -*- coding:utf-8 -*- ''' 1\读写文件这样的资源要特别注意,必须在使用完毕后正确关闭它们。正确关闭文件资源的一个方法是使用try...finally: 2\写try...finally非常繁琐。Python的with语句允许我们非常方便地使用资源,而不必担心资源没有关闭,所以上面的代码可以简化为: with open('/path/to/file', 'r') as f: f.read() 3\并不是只有open()函数返回的fp对象才能使用with语句。实际上,任何对象,只要正确实现了上下文管理,就可以用于with语句 4\实现上下文管理是通过__e...
true
9e1f8a2fb105506a390886c657f8beb06f607bcf
mtucker91/Intro_to_Python
/past_assignments/Prog Assignment 9 - 1_ Simple Statistics/statistics.py
UTF-8
707
4.09375
4
[]
no_license
# FIXME : Complete the program. No need for defining new functions # setup variables for counters among other things num_count = 0 sum_count = 0 avg_count = 0 max_num = 0 min_num = 0 print('Simple Statistics') numbs = str(input('Please enter numbers, separated by a space:\n')) my_numbs = [float(numb) for numb in numb...
true
ab5914a10537efbbf88bc2b3992208ac944926bf
chetanmehra/hft-backtesting
/hft/units/filters.py
UTF-8
5,538
2.671875
3
[ "Apache-2.0" ]
permissive
from hft.utils.consts import QuoteSides from hft.utils.data import OrderBook, Delta from typing import Dict, List, Optional, Tuple from hft.utils.logger import setup_logger import numpy as np from abc import ABC, abstractmethod logger = setup_logger('<filter>', 'INFO') class Filters: class Filter(ABC): @abst...
true
3c4f7d88ad323c145b9741e1f7c60ae67b028c9c
nandhakumarm/InterviewBit
/Stacks&Queues/largestRectangleHistogram.py
UTF-8
1,041
3.015625
3
[]
no_license
class Solution(object): def largestRectangleArea(self,A): myStack=[] max_area=0 i=0 while i<len(A): if len(myStack)==0 or A[myStack[-1]]<=A[i]: myStack.append(i) i+=1 else: top_index=myStack.pop() ...
true
e203f0999a4dc8eb1c5561f6d73f5e9d078e8568
BigdoBig/infosatc-lp-avaliativo-01
/ex24.py
UTF-8
208
3.828125
4
[]
no_license
metrosquad = float(input("Digite seu valor de metros^2 para a conversão em Acres : ")) acres = metrosquad * 0.000247 print("O seu valor {} em metros^2 convertido em acres é = {}".format(metrosquad,acres))
true
591d7b2212ea6f8568e95ce82a983be44ed5fb06
MrsPsRobot/1-reposit-rio
/listasUdemy.py
UTF-8
977
3.65625
4
[]
no_license
# -*- coding: utf8 -*- minha_lista = ['Abacaxi','melancia','abacate'] minha_lista_2 = [1,2,3,4,5] minha_lista_3 = ['Abacaxi',2, 9.89, True] separa =("==========================================================") for inten in minha_lista: print(inten) separa =("================================================...
true
c5b046d109916ec809823ad84e2bb90c3b2eb43e
Krysox/ProjetCleanArchitecture
/data_source/test_history.py
UTF-8
1,568
2.609375
3
[]
no_license
from data_source.isellHistory import ISellHistory from model.sellHistory import SellHistory from model.productCatalog import ProductCatalog from model.user import User from typing import List class TestHistory(ISellHistory): def get_history_by_product_and_user_last_year(self, idUser, idProduct) -> List[Se...
true
fccfe14e0cafc58dfaeec4f1d79fe34c84c27486
goddammcarti/friendly-octo-journey
/fitst.py
UTF-8
133
3.484375
3
[]
no_license
n = int(input("Введите чилсо")) m = int(input("Введите еще одно чилло")) print((m + n - 1) // n)
true
6d627dce7a4142a5be08168470c81ed125451898
javierpeces/my-python-stuff
/200-re-and-dict.py
UTF-8
2,270
3.5625
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Integrate simple regexp stuff and dictionaries. Analyze a text file with this content... $ cat samp.zone.db www IN A 192.168.100.3 ; not to be IN my Area smtp IN A 192.168.100.100 print IN A 192.168.100.70 www IN A 192.168.100.2 ;...
true
545159f2de8d3dac192ffcce732309463e0aea11
guihehans/self_improvement
/code_pattern/binary_search/minimum_difference.py
UTF-8
1,067
3.421875
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ @author: guihehans @file: minimum_difference.py @time: 2020/12/31 15:53 @function: """ def search_min_diff_element(arr, key): n = len(arr) start, end = 0, n - 1 if key <= arr[0]: return arr[0] if key >= arr[end]: return arr[end] while s...
true
c64bd6d4d6894134538dabc1a84b1b40efa8a134
Pvillamanario/prework-datamad-no-solutions
/Test prework/temperature.py
UTF-8
3,102
2.90625
3
[]
no_license
temperatures_C = [33, 66, 65, 0, 59, 60, 62, 64, 70, 76, 80, 81, 80, 83, 90, 79, 61, 53, 50, 49, 53, 48, 45, 39] min_temp = min(temperatures_C) max_temp = max(temperatures_C) high_temp = [t for t in temperatures_C if t > 70] avg_temp = sum(temperatures_C)/len(...
true
5bf03b4613b438df5ea2b7490978c924ba559882
matthieucan/gitcaca
/gitcaca/gitcaca-display
UTF-8
1,554
2.59375
3
[ "WTFPL" ]
permissive
#!/usr/bin/env python import os import sys import re import subprocess import argparse import pkg_resources import gitcaca def get_avatar(folder, email, width): path = os.path.join(folder, email) if not os.path.exists(path): path = gitcaca.get_default_avatar() command = 'img2txt -W %(width)s %(...
true
b62ae9659116e172e4816e39a48ccd64cc2beed5
zemin-Zhang/Studio3_Year_Final
/Python/Marker/ArucoModule.py
UTF-8
2,888
2.9375
3
[]
no_license
# ArUco markers generator_https://chev.me/arucogen/ # [OpenCV_Detection of ArUco Markers] https://docs.opencv.org/master/d5/dae/tutorial_aruco_detection.html # Use "opencv-contrib-python" rather than "opencv-python"_pip install opencv-contrib-python ( * remember remove "opencv-python") import cv2 import cv2.aruco as a...
true
78e52dec223cd1b6bea293ffa5ab6d5310e3d6ee
adogsa/myMl
/keras_first.py
UTF-8
6,400
2.578125
3
[]
no_license
# 0. 사용할 패키지 불러오기 import numpy as np from keras.preprocessing.image import ImageDataGenerator from core.base import BaseNetwork # 랜덤시드 고정시키기 np.random.seed(3) ################################################################################################## # 1. 데이터 생성하기 train_datagen = ImageDataGenerator(rescale=1./2...
true
50e5a4328e8734d6de3cc84b1c0bbffcfa86e42e
jimmytran16/CLICommandArchives
/main/routes/routes.py
UTF-8
1,241
2.578125
3
[]
no_license
from main import app, mongo from bson.objectid import ObjectId from flask import render_template, request, redirect, url_for # route to the main page @app.route('/') def home(): commands = mongo.db.commands.find({}) print(commands) return render_template('index.html',commands=commands) # route to sea...
true
d988a6b608ee1eb7cde14577d066fcf8baae9be4
Mehareethaa/meha
/posneg.py
UTF-8
143
3.4375
3
[]
no_license
n=int(input()) if n>1: print("Positive") elseif n>1: print("Negative") elseif n==0: print("Zero") else: print("Invalid input")
true
634b1c680cb80b34461a85c71547eb80f94afb55
JGilba/Python_Exercices
/Seção 04 - Variáveis e Tipos de Dados/27.py
UTF-8
134
3.3125
3
[]
no_license
hectares = float(input('Informe um valor em hectares: ')) print('{} hectares = {} metros quadrados'.format(hectares, hectares*10000))
true
e7f9e484aece6de9764d57f6fdd3ed5711acf0fa
DBerger31/myProjects
/automate_boring_stuff/ch8_input_validation/sandwich_maker.py
UTF-8
2,012
3.875
4
[]
no_license
#prompts user what kind of sandwich he wants then #calculates total of sandwich import pyinputplus as pyip import random, time breadType = pyip.inputMenu(['Whole-Wheat', 'Rye', 'White', 'Brown'], lettered=True) meatType = pyip.inputMenu(['Chicken', 'Turkey', 'Ham', 'Tofu'], lettered=True) cheeseResponse = pyip.input...
true
703230501023457dbee272a11d8b1fd5e08050c9
SymbiSoft/aulost
/lost/extras/data/python/mapview.py
UTF-8
10,016
3.0625
3
[]
no_license
import appuifw import key_codes import graphics import time import locations import math import track import view KeyboardAmountOfMapMovement = 10 def rotatePoint(point, rad): x,y = point newX = x * math.cos(rad) - y * math.sin(rad) newY = y * math.cos(rad) + x * math.sin(rad) return newX,newY def tr...
true
2be155f4e21636ddaccba3138aec8a68f3736811
radhey24h/python
/learn-python/comperhension/gen_comperhension.py
UTF-8
135
3.46875
3
[]
no_license
''' Gen comperhensive ''' gen = (i for i in range(100) if i % 3 == 0) for item in gen: print('With gen comperhensive' ':- ', item)
true
17a020512a0b61a63f7fb831ee3c891b0ed6854b
ThejanW/CS4642-YAMU-FOOD
/yamu_food/spiders/cuisines_spider.py
UTF-8
1,164
2.78125
3
[]
no_license
import scrapy class RestaurantsSpider(scrapy.Spider): name = "cuisines" def start_requests(self): with open('cuisines_urls.txt') as f: urls = f.readlines() urls = [x.strip() for x in urls] for url in urls: yield scrapy.Request(url=url, callback=self.parse) ...
true
336fc5f0cab80e7edf3efb2dc163535c1f98da4f
vmirisas/Python_Lessons
/lesson9/part2/string.escape.characters.py
UTF-8
173
2.984375
3
[]
no_license
print("quotes:\",\'") print("slashes: /\\") print("tabs: \n\t|\t|a\t|aa\t|aaa\t") print("change line: \n newline \r carriage returns") print("Backspace: bb\baa\bc\b\baa\b")
true
dccaed58996dd11c7abf7e4d420c1bd3a09d8907
Spikiii/AI20Q
/dataNode.py
UTF-8
3,063
3.34375
3
[]
no_license
import characteristic class dataNode: name = "" category = "" chars = [] similarities = {} def __init__(self, nm = "", cat = "Other", chs = [], sims = {}): self.name = nm self.category = cat self.chars = chs self.similarities = {} def get(self): """Gets...
true
3426186de353615f9c0f1e3238df71e8da88c932
anetak545/Modelowanie-i-analiza-systemow
/lab2.py
UTF-8
4,391
4.0625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 18 18:57:01 2019 @author: Paulina """ """ from cs50 import get_int x = get_int("x: ") y = get_int("y: ") print("x:") x = int(input()) print("y:") y = int(input()) print("-"*10) print(x + y) print("-"*10) print(f"x + y: {x + y}") print(f"x - y: ...
true
f9c641e766bbb7ef37865c112805b48e52b460eb
ZhuoLeng1/Machine-Learning
/hw2/model.py
UTF-8
860
3.46875
3
[]
no_license
from sklearn.linear_model import LogisticRegression import pylab as pl def logistic_regression(df, features, outcome_var): ''' generate logistic regression model. Input: df: dataframe features: list of varibale name outcome: a string:variable name Output: model ''' lm = LogisticRegression() lm.fit(df[fe...
true
33dc44dd1891eda9ff4a017b387af898f8fb7eab
ryleyw/wec2020
/Level4Deliverables/predictor.py
UTF-8
3,179
3.328125
3
[]
no_license
import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression # Read given training file train_file_path = 'MACY_OLD.csv' given_train_data = pd.read_csv(train_file_path) #print(given_train_data.head()) # Read given test file test_file_path = 'MACY_NEW.csv' given_test_data = pd....
true
07a2633a4aa136e5e85cce1c42c4d6f2891832ec
ib619/Skillfactory_Python_Fullstack
/BATTLESHIPS/player.py
UTF-8
15,591
3.546875
4
[]
no_license
from abc import ABC, abstractmethod from ships import Ship, TwoSquareShip, ThreeSquareShip, OneSquareShip, ShipPositionError from field import Field from random import randint class Player(ABC): def __init__(self, my_field: Field, opponent_field: Field): self.my_field = my_field sel...
true
d60e276656ff5f1b8ae081f816d41e1916e11dd2
facuguerrero/TeoriaDeAlgoritmos
/TP1/ComponentesConexas/componentesConexas.py
UTF-8
1,711
3.015625
3
[]
no_license
from graph import Graph from lectorArchivos import LectorArchivos from kosaraju import Kosaraju import time GRAFO1 = "files/d1.txt" GRAFO2 = "files/d2.txt" GRAFO3 = "files/d3.txt" GRAFO4 = "files/d4.txt" GRAFO5 = "files/d5.txt" GRAFO6 = "files/d6.txt" def main(): lector = LectorArchivos() archivos = [GRAFO1,...
true
17fb6eefa9cde18bf809fe23fa496c384d417661
lr616731587/study_test
/Conterllor.py
UTF-8
4,110
3.078125
3
[]
no_license
import random import copy from projects_2048.Location import Location, Direction class Conterllor: def __init__(self): self.__list_merge = [] self.__list_empty_location = [] self.count = 0 self.is_change = False @property def is_change(self): return s...
true
e472cb91879a45fd511c5482c9ca6f97420e331a
adechan/School
/Undergrad/Third Year/Python/Lab07/PythonLab7.py
UTF-8
15,042
4.0625
4
[]
no_license
def greatest_common_divisor_2_numbers(a, b): while(b): a, b = b, a % b return a def greatest_common_divisor(*numbers): divisors = 0 a = numbers[0] for number in numbers[1:]: divisors = greatest_common_divisor_2_numbers(a, number) return divisors #print(greatest_common_div...
true
2369b3d1b98fd0798f62147f93da1e9fcaa576a6
AnandD007/Amazing-Python-Scripts
/Github-Automation/ignore.py
UTF-8
486
2.671875
3
[ "MIT" ]
permissive
import os cwd = os.getcwd() ignorepath = os.path.join(cwd, '.gitignore') def getIgnoreFiles(): ignorefiles = [] with open(ignorepath) as ignore: files = ignore.readlines() for file in files: file = ''.join(file.splitlines()) if (file != ''): filepath = ...
true
a834b9ccdf3f8d99cf72a86e3ee6372c43922a90
Soulmates2/dropFile
/preprocessing/preprocessing.py
UTF-8
17,612
2.796875
3
[]
no_license
# preprocessing code import os import re from pdfminer.high_level import extract_text import nltk from nltk.tokenize import word_tokenize, sent_tokenize from nltk.corpus import stopwords from nltk import pos_tag from nltk.stem import WordNetLemmatizer import numpy as np from nltk.corpus import wordnet as wn from nltk.p...
true
4f309f25ab9bd8720a6ae33bdbb72e5f1aad56f6
baby-wei/Alien_Invasion
/game_stats.py
UTF-8
990
2.875
3
[]
no_license
class GameStats(): """Track statistics for Alien Invasion""" def __init__(self, ai_settings): """Initialize statistics""" self.ai_settings = ai_settings self.reset_stats() self.last_high_score = self.open_high_score() #Start Alien Invasion in an inactive state self.game_active = False #High score shou...
true
dbb6990552772ceba23e9276c5e89ab1469eeadd
Vincannes/TradeFinance
/app/libs/widgets/label.py
UTF-8
637
2.734375
3
[ "MIT" ]
permissive
import webbrowser from PySide2 import QtWidgets, QtGui class LabelTitle(QtWidgets.QLabel): def __init__(self, link=None, size=20): super(LabelTitle, self).__init__() # self.font = "Marianne" self.fontDB = QtGui.QFontDatabase() self.fontDB.addApplicationFont(":/font/Marianne/fontes_...
true
5f06a64d386a2521519b27b69382793c537a3c22
jpc0016/Python-Examples
/Crash Course/ch9-Classes/electric-car.py
UTF-8
3,027
4.40625
4
[]
no_license
# CH9 Example # # electric-car.py # # Demonstration of a child class. A child class inherits attributes from the # parent class. The parent class must be within the same file as the child # class and appear before it. class Car(): """A simple attempt to represent a car""" # odometer_reading is an attribute t...
true
779d2c782ef2068ee84143066f73f9db83032102
daniel-reich/ubiquitous-fiesta
/sHJmjMcZPiCsEujk6_24.py
UTF-8
288
2.8125
3
[]
no_license
def pilish_string(s): pi, r, k = [int(d) for d in '314159265358979'], [], 0 for i in pi: r.append(s[k:k+i]) if s[k:k+i] else r k += i return '' if not r else ' '.join(r) if len(r[-1]) == pi[len(r)-1] \ else ' '.join(r[:-1]+[r[-1]+r[-1][-1]*(pi[len(r)-1]-len(r[-1]))])
true
8f3425f9c6345fe1fcc40ff30688f9f5e537b7d7
liang1213/San-Francisco-Crime-Classification
/Python_Code.py
UTF-8
3,018
2.796875
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import matplotlib.pyplot as plt import seaborn as sns train_data = pd.read_csv("../input/Police_Department_Incidents.csv") target = train_data["Category"].unique...
true
534791fa6176f6979c047aebb854fec46303501e
yosoyfunes/python
/Clase8/TCP.py
UTF-8
370
2.734375
3
[]
no_license
import socket HOST = '192.168.2.68' # Servidor de Lucas PORT = 65000 # Puerto del Servidor s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # s.sendto("Mensaje" ,(HOST, PORT)) s.bind(("0.0.0.0", PORT)) while True: msj = raw_input("escribe un mensaje: ") s.sendto(msj ,(HOST, PORT)) recibido...
true
d7c949fc140989b609741fbf110260b6e40a0e82
RemiliaForever/PicSpider
/mergeanime/merge.py
UTF-8
973
2.859375
3
[]
no_license
#!/bin/python3 from PIL import Image from PIL import PngImagePlugin # 循环打开原图片 images = [ '00000001.jpg', '00000002.jpg', '00000003.jpg', '00000004.jpg', '00000005.jpg', '00000006.jpg', '00000007.jpg', ] bitmaps = [] for i in images: bitmaps.append(Image.open(i)) # 创建目标图片 sample = bitm...
true
46d793b9205c2ad6b8975215aebb033ec7e9c9fc
johnyob/Algo-Crate
/python/algo_crate/util.py
UTF-8
267
3.03125
3
[]
no_license
DEFAULT_CMP = lambda x, y: 1 if x > y else (-1 if x < y else 0) def is_numeric(value): return isinstance(value, int) or isinstance(value, float) or isinstance(value, complex) def is_series(value): return isinstance(value, list) or isinstance(value, tuple)
true
a61fabcc69ce14eafe3404a5d9ec8c67bfbd34ca
marcellasiqueira/aplicacao_grafos
/atg8.py
UTF-8
814
3.59375
4
[]
no_license
# coding: utf-8 # Marcella Medeiros Siqueira Coutinho de Almeida # [ATG] Identifique o conceito 3 # Matrícula: 117110492 N = int(input()) # número de vértices do grafo grafo = {} # declara um Mapa vazio # para cada vez (de 0 até o número total de vértices), lê-se um vértice, as arestas e associa-se essas arestas ao ...
true
ac5a40aee502aaa3863d26eae2aa84e138a719e3
rajamundo/YelpBusinessFinder
/getCities.py
UTF-8
1,932
3.0625
3
[]
no_license
from bs4 import BeautifulSoup from math import floor from time import sleep import requests import googlemaps import io import json def soupItUp(URL): content = requests.get(URL) soup = BeautifulSoup(content.text, "lxml") return soup def losAngelesCities(): URL = "https://en.wikipedia.org/wiki/List_of_cities_in_...
true
3740d8552634fbeeb03321abe107f9ec69740b1e
ChrisLR/BasicDungeonRL
/bflib/items/weapons/melee/swords.py
UTF-8
954
2.53125
3
[ "MIT" ]
permissive
from bflib import dice, units from bflib.items import coins, listing from bflib.items.weapons.melee.base import MeleeWeapon from bflib.sizes import Size @listing.register_type class Sword(MeleeWeapon): pass @listing.register_item class Shortsword(Sword): name = "Shortsword" melee_damage = dice.D6(1) ...
true
a4881f81c67475e3743b1d2bf2bf90cf99742b76
pedrodedin/Neutrino-Collective-Effects
/Auxiliar_Functions.py
UTF-8
7,317
2.578125
3
[ "MIT" ]
permissive
import numpy as np from scipy.special import gamma import math ############# Constants ######################################## G_F=1.1663787*10**(-23) #eV⁻² - Fermi Constant delta_m2_31=2.5*10**(-3) #eV² - \Delta m²_31 delta_m2_21=7.53*10**(-5); #eV² theta_31=np.arcsin(math.sqrt(2.18*10**-2)) #\theta_31 theta_21=np....
true
62c69b761f59a773228ead60bbf21cc79edaf368
fangyuchu/MyLeetCode
/15. 3Sum.py
UTF-8
1,139
3.46875
3
[]
no_license
class Solution(object): def threeSum(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ nums.sort() two_sum=dict() for i in range(len(nums)): for j in range(i+1,len(nums)): key=nums[i]+nums[j] if two_...
true
88382a1cb0c0ba07e768f1c9aae48ea276d4e969
iWeslie/AlgorithmPlayground
/Python/Stack/list_queue.py
UTF-8
274
3.53125
4
[]
no_license
class ListQueue: def __init__(self): self.items = [] self.size = 0 def enqueue(self, data): self.items.insert(0, data) self.size += 1 def dequeue(self): data = self.items.pop() self.size -= 1 return data
true
99bbc3ddaef4334ee4a1b66497b3f10d36d0b6b0
mounui/python
/examples/btin_base64.py
UTF-8
424
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- import base64 def safe_base64_decode(s): if not isinstance(s, bytes): s = bytes(s, encoding='utf-8') num = 4 - len(s) % 4 s = s + bytes('=', encoding='utf-8') * num return base64.b64decode(s) # 测试: assert b'abcd' == safe_base64_decode('YWJjZA=='), safe_base64_decode('Y...
true
3d6af6da7b429f5046bfd40e53241e72f69cfa5f
songdanlee/python_code_basic
/day02/classAM/2my_code_eval2.py
UTF-8
29
2.640625
3
[]
no_license
s = "1+2+3.0" print(eval(s))
true
1b8cbd3bffbec55addbcccc43eea6997bfad6da5
jisuwudou/Python_learn
/media/douyin.py
UTF-8
7,048
3.0625
3
[]
no_license
# coding=utf-8 """ @author: jiajiknag 程序功能:批量下载抖音视频 """ import requests import bs4 import os import json import re import sys import time # 如果一个对象没有实现上下文,我们就不能把它用于with语句。这个时候,可以用closing()来把该对象变为上下文对象。 # closing-将任意对象变为上下文对象,并支持with语句。 from contextlib import closing # Urllib3是一个功能强大,条理清晰,用于HTTP客户端的Python库 # urllib3.disa...
true
34c7cd0e4fea792b336fcefaeb239cc172b3ae1a
csmith49/motifs
/scripts/evaluate/evaluate_frontier.py
UTF-8
1,319
2.71875
3
[]
no_license
import json, csv from argparse import ArgumentParser from analysis import Motif, ensemble_from_string, load_ground_truth, prc parser = ArgumentParser() parser.add_argument("--ground-truth", required=True) parser.add_argument("--image", required=True) parser.add_argument("--output", required=True) parser.add_argument("...
true
bd3758972d4589c2593ba792baac679968eea460
pankan3/DataMiningProject1
/myKNN.py
UTF-8
2,921
2.828125
3
[ "MIT" ]
permissive
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sat Apr 21 16:36:40 2018 @author: kalo-pc """ # -*- coding: utf-8 -*- """ Created on Sun Apr 15 16:11:36 2018 @author: giann """ import math from operator import itemgetter import numpy as np from sklearn.base import BaseEstimator, ClassifierMixin from ...
true
95cfd06387410e222a365c793e2c0056622639f7
zhuhaiqing42/Python_Training
/self dividing numbers.py
UTF-8
802
3.6875
4
[]
no_license
class Solution(object): def selfDividingNumbers(self, left, right): """ :type left: int :type right: int :rtype: List[int] """ def selfdividing(x): x_str = str(x) for each in x_str: if (each == '0' or x % int(each) !=0 ): ...
true
182fc5b676b4b1b6e036171569f42800b32fff4d
brotaku13/TestrApplication
/ApplicationFiles/MainWindow.py
UTF-8
5,627
2.609375
3
[]
no_license
from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from ApplicationFiles.TestrWidgets.CodingWindow import CodingWindow import ApplicationFiles.Resources.filepaths as path from ApplicationFiles.TestrWidgets.navigationPage import NavigationPage from ApplicationFiles.TestrWidgets.Glos...
true
d6a295238f7040075d8ec94b2dd192e81e854036
Immaculated/educational_basic
/07 lists/03 - abs.py
UTF-8
188
3.5
4
[]
no_license
starting_list = [i for i in range(-10, 11)] print('starting list: ' + str(starting_list)) new_list = [abs(number) for number in starting_list] print('ending abs list: ' + str(new_list))
true
e527558cbf42632bac75b297a8b50fcccfdb4a60
madsbk/NVTabular
/nvtabular/ops/fill.py
UTF-8
3,665
2.5625
3
[ "Apache-2.0" ]
permissive
# # Copyright (c) 2020, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
true
248ca23a79aff92896b9b8697382ca8a5a551155
svisho1983/ArrowUpdate
/arrow2.py
UTF-8
13,095
3.09375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # Імпортуємо бібліотеку pygame import pygame from pygame import * from random import * import sys from sys import * # створюємо загальний екран window = pygame.display.set_mode((600, 630)) # завантажуєм космічний фон bg = pygame.image.load("space.jpg") # з...
true
1118e8abc177095ecafefeb57301abbe4811cb40
sheldonzhao/LeetCodeFighting
/89. Gray Code.py
UTF-8
989
4
4
[]
no_license
''' The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0. For example, given n = 2, return [0,1,3,2]. Its gray code sequence...
true
a4aa14938c0e133c54dad2f7216c6a29268657a7
seunghee63/study_web_python
/web_practice_python/1st_week/SelectionSort.py
UTF-8
369
3.453125
3
[]
no_license
list = [ 7, 4, 5, 3, 1] round = 1 while round < len(list): min = list[round-1] i = round while i < len(list): if min > list[i]: min = list[i] min_index = i i+=1 tmp = list[round-1] list[round-1] = min list[min_index] = tmp print(round , "round : "...
true
7004c217fce558ce2242233b1658b6f64c1d2a08
RSsquare-coder/Connect_4_Game
/Connect4Game.py
UTF-8
5,046
3.75
4
[]
no_license
#traditional board size (6*7) r = 6 #Row c = 7 #Column p = 4 #Pieces to connect #but we will also support (r*c) board with connecting p pieces while True: try: r, c, p = input("Enter the values of Row, Column and Pieces: ").split() r, c, p = int(r), int(c), int(p) ex...
true