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
d4a26f64885943d705dd963b8c637e7d4b2a9b35
mharouni/Sorting
/heaps.py
UTF-8
671
3.4375
3
[]
no_license
#!/usr/bin/python import time def heapify(arr=[1,2,3,4,5,6,7,8],n=8,i=8): largest = i l = 2 * i +1 r = 2 * i +2 if l < n and arr[i] < arr[l]: largest = l if r < n and arr[largest] < arr [r]: largest = r if largest != i: arr[i],arr[largest]= arr[largest],arr[i] heapify(arr, n, largest) return arr def b...
true
42eb6ca84235dc4b7d86e896b21c19017f9ee058
therohitsingh/CODE
/codeblocks/Assignment1&Asignment2/halfpyrami.py
UTF-8
175
3.21875
3
[]
no_license
def pyprt(n): for i in range(0,n): for j in range(0,i+1): print(j+1,end="") print("\r") n = 5 pyprt(n)
true
c4dca5e943f136aee44b0bdcd937d6cc0e4b065a
MaximTiberiu/Google-Python-Course
/week04/functii.py
UTF-8
1,124
3.65625
4
[]
no_license
# def my_function(a, b, c): # # blocul functiei # # pass # return a + b + c # # # # variabila = my_function(1, 2) # variabila = my_function(a=1, b=2, c=3) # variabila2 = my_function(1, 2, c=3) # print(variabila) # print(variabila2) # # # -- functie cu parametri default -- # # # def my_default_function(a, b,...
true
bcdabf5e645ddcf7b09242f7359afe57d3df4bfc
yunakim2/Algorithm_Python
/카카오/2021 카카오 공채/4.py
UTF-8
2,172
2.984375
3
[]
no_license
def solution(n, info): answer = [] sum_list = [] def dfs(idx, win_lion, cnt): if idx == 11 and cnt == 0: if False not in visited: sums = 0 sums_peach = 0 for idx in range(len(info)): if info[idx] == 0 and win_lion[idx] ...
true
68c1c8a86aa81c580c9b76908414c636c70f42d0
fresnik/ikea-name-generator
/src/app.py
UTF-8
727
2.625
3
[]
no_license
from flask import Flask from flask import request from flask import Response import generate_name import json import os app = Flask(__name__) generate_name.initialize() @app.route('/name') def get_name(): count = min(50, int(request.args.get('count', 1))) max_length = int(request.args.get('max-length', 20))...
true
88b4e231e0045e8d48f6d848d35117e791fe61f0
caishiqing/super-slomo-tf2
/model.py
UTF-8
12,774
2.5625
3
[]
no_license
from tensorflow.python.ops import image_ops, array_ops from tensorflow.keras import layers import tensorflow_addons as tfa import tensorflow as tf class Encoder(layers.Layer): """ A class for creating neural network blocks containing layers: Average Pooling --> Convlution + Leaky ReLU --> Convolution...
true
37637b97a92112a1331675d3e6177d73685d2288
didinnuryahya/gundar-python
/filehello.py
UTF-8
52
2.625
3
[]
no_license
x = "python" if x == "python": print "Hello"+x
true
39a00dbd8d7c5dd5aa7fa8b31d7a3e67b06641e4
JudeDavis1/CS50-Coursework
/project2/heredity/heredity.py
UTF-8
8,222
3.328125
3
[]
no_license
import csv import itertools import sys import math PROBS = { # Unconditional probabilities for having gene "gene": { 2: 0.01, 1: 0.03, 0: 0.96 }, "trait": { # Probability of trait given two copies of gene 2: { True: 0.65, False: 0.35 ...
true
8d3382b43659c8616d0050db886ece0191eaffef
IpsumCapra/tincos01
/server/server.py
UTF-8
6,698
2.578125
3
[]
no_license
import socket import threading import json HOST = "" PORT = 9000 BUFSIZE = 1024 SCANRANGE = 100 messages = {} obstacles = [] targets = {} destinations = {"Sherman": [0, 4]} free = [[True for x in range(10)] for y in range(10)] dist = [[-1 for x in range(10)] for y in range(10)] locations = {} movements = {} clientCo...
true
6b66f7b600ab8e5a063c442ce06e0f73938b5188
adampehrson/Kattis
/venv/bin/EbAltoSaxophonePlayer.py
UTF-8
2,871
2.90625
3
[]
no_license
#Creating array: def checkpressed(fingers, presses, index): if not fingers[index]: fingers[index] = True presses[index] += 1 def press(fingers, presses, note): if note == 'c': for x in [2, 3, 4, 7, 8, 9, 10]: checkpressed(fingers, presses, x) for a in [1, 5, 6]: ...
true
5aba658a3190acf7cccbda830d3b3e29176f45ca
microsoft/Azure-Databricks-NYC-Taxi-Workshop
/code/01-Primer/pyspark/00-azure-storage/7-adlsgen2-primer.py
UTF-8
3,668
2.671875
3
[ "MIT" ]
permissive
# Databricks notebook source # MAGIC %md # MAGIC # ADLS gen 2 - primer # MAGIC Azure Data Lake Storage Gen2 combines the capabilities of two existing storage services: Azure Data Lake Storage Gen1 features, such as file system semantics, file-level security and scale are combined with low-cost, tiered storage, high ava...
true
9ff69b3215391e19a8c21abd91a0d72041d01a36
Amotica/Low-Cost-Plant-Phenotyping
/dataset_utils.py
UTF-8
16,529
2.578125
3
[]
no_license
import numpy as np import cv2 import os import parameters as para from keras.preprocessing.image import ImageDataGenerator from keras.utils import np_utils import glob import itertools import ntpath def prep_data_gen(images_path): image_paths = glob.glob(images_path + "0/" + "*.jpg") + glob.glob(images_path + "0...
true
6e42a985e0622816a68f680d8dbfc5e3def2240b
forzavitale/Data_Visualization
/Matplotlib/pie_charts_count/pie_charts_count.py
UTF-8
292
3.28125
3
[]
no_license
from pylab import * figure(1, figsize=(6,6)) ax = axes([0.1, 0.1, 0.8, 0.8]) labels = 'Spring', 'Summer', 'Autumn', 'Winter' x = [15, 30, 45, 10] explode=(0.1, 0.1, 0.1, 0.1) pie(x, explode=explode, labels=labels, autopct='%1.1f%%', startangle=67) title('Rainy days by season') show()
true
a1cb5fdda2c0f9c53109bd88a7e12c4a7b2a40d2
gilby125/paho-sqlalchemy
/source/Position.py
UTF-8
382
2.703125
3
[]
no_license
from sqlalchemy import Column, Integer, Float from Base import Base class Position(Base): __tablename__ = 'position' id = Column(Integer, primary_key = True) latitude = Column(Float) longitude = Column(Float) def __repr__(self): return "<Position(id='%d', latitude='%s', longitude=...
true
c8a529b8f4d471b3b00d4166a9a0ac95b69fee0d
saumye4696/codeforces-and-leetcode
/BubbleSort.py
UTF-8
373
3.734375
4
[]
no_license
def bubble(arr): for i in range(len(arr)): for j in range(len(arr) -i - 1): if(arr[j] > arr[j+1]): arr[j] , arr[j+1] = arr[j+1], arr[j] return arr # after every iteration, the next largest number will # be sent to the end in its correct position l1 = [9,6,4,3,6,4...
true
f21cc0f432a4c86dc1ea0a31ed4581aee9648ef0
vivekpandit/deeplearning-code
/class_imbalance.py
UTF-8
3,736
3
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[2]: import tensorflow as tf from tensorflow.keras.preprocessing.image import ImageDataGenerator import cv2 import imutils import matplotlib.pyplot as plt from os import listdir import time # Nicely formatted time string def hms_string(sec_elapsed): h = int(sec_ela...
true
398c3580841547f4a0ad9d8a967f75a92092cb72
OtavioLara/Snake-Pygame
/screen.py
UTF-8
1,341
3
3
[]
no_license
from pygame import Surface, draw, Color, display, image from game_scene import GameScene from pygame import Color from pygame import font import os class Screen: '''Draw actors in the scenes''' def __init__(self): self.scene = GameScene(Color(255,255,255)) self.display = display.set_mode((800, 6...
true
9ced055e58b33a8963879bf0e09854ae82217e45
wraithan/dashboard
/lib/cal.py
UTF-8
2,333
2.921875
3
[]
no_license
import json from datetime import datetime, timedelta from pprint import pprint import requests from dateutil.rrule import rrulestr from dateutil.tz import tzlocal from icalendar import Calendar def dt_cmp(unsafe_dt, other_dt): if not isinstance(unsafe_dt, datetime): other_dt = other_dt.date() elif no...
true
0cd0e54c4f7fd69efadb41c77e797ea3819670f3
aymanshub/Work_Log
/tasks.py
UTF-8
6,122
3.5625
4
[ "BSD-3-Clause" ]
permissive
""" tasks module defines the Task class """ import os import datetime import csv import params class Task: """ Task class and all it's attributes & methods: Task instance attributes: date, name, time_spent, notes Task methods: add_task_to_file delete_task_fr...
true
0d2dbcd3ca87d6a5d8219b995379a0519076aee8
paddyguan/flask_web
/pic_classify/keras-training-master/cnn_keras.py
UTF-8
3,923
2.515625
3
[]
no_license
#coding:utf8 import re import cv2 import os import numpy as np import cv2.cv as cv from keras.models import Sequential from keras.layers.advanced_activations import LeakyReLU from keras.layers.core import Dense,Dropout,Activation,Flatten from keras.layers.convolutional import Convolution2D,MaxPooling2D from keras.optim...
true
4f1be5660584596bf2f696b3aa0a05c04a948023
leehkl/roadtrip_GAE
/users.py
UTF-8
7,269
2.546875
3
[]
no_license
import webapp2 import json from google.appengine.ext import ndb from google.appengine.ext import blobstore import db_defs import re #Source code for this file was inspired by Wolford CS 496 lectures #actions on a user class User(webapp2.RequestHandler): #retrieves users def get(self, **kwargs): #check...
true
c70f532c599657b88bd3d6394aabda0322daecb1
kaisaryousuf/exim-rce-cve-2018-6789
/sploits/smtp.py
UTF-8
605
2.640625
3
[]
no_license
import base64 def _print_response(resp): print(resp.replace(b"\r\n", b"\n").decode("utf-8")) def EHLO(p, v): p.sendline(f"EHLO {v}".encode("utf-8")) _print_response(p.recvuntil(b"HELP")) def AUTH_PLAIN(p, v): p.sendline(f"AUTH PLAIN {v}".encode("utf-8")) _print_response(p.recvuntil(b"data")) ...
true
3f623a253bb50f5753b899de547970d936671974
FedeFiores95/Pildoras-Informaticas
/prueba excepciones 3.py
UTF-8
442
3.46875
3
[]
no_license
def evaluaEdad(edad): if edad<20: raise TypeError("No se permiten edades negativas.") #Con la funcion raise creamos nuestras propias excepciones if edad<20: return "Eres muy joven" elif edad<40: return "Eres joven" elif edad<65: return "Eres adulto" elif edad<100: return "cuidate..." try: print(evalua...
true
618a93c39b0ee1083087333ec39dc1c51950d456
dineshpullagura/PythonEx
/listComb.py
UTF-8
221
2.75
3
[]
no_license
def RecPermute(soFar,rest): if not rest: print soFar else: next=list(soFar) next.append(rest[0]) RecPermute(next,rest[1:]) #print next, rest[1:],soFar RecPermute(soFar,rest[1:]) RecPermute([],[1,2,3])
true
6963407c841534adfc37198cded5d308757444ff
usnistgov/core_json_app
/core_json_app/utils/json_utils.py
UTF-8
675
2.671875
3
[ "LicenseRef-scancode-public-domain" ]
permissive
""" JSON utils """ import json from jsonschema import validate, Draft7Validator from core_json_app.commons.exceptions import JSONError def validate_json_data(data, schema): """Validate JSON data against JSON schema Args: data: dict content schema: string content Returns: """ t...
true
22e41a69ce5b99042f576336fdeb23ed02e398dc
mslinklater/BlenderScripts
/ch2_visualise_4d.py
UTF-8
797
2.953125
3
[ "BSD-2-Clause" ]
permissive
import ut import csv import urllib.request ################### # Reading in Data # ################### # Read iris.csv from file repository url_str = 'http://blender.chrisconlan.com/iris.csv' iris_csv = urllib.request.urlopen(url_str) iris_ob = csv.reader(iris_csv.read().decode('utf-8').splitlines()) # Store header ...
true
885278e339be8d6e446f5a1c2e0361004da87ff6
jihainan/data-analysis-service
/dataAnalysis.py
UTF-8
4,488
2.9375
3
[]
no_license
import pylab from flask import Flask, jsonify, escape, request import requests as http_request # kalman algorithm params x = 0 p = 0.5 r = 0.4 cycle = 0 lastMsg = 0 angle = [] angle_filter = [] # command url command_url = 'http://127.0.0.1:48082/api/v1/device/a7754a90-599f-47ac-a8a6-209505dd7220/command/d57fc15c-87a...
true
d81bd4782a33974f932bd3e001cb08639c91fa19
picrin/naturalSelectionNightly
/printGraph.py
UTF-8
779
2.515625
3
[]
no_license
import sys import naturalSelection as ns import networkx as nx import matplotlib.pyplot as plt if len(sys.argv) < 2: print("usage is: " + sys.argv[0] + " <graphFilename>") sys.exit(1) with open(sys.argv[1]) as f: simulation = ns.loadGraph(f) nx.draw_networkx(simulation['graph']) print(ns.MRCA(simulation)) ...
true
3644749e7ab223970c25167d6debd84c24400b9f
jmshoun/ZeroGee
/config.py
UTF-8
1,123
2.796875
3
[]
no_license
import pygame import yaml def read_config_section(section, filename="config.yaml"): with open(filename, "r") as file: config = yaml.load(file) return config[section] class DisplaySettings(object): def __init__(self, filename="config.yaml"): config = read_config_section("display", filenam...
true
65f69e44fc86caa224d7495d986313248e08e53a
stiguer/projweb
/weatherc.py
UTF-8
1,470
3.109375
3
[]
no_license
from urllib.request import urlopen import bs4 import xmltodict import pprint import json class WebClient(object): """WebClient class""" def __init__(self): super(WebClient, self).__init__() def download_page(arg): # connect to the web site f = urlopen("https://api.openweathermap....
true
038579f7f86ae6c3d4422dba130706471b46fa6f
avengerryan/daily_practice_codes
/eight_sept/programiz_builtin_funcs/python_help.py
UTF-8
221
3.53125
4
[]
no_license
# Python help() : invokes the built in help system # Next: Do the below programming codes in the terminal window. # >>> help(list) # >>> help(dict) # >>> help(print) # >>> help([1, 2, 3])
true
fb4c795ad23937e4cb25c39bb4e4b1281e83151e
watemerald/pytest_dl
/pytest_dl/trainer.py
UTF-8
3,757
2.71875
3
[ "MIT" ]
permissive
import os import torch import torch.nn.functional as F import tqdm from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter class Trainer: def __init__( self, model, data, optimizer, batch_size, device, log_dir="./results", ...
true
c6af0bae5289fb002682a4499803e9d1d614c4df
alexsotocx/coursera
/Algorithms/data_structures/basic_data_structures/tree/tree.py
UTF-8
914
3.484375
3
[]
no_license
# python3 import sys, threading sys.setrecursionlimit(10**8) # max depth of recursion threading.stack_size(2**30) # new thread will get stack of such size class TreeHeight: def read(self): self.n = int(sys.stdin.readline()) parents = list(map(int, sys.stdin.readline().split())) self.nodes = [[] for x i...
true
817c6449dd5a35e701954f8cfe251c729e8e8e4c
prompt-toolkit/python-prompt-toolkit
/examples/gevent-get-input.py
UTF-8
686
3.140625
3
[ "BSD-3-Clause" ]
permissive
#!/usr/bin/env python """ For testing: test to make sure that everything still works when gevent monkey patches are applied. """ from gevent.monkey import patch_all from prompt_toolkit.eventloop.defaults import create_event_loop from prompt_toolkit.shortcuts import PromptSession if __name__ == "__main__": # Apply...
true
647031a2ed3cf57042b7def7d0805ba3ffe5edb1
DmitryBol/reel
/FrontEnd/moments.py
UTF-8
1,691
3.1875
3
[]
no_license
# xi - random variable, equals payment for combination # eta - random variable, equals the number of freespins given for combination # zeta - random variable, equals payment for freespin def Exi2(self, width, lines): s = 0 for str_with_count in self.simple_num_comb: string = str_with_count[0] ...
true
59d4e70c26607070b8d3a48642da04ddbabbe7d1
jcharra/meowbg
/meowbg/core/move.py
UTF-8
671
3.265625
3
[]
no_license
import logging logger = logging.getLogger("Move") class PartialMove(object): def __init__(self, origin, target): self.origin = origin # keep inside the usual boundaries self.target = min(max(target, -1), 24) def __eq__(self, obj): try: return (self.origin == obj.or...
true
a66f84b370ff5070c4637f6b08bc22d7f92471db
shifalik/practice
/shifali/test37.py
UTF-8
299
3.359375
3
[]
no_license
''' Created on Jan 30, 2018 @author: shifa ''' #numbers #number objects var1 = 1 var2 = 10 var_a = 3 var_b = 4 #delete reference to number object #can delete a single object or multiple del var1 del var_a, var_b #hexadecimal number = 0xA0F print(number) #octal number1 = 0o37 print(number1)
true
61b80f12f37d1258090ae4084dc12b4c4d206fd0
vyraun/subsets
/subsets/L2X/imdb_sent/make_data.py
UTF-8
4,651
2.859375
3
[]
no_license
""" Modified based on the code of Richard Liao at https://github.com/richliao/textClassifier """ from __future__ import print_function import numpy as np import pickle as pkl from collections import defaultdict import re from nltk import tokenize from bs4 import BeautifulSoup import pandas as pd import sys import os i...
true
924a5169601acfd998f2cc36e75b05fbd5934ef6
KEClaytor/YAYTracker
/main.py
UTF-8
4,060
3.03125
3
[ "MIT" ]
permissive
""" Tracker for activity. """ import time import board import random import digitalio import displayio import terminalio from adafruit_display_text import label import adafruit_displayio_ssd1306 import button displayio.release_displays() i2c = board.I2C() display_bus = displayio.I2CDisplay(i2c, device_address=0x3C)...
true
a9f8128ce8ea9444e14be4024bb39c2fa35a8624
m-aykurt/ITF-008-CLARUSWAY
/1-Python/Sadık turan/3-Operatörler/comparison-operators-uygulama.py
UTF-8
590
3.65625
4
[]
no_license
""" x1 = int(input("x1 sayisini giriniz")) x2 = int(input("x2 sayisini giriniz")) sonuc = (x1 > x2) """ not1 = float(input("1.sınav notunu giriniz: ")) final = float(input("final : ")) ortalama = (((not1 + not2)/2) * 0.6 ) + (final * 0.4) sonuc = (ortalama > 50) print(f"{ortalama} ile gecti. : {sonuc}") ""...
true
d6f0d9c847f8f78c1683d70a8c8f0060817eb6db
baiyecha404/crypto_experiment
/crypto_experiment1/hill_cipher.py
UTF-8
2,046
3.40625
3
[]
no_license
# coding: utf-8 # -**- author: byc_404 -**- import string import numpy as np from sympy import Matrix from collections import Counter char_list = string.ascii_lowercase key = np.mat([[10, 5, 12, 0, 0], [3, 14, 21, 0, 0], [8, 9, 11, 0, 0], [0, 0, 0, 11, 8], [0, 0, 0, 3, 7]]) key_matrix = Matrix(key) reverse_key_matrix...
true
10355e5930c3ff26bd6a3b64f63949e390bb2436
carden-code/python
/stepik/euclidean_distance.py
UTF-8
457
4.3125
4
[]
no_license
# Write a program that determines the Euclidean distance between two points whose coordinates are given. # # Input data format # The program is fed four real numbers, each on a separate line - x_1, y_1, x_2, y_2 # # Output data format # The program should output one number - the Euclidean distance. from math import sqr...
true
1d4319cb72fe418f04da0da5214e1456a55a95ec
macabdul9/BloomNet
/models/baselines/Seq2SeqAttn.py
UTF-8
4,058
2.734375
3
[ "MIT" ]
permissive
# model.py # Source: https://github.com/AnubhavGupta3377/Text-Classification-Models-Pytorch/edit/master/Model_Seq2Seq_Attention/model.py import torch from torch import nn import numpy as np from torch.nn import functional as F from utils import * class Seq2SeqAttnClassifier(nn.Module): def __init__(self, vocab_s...
true
0618ed18da68e64e2b69ae80e0445b3d59b7cd02
marokazu/my_reserch
/agent.py
UTF-8
5,991
2.78125
3
[]
no_license
from simulation import Simulation import random import numpy as np from culCij import culcCij import statistics import matplotlib.pyplot as plt import matplotlib.animation as animation # import histAni np.set_printoptions(precision=3) np.set_printoptions(threshold=np.inf) class Agent: def __init__(self, index): ...
true
cb350145651b7aaee067695373b7873421d32d85
pf4d/bullet_drag
/simulations/556_rounds.py
UTF-8
1,847
2.828125
3
[]
no_license
import sys src_directory = '../' sys.path.append(src_directory) from src.Cartridge import * from src.Ballistics import * from src.functions import * from numpy import array import src.model # Initial Conditions name = 'XM193 5.56x45 mm 55 grain bullet' mass = 55 mv = ft_to_m(3310) caliber = 0.22...
true
79823082c65644356e20846ffc2de026262c5bed
juanegido/PyQt-Example
/test3.py
UTF-8
951
2.96875
3
[]
no_license
from PyQt5 import QtWidgets import sys class PegGameWindow(QtWidgets.QWidget): def __init__(self): QtWidgets.QWidget.__init__(self) self.setup() def setup(self): self.setGeometry(200, 200, 400, 200) self.setWindowTitle('Triangle Peg Game') self.setToolTip("Play the tri...
true
7d1170c00e40d96c71b5fcdf713399bf22808ef6
joegillon/bluestreets
/tests/models/test_address.py
UTF-8
11,993
2.6875
3
[]
no_license
import unittest from models.address import Address class TestAddress(unittest.TestCase): def test_init(self): d = {'address': '1527 S. Allison St.'} addr = Address(d) self.assertEqual('1527', addr.house_number) self.assertEqual('S', addr.pre_direction) self.assertEqual('AL...
true
c8d3da2541b466dcf9e110c1439736e6f8c35759
ninini976/yf_leetcode_problems
/338.py
UTF-8
381
3.40625
3
[]
no_license
# i&(i-1) will remove the right most bit 1 in the binary number i # right most bit "1" of i will change to "0" after the operation i&(i-1) class Solution(object): def countBits(self, num): """ :type num: int :rtype: List[int] """ res = [0]*(num+1) for i in range(1,nu...
true
b028a30b76ecf947d5db572a0a4e4b6ac7cfaf00
0xSenpai/eZ3jny_leen_Tdarbny
/mailsender.py
UTF-8
6,687
2.65625
3
[]
no_license
import time import smtplib from os.path import basename from email.mime.text import MIMEText from email.mime.base import MIMEBase from email.mime.multipart import MIMEMultipart from email import encoders import mimetypes def send_mail(mail, CV, letter): # mail text content if check == 'y': mail_c...
true
439756e0e4d91a5f79242621149cf7766eb181a4
Jercer/EuroTruckAutopilot
/perspective_transform.py
UTF-8
2,197
2.890625
3
[ "MIT" ]
permissive
import cv2 import keyboard import numpy as np import image_process a = 20 b = 40 c = 60 d = -70 def perspective_transform(window): global a, b, c, d window_resized = cv2.resize(window, (640, 360)) original_resized = window_resized.copy() # Remove upper half of image cropped_window = window_res...
true
e5624d117b79de7c0a93e2df3d57e67957cfc054
izham-sugita/python3-tutorial
/py-while.py
UTF-8
83
3.0625
3
[]
no_license
i=1 while i<6: print(i) i +=1 i=1 while i<6: print(i) if i==4: break i +=1
true
27ba79e71c6f8efaa27865f94400cdb36859758d
VitBomm/CSC
/Module1/Bai3/3_4.py
UTF-8
557
3.3125
3
[]
no_license
''' Created on Feb 2, 2017 Trung Tam Tin Hoc - DH KHTN ''' x = 10 y = 4 print('x = %d, y = %d'%(x,y)) equivelence = x==y print('x==y is', equivelence) # equivelence = False equivelence = x!=y print('x!=y is', equivelence) # equivelence = True equivelence = x>y print('x>y is', equivelence) # equivelence = True x = 8...
true
80df1ede0f29dcc1d9c06f1877f0ac6d430ee81a
weishaodaren/ShamGod
/Basic/staticmethod.py
UTF-8
741
4.21875
4
[ "MIT" ]
permissive
from math import sqrt class Triangle(object): def __init__(self, a, b, c): self._a = a self._b = b self._c = c @staticmethod def is_valid(a, b, c): return a + b and b + c > a and a + c > b def perimeter(self): return self._a + self._b + self._c def area(s...
true
6bd284e66cf0d6c2dbccf39615bd4cc589b24dbb
erikac613/CodewarsKata
/Difference of Volumes of Cuboids.py
UTF-8
137
3.078125
3
[]
no_license
def find_difference(a, b): volume_a = a[0] * a[1] * a[2] volume_b = b[0] * b[1] * b[2] return abs(volume_a - volume_b)
true
d41d7ce938fee60ad03d8248f3d8d025d9e20c38
murdockhou/MultiPoseNet-tensorflow
/keypoint_subnet/src/convert_tfrecord.py
UTF-8
3,681
2.5625
3
[]
no_license
# encoding: utf-8 ''' @author: shiwei hou @contact: murdockhou@gmail.com @software: PyCharm @file: convert_tfrecord.py.py @time: 18-9-28 下午6:50 ''' import os, cv2 import numpy as np import tensorflow as tf FLAGS = tf.flags.FLAGS tf.flags.DEFINE_string(name='image_dir', default='/media/ulsee/E/datasets/test2', ...
true
14cf3bfad20554028e98f4b8e309b8fd7837c766
Toolchefs/kiko
/kiko/python/kiko/core/entity/handlers/chunkhandler.py
UTF-8
2,302
2.578125
3
[ "MIT" ]
permissive
# ============================================================================== # # KIKO is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later...
true
69cd536bf4731b9fd73ab9842c832c39ec396604
allanpitter/dock
/dock15.py
UTF-8
1,116
3.359375
3
[]
no_license
''' dock15.py - arquivos csv (arquivo com delimitadores) dados.csv Nome, Sobrenome, Vendas Pedro, Silva, 3000 Maria, dos Santos, 5000 Ana, Maria, 8000 ''' # criar um arquivo exemplo nome dados.csv ''' arquivo = open('dados.csv','w') arquivo.writelines('Nome, Sobrenome, Vendas\n') arquivo.writelines('Pedro, Silva, 3000\...
true
294f1b230ec3731a9c08d2ad21059bb5790e1353
EEVV/jiftc
/src/parser/node/__init__.py
UTF-8
10,394
3.25
3
[ "MIT" ]
permissive
class Node: def __init__(self, tokens, nodes = None): self.tokens = tokens self.nodes = nodes class NumNode(Node): # self.tokens[0] -> token def __init__(self, tokens): super().__init__(tokens) def __str__(self): return "({})".format(self.tokens[0].value) def __repr__(self): return "NumNode(\n{})".f...
true
19db738fdf3853c04b4d0980ff358dcb99145174
wz139704646/FinancialRobot
/FinancialRobot/app/utils/crawler.py
UTF-8
2,992
2.953125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import urllib.request from bs4 import BeautifulSoup import re def helper(string, we_want): if we_want == '唯一一个小数': # 用来提取字符串中的唯一一个小数,局限性在于99,897,100这样的数字识别不了 return re.search("-?\d+(\.\d+)?", string).group() elif we_want == '所有汉字': # 汉字的范围为...
true
aa8f9df454a9ffb2deaee7af0194f164d4097784
AdriandersonLira/APE
/Lista_de_Exercício_06/ex008.py
UTF-8
187
3.75
4
[]
no_license
massa = float(input('Digite a quantidade de massa: ')) tempo = 0 while massa >= 0.5: tempo += 50 massa /= 2 print(f'{tempo} segundos para a massa se tornar menor que 0,5g')
true
80ad43c4c3404d05be460aa6ef42737bd32bd488
royalmustard/NicerDicerDnD
/Prob.py
UTF-8
391
3.296875
3
[]
no_license
def hitChance(ac, bonus=0, state="n"): if state not in ["n", "a", "d"]: print("Please enter valid state!") return pr = (20+bonus-ac)/20 chance = 0 if state == "n": chance = pr elif state == "a": chance = 2*pr-pr**2 else: chance = pr**2 print("Hit chanc...
true
74ba9de09faaa91d8aa28900ec2db5f4e9fd0e6c
767472021/face-recognition
/webcam/take_photos.py
UTF-8
3,376
3.15625
3
[ "Apache-2.0" ]
permissive
#!/usr/bin/env python3 ################## # take_photos.py # ################## import cv2 import numpy as np from imutils.video import VideoStream from imutils import resize import os def take_photos(photos_path): ''' Take photos from a camera. User is required to press SPACEBAR to take photos A...
true
74ef3d6c314870e9a1b7c918739c53c883362084
SergioDiaz90/holberton-system_engineering-devops
/0x15-api/3-dictionary_of_list_of_dictionaries.py
UTF-8
817
2.84375
3
[]
no_license
#!/usr/bin/python3 '''This script for obtain info about users in tha API''' import json import requests from sys import argv if __name__ == '__main__': URL = 'https://jsonplaceholder.typicode.com' name = requests.get(URL + '/users/').json() new_dict = {} obj_j = {} for user in name: un = ...
true
4e4139bc4ae1c4395e34cc1a0df78127c47a37ef
paulinasosnowska/PiPGiS-zadanie-1
/zad1-gotowe.py
UTF-8
391
3.65625
4
[]
no_license
""" Projektowanie i Programowanie w GiS - zadanie 1 Paulina Sosnowska grupa 4, GiK I MSU Zadanie 1 - "Fizz Buzz" """ def fizz_buzz(n): liczby = range(1,n) for i in liczby: if i%3 == 0 and i%5 == 0: print "Fizz Buzz" elif i%5 == 0: print "Buzz" elif i%3 == 0: ...
true
9f19c7e4f7079208c05d483a08756d06d2421337
jung9156/studies
/lecture/algorithm/problem/1210.Ladder1.py
UTF-8
646
2.71875
3
[]
no_license
for ir in range(10): n = int(input()) a = [list(map(int, input().split()))for iii in range(100)] a2 = a[-1] ed = a2.index(2) i = 98 j = ed while True: if i == 0: print('#{} {}'.format(n, j)) break if j-1 >= 0 and a[i][j-1] == 1: while True...
true
831cd1ddadcf6bbae2a94470242b8dd01eee5439
bossjoker1/algorithm
/pythonAlgorithm/Practice/5981分组得分最高的所有下标.py
UTF-8
539
2.765625
3
[]
no_license
# 278周赛 2 class Solution: def maxScoreIndices(self, nums: List[int]) -> List[int]: n = len(nums) pre = [0] * (n+1) for i in range(n): pre[i+1] = pre[i] + nums[i] maxv, res = -1, [] for p in range(n+1): temp = pre[n] - pre[p] if p - 1 >= 0: ...
true
b107c1bc6a08eff14b7403faf06ee90b3e819ab1
rczajkowski/flask-django-docker
/web/tests/features/steps/bdd_test.py
UTF-8
775
2.53125
3
[]
no_license
from behave import * @when('Im on {url}') def step_impl(context, url): context.browser.visit(url) @when('I fill username field {u_field} with {value}') def step_impl(context, u_field, value): username_field = context.browser.find_by_id('id_'+u_field) username_field.send_keys(value) @when('I fill password...
true
0ca0f89826e937be6d941377387973e43433a6c8
yichen123/Algorithm_p0
/Task3.py
UTF-8
2,706
4.03125
4
[]
no_license
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 3: (080) is the area code for fixe...
true
ba5342a8ad85000fd16d8717978fe82c6ece8a35
kavya-shah123/Local-Gym
/code.py
UTF-8
4,162
2.9375
3
[]
no_license
import mysql.connector db=mysql.connector.connect(host="localhost",user="root",password="root") cur=db.cursor() def insert(): trainerid=int(input("Enter Trainer ID : ")) tname=input("Enter Trainer Name : ") contact=input("Enter Trainer Phone Number : ") workingdays=int(input("Enter Number of Wo...
true
c2f28866b2bfa54028ba73d930a790124b8b8d9f
LotusChing/Py
/practice/server.py
UTF-8
885
2.609375
3
[]
no_license
# coding:utf8 __author__ = 'LotusChing' from socketserver import BaseRequestHandler, TCPServer import subprocess class EchoHandler(BaseRequestHandler): def handle(self): print('Got connection from {}'.format(self.client_address)) while True: cmd = self.request.recv(8192) ...
true
3dc985be75a4ce0b54540df2bacc47839680c6ad
MikeTTTT/webSpider
/lagouJob.py
UTF-8
2,747
2.640625
3
[]
no_license
import time import requests import re import xlwt url = "https://www.lagou.com/jobs/positionAjax.json?city=%E5%B9%BF%E5%B7%9E&needAddtionalResult=false" headers = {"Host": "www.lagou.com", "Referer": "https://www.lagou.com/jobs/list_%E7%88%AC%E8%99%AB?city=%E5%B9%BF%E5%B7%9E&cl=false&fromSearch=true&label...
true
5056a55a9c4b82a93e80f3f1ad0cdc3576626541
fabriciolelis/python_studying
/Curso em Video/ex057.py
UTF-8
83
3.71875
4
[]
no_license
sexo = ' ' while sexo not in "MmFf": sexo = input('Informe seu sexo: [M/F]: ')
true
d47a4e05689a9880a0e7cc4d1af1e6a78f22946d
Yosolita1978/Exercises_Hackbright
/word_count.py
UTF-8
867
3.75
4
[]
no_license
# put your code here. import sys def count_words(filename): """Returns dictionary with words as keys, and word count as value""" data = open(filename) word_count = {} for line in data: string = line.rstrip() words = string.split(" ") for word in words: clean_word ...
true
be790871f7e9a9f9763c7865199e6a3ebeef1d60
elango-ux/CodeTrainingProject
/Python/generatorexpression.py
UTF-8
475
3.984375
4
[]
no_license
# display even number using list comprehension evennumber = [x * 2 for x in range(10)] print(evennumber) # generator object or expression take less memory values = (x * 2 for x in range(10)) #it show output generator object so we shold loop to get output print(values) for x in values: print(x) # get siz of generat...
true
8f234c8247813a3ae38a733a7435a2192f84d2a8
sk881901/pythonPractice
/writingIdomatic.py
UTF-8
2,108
4.21875
4
[]
no_license
# /pythonPractice/writingIdomatic.py # -*- coding: UTF-8 -*- from __future__ import print_function print("\n--Let's Practice!--\n") # Notes: When using 'if' statements do the error checking FIRST, then have the code that supposed to run normally, # This lets a reader easily skip to what should happen. ...
true
a871b52cbd0afefbf26d0ef2c6f2c3122ce543b4
joelwitherspoon/PythonCrashCourse
/data_visualization/dice16_visual.py
UTF-8
855
3.59375
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Mar 2 15:06:47 2020 @author: jwitherspoon """ from die import Die import pygal #create a D6 die1 = Die() die10 = Die(10) #make some rolls and store rolls in list results = [] for roll_num in range(50000): result = die1.roll() + die10.roll() results.append(result) ...
true
ba964785c7348b6a94610d7717c7e49328446fb5
bopopescu/APITutorialSearch
/venv/Lib/site-packages/sekg/graph/creator.py
UTF-8
1,778
2.921875
3
[]
no_license
from py2neo import Node class NodeBuilder: """ a builder for Node """ def __init__(self): self.labels = [] self.property_dict = {} def add_labels(self, *labels): """ add labels for Node :param labels: all labels need to be added :return: a NodeBuil...
true
ec772b9ef004c3694faa0f8f9127936614a6db5e
fjsaca2001/proyectosPersonales
/python/ejercicio3.py
UTF-8
475
4.03125
4
[]
no_license
# Declaracion de variables b = True clave1 = '' clave2 = '' # Ciclo para velidar el ingreso de la clave que sea mayoa a 6 digitos while b: clave = int(input("Ingrese su clave maestra: ")) if len(str(clave)) >= 6: b = False # Ciclo para validar la clave 1 y 2 en base a si es numero par o impar for x in str(clave): ...
true
50a4b0ec7f198a9335348674b43f78d0f0818214
Fusilladin/TestEnumerate
/Test-Enumerate.py
UTF-8
184
3.953125
4
[]
no_license
groceries = ['roast beef', 'cucumbers', 'lettuce', 'peanut butter', 'bread', 'dog food'] for index, item in enumerate(groceries, 1): print(f'{index}. {item}') index+=1
true
dc32a377a5369f5e6ee0707af8d3c24633a0d1dd
cleverer123/Algorithm
/动态规划/leetcode_674_Longest_Continuous_Increasing_Subsequence.py
UTF-8
376
3
3
[]
no_license
class Solution(object): def findLengthOfLCIS(self, nums): """ :type nums: List[int] :rtype: int """ dist = [1] * len(nums) res = 0 for i in range(1, len(nums)): if nums[i] > nums[i-1]: dist[i] = dist[i-1] + 1 if dist[i] ...
true
6e44a35525cb1049c2796cf3471bd3f06b7d31f6
gilberto-009199/MyPython
/Tec.Program.I/ACS/3 AC/3/main.py
UTF-8
231
3.25
3
[]
no_license
DIAS = 7 diasCompridos = 0; media = 0; for index in range(0, DIAS): cartas = int(input()); media += cartas; if cartas >= 100 : diasCompridos += 1; print( diasCompridos ); print( "%0.0f" % (media / DIAS) );
true
ff9a281722357ca3299825f89dce705e8a65a488
SagnikDev/Infytq-Programme-Codes
/Data Structure/assignment_20.py
UTF-8
3,373
3.921875
4
[]
no_license
#DSA-Assgn-20 #Implement Item class here class Item: def __init__(self,item_name,author_name,published_year): self.__item_name=item_name self.__author_name=author_name self.__published_year=published_year def get_author_name(self): return self.__author_name def get_item_name...
true
d43dc48e1baf5e8eb475c256adeb6da1087917c8
ins-amu/BVEP
/SBI/BVEP_stat_summary.py
UTF-8
26,588
2.515625
3
[]
no_license
#!/usr/bin/env python3 """ @author: meysamhashemi INS Marseille """ import os import sys import numpy as np import scipy as scp from scipy import signal from scipy.signal import hilbert from scipy.signal import savgol_filter from scipy.signal import find_peaks from scipy import stats as spstats from scipy.stats im...
true
572ab4312572cc544ac56281d8fa376e975c0946
vvspearlvvs/CodingTest
/2.프로그래머스lv2/파일명정렬/solition1.py
UTF-8
1,428
3.328125
3
[]
no_license
from collections import defaultdict def solution(files): tmp = [] filedict=defaultdict(list) HEAD, NUM, TAIL = '', '', '' for file in files: for i in range(len(file)): if file[i].isdigit(): # 숫자가 나오면 그 이전은 무조건 HEAD, 이후는 NUMBER, TAIL로 다시 구분 HEAD = file[:i] ...
true
ac108cb93c0b48cedd2ce0390fbef3771f1955a0
spacetime314/python3_ios
/extraPackages/matplotlib-3.0.2/examples/lines_bars_and_markers/scatter_star_poly.py
UTF-8
748
3.40625
3
[ "BSD-3-Clause" ]
permissive
""" ================= Scatter Star Poly ================= Create multiple scatter plots with different star symbols. """ import numpy as np import matplotlib.pyplot as plt # Fixing random state for reproducibility np.random.seed(19680801) x = np.random.rand(10) y = np.random.rand(10) z = np.sqrt(x**2 + y**2) plt....
true
149a45dc45d90f1926db29d16de78aad5e40823c
kdebski/book-python
/serialization-json/src/json-decoder-code.py
UTF-8
1,104
2.890625
3
[ "MIT" ]
permissive
import datetime import json DATA = """ { "astronaut":{ "date": "1923-11-18", "person": "jose.jimenez@nasa.gov" }, "flight": [ {"datetime": "1961-05-05T14:34:13.000Z", "action": "launch"}, {"datetime": "1961-05-05T14:49:35.000Z", "action": "landing"} ] } """ def make_d...
true
dd666c8894c228a35b3897069a3deb7168ade4e3
SpengeSec/CtfCryptoTool
/crypto/affine.py
UTF-8
1,072
2.609375
3
[]
no_license
import re name = "Affine" priority=10 prequisites=["affineKey"] def egcd(a, b): x,y, u,v = 0,1, 1,0 while a != 0: q, r = b//a, b%a m, n = x-u*q, y-v*q b,a, x,y, u,v = a,r, u,v, m,n gcd = b return gcd, x, y def modinv(a, m): gcd, x, y = egcd(a, m) if gcd != 1:...
true
c77631233d22eea6b5d31d5e3f7ed97eeefa6d2e
AlienWu2019/Alien-s-Code
/oj系统刷题/俄罗斯套娃.py
UTF-8
291
3.125
3
[]
no_license
n=int(input()) a=input() b=a.split() count=0 temp=0 for i in range(len(b)): for j in range(i,len(b)): b[j]=int(b[j]) b[i]=int(b[i]) if(b[j]<b[i]): temp=b[i] b[i]=b[j] b[j]=temp count=count+1 print(b) print(count)
true
b73bb159fcad5edefb0e7fbf5e37a1be5d756fe0
Anmol-Singh-Jaggi/Crypto
/Crypto/RSA/RSA.py
UTF-8
4,085
3.6875
4
[ "MIT" ]
permissive
import sys p1=0;p2=0 # p1 and p2 are the 2 primes... n=0;phi_n=0 # n = p1*p2 ; phi_n is the Euler Totient Function value of n... e=0;d=0 # e = Public Key exponent ; d = Private Key exponent # The list of all the allowed characters in the input message... alphabet="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq...
true
b5277321c033a363c80fba7b26a8a23bacddfe95
hros18/sri-vectorial
/src/query.py
UTF-8
967
2.640625
3
[]
no_license
from corpus import Corpus import math import re class Query: def __init__(self, idx=-1, words=""): self.idx = idx self.words = words self.tokens = [] self.terms = {} self.lemmas = set() self.stemms = set() self.vector = [] self.max_l = 1 def toke...
true
3e04a391c353d7668bb5e21c7824f92ca8a6c3f8
Sujay-M/MachineLearning
/SupervisedLearning/code/neuralNetworks.py
UTF-8
2,084
2.78125
3
[]
no_license
import numpy as np class NeuralNetwork: def __init__(self,name,nFeatures,nHiddenLayers,nParams,k,epsilon): self.nFeatures = [nFeatures]+nParams+[k] self.nHiddenLayers = nHiddenLayers self.k = k self.name = name self.theta = [(np.random.rand(self.nFeatures[i-1]+...
true
04ad812274ed784ded9e3e74d992294c0ec9fdd5
SteadBytes/study
/algorithms-data-structures-programs/notes/02/2-sorting-arrays/code/heap_sort.py
UTF-8
1,383
3.75
4
[]
no_license
from typing import List from hypothesis import given from hypothesis import strategies as st def sift(lst: List, start: int, end: int): """ Repair the min-heap property of a min heap between `lst[start:end]` by sifting down the root element into the correct place. """ root = start while True:...
true
a3abef0bf1d48c2abec075f98df5c7950b21b40f
Enokisan/AtCoder-History
/AtCoder/ABC212/C/C_ans.py
UTF-8
301
2.890625
3
[]
no_license
import bisect N, M = list(map(int, input().split())) A = list(map(int, input().split())) B = list(map(int, input().split())) A += [-2*10**9, 2*10**9] # 番兵で端の部分を考慮 A.sort() ans = 2*10**9 for x in B: i = bisect.bisect(A, x) ans = min([ans, x-A[i-1], A[i]-x]) print(ans)
true
59ad5637b98226e7eb972d3d12c37346b26a4a3e
cornellius-gp/gpytorch
/gpytorch/kernels/arc_kernel.py
UTF-8
7,380
3.109375
3
[ "MIT", "Python-2.0" ]
permissive
#!/usr/bin/env python3 from math import pi from typing import Callable, Optional import torch from ..constraints import Interval, Positive from ..priors import Prior from .kernel import Kernel class ArcKernel(Kernel): r""" Computes a covariance matrix based on the Arc Kernel (https://arxiv.org/abs/1409.401...
true
4a9729ba64525145e0e7c0f9bf5a850b13b3adef
spaceghost173/servosix-1
/python/examples/waggle.py
UTF-8
239
2.796875
3
[ "MIT" ]
permissive
from servosix import ServoSix import time ss = ServoSix() period = 0.5 try: while (True): ss.set_servo(1, 0) time.sleep(period) ss.set_servo(1, 180) time.sleep(period) finally: ss.cleanup()
true
e2e5f90788fe9d79f6a242c9ebfee9d1ea4b7789
barronwei/reddit-raop
/src/main.py
UTF-8
2,292
2.84375
3
[]
no_license
import numpy as np import scipy as sp import pandas as pd import seaborn as sb import textblob as tb file_name = "../data/pizza.json" data = pd.read_json(file_name) cols = data.columns """ Drop irrelevant columns """ keep_cols = [0, 1, 2, 5, 6, 8, 22, 25, 28, 29] data = data[cols[keep_cols]] """ Empty class """ ...
true
dcf1af035879d36a00a3921ea8306bcc9895734d
yrutis/suggesting-identifiers
/src/utils/config.py
UTF-8
780
2.703125
3
[]
no_license
import json import os from dotmap import DotMap import src.utils.path as path_file def get_config_from_json(json_file): """ Get the config from a json file :param json_file: :return: config(dictionary) """ # parse the configurations from the config json file provided with open(json_file, 'r...
true
6194a0596909b83c761f14d02e55420a5f12829e
Raghavkumarkakar252/Rasa-Chatbot
/conn.py
UTF-8
572
2.953125
3
[ "MIT" ]
permissive
import sqlite3 from openpyxl import load_workbook conn = sqlite3.connect('food.db') wb = load_workbook('food_menu.xlsx') ws = wb['items'] conn.execute("create table if not exists food_items (restaurant_name text, food text, price int)") for i in range(1,56): temp_str = "insert into food_items (restaura...
true
548f1c3ffc7814de1e6d746a481d881227d20713
vthorat1986/python-programs
/functions.py
UTF-8
576
4.34375
4
[]
no_license
#!/usr/bin/python # Pass by reference : value of the passed variable object changes def appendme(list): list.append([1, 2, 3, 4]) print('Printing list inside the function : ', list) return mylist = [10, 20, 30] appendme(mylist) print('Printing list outside the function : ', mylist) # Pass by referenc...
true
ee4da2d5996f8efb9f080674cf539b8286b47826
devashish9599/PythonPractice
/try.py
UTF-8
112
3.234375
3
[]
no_license
a=int(input("enter the number of your choice")) c=0 for i in range(0,a): z=a%10 x=a/10 c=c+1 print c
true