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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
bde914c0d351234c127a308b88600cece4960972 | Python | Ukabix/machine-learning | /Machine Learning A-Z/Part 2 - Regression/Section 9 - Random Forest Regression/run.py | UTF-8 | 1,873 | 3.625 | 4 | [] | no_license | # Random Forest Regression
# import libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# import dataset
dataset = pd.read_csv('Position_Salaries.csv')
## DATA PREPROCESSING
# creating matrix of features [lines:lines,columns:columns]
X = dataset.iloc[:, 1:2].values # not [:,1] bc we w... | true |
eb0b349aae46abe369297e0098bcdd413c2c1850 | Python | celiacintas/popeye | /UI/myGraphicsView.py | UTF-8 | 649 | 2.78125 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from PyQt4 import QtGui
class MyGraphicsView(QtGui.QGraphicsView):
def __init__(self, parent=None):
QtGui.QGraphicsView.__init__(self)
def resizeEvent(self, event):
items = self.items()
self.centerOn(1.0, 1.0)
posx ... | true |
9212b507cea84af2ec8713320906ef5b69babda1 | Python | JEngelking/LyricFinderBot | /main_bot.py | UTF-8 | 6,594 | 2.796875 | 3 | [] | no_license | import praw
import config
from bs4 import BeautifulSoup
import requests
import os
import time
import re
HEADERS = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:30.0) " +
"Gecko/20100101 Firefox/30.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0... | true |
0e8c2f932164cff97bb97d02e3b69d994be5ef24 | Python | jw3329/leetcode-problem-solving | /1394. Find Lucky Integer in an Array/solution.py | UTF-8 | 231 | 2.796875 | 3 | [] | no_license | class Solution:
def findLucky(self, arr: List[int]) -> int:
freq = [0] * 501
for num in arr:
freq[num] += 1
for i in range(500, 0,-1):
if freq[i] == i: return i
return -1
| true |
e36c02f729e190821d9872901630261144f9cc44 | Python | AndreiTsukov/PythonFiles | /Classwork/pygame/lesson4/Kromski.py | UTF-8 | 1,235 | 3.46875 | 3 | [] | no_license | #Kromski
'''
class address():
name='z'
line1='z'
line2='z'
city='z'
state='z'
zip='z'
def printAddress(address):
print(address.name)
if(len(address.line1) > 0):
print(address.line1)
if(len(address.line2) > 0):
print(address.line2... | true |
b634d5e37df605ce01122b0ad57f706ea2acb13b | Python | L-e-N/Crypto-SSL-Infrastructure | /main.py | UTF-8 | 2,644 | 3.296875 | 3 | [] | no_license | import threading
import time
from Equipement import Equipment
from create_socket import *
from cli import *
def main():
# List of equipments in the network and graph to display it with nodes and edges
network = []
default_port = 12500
# Already create an equipement for test
new_equipment1 = Equ... | true |
f106be29a1f8909322569a69d109b518772e54f2 | Python | daniel-reich/ubiquitous-fiesta | /jwzgYjymYK7Gmro93_8.py | UTF-8 | 96 | 3.25 | 3 | [] | no_license |
def get_indices(lst, el):
return [ index for index, item in enumerate(lst) if item == el]
| true |
344fa84ffa5860195a1201272942c7d944f6dd0c | Python | JaeminBest/gadgetProj | /back/app/models.py | UTF-8 | 7,145 | 2.65625 | 3 | [] | no_license | # models.py
# author : jaemin kim
# details : back-end server DB model that describe user, original image, edits from users, and collection of edits that used for actual machine learning
from app import db
from datetime import datetime
from sqlalchemy.dialects.mysql import LONGBLOB
# User DB which has columns of use... | true |
157ca986d2bdd6c2e4301cd6d9f1190a1ff3112d | Python | Morrisson1305/dev | /weather.py | UTF-8 | 644 | 3.078125 | 3 | [] | no_license | import pyowm
city = input('Enter a city: ')
# country = input('Enter a country: ')
# city2 = input('Enter another city: ')
# country2 = input('Enter another country: ')
print()
apiKey = '3901eae877f62d68f8d37ca8a1de03df'
owm = pyowm.OWM(apiKey)
observation = owm.weather_at_place(city)
w = observation.get_weather()
... | true |
17729d120b60e129cfe37f2011589bcd305c8459 | Python | dingqqq/LeetCode | /countAndSay.py | UTF-8 | 653 | 3.28125 | 3 | [] | no_license | class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
if n == 1:
return '1'
prevResult = self.countAndSay(n-1)
curResult = ''
prevNum = None
cnt = 0
for curNum in prevResult:
if p... | true |
2cee062bbeb4f7fd9bdb1a3373c07dbfc5061ff4 | Python | jinkingmanager/my_python_code | /pythontest/CommonUtils.py | UTF-8 | 403 | 2.53125 | 3 | [] | no_license | #coding=utf-8
__author__ = 'siyu'
from bs4 import BeautifulSoup
import urllib2
import sqlite3
# get all content using urllib2
def getAllContent(url):
wp = urllib2.urlopen(url,None)
return wp.read()
# get bs obj from url
def getSoupFromUrl(url):
wp = getAllContent(url)
#print len(wp)
return Beauti... | true |
b4826e9dbee3f9cbab41e4b142a7ceb01b420928 | Python | 17722996464/zj | /Testcase_date/readExcel.py | UTF-8 | 1,266 | 3.234375 | 3 | [] | no_license | import os
from Testcase_date.getpathInfo import getpathInfo # 自己定义的内部类,该类返回项目的绝对路径
# 调用读Excel的第三方库xlrd
from xlrd import open_workbook
# 拿到该项目所在的绝对路径
path = getpathInfo().get_Path()
print(path)
class readExcel():
def get_xls(self, zj, ww): # xls_name填写用例的Excel名称 sheet_name该Excel的sheet名称
cls = []
#... | true |
081018971114db4e73cd0af25962b2f9c219f118 | Python | TiagoDM-21905643/AdventOfCode | /_2020/Day03/_toboggan_trajectory.py | UTF-8 | 1,055 | 2.875 | 3 | [] | no_license | from _2020.help_functions import get_function_exec_time
def count_trees(file, x_dist, y_dist):
trees = 0
pos = 0
for i in range(0, len(file), y_dist):
if file[i][pos] == '#':
trees += 1
if x_dist + pos >= len(file[i]) - 1:
pos = x_dist - len(file[i]) + 1 + pos
... | true |
acbda9eed3877a35ab3cafa6ced8f069b3071283 | Python | sarahgededents/Advent_Of_Code_2020 | /08/solve.py | UTF-8 | 1,221 | 2.890625 | 3 | [] | no_license | with open("input", 'r') as inp:
lines = [line.rstrip() for line in inp]
acc, idx = 0, 0
potential_bugs, seen = [], []
while idx not in seen:
seen.append(idx)
cmd, inc = lines[idx].split()
inc = int(inc)
if cmd == 'acc':
acc += inc
idx += 1
... | true |
919d09755b92c2a53d2ea5c3788e63d92be8f790 | Python | spider-z3r0/rapid_rpg | /front_page.py | UTF-8 | 2,116 | 3 | 3 | [] | no_license | import tkinter as tk
from main_page import GamePage
class FrontPage(tk.Frame):
"""This is a class to make the front page
it inherits from tk.Frame
"""
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.controller = controller
self.mainframe = tk.Fram... | true |
72ec08468e0608ca99d8ddeb204dc15bfe04bd50 | Python | Topp-Roots-Lab/rsa-tools | /FileHandlers/rsa-renameorig.py | UTF-8 | 2,092 | 2.953125 | 3 | [] | no_license | #!/usr/bin/python2
# -*- coding: utf-8 -*-
# Python 2.7 compatible
"""
script name: rsa-renameorig
This script renames a directory in the original_images folder.
"""
import argparse
import os
import sys
existing_dir = ""
new_name = ""
parent_dir = ""
new_dir = ""
def testDirs():
global existing_dir
glob... | true |
4bd0c95d7e78a2d1c707e49d56cbadf01f40f1b1 | Python | ElofssonLab/evolutionary_rates | /visualization/seq_and_str_in_same/curvefit.py | UTF-8 | 3,192 | 2.921875 | 3 | [] | no_license | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import Counter
import pdb
#Arguments for argparse module:
parser = argparse.ArgumentParser(description = '''A program that plots a runni... | true |
ace34d222c4167c3c65115aead207119ed9f4486 | Python | NischalKash/Project-2017---BMSIT | /IDS-Project-master/Code-2/Python Code/datasetCreator.py | UTF-8 | 1,054 | 2.859375 | 3 | [] | no_license | import cv2
import numpy as np
faceDetect=cv2.CascadeClassifier('haarcascade_frontalface_default.xml') #Cascase fronatal face
cam=cv2.VideoCapture(0) #Capture video stream
cam.set(3,320) #Set camera resoultion
cam.set(4,240)
uid=input("Enter the User ID matching with the RFID of the person")
sampleNum=0
while True:... | true |
1454c29661d793802c925de09e0eadff5c4b53b2 | Python | xiaoge2017/star | /Tools1_single/delFilesExcept.py | UTF-8 | 1,171 | 2.703125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
'''
在每个APP的migrations文件夹下,保留__init__.py文件,删除其他文件
'''
import os
import os.path
my_file_ROOT = 'C:/Users/wyc/Desktop/star'
my_file_APP = ['file_db','files_db','img_db','imgs_db','pro_db','xadmin']
my_file_migartions = 'migrations'
my_file_init = '__init__.py'
undel_file_list = [r'\__init__.py',]
... | true |
88c53c297d910f26ac2e5d226d30b84bf3c4b15e | Python | chlin61/file | /readfile.py | UTF-8 | 306 | 3.5 | 4 | [] | no_license | #read file
data =[]
count = 0
with open('reviews.txt','r') as f: # with 只要離開with架構 將會自動關閉open
for line in f:
##print(line.strip()) ##.strip() 去調換行符號
data.append(line.strip())
count += 1
if count % 1000 == 0:
print(count)
print(len(data))
print(data[0]) | true |
95debf004589c7628ce70e63a4d812667c4fb62a | Python | joaquinvanschoren/gama | /gama/GamaRegressor.py | UTF-8 | 1,053 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | import numpy as np
from .gama import Gama
from gama.configuration.regression import reg_config
from gama.utilities.auto_ensemble import EnsembleRegressor
class GamaRegressor(Gama):
def __init__(self, config=None, objectives=('neg_mean_squared_error', 'size'), *args, **kwargs):
if not config:
... | true |
9dfb8778ff2e6471fea1ec333a1ca051ec59b402 | Python | RamonFidencio/exercicios_python | /EX100.py | UTF-8 | 290 | 3.34375 | 3 | [] | no_license | from random import randint
def sorteio(lista):
for i in range(0,5):
lista.append(randint(0,10))
return lista
def somaPar(lista):
soma=0
for i in lista:
if i%2==0:
soma+=i
return print(soma)
lista=[]
sorteio(lista)
print(lista)
somaPar(lista)
| true |
ceab0a7b8ef0b44d9f2d6e5b0a8af1853310b9d0 | Python | chipaca/caw | /caw/widgets/mpdc.py | UTF-8 | 5,099 | 2.984375 | 3 | [] | no_license | import caw.widget
import collections
import mpd
import socket
class MPDC(caw.widget.Widget):
"""Widget to display MPD information.
Parameters
-----------
fg : text color of this widget
play_format : format of the text to display when a song is playing. \
See the list of possible repl... | true |
b1cb34b481c5fef5bf57e71141eaddde6f1e32db | Python | Axelwickm/Index-Stock-Preditor | /StockEvaluation.py | UTF-8 | 3,469 | 2.84375 | 3 | [] | no_license | from collections import defaultdict
import csv
import numpy as np
import torch
import Predictors
import Train
PredictorList = Train.PredictorList
def loadModels():
print("Loading models")
for predictor in PredictorList:
predictor.load("./models/" + predictor.__class__.__name__ + ".pth")
def perfo... | true |
2a57ffdb6a2ef276c694b463b4111d78ed405130 | Python | plawler92/challengefantasyetl | /src/infra/webpageprovider.py | UTF-8 | 230 | 2.625 | 3 | [] | no_license | import requests
class WebPageProvider(object):
def __init__(self, url):
self.url = url
def get_page(self):
page = requests.get(self.url)
if page.status_code == 200:
return page.content | true |
f507c7661a0cbc661ab9399074a397f3c957bf6e | Python | jortsquad/alexa-definition-game | /dictionary.py | UTF-8 | 405 | 2.96875 | 3 | [] | no_license | import requests
import urllib
import json
import random
from word import Word
class Dictionary():
def __init__(self,filename):
self.dictionary = json.load(open(filename))
# Generates a random word, returned as a Word object
def get_word(self):
word_obj = self.dictionary[random.randint(0,... | true |
ee5a879044f7de0729d713f6201e517efacb891c | Python | shloak2611/USAA | /Data Challenge.py | UTF-8 | 2,983 | 3.34375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 28 12:25:28 2019
@author: Shloak
"""
import pandas as pd
import matplotlib.pyplot as plt
df1 = pd.read_csv("MSA1.csv")
df2 = pd.read_csv("MSA2.csv")
#df1.head()
#df2.head()
#Finding No. of Properties Sold After 2018
df1x = df1[df1["Apr-08"] != "S"]
df... | true |
b9125852b31b04bfa332373d6383b17902f34bbd | Python | flips30240/VoxelDash | /StoryParser.py | UTF-8 | 1,631 | 3.078125 | 3 | [] | no_license | ##############################################
# #IMPORT# #
##############################################
##############################################
# #BULLET IMPORT# #
##############################################
####################################... | true |
f80d39a522a617ed5da949f9e8c9d739e0763f02 | Python | KrzysztofSieg/MN-interpolation | /spline_interpolation.py | UTF-8 | 1,911 | 2.59375 | 3 | [] | no_license | import numpy as np
def spline(x_basic_points, y_basic_points, x_all_points):
size_x = x_basic_points.size
delta = np.zeros([size_x])
mi = np.zeros([size_x])
sigma = np.zeros([size_x])
h = np.zeros([size_x])
for j in range(1, size_x):
h[j] = x_basic_points[j] - x_basic_points[j - 1]
... | true |
219141b35716d168bedc8bf74ca0d4ca20ab8f01 | Python | kmngtkm/command_injection | /cgi-bin/vul.py | UTF-8 | 655 | 2.609375 | 3 | [] | no_license | #!/usr/bin/python3
import subprocess
import cgi
import io
import sys
# 文字化け対策
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
# POSTされたデータの取得
form = cgi.FieldStorage()
# inputタグのname='string'の入力値を取得
string = form.getvalue('string')
# コマンドの組み立て
cmd = "echo " + str(string) + " | rev"
# subprocessでコマン... | true |
b6d614a5c3a70b2b7e2f980f62635a8c3c804d1c | Python | dyn1990/YelpTopicModel | /eval_utils.py | UTF-8 | 3,099 | 2.84375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon May 7 16:59:21 2018
@author: Dyn
"""
import matplotlib.pyplot as plt
import numpy as np
import itertools
from scipy import interp
from sklearn.preprocessing import label_binarize
from sklearn.metrics import roc_curve, auc
def Multi_roc_auc(y_true, y_score):
# http:... | true |
92b135280046e6014f2841a2ad1dc204455d7cfb | Python | Sumedh31/algos | /python/Misc/IterTools.py | UTF-8 | 521 | 3.671875 | 4 | [] | no_license | '''
Created on 12-May-2019
@author: Sumedh.Tambe
'''
import itertools
L = ['a','b','c']
c = []
for i in range(1, len(L)+1):
l = [list(x) for x in itertools.combinations(L, i)]
c.extend(l)
d=[]
l = [list(x) for x in itertools.combinations(L, 2)]
d.extend(l)
x= (int(len(c)) + int(len(d)))
print(x)
def exampl... | true |
7fefb83180ae5303ac515f1d8cd0a3a0eb0a264a | Python | michaelandom/NGO | /mainxr.py | UTF-8 | 779 | 2.546875 | 3 | [] | no_license | from fastapi import FastAPI
from typing import Optional
from pydantic import BaseModel
app = FastAPI()
class Blog(BaseModel):
title: str
body: str
published: Optional[bool]
@app.get("/")
def index():
return {"data": {"message": "index page"}}
@app.get("/blog")
def published(limit: int, publish: b... | true |
88a7f7fa4a31580aeb5f52318f6729d9f89b3ee8 | Python | sunovivid/hiddenlayer | /CodingTestExamples/Basic_Algorithms/DP/DP 6 - thieves.py | UTF-8 | 2,994 | 3.421875 | 3 | [] | no_license | '''def solution(money):
l, ans = len(money), []
for start, idx in [(money[0],0), (money[1],1)]:
level, std = [(start,idx)], l - 1 + idx
while len(level) < l//2 + 1:
next_level = [0 for _ in range(len(level)+1)]
# only for 0
if level[0] and level[0][1] +... | true |
2d239f7467f485fafe36725bd890580bc1fa5ed1 | Python | Asim-afk/MyGit | /SecondAssignment/6th.py | UTF-8 | 108 | 3.078125 | 3 | [] | no_license | def Sum(*b):
Sum = 0
for i in b:
Sum = Sum+i
return Sum
ans= Sum(8,2,3,0,7)
print(ans)
| true |
c88551d7f1fdd7ed913c74432efe0f05db63f25b | Python | shahkrapi/Image_Processing | /sharpen.py | UTF-8 | 668 | 2.734375 | 3 | [] | no_license | from PIL import Image
im=Image.open("krapi.jpg")
im=im.convert("L")
i1=im.copy()
width,height=im.size
print(str(width)+" "+str(height))
sum1=0
for i in range(1,width-1):
for j in range(1,height-1):
sum1=0
for a in range(i-1,i+2):
for b in range(j-1,j+2):
t=(a,b)
if(a==i and b==j):
sum... | true |
329a472804fa25c78369cc7874ccb513b0fe9aea | Python | laosiaudi/brs | /appendix/demo.py | UTF-8 | 3,144 | 2.671875 | 3 | [] | no_license | #encoding=utf-8
# AUTHOR: LaoSi
# FILE: demo.py
# 2014 @laosiaudi All rights reserved
# CREATED: 2014-06-05 19:13:12
# MODIFIED: 2014-06-07 20:34:35
import urllib
import time
import sys
import MySQLdb
import re
import json
from bs4 import BeautifulSoup
reload(sys)
sys.setdefaultencoding('utf-8')
rfile = open(... | true |
281b8ccabfeccb8053e7f2a8387573134854fd9f | Python | MMCALL01/developmentBoard | /TPYBoard-v10x-master/04.心形8x8点阵/main.py | UTF-8 | 748 | 2.828125 | 3 | [] | no_license | # main.py -- put your code here!
import pyb
from pyb import Pin
x_row = [Pin(i, Pin.OUT_PP) for i in ['X1','X2','X3','X4','X5','X6','X7','X8']]
y_col = [Pin(i, Pin.OUT_PP) for i in ['Y1','Y2','Y3','Y4','Y5','Y6','Y7','Y8']]
tuxing = [
#大心
['11111111','10011001','00000000','00000000','10000001','11000011','11100111','1... | true |
237f2877c676fbb5d017fa5670a19ce2d0e0d257 | Python | goatber/hangman_py | /main.py | UTF-8 | 3,483 | 4.03125 | 4 | [] | no_license | """
Hangman in python
by Justin Berry
"""
import random
words_short = open("words_short.txt", "r")
words_long = open("words_long.txt", "r")
short_words = [] # List of short words, need to truncate "\n"
long_words = [] # List of long words, need to truncate "\n"
tiles = [] # List of displayed tiles
... | true |
3a6014ab60197a79b03f106c8531ea5ac777cf4c | Python | AFatWolf/cs_exercise | /Mid-term preparation/Midterm4/1assignment1.py | UTF-8 | 221 | 3.34375 | 3 | [] | no_license | def my_compare(x, y):
if len(x) == y:
return 'equal'
if len(x) > y:
return 'larger'
return'smaller'
print(my_compare('apple', 3))
print(my_compare('banana', 7))
print(my_compare('tomato', 6))
| true |
6c6e594a21606426f503bc502a38387cbcf741ea | Python | bayne/CarND-Traffic-Sign-Classifier-Project | /Traffic_Sign_Classifier.py | UTF-8 | 7,744 | 2.828125 | 3 | [] | no_license | import pickle
import numpy as np
import tensorflow as tf
from tensorflow.contrib.layers import flatten
def safe_indexing(X, indices):
"""Return items or rows from X using indices.
Allows simple indexing of lists or arrays.
Parameters
----------
X : array-like, sparse-matrix, list.
Data fr... | true |
10cdf7c6c88cb3fe32c20505c883716372d2b7fa | Python | yahavzar/ManyForOne | /server/Login.py | UTF-8 | 1,653 | 2.625 | 3 | [] | no_license | from flask import Blueprint, render_template, request, redirect, session
from DB import get_user
from datetime import datetime
login_page = Blueprint('Login', __name__, template_folder='../templates')
@login_page.route('/Login', methods=['POST', 'GET'])
def login():
if request.method == 'POST':
email = r... | true |
f4706dafed5a4ecef28f97a87437deec3e829fe7 | Python | siddharthcb/jmoab-ros | /src/jmoab-ros-atcart.py | UTF-8 | 1,857 | 2.625 | 3 | [] | no_license | #! /usr/bin/env python
import rospy
from smbus2 import SMBus
from std_msgs.msg import Int32MultiArray
class JMOAB_ATCart:
def __init__(self):
rospy.init_node('jmoab_ros_atcart_node', anonymous=True)
rospy.loginfo("Start JMOAB-ROS-ATCart node")
self.bus = SMBus(1)
self.sbus_ch_pub = rospy.Publisher("/sbus_... | true |
a5216cf881102239e813c8f7760a0cddc2156ff9 | Python | calpoly-csai/CSAI_Voice_Assistant | /Scripts/AddPath.py | UTF-8 | 1,284 | 3.015625 | 3 | [] | no_license | '''
Name: Path Adder
Author: Chidi
Date: 10/10/2019
Organization: Cal Poly CSAI
Description: Adds the path to the CSAI Voice Assistant
directory for the program scripts
'''
import json
import os
from Utils.OS_Find import Path_OS_Assist
def main():
path = "" # path string
confirm = "" # confir... | true |
cfd448ef96311168b475781f8ad088210ab5d5d6 | Python | CodeWorks21-Python/ciphers_solution | /rail_fence_cipher.py | UTF-8 | 5,434 | 3.90625 | 4 | [] | no_license | # author: elia deppe
# date: 7/28
# difficulty: hard
# Wikipedia: https://en.wikipedia.org/wiki/Rail_fence_cipher
# Read this for a better understanding of the cipher.
# Introduction
#
# Implement encoding and decoding for the rail fence cipher.
#
# The Rail Fence cipher is a form of transposition cipher that gets... | true |
d58e68504eba5862d7397ac9aedcdd2f390557b1 | Python | bjlittle/geovista | /src/geovista/examples/from_2d__orca_moll.py | UTF-8 | 2,036 | 2.859375 | 3 | [
"BSD-3-Clause",
"CC-BY-4.0"
] | permissive | #!/usr/bin/env python3
"""Importable and runnable geovista example.
Notes
-----
.. versionadded:: 0.1.0
"""
from __future__ import annotations
from pyproj import CRS
import geovista as gv
from geovista.common import cast_UnstructuredGrid_to_PolyData as cast
from geovista.pantry import um_orca2
import geovista.theme... | true |
675211cd79c79193584f5cf9d74abfc7c2c152f5 | Python | marklr/consensus_debate_bot | /helpers.py | UTF-8 | 291 | 2.796875 | 3 | [] | no_license |
def is_deleted(thing):
try:
content = thing.body
except AttributeError:
content = thing.selftext
return thing.author is None and content == '[deleted]'
def del_key(dictionary, key):
return {k: (v[0], del_key(v[1], key))
for k, v in dictionary.items() if k != key} | true |
01ee4c72270fc7e4330fac150f11ad2d7761a5da | Python | qxzsilver1/HackerRank | /Data-Structures/Trees/Huffman-Decoding/Python2/solution.py | UTF-8 | 475 | 3.3125 | 3 | [] | no_license | """class Node:
def __init__(self, freq,data):
self.freq= freq
self.data=data
self.left = None
self.right = None
"""
import sys
# Enter your code here. Read input from STDIN. Print output to STDOUT
def decodeHuff(root , s):
#Enter Your Code Here
temp = root
for c i... | true |
5939c2b0aa13b841e0191832894467558164f261 | Python | ehouguet/ehouguet-snake-ia | /main.py | UTF-8 | 2,546 | 2.75 | 3 | [] | no_license | from time import sleep
import pygame
from game import Game
from window import Window
from brain import Brain
from constante import Constante
class Main:
def __init__(self):
self.window = Window(Constante.NB_ROW, Constante.NB_COLUMN)
self.game = Game(Constante.NB_ROW, Constante.NB_COLUMN)
self.brain = B... | true |
9fe25f63c99f9c93660f1ac17609a3fa9906c731 | Python | adoleba/toggl_app | /toggl/forms.py | UTF-8 | 6,081 | 2.65625 | 3 | [] | no_license | from django import forms
from toggl.initial_data import start_day, end_day
class DateInput(forms.DateInput):
input_type = 'date'
class TimeInput(forms.TimeInput):
input_type = 'time'
class PasswordInput(forms.PasswordInput):
input_type = 'password'
CHOICES = [('R', 'Takie same'),
('V', '... | true |
eb4ed306f6306f48e2f699443b28699a3bb66a3a | Python | mindajalaj/academics | /Projects/python/pyh-pro/NFS-REMOVE-FOLDER.py~ | UTF-8 | 401 | 2.875 | 3 | [] | no_license | #!/usr/bin/python2
import os
x=raw_input("Enter the folder to be removed : ")
os.system("cat /etc/exports | grep " + x + "\ > /root/Desktop/trash")
j=1
f=open("/root/Desktop/trash" , 'r')
j=f.read()
if j == 1 :
print("Folder does not exist")
else :
print("Folder found")
#i=i[:-1]
cmd="sed -i -e's/" + j[:-1] + "... | true |
42aebd66eb4a0d8395623206cc8a024c557bee05 | Python | Htiango/Painting-Classification | /deep_learning/main.py | UTF-8 | 1,093 | 2.984375 | 3 | [] | no_license | import argparse
import numpy as np
import model
def run(args):
X = np.loadtxt(args.X_path)
y = np.loadtxt(args.Y_path, dtype=int)
X = X[(y==5) | (y==6)]
y = y[(y==5) | (y==6)]
y[(y==5)] = 0
y[(y==6)] = 1
print("Loaded data!")
print("Data_size = " + str(y.shape[0]))
print("label ... | true |
7498693e60e01d4197620c5b0c58cd7284cd6773 | Python | sarahperrin/open_spiel | /open_spiel/python/algorithms/deep_cfr.py | UTF-8 | 17,493 | 2.765625 | 3 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | # Copyright 2019 DeepMind Technologies Ltd. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | true |
7c1df9386958533d367ad34beae25827184e8619 | Python | iasolovev/EpamGrow | /OOP/task2/main.py | UTF-8 | 397 | 3.046875 | 3 | [] | no_license | from OOP.task2.classes import *
if __name__ == '__main__':
tv_1 = TV('LG', 60000, 45)
tv_2 = TV('Samsung', 80000, 55)
print(tv_2.print_info())
print(tv_2.print_avg())
phone_1 = Phone('Honor', 20000, 'ios')
phone_2 = Phone('Iphone', 100000, 'ios')
print(phone_2.print_avg())
print('Т... | true |
6572d72ecd89cf455b87799e697aac911f238a7a | Python | mldbai/mldb | /testing/MLDB-1802-select-orderby.py | UTF-8 | 1,373 | 2.734375 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # MLDB-1802-join-order-by.py
# Mathieu Marquis Bolduc, 2016-07-12
# This file is part of MLDB. Copyright 2016 mldb.ai inc. All rights reserved.
#
import unittest
import json
from mldb import mldb, MldbUnitTest, ResponseException
class DatasetFunctionTest(MldbUnitTest):
@classmethod
def setUpClass(self):
... | true |
8c9d2f2e77a9d33e50b9e0519c3bfb092071e33d | Python | bashbash96/InterviewPreparation | /LeetCode/Facebook/Medium/215. Kth Largest Element in an Array.py | UTF-8 | 734 | 3.921875 | 4 | [] | no_license | """
Given an integer array nums and an integer k, return the kth largest element in the array.
Note that it is the kth largest element in the sorted order, not the kth distinct element.
Example 1:
Input: nums = [3,2,1,5,6,4], k = 2
Output: 5
Example 2:
Input: nums = [3,2,3,1,2,4,5,5,6], k = 4
Output: 4
Constrai... | true |
f4d93ca2c85e7878cf4c33bc5e0bd3ff7e1204c2 | Python | cresentboy/test | /test10.py | UTF-8 | 2,588 | 3.09375 | 3 | [] | no_license | import requests,json
from lxml import etree
url = 'https://music.163.com/discover/artist'
singer_infos = []
# ---------------通过url获取该页面的内容,返回xpath对象
def get_xpath(url):
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/53... | true |
c43c410b833bcb029bdbe2a9ad316865496e9518 | Python | ravikumar290491/AWS_CMSDEV | /simple_test.py | UTF-8 | 79 | 3.328125 | 3 | [] | no_license |
def hello_world(name):
print(f"Hi this is {name}")
hello_world("girish")
| true |
acff0a73b7a35415c65374a20866cfd9f291d12c | Python | mfthomps/RESim | /simics/bin/showTrack.py | UTF-8 | 1,468 | 2.625 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python3
#
#
'''
Dump track files for a given target
'''
import sys
import os
import glob
import json
from collections import OrderedDict
import argparse
splits = {}
def getTrack(f):
base = os.path.basename(f)
cover = os.path.dirname(f)
track = os.path.join(os.path.dirname(cover), 'trackio', b... | true |
fa47b7691aac131b4c15eb5920abb7f0a2e145d2 | Python | gh-dsharma/Xframework | /libraries/jama_sync/libraries/test_case.py | UTF-8 | 6,416 | 2.984375 | 3 | [] | no_license | class TestCase:
"""
A class to pass information about a test case in jama_sync.py
"""
def __init__(self, name, parent_folder_path):
"""
TestCase initializer. Most information in the test case
will be filled out after it is initialized
:name: name or title of the test cas... | true |
a997c07d92264c2984b111613920a432a9b46131 | Python | yashika-5/pyFirst | /google_searchdata.py | UTF-8 | 311 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python2
import urllib2
from googlesearch import search
# now put a keyword
webdata = search('hello',num = 3,tld = "co.in")
#webdata = search('hello',num = 3,stop = 2,pause=1)
# generator type iterable
print type(webdata)
for i in webdata:
print i
link = urllib2.urlopen(i)
print link.read()
| true |
76a4e272bf293a488d1093469fa21763e50ed405 | Python | JaydipMagan/codingpractice | /leetcode/August-31-day/week4/fizz_buzz.py | UTF-8 | 527 | 3.296875 | 3 | [] | no_license | class Solution:
def fizzBuzz(self, n: int) -> List[str]:
multiples = {3:2,5:4}
replace = {3:"Fizz",5:"Buzz"}
res = []
for i in range(n):
buffer = ""
for num in multiples:
if multiples[num]==0:
buffer+=replace[num]
... | true |
5ce47923a8318aa64db051e405f3891f98277507 | Python | dbcli/pgcli | /pgcli/pgbuffer.py | UTF-8 | 2,027 | 2.78125 | 3 | [
"BSD-3-Clause"
] | permissive | import logging
from prompt_toolkit.enums import DEFAULT_BUFFER
from prompt_toolkit.filters import Condition
from prompt_toolkit.application import get_app
from .packages.parseutils.utils import is_open_quote
_logger = logging.getLogger(__name__)
def _is_complete(sql):
# A complete command is an sql statement th... | true |
e8024f1c00efff6b1ee1afc53a48afc4505ee2da | Python | vazzolini/BaBar-DKDalitzMiniUser | /selectionCode/gamma/efi_an51_new.py | UTF-8 | 1,203 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python
#import commands
import math
import os
import sys
from string import atof,atoi
#DK kspipi & Kskk and DPi
ldel=[["999999","54000","156000","83000","252000","333000","198000"],["999999","54000","156000","83000","252000","333000","198000"]]
modes=["btdkpi_d0k_kspipi_btdk","btdkpi_d0k_kskk_btdk"... | true |
c441b5643f75fa8ba759fe2e68c621ba758d5ecb | Python | LssG/zhongkeweisixuexijilu | /python/练习/2019_08_06.py | UTF-8 | 870 | 2.890625 | 3 | [] | no_license | import numpy
import pandas
import requests
import time
# s = pandas.Series([])
# print(s)
#
# s = pandas.Series([1, 2, 3, 4], index=["jj", "poi", "gyi", "asd"])
# print(s[0])
#
# arr = numpy.random.randint(0, 100, (4, 5))
# s = pandas.DataFrame(arr)
#
# print(s)
#
# print(s.iloc[0])
#
# print(s.count())
def sortFun(i... | true |
a876f99a50b96bc22af7305c2eb07b062534860d | Python | gustavscholin/AppliedArtificialIntelligence | /lab1/game.py | UTF-8 | 1,040 | 3.890625 | 4 | [] | no_license | import time
from lab1.board import Board
from lab1.board import Color
class Game:
# Init the game with players and a board
def __init__(self, player_w, player_b):
self.players = []
self.players.append(player_w)
self.players.append(player_b)
self.board = Board()
self.tu... | true |
e848b8e599cbf3c9aca0232d75de2397dae99163 | Python | HarriMeskanen/lego_robot_controller | /src/main_script.py | UTF-8 | 2,806 | 2.65625 | 3 | [] | no_license | # from <module> import <class/function>
from models import Link, Robot
from math import pi
import time
def main():
links = getLinks()
robot = Robot(links)
robot.setGearRatio([3,3.25,3])
initialize_demo(robot)
robot.setSensor("color",1)
time.sleep(2)
i = 0
while i < 2:
... | true |
58e6af2320a3f1c1a2ff2546c440f8bf887b35f9 | Python | iamgroot42/bio-adversary | /glimpse.py | UTF-8 | 19,199 | 2.765625 | 3 | [] | no_license | #image tools
import os
import warnings
import pickle
import tensorflow as tf
import numpy as np
from scipy.optimize import curve_fit, brenth
from functools import partial
def image_augmentation(image, dataset):
#image augmentations
if dataset == 'imagenet10':
#random crops and resize params
... | true |
f384e3ab1ffd878a2d6b65cf445fa0d3ba790c26 | Python | chouchouyu/my_words | /my_words/cuss.py | UTF-8 | 785 | 2.703125 | 3 | [] | no_license | rescue--0
repercussion--0
concussion
discuss
discussion
percussionist
英语词源字典
repercussion
repercussion,反响,恶果
re,向后,往回,percussion,敲击,碰撞,比喻用法,
英语词源字典
cuss
concuss,脑震荡
con,强调,cuss,摇晃,振荡,词源同discuss,percussion,
discuss,讨论
dis,分开,散开,cuss,摇,震荡,词源同concussion,percussion,引申词义谈话,讨论,
percussion,打击乐器
per,完全的,cuss,摇,击打,词源... | true |
a1d39465fce5af9fe39f4588aeb92df2c55d4cfe | Python | JokeDuwaerts/Quetzal | /quetzal/quetzal/chocolatemilk.py | UTF-8 | 1,459 | 3.578125 | 4 | [] | no_license | from .datastructures import *
class ChocolateMilk:
def __init__(self, id_):
"""
Initialises a new chocolatemilk.
:param id: The id of the chocolatemilk.
POST: A new chocolatemilk was created with a default price and workload.
"""
self.id = id_
self.price = 2
... | true |
c932b7e7d5f59cb7e56544727d1d4dbf89e3f19a | Python | cintiahiraishi/python-520 | /aula_3/ex_7.py | UTF-8 | 172 | 3.5625 | 4 | [] | no_license |
def somente_os_pares (lista):
return list(filter(lambda x: x %2 ==0, lista))
lista_1 = [1,2,3,4,5,6]
print(lista_1)
lista_2 = somente_os_pares(lista_1)
print(lista_2) | true |
0316b8f2f407e5c920f55a002d2004f84624a5a9 | Python | davidlibland/scratch-python | /clustering/clustering_algorithms/src/standard_metrics.py | UTF-8 | 2,942 | 2.578125 | 3 | [] | no_license | from collections import Counter
from functools import lru_cache
from itertools import combinations
from sklearn import metrics
from scipy import stats
def to_binary(clustering_list):
return [x == y for x, y in combinations(clustering_list, 2)]
def from_binary_metric(metric):
def clustering_metric(y_true, y... | true |
18e70abc434071d13d18ef3b6afec772df78243e | Python | chikii/DS-Algo-Competetive | /Tree/Dist two node in BST.py | UTF-8 | 574 | 3.34375 | 3 | [] | no_license | def solve(self, A, B, C):
curr = A
while curr:
if B < curr.val and C < curr.val:
curr = curr.left
elif B > curr.val and C > curr.val:
curr = curr.right
else:
x = find(curr, B)
y = find(curr, C)
... | true |
2e5f6bd8cb743e1dcad6246471fc3ef5de4c6099 | Python | lanl/ExactPack | /exactpack/solvers/cog/cog3.py | UTF-8 | 3,231 | 3.125 | 3 | [
"BSD-3-Clause"
] | permissive | r"""A Cog3 solver in Python.
This is a pure Python implementation of the Cog3 solution using Numpy.
The exact solution takes the form,
.. math::
\rho(r,t) &= \rho_0 \, r^{b - k -1}\, e^{b t}
\\
u(r,t) &= -\frac{b}{v} \cdot r
\\
T(r,t) &= \frac{b^2}{ v^2\, \Gamma (k - v - 1)} \cdot r^2
\\[5pt]
\gamma &... | true |
73fa772ca404d9e2520921caba39e7466279bc88 | Python | Lucasharris4/pythonVendingMachine | /menu/menu_item.py | UTF-8 | 1,495 | 3.234375 | 3 | [] | no_license | from vending_machine_error.vending_machine_error import OutOfStockError, InvalidSelectionError, Message
class MenuItem(object):
def __init__(self):
self.info = {
"code": "XX",
"name": "",
"price": "0.00",
"stock": 0,
}
def __setitem__(self, key,... | true |
da1fc18e1f4b4c226853eb95acb489ba646c20e7 | Python | carlosElGfe/BigDataAIR | /app.py | UTF-8 | 6,486 | 2.578125 | 3 | [] | no_license | import os
import time
import csv
from utils import *
from flask import Flask, render_template, request
import boto3
from werkzeug.datastructures import ImmutableMultiDict
import sys
countries = [
'Sydney',
'Estambul',
'Paris',
'Amsterdam'
]
app = Flask(__name__)
key = os.environ['ACCESS_KEY']
secret =... | true |
cf2b8a084f6c1d27d90a1df04384f449aa5aa835 | Python | Dmaner/Pytorch_learning | /VGG16.py | UTF-8 | 2,352 | 2.65625 | 3 | [] | no_license | from torchvision import models, transforms
import numpy as np
from PIL import Image
from torch import nn
Vgg16_cfg = [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M']
class Vgg16(nn.Module):
def __init__(self, layers, num_classes=1000, init_weight=True):
sup... | true |
4c927598793650c1509ff6d7d2bd2d273767bdfd | Python | cteant/SERGCN | /utils/eval.py | UTF-8 | 1,733 | 2.875 | 3 | [] | no_license | import numpy as np
from utils.logger import logger
def cal_AP(scores_list,labels_list):
list_len = len(scores_list)
assert(list_len == len(labels_list)), 'score and label lengths are not same'
dtype = [('score',float), ('label',int)]
values = []
for i in range(list_len):
values.append((scor... | true |
b85084b0594df73c707f5e78a37dbdc2d6841ce9 | Python | danielzengqx/Python-practise | /CC150 6th/4.4.py | UTF-8 | 490 | 3.28125 | 3 | [] | no_license | #check balance
class Node:
def __init__(self, data, left = None, right = None):
self.data = data
self.left = left
self.right = right
t = Node(1, Node(2, Node(4), Node(4)), Node(3, Node(4)))
def height(node):
if node == None:
return 0
return max(height(node.right), height(node.left)) + 1
def balance(node)... | true |
8d41ad35036621fde11c939a52e4a47e28a5b139 | Python | MarkusUllenbruch/Modulationssystem-with-FFT | /Implementierung_py/schnelle_Faltung.py | UTF-8 | 1,927 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
import numpy as np
# Schnelle Faltung Implementierung
def schnelle_faltung(f_arg, g_arg):
""" Berechne schnelle Faltung von 2 Inputsignalen
f_arg -- Inputsignal 1
g_arg -- Inputsignal 2
"""
if f_arg.size >= g_arg.size: # Bezeichne längeres Signal als f
... | true |
3f55054c94aa898107605c628b3cd58caa86e9a3 | Python | tigonza/lepton-pyscreen | /cv2def.py | UTF-8 | 3,643 | 2.5625 | 3 | [] | no_license | import cv2
import numpy as np
def getCropMedium(imageData, x, y):
m=4
p=4
if x-m < 0:
m = m-x
xl = 0
else:
xl = x-m
if y-p < 0:
p = p-y
yd = 0
else:
yd = y-p
xr = x + 5
yu = y + 5
square = imageData[xl:xr,yd:yu]
csq = np.a... | true |
21001661209434afc7b51cff5a7ef6435a6f7723 | Python | ldakir/Machine-Learning | /lab03/PolynomialRegression.py | UTF-8 | 8,462 | 3.390625 | 3 | [] | no_license | """
Starter code authors: Yi-Chieh Wu, modified by Sara Mathieson
Authors: Lamiaa Dakir
Date: 09/25/2019
Description: Data and PolynomialRegression classes
"""
# This code was adapted from course material by Jenna Wiens (UMichigan).
# import libraries
import os
import numpy as np
import matplotlib.pyplot as plt
from ... | true |
b042fb9a00f33ee92e3027165970751e906638c8 | Python | Dolantinlist/DolantinLeetcode | /1-50/8_string_to_integer.py | UTF-8 | 521 | 2.96875 | 3 | [] | no_license | class Solution():
def myAtoi(self, str):
ls = list(str.strip())
if len(ls) == 0:
return 0
sign = -1 if ls[0] == '-' else 1
i = 1 if ls[0] in ['-','+'] else 0
res = 0
while i < len(ls) and ls[i].isdigit():
res = 10 * res + int(ls[i])
... | true |
266d1348df5eedd582551931e64b765a776c9cf9 | Python | glassesfactory/techlab4-template | /model.py | UTF-8 | 1,560 | 2.65625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from datetime import datetime
from bson.objectid import ObjectId
from mongoengine import *
class ConnectDB():
def __init__(self):
self.db = None
def __enter__(self):
self.connect()
def __exit__(self, exc_type, exc_value, traceback):
... | true |
55eb458fe50a8d2bda047e3b00009eafd2153f07 | Python | uannabi/PyHeatmap | /valueHeatmap.py | UTF-8 | 247 | 3.15625 | 3 | [] | no_license | # libraries
import seaborn as sns
import pandas as pd
import numpy as np
# Create a dataset
df = pd.DataFrame(np.random.random((10, 10)), columns=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])
# plot a heatmap
sns.heatmap(df, xticklabels=4) | true |
86e8e1258a8f8ee95565c48cb5880317adc72d3b | Python | d-mh-codes/tictactoe | /tictac.py | UTF-8 | 1,456 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 23 17:53:04 2021
@author: mh_codes
"""
# | | 0
#----- 1
# | | 2
#----- 3
# | | 4
#01234
def field(current) :
for row in range(5) : #0,1,2,3,4
if row%2 == 0:
prow = int(row / 2)
for column in range(5) :#0,1,2,3,4... | true |
79f2f1bd752742790a04fd4d458ec216dd989c7f | Python | jsun-eab/learn-ortool | /MIP/mip_assignment_task_size.py | UTF-8 | 2,181 | 2.96875 | 3 | [] | no_license | # https://developers.google.com/optimization/assignment/assignment_teams
from ortools.linear_solver import pywraplp
def main():
solver = pywraplp.Solver('SolveAssignmentProblem',
pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
# Create data
# each work is in a row and each tas... | true |
31d94a76cf3cf8eadd275ac7eed8b1d37371d844 | Python | nsbradford/ExuberantCV | /odometry/odometry.py | UTF-8 | 4,312 | 2.875 | 3 | [] | no_license | """
odometry.py
Nicholas S. Bradford
19 March 2016
Algorithm from http://avisingh599.github.io/assets/ugp2-report.pdf:
1) Capture and undistort two consecutive images.
2) Use FAST algorithm to detect features in I^t, and track features in I^t+1.
New detection is triggered if the # of... | true |
ce6b5dcae72d92723ae44f23b05c274dd72b7ca9 | Python | Aria-K-Alethia/X-AI | /data_structure/sa.py | UTF-8 | 2,291 | 3.203125 | 3 | [
"MIT"
] | permissive | '''
Copyright (c) 2019 Aria-K-Alethia@github.com / xindetai@Beihang University
Description:
assistant function for building suffix array and lcp
Licence:
MIT
THE USER OF THIS CODE AGREES TO ASSUME ALL LIABILITY FOR THE USE OF THIS CODE.
Any use of this code should display all the info above.
'''
d... | true |
01302772f10834917c4d12fd555b5ccba8819014 | Python | RocketMirror/AtCoder_Practice | /socket.py | UTF-8 | 109 | 3.125 | 3 | [] | no_license | a, b = map (int, input().split())
plug = 1
cnt = 0
while plug < b:
plug += a - 1
cnt += 1
print (cnt) | true |
6632c4a723cc021d3085d8bb38b64297a2c5dbe8 | Python | webclinic017/A1chemy | /a1chemy/data_source/sw_sectors.py | UTF-8 | 924 | 2.625 | 3 | [
"Unlicense"
] | permissive | import re
from a1chemy.util import write_data_to_json_file
def parse_sw_sectors(source):
fd = open(source)
li = fd.readlines()
print(len(li))
result = []
for i in range(1, len(li) - 1):
row_data = re.split('<|>', li[i])
symbol_suffix = row_data[8]
exchange = 'SH' if symbol... | true |
1e6a34243b41af7fcc866765c5a0b70b8c3cacbd | Python | Struth-Rourke/cs-module-project-algorithms | /product_of_all_other_numbers/product_of_all_other_numbers.py | UTF-8 | 1,104 | 4.25 | 4 | [] | no_license | '''
Input: a List of integers
Returns: a List of integers
'''
def product_of_all_other_numbers(arr):
# instantiate empty product list
product = []
# loop over items in the arr, enumerated so that I can access the index
for index, j in enumerate(arr):
# create a new, copy of the array
ne... | true |
633ccb8709ff58c645d3b21eb8e417f862c22bea | Python | protea-ban/programmer_algorithm_interview | /CH1/1.10/remove_node.py | UTF-8 | 1,179 | 4.15625 | 4 | [] | no_license | # 在只给定单链表中某个结点的指针的情况下删除该结点
class LNode:
def __init__(self):
self.data = None
self.next = None
# 构造单链表
def ConstructList():
i = 1
head = LNode()
head.next = None
tmp = None
cur = head
while i < 8:
tmp = LNode()
tmp.data = i
tmp.next = None
cur... | true |
f37f8ad4e2c601f9d671ea1f83fd9689c951b94e | Python | marijalogarusic/Srce-D450 | /10. dodatak/9.py | UTF-8 | 448 | 3.890625 | 4 | [] | no_license | niz = input("Unesite niz znakova: ")
privremenNiz = ""
for e in niz:
if e>='a' and e<='z' or e>='A' and e<='Z':
privremenNiz += e.lower()
duljina = len(privremenNiz)
i=0
palindrom = True
while i < int(duljina/2):
if privremenNiz[i] != privremenNiz[duljina-i-1]:
palindrom = False
break
i ... | true |
b53c2669597df2d82297c118b688a086f00b4e52 | Python | ilee38/practice-python | /graphs/topological_sort.py | UTF-8 | 2,062 | 3.8125 | 4 | [] | no_license | #!/usr/bin/env python3
from directed_graph import *
def topological_sort(G):
""" Performs topological sort on a directed graph if no cycles exist.
Parameters:
G - directed graph represented with an adjacency list
Returns:
returns a dict containing the edges in the discovery path as:
... | true |
5ac2174d792da46a6affbad8d72dd2fb60af1c15 | Python | seven320/AtCoder | /abc190/c/main.py | UTF-8 | 1,082 | 2.8125 | 3 | [] | no_license | #!/usr/bin/env python3
# encoding:utf-8
import copy
import random
import bisect #bisect_left これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys
import collections
from decimal import Decimal # 10進数で考慮できる
mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000
d = collections.deque()
def LI()... | true |
f426387bcd9ca6981466786798281fb8f211c7f6 | Python | MichaelSel/wrong_note_MEG_pilot | /average_time.py | UTF-8 | 1,634 | 2.59375 | 3 | [] | no_license | import json
import dateutil.parser
import math
import statistics as stat
import csv
import scipy.stats
import os
import numpy as np
import sim_reformat_data
import matplotlib.pyplot as plt
import statistics as stat
#define directories
processed_dir = './processed'
analyzed_dir = './analyzed'
all_data_path = processed_... | true |
7e3512dde850f318c7cc185b7396678dcbd4b95e | Python | skunz42/New-York-Shortest-Path | /src/Edge.py | UTF-8 | 294 | 2.640625 | 3 | [] | no_license | class Edge:
def __init__(self, source, dest, dist):
self.source = source
self.dest = dest
self.dist = dist
def getSource(self):
return self.source
def getDest(self):
return self.dest
def getDist(self):
return self.dist
| true |
f29ee643e4d9ba96d9a25eb988c8416e014db80c | Python | adruzenko03/Python-ASCII-RogueLike | /enemycreator.py | UTF-8 | 3,235 | 3.21875 | 3 | [
"MIT"
] | permissive | from random import *
from itemcreator import *
from copy import *
class Enemy (object):
def __init__(self, name, maxhp, strength, weaponchoices, rarity, moneydrop, droplist):
self.name = name
self.maxhp = maxhp
self.strength = strength
self.weaponchoices = weaponchoices
sel... | true |
27072f02ea453a889baac59a7bf62b372a9a52e1 | Python | Aasthaengg/IBMdataset | /Python_codes/p03315/s533435002.py | UTF-8 | 51 | 3 | 3 | [] | no_license | S = input()
p = S.count("+")
m = 4 - p
print(p-m) | true |