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
45576ef9da9da86d57d05b3f6633784b1017820e
Python
transientskp/tkp
/tkp/utility/coordinates.py
UTF-8
20,422
2.90625
3
[ "BSD-2-Clause" ]
permissive
# # LOFAR Transients Key Project """ General purpose astronomical coordinate handling routines. """ import datetime import logging import math import sys import pytz from astropy import wcs as pywcs from casacore.measures import measures from casacore.quanta import quantity logger = logging.getLogger(__name__) # No...
true
046719c95e3e1759e4b24efef4c0aca062e3cd10
Python
hritik1330/GUVI
/hunter/set-10/94.py
UTF-8
96
3.234375
3
[]
no_license
ss = list(input().split()) for i in range(len(ss)): ss[i] = ss[i][::-1] print(" ".join(ss))
true
b92c6c6e33d995fd87273751314705a721ce1cb2
Python
andrewlarimer/location-buzz
/app/location_analyzer.py
UTF-8
15,603
2.578125
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 import googlemaps import re from sklearn.cluster import KMeans from bert_serving.client import BertClient import requests import json from collections import defaultdict, Counter from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer import numpy as np import pandas ...
true
42b15b419190f9a04b6571029058f973040a9075
Python
Castor87/pacman
/teste_fontes.py
UTF-8
967
3.0625
3
[]
no_license
import pygame BRANCO = (255, 255, 255) PRETO = (0, 0, 0) AMARELO = (255, 255, 0) VERMELHO = (255, 0, 0) VERDE = (0, 255, 0) pygame.init() tela = pygame.display.set_mode((800, 600), 0) score = 0 fonte = pygame.font.SysFont("calibri", 24, bold=True, italic=False) while True: texto = "Score: {}".format(score) ...
true
0c73c27ba0d59606669b1bfb6dacd863b5ad3bd6
Python
daclink/Final_Project_IST338
/logger.py
UTF-8
4,350
3.0625
3
[]
no_license
### # Drew A. Clinkenbeard # Error Reporter and Logger # 29 - April - 2014 # Since I broke this apart into multiple classes # I needed a more flexible logging system. ### from time import localtime, strftime class Logger(): def __init__(self, fileName="admm.log"): """ I like using tail -F to have a running log...
true
a3a0d613e0bcddc228850c5b9fb383db8f447b87
Python
ArseniyCool/Python-YandexLyceum2019-2021
/Основы программирования Python/5. Debugger/Псевдоним-пасьянс.py
UTF-8
845
3.828125
4
[]
no_license
# По игре Ним-пасьянс с ограничением: # можно за один ход взять не больше трёх камней. # Игрок может попытаться взять больше трёх камней, меньше одного или больше оставшегося количества, # но в этих случаях его ход игнорируется, и программа ещё раз выводит не изменившееся количество камней. a = int(input('Введит...
true
d2d938c136741471f678a2701d513aec58d28ab1
Python
kajaltingare/Python
/Dictionary/cntWordsIntoDict.py
UTF-8
546
4.0625
4
[]
no_license
# Write a program to accept a paragraph from user & return a dictionary of count of words in it. def cntWordsIntoDict(ipString): opDict={} for ch in ipString.split(): if(opDict.get(ch)!=None): opDict[ch]+=1 else: opDict[ch]=1 return opDict def main(): ...
true
ce24cdf44ebdcfdfe20b72948a311c65993d4dd1
Python
harry123180/opencv_find_objects
/GMTCV/ik.py
UTF-8
494
3.0625
3
[]
no_license
import math l1 = 4 l2 = 3 pi = 3.14159 x =-4 y = 0 theta = 90 Kdeg = 180/pi def ik(x,y,theta): v2 = (pow(x,2)+pow(y,2)-pow(l1,2)-pow(l2,2))/(2*l1*l2) d2 = math.acos(v2) k1 = l1+l2*math.cos(d2) k2 = l2*math.sin(d2) d1 = math.atan2(y,x)-math.atan2(k2,k1) fai = theta*pi/180 d3 = (fai-d2-d1) ...
true
3ae208a9021a62a1030e67b690c5c7dd8b780803
Python
JINO-ROHIT/IPL-Score-Prediction
/src/train.py
UTF-8
2,271
2.53125
3
[]
no_license
from ast import parse import joblib import os import argparse import config import model_dispatcher import pandas as pd import numpy as np from sklearn import metrics from sklearn import ensemble from sklearn.preprocessing import LabelEncoder from sklearn.metrics import mean_squared_error df = pd.read_csv(config.TRAIN...
true
442ce3c013f419ded55bd05c2a017d9e2088fa1a
Python
Manovah/guvi
/code kata/min_to_hrs.py
UTF-8
76
3.21875
3
[]
no_license
q=int(input()) if(q<59): print(0,q) else: d=q//60 b=q%60 print(d,b)
true
7e9ced26af38c3c8e4e10722826244b7d080d330
Python
QuentinCG/Base-Scripts
/OS_Independent/utils/fb_messenger_send.py
UTF-8
4,402
2.71875
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Utility functions to send message/image with Facebook messenger (can also be called with shell) """ __author__ = 'Quentin Comte-Gaz' __email__ = "quentin@comte-gaz.com" __license__ = "MIT License" __copyright__ = "Copyright Quentin Comte-Gaz (2017)" __python_version_...
true
67279ec82cf6e2f8b472727cd58f0068a7e852c0
Python
lancelafontaine/caproomster
/app/core/equipment_test.py
UTF-8
499
2.625
3
[]
no_license
from app.core.equipment import Equipment def test_equipment_with_no_arguments_is_zero_length(): equipment = Equipment("equipmentID_uybino") assert 0 == len(equipment) def test_equipment_getting_number_of_equipment_needed(): equipment7 = Equipment("equipmentID_ibiubi",laptops=2,projectors=1,whiteboards=4) assert 7...
true
f5842ab82da63d07d20db85f63ce4c43747fbe09
Python
ShreeyaVK/Python_scripts
/change_delimiter.py
UTF-8
735
2.765625
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- """ Created on Wed Aug 23 19:03:55 2017 @author: Sadhna Kathuria """ import pandas as pd #change the delimter of a dataset path = 'C:/Users/Sadhna Kathuria/Documents/Shreeya_Programming/Predictive/Chapter 2' #filename1 = 'titanic3.csv' filename2 = 'Customer Churn Model.txt' filename_tab = 'Ta...
true
409e5a90dad58ad4566b493c3838ad081272a27f
Python
uchicago-cs/icpc-tools
/scoreboard-publish/scoreboard-publish.py
UTF-8
15,397
2.5625
3
[]
no_license
#!/usr/bin/python # PC^2 scoreboard publishing script # # See README for instructions # # (c) 2014, Borja Sotomayor from argparse import ArgumentParser, FileType from pprint import pprint as pp from datetime import datetime import os import os.path import stat import subprocess import socket import time import re imp...
true
ff747d97e8ac35c4b6d43513f01ceec88cbc8ced
Python
hpcloud-mon/monasca_query_language
/mql/influx_repo.py
UTF-8
3,897
2.515625
3
[ "Apache-2.0" ]
permissive
import datetime import sys import numpy from influxdb import client import mql_parser influxdb_client = client.InfluxDBClient( "192.168.10.6", "8086", "", "", "mon") functions_for_repo = { 'avg': 'mean', 'max': 'max', 'min': 'min', 'count': 'count', 'sum': 'sum', 'rate': 'deriv...
true
3baf987cd1be64f1e8b5485141022e396003ea1c
Python
PTITLab/Multitask-Breath-Sound
/Breath-Code/dataset.py
UTF-8
3,505
2.890625
3
[]
no_license
import numpy as np import keras from scipy.io import wavfile import librosa import os from keras.utils import to_categorical class BreathDataGenerator(keras.utils.Sequence): 'Generates data for Keras' def __init__(self, directory, list_labels=['normal', 'deep', 'strong'], ...
true
bee776a208bb4cfb0466fbbba5149af9bebd37a6
Python
dorx/codesnippetsearch
/code_search/vocabulary.py
UTF-8
1,539
3.09375
3
[ "MIT" ]
permissive
from typing import List, Dict, Counter as TypingCounter, Optional, Iterator from collections import Counter MASK_TOKEN = '%MASK%' UNKNOWN_TOKEN = '%UNK%' class Vocabulary: def __init__(self): self.token_to_id: Dict[str, int] = {MASK_TOKEN: 0, UNKNOWN_TOKEN: 1} self.id_to_token: List[str] = [MASK_...
true
8b55d761ffb598b3a0cd40930860efca84d7e917
Python
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_200/3538.py
UTF-8
1,434
2.859375
3
[]
no_license
#f = open('C:/Users/Avinash/Desktop/Google codejam 2017/pycharmworks/input2', 'r') # C:\Users\Avinash\Desktop\Google codejam 2017\pycharmworks\AA-small-practice.in # f = open('C:/Users/Avinash/Desktop/Google codejam 2017/pycharmworks/A-large-practice.in', 'r') f = open('C:/Users/Avinash/Desktop/Google codejam 2017/p...
true
10fc9b2d7e508e3e467f4375f6b478f345decde7
Python
gagejustins/snql
/snql/app/data_scripts/data_api.py
UTF-8
1,103
2.515625
3
[]
no_license
import pandas as pd def generate_pairs_owned_over_time_df(conn): sql="""select c.month, count(*) as pairs_owned from calendar_monthly c join dim_sneakers s on s.created_at <= c.month and (sold_at >= c.month or sold_at is null) and (trashed_at >= c.month or trashed_at is null) and (given_at >= c.month or give...
true
1239fe53f1e1b6f81fa4bbf5e2cb2fcbd8cb2c4a
Python
nextwiggin4/TimeRisk
/dice_test.py
UTF-8
219
3.515625
4
[]
no_license
from dice import * d1 = Dice() while True: turn = input("please select a trun to check: ") if turn == 'n': print(d1.next_roll()) else: print(d1.roll_for_turn(int(turn))) print(d1.number_of_rols())
true
7eeddaa8459d741a5792749effdd1090ef781f3c
Python
linxigal/tfos
/tfos/tf/models/mlp.py
UTF-8
2,240
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- """ :Author : weijinlong :Time : :File : """ import tensorflow as tf from tfos.tf import TFModel, TFCompile class MLPModel(TFModel): def __init__(self, input_dim=784, hidden_units=300, keep_prob=0.8): """ :param input_dim: 输入节点数 :param hidden_units: 隐含层节...
true
074d56aa9fe8379f522d8d129cefc81cb4a2a805
Python
michalporeba/cooking-with-python
/steps/step01/recipes.py
UTF-8
1,271
4.15625
4
[ "MIT" ]
permissive
# the data - for now hardcoded three recipes recipes = [ { "name": "lemon cake", "description": "a cake with a lemon"}, { "name": "brownies", "description": "a simple cake with chocolate"}, { "name": "cookie"} # there is no description, so we can test this behaviour ] def display_recipes(): print("Avai...
true
a7fbce000908fdfbc6bf8dc9a80780b5668698a7
Python
pps789/introduction-to-deep-learning-2018
/hw1/q3-3.py
UTF-8
775
3.125
3
[]
no_license
import numpy as np import matplotlib import math matplotlib.use('Agg') import matplotlib.pyplot as plt def inv_F(y): return -math.log(1-y) def F(x): return 1-math.exp(-x) N = 1000000 # samples! data = np.random.uniform(0,1,N) samples = list(map(inv_F, data)) H_sample, X_sample = np.histogram(samples, bins ...
true
33c165db6d4daeba6c1340cabb6f84dfaed52d06
Python
remy-algo-dim/AD_serveur
/src/google_filters_to_good_format.py
UTF-8
590
2.78125
3
[]
no_license
import pandas as pd """ Ce fichier a pour but de transformer le format des filtres que l'on telecharge depuis le drive (format CSV), en bon format pour notre algo. On renseignera donc en input : - CSV = path du csv telecharge depuis DRIVE - NON_CLIENT = il s'agit du nom du client figurant dans la premiere colonne du ...
true
215ace42f4865281b3df20b96fe77ba398df9aaa
Python
Wolvarun9295/PythonLibraries
/Seaborn/Swarm Plot/1.PlotOfBillvsSize.py
UTF-8
149
2.625
3
[]
no_license
import seaborn as sns import matplotlib.pyplot as plt tips = sns.load_dataset("tips") sns.swarmplot(x='total_bill', y='size', data=tips) plt.show()
true
bbe0302aa3aa7622696d2a36d0bd619a94c26357
Python
LucasOJacintho/DESENVOLVIMENTO-PYTHON
/DESENVOLVIMENTO PYTHON/1014 - Consumo.py
UTF-8
101
3.0625
3
[]
no_license
distancia=int(input('')) combustivel=float(input('')) print ("%.3f" % (distancia/combustivel),'km/l')
true
f09f7c467bdbfb83b79b41af2003d76057d9d0a3
Python
HAOYU-LI/Web_Search_Application
/src/Inverted_ID.py
UTF-8
3,213
2.921875
3
[]
no_license
import os import re import sys import json class Inverted_ID: """ A class that constructs the inverted index for cvpr metadata. input: dic : A dictionary that stores the cvpr research papers. e.g. {'cvpr': [{'subject': '2013 IEEE Conference on Computer V...
true
b89e0be3bb1597a95716fe5f194fef0a94df6255
Python
ewhuang/pacer
/ensg_to_hgnc_conversion.py
UTF-8
3,552
2.734375
3
[]
no_license
### Author: Edward Huang from collections import OrderedDict import numpy as np ### This script converts the new auc file for drug response in patients to the ### old format that the Mayo data used. Also converts the gene expression table ### to the old format. Lastly, converts the LINCS level 4 data to the old ### f...
true
b432a9723adf994533ed1bba53f318b62834a3d2
Python
bobovnii/Stau
/NTupleMaker/test/DatacardProducer/ratioPlotSyst.py
UTF-8
5,023
2.640625
3
[]
no_license
###################################################################################### # Script to plot the central, up and down distributions # # for each MC process and syst uncertainty. # # The lower pad plots the ratios. # # It is meant to run on ROOT files produced by the datacardP...
true
30bbf1c6f184ee2a9a99d92529d37ff0c24a6686
Python
primus2019/mini-project
/utils/Plots.py
UTF-8
2,097
2.59375
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from .EDA import feature_VIF def correlationPlot(ds, features, savefig, title=None): features = ds.columns.values.tolist() if features == 'all' else features corr = ds.loc[:, features].corr() mask = np.zeros_lik...
true
752bd5e6cc99f72c6814537c118c9ff58134757a
Python
lucaschen321/leetcode
/python/p0424-longest-repeating-character-replacement/p0424-longest-repeating-character-replacement.py
UTF-8
1,078
3.640625
4
[ "MIT" ]
permissive
from collections import defaultdict class Solution: def characterReplacement(self, s: str, k: int) -> int: if not s: return 0 character_frequency = defaultdict(int) character_frequency[s[0]] += 1 # Include 1st character so character_frequency.values() isn't empty left...
true
38d76130202cfd90e8de51c59a628bc9acb4b92c
Python
Dhanush33324/Python_Pytest_Demo
/Scenario 1.py
UTF-8
2,000
2.5625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.support import expected_conditions from selenium.webdriver.support.select import Select from selenium.webdriver.support.wait import WebDriverWait driver = webdriver.Chrome("./chromedriver") driver.get("https://rahulshettyacademy.com/seleniumPractise/#/") search_it...
true
a41fca7d8eee1fb49cafbeca0b1b1265dd30914a
Python
Artem-Efremov/CodeWars
/Strings/6kyu_Scooby Doo Puzzle.py
UTF-8
4,256
3.765625
4
[]
no_license
""" Introduction Good one Shaggy! We all love to watch Scooby Doo, Shaggy Rogers, Fred Jones, Daphne Blake and Velma Dinkley solve the clues and figure out who was the villain. The story plot rarely differed from one episode to the next. Scooby and his team followed the clue then unmasked the villain at the end. Sc...
true
5aff677bbf36e68ff625f16c37ccef5c7c643cf3
Python
DanielJBurbridge/Jetbrains-Academy
/Hyperskill/Python/Medium/Webscraper/Webscraper/1.0/scraper.py
UTF-8
293
3.09375
3
[]
no_license
import requests url = input("Input the URL:\n") r = requests.get(url) if r.status_code == 200: r_json = (r.json()) if 'content' in r_json: print(r_json.get('content')) else: print("Invalid quote resource!") else: print("Invalid quote resource!")
true
50b1e5e598ec042cd656526f3dcf585ae6e68a38
Python
akiraboy/python_20191010
/collections_tbier/zad_7.py
UTF-8
238
3.921875
4
[]
no_license
napis = input("POdaj ciag znaków: ") samogloski = ['a', 'e', 'i', 'o', 'u', 'y'] ile_samoglosek = 0 for znak in napis: if znak in samogloski: ile_samoglosek += 1 print(f"Znaleziono samoglosek: {ile_samoglosek}")
true
30be00a608cfe4674ffbba5469ad8e9a554c0f06
Python
git-metal/python-learn
/python-lib/Concurrent/test_threading.py
UTF-8
1,450
3.359375
3
[]
no_license
import threading from time import ctime, sleep class MyThread(threading.Thread): def __init__(self, func, args, name=""): # threading.Thread.__init__(self) super(MyThread, self).__init__() self.name = name self.func = func self.args = args def run(self)...
true
ce6a2a0741353d427a4dc4bead7f9dffa514191f
Python
lukaszmitka/beacon_detector
/scanner.py
UTF-8
2,472
2.6875
3
[]
no_license
from bluepy.btle import Scanner, DefaultDelegate import sqlite3 import datetime class ScanDelegate(DefaultDelegate): def __init__(self): DefaultDelegate.__init__(self) def handleDiscovery(self, dev, isNewDev, isNewData): if isNewDev: print "Discovered device", dev.addr elif...
true
b4155ca142b910a4062222acc6a9b0557edc9d7c
Python
ibiehler/isabelleb
/Labs/School Greenhouse Gas Emissions/ghg_lab.py
UTF-8
4,281
3.796875
4
[]
no_license
''' Greenhouse gas emissions (GHG) vs. square footage for all school buildings in Chicago Data set used will be Chicago Energy Benchmark info from 2018 data can be found at... https://data.cityofchicago.org/api/views/xq83-jr8c/rows.csv?accessType=DOWNLOAD Energy Efficiency of Chicago Schools (35pts) Chicago require...
true
6dbe60c72d7495e4fedc5daa877f280a2b02b25e
Python
sWizad/diffeqsolver
/main5.py
UTF-8
8,668
3.0625
3
[]
no_license
""" NN to solve 1st order ODE problems based on Rosenbrock Euler method """ # Import the required modules from __future__ import division import numpy as np import os, sys import matplotlib.pyplot as plt import tensorflow as tf from utils import colored_hook # tf.enable_eager_execution() # This makes the plots ap...
true
9dc55b66267bf64baac83be1e6d6f798c9d96468
Python
redixhumayun/ctci
/HackerRank/projectEuler.py
UTF-8
1,448
3.421875
3
[]
no_license
import unittest import pdb from fractions import Fraction def findSumOfProducts(number): result = 0 for num in range(5, number + 1): pdb.set_trace() result += findMaxProduct(num) return result def findMaxProduct(n): max_value = 0 for divisor in range(1, n): product = Fracti...
true
551d351319962976d1c5729157cc9c054385d368
Python
Ro9ueAdmin/django-orchestra
/orchestra/permissions/options.py
UTF-8
3,550
3.0625
3
[ "BSD-3-Clause" ]
permissive
import functools import inspect # WARNING: *MAGIC MODULE* # This is not a safe place, lot of magic is happening here class Permission(object): """ Base class used for defining class and instance permissions. Enabling an ''intuitive'' interface for checking permissions: # Define permiss...
true
42a2887dc16e67b1f43de510a505912a05a87061
Python
Debdut24/Pong
/puddle.py
UTF-8
478
3.734375
4
[]
no_license
from turtle import Turtle class Puddle(Turtle): def __init__(self, x, y): super().__init__() self.x = x self.y = y self.color("white") self.shape("square") self.penup() self.shapesize(stretch_wid=5, stretch_len=1) self.goto(x, y) def move_up(self...
true
782c4d867fe81a436f2dd6c061ee2bbd7f5f8eba
Python
purnima64/DS_Titanic
/basic_fun.py
UTF-8
2,280
3.6875
4
[]
no_license
import numpy as np import pandas as pd def basic_df_exploration(df): """ Provides basic data exploration details Params: ------- df: pandas dataframe Returns: -------- None Prints the following output: - Shape - Column name and respective types - Descriptive stats - ...
true
64769cc0532a2e48c4e607781a4cc342dbcf5d74
Python
LCDG-tim/2020-exos
/arbres3.py
UTF-8
2,185
3.421875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Nov 24 15:37:37 2020 @author: timot """ class ABR: def __init__(self,val): self.valeur=val self.gauche=None self.droite=None def inserer(self,x): if x<self.valeur: if self.gauche!=None:# si il y a un noeud à gauche ...
true
ccbdfe9e20b716053ce7e286dc1b4f060a9b40a4
Python
aspcodenet/IotListLabbar
/IotListLabbar/Lab1.py
UTF-8
199
3.59375
4
[]
no_license
lista = [] for i in range(0,4): lista.append(int(input(f"Mata in tal {i+1}:"))) largestSoFar = lista[0] for i in lista: if i > largestSoFar: largestSoFar = i print(largestSoFar)
true
3e3c620aa3287ba9266d0eb61a0d92a45c0e7e5a
Python
runzezhang/Code-NoteBook
/lintcode/1243-number-of-segments-in-a-string.py
UTF-8
1,475
3.828125
4
[ "Apache-2.0" ]
permissive
Description 中文 English Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters. the string does not contain any non-printable characters. Have you met this question in a real interview? Example Example: Input: "Hello, my name is John" Output: 5 Expla...
true
37e9c844ce04a3c8f7af90584a1609da00787292
Python
kdungs/adventofcode
/2021/05.py
UTF-8
1,434
3.78125
4
[]
no_license
#!/usr/bin/env python3 from collections import defaultdict with open("data/05.txt") as f: lines = f.readlines() points = defaultdict(int) for line in lines: left, right = line.split(" -> ") x1, y1 = map(int, left.split(",")) x2, y2 = map(int, right.split(",")) if x1 != x2 and y1 != y2: #...
true
ceb98003f824c3a85ed547bbbc63f7a47354fdde
Python
javierwilson/commcare-hq
/corehq/blobs/tests/util.py
UTF-8
940
2.609375
3
[]
no_license
from shutil import rmtree from tempfile import mkdtemp import corehq.blobs as blobs from corehq.blobs.fsdb import FilesystemBlobDB class TemporaryFilesystemBlobDB(FilesystemBlobDB): """Create temporary blob db and install as global blob db Global blob DB can be retrieved with `corehq.blobs.get_blob_db()` ...
true
03c879bb46dee0e3eba046547eae73819ecf1ae1
Python
ChidinmaKO/Chobe-Py-Challenges
/bites/bite155.py
UTF-8
1,397
3.828125
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
import re import shlex def split_words_and_quoted_text(text): """Split string text by space unless it is wrapped inside double quotes, returning a list of the elements. For example if text = 'Should give "3 elements only"' the resulting list would be: ['Should', '...
true
83339f9e2e2f9ab76f41bd75814dd4b58b599d38
Python
fernandochimi/python-data-analysis
/python_data_analysis/chapter_03/03-linear-algebra.py
UTF-8
221
3.078125
3
[]
no_license
# coding: utf-8 import numpy as np A = np.mat("2 4 6; 4 2 6; 10 -4 18") print "A\n", A inverse = np.linalg.inv(A) print "Inverse of A\n", inverse print "Check\n", A * inverse print "Error\n", A * inverse - np.eye(3)
true
c0d48ae35700a9bf4baf94fa1e6b3f32030fbfc0
Python
maxdatascience/tic-tac-toe
/tic-tac-toe.py
UTF-8
3,270
4.1875
4
[]
no_license
import random def display_board(board): print('\n'*100) print(f"| {board[7]} | {board[8]} | {board[9]} |") print("-------------") print(f"| {board[4]} | {board[5]} | {board[6]} |") print("-------------") print(f"| {board[1]} | {board[2]} | {board[3]} |") def player_input(): ""...
true
091824f44461290479800b6f5b33923bcfead9d0
Python
LibriCerule/Cerulean_Tracking
/db_unittest.py
UTF-8
1,461
2.59375
3
[ "MIT" ]
permissive
from tracker_database import TrackerDatabase test_uuid = "de305d54-75b4-431b-adb2-eb6b9e546014" test_uuid2 = "de305d54-75b4-431b-adb2-eb6b9e546015" def test_track_new_package(): test_name = "4401 Wilson Blvd #810, Arlington, VA 22203" test_lat = 0 test_lon = 0 test_delivered = False test_time = "2...
true
ac9947fe8f632200c831439009a2610e6673dc1a
Python
ashutoshdhondkar/basic-python
/comprehension_exercise.py
UTF-8
498
4.3125
4
[]
no_license
#Wap to check whether an input number is multiple of 5 and is greater than 17 ''' #without comprehension ip=int(input("Enter a number : ")) if(ip%5==0) and (ip>17): print("Satisfied") else: print("Not satisfied") ''' # with comprehension def check(num): if(num%5==0 and num>17): ...
true
ef9c01c7d62edf3c170a2bfb2f79545e9fac4a22
Python
minbbaevw/multi.plus.py
/main.py
UTF-8
1,375
4.34375
4
[]
no_license
# Дан массив целых чисел. Нужно найти сумму элементов с четными индексами (0-й, 2-й, 4-й итд), затем перемножить эту сумму и последний элемент исходного массива. Не забудьте, что первый элемент массива имеет индекс 0. # Для пустого массива результат всегда 0 (ноль). # Входные данные: Список (list) целых чисел (int). ...
true
2b1a6f8ddbeb857738b34659c2da131f3c627ce1
Python
subicWang/leetcode_aotang
/tools/binarytree.py
UTF-8
3,592
3.5
4
[]
no_license
# -*- coding: utf-8 -*- """ Aouther: Subic Time: 2019/8/28: 10:08 """ from collections import Iterable import networkx as nx import matplotlib.pyplot as plt class Node(object): def __init__(self, value, left=None, right=None): self.val = value self.left = left self.right = right class Bin...
true
fa95b14cee4d49c0e64817a0e6c43c222f6fc9fb
Python
andreas19/pygemina
/src/gemina/__main__.py
UTF-8
3,156
2.84375
3
[ "BSD-3-Clause" ]
permissive
# flake8: noqa """Usage: gemina encrypt -i INFILE -o OUTFILE [-V N] (-p | -k) [INPUT] gemina decrypt -i INFILE -o OUTFILE (-p | -k) [INPUT] gemina verify -i INFILE (-p | -k) [INPUT] gemina create -o OUTFILE [-V N] Commands: encrypt encrypt a file decrypt decrypt a file verify verify a file create...
true
8ee17ccebc20de05c3e6e1b868ea89d7a4597738
Python
dwtrain/Gitpractice
/calc.py
UTF-8
320
3.515625
4
[]
no_license
def add(x,y): return x+y def sub(x,y): return x-y def mult(x,y): return x*y def divide(x,y): if(y==0): return NULL else: return x/y def mod(x,n): return x%n print('these are math operations') print(add(2,4)) print(sub(2,4)) print(mult(2,4)) print(divide(2,4)) print(mod(2,4))
true
108565a87cf38864a7ced4482f9753a2a9159475
Python
499244188/Python
/1datetime.py
UTF-8
1,448
3.625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Apr 13 14:06:18 2017 @author: Z """ from datetime import datetime now = datetime.now() print(now) print(type(now)) #指定时间日期 dt = datetime(2017,5,4,23,1) print(dt) dt.timestamp()#把datatime转为timestamp t = 3600*24*360*48-3600*24*11 print(datetime.fromtimestamp(t)) t = 14939...
true
58b8f72c633407e708f248f6cc3d1fd931d7540c
Python
Dharian/pythonProject
/Ejercicios/Listas/Ejercicio 9 LIstas.py
UTF-8
404
3.796875
4
[ "MIT" ]
permissive
def cargarLista(): lista=[] for x in range(5): lista.append(str(input("Ingresa tus cinco palabras favoritas"))) print(lista[x]) comprobarLongitud(lista) def comprobarLongitud(lista): for elemento in lista: if len(elemento) > 5: print(elemento) else: p...
true
7b6c0519f2e32876ba7e16973eb7f88672eed47a
Python
sekunder/SWDB-KART
/pca/main.py
UTF-8
1,344
3.328125
3
[]
no_license
from sklearn.preprocessing import StandardScaler import numpy as np def pca(X, ndims=3): """Runs PCA on provided data, X, and returns the projection onto ndims principal components. This function assumes X has data series in columns. This function also returns the covariance matrix of the data (scaled to zero norm a...
true
45fdf75a9b30b797f1090d38a62c184c9e204a3d
Python
BartlomiejCiurus/PythonClasses
/Functions/4.2.py
UTF-8
841
3.65625
4
[]
no_license
__author__ = 'Bartek' def print_ruler(number): ruler = "" limiter = " " counter = 0 border_value = 10 for i in range(1, number): ruler += "|...." ruler += "|\n" for character in ruler: if character == '|': ruler += str(counter) counter += 1 ...
true
b3ec75f76aa090dab2d5fd8237b9d7ffc6b981f9
Python
gdurin/Python-in-the-lab
/problems/plot3D_withcolors.py
UTF-8
580
2.765625
3
[ "CC-BY-3.0" ]
permissive
import numpy as np import pandas as pd from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt from matplotlib import colors as mcolors fig = plt.figure() ax = fig.add_subplot(111, projection='3d') data = pd.read_csv("output_point.csv", names=['x','y','z','R','G','B']) c = [mcolors.to_hex([r/255,g/255...
true
c690610208b79cb822ddbf41ce7fd9a407d8b00c
Python
haribogummi/test
/anotation1.py
UTF-8
907
2.578125
3
[]
no_license
# coding: UTF-8 import re import sys import csv def position(): dic1={} dic2={} f=open("snp_test.csv","rb") datareader = csv.reader(f) for row in datareader: dic2={row[1]:row[2]} dic1.update(dic2) return dic1 f.close() def search(): dic1=position() c=0 print "Position,Nuc,n_p,Start,End,Type" for k,...
true
47a53542ffae6efd469c633154fe5af425a87af9
Python
baez97/shonen
/Source Code/Estado.py
UTF-8
1,877
3.109375
3
[]
no_license
import pygame from pygame.locals import * class Estado: def pintar(self, personaje): self.grafico.pintar(personaje) def getImage(self): return self.image def isUp(self): return False def isDown(self): return False def isRight(self): return False def isL...
true
8e5f4d6addb9f956efb0907c36dd4f69e8f12635
Python
yellowrangler/vue
/systemscripts/putvue.py
UTF-8
811
2.96875
3
[]
no_license
#!/usr/bin/env python #!/usr/bin/env python3 import sys import subprocess import glob # global variables mysqlcommand = "mysql -u tarryc -p vue < " file_list = [] cmd = "no file selected" file_list = glob.glob('vue-*python.sql') l = len(file_list) i = 0 while (i < l): name = file_list[i] print name answer = raw...
true
5c89f0b24ef920a2fa5c9b2cbd372881868bbb1f
Python
yeasin50/Traffic-Sign-Classification
/traffic_sign_net.py
UTF-8
3,371
2.765625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # <center> TrafficSignNet # Conv2D # input: (None, 32, 32, 3) # output: (None, 32, 32, 8) # # Activation # input: (None, 32,32,8) # output: (None, 32,32,8) # # BatchNormalization # input: (None, 32, 32, 8) # output: (None, 32, 32, 8) # # MaxP...
true
098f3382a214dd08406eae9310623053599fd72a
Python
pheldox/Covid-19-Tweet-Classification
/app.py
UTF-8
2,293
3.0625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Jul 6 21:37:09 2020 @author: Ayush """ # covid 19 tweets import streamlit as st import pickle import numpy as np from nltk.corpus import stopwords from nltk.stem.porter import PorterStemmer from nltk.stem import WordNetLemmatizer from PIL import Image import re...
true
28803ddbabe66f9294d4cfb1e2780e5418ff49c4
Python
kevjam/fake-news-classifier
/src/predict.py
UTF-8
2,428
2.625
3
[]
no_license
from preprocess import filter_dataset from utils.tokenizing import segment_zh_data, tokenize from utils.storage import load_tokenizers # -------------- General Packages -------------- # Data Manipulation import pandas as pd import numpy as np # For Saving/Loading Files import os from keras.models import lo...
true
08c7a5a38bf556feb2270064acae6082b1251ea3
Python
junli-cs-fiu/spinner_public
/matrix.py
UTF-8
1,224
2.984375
3
[]
no_license
import numpy as np def Cauchy(m, n): x = np.array(xrange(n + 1, n + m + 1)) y = np.array(xrange(1, n + 1)) x = x.reshape((-1, 1)) diff_matrix = x - y cauchym = 1.0 / diff_matrix return cauchym def RS(n, k): I = np.identity(k) P = Cauchy(n - k, k) return np.concatenate((I, P), axis...
true
92197a7af9b0cd9ba5a036f49b23cae7b1b182d4
Python
jobafash/InterviewPrep
/educative.io/patterns/bfs/easy4.py
UTF-8
2,272
4.65625
5
[]
no_license
''' Given a binary tree, populate an array to represent the averages of all of its levels. Solution# This problem follows the Binary Tree Level Order Traversal pattern. We can follow the same BFS approach. The only difference will be that instead of keeping track of all nodes of a level, we will only track the runnin...
true
9b043b127f870220d33161f7b1a1cc229fd10b19
Python
tcbrouwer/FourierMonitor
/HarmonicAI/main.py
UTF-8
384
2.9375
3
[]
no_license
import random import math from FourierClerk import FourierClerk clerk = FourierClerk(1000) supervisor = FourierClerk(10) print(clerk.get_coefficients_for_channel(0)) for i in range(0,2000): clerk.note([math.sin(math.pi * i/10)]) #clerk.note([random.random()]) supervisor.note(clerk.get_coefficients_for_cha...
true
8c88611626c37a22dc1ca4ca4d76db530a61d8fe
Python
ProximaB/Control-of-a-mobile-robot-with-extrinsic-feedback
/Find_Detect_base/qt6clock.py
UTF-8
1,077
2.71875
3
[]
no_license
import cv2 def start_webcam(self): if not self.cameraRuns: self.capture = cv2.VideoCapture(cv2.CAP_DSHOW) self.cameraRuns = not self.cameraRuns self.timer = QTimer(self) self.timer.timeout.connect(self.update_frame) self.timer.start(2) from PyQt5.QtCo...
true
712bfa1d9fc2476c22fd135f2332df416e25bdf0
Python
vparikh10/facial-expression-classifier
/fec/classifier/gl_data.py
UTF-8
2,096
2.625
3
[]
no_license
import numpy as np from boto.s3.connection import S3Connection import os from filechunkio import FileChunkIO import math import pandas as pd _conn = None def get_connection(): """Get the boto connection to Amazon S3 This method assumes the environment variables AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_K...
true
f8ab8524e8caae4e35e1a6360a1a74cc58c2d5a2
Python
Lan2008-StudioPro/Python_Singular
/Homework/20210321/t2_climate.py
UTF-8
560
4.34375
4
[]
no_license
#溫度問題 while True: a=input('今天攝氏幾度?') try: a=int(a) except: print('蛤?我問你溫度你回答這什麼鬼東西?') else: if a>=40: print('怎麼可能?這麼熱!') elif a<=10: print('天哪!太冷了吧~') else: print('真舒適的溫度!') """ Topic:輸入溫度,如果溫度>=40度C,顯示: 太熱,    如果溫度<= 10 顯示:太冷...
true
b0e9b6eecb284ae06b2169c65d1d99aa90802b34
Python
py2-10-2017/MatthewKim
/Fundamentals/DebuggingLearn.py
UTF-8
120
3.34375
3
[]
no_license
def multiply(arr,num): for x in arr: arr[x] *= num return x a = [2,4,10,16] b = multiply(a,5) print b
true
8444472261faf517ddb82e348afe0690bd4c7b45
Python
SHawkeye77/game_1
/items_all/items_research_dome.py
UTF-8
6,261
3.171875
3
[]
no_license
""" Holds items specifically made in the research dome """ from items import Item from items_all.items_general import * ############################# Achebe Office Items ############################ class WetWipes(Item): def __init__(self): super().__init__(name=["Wet Wipes", "Wipes"], can_pick_up=True, ...
true
708333088d6d79c3df015aa2450c2691903a5793
Python
SMG2S/SMG2S
/scripts/verification.py
UTF-8
4,885
2.546875
3
[ "MIT" ]
permissive
''' MIT License Copyright (c) 2019 Xinzhe WU @ Maison de la Simulation, France Copyright (c) 2019-2022, Xinzhe Wu @ Simulation and Data Laboratory Quantum Materials, Forschungszentrum Juelich GmbH. Permission is hereby granted, free of charge,...
true
e8885c972bf210344f8d892ba43b2eb4537589c4
Python
erosethan/Proyecto-Compiladores-1
/main.py
UTF-8
517
2.78125
3
[]
no_license
#!/usr/bin/python import automata, nodo, expreg entrada = input() expresionRegular = expreg.marcarConcatenacion(entrada) print(entrada + ' ===> ' + expresionRegular + '\n') expresionRegular = expreg.infijaAPosfija(expresionRegular) inicioAutomata = automata.expregAThompson(expresionRegular) automata.generarImagen(...
true
944be212b7f66b29ba240ab8703291f9cc863192
Python
zzong2006/coding-problems-study
/pythonProject/leetcode/First Missing Positive.py
UTF-8
514
3.09375
3
[]
no_license
from typing import List class Solution: def firstMissingPositive(self, nums: List[int]) -> int: if not nums: return 1 else: max_val = max(nums) if max_val <= 0: return 1 else: num_set = set(nums) for i...
true
125d0ffd669a416346ee2edcc48baabf61b8e14f
Python
edu-sense-com/OSE-Python-Course
/SPP/Modul_05/przestawieniowe.py
UTF-8
3,626
3.953125
4
[ "MIT" ]
permissive
class Skaut_Cipher: def __init__(self, text: str, direction: str="E") -> None: """ direction: E -> for encryption - default direction: D -> for decryption """ self.direction = direction self.input_text = text.upper() if self.direction == "E" else "" self.text_...
true
1e1a1215e058abea0dfeb04b584c726bb22f195d
Python
jhelphenstine/python-class-exercises
/server.py
UTF-8
3,221
2.921875
3
[]
no_license
#!/usr/bin/python # Task: Implement a server to run on an Ubuntu system. It must: # -- hold a port # -- receive commands -- in the form of command-line arguments # -- execute commands -- via os library # -- return the results -- capture stdout/stderr... # immediate considerations: # we'll need sockets # w...
true
e43b789c39d64d3991b7118f85f02c82cb605a14
Python
bpull/FST
/fornick/split.py
UTF-8
276
2.921875
3
[]
no_license
fp = open("tickers.txt","r") fp2=open("companies.txt","w") for line in fp: newlist = [] for word in line.split(): if word == "reports": break else: newlist.append(word) fp2.write(newlist.pop(0) + " "+" ".join(newlist)+"\n")
true
0590e7cc54b683444f9eff18fddb3ee9732e9382
Python
MichaelPHartmann/Custom-Analysis-Tools
/main.py
UTF-8
799
2.65625
3
[]
no_license
""" This is the general working file for accessing the different analysis tools. All of the tools will be accessed from here to keep clutter down and keep the modules clean. This also may be used for developing new tools, but they must be moved to their own modules when done. Export or pickling may happen here for now ...
true
805c7c4fd5e848a6988eab6846b7f9546adc3a78
Python
techsharif/python_training_2021
/day1/function.py
UTF-8
89
3
3
[]
no_license
# def hello (): # print("hello") # hello() def add(a, b): print(a+b) add(4, 5)
true
d6122eb9d0b547020a0d0e0de14335f3af383ee1
Python
PEDSnet/Data-Quality-Analysis
/Tools/ConflictResolution/resolvers/ba_001.py
UTF-8
2,591
2.90625
3
[ "BSD-2-Clause" ]
permissive
# function to resolve conflicts from log file # Inputs: (i) log_issue - an object read the log file (ii) secondary_issue - a similar issue read from the secondary # report, # (iii) threshold_l, and threshold_u are the thresholds corresponding to the check type CA-006 # returns a set of objects that would replace the s...
true
e575a68d176957788541953feec141022412d060
Python
Mathakgale/level-0-coding-challenge
/task1.py
UTF-8
105
3.703125
4
[]
no_license
x = 0 y = 1 print(f"x = {x}") print(f"y = {y}") x = x + 3 y = y + x print(f"x = {x}") print(f"y = {y}")
true
2df354300958188d20f0eabd5d791146f0215c6d
Python
wsgan001/PyFPattern
/Data Set/bug-fixing-5/a9efceb30baa6002b4ea7f551c94f5e65e9d6f41-<_label_path_from_index>-fix.py
UTF-8
475
2.640625
3
[]
no_license
def _label_path_from_index(self, index): '\n given image index, find out annotation path\n\n Parameters:\n ----------\n index: int\n index of a specific image\n\n Returns:\n ----------\n full path of annotation file\n ' label_file = os.path.join...
true
577438bcffa25dd5552a557e661b88db540ae9dc
Python
Aasthaengg/IBMdataset
/Python_codes/p02712/s061370665.py
UTF-8
189
3.203125
3
[]
no_license
N = int(input()) ans = [0] * (N+1) for i in range(N+1): if i % 3 != 0 and i % 5 != 0 and i % 15 != 0: ans[i] = ans[i-1] + i else: ans[i] = ans[i-1] print(ans[-1])
true
897f9ae2bab6ea1212577bfecc210e17a737b78f
Python
JiachenLi/PythonLearning
/emailaddress2.py
UTF-8
351
3
3
[]
no_license
# !/usr/bin/env python3 # -*- coding: utf-8 -*- ' a test module ' __author__ = 'Jiachen Li' import re def name_of_email(addr): s = str(addr) m = re.match(r'/^\<([a-zA-Z\s]+)\>\s([a-zA-Z][a-zA-Z\d\_\.]*@[a-zA-Z\d]+\.[a-zA-Z]{2,3})$/', s) if m: print(m.group(1)) else: pr...
true
1811d475dff7f4d0cec5289ec42b86008cad493b
Python
nosleep123/shawn-sascode
/Scraper.py
UTF-8
3,856
2.734375
3
[]
no_license
import logging import os DEFAULT_DATA_PATH = os.path.abspath(os.path.join( os.path.dirname('/Users/shuhao/PycharmProjects/Learning/data/SEC'), '..', 'SEC-Edgar-Data')) # -*- coding:utf-8 -*- # This script will download all the 10-K, 10-Q and 8-K # provided that of company symbol and its cik code. class HoldingIn...
true
4d68b1e6413d7d15f01902a1f3b32a86b4fde8ae
Python
zhangweisgithub/demo
/python_module/asyncio_module/case2.py
UTF-8
2,633
3.828125
4
[]
no_license
# !/usr/bin/env python # -*- coding: utf-8 -*- """ 可等待对象 如果一个对象可以在 await 语句中使用,那么它就是 可等待 对象。许多 asyncio API 都被设计为接受可等待对象。 可等待 对象有三种主要类型: 协程, 任务 和 Future. """ print("---------------------协程-------------------------") """ 协程函数: 定义形式为 async def 的函数; 协程对象: 调用 协程函数 所返回的对象。 """ import asyncio async def nested(): return...
true
cf6fb96b2e2dd3c49fd399938623478f8d986fdd
Python
bolton-nate/ttt_minimax
/main.py
UTF-8
4,080
3.484375
3
[]
no_license
# This is where your main() function will go. # The main() function will tie all other functions together. # You may add other functions here as needed. from userInput import * from computerInput import * from computerRandom import * from computerMinimax import * from computerAlphaBeta import * from Game import * tota...
true
eb9de6d661fa1ed71f06142a46caae0a59f52529
Python
try1995/Linear-classifier
/activation_statistic.py
UTF-8
1,527
3.015625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt from time import time '''激活函数策略和权值的选择''' start = time() D = np.random.randn(1000, 500) hidden_layer_sizes = [500]*10 nonlinearities = ['tanh']*len(hidden_layer_sizes) '''激活函数''' act = {"relu": lambda x: np.maximum(0, x), 'tanh': lambda x: np.tanh(x), 'sigmoid'...
true
f26eeb9f03ebac01629696e35ea122aa535e7bbf
Python
Kimseongick/2017_NIMS_CNC_Problem
/04_Code.py
UTF-8
8,933
2.625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: data_1 = pd.read_csv('data/data_1.csv', header=None, index_col=None) data_2 = pd.read_csv('data/data_2.csv', header=None, index_col=N...
true
62ea2f4508ce0d0dc9efe8c61e76abeeacd98985
Python
gustavobiage/URI_Solutions
/AD-HOC/1441.py
UTF-8
180
3.125
3
[]
no_license
while 1: hstr = input() h = int(hstr) if h == 0: break m = 1 while h != 1: if h > m: m = h if h % 2 == 1: h = 3 * h + 1 else: h = h / 2 h = int(h) print(m)
true
f7a8ab7ad061c1a5433d7d9a1867909a30be186e
Python
hatopoppoK3/AtCoder-Practice
/AOJ/ALDS1/002/C.py
UTF-8
845
3.59375
4
[]
no_license
def bubble_sort(A, N): A = list(A) for i in range(1, N): for j in range(0, N-i): if A[j][1] > A[j+1][1]: A[j], A[j+1] = A[j+1], A[j] tmp = [] for x, y in A: tmp.append(x+str(y)) return tmp def selection_sort(A, N): A = list(A) for i in range(0, N...
true
adc02d239be6ef8375f83e00f752deb9bfcb75c5
Python
araghuram3/SF_NN
/evaluate_data.py
UTF-8
1,234
2.59375
3
[]
no_license
# script to process data # will depend on how the data is imported # write now will assume it is placed in a folder "test" in the same directory # import statments import matplotlib.pyplot as plt # tensorflow statements import tensorflow as tf layers = tf.keras.layers from tensorflow.keras.preprocessing.ima...
true
1330e427651c295ed4b4cb79f33bc2bce1743d97
Python
ycxzfforever/Python_Study
/time.py
UTF-8
1,184
3.515625
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import time; # 引入time模块 import calendar; ticks = time.time() print "当前时间戳为:", ticks localtime = time.localtime(time.time()) print "当前时间结构体:",localtime print "当前时间:",time.asctime(localtime) # 格式化成2016-03-20 11:45:39形式 print time.strftime("%Y-%m-%d %H:%M:%S %A %B %x %X %...
true
2a28c8391fc043e005b0e27e0109492299030186
Python
KarenWest/pythonClassProjects
/newtonRaphsonMethod.py
UTF-8
1,090
4
4
[]
no_license
#Summary - admittedly--had help from internet search here! Have not learned all these tricks yet. # Solve for a zero of function using Newton-Raphson method #Usage # real = func(real) # real = funcd(real) # real = newton(func, funcd, real [, TOL=real]) #""" Ubiquitous Newton-Raphson algorithm for solvi...
true
d682a3f8a3332e2e45fd66d7cfdb97138375c071
Python
KiranChavan326/sdet
/python/acc2.py
UTF-8
153
3.8125
4
[]
no_license
num = int(input("Enter the number :")) mod = num%2 if mod>0: print("You picked the old number") else: print("You picked the even numer")
true