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
a1f6cd29fe2f9d6f779f2c3048539b29d07b2a28
Nian-Jingqing/deBettencourt_realtimeBehav
/paper_behavior.py
UTF-8
833
3.078125
3
[]
no_license
import numpy as np import scipy #determine the frequent category #note: which category was frequent vs. infrequent category was counterbalanced across subjects def find_freq_categ(categs): modeCategs = scipy.stats.mode(categs,axis=None) freqCateg = modeCategs[0] infreqCateg = freqCateg % 2 + 1 return...
true
d4662eb765173e5bc77a531c8e937b652d037ca5
riZZZhik/Facades
/facades.py
UTF-8
6,881
2.609375
3
[ "Apache-2.0" ]
permissive
import logging import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '0' logging.getLogger("tensorflow").setLevel(logging.DEBUG) logging.basicConfig(filename='logs.log', filemode='w', level=logging.DEBUG, format='%(asctime)s: %(levelname)s - %(message)s') import keras import numpy as np from keras.callba...
true
677321f45d9f9dfed24cf3bb4cca1e3d22656325
JulianNicholls/Adventure
/python/adventure1.py
UTF-8
2,046
3.859375
4
[]
no_license
from inventory import * from room import * def take(room, nouns): for i in nouns: item = room.take(i) if item: print('You pick up the', item, 'and stash it in your bag of holding.') the_inv.add(item) elif i != 'and': print("There's no", i, 'to ta...
true
e76f87bf9a5934583639f858e593f5d2aa9558fc
Jarvis73/SubKmeans-Python
/Display.py
UTF-8
2,515
3.140625
3
[ "MIT" ]
permissive
import numpy as np from pathlib import Path import matplotlib.pyplot as plt import pandas as pd from pandas.plotting import scatter_matrix import matplotlib.colors from scipy.stats import gaussian_kde from src.utils import DataIO def factor_scatter_matrix(df, factor, palette=None): '''Create a scatter matrix of ...
true
5b880d0b3b1d60ede8bc2e3eac35e47b8ae1d005
srikanthpragada/PYTHON_15_MAY_2018_DEMO
/exercises/old_prime.py
UTF-8
218
3.96875
4
[]
no_license
num = int (input("Enter a number :")) prime = True for i in range(2, num//2 + 1): if num % i == 0: prime = False break if prime: print("Prime number!") else: print("Not a prime number")
true
b8f78aceb1ca433313f2434f7dfb917fc6671db2
ai-med/nn-common-modules
/build/lib/nn_common_modules/octave_convolution_block.py
UTF-8
6,558
2.609375
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import torch.nn.functional as F from math import ceil,floor from torch.nn.modules.utils import _single, _pair, _triple class OctConv2d(nn.modules.conv._ConvNd): """Unofficial implementation of the Octave Convolution in the "Drop an Octave" paper. oct_type (str): The type of...
true
8a1775bed9c05d7ebf79dde29a7329a7226310ee
bnbwebexpertise/linkr
/util/decorators.py
UTF-8
11,345
2.515625
3
[ "MIT" ]
permissive
import threading import time from functools import wraps import statsd import strgen from flask import make_response from flask import request from flask_login import current_user from flask_login import login_user import config as base_config import database.user import util.cache import util.response from linkr imp...
true
704f508562957a6cec4c3a34ddc649713dd7397e
lautarodelosheros/TDA_tp1
/Lista/permutacion.py
UTF-8
1,123
3.359375
3
[]
no_license
from lista_enlazada import * def permutacion(lista_enlazada): if lista_enlazada.largo() == 0: return ListaEnlazada() if lista_enlazada.largo() == 1: lista = ListaEnlazada() lista.insertar_ultimo(lista_enlazada) return lista resultado = ListaEnlazada() f...
true
bfc34b21fe9ecd846a0b315638702b56de5cc90e
ubuntunux/WorkSpace
/PythonProject/pyglet-gui-master/pyglet_gui/option_selectors.py
UTF-8
4,485
2.734375
3
[]
no_license
import pyglet from pyglet_gui.controllers import Option, Selector from pyglet_gui.gui import Frame from pyglet_gui.containers import VerticalContainer from pyglet_gui.constants import ANCHOR_TOP_LEFT, ANCHOR_BOTTOM_LEFT, HALIGN_CENTER, VALIGN_TOP from pyglet_gui.manager import Manager from pyglet_gui.scrollable import...
true
24dbb1e0a6aa8664065715965945a630b01c3251
wells1400/PersonalProjects
/Drosophila optimization/SourceCode/newfoa原版.py
UTF-8
7,391
2.78125
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import copy def show_result(MaxIter, bestsofar): plt.plot(range(MaxIter), bestsofar, '-y') plt.title('The best of process in foa') plt.xlabel('iter') plt.ylabel('fitness') plt.show() def print_result(reala, solution): print('the result is sh...
true
a7201d6acb41cfd86f0e2caa37acb9e008d94f30
quatroka/urionlinejudge
/iniciante/python/1789.py
UTF-8
297
2.734375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- while True: try: QTD = input() MAX_V = max(map(int, input().split())) if MAX_V < 10: print(1) elif MAX_V < 20: print(2) else: print(3) except EOFError: break
true
2da1ec30b98c8f6e127ed0b99bdc5abfcea79c2f
ShamsTabish/respberry-pi-python-security-camera
/security/daemonRepeatCam.py
UTF-8
815
2.578125
3
[]
no_license
import datetime import os from picamera import PiCamera from time import sleep minute = 60 # seconds numberOfImagesPerDay = 150 repeatAfter = minute * 5 rootDirectory = "/home/pi/caps/" def createFolder(directory): if not os.path.exists(directory): os.makedirs(directory) for i in range(numberOfImagesPer...
true
f8ed1ce005c557be9587b580961ff096c7b7e8f5
JagadeeshmohanD/PythonTutorials
/OOPDemo/InheritanceDemo1.py
UTF-8
265
3.75
4
[]
no_license
class Base: name="Jags" def baseMethod(self): print("I am in Base Class") class Child(Base): company="Apple" def chilMethod(self): print("I am in child class") c=Child() c.chilMethod() c.baseMethod() print(c.name) print(c.company)
true
59b4373ff83e7185e2d663ce1cd02b74800fb6f0
sharonbabz44/pythoncodes
/password.py
UTF-8
599
3.234375
3
[]
no_license
import string import random N=4 def shuffle(string): blist=list(string) random.shuffle(blist) return ' '.join(blist) uppercaseLetter1=chr(random.randint(65,90)) uppercaseLetter2=chr(random.randint(65,90)) uppercaseLetter3=chr(random.randint(65,90)) uppercaseLetter4=chr(random.randint(65,90)) number1=...
true
1b39f752587153320d23e2b9e18f3b42be85a6c1
liehuojdd/pythonstudy2
/3.6/PythonCharmTest2/basic/object/mainfun.py
UTF-8
399
2.84375
3
[]
no_license
from basic.object.people import people from basic.object.student import student if __name__=='__main__': #print(people.getStaticCountry()) myobj=people('jim') # Call failed if no people.__init__(self,name) #print(myobj.noSelf('here')) # TypeError: noSelf() takes 1 positional argument but 2 were giv...
true
5bf05e788ce5f36cc5a770731f8043abfd7bc58a
kohei-kubota/diver05
/algorithm_exercise/algorithm_exercise3.py
UTF-8
860
3.25
3
[]
no_license
def sort(*args): arr = list(args) arr = [] for j in args: for l in j: if isinstance(l,int): l = str(l) arr.append(l) k = 0 w = 0 i = len(arr) - 1 index_med = round(i/2) while k < len(arr) - 1: while k < i: if arr[i-1] <...
true
3c9413ce320395a4b0f0db607e2750ab2d977698
TheBigFour/KaggleJune-For-ML
/code/DeepForest.py
UTF-8
1,363
2.671875
3
[]
no_license
import pandas as pd from deepforest import CascadeForestClassifier df = pd.read_csv("train.csv") strs = df['target'].value_counts() value_map = dict((v, i) for i,v in enumerate(strs.index)) value_map = {'Class_1': 0, 'Class_2': 1, 'Class_3': 2, 'Class_4': 3, 'Class_5': 4, 'Class_6': 5, 'Class_7': 6, 'Class_8': 7, 'Cla...
true
2af28296789367cdf3917af08ad99facd9e80ab9
manmeet3591/Financial-Analyzer
/bollinger_events.py
UTF-8
5,088
2.640625
3
[]
no_license
import copy import datetime as dt import numpy as np import pandas as pd # QSTK Imports import QSTK.qstkutil.DataAccess as da import QSTK.qstkutil.qsdateutil as du import QSTK.qstkstudy.EventProfiler as ep def get_symbols(s_list_index): dataobj = da.DataAccess("Yahoo") return dataobj.get_symbols_from_list(s_l...
true
ccd8d07ec6205875f3714f08accd2ba4c26cd4ba
kannanch/pythonscripts
/System/List the Start ,Pause ,Resume and Stop of the Windows Services/list-the-start-pause-resume-and-stop-of-the-windows-services.py
UTF-8
1,127
2.984375
3
[]
no_license
name="Themes" # provide the name of the service a=1 #provide value for a based on following: #set a=0 to stop service #set a=1 to start service #set a=2 to pause service #set a=3 to resume service import os import re print "------Listing windows services------\n" net=os.popen("net start ").read() print net...
true
8b6a5c3040c342ce1abbd14b75281cb71f7adee8
ShravanKumar-Technology/personalPython
/python-commands/test.py
UTF-8
2,280
3.390625
3
[]
no_license
# nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] # al = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'] # my_dict = {n1: al1 for n1, al1 in zip(nums, al)} # print my_dict # import os # from datetime import datetime # print(dir(os)) # print(os.getcwd()) # os.chdir('/home/jacksparrow/Desktop/python...
true
353d1fcf188a9f2e8446e4773ca84bb3fddcfde7
stwinter2014/Interpolation-algorithm-for-complex-trajectories
/Work_with_files.py
UTF-8
217
2.765625
3
[]
no_license
def Write_log (string): file = open("Machining_log.txt", 'a') file.write(string + '\n') file.close() return(string) def Clear_log (): file = open("Machining_log.txt", 'w') file.close()
true
96dc03ab7b14b012c79ea2cf643b1a3bfac67333
tranzilla/Django-first-blog
/blog/models.py
UTF-8
768
2.640625
3
[]
no_license
from django.conf import settings #This will import settings from django.conf from django.db import models from django.utils import timezone #This defines our model - Class is defining an object, Post is the name of our object, #models.Model tells Django that Post is a Django Model so it can be saved in the database ...
true
51b292f765e798ffd7ab59b4cf5f3e33638a65d7
Grieverwzn/Learning_document_python
/DataClearning.py
UTF-8
363
3
3
[]
no_license
import numpy as np import pandas as pd link_df=pd.read_csv('input_link.csv',encoding='gbk') link_df=link_df.dropna(axis=1) print(link_df.head()) print(link_df['number_of_lanes'].unique()) print(link_df['number_of_lanes'].duplicated()) print(link_df['number_of_lanes'].drop_duplicates(keep='last')) print(link_df['numbe...
true
51a1d48766d452aea2fab0b1c88ebfe20e80fa7a
flaport/bosonic
/bosonic/util.py
UTF-8
901
2.765625
3
[ "MIT" ]
permissive
import numpy as np def memoize(f): memory = dict() def decorated(*args): if args not in memory: memory[args] = f(*args) return memory[args] return decorated def haar_rand(m): """Returns haar-random matrix of dimension m x m The haar-random algorithm is taken from t...
true
b15fb57a730d15bf47ea65b1bdb4cd301d3daf46
Shawnmok/WebCrawler
/T1_maoyan_movie.py
UTF-8
678
2.5625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Jul 31 15:42:35 2018 To catch the TOP ranking movie in the Maoyan website @author: moxiaodong """ import requests import re header = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', } res = reque...
true
48626a7b3dcf5dfd2e4b229bfadd46d20a563cf7
ianbuen/PythonExercises
/00 NameAge.py
UTF-8
195
4.28125
4
[]
no_license
name = input("Hello, what is your name? ") age = input("How old are you? ") year = (100 - int(age)) + 2020 print("Hello " + name + ", you will turn 100 years old in year " + str(year));
true
270e269a538f89ea1bc9051157f249265d60f4e3
MayankMaheshwar/DS-and-Algo-solving
/leetcode/4sum.py
UTF-8
1,333
2.953125
3
[]
no_license
class Solution: def fourSum(self, nums: List[int], target: int) -> List[List[int]]: n = len(nums) res = [] nums.sort() i = 0 while i < (len(nums)-3): j = i+1 while j < (len(nums)-2): required = target-(nums[i]+nums[j]) ...
true
0dc48ea3103e5dc80dedb82139236281c7773db7
florisluiten/rssreader
/tests/autopilot/application_tests/tests/test_app_launch.py
UTF-8
582
2.578125
3
[ "MIT" ]
permissive
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- from application_tests.tests import HTML5TestCaseBase from testtools.matchers import NotEquals, Equals class LaunchTestCaseBase(HTML5TestCaseBase): def setUp(self): super(LaunchTestCaseBase, self).setUp() def test_basic_laun...
true
adb8f0de687c156793843d3e9463ebb59eacec66
zhongshankaka/data-structures-and-algorithms
/doubly_linked_list.py
UTF-8
1,489
3.296875
3
[]
no_license
from single_linked_list import LNode, LList1 class DLNode(LNode): def __init__(self, prev, elem, nxt): LNode.__init__(self, elem, nxt) self.prev = prev class DLList(LList1): def __init__(self): LList1.__init__(self) def prepend(self, elem): p = DLNode(None, elem, self._hea...
true
ccdaaf0d5a959e036f1349d1a6bc3d8021424f89
janek/hackattic
/reading-qr/reading-qr.py
UTF-8
2,345
2.8125
3
[]
no_license
import requests import json from PIL import Image import numpy as np from io import BytesIO import scipy.ndimage.interpolation as interpolation import matplotlib.pyplot as plt import zbarlight #NOTE: might need more than pip install. see h...
true
c41e38daa826d4de564ffc7555b8be0ff3ec29f2
AndChen153/fingerAppBot
/tesseractnumberdetection.py
UTF-8
2,436
2.609375
3
[]
no_license
# https://tesseract-ocr.github.io/tessdoc/4.0-with-LSTM.html#400-alpha-for-windows # https://www.youtube.com/watch?v=6DjFscX4I_c&t=63s # this does not work with fingerontheapp, the numbers that are shown are not recognized by tesseract # works with other text though, just not the app import cv2 import numpy as np imp...
true
b2600349dd3b92008f809ae35ae1566f1c2d9679
wainwright/filedb
/main.py
UTF-8
1,154
2.5625
3
[]
no_license
#!/usr/bin/python3 import sys import argparse from Entry import Entry from Database import Database, loadDb filedb = None; def add(args): entry = Entry(path=args.file, tags=args.tags) filedb.addEntry(entry) print(filedb) print(filedb.lookup('gift')) def search(args): print(filedb.lookup(args.term)) def listAl...
true
8f1f2dbe1b0b4a7b6c739895014a42bd37070290
heshengbang/pylearn
/100examples/66.py
UTF-8
346
3.625
4
[]
no_license
#!/usr/bin/python # -*- coding: UTF-8 -*- num = int(raw_input("有多少个数字要排序:")) nums = [] while num>0: temp = int(raw_input("请输入:")) nums.append(temp) num -= 1 for i in range(len(nums)): for j in range(i+1,len(nums)): if nums[i] < nums[j]: nums[i],nums[j] = nums[j],nums[i] for i in nums: print "%d"%i, print
true
ba136418249c5a9e0f45387b6bcba2008d184fd1
akasschrodinger/Autumn-of-Automation
/OpenCV/Assign3.2.py
UTF-8
891
2.84375
3
[ "MIT" ]
permissive
import cv2 import numpy as np from matplotlib import pyplot as plt cap = cv2.VideoCapture(0) initialFrame = 0 while(True): # Capture frame-by-frame ret, frame = cap.read() frame = cv2.flip(frame,1) cv2.imshow('frame', frame) if cv2.waitKey(0): break initialFrame += 1 laplacia...
true
f5e558416a7aff6836dc24c9a5c18cb4a867bb45
kiranbkulkarni/redesigned-disco
/.vscode/Classes/5. Class vs Instance Methods.py
UTF-8
450
3.8125
4
[]
no_license
class Point: # Class attributes are shared between objects & classes default_color = "red" # A constructor is a special method @classmethod def zero(cls): return cls(0, 0) def __init__(self, x, y): self.x = x self.y = y def draw(self): print(f" Point ({self...
true
7f8b5623a43fabbfb903834a6e560f2acdcd13cd
reflectometry/direfl
/direfl/api/calc.py
UTF-8
7,052
2.578125
3
[ "MIT" ]
permissive
#!/usr/bin/env python """ Basic reflectometry calculations. reflectivity, reflectivity_amplitude: Slab model with optional absorption and roughness. The function reflectivity returns the magnitude squared of the waveform. The function reflectivity_amplitude returns the complex waveform. magnetic_reflec...
true
897d26037d147c37441350b38ba236224a60c153
xwang322/Coding-Interview
/EA/LC98ValidateBinarySearchTree.py
UTF-8
569
3.453125
3
[]
no_license
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isValidBST(self, root): return self.dfs(root, -float('inf'), float('inf')) def dfs(self, root...
true
b73e9678a824377df02a049dfd8cd60bc4a6247b
RobusGauli/hris
/hris/utils.py
UTF-8
1,618
2.5625
3
[]
no_license
import time import hashlib from functools import wraps from flask import request, jsonify import jwt SECRET = 'shivapandeyisverybad' STRINGS = 'ABCSJKSHDJHG' from random import choice def random_string(num): return ''.join(choice(STRINGS) for i in range(num)) def timestamp(): return int(time.time())...
true
2030a32148e76bc9ed484c5249312f983cf47dd0
KBoehme/co
/languages/py/co/bioinformatics.py
UTF-8
3,216
3
3
[]
no_license
# To use this code, make sure you # # import json # # and then, to convert JSON from a string, do # # result = fast_q_from_dict(json.loads(json_string)) # result = bam_from_dict(json.loads(json_string)) # result = vcf_from_dict(json.loads(json_string)) # result = bed_from_dict(json.loads(json_string...
true
aa18dacd348ae55d3730680b102603cf8df18a63
wangjiachuan/email_service
/email_strategy/email_factory.py
UTF-8
869
2.6875
3
[]
no_license
__author__ = 'mylons' from email_strategy.mailgun import MailGun from email_strategy.mandrill import Mandrill from email_strategy.email import Email class EmailFactory(object): """ creates objects capable of sending emails """ def __init__(self): self.mg = MailGun() self.md = Mandrill(...
true
9ee44fa652cff68c711eeb3836e12c12a41b8776
Boris-0412/python-boris
/s2 lesson1/2-1.py
UTF-8
1,712
2.859375
3
[]
no_license
from pycat.core import Window, Sprite, KeyCode, Label from pycat.scheduler import Scheduler from random import randint from pyglet.window.key import W window =Window(enforce_window_limits=False,background_image="background.png",width=900,height=504) class Score(Label): def on_create(self): self.score ...
true
dd6c7f8fb418a049e16611ac670b295855c95b3e
PriyangMT/inter_hall_DA_2018
/MC_MFH.py
UTF-8
1,579
2.609375
3
[]
no_license
''' This code is used to calculate management consistency of a MFH from the responsive scores of their mutual funds ''' import glob import math import numpy as np import pandas as pd import scipy def sigi(x): return np.log(abs(x/(1-x))) def sigmoid(x): return (1/(1+math.exp(-x))) lof=glob.glob('AUM_scheme/...
true
9481625a0c9b7b5f00d9221fa00844486ad86c0f
pennycentsarah/novel-flask
/flaskr/novel.py
UTF-8
4,685
2.75
3
[]
no_license
from flask import ( Blueprint, flash, g, redirect, render_template, request, url_for ) from werkzeug.exceptions import abort from flaskr.auth import login_required from flaskr.db import get_db bp = Blueprint('novel', __name__) @bp.route('/') def index(): """Show all the posts, most recent first...
true
cf2ad981676d0ac77a1835ccd5104042b43b3adf
monk0062006/Nutshell
/CreateVideo.py
UTF-8
2,951
2.609375
3
[]
no_license
__author__ = "Jack Walker" import os import json import sys from VideoCreationModules import BackgroundGenerator from VideoCreationModules import RecordScreen from VideoCreationModules import CropRecording from VideoCreationModules import BackgroundToVideo from VideoCreationModules import OverlayClips from VideoCreat...
true
db4799dad89494549d374814cee7711d5e723a52
dsiot/wearables
/dstML/data_fn.py
UTF-8
1,613
2.609375
3
[ "Apache-2.0" ]
permissive
# inbuilt modules import numpy as np from sklearn.model_selection import train_test_split # defined modules from dataexp_methods import * def split_data(data,label,split,balance_data=True): (n,n_feat) = data.shape x_train,x_test,y_train,y_test = train_test_split(data,label,test_size = 1-split) if balance_d...
true
24d6fc2b14528f5e5d852fe7791ae561330b349a
ndfriedman/myMskccUtils
/create_cncf_or_rdata_file_list.py
UTF-8
5,092
2.515625
3
[]
no_license
#written by Noah Friedman import sys import argparse import os import pandas as pd import numpy as np import re import gc from multiprocessing import Process, Queue def write_cncf_file(lines, headerLine=['Tumor_Sample_Barcode', 'Rdata_filename'], writeFileDir = '/ifs/work/taylorlab/friedman/myAdjustedDataFiles',...
true
3623870974b4038bddbba78409efeaf5aa6ddf70
Robbie2725/ECE448
/mp3/neuralnet_part2.py
UTF-8
4,877
3.109375
3
[]
no_license
# neuralnet.py # --------------- # Licensing Information: You are free to use or extend this projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to the University of Illinois at Urbana-Champaign # # Crea...
true
28384311b5c87e3a6e4cc8e279f27cd98b1f4b6a
sharebook-kr/book-cryptocurrency
/ch10/volatility.py
UTF-8
870
2.90625
3
[ "Apache-2.0" ]
permissive
import time import pybithumb def get_target_price(ticker): df = pybithumb.get_ohlcv(ticker) yesterday = df.iloc[-2] today_open = yesterday['close'] yesterday_high = yesterday['high'] yesterday_low = yesterday['low'] target = today_open + (yesterday_high - yesterday_low) * 0.5 return target...
true
900a27af67f45284879e7827e34ca4c34906d56c
signalblues/Parking-Lot-Occupancy-Tracking
/West-Virginia-parking-lot/DrawlineTest.py
UTF-8
1,457
2.84375
3
[]
no_license
import numpy as np import cv2 import json with open('parking.json') as data_file: data = json.load(data_file) img = cv2.imread('Image2.jpg') #JSON FILE NEEDS TO BE FIXED............ for row in range(0,3): #Change for how many spots if row == 0: ISIZE = 4 if row == 1: ISIZE =...
true
ebaba59f9690d00fedc924aaafb8380a5a1cea54
casastorta/krivokuca.eu
/krivokucaeu/quotes/views_quote.py
UTF-8
964
2.625
3
[]
no_license
from django.template.loader import get_template from django.template import Context from django.http import HttpResponse, Http404 import quotes.models as qm import itertools import random current_section = 'quote' def quote_by_id(request, id): ''' Retrieve quote by ID ''' try: q = qm.Quote.ob...
true
f6b1d237d6d9cf4b1653472aab2196c04a759077
southpawgeek/perlweeklychallenge-club
/challenge-117/steven-wilson/python/ch-1.py
UTF-8
630
3.546875
4
[]
no_license
#!/usr/bin/env python import sys if __name__ == "__main__": filename = sys.argv[1] file = open(filename) lines = file.readlines() line_numbers = [int(line.split(',')[0]) for line in lines] # Math method sum_of_line_numbers = sum(line_numbers) sum_of_range = sum(range(1, (len(line_numbers) ...
true
8daad3672941a885dbd04a331b3af2970172bed0
heiparta/energy_monitoring_scripts
/conversion.py
UTF-8
8,512
2.671875
3
[]
no_license
#!/usr/bin/env python3 import argparse import pylightxl as xl import pytz import sys from datetime import datetime DEBUG = False INPUT_SEPARATOR = ";" OUTPUT_SEPARATOR = "," MAX_LINES = 2**32 TIME_FORMAT = "%d.%m.%Y %H:%M" SOURCE_TIMEZONE = "Europe/Helsinki" STATIC_COLUMNS = [ ("site", "2463453700"), ] DATA_COL...
true
c238fcf3d6768435806f0244545afda82afbff47
suzheng123/Sorting-Algorithms
/mergeSort.py
UTF-8
1,554
3.875
4
[]
no_license
def mergeSort(arr): n = len(arr) if n>1: mid = n/2 L = arr[:mid] #CANNOT WORK WITH PYTHON3 R = arr[mid:] print(L) # print(R) mergeSort(L) mergeSort(R) nl = len(L) nr = len(R) i=j=k=0 while i<nl and j<nr: ...
true
74fd4a8589755a81cab41be7d867d9be35d01d3f
femi-saliu/pythonAdventures
/adventures.py
UTF-8
6,192
4.28125
4
[]
no_license
#adventures in python # codewars problem: # Write a function that removes each 9 that it is in between 7s. # def seven_ate9(str_): leftSeven = False for i in range(len(str_)): if (str_[i] == '9'): if (str_[i-1] == '7' and str_[i+1] == '7'): del str[i] i -= 1 return str_ # this was my fi...
true
4c9b68f74312bd8bd59137f3eefa7fbccb69413b
LOOKCC/2017-Seed-Cup-Round-2
/src/Empirical_analysis/E_predict.py
UTF-8
6,847
2.90625
3
[ "MIT" ]
permissive
#!/usr/bin/env python # -*- coding: UTF-8 -*- # ------------------------------------------------------------------------ # Project: 2017 Seed cup round 2 # Author: Jiyang Qi, Zhihao Wang, Yue Pan # GitHub: https://github.com/zxc479773533/2017-Seed-Cup-Round-2.git # Module: Empirical analysis # ------------------------...
true
4caeebb65557717b13eb2dc28a47e37458c61dee
akesiraju/raspberrypi
/mike/right_leg.py
UTF-8
266
3.046875
3
[ "MIT" ]
permissive
import motor forward_pin = 37 reverse_pin = 31 enable_pin = 35 def walk(): motor.run(enable_pin, forward_pin, reverse_pin) def reverse(): motor.run(enable_pin, reverse_pin, forward_pin) def stop(): motor.stop(enable_pin, forward_pin, reverse_pin)
true
9f64f0d7d26c2dba059bcf4aa55e7225c224e24f
aliaksei135/seedpod_ground_risk
/seedpod_ground_risk/ui_resources/info_popups.py
UTF-8
2,905
2.734375
3
[ "MIT" ]
permissive
import matplotlib.pyplot as mpl from PySide2.QtWidgets import QDialog, QVBoxLayout from matplotlib import gridspec from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar from seedpod_ground_risk.pathfindi...
true
e44ea8d370925cb9158aab2656f8cdab4f9b2f18
nguyenlam185/numpyCookbook
/ch02/flipping.py
UTF-8
720
2.5625
3
[]
no_license
import scipy.misc import matplotlib.pyplot import os from utils import DATA_DIR # Loads the miss_sa image into an array miss_sa = matplotlib.pyplot.imread(os.path.join(DATA_DIR, 'miss_south_africa.jpg')) # Plot the miss_sa array matplotlib.pyplot.subplot(221) matplotlib.pyplot.imshow(miss_sa) #Plot the flipped array m...
true
f4a9ac6ddddc13b152ab1827293ebe0d9ea1d113
Zihang97/PAGAN
/src/snlayers/snconv2d.py
UTF-8
5,657
3.0625
3
[ "MIT" ]
permissive
# coding=utf-8 import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules import conv from torch.nn.modules.utils import _pair from ..functions.max_sv import max_singular_value class SNConv2d(conv._ConvNd): r"""Applies a 2D convolution over an input signal composed of several input ...
true
c52997fe8431400c979b2d1adb72c444f5b8e2ab
kobeeraveendran/cap5636
/unit2/hw2/valueIterationAgents.py
UTF-8
6,956
3.28125
3
[]
no_license
# valueIterationAgents.py # ----------------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to ht...
true
69d7358940b7793e5f935789ffceddd52909e1d2
vincent507cpu/Comprehensive-Algorithm-Solution
/LintCode/chapter 30/52. Next Permutation/solution.py
UTF-8
729
3.34375
3
[ "MIT" ]
permissive
class Solution: """ @param nums: A list of integers @return: A list of integers """ def nextPermutation(self, nums): # write your code here n = len(nums) if n <= 1: return nums i = n - 1 while i > 0 and nums[i] <= nums[i - 1]: ...
true
938b64e7b463e9595d2b6f4f0e0edc3699900902
forest-stone/coin
/coinChecker/views.py
UTF-8
10,433
2.671875
3
[]
no_license
from django.shortcuts import render from django.http import HttpResponse import json import time import sys import requests import re import datetime class Coin(): def __init__(self, name, price, volume): self.price = 0 self.volume = 0 self.priceList = [0, 0, 0, 0, 0] self.volumeLis...
true
879f9d2b6d587a74e76e554ff42cc4b795086947
softelnet/sponge
/sponge-integration-tests/examples/core/wrapped_exception.py
UTF-8
209
2.53125
3
[ "Apache-2.0" ]
permissive
""" Sponge Knowledge Base Wrapped exception """ from java.lang import String class WrappedExceptionAction(Action): def onCall(self): # Force an exception from Java. String("a").charAt(10)
true
6a578340ebba8edb9b889bf2e0d07bc1d1711eb5
ato/metactl
/src/metactl/edit.py
UTF-8
1,469
2.6875
3
[]
no_license
import os, sys from metactl import cli, config from configparser import ConfigParser def config_editor(ctx): editor = os.environ.get('EDITOR', 'vi') os.execvp(editor, [editor, config.local_file(ctx.app)]) parser = cli.subparsers.add_parser('config', help='open config file in $EDITOR') parser.set_defaults(func...
true
c0d6fd8fd48bfcde7e8eb90ecd057b4fc5dc350c
avcrowdhackathon/Anti.o
/sentiment_analysis/main_nlp.py
UTF-8
1,147
3.109375
3
[]
no_license
""" @author: Elena Stamatelou """ import scraping import polarity import pandas as pd import numpy as np # define the municipality municipality = "Αθήνα" #municipality = "Μαρούσι" # scrape the COVID-19 news for the selected municipality news = scraping.scraping_google_news(municipality) # apply opini...
true
7247f0b6d49d99b15072ae0b0d609dadada1a049
KiritoCyanPine/ShidoBOT
/kissmanga/api/mangainfo.py
UTF-8
5,083
2.8125
3
[]
no_license
import dataclasses import typing from bs4 import BeautifulSoup from .apibase import APIBase @dataclasses.dataclass(frozen=True) class MangaData: url: str title: str authors: list status: str genres: list chapters: list icon: str description: str @dataclasses.dataclass(frozen=True) ...
true
4e97b496a378bb4fef0794ce5853a6fa3015e2a5
HZyo/Note
/AI/LearnTF/tutorials/KerasDoc/projects/01_01_02_MLP_sigmoid/01_01_02_main.py
UTF-8
797
2.765625
3
[ "MIT" ]
permissive
import numpy as np from keras.models import Sequential from keras.layers import Dense, Dropout # 生成虚拟数据 x_train = np.random.random((1000, 20)) y_train = np.random.randint(2, size=(1000, 1)) x_test = np.random.random((100, 20)) y_test = np.random.randint(2, size=(100, 1)) model = Sequential() model.add(Dense(64, activ...
true
7d1563586977f546b92969906d1ca007a7c61a33
nuistpg/LeveragePartialStragglers
/Codes/MPI Code For Worker Computation Time/worker_comp_time_proposed_uncoded.py
UTF-8
3,545
2.640625
3
[]
no_license
""" Finding the worker computation time for the proposed uncoded scheme Having two random matrices A and B We have n workers and s stragglers. Storage fraction gammaA = a1/a2 and gammaB = b1/b2. Matrices A and B are partitioned into a2 and b2 block columns. ellA and ellB are the number of uncoded blocks for A and B, re...
true
b1faee7315532a528661c3f071cd307b85612111
shasank-shah/pycharmProjects
/pythonProjects/Edureka_case_studies_Pyspark/Practise programs/09_11_19/variableScope.py
UTF-8
126
2.65625
3
[]
no_license
#global _vara _vara = 20 def func(): global _vara _vara = 40 return _vara print(_vara) print(func()) print(_vara)
true
ffd24d8e55229d65afffb493bb0e2dfb1e729b78
webclinic017/TradingScripts-1
/realTime-stockData-toExcel.py
UTF-8
771
2.6875
3
[]
no_license
import pandas as pd from alpha_vantage.timeseries import TimeSeries from alpha_vantage.techindicators import TechIndicators import time #-------------------------------------------------------------------------- # Script that sends realtime stock data for MSFT to excel every 60 seconds. #-----------------------------...
true
95864813564f8a89de1f68458b6c76e92125e539
highb/RoboND-Rover-Project
/code/perception.py
UTF-8
11,298
3.265625
3
[]
no_license
import numpy as np from scipy import ndimage import cv2 # Identify pixels above the threshold # Threshold of RGB > 160 does a nice job of identifying ground pixels only def color_thresh(img, rgb_thresh=(160, 160, 160)): # Create an array of zeros same xy size as img, but single channel color_select = np.zeros_...
true
9dc6f97918f19d3b7ca94be3ca17bfbf318cfc6c
bhushanmahangare/Leetcode
/Python/0014_longest-common-prefix.py
UTF-8
1,143
3.546875
4
[ "MIT" ]
permissive
'''=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= * 14. Longest Common Prefix * Easy * * Write a function to find the longest common prefix string amongst an array of strings. * * If there is no common prefix, return an empty string "". * Example 1: * Input: ["...
true
9b71e294c7eb686e62d6dc677f52262283b61eaf
ArtemiyMalau/leadersofdigital2021
/py/helpers/dbFilling.py
UTF-8
4,466
2.640625
3
[]
no_license
import csv import re import requests from bs4 import BeautifulSoup from io import StringIO from sqlalchemy import func from ..db.models import Country, City, Okved, OkvedSection def import_countries(session): URL = "https://www.artlebedev.ru/country-list/tab/" resp = requests.get(URL) countries = csv.DictReade...
true
609b2a86148a1add5830601b764ea91ea950656b
lfoppiano/vento-live-py
/training.py
UTF-8
2,182
2.609375
3
[]
no_license
import nltk import sys import os from nltk.sentiment import SentimentAnalyzer from nltk.classify import NaiveBayesClassifier from nltk.sentiment.util import * if len(sys.argv) == 2: trainingDataDirectory = sys.argv[1] else: print("Usage: python training.py trainingDataDirectory") sys.exit(-1) ...
true
d1177a98cc197d8aefe10a1ccc8d6fc0db1ea0e9
charlie219/CSES-Solutions
/Graph Algorithms/Counting Rooms.py
UTF-8
512
2.546875
3
[ "MIT" ]
permissive
n,m=map(int,input().split()) a=[list(input()) for i in range(n)] o=0 R=[0,0,-1,1] C=[1,-1,0,0] for i in range(n): for j in range(m): if a[i][j]=='.': o+=1 s=[(i,j)] while(s): x,y=s.pop() a[x][y]='#' for k in ran...
true
29534d6a36e8ec9638d5f9039997c3c458f9f1f9
tomivs/luces-pinguino
/pynguino/PinguinoLCD.py
UTF-8
11,926
2.6875
3
[]
no_license
#! /usr/bin/python #-*- coding: utf-8 -*- try: import serial except: PynguinoError(3) import os from raiseError import PynguinoError ######################################################################## class PinguinoLCD(): #---------------------------------------------------------------------- d...
true
c4f0158b578a8df0f20f3cf7a53c3cccbd8364be
pawelsalwa/python
/Zad06/6.3.py
UTF-8
2,408
3.59375
4
[]
no_license
from Point import Point import math import sys #================================================================================ class Rectangle: """Klasa reprezentujaca prostokat na plaszczyznie.""" def __init__(self, x1=0, y1=0, x2=0, y2=0): self.pt1 = Point(x1, y1) self.pt2 = Point(x2, y2) def __str__(self)...
true
5570b565662a2651e8ef361ea28f719bf0291b22
Heectorr/Prueba
/hola.py
UTF-8
64
3.296875
3
[]
no_license
nom = input('¿Cual es tu nombre? ') print('Hola, Buenas tardes', nom)
true
df4f829c3fde9c0aabc8afe8973c37c78d1bc9dc
matthewhamiltonimperial/lpg-siot
/daily_prediction.py
UTF-8
2,707
2.75
3
[]
no_license
import pandas as pd from sklearn import tree import numpy as np from sklearn.metrics import accuracy_score, classification_report, confusion_matrix, f1_score from twilio.rest import Client import os ### TRAINING data = pd.read_csv("siot-main1.csv", engine='python', usecols=[0,1,2]) # Reading from csv data["Weight (...
true
34cee34f6718e8d4c7424216226b5321c2acc161
deepgully/codes
/leetcode/python/convert-sorted-array-to-binary-search-tree.py
UTF-8
1,615
3.8125
4
[]
no_license
""" https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/ Convert Sorted Array to Binary Search Tree Given an array where elements are sorted in ascending order, convert it to a height balanced BST. :copyright: (c) 2014 by Gully Chen. :license: BSD, see LICENSE for more details. """ from su...
true
964fabec94a04278b1dd529aae23a6b154d7bd8e
ramwin/leetcode
/test_same_source.py
UTF-8
1,081
3.125
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Xiang Wang <ramwin@qq.com> """ 测试同源字符串 """ import unittest from same_source import MyString class TestMyString(unittest.TestCase): """测试 MyString""" def setUp(self): self.string1 = "internationalization" self.string2 = "l123e" self.s...
true
32739047539bc1d5a352b267dc92ac558cd3deb0
prilosac/Alfred
/util.py
UTF-8
1,801
3.140625
3
[]
no_license
class myDict(dict): def __getitem__(self, idx): self.setdefault(idx, 0) return dict.__getitem__(self, idx) class StateMemory(object): def __init__(self, capacity): self.capacity = capacity self.memory = [] self.position = 0 # self.recentlyDied = False sel...
true
41d3aa8608b1098cb253ae4e9234c4c76fb384a8
wiegerhelsdingen/FlightDynamics
/Analytical_model_def.py
UTF-8
6,074
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import numpy as np from math import * import cmath as cmath from parameters_def import * ######### Short period motion ############# def short_period(V0, m, rho, muc, mub, CL, CD, CX0, CZ0): # A_spm = muc ** 2 * KY2 #KY2 is alre...
true
aaf8078edf6301666113f51292bad54c8429489c
ljia2/leetcode.py
/solutions/binary.index.tree.segment.tree/315.Count.of.Smaller.Numbers.After.Self.py
UTF-8
5,665
3.921875
4
[]
no_license
class SegmentTreeSolution: def countSmaller(self, nums): """ You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i]. Example: Input: [5,2,6,1]...
true
a0f0e71b26525128248634cc1eb046ec22be0e9a
Siva-Karthi/ProblemSolvingV2
/lesson1/print_common_chars_and_the_commonly_appeared_times/tests/test_task.py
UTF-8
282
2.890625
3
[]
no_license
import unittest from ..task import print_common_chars # todo: replace this with an actual test class TestCase(unittest.TestCase): def test_add(self): res = print_common_chars("ababca", "cbbbc") self.assertEqual(res, "bbc", msg="solution is = {}".format(res))
true
3e1c0d0d17c9f42de287007caf626ab25b2712e3
ethancreeger/hackasat-qualifier-2020
/rbs_m2/signal_to_pwm.py
UTF-8
7,578
3.03125
3
[]
no_license
import click import struct import timeit SAMPLE_RATE = 102400 SAMPLE_PERIOD = 1.0 / float(SAMPLE_RATE) SAMPLE_FMT = "<ff" SPIKE_THRESHOLD = -65 def calc_and_store_position( verbose, output_fp, last_on_time, last_azimuth_off_time, last_elevation_off_time ): azimuth_duty = \ (last_azimut...
true
fe48c2522724283ff09ac36eceafb1f891269621
Likazyabra/git-lesson
/5.py
UTF-8
295
3.4375
3
[]
no_license
array = [1, 2, 0, 3, 18, 14, 89, 45, 100, 0, 4] len_arr = len(array) i = 0 j = 0 while i < len_arr: j = i + 1 while j < len_arr: if array[j] < array[i]: tmp = array[i] array[i] = array[j] array[j] = tmp j += 1 i += 1 print(array)
true
c06026ce724bac963be212e076742e82b0e27881
jithendarreddy/guvi-set1
/224.py
UTF-8
181
2.84375
3
[]
no_license
p=int(input()) k=pow(2,p) w=[] for i in range(k): m=bin(i).replace("0b","") w.append(m.zfill(p)) w.sort(key=(lambda x:x.count('1'))) for i in w: print(i)
true
c3c116a5c1b35548f1071b1af102b9dfec0fba65
DaHuO/Supergraph
/codes/CodeJamCrawler/16_3_1_neat/16_3_1_ParagonLight_one.py
UTF-8
2,312
2.71875
3
[]
no_license
import utils def removeTwo(total,la,lb,ps): remo = total - 2 if remo == 0: return True flag = True for i in range(len(ps)): if la == i: if (ps[la] -1) / float(remo) > 0.5: flag = False return flag elif lb == i: if (ps[lb] ...
true
b7af5cf590bdba2969a2df948afdb925b47d884f
gituser95/ProjetPrim
/BasicFunctions.py
UTF-8
12,603
3.34375
3
[]
no_license
import xlrd import pub import numpy as np import matplotlib import matplotlib.pyplot as plt import matplotlib.ticker as ticker import datetime import time ##### ####### ###### ###### ##### ####### ###### ###### ##### ####### ###### ###### def timeTicks(x, pos): d = datetime.timedelt...
true
1061ddfe59cd15279c5ebebb858621416a03401f
tobiaspettrem/master18
/scrap_finn.py
UTF-8
6,548
2.71875
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import time import random import alva_io import pandas as pd from multiprocessing import Pool from bs4 import BeautifulSoup, UnicodeDammit import requests #import warnings #warnings.filterwarnings("ignore") REFURBISHMENT_WORDS = ["oppussingsbehov", "oppussingsobjekt", "oppgr...
true
5e16f8c19f3ba6f63920eda40b4b278dd1c394be
Spinu2b/AnimatedCharacterBlenderModelConstructor
/acbmc/util/model/matrix4x4.py
UTF-8
1,857
2.734375
3
[]
no_license
from typing import List, Tuple import mathutils from acbmc.model.animated_character.model.math.quaternion import Quaternion from acbmc.model.animated_character.model.math.vector3d import Vector3d class Matrix4x4: def __init__(self): self.elements = [[0 for i in range(4)] for j in range(4)] # type: List[L...
true
3b170095915c251550dae519ff951032241bb025
XHermitOne/iq_framework
/iq_report/report/report_generator.py
UTF-8
48,882
2.671875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Report generator module. Report cell tags: ['...'] - Access to the query table field. [&...&] - Accessing a report variable. Report variables are set in the query table in the form of a dictionary by key '__variables__'. [@package.module.function()@] - Python funct...
true
6fcf8496b6be2ed12590fb70e916ab962df7be9a
the-kaizer/awesome-pattern-matching
/tests/test_transform.py
UTF-8
3,133
2.84375
3
[ "MIT" ]
permissive
from __future__ import annotations import unittest from itertools import chain, combinations, permutations from apm import * from apm.core import transform def powerset(it): s = list(it) return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1)) def identity(x): return x def record_ty...
true
3290ffebafd99d65d4ff8df2e0e61a40661ba8a2
Eshowhish/Computervision-AdvancedTools
/resize_image.py
UTF-8
2,086
2.640625
3
[]
no_license
#%% import matplotlib.pyplot as plt import pickle import numpy as np import PIL import random train_list = [] train_label_list = [] test_list = [] test_label_list = [] val_list = [] val_label_list = [] for i in range(12500): try: img_cat = PIL.Image.open("kagglecatsanddogs_3367a/PetImages/Cat/"+str(i...
true
622ea7f204a4c8e135ccd0a5b689aa40e121f2ae
jicahoo/pythonalgr
/leetcode/232_ImplementQueueUsingStacks.py
UTF-8
1,368
3.953125
4
[]
no_license
class Queue(object): def __init__(self): """ initialize your data structure here. """ self.stack_primary = [] self.stack_standby = [] def push(self, x): """ :type x: int :rtype: nothing """ # Move primary stack to stand-by stack ...
true
1aa50e9ac95cbc2e7f3e8507fe90d5186e9f7bd5
witchsab/WorkSpace
/ImageSearch.py
UTF-8
7,176
2.8125
3
[]
no_license
#------------------------------------HASH CODE-----------------------------------# import PIL from PIL import Image import imagehash import os import cv2 import time from pprint import pprint from imutils import paths import matplotlib.pyplot as plt import pandas as pd print('Hello here') IMGDIR = "./imagesbooks/"...
true
5a1cfeaa34b925b14db5abd090baf9ef53d3c72a
tanhuacheng/Documents
/python/decorator_callback.py
UTF-8
257
2.78125
3
[]
no_license
#!/usr/bin/python3 # -*- coding:utf-8 class Test(): def feature(self): self.callback() def decorate(self, func): self.callback = func return func test = Test() @test.decorate def foo(): print('test') test.feature()
true
7838c4946d0f349598675733bfe992ba23e9b99c
Aasthaengg/IBMdataset
/Python_codes/p03693/s984173036.py
UTF-8
62
3.125
3
[]
no_license
s = input().replace(' ','') print('NO' if int(s)%4 else 'YES')
true
625c3fd822b9bfbc1fe48f99ba37ce11d579cfbb
Dayoming/PythonStudy
/codingdojang/unit12/import_01.py
UTF-8
875
3.6875
4
[]
no_license
# 모듈 : 특정 기능을 .py 파일 단위로 작성한 것 # 패키지 : 특정 기능과 관련된 여러 모듈을 묶은 것. 보통 인터넷에 있는 패키지를 설치해서 사용 # 라이브러리 : 파이썬에 기본적으로 설치된 모듈과 내장 함수를 묶어서 파이썬 표준 라이브러리(Python Standard Library, PSL)라 부름 import math print(math.pi) # 원주율 print(math.sqrt(2.0)) # 제곱근 # import는 패키지의 모듈도 가져올 수 있다. import urllib.request response = urllib.request.urlope...
true