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
8608f26fc7a86737e5d44f7623280d40b9a7cb5b
Python
minhhienvo368/OOP_challenges
/3.python-pangram/pangram.py
UTF-8
652
3.828125
4
[]
no_license
# Write a program check if a string is a pangram import string import re def strip_punctuation(word: str) -> str: #eleminate puntuation function exclude = set(string.punctuation) word = ''.join(char for char in word if char not in exclude) return word def is_pangram(text: str) -> bool: text = re.sub(...
true
f9d83778c399eb21c1f778f236ea85c458e62d6a
Python
ZqLiu7/Yelp_Analytics
/text_preprocessing.py
UTF-8
2,054
3.09375
3
[]
no_license
from nltk.corpus import stopwords from nltk.stem import LancasterStemmer, WordNetLemmatizer from string import digits, punctuation from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn.svm import ...
true
3e40938b0f301b560b625043910f38c14c0f9227
Python
ChungJunn/word2vec
/cbow.py
UTF-8
4,543
3.015625
3
[]
no_license
''' implement CBOW model with KJV bible dataset code adopted from https://towardsdatascience.com/understanding-feature-engineering-part-4-deep-learning-methods-for-text-data-96c44370bbfa ''' from nltk.tokenize.simple import SpaceTokenizer from nltk.stem.porter import PorterStemmer from nltk.corpus import gutenberg f...
true
8032bd1c0c8e0adf90bf52635344ef922c8dfce0
Python
jackwillson642/Python
/asc.py
UTF-8
207
3.390625
3
[]
no_license
a = [9,6,5,3,2] t = 0 for i in range(0,4): for j in range(i+1,4): if a[i]>a[j]: t = a[i] a[i] = a[j] a[j] = t for k in range(0,5): print(a[k], end =',')
true
9e7ee24d7ebb344e8471555a613eddcd697b6266
Python
matteobarbera/AdventOfCode2019
/Tests/intcode_test.py
UTF-8
3,984
2.765625
3
[]
no_license
import os import unittest from contextlib import redirect_stdout from io import StringIO from unittest import mock from Intcode import Intcode class TestIntcode(unittest.TestCase): def setUp(self): self.computer = Intcode() def tearDown(self) -> None: self.computer.program = None def te...
true
b312e1a32736fcc8dfa4831827fc641a50f729fe
Python
Aasthaengg/IBMdataset
/Python_codes/p03131/s448704270.py
UTF-8
147
2.796875
3
[]
no_license
K, A, B = map(int, input().split()) if A >= B - 1 or K <= A - 1: print(1 + K) else: r = K - (A - 1) print(r // 2 * (B - A) + A + r % 2)
true
c33c1042804a09ac7cef8155ae8bdb20b0096a5b
Python
MohammedAlbaqerH/Machine-learning-from-scratch
/PCA/pca.py
UTF-8
751
3
3
[]
no_license
import numpy as np class PCA: def __init__(self, dim = 2): self.dim = dim self.components = None self.mean = None def fit(self, X): #callate mean self.mean = X.mean(axis = 0) self.std = X.std(axis = 0) #callate coverance matrix X = (X - self.me...
true
bc47b0352b3d24dd1cc0fdf81e6737e260af6d4d
Python
cesern/Seminario-de-CsC-2018-1
/Tareas 1/CESB-sumaMatrices.py
UTF-8
1,044
2.640625
3
[]
no_license
"""import pycuda.driver as cuda import pycuda.autoinit from pycuda.compiler import SourceModule import numpy as np N = 32 BLOCKS = 2 THREADS = 16 mod = SourceModule( #include <stdio.h> #define N 32 __global__ void montecarlo(float *a, float *b,float *c) { int indice = threadIdx.x + bl...
true
550ef09bcf8b54157905ff9934970cca1697985d
Python
martinbonardi/Explicit-Content-Classifier-using-ResNet
/GUI/gui.py
UTF-8
1,775
2.71875
3
[ "Apache-2.0" ]
permissive
import tkinter as tk from tkinter import filedialog, Text import tkinter.font as font import os import model_predict import model_predict root = tk.Tk() root.title("Explicit Content Classifier") myFont = font.Font(family='Playfair Display') def openf(): foldername = filedialog.askdirectory(initialdir=...
true
f43c3b1c015ae1d9eb7a70a4f436139b06f50c65
Python
alexlwn123/kattis
/Python/kastenlauf.py
UTF-8
640
2.890625
3
[]
no_license
def main(): cases = int(input()) while cases: nstores = int(input()) x0,y0 = map(int, input().split()) stores = [(x0,y0)] for _ in range(nstores): x,y = map(int, input().split()) stores.append((x,y)) x1,y1 = map(int, input().split()) isG...
true
50734673f182e663d24da1aa9d541a867ab81d20
Python
tranmanhhung1941996/web_flask_python
/ticket_app/app/ticket_scraper_thegioididong.py
UTF-8
1,931
2.75
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function from lxml import html import requests import re from pprint import pprint head = 'https://www.thegioididong.com' mid = '/tim-kiem?key=' def get_post_thegioididong(thegioididong_name): name = '+'.join(thegioididong_name.lower().split...
true
981cb5fcd12dba7a6567bf5891496e3b577444f4
Python
goelhardik/programming
/leetcode/super_ugly_number/tle_but_correct_sol.py
UTF-8
2,226
3.609375
4
[]
no_license
class Heap(object): def __init__(self): self.heap = [-1] self.size = 0 def insert(self, num): self.size += 1 self.heap.append(num) self.perc_up(self.size) def perc_up(self, index): p = index // 2 while (p >= 1): if (self.h...
true
aa915214de3632caf6a46eccbf35b210a347793f
Python
KKDJOSEPH/GUI_OCM
/OCMhap/controller/AnimatedMapController.py
UTF-8
5,334
2.921875
3
[ "MIT" ]
permissive
import folium import folium.plugins import pandas import branca import numpy import geopandas import os import pkg_resources import webbrowser class AnimatedMapController(object): """ An AnimatedMapController represents a controller used for the creation of an animated map. """ county_geo_data =...
true
fbaed351cf23796d90a6ab89df8425dfb53f7791
Python
LJamieson/Robot
/robot_controls/scripts/test.py
UTF-8
408
2.828125
3
[]
no_license
import time import forwardsSerial moveClass = forwardsSerial.motors() sensorClass = forwardsSerial.sensors() moveClass.forward(0.5) time.sleep(1) moveClass.stop() time.sleep(1) print(sensorClass.get_temperature()) #moveClass.backward(0.8) time.sleep(1) #moveClass.brake() #time.sleep(2) #moveClass.set_left_motor_speed(...
true
607999bc4ff911d0ffc6fbeca6546a452318e449
Python
IdealDestructor/LighterDetect-YoloV5
/divideData.py
UTF-8
857
3.21875
3
[ "Apache-2.0" ]
permissive
# -*- coding:UTF-8 -*- #制作训练集和验证集、测试集。 import os, random, shutil def moveFile(fileDir): pathDir = os.listdir(fileDir) #取图片的原始路径 filenumber=len(pathDir) rate=0.05 #自定义抽取图片的比例,比方说100张抽10张,那就是0.1 picknumber=int(filenumber*rate) #按照rate比例从文件夹中取一定数量图片 sample = random.sample(pat...
true
9fb5c7189fba919cfe17e4354978f5b072fd58fc
Python
guacamole56/MYOB-ops-technical-test
/myob_ops_technical_test/helper.py
UTF-8
570
2.75
3
[]
no_license
import os def get_last_commit_sha(file_name='version.txt'): if os.path.exists(file_name): try: with open(file_name, 'r') as version_file: # If version.txt is available and readable use the version in it. return version_file.read().strip() except Exceptio...
true
0cc5758a27b37bffe511cc975be85b7af0ac9981
Python
CollinHU/TextEntityExtraction
/Deprecated/dict_construct_01_fuzzy_match.py
UTF-8
1,073
2.8125
3
[]
no_license
import csv import pandas as pd import nltk from nltk import sent_tokenize,word_tokenize, pos_tag, ne_chunk from nltk.stem.snowball import SnowballStemmer from nltk.metrics.distance import edit_distance max_dist = 1 def fuzzy_match(w1,w2): return edit_distance(w1,w2) <= max_dist def match_key(w_list, key): for...
true
30dce61075ddabe77a1b9c757e40397b58cc3feb
Python
gutierrezalexander111/PycharmProjects
/Tests/subprocess.py
UTF-8
372
2.84375
3
[]
no_license
#!/usr/bin/env python """Dictionary implementation for demonstrating a Python dictionary.""" import subprocess def MyNetworkAddress(): popen_obj = subprocess.Popen(("ifconfig", "en0"), stdout=subprocess.PIPE) open_pipe = popen_obj.stdout words = open_pipe.read().split() index = words.index("inet") ...
true
2504ae8aeacbdb221b779be678c9ee68247deabb
Python
LeishaBurford/AdventOfCode2019
/Day8.py
UTF-8
1,109
3.046875
3
[]
no_license
from pathlib import Path data_folder = Path("./PuzzleData/") file_to_open = data_folder / "Day8.txt" with open(file_to_open) as input: pixels = [int(pixel.strip()) for pixel in input.read()] def getLayers(pixels, width, height): layerSize = width * height return [pixels[x:x+layerSize] for x in range(0, le...
true
2ea60e310c78ad8e428d7c56f7464c4fa1bf6f6a
Python
Recomandation-System-Simplon/api_recommandation
/app/utils.py
UTF-8
5,168
2.5625
3
[]
no_license
from os import pipe import pandas as pd from flask import current_app import numpy as np from app.db import db import json def format_data_user(to_read_data, ratings_data: pd.DataFrame): """Permet de formatter les champs du dataframe afin de les conformer au type de la BDD Args: to_read_data,rati...
true
26ad38638c8463f5c982ccffa4a386245d7ad53c
Python
austincqdo/treehacks
/app.py
UTF-8
3,002
2.59375
3
[]
no_license
from flask import Flask, render_template, request from scraper import get_votes from project import output_data app = Flask(__name__) ## Make API calls in this file. Use name of elected official as first two parameters for get_votes(). ## 'select' is the third param. @app.route('/') def index(): return render_temp...
true
e4e8d9796ee950cbdd1d18b07936350bb8ed9afc
Python
kaskang99/Projeto_final_Super_Fox
/sprites.py
UTF-8
5,699
2.921875
3
[]
no_license
# Sprite classes for game from config import * import pygame as pg from os import path from random import choices from assets import * vec = pg.math.Vector2 dir = path.dirname(__file__) mob_dir = path.join(dir, 'assets') class Player(pg.sprite.Sprite): def __init__(self, game): #no arquivo MAIN.py - self.player =...
true
6ea9fe55ffa3a929f7ff4007cbe12da79f1213a3
Python
ao9000/tic-tac-toe-ai
/game/player.py
UTF-8
2,472
3.890625
4
[]
no_license
""" Player class Handles everything related to move selection by the bot or the human player. """ from bot.minimax import minimax_soft_alpha_beta, get_depth import random from math import inf class Player: """ Player class A player can be a human or bot. """ def __init__(self, bot, stat...
true
d039698f7a347ee5c7c52c9fd94361d30a88fc62
Python
wesinalves/neuralnet
/my_perceptron.py
UTF-8
1,055
3.21875
3
[ "Apache-2.0" ]
permissive
''' simple implementation of rosemblat's perceptron Wesin Alves ''' import numpy as np ##set parameters num_inputs = 4 lr = 0.1 bias = np.random.normal() # input signals inputs = [np.array([int(y) for y in bin(x).lstrip("0b").zfill(num_inputs)]) for x in range(2**num_inputs)] print("Shape of input:") for...
true
885c37c5771ae84f8b2baf332fa2f210094cf1b4
Python
ILister1/core-project
/service3/app.py
UTF-8
538
2.53125
3
[]
no_license
from flask import Flask, request, Response import random app = Flask(__name__) @app.route('/setting', methods=['GET', 'POST']) def setting(): #settings = ["a mysterious cavern", "an intimidating room", "a dreamlike headspace"] #return Response(random.choice(settings), mimetype="text/plain") ...
true
37671a630f215b5fbfba6b7786893682a9675063
Python
mvonpapen/swem
/swem/metrics.py
UTF-8
6,977
3.03125
3
[ "MIT" ]
permissive
"""Implementation of certain useful metrics.""" from __future__ import annotations import json import torch from swem.utils.classes import ClfMetricTracker, KeyDependentDefaultdict class ClassificationReport: """A class for tracking various metrics in a classification task. The class is particularly usefu...
true
05e536af40aeebab4c6d1cf79bfaa9437bbe7e72
Python
mikekeda/maps
/core/tests_models.py
UTF-8
554
2.609375
3
[ "MIT" ]
permissive
from django.test import TestCase from core.models import get_unique_slug, Category class MapsModelsTest(TestCase): def test_models_catagory(self): slug = get_unique_slug(Category, "Test title") self.assertEqual(slug, "test-title") category_obj = Category(title="Test title") categ...
true
c8eda30a8fcd7fbd496a10cd39a173842b26983f
Python
akaufman10/scrapeDyno
/scrapedyno/scrapers.py
UTF-8
7,601
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jun 19 15:09:21 2016 @author: alex """ import pandas as pd import os import time from .scrapely_mod import MonkeyPatch import hashlib import scrapely from .utilities import HTMLTableParser, isnumber def advanced_scraper(website,data=None): ''' website: website type ...
true
9c673f9ad31bcdb3c65c3a1c46c6b1c775e04ab7
Python
fdbesanto2/carbon-budget
/analyses/loss_in_raster.py
UTF-8
2,078
2.8125
3
[]
no_license
import subprocess import datetime import os import sys sys.path.append('../') import constants_and_names as cn import universal_util as uu # Calculates a range of tile statistics def loss_in_raster(tile_id, raster_type, output_name, lat, mask): print "Calculating loss area for tile id {0}...".format(tile_id) ...
true
9a8f443794538a0145ff272d67e5ee446b3fc728
Python
x1He/leetcode_practice
/problems/find_mode_in_BST_501/__init__.py
UTF-8
606
3.046875
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None from collections import Counter class Solution: def findMode(self, root: TreeNode) -> List[int]: def dfs(root, res): if root: ...
true
20b278dcdfd6217f2b806e9845b1e3cad51efd27
Python
vyahello/upgrade-python-kata
/kata/07/number_of_decimal_digits.py
UTF-8
498
4.375
4
[ "MIT" ]
permissive
""" Determine the total number of digits in the integer (n>=0) given as input to the function. For example, 9 is a single digit, 66 has 2 digits and 128685 has 6 digits. Be careful to avoid overflows/underflows. All inputs will be valid. """ def digits(number: int) -> int: """Counts number of digits. Args: ...
true
c94541369561c6fd76eaee5de6c31b4ce8f8b08e
Python
leandrotartarini/python_exercises
/secondWorld/ex056.py
UTF-8
596
4.0625
4
[]
no_license
sumage = 0 olderman = 0 oldername = '' woman20 = 0 for p in range(1,5): print(f'----- {p} PERSON') name = str(input('Name: ')).strip() age = int(input('Age: ')) sex = str(input('M/F: ')).strip() sumage += age if p == 1 and sex in 'Mm': olderman = age oldername = name if sex in 'Mm' and age > older...
true
6ab2113a5cb70f1959d304f320c673aee40ed4e4
Python
joeADSP/adventofcode2020
/12/1.py
UTF-8
2,018
4
4
[]
no_license
def load_data(): with open("data.txt", "r") as f: data = f.read().splitlines() return data def parse_instruction(instruction): command = instruction[:1] units = int(instruction[1:]) return command, units class Ferry: def __init__(self): self._x = 0 self...
true
b5b36c2cc7feea7cd2cd2cf41b5fdefbe65e396e
Python
iomgaa/Learning-Deeplearning-for-100-days
/1 day/1 day.py
UTF-8
2,862
3.234375
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import pandas as pd # In[2]: dataset = pd.read_csv('Data.csv')#读取csv文件 X = dataset.iloc[ : , :-1].values#.iloc[行,列] Y = dataset.iloc[ : , 3].values # : 全部行 or 列;[a]第a行 or 列 # [a,b,c]第 a,b,c 行 or 列 # In[3]: pri...
true
a592b93c285c1122ee45e9eaff95dc1452794a0c
Python
anton-trapeznikov/RecipeParser
/apps/parser/core.py
UTF-8
12,976
2.640625
3
[ "MIT" ]
permissive
from django.core.exceptions import ValidationError from django.core.validators import URLValidator from django.conf import settings from urllib.parse import urlparse, urljoin from bs4 import BeautifulStoneSoup as Soup from abc import ABCMeta, abstractmethod import urllib.request import time import json import uuid imp...
true
545a3bad558e3b220e24a64d99c98a0035d86eb1
Python
namntran/modern_python3_bootcamp
/BooleanandConditionalLogic/logicalNot.py
UTF-8
465
4.125
4
[]
no_license
age = int(input("What is your age?")) # age 2-8 years is $2 tickets # age 65 years + is $5 tickets # everyone else is $10 tickets if not ((age >= 2 and age <= 8) or age >= 65 or age <2): print("you pay $10 dollars and not entitled to discount") elif age >= 65: print("you pay $5 and are entiled to senior discou...
true
394e7a913feed987f6e8dbee9c15bbb7619ac530
Python
WinrichSy/Codewars_Solutions
/Python/7kyu/MinimizeSumOfArray.py
UTF-8
224
3.5
4
[]
no_license
#Minimize Sum Of Array (Array Series #1) #https://www.codewars.com/kata/5a523566b3bfa84c2e00010b def min_sum(arr): arr = sorted(arr) ans = sum([arr[i]*arr[len(arr)-i-1] for i in range(len(arr)//2)]) return ans
true
f6d37f28c0b45537d80273e3d53e4e8afd48337b
Python
naoto0804/atcoder_practice
/contests/abc/19/195/c.py
UTF-8
1,007
2.609375
3
[]
no_license
import sys, re from collections import deque, defaultdict, Counter from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd from itertools import accumulate, permutations, combinations, product from operator import itemgetter, mul from copy import deepcopy from string import ascii_lowercase, ascii_uppe...
true
626d7665c135cbdc6d35e7f81a40ad73632ede69
Python
Atollye/search4letters
/letters_search.py
UTF-8
276
3.53125
4
[]
no_license
#!/usr/bin/env python3 def search4letters(phrase, letters='aeiou'): """ Returns the set of vowels found in 'phrase'""" return set(letters).intersection(set(phrase)) if __name__ == "__main__": phrase = input() res = search4letters(phrase) print(str(res))
true
7a6482d2fab5497cb391dfdc1339f802e9cfc368
Python
Rasquin/python-test
/vending_machine_challenge.py
UTF-8
2,831
4.1875
4
[]
no_license
#Challenge I """"Change the function so that instead of a list of coins, the function works with a dictionary that contains the coin denominations, and the quantity of each coin available. By default, assume there are 20 of each coin, but this can be overridden by passing a dictionary to the function as with the pre...
true
f5052bffc0c3dda66faba0426795fa12dcf3cd70
Python
Infinidrix/competitive-programming
/Take 2 Week 4/shortestBridge.py
UTF-8
2,044
3.296875
3
[]
no_license
class Solution: def connect_dots(self, A, x, y, visited): neighbors = [[1, 0], [0, 1], [-1, 0], [0, -1]] outline = set() path = collections.deque() path.append((x, y)) visited.add((x, y)) while path: land = path.popleft() for neighbor in neighb...
true
942333568e40a0cc4eda568937e388977af29d65
Python
Sosthene00/hd_derivation_workshop
/ecc/ecc.py
UTF-8
12,623
3.09375
3
[]
no_license
# Elliptic Curves library for cryptography import hmac, hashlib from ecc.util import * from io import BytesIO P = pow(2, 256) - pow(2, 32) - 977 A = 0 B = 7 Gx = 0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 Gy = 0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 N = 0xfffffffffff...
true
7ca88b6d11a43434a66520ce565af8d0648d4556
Python
vvveracruz/learn-py
/zhang-intro/ex3.py
UTF-8
4,552
4.21875
4
[]
no_license
import math def two_a(): ''' A program that asks the ser for a float x_0 an prints the value of f(x) = x^3 - 3x + 1 at x_0 ''' x = float ( raw_input( "Please enter your value for x_0: " ) ) print( x ** 3 - 3*x + 1 ) def two_b(): ''' A function that asks the user for their name, then prints...
true
e2735b2d80a90b5910a87b5888bcb3a9f1151df4
Python
code-knayam/DataStructureAlgorithms
/code-wars/004.order_weight.py
UTF-8
889
3.359375
3
[ "MIT" ]
permissive
def sum_dg(st): sum = 0 for c in st: sum = sum + int(c) return sum def order_weight(strng): strng = strng.split(" ") leng = len(strng) for i in range(leng): for j in range(leng-1): if sum_dg(strng[j]) > sum_dg(strng[j+1]): temp = strn...
true
278d89221a835656fa8273adb5250a24b960a8b9
Python
cholla-bear/ProjectEuler
/lib/prime.py
UTF-8
2,270
3.40625
3
[]
no_license
from collections import defaultdict import itertools from itertools import takewhile, islice from math import sqrt from functools import lru_cache, reduce from operator import mul import numpy as np @lru_cache(maxsize=None) def prime_factors(n): '''Returns a dictionary of prime factors with their counts''' prime_...
true
5f62927b10ebf68540e71465cf74de9e2844155a
Python
silky/bell-ppls
/env/lib/python2.7/site-packages/observations/r/cps_85.py
UTF-8
2,278
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function import csv import numpy as np import os import sys from observations.util import maybe_download_and_extract def cps_85(path): """Data from the 1985 Current Population Survey (CPS85)...
true
2f7e99d39aea40ebaecbc15c8740a7ceb884ccdd
Python
cmobrien123/Python-for-Everybody-Courses-1-through-4
/Ch8Asnt8.5.py
UTF-8
1,120
3.9375
4
[]
no_license
# Exercise 8.5: Write a program to read through the mail box data and when you # find the line that starts with "From", you will split the line into words # using the split function. We are interested in who sent the message, which is # second word on the From line. # From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16...
true
fead1309187f3a507941fceee14b9ec1d7520659
Python
Dexels/app-tools
/apptools/image/core/scale.py
UTF-8
396
2.578125
3
[]
no_license
from apptools.image.core.json import json_get class Scale(object): def __init__(self, multiplier, directory): self.multiplier = multiplier self.directory = directory @classmethod def load_from_json(cls, json): multiplier = float(json_get('multiplier', json)) directory = js...
true
c6b215d145fdc672643837f098aa2faba1c45093
Python
luizapozzobon/myo_project
/refactored_raw.py
UTF-8
5,557
2.625
3
[ "MIT" ]
permissive
from myo_raw import * import pygame import pandas as pd import datetime from copy import copy from time import sleep, time DEBUG = False class MyoRawHandler: def __init__(self, tty=None): self.m = MyoRaw(sys.argv[1] if len(sys.argv) >= 2 else None) self.create_connection() self.emg = [] ...
true
7ed042a68bf8407b7bcf88dde7f00a5133cd6878
Python
Hibiscusofxp/wxz-card-bot
/bot.py
UTF-8
18,182
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- import random import datetime import json import os import itertools, math import stats import collections random.seed() """ Bot implementation. Should be reloadable """ leaderboard = {} accept_challenge = 0 offer_challenge = 0 in_challenge = False def checkDir(fn): dn = os.path.dirname(f...
true
825dca0ba445a58e59d2c1473b732b8b4b68d149
Python
mksingh8/google_Search_Automation_Framwork_Python
/testCases/test_google_search.py
UTF-8
842
2.75
3
[]
no_license
from pageObjects.searchPage import SearchPage from utilities.logGeneration import LogGen from utilities.readConfig import ReadConfig class Test_001_Google_Search: logger = LogGen.log() url = ReadConfig.get_application_url() def test_google_search_method(self, setup): self.logger.info("*** test_go...
true
b95523aeb3d0244c7548c0aaade9400b939f63dc
Python
husanpy/Programming-in-python-Coursera-MIPT
/1 Diving in python/Homework/2 Data structures and functions/key_value_storage.py
UTF-8
740
2.65625
3
[ "MIT" ]
permissive
import os import tempfile import argparse import json # command line arguments parser parser = argparse.ArgumentParser() parser.add_argument('--key') parser.add_argument('--val') args = parser.parse_args() storage_path = os.path.join(tempfile.gettempdir(), 'storage.data') # storage_path = 'storage.data' if os.path...
true
1d6e3d41cadd52cecf6ed30798b3ab5a9fa83cf1
Python
alirezahi/DataMining
/Codes/p4-f.py
UTF-8
454
2.5625
3
[]
no_license
from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt import numpy as np import csv x = [ [], [], [], [], ] r = [] with open('iris.data','r') as csvfile: plots = csv.reader(csvfile, delimiter=',') for row in plots: if len(row): for i in range(4): ...
true
6a12ae933e63d510f3b57f38c5d3f18131c0d74e
Python
kordejong/my_devenv
/script/build_target.py
UTF-8
1,605
2.65625
3
[]
no_license
#!/usr/bin/env python_wrapper """ Build target. Usage: build_target.py [--build_type=<bt>] (--object | --project | --test) <name> build_target.py -h | --help Options: -h --help Show this screen. --build_type=<bt> Build type. --object Build object. --project Build project. --...
true
b2bcfd36943494411442c7a894e582872104bd95
Python
ra536/network
/stopo.py
UTF-8
625
2.734375
3
[]
no_license
""" How to run: $ sudo mn --custom ~/path/to/python/file --topo stopo """ from mininet.topo import Topo class STopo( Topo ): "Simple topology example." def createSwitchWithHosts ( self, name ): newSwitch = self.addSwitch( 's%s' % (name,) ) for i in range(1,4): newHost = self.addHost( 'h%s_%d' % (name,...
true
96b95b29fdbc3569b09b013fd2c0bb9e6297ea5c
Python
bramyarao/2D-POISSON-PYTHON
/2D POISSON PYTHON/_2D_POISSON_PYTHON.py
UTF-8
6,518
2.8125
3
[]
no_license
#========================================================= # NUMERICAL ANALYSIS: USING MESHFREE METHOD # USING THE REPRODUCING KERNEL COLLOCATION METHOD TO SOLVE # THE 2D POISSONS PROBLEM #========================================================= import numpy as np import matplotlib.pyplot as plt from matplotlib imp...
true
0d144acf38f5b86ad6561eeb200594a985f5f3d2
Python
ajchristie/matasano-challenges
/set1.py
UTF-8
5,719
3.234375
3
[]
no_license
#!/usr/bin/env python2 from collections import Counter # for challenge 1: convert hex to base64 def hexToB64(h): return h.decode('hex').encode('base64') # for challenge 2: return XOR of two fixed length strings def fXOR(s1, s2): if len(s1) != len(s2): print 'Give me equal length buffers!' retu...
true
75582afe56bebaa8b16a0b08b64c0a4765e97318
Python
raymonstah/Hacking-Ciphers
/Reverse/reverse.py
UTF-8
354
4.09375
4
[]
no_license
# Reverse Cipher # The first example of Hacking Secret Ciphers # A simple, weak cipher to encrypt a string. # Raymond Ho message = raw_input("Enter your string: ") # Look at this pythonic way.. print message[::-1] # The uglier way translated = '' i = len(message) - 1 while i >= 0: translated = translated + messa...
true
0e4e63c731825edb4c2dcffa3dad8aecef45d96a
Python
Shusovan/Basic-Python-Programming
/Swapping_List.py
UTF-8
350
3.75
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[4]: def swapList(): lst=[] size=int(input('Enter the size of array: ')) for i in range(1,size+1): n=int(input('enter the elements: ')) lst.append(n) temp = lst[0] lst[0] = lst[size - 1] lst[size - 1] = temp retu...
true
b20418c1b111d82c673c6f559c31cd990d69b048
Python
MrCodemaker/python_work
/files and exceptions/user_like_proggramming.py
UTF-8
310
3.140625
3
[]
no_license
filename = 'user_reasons_like_programming.txt' prompt = "\nPlease enter, why you like programming?: " prompt += "\nEnter the 'quit' to end the order!" message = "" while message != 'quit': with open(filename, 'w') as file_object: message = input(prompt) file_object.write(print(message))
true
9e76f74807d27235af0edc427c79e6f9db12586d
Python
searcy/ASpaceASnake
/upload-new-subjects.py
UTF-8
1,333
2.734375
3
[ "MIT" ]
permissive
#!/usr/bin/env python import glob, json, datetime # Setting up the log import asnake.logging as logging logname = 'logs/new_subject_upload_' + datetime.datetime.now().strftime('%Y-%m-%d-T-%H-%M') + '.log' logfile = open(logname, 'w') logging.setup_logging(stream=logfile) logger = logging.get_logger('upload-new-subje...
true
fdef180fc0cef71ad2ed1046547879300026aea4
Python
Jbruslind/ECE44x_Senior_Design
/Computer Science/MircobialAnalysisTool/colonyCounter.py
UTF-8
1,885
2.75
3
[ "MIT" ]
permissive
import cv2 import numpy as np; import os font = cv2.FONT_HERSHEY_SIMPLEX text_loc = (20, 40) font_scale = 1 font_color = (255,0,0) line_type = 2 def analyzeImage(imageNumber): #setup colonyCount = 0 # initalizes cwd = os.getcwd() fileName = cwd + "/images/" + str(imageNumber) + ".jpg" #impo...
true
48cb8db9158188087c00eaf745faafb3d4d2c929
Python
ailyanlu1/leetcode-4
/Python/001_Two Sum.py
UTF-8
495
2.953125
3
[]
no_license
class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ ht = dict() for i in range(len(nums)): ht[nums[i]] = i + 1 for i in range(len(nums)): lt = target - nums[i...
true
fd75aa8114e41b366f42738324d7b5b12f6f2aea
Python
rravicha/pdfdrive
/flask-api/engine/forms.py
UTF-8
8,355
3.0625
3
[]
no_license
from math import sqrt, atan2, ceil, degrees from datetime import datetime as dt from copy import deepcopy from flask.logging import default_handler import logging log_f="%(levelname)s %(asctime)s - %(message)s -->%(lineno)d |%(module)s " logging.basicConfig( filename="monitor.txt", level=logging.DEBUG, format=log_f, ...
true
5378b62b2a24fb21b14a58dcc272580e6365c06c
Python
osu-mlpp/mlpp-playground
/curve_analysis/osu_dump/osu_db.py
UTF-8
1,617
2.890625
3
[ "MIT" ]
permissive
# Go ahead and replace db_names with how you named your dumps. Make sure it's in the same order # Each dump should still start with osu_ ex. osu_random_2019_11_01 from curve_analysis.bin.config import * import mysql.connector from tqdm import tqdm class OsuDB: password = SQL_PASSWORD host = SQL_HOST user...
true
06d9f2f947d972d115f4c2d3740bb445996e5905
Python
joelsmith80/modern-django
/project/races/helpers.py
UTF-8
126
2.515625
3
[ "MIT" ]
permissive
def get_option( key, type = int ): from .models import SiteOption obj = SiteOption() return obj.get_option( key )
true
fb218e2621c3170a07fff6aa39a9274a002d75f6
Python
ducnguyen1911/ReinforcementLearning
/non_deterministic_case.py
UTF-8
6,102
2.640625
3
[]
no_license
import math __author__ = 'duc07' import numpy import random import matplotlib.pyplot as plt GAMMA = 0.9 GOAL_STATE = 6 e = 0.2 # greedy parameter g_numb_same_q = 0 g_prev_q_arr = numpy.zeros((12, 4)) g_cur_q_arr = numpy.zeros((12, 4)) g_dict_action = {0: -4, 1: 4, 2: -1, 3: 1} # 0: up, 1: down, 2: left, 3: right g_...
true
add12e183a9909e23839a429f1b83932726c57d9
Python
JHussle/Python
/Collections/collections.py
UTF-8
474
3.984375
4
[]
no_license
import os from os import system system('clear') array = (87, 10, 2, 46, 22, 19, 66) print(type(array)) print(array) for number in array: print(number) #List cars = ["BMW", "Audi", "VW", "Ford", "Honda", "Chevy"] print(cars) print(type(cars)) cars.sort() for car in cars: print(car) numbers = [6, 3, 8, 1, ...
true
27cd7b203f7d143c45988445b92c00185dba9733
Python
geekstor/jeju-dl-camp-2018
/util/util.py
UTF-8
2,567
2.59375
3
[]
no_license
import tensorflow as tf from configuration import ConfigurationManager from function_approximator import GeneralNetwork, Head def get_vars_with_scope(scope): return tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=scope) def get_copy_op(scope1, scope2): train_variables = get_vars_with_scope(scope1)...
true
ea9925c02b20b0a1d351c7433b93e4cfaad3e76b
Python
reedan88/QAQC_Sandbox
/Calibration/Parsers/Parsers/DOSTACalibration.py
UTF-8
6,132
3.03125
3
[]
no_license
#!/usr/bin/env python import datetime import re import csv import pandas as pd from zipfile import ZipFile from dateutil.parser import parse from xml.etree.ElementTree import XML class DOSTACalibration(): def __init__(self, uid): self.serial = '' self.uid = uid self.coefficients = {'CC_c...
true
279c27637628504c2318d4c099b73e5a96d35e38
Python
benumbed/rapid-rest
/src/rapidrest_dummyapi/v1/recursive/__init__.py
UTF-8
701
2.53125
3
[ "BSD-3-Clause-Clear" ]
permissive
from flask import jsonify, make_response from rapidrest.apiresource import ApiResource, ApiResponse class Recursive(ApiResource): endpoint_name = "recursive" description = "Recursive endpoint" def get(self, obj_id=""): """ Example of a GET @param obj_id: @return { d...
true
25f2e8db95edf1487e2880ee4bbfc76dfb68c88c
Python
Ebyy/python_projects
/Classes/modifying_attributes_by_method.py
UTF-8
3,058
3.671875
4
[]
no_license
class Car(): """Simulate method for summary.""" def __init__(self,make,model,year): """Initialize attributes to describe car.""" self.make = make self.model = model self.year = year def update_odometer(self, mileage): """Set odometer reading to a given value.""" ...
true
0316a0adfe8446bfb49aa70f12efe25f99907ba2
Python
alben/sandbox
/AOC2017/AOC01/sol.py
UTF-8
255
3.140625
3
[]
no_license
TEST1 = '1122' SOL1 = 3 TEST2 = '1111' SOL2 = 4 TEST3 = '1234' SOL3 = 0 TEST4 = '91212129' SOL4 = 9 target = TEST2 total = 0 for i, item in enumerate(target, 1): i = i % len(target) if item == target[i]: total += int(item) print(total)
true
58946e689951557816b8a6bdc91f8313e41f79ea
Python
poojakancherla/Problem-Solving
/Leetcode Problem Solving/DataStructures/Linked Lists/206-reverse-linked-list.py
UTF-8
1,218
4
4
[]
no_license
class Node: def __init__(self, val): self.val = val self.next = None ###### Iterative ######## def reverseList_iter(head): currNode = head prevNode, nextNode = None, None while currNode: nextNode = currNode.next currNode.next = prevNode prevNode = currNode ...
true
60bb63dc9b569d9ecc0ee9bc6103c9b5a7945b2e
Python
andreapdr/word-class-embeddings
/src/model/helpers.py
UTF-8
1,654
2.640625
3
[]
no_license
import torch import torch.nn as nn from torch.nn import functional as F def init_embeddings(pretrained, vocab_size, learnable_length): pretrained_embeddings = None pretrained_length = 0 if pretrained is not None: pretrained_length = pretrained.shape[1] assert pretrained.shape[0] == vocab_s...
true
c9711a276a356f283c6a2d34bb7c3608e3a335a7
Python
sandeep-18/think-python
/Chapter05/example05_boolean.py
UTF-8
348
4.4375
4
[]
no_license
# Sandeep Sadarangani 3/12/18 # A function that takes in two numbers and determines if they are equal def equality(num1, num2): isEqual = 0 if num1 == num2: isEqual = 1 return isEqual x = 7 y = 7 equality_check = equality(x, y) if equality_check: print("Numbers are equal") else: ...
true
3874cfcb2188bcb18c3850a90b55ff5be07d8cae
Python
21tushar/Python-Tutorials
/os module(sentdex).py
UTF-8
156
3.078125
3
[]
no_license
import os dir1 = os.getcwd() print(dir1) os.mkdir('newdir') import time time.sleep(5) os.rename('newdir', 'newdir1') time.sleep(5) os.rmdir('newdir1')
true
57dd683a0884b38cdce07c5903d1164d43454d27
Python
Globaxe/crispy-disco
/lex.py
UTF-8
1,557
2.75
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Sep 27 09:19:51 2017 @author: cedric.pahud """ import ply.lex as lex from ply.lex import TOKEN reserved_words = ( 'BPM', 'START', 'STOP', 'REP', 'ARP', 'PAUSE', ) notes = ( 'do', 'do\#', 're', 're\#', 'mi', 'mi\#', 'fa', ...
true
48e7abbe4a7ef642537a6042f442414dc2e39c81
Python
maggiebauer/hb_project
/seed.py
UTF-8
5,613
2.609375
3
[]
no_license
"""Utility file to seed company_insights database from FullContact API and Crunchbase data csb in seed_data/""" from sqlalchemy import func from model import FCCompany from model import SMLink from model import CompanyLink from model import IndustryType from model import CompanyIndustry from model import CBCompany fro...
true
5378fb010cc94b740993e4a30439ee5e9c86514d
Python
GeographicaGS/GeoLibs-Dator
/dator/transformers/pandas.py
UTF-8
1,107
2.671875
3
[ "MIT" ]
permissive
from dator.schemas import validator, TransformerSchema class Pandas(): def __init__(self, options): self.options = validator(options, TransformerSchema) def transform(self, df): if self.options.get('time', None): field = self.options['time']['field'] start = self.opti...
true
08c26de6cc8874f72c286e57f89e2b615157e05c
Python
yisha0307/PYTHON-STUDY
/RUNOOB/test01.py
UTF-8
168
3.234375
3
[]
no_license
# -*- coding: UTF-8 -*- # python2 x = 'a' y = 'b' # 换行输出 print x print y print '-------------' # 不换行输出 print x, print y, #不换行输出 print x, y
true
d29237afc8e03c9f9068449a486ed891505acda4
Python
dominikjurinic/geometric-integrator
/python-implementation/lie_bracket.py
UTF-8
150
2.578125
3
[]
no_license
import numpy as np def lie_bracket(skew_x, skew_y): skew_x_out = np.matmul(skew_x,skew_y) - np.matmul(skew_y,skew_x) return skew_x_out
true
7c84cf4b444a6747b2ccd4aea11b3250159f692b
Python
AP-Class-Activities/Final-Project-T-11
/store_class.py
UTF-8
8,063
3.28125
3
[]
no_license
import random sellers_id = dict() sellers = dict() products = dict() costumers = dict() class Store: net_profit = 0 # variable to store the net profit of the store until this moment def __init__(self, address, website_url, telephone_number): self.address = address self.website_url = website_u...
true
bb9ecafe59dec227f8d0a5a07ec741e3b331d3ff
Python
HimanshuSRTOp/advanced-verification
/cogs/setup.py
UTF-8
6,995
2.53125
3
[]
no_license
import discord import asyncio import json from discord.ext import commands from discord.utils import get # ------------------------ COGS ------------------------ # def is_allowed(ctx): return ctx.message.author.id == 754453123971547266 class SetupCog(commands.Cog, name="setup command"): def __init__(self, ...
true
f57f54a554449ebb6d01bf8b8ec422511fdb7b9a
Python
20c/munge
/src/munge/config.py
UTF-8
7,040
3.015625
3
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0" ]
permissive
import collections import copy import os from urllib.parse import urlsplit import munge import munge.util # this wouldn't work with tabular data # need metaclass to allow users to set info once on class # TODO rename to BaseConfig, set standard setup for Config? class Config(collections.abc.MutableMapping): """ ...
true
1fba1fb390bf6750d2cf0b6ac72a39c6d42022a7
Python
akaliutau/cs-problems-python
/problems/array/Solution1566.py
UTF-8
1,334
3.8125
4
[ "MIT" ]
permissive
""" Given an array of positive integers arr, find a pattern of length m that is repeated k or more times. A pattern is a subarray (consecutive sub-sequence) that consists of one or more values, repeated multiple times consecutively without overlapping. A pattern is defined by its length and the number of ...
true
2345a224340ec193bce61ac20e1979df3093270c
Python
pekkajauhi/Breakout
/game_stats.py
UTF-8
637
2.8125
3
[]
no_license
class GameStats(): """Track game statistics for breakout.""" def __init__(self, bo_settings): """Initialize statistics.""" self.bo_settings = bo_settings self.reset_stats() # Start breakout in an inactive state self.game_active = False # High score should never ...
true
ae50a29fe52039970a683cb050719537da37f047
Python
narupi/Competitive-programming
/atcoder/abc124/b.py
UTF-8
241
3.078125
3
[]
no_license
n = int(input()) h = list(map(int, input().split())) ans = 0 flag = True for i in reversed(range(n)): flag = True for j in range(i): if h[i] < h[j]: flag = False if flag: ans += 1 print(ans)
true
08d0349d2f3ae92cefad8838ef8a6c9d7dfde1e0
Python
singhujjwal/python
/2017_May23/proc/subprocess/wait_process.py
UTF-8
246
3.046875
3
[]
no_license
#!/usr/bin/env python from subprocess import Popen from time import sleep p = Popen("./slow_program.py") for i in range(5): print "Main program: counting ", i sleep(1) ret = p.wait() print "Child process exited with exit code", ret
true
920aeff8167d0f25c5dcab75dce5ee26a6a78b88
Python
miaohf/flask-vue-book-library
/app/resources/book.py
UTF-8
5,510
2.546875
3
[]
no_license
import re from flask import request from flask_restful import Resource, inputs, reqparse from flask_jwt_extended import create_access_token, jwt_required, jwt_optional from sqlalchemy.orm import subqueryload from app.models import Book, Author, Category from app.helpers import PaginationFormatter def book_rules(): ...
true
0a3f81d6d3a8f73c54a106349a173c3326eca34f
Python
majopa/python_projects
/Common Word List.py
UTF-8
436
3.640625
4
[]
no_license
# Author : Matthew Palomar # Class: 8/27/15 # Desc: Creates a list of commonly used words in a given file # Input: file name (fname) fname = raw_input("Enter file name: ") fh = open(fname) lst = list() allWords = list() for line in fh: linebuffer = line.rstrip().split() for words in linebuffer: all...
true
a4fa5a09eb3e5dcfcf7d579d4d89cb83f53476af
Python
chrislevn/Coding-Challenges
/Orange/DP_III_LIS/The_Tower_of_Babylon.py
UTF-8
1,259
3.1875
3
[]
no_license
from itertools import permutations result = [] path = [] last = -1 def printLIS(a): global last b = [] i = last while i != -1: b.append(a[i]) i = path[i] for i in range(len(b) - 1, -1, -1): print(b[i], end=' ') def LIS_Triple(a): global...
true
b08714d2c04223fe06689019ea0af66a8e0bb144
Python
ZoroOP/Problem-Solving-With-Algorithms-And-Data-Structures
/4_Recursion/tower_of_hanoi.py
UTF-8
981
4.0625
4
[ "MIT" ]
permissive
""" Write recursive algorithm that rolves the Tower of Hanoi problem. Explanation: The key to the simplicity of this algorithm is that we make two different recursive calls. The first recursive call moves all but the bottom disk on the initial tower to an intermediate pole. The next line simply moves the botto...
true
20597b990f90ee77062ddbe9652fbb6c144d8500
Python
Jane11111/Leetcode2021
/069.py
UTF-8
297
3.515625
4
[]
no_license
# -*- coding: utf-8 -*- # @Time : 2021-04-18 12:46 # @Author : zxl # @FileName: 069.py class Solution: def mySqrt(self, x: int) -> int: x1 = x while x1*x1>x : x1 = int(0.5*(x1+x/x1)) return x1 x = 5 obj = Solution() ans = obj.mySqrt(x) print(ans)
true
9ac44e880e6d6570fd6b4f2a2b3e927e6dad93b6
Python
dedkoster/audio_preproccesing
/audio_data_generator.py
UTF-8
15,409
3.03125
3
[ "Apache-2.0" ]
permissive
"""Utilities for real-time audio data augmentation. URL: - https://github.com/keras-team/keras/blob/master/keras/preprocessing/image.py """ import os import threading import numpy as np import pandas as pd from glob import glob1 as glob from librosa.output import write_wav from librosa.effects import time_stretch from...
true
cd0bedd73f04045061f1a3b144ff67478e33149f
Python
alexbyz/HW070172
/l04/ch3/ex1.py
UTF-8
560
4.3125
4
[]
no_license
#exercise 1 #Alexander Huber #volume and surface of a sphere # V = 4/3pi*r^2 # A = 4pi * r^2 # (unit) as it does not matter for the programm if its in cm, inches or some fantasy-unit import math def main(): print("calculates the Surface Area and the Volume of a Sphere\n") rad = float(input("what is the radius...
true
d6e4a3476bf2ec2c36200932ad85ade811a5bd5e
Python
jonathan-mothe/ListaDeExercicios
/funcoes/ex007.py
UTF-8
557
3.609375
4
[]
no_license
def valor_pagamento(valor, dias_atraso): if (valor < 0): return None if (dias_atraso > 0): multa = valor * 0.03 adicional_atraso = valor * (dias_atraso * 0.01) return valor + multa + adicional_atraso else: return valor # Entrada de Dados valor = 1 while (valor != 0)...
true
9692503ae6fbcabc5b8259705bc4bed26db0df37
Python
atharvac/Celeste-TFNeuralNet
/data_manip.py
UTF-8
694
2.765625
3
[]
no_license
import pandas as pd import numpy as np import cv2 from collections import Counter import random combos = ['L', 'R', 'C', 'X', 'Z', 'CR', 'CU', 'CL', 'CD', 'UZ', 'DZ', 'RX', 'LX', 'RUX', 'LUX', 'DRX', 'DLX', 'CDRX', 'NaN'] data = np.load("training_data.npy", allow_pickle=True) d = pd.DataFrame(data) count = Coun...
true
1fce555b3b409a52b72523771d426a0876283985
Python
Raghibshams456/Python_building_blocks
/Numpy_worked_examples/032_numpy_cauchy.py
UTF-8
359
3.34375
3
[]
no_license
""" Given two arrays, X and Y, construct the Cauchy matrix C (Cij =1/(xi - yj)) """ import numpy as np X = np.arange(8) Y = X + 0.5 C = 1.0 / np.subtract.outer(X, Y) print(np.linalg.det(C)) """ PS C:\Users\SP\Desktop\DiveintoData\Numpy> python .\032_numpy_cauchy.py 3638.163637117973 PS C:\User...
true
c4097559ee470090205ae8a4776acc0748dadeac
Python
tugra-alp/Data-Science-Projects
/Project1-Bengaluru House Project/preProcessingPart.py
UTF-8
4,934
3.453125
3
[]
no_license
#%% import pandas as pd import numpy as np from matplotlib import pyplot as plt import matplotlib #%% # link of dataset = 'https://www.kaggle.com/amitabhajoy/bengaluru-house-price-data' data = pd.read_csv("Bengaluru_House_Data.csv") #%% ---- DATA CLEANING ---- # Removing unnecessary features data = data.drop(['area...
true