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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ca58edf3b9249f20a7bc3657fdf90ec987bb8ec1 | Python | someshjaishwal/Opencoin | /opencoin_server.py | UTF-8 | 3,287 | 3.078125 | 3 | [] | no_license | from flask import Flask, jsonify , request, render_template
from uuid import uuid4
from blockchain import Blockchain
# Create a web app
app = Flask(__name__)
# Create an address for the node on port 5001
node_address = str(uuid4()).replace('-', '')
# Create a blockchain object
blockchain = Blockchain()
# Render htm... | true |
9acecd405079fd408d4744608edf75a55216a555 | Python | Shiv2157k/leet_code | /expedia/minimum_knight_moves.py | UTF-8 | 3,437 | 3.640625 | 4 | [] | no_license | from collections import deque
from functools import lru_cache
class Knight:
def minimum_moves(self, x: int, y: int) -> int:
"""
Approach: DFS
Time Complexity: O(|x*y|)
Space Complexity: O(|x*y|)
:param x:
:param y:
:return:
"""
@lru_cache(m... | true |
25d6265961aa4fe52fb394cfa43f65699f6d9a79 | Python | ProfeJoelPOO/poo-python-2021 | /clase14/test_figura_geometrica.py | UTF-8 | 470 | 3.484375 | 3 | [] | no_license | from clase_cuadrado import Cuadrado
from clase_rectangulo import Rectangulo
from clase_figura_geometrica import FiguraGeometrica
# No se puede instanciar una clase abstracta
# figura = FiguraGeometrica(80, 90)
cuadrado1 = Cuadrado(5, 'Negro')
print(str(cuadrado1.calcular_area()) + 'cm2')
rectangulo1 = Rectangulo(3, ... | true |
bddf006b28e100fec74fd13e52cd581cf73385ce | Python | siddharth-u/selenium-python | /test.py | UTF-8 | 3,736 | 2.75 | 3 | [] | no_license | import selenium
from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from PIL import Image
from io import BytesIO
# Function to check gender, have used variable name revird because it is driver spelled backwards
driver = webdriver.Chrome("J:\\Chromedriver.exe")
#this i... | true |
bee9ad57a9aaa5df3817ce8fd2aa3ffe28b69216 | Python | sergun-36/messenger_intensiv | /server.py | UTF-8 | 1,434 | 2.796875 | 3 | [] | no_license | from flask import Flask, request, abort
from datetime import datetime
import time
db = [
{
"name": "Nick",
"text": "Hello",
"time": time.time()
},
{
"name": "Ivan",
"text": "Hello, Nick",
"time": time.time()
}]
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, messange... | true |
d3b6c5c8a096e37481cab3158c65e31c9aae1701 | Python | gary-loayza/Python-Basics | /4-exercises.py | UTF-8 | 4,644 | 4.5 | 4 | [] | no_license | ################################################################################
# What is 7 to the power of 4
################################################################################
7**4
################################################################################
# Split this string
#
## s = "Hi there S... | true |
9531f1651dabd8e703a848b3c50132506d229894 | Python | ryalsjosh14/ML-implementation | /ps2/src/p06_spam.py | UTF-8 | 11,686 | 3.671875 | 4 | [] | no_license | import collections
import csv
import matplotlib.pyplot as plt
import numpy as np
import json
def get_words(message):
"""Get the normalized list of words from a message string.
This function should split a message into words, normalize them, and return
the resulting list. For splitting, you should split on... | true |
0c538bfa38d536cd47f838854bafda215cb246eb | Python | daniel-lozano/prueba | /Astro/espectro.py | UTF-8 | 1,603 | 2.609375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
from sys import argv
Labels=["N_2","H_2","O_2","CO","NO"]
R=[109.4,74.16,120.7,112.8,115.1]
Be=[2.01,60.8,1.45,1.931,1.705]
De=[5.8E-6,1.6E-2,4.8E-6,6E-6,0.5E-6]
alpha_e=[0.017,3.06,0.016,0.017,0.017]
beta_e=alpha_e#[0.0,0.0,0.0,0.0,0.0]
w_e=[2359.0,4401,1580.0,2170.... | true |
517a6604689d3d2acaca5d917a9063a442ac97b0 | Python | arturovictoriar/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/8-uppercase.py | UTF-8 | 287 | 3.75 | 4 | [] | no_license | #!/usr/bin/python3
def uppercase(str):
strup = ""
for i in range(len(str)):
if ord(str[i]) >= ord('a') and ord(str[i]) <= ord('z'):
strup = ord(str[i]) - 32
else:
strup = ord(str[i])
print("{:c}".format(strup), end="")
print()
| true |
0863e4788b2a64f0f12d9a93d6f48fef8ce1f08e | Python | cluster-ai/Automarket | /project/modules/preproc.py | UTF-8 | 3,363 | 3.375 | 3 | [] | no_license |
#standard libraries
import math
import time
import datetime
import numpy as np
import pandas as pd
def unix_to_date(unix, show_dec=True):
#the datetime package is only accurate to 6 decimals but 7 are
#needed for date format being used. Since the decimal value is
#the same regardless of unix or date, I have it... | true |
4b2318ff4972dba5bf3f5bb2da3204315e76bab0 | Python | VaishakDV/ML-project | /Coin detection/coinrecognitionanddetection.py | UTF-8 | 2,252 | 2.75 | 3 | [] | no_license | # import libraries
import numpy as np
import matplotlib.pyplot as plt
import cv2
from scipy import ndimage
from skimage.feature import canny
from skimage.transform import hough_circle, hough_circle_peaks
from skimage.transform import hough_ellipse
from skimage.draw import ellipse_perimeter
# capturing coin i... | true |
052e0cf1b77ebef932addb1d5c1c1cf879fa9c1a | Python | k43lgeorge666/Python_Scripting | /functions/program5.py | UTF-8 | 1,302 | 4.59375 | 5 | [] | no_license | #!/usr/bin/python
def Add_Numbers(number1, number2):
result = number1 + number2
print("The result is: " + str(result))
def Substract_Numbers(number1, number2):
result = number1 - number2
print("The result is: " + str(result))
def Multiply_Numbers(number1, number2):
result = number1 * number2
print("The result... | true |
a293eb44ec231d2ad85a2ade3d1324a7307cbcdb | Python | nischayn22/PythonScripts | /Mergeinversion.py | UTF-8 | 632 | 2.625 | 3 | [] | no_license | inversion=0
def merge(array,i,j):
global inversion
# raw_input()
# print i,j
if(j==i):
return [array[i]]
else:
array1 = merge(array,i,(j+i)/2)
array2 = merge(array,(j+i)/2+1,j)
# print array1, array2
retarr = []
while( len(array2)>0 and len(array1)>0 ):
if(array1[0]>array2[0]):
retarr.append(arr... | true |
f10b99b4d5a1526b67f6352947ebb8afcc41499e | Python | TongJin123/matplotlib | /matplotlib_basic.py | UTF-8 | 299 | 3.5625 | 4 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-1,1,5) # x是从-1到1的50个点,相当于分成50段,分的越多越精确,有点像微分
# y = 2*x + 1
y = x**2 # 创建一个函数
plt.plot(x,y) # 图形化函数
plt.show() # 使用这个函数,图才会出来 | true |
aa93ae44093bf4eabc57fe2033a784e9e280a9b8 | Python | winnievoi/winnievoi | /MCTS 2/Run_with_human.py | UTF-8 | 1,103 | 2.703125 | 3 | [] | no_license | from Game import Game
from MCTS import MCTS
def main(board_size):
env = Game(board_size,is_random_policy=False)
done = False
while not done:
mcts = MCTS(n_iterations=50, depth=10, exploration_constant=10,
game_board=env.game_state,win_mark=env.board_size, player='O')
action... | true |
f5d713ddcb32501b716df7503541f3dd0e3bf3fa | Python | joaootavio93/3DFaceTracking | /face_tracking.py | UTF-8 | 1,556 | 2.59375 | 3 | [
"MIT"
] | permissive | """
Contains functions for 3D face tracking and face augmentation for Augmented Reality purposes.
"""
import cv2
import utils
import face_alignment as fa
import face_detection as fd
import face_fit as ff
def track_faces(img):
""" Computer 3D face tracking.
Parameters:
img (list): The input image... | true |
a69976215401fd6926aea40281832eb314c419b7 | Python | KFranciszek/Python | /ZADANKA/1/3.py | UTF-8 | 2,611 | 3.421875 | 3 | [] | no_license | slownikCyfr = {1:"jeden", 2:"dwa", 3: "trzy", 4: "cztery", 5:"pięć", 6:"sześć",
7: "siedem", 8:"osiem", 9:"dziewięć"}
slownikDwucyfr = {10: "dziesięć", 11:"jedenaście",
14:" czternaście", 15: " piętnaście", 16: " szesnaście", 19: " dziewiętnaście",
20:" dwadzieścia... | true |
8796418fc07ed918c6b77ab011861ce1c9b88c09 | Python | dayfundora/autogoal | /autogoal/ml/metrics.py | UTF-8 | 652 | 2.71875 | 3 | [
"MIT"
] | permissive | import inspect
import numpy as np
METRICS = []
def register_metric(func):
METRICS.append(func)
return func
def find_metric(*types):
for metric_func in METRICS:
signature = inspect.signature(metric_func)
if len(types) != len(signature.parameters):
break
for type_if... | true |
52efc725e9e47e6e72bb0375e8a7e4c89cc20433 | Python | aurel1212/Sp2018-Online | /students/daniel_grubbs/lesson08/Assignment08/populate_mailroom_mongodb.py | UTF-8 | 1,767 | 3.0625 | 3 | [] | no_license | """
Data for Donor Management System database - MongoDB
"""
import login_database
import utilities
log = utilities.configure_logger('default', 'logs/mongodb_script.log')
def populate_donor_data():
"""
Populate donor data
"""
# Define our initial donor data
donor_data = [
{
... | true |
f3ea29084ce5651998f57ec581aeed663bff9db3 | Python | microsoft/CASPR | /caspr/models/embedding_layer.py | UTF-8 | 2,383 | 3.109375 | 3 | [
"MIT"
] | permissive | """CASPR embedding layer base class."""
import numpy as np
import torch
import torch.nn as nn
class CategoricalEmbedding(nn.Module): # noqa: W0223
"""Define embedding layers to convert categorical variable values to continuous embeddings.
Uses pytorch defined nn.Embedding layers
The incoming data for t... | true |
2803d7dc125761e0356442007a71e90e13b7ded6 | Python | mcneel/computeclient_py | /compute_rhino3d/AreaMassProperties.py | UTF-8 | 9,373 | 2.578125 | 3 | [
"MIT"
] | permissive | from . import Util
try:
from itertools import izip as zip # python 2
except ImportError:
pass # python 3
def Compute(closedPlanarCurve, multiple=False):
"""
Computes an AreaMassProperties for a closed planar curve.
Args:
closedPlanarCurve (Curve): Curve to measure.
Returns:
A... | true |
3cb7f89afd51fb33870d00b4d5afce1294aa206e | Python | YatreeLadani/CompetitiveProgramming | /LeetCode/1_ReversString.py | UTF-8 | 206 | 3.21875 | 3 | [] | no_license | class Solution:
def reverseString(self, a: List[str]) -> None:
x = 0
y = len(a)-1
while(x<y):
a[x],a[y] = a[y],a[x]
x+=1
y-=1 | true |
052db344814c64c40b69022219f7fe1a4ef441dc | Python | death-of-rats/CTF | /2022/WolfSec/EAV/sol.py | UTF-8 | 441 | 2.71875 | 3 | [] | no_license | #!/usr/bin/env python
import math
from Crypto.Util.number import long_to_bytes
p = 320907854534300658334827579113595683489
g = 3
#A = pow(g,a,p) #236498462734017891143727364481546318401
A = 236498462734017891143727364481546318401
for i in range(1000000000000000):
A1 = A+i*p
v = math.log(A1, 3)
if v.i... | true |
b655391eb0fc211b768d645ac54a04b277747be7 | Python | lkubie/gemd-python | /gemd/entity/value/uniform_integer.py | UTF-8 | 763 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | """A uniformly distributed integer value."""
from gemd.entity.value.integer_value import IntegerValue
class UniformInteger(IntegerValue):
"""
Uniform integer distribution, with inclusive lower and upper bounds.
Parameters
----------
lower_bound: int
Inclusive lower bound of the distributi... | true |
f5d13bf7b3fc60030cc0ad02bb7b381422204c8a | Python | Sujankhyaju/IW_PythonAssignment1 | /function/3.py | UTF-8 | 269 | 4.4375 | 4 | [] | no_license | # 3. Write a Python function to multiply all the numbers in a list.
def mul(sample_list):
result=1
for item in sample_list:
result *= item
return result
sample_list = [8, -2, 3, -1, 7]
print("Multiplication of all the numbers::",mul(sample_list)) | true |
b81b4b7b15563d66aa0ec666126f76f7462272bd | Python | longdongchuan/pyadlml | /pyadlml/dataset/plot/devices.py | UTF-8 | 8,029 | 2.671875 | 3 | [] | no_license | import numpy as np
from pyadlml.dataset.util import print_df
from datetime import timedelta
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.colors as colors
from pyadlml.dataset.stats.devices import duration_correlation, \
devices_trigger_time_diff, device_tcorr, device_triggers... | true |
ed981284d8e456c7e5832d532e46f7c4b1528675 | Python | taosenlin/python_file | /sel/day1/1访问百度.py | UTF-8 | 440 | 2.859375 | 3 | [] | no_license | # Time:2020-02-09 16:20
# Author:TSL
from selenium import webdriver
#文件名,模块名不要和现有的库名称相同
import time
driver = webdriver.Chrome("D:\\ruanjiananzhuang\chromedriver.exe")
#谷歌浏览器
driver.get("http://www.baidu.com")
driver.find_element_by_id("kw").send_keys("松勤")#找到输入框,输入想搜索的值
driver.find_element_by_id("su").click()#点击百度一... | true |
7bf7f8d06d8c370cba17f4ddaa3cf1c35d022966 | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2740/60889/272842.py | UTF-8 | 571 | 3.15625 | 3 | [] | no_license | def timeD(time1,time2):
time1 = time1.split(":")
time1N = int(time1[0])*60+int(time1[1])
time2 = time2.split(":")
time2N = int(time2[0])*60+int(time2[1])
if time1N > time2N:
timeD = time1N - time2N
else:
timeD = time2N - time1N
if timeD > 720:
timeD = 1440-timeD
r... | true |
5ea5ea37487dced28d4133c56493ff5ea9fb4202 | Python | marcelomata/MBTI-Tweetouilles | /PythonBasics/Content/Models/TrainingWord2Vec.py | UTF-8 | 5,878 | 2.734375 | 3 | [] | no_license | #%% cell 0
import sys
sys.path.append('C:/Users/BOUÂMAMAElMehdi/documents/visual studio 2017/Projects/PythonBasics/PythonBasics/')
import numpy as np
from DatabaseManager import *
import multiprocessing
from multiprocessing import Pool
from text_helper import *
import random
import collections
import os
import pandas a... | true |
8fa208ad1908842f70c059e859bdec801b043b65 | Python | cpereira00/Image-Classifier | /trainer.py | UTF-8 | 9,278 | 2.53125 | 3 | [] | no_license | from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.applications import InceptionV3
from tensorflow.keras.layers import Dropout, Flatten, Dense, Input
from tensorflow.keras.models import Model
from tensorflow.keras.optimizers import SGD, Adam
import os
from sklearn.metrics import ... | true |
43c70a8bdc3000bdeab4a0b9d2e80e10ae73f61e | Python | tz0rgina/ML-2nd-Assignment | /reload2_a.py | UTF-8 | 2,408 | 2.796875 | 3 | [] | no_license | # Import libraries and modules
import numpy as np
np.random.seed(123) # for reproducibility
import keras
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Convolution2D, MaxPooling2D
from keras.utils import np_utils
from keras.datasets i... | true |
c7e115ec3cf2a6e96e977eb50de5081582b4a9af | Python | juliia5m/course_work | /feature_extracting_popul_author.py | UTF-8 | 4,302 | 3.234375 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from sklearn.cluster import KMeans
import os
import course
def compute_mean(dataframe):
result = dataframe.mean()
return result
def compute_var(dataframe):
result = datafra... | true |
180d8d0a9948939cb6bf4aa071438adb5345f06f | Python | DarkCyTic/daily_coding_problems | /problem_5/solution.py | UTF-8 | 368 | 3.796875 | 4 | [] | no_license | def cons(a, b):
def pair(f):
return f(a ,b)
return pair
def car(pair):
def first(a ,b):
return a
return pair(first)
def cdr(pair):
def last(a ,b):
return b
return pair(last)
if __name__ == "__main__":
first = car(cons(3, 4))
last = cdr(cons(3, 4))
print("F... | true |
7b7214a782c11a96782903957e38f0717af989da | Python | loti-ibrahimi/AWS-Script-Boto3 | /Assessment1/run_newwebserver.py | UTF-8 | 12,757 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python3
#------------------------------------------------------------------------------------#
# Student Name: Loti Ibrahimi | (20015453)
# Course: The Internet of Things
# Module: Dev Ops
# Lecturer: Jimmy McGibney
# Code references: Jimmy McGibney/Richard Frisby DevOps labs (Boto3 tutorial/Assignmen... | true |
5ea0a75d2379ad6cf409cbca0861e7cd41ee9eaa | Python | CSmel/pythonProjects | /person_customer_program/ProductionWorker.py | UTF-8 | 1,491 | 3.234375 | 3 | [] | no_license | # Employee class
class Employee:
# Initialize the object.
def __init__(self, name, number):
self.__name = name
self.__number = number
# Mutator for the __name attribute.
def set_name(self, name):
self.__name = name
# Mutator for the __number attribute... | true |
16c3496681e8dd87158162e063be43bdcac8d27d | Python | antdlx/pythonWebDemo1 | /rank/tools.py | UTF-8 | 548 | 2.984375 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import datetime
import json
class MyMath:
def UpDivision(self, a, b):
a = int(a)
b = int(b)
return int((a + b - 1) / b)
# 解决日期不能json编码的问题
class CJsonEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime.datetime):
... | true |
362b8b4ceae97fe5d8b44e5cd7cedeb8f2a2ba5e | Python | LordAmit/mobile-monkey | /adb_logcat.py | UTF-8 | 3,875 | 2.609375 | 3 | [
"MIT"
] | permissive | from pathlib import Path
import shlex
import time
from enum import Enum
import subprocess
import api_commands
import config_reader as config
from emulator import Emulator
from apk import Apk
class TestType(Enum):
'''
Test types to be used by the logcat
'''
Monkey = 0
MobileMonkey = 1
class Fata... | true |
47c694c885d9790bd41fd9b65d559c4c35319b6a | Python | mfrasquet/SHIPcal | /General_modules/func_General.py | UTF-8 | 13,944 | 2.921875 | 3 | [
"MIT"
] | permissive |
#Miguel Frasquet
import numpy as np
import math
#from matplotlib import pyplot as plt
def bar_MPa(pres):
pres=pres/10
return pres
def MPa_bar(pres):
pres=pres*10
return pres
def C_K(temp):
temp=temp+273
return temp
def K_C(temp):
temp=temp-273
return temp
def ... | true |
aced4d8093f2ba70f7a3fa37384f565915672c82 | Python | dtim-upc/gcnsmv2 | /step3/step3_train_test_split.py | UTF-8 | 4,010 | 2.65625 | 3 | [] | no_license | import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
import os
from pathlib import Path
def concat_shuffle(a1,a2):
out = np.concatenate((a1,a2))
np.random.shuffle(out)
return out
def sample_negative(triple_list,n=1):
np.random.shuffle(triple_list)
t_pos = np.array(... | true |
87a4b3dbe9affecf0c8ddd40cd0b2157ec41ea16 | Python | layal20-meet/meet2018y1mini-proj | /meet-coding/fun1.py | UTF-8 | 163 | 3.3125 | 3 | [
"MIT"
] | permissive |
def add_number(start, end):
c=0
for number in range(start,end):
c=c+number
return c
test1 = add_number(333,777)
print(test1)
| true |
68054048094199e2f2900fc3b7a45266080c1806 | Python | AiZhanghan/Leetcode | /code/131. 分割回文串.py | UTF-8 | 2,131 | 3.546875 | 4 | [] | no_license | class Solution:
def partition(self, s):
"""
Args:
s: str
Return:
list[list[str]]
"""
self.res = []
self.is_palindrome = [[False for _ in range(len(s))]
for _ in range(len(s))]
for right in range(len(s)):
... | true |
160faf8a9c09cd2fd28aea80ca98d4240131da91 | Python | shivamkaushik12007/practice | /leetCode/levelOrderBottom.py | UTF-8 | 1,282 | 3.15625 | 3 | [] | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def levelOrderBottom(self, root: TreeNode) -> List[List[int]]:
if(root==None):
return []... | true |
daf11c657ade697dda6b038386fa5b0b21b9b2c3 | Python | djangoat/django-swissarmy | /swissarmy/mixins/models/uuid_model.py | UTF-8 | 1,413 | 2.84375 | 3 | [
"MIT"
] | permissive | import uuid
from hashids import Hashids
from django.conf import settings
from django.db import models
class UidModelMixin(models.Model):
"""Unique ID type properties for a Django model.
uuid is a concrete model field (i.e. it's stored in the DB) using uuid4.
uid a concrete model field based a (numerica... | true |
98cbd1a759b1315f932a409277e210d53bc0607a | Python | TarangKhanna/AutoEssayGrader | /webapp/upload_essay_folder_form.py | UTF-8 | 1,660 | 2.8125 | 3 | [] | no_license | from django import forms
from django.core.exceptions import ValidationError
import os
MAX_ESSAYS = 20
class UploadEssayFolderForm(forms.Form):
title = forms.CharField(label="Essay Prompt: ",max_length=50, required=True,widget=forms.TextInput(attrs={'class':'form-control','placeholder':'Essay Prompt'}))
save_... | true |
de2125c7ac2d4b0c929d438261e65cae50a5bc23 | Python | osanseviero/allennlp | /allennlp/common/det_hash.py | UTF-8 | 1,987 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | import hashlib
import io
from typing import Any
import base58
import dill
class CustomDetHash:
def det_hash_object(self) -> Any:
"""
By default, `det_hash()` pickles an object, and returns the hash of the pickled
representation. Sometimes you want to take control over what goes into
... | true |
4f39692b6838b4c45398eff81b72fab4a3321002 | Python | leemingeer/designmode | /template.py | UTF-8 | 1,356 | 3.75 | 4 | [] | no_license | #!/usr/bin/env
#encoding=utf-8
#模版方法模式
#ref:https://www.cnblogs.com/Xjng/p/4029522.html
__author__ = 'kevinlu1010@qq.com'
#模版方法模式的宗旨就是,所有重复的东西,即需要写两次以上的东西都放在一个模版里面(可以是父类,也可以是一个函数)
#this is a template, the difference of different guy is released in child class
class Student():
def answer1(self):
print '题目1:... | true |
86095590e0e82e277cee99d5d9d3abc0e9e02899 | Python | LeopoldTal/mpdl-py | /mpdl/mpdl_instruction.py | UTF-8 | 3,100 | 3.09375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .rectangles import BlankRectangle, PaintingRectangle
class TracingContext:
def __init__(self, line_number, col_number, source = ''):
self.line_number = line_number
self.col_number = col_number
self.source = source
def __str__(self):
return 'at line %d, c... | true |
0e96e361caec93a6879ab1762bff72959c58e504 | Python | BryanPachas-lpsr/class-samples | /calculateDonuts.py | UTF-8 | 151 | 2.890625 | 3 | [] | no_license | import sys
donuts = 11
people = 40
print(Our party has "people" people and "donuts" donuts.
Each person at the party gets "people/donuts" donuts.)
| true |
054a24d3fcca5248337d06214165a3340c6e8fdf | Python | AdamZhouSE/pythonHomework | /Code/CodeRecords/2740/60672/277373.py | UTF-8 | 129 | 2.890625 | 3 | [] | no_license | ar=input()
print(ar)
maxx=24*60
br=[0]*len(ar)
for i in range(len(ar)):
a=ar[i]
br[i]=int(a[:2])*60+int(a[-2:])
print(br) | true |
4abf2379f0fb6fb8306ee8d48e863ee634bf806a | Python | martinleeq/python-100 | /day-01/question-009.py | UTF-8 | 280 | 3.984375 | 4 | [] | no_license | """
问题9: 从控制台输入多行语句,将每行语句的字母变成大些然后输出
"""
sentences = []
while True:
sentence = input()
if sentence:
sentences.append(sentence.upper())
else:
break
for sentence in sentences:
print(sentence)
| true |
568c6336668e5910ad27d091aa8238ddd199063f | Python | pcostam/exploratory | /tutoriais/test_func_static.py | UTF-8 | 380 | 2.953125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 18:02:33 2020
@author: anama
"""
def finess():
print("hello world")
class Apple(object):
my_func = finess
@classmethod
def get_func(cls):
return Apple.my_func
@classmethod
def do_stuff(cls):
my_func = Apple.get_... | true |
8c374683183e5fea4a2a91995b5b65a941809506 | Python | radicalparty/BOJ-Solved-problem | /Silver 4/boj_1620.py | UTF-8 | 799 | 3.71875 | 4 | [] | no_license | #python의 딕셔너리를 두개 만들어서 푼 문제
#만약 i번째에 j라는 문자열이 들어오면 dict1[i] = j, dict2[j] = i 이런 식으로 품
#입력이 문자열과 숫자가 동시에 들어오는, 즉 입력을 알 수 없는 상황이 나오기 때문에 try - except문을 사용해 해결(type(string)으로는 문자열 <-> 숫자간 구별 불가)
import sys
n, m = map(int, sys.stdin.readline().split())
dictionary1 = {}
dictionary2 = {}
for i in range(1, n + 1):
... | true |
8954c665a41d7549af8832cf0e602abb476b6e59 | Python | selvaje/YaleRep | /Python_code/spatial/openRaster.py | UTF-8 | 1,865 | 2.984375 | 3 | [] | no_license | #-------------------------------------------------------------------------------
# Name: openRaster.py
# Purpose: A function for opening a raster image using the GDAL library
#
# Author: Mao-Ning Tuanmu
#
# Created: 05/04/2012
# Copyright: (c) Mao-Ning Tuanmu 2012
# Licence: <your lice... | true |
8d10c21334f5fe1a7cbd3a06d8ec0817260538e0 | Python | aishgupta/Quantifying-Humor-Offensiveness | /datasets.py | UTF-8 | 3,725 | 2.6875 | 3 | [] | no_license | # *****************************************
#
# Customised dataset class for
# SemEval 2021 Task 7: Hahackathon
#
# ****************************************
import numpy as np
import pandas as pd
import torch
from transformers import AutoTokenizer, BertTokenizer, RobertaTokenizer, DebertaTokenizer
im... | true |
f79d4af8909bdf9adca2c918ee27319ff29d1bc9 | Python | Nach95/Python | /tarea2.py | UTF-8 | 2,254 | 4.1875 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#UNAM-Becarios
#Leal Gonzalez Ignacio Creacion de un password
# Importamos modulos para obtener letras del abecedario mayusculas y minusculas para generar letras
#aleatorias asi como numeros
from string import letters
from random import choice, randint
# Cadena donde se alm... | true |
3c81ef87e25f7c4e240939c6b6777f4d131b3c1e | Python | jtpils/labeler | /labeler/dataset.py | UTF-8 | 3,023 | 2.765625 | 3 | [] | no_license | import hashlib
import os
from skimage.io import imsave
import numpy as np
import yaml
def md5(sample):
name = hashlib.md5(sample.flatten()).hexdigest()
return name
def touch(fname, times=None):
os.utime(fname, times)
class Sample(object):
def __init__(self, dataset, name, data=None, meta={}):
... | true |
1c939211c33c853ce2b09835670685978fa18fc7 | Python | sriks8019/DB_Coding_Practice | /DB5_Add_Binary.py | UTF-8 | 1,251 | 3.359375 | 3 | [] | no_license | '''
"100" + "1", return "101"
"11" + "1", return "100"
"1" + "0", return "1"
'''
def add_binary(a,b):
def add_bits(a, b, carry):
s=""
if a =='1' and b=='1':
s+="0" if carry=="0" else "1"
carry="1"
elif a=='1' or b=='1':
if carry=="0":
... | true |
ba2ddf095e0878ffe69cc2641eafecd5c98c513e | Python | hermetico/ml-bio | /project-3/models/mx.py | UTF-8 | 7,726 | 2.953125 | 3 | [] | no_license | from viterbi import Viterbi
def train(hmm, data, number_of_aminoacids):
# The idea could be define a variable number of aminoacids for
# the extrems of the helice, the default value could be 1, and
# test how it works
# modifying the core core could be a little trickier, but not modifying
# the e... | true |
65cd98ff78b97a93bd66b4b391c5097df1a5e0d5 | Python | Aasthaengg/IBMdataset | /Python_codes/p02408/s201412244.py | UTF-8 | 302 | 3.109375 | 3 | [] | no_license | n = int(raw_input())
C = {'S':range(13), 'H':range(13), 'C':range(13), 'D':range(13)}
for i in range(n):
suit, num = raw_input().split()
num = int(num)
C[suit][num-1] = 14
for i in ['S', 'H', 'C', 'D']:
for j in range(13):
if C[i][j] != 14:
print "%s %d" %(i, j+1) | true |
a579885da9c8a255a90fedf4a6e64c107c4538ea | Python | sanjanaagarw/Machine-Learning | /Assignment4/a3barebones/dataloader.py | UTF-8 | 2,463 | 2.71875 | 3 | [] | no_license | from __future__ import division # floating point division
import numpy as np
def load_occupancy_dataset(trainsize=500, testsize=1000):
""" A KC Housing dataset """
filename = 'datasets/numericsequence.csv'
dataset = loadcsv(filename)
trainset, testset = splitdataset(dataset, trainsize, testsize)
... | true |
740f7069947b9aefeea977a04d54a019ee8fc4d5 | Python | alexandor91/Data-Generation-Tool | /create_viewpoints.py | UTF-8 | 1,437 | 3.421875 | 3 | [
"MIT"
] | permissive | # This script is to create 20 viewpoints (vertices of a regular dodecahedron) around shapes.
import math
if __name__ == '__main__':
phi = (1 + math.sqrt(5)) / 2. # golden_ratio
circumradius = math.sqrt(3)
distance = circumradius*1.2
dodecahedron = [
[-1, -1, -1],
... | true |
07601a3d6a6cd17d2f5bafb5bfbadf1da75f5743 | Python | anhmt90/social-computing-ss20 | /exercise01/solver1.py | UTF-8 | 2,788 | 3.140625 | 3 | [] | no_license | import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
def solve_a():
indexNames = df_epchar[df_epchar.episode_id > HIGHEST_EPISODE].index
df_epchar.drop(indexNames, inplace=True)
def solve_b():
global df_merged
df_merged = df_epchar.merge(df_nodes, how='inner', left_on='character... | true |
38ce9757dc93138c02cbaabacd85a72f46994cc9 | Python | giosumarin/nn_compression | /build/lib/NN_pr/activation_function.py | UTF-8 | 378 | 2.5625 | 3 | [] | no_license | import numpy as np
def ReLU(x, derivate=False):
if not derivate:
return x * (x > 0)
else:
return 1. * (x > 0)
def sigmoid(x, derivate=False):
if not derivate:
return 1 / (1 + np.exp(-x))
else:
return x * (1-x)
def id(x, derivate=False):
if not derivate:
... | true |
49e1b5ea600fffdc0c8727573796ff809bf09662 | Python | goodlucky-Joy/Python_TicTacToe | /01_Python/40_dictionary_for.py | UTF-8 | 292 | 3.328125 | 3 | [] | no_license | phone_num = {'Emily':'010-234-5678',
'Eric':'010-345-6789',
'Ellie':'010-456-7890'
}
for name in phone_num:
print(name)
for item in phone_num.items():
print(item)
for name, num in phone_num.items():
print(name+":"+num)
| true |
a1faf91a4195a8b220ec3e514e8beb432722801b | Python | makrandp/python-practice | /LeetCode/Solved/Medium/GroupThePeopleGivenTheGroupSize.py | UTF-8 | 2,348 | 4.03125 | 4 | [] | no_license | '''
1282. Group the People Given the Group Size They Belong To
There are n people whose IDs go from 0 to n - 1 and each person belongs exactly to one group. Given the array groupSizes of length n telling the group size each person belongs to, return the groups there are and the people's IDs each group includes.
You c... | true |
9a371ea957cfbe24c251324c50391c202e9003df | Python | pranavgupta1234/s3transform | /test_fakes3/create_keys_s3.py | UTF-8 | 993 | 2.515625 | 3 | [
"MIT"
] | permissive | import boto3
import os
import botocore
import random
import uuid
from tqdm import tqdm
from io import StringIO
COMMAND_FAKE_S3 = 'fakes3 -r fakes3/fake_s3_root -p 4567 --license xxx'
def create_files_and_upload(no_of_files, bucket_name, s3_client):
random_text = 'Manor we shall merit by chief wound no or woul... | true |
79b72f0095b6e9bc3c606182f3ed1e666a21f24b | Python | fernandamsouza/UDESC-Pandemic-Edition | /TEG/Trabalho 1 - V.Final - Graphviz/grafo.py | UTF-8 | 1,367 | 3.3125 | 3 | [] | no_license | # Arquivo para gerar o grafo normal e dfs, bem como suas ligações
from graphviz import Graph
dot = Graph(comment='TEG')
dotfs = Graph(comment='DFS')
dfs = open('arquivo.txt')
entrada = open('out.txt')
def grafoNormal():
vizinhos = []
for linha in entrada:
dot.node(str(linha[0]))
linha = lin... | true |
a62df4fca488dc338af861020838917acd51164d | Python | ChiayenGu/deeperlib | /deeperlib/data_processing/hidden_data.py | UTF-8 | 5,603 | 2.796875 | 3 | [] | no_license | import pickle
import os
from data_process import alphnum, wordset, getElement
from json2csv import Json2csv
class HiddenData:
"""
A HiddenData object would keep the data crawled from api in json format in a dict. It provides you
with some methods to manipulate the data, such as, defining your own way to p... | true |
ec763cfb9cc5e68b9b0ed75de4263fe205cb5fee | Python | YKarthikeyan/DataStructures-Python | /Graph/dijikstras_shortestPath.py | UTF-8 | 1,527 | 3.4375 | 3 | [] | no_license | import sys
sys.path.insert(1,'./')
from graph import Graph
from PriorityQueue.priorityQueue import PriorityQueue
def shortest_path(graph, sourceVertex):
minHeap = PriorityQueue(True)
distance = {}
parent = {}
for vertex in graph.vertices.values():
minHeap.add_task(sys.maxsize, vertex)
min... | true |
cf32e34257b82a7aa2fec41bc4b6c8f893614706 | Python | Dan-Vizor/MEGA-transfer | /MT-client.py | UTF-8 | 1,824 | 2.71875 | 3 | [] | no_license | #!/usr/bin/python3
__version__ = 0.1
import json, os, random
def error(ErrorMessage):
print("Error: " + ErrorMessage)
raise SystemExit
def ReadJSON(File):
try:
# from https://stackoverflow.com/questions/20199126/reading-json-from-a-file
with open(File) as f:
return json.load(f)
except IOError:
error("un... | true |
feb8c2b3551a260dedffc2a1396e0b72f09713bc | Python | zhudotexe/aoc_2019 | /14/1.py | UTF-8 | 1,783 | 3.25 | 3 | [
"MIT"
] | permissive | import collections
class Dependency:
def __init__(self, chemical, number):
self.chemical = chemical
self.number = number
@classmethod
def parse(cls, s):
num, chem = s.split(' ')
return cls(chem, int(num))
def __str__(self):
return f"{self.number} {self.chemica... | true |
5b1eafc38ea00f1704f11b2c2c19e984cf37a373 | Python | Gabbu98/deeplearningtutorial | /tensorflow_v1/06_-_Convolutional_neural_networks/01_-_Convolutional_layers_1D.py | UTF-8 | 1,288 | 3.15625 | 3 | [
"MIT"
] | permissive | import numpy as np
import tensorflow as tf
window_width = 2 #The size of the window sliding over the inputs
stride = 1 #The step size to move the window as it's sliding
in_vec_size = 2 #The vector sizes in the inputs
out_vec_size = 3 #The transformed vector sizes in the outputs
padding = 'VALID' #Whether to automatica... | true |
fd0cbd09d39aeab07a29369d89373252af67d7fb | Python | MatenRehimi/University | /Year 4/Dissertation (Python)/Predict stocks prices using neural netwoks/YahooCollector.py | UTF-8 | 2,052 | 2.796875 | 3 | [] | no_license | import datetime as dt
import pandas_datareader.data as web
import pandas as pd
import os.path
import csv
class YahooCollector:
def __init__(self,start,end):
self.collectSP500(start,end);
self.csvFiles = self.collectFeatureVectorWithoutIndividualStocks(start,end);
def collectFeatureVectorWithou... | true |
55b889b3c96e4d774920b3cfb72bf8a1941f6279 | Python | hasanino/PyPDF4 | /scripts/pdf-image-extractor.py | UTF-8 | 2,376 | 2.84375 | 3 | [
"BSD-3-Clause"
] | permissive | """
Extract images from PDFs without resampling or altering.
Adapted from work by Sylvain Pelissier
http://stackoverflow.com/questions/2693820/extract-images-from-pdf-without-resampling-in-python
"""
from __future__ import print_function
import os
import sys
from PIL import Image
from os.path import abspath, dirname... | true |
7a00d6a33506a0aaa0c20ed6d5b06be1be07af65 | Python | barsKii/Python_Development | /00_Function_Beginnings/06_concat_files.py | UTF-8 | 376 | 3.03125 | 3 | [] | no_license | import datetime
def write_to_file(read, write):
read_file = open(read, "r")
content = read_file.read()
write.write(content + "\n")
read_file.close()
date = datetime.datetime.now()
file = open(date.strftime("%Y-%m-%d-%H-%M-%S-%f") + ".txt", "w")
write_to_file("file1.txt", file)
write_to_file("file2.tx... | true |
7c8a20c922d7c38d7fc68dd0bc828888a4366595 | Python | DanielMDouglas/FE_ASIC_pulse_scanner | /scan.py | UTF-8 | 2,453 | 2.75 | 3 | [] | no_license | import curses as crs
import numpy as np
from time import sleep
import os
import subprocess
stdscr = crs.initscr()
crs.noecho()
crs.cbreak()
stdscr.keypad(1)
stdscr.nodelay(1)
crs.curs_set(0)
maxHeight, maxWidth = stdscr.getmaxyx()
# edit these!
# they should point to the executable itself,
# not including arguments
... | true |
df9da4fefa9be95a119703b4c199ad85fd17e3c1 | Python | marciogomesfilho/Codes | /ex48.py | UTF-8 | 332 | 4.0625 | 4 | [] | no_license | #Exercício Python 048:
# Faça um programa que calcule a soma entre todos os números que são múltiplos de três e que se encontram no intervalo de 1 até 500.
soma = 0
conta = 0
for c in range(1,501,2):
if c % 3 == 0:
soma += c
conta += 1
print ('a contagem dos {} valores deu {}'.format(conta,s... | true |
302ff2d6051a546ad4c6a82c8a8b8e0aee5b83e4 | Python | heqiang1992/project | /he/dota2/time_caution_script.py | UTF-8 | 1,222 | 2.828125 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import datetime
import win32com.client
import pyttsx3
mession = {"1": "五分钟快到了", "2": "10分钟快到了", "3": "15分钟快到了"}
pre_warning_set = 30 # unit :second
class TIMER():
def __init__(self):
self.read_mession()
# self.speaker=win32com.client.... | true |
100d9427a30546ce97ddec72a539bef242bd7d9c | Python | ydyoon2/ydyoon2-IE598_F18_HW7 | /IE598_F18_HW7_Yoon.py | UTF-8 | 4,461 | 3 | 3 | [] | no_license | import sys
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestClassifier
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
import numpy as np
from sklearn.model_selection im... | true |
4736c8b376453c9a36073c165c62f5f454efcdab | Python | DavidMarquezF/InfoQuadri2 | /Practica 7/Search.py | UTF-8 | 2,051 | 3.28125 | 3 | [] | no_license | import random,Eines, MergeSort
def cercaBruta(l,n):
for e in l:
if e==n:
return True
return False
def cercaBinaria(llista,element):#la llista ha d'estar ordenada previament
primer=0
final=len(llista)
trobat=False
while primer<final and not trobat:
index=(primer+fina... | true |
aea89a81d4076178a1cc454aeb6ec0c0cafe149d | Python | henk2525/speech-recognition-on-raspberrypi4 | /pc(train)/train.py | UTF-8 | 10,873 | 2.53125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Created at 2019/12/8
@author: henk guo
tensorboard --logdir=logs/fit --port 8088 --host localhost
https://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_annotated_heatmap.html#sphx-glr-gallery-images-contours-and-fields-image-annotated-heatmap-py
"""
import tensorflow as tf... | true |
192bfc7adeb2d55c013a8f5d146d9987ed50f339 | Python | Beanpen/Library-System | /main.py | UTF-8 | 6,606 | 3.6875 | 4 | [] | no_license | # displayMenu:
# displays a menu with options
# DO NOT MODIFY THIS FUNCTION
import Library as Library
if __name__ == "__main__":
def display_menu():
print("Select a numerical option:")
print("======Main Menu=====")
print("1. Read book file")
print("2. Read user file")
print... | true |
73b61c0673965799aaa9728b709349d73cdebfe5 | Python | Xitog/tallentaa | /python/pygame/Basic_Imperative.py | UTF-8 | 571 | 3.140625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# Import
import pygame
from pygame.locals import *
# Init
pygame.init()
pygame.display.set_caption('Basic PyGame')
resolution = (800,600)
flags = pygame.DOUBLEBUF
screen = pygame.display.set_mode(resolution, flags, 32)
escape = False
clock = pygame.time.Clock()
# Main loop
while not escape:... | true |
7f1956e0669291e0fd94e629c3f925a879016dc0 | Python | imsure/tech-interview-prep | /foobar3_jerry/re_ID/solution.py | UTF-8 | 494 | 3.640625 | 4 | [] | no_license | import math
def is_prime(p):
for i in range(2, int(math.sqrt(p)) + 1):
if p % i == 0:
return False
return True
def answer(n):
prime_str = ''
p = 2
while True:
if len(prime_str) > n + 4:
return prime_str[n:n+5]
if is_prime(p):
prime_str ... | true |
05f2b9dfb19aa9bfa4ff77a17f766b987e70711c | Python | SerenaW1991/ItemSearching | /useTensorFlow/funcs/func_getColorRatio.py | UTF-8 | 346 | 2.609375 | 3 | [] | no_license | import numpy
def func_getColorRatio(imageArray, startx, endx, starty, endy):
B,G,R = 0.0, 0.0, 0.0
for x in range(startx, endx):
for y in range(starty, endy):
curB, curG, curR = imageArray[y][x]
B += curB
G += curG
R += curR
allArea = B+G+R
if(allArea == 0):
return [0,0,0]
else:
return [B/allAre... | true |
bf0c8699ce3dc6306928c8796961391c204447e5 | Python | kakirastern/regions | /regions/io/ds9/read.py | UTF-8 | 19,241 | 2.90625 | 3 | [] | permissive | # Licensed under a 3-clause BSD style license - see LICENSE.rst
import string
import itertools
import re
import copy
from warnings import warn
from astropy import units as u
from astropy import coordinates
from astropy import log
from ..core import reg_mapping
from ..core import Shape, ShapeList
from .core import DS9... | true |
bf4242d80cb5b5f015dd2f57652f3d121a140616 | Python | marlinspike/lobe-python | /src/lobe/ImageModel.py | UTF-8 | 1,473 | 2.671875 | 3 | [
"MIT"
] | permissive | """
Load a Lobe saved model
"""
from __future__ import annotations
import os
import json
from PIL import Image
from typing import Tuple
from ._results import PredictionResult
from ._model import Model
from . import Signature
from . import image_utils
def load_from_signature(signature: Signature) -> ImageModel:
# ... | true |
f41b65309c600ef3080f9b97c6b06582632a7f52 | Python | MeliPax/News_scrapping_App | /news_scrapping/news_scrapping/spiders/spidernews.py | UTF-8 | 778 | 2.53125 | 3 | [] | no_license | import scrapy
from ..items import NewsMiningItem
class NbcSpider(scrapy.Spider):
name = 'news_crawler'
start_urls = ['https://abcnews.go.com/Entertainment']
def parse(self, response, **kwargs):
items = NewsMiningItem()
link = response.css('.ContentRoll__Headline h2 a::attr(hre... | true |
87ef5c2726096b3c4ef6a3019ebd7f09d21a8079 | Python | sarahgerrity/workshops | /python_objects/pokemon/pokemon_types/water_type.py | UTF-8 | 324 | 2.671875 | 3 | [] | no_license | from python_objects.attacks.water_gun import WaterGun
from python_objects.pokemon.pokemon_types.pokemon import Pokemon
class WaterType(Pokemon):
def __init__(self, pokemon, hp, pokedex_description=None):
super().__init__(hp, pokedex_description=pokedex_description)
self.water_gun = WaterGun(pokem... | true |
920345b84a5a55ad09027d60239934c8958a628e | Python | infer-actively/pymdp | /test/test_control.py | UTF-8 | 51,381 | 2.515625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit Tests
__author__: Conor Heins, Alexander Tschantz, Daphne Demekas, Brennan Klein
"""
import os
import unittest
import numpy as np
from pymdp import utils, maths
from pymdp import control
class TestControl(unittest.TestCase):
def test_get_expected_states(s... | true |
13431cbd7a4d57873f3c93ef6111f2007ab36674 | Python | Brisselada/Modelling-and-Simulation | /run_simulation/test_different_grids.py | UTF-8 | 2,056 | 2.890625 | 3 | [] | no_license | from matplotlib.pyplot import figure, show
import numpy as np
import os,sys
from simulation import simulation
sys.path.append("..")
from generate_network.generate_network import makegrid
if __name__ == '__main__':
all_mean_speeds = []
all_mean_times = []
# Doesn't work for less than 3
for i in [3,4,5,6... | true |
f43f53b1c2ad577714944df6a37c2a1c86b896e1 | Python | richardzhao2/EPM-Dashboard | /Submission/Code/Models/shot_quality_regressor.py | UTF-8 | 2,577 | 2.859375 | 3 | [] | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPRegressor
print("Loading in Data...")
shotFile1 = "Basketball Data/NBAPlayerTrackingData_2014-17/2015-16_nba_shot_log.csv"
shot1_df = pd.read_csv(shotFile1... | true |
fc49e2149e949dd8edbe796ff167e3f2581ffafe | Python | laomobk/IdiomSolitaireGame | /referee.py | UTF-8 | 1,110 | 2.8125 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
import random
from pypinyin import lazy_pinyin
class Referee:
__URL_SEARCH = 'http://www.chengyujielong.com.cn/search/%s'
def __init__(self):
self.__topic = None
def check_answer(self, ans :str, topic :str):
if len(ans) == 4:
retu... | true |
3524aa6c87bf6b173f20a86717f6b10e3c90fd82 | Python | ThiaguinhoLS/Python | /abstractfactory_one.py | UTF-8 | 1,955 | 3.78125 | 4 | [] | no_license | # -*- coding: utf-8 -*-
class Mago(object):
def __init__(self, nome):
self.nome = nome
def method(self, vilao):
print('{0} encontrou um {1} e {2} !'.format(self, vilao, vilao.acao()))
def __str__(self):
return self.nome
class Ogro(object):
def __str__(self):
return... | true |
837dece3452c37a9eab4e30c610858e5b543390c | Python | ShazeRx/python-EV3 | /sensor_data.py | UTF-8 | 311 | 2.8125 | 3 | [] | no_license | import ev3dev.ev3 as ev3
from threading import Thread
from time import sleep
color_left=ev3.ColorSensor('in2')
color_right=ev3.ColorSensor('in4')
color_left.mode="COL-COLOR"
color_right.mode="COL-COLOR"
while True:
print('Left',color_left.value())
print('Right',color_right.value())
sleep(2) | true |
4b68a139414c3ff88cadb2c982039f9a453afc2c | Python | LucianaRepetto/pythonbootcamp | /37filter.py | UTF-8 | 968 | 3.140625 | 3 | [] | no_license | users = [
{"username": "samuel", "tweets": ["I love cake", "I love pie", "hello world!"]},
{"username": "katie", "tweets": ["I love my cat"]},
{"username": "jeff", "tweets": []},
{"username": "bob123", "tweets": []},
{"username": "doggo_luvr", "tweets": ["dogs are the best", "I'm hungry"]},
{"username": "guitar_g... | true |
2ab3b3720f34f67a7c0560f35f8e7e49d316473d | Python | MEFM/Compi1 | /Hojas.py | UTF-8 | 364 | 2.984375 | 3 | [] | no_license |
lista = []
def addHoja(nodo):
global lista
lista.append(nodo)
#END
def getHoja(numHoja):
global lista
for h in lista:
if h.num == numHoja:
return h
return None
#END
def aceptacion(numHoja):
global lista
for h in lista:
if h.num == numHoja:
... | true |
3e927d8acebbec72d5806bd8006ca51ad3dafe69 | Python | MichalKapala/Bitcoin-Analyser | /Analysers/analyser.py | UTF-8 | 1,331 | 2.9375 | 3 | [] | no_license | from Analysers.stock import Stock
from Analysers.indicators import TechnicalIndicators
from Scraper.scraper import Headers
simple_chart_indicators = ["Moving_average"]
class Analyser:
updating = False
def __init__(self, company, ticker):
self.company = company
self.ticker = ticker
sel... | true |
61d22e21a9779128d91f9ce46b14aa12d2d45a16 | Python | kartikay-43/feature_matching_opencv | /feature_matching.py | UTF-8 | 1,009 | 2.671875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 28 04:07:46 2019
@author: kartikay
"""
import cv2
import matplotlib.pyplot as plt
import numpy as np
img1 = cv2.imread("matching-template.jpg")
img2 =cv2.imread("matchimg.jpg")
orb = cv2.ORB_create(nfeatures=1500)
kp1, des1 = orb.detectAndCompute(img1,... | true |
fb5f7f0b66e4e0744e211a78d04c6112f092d542 | Python | jianminchen/LeetCode-IIII | /312. Burst Balloons.py | UTF-8 | 646 | 3.015625 | 3 | [] | no_license | # timeout
class Solution(object):
def maxCoins(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
return self.DFS(nums)
def DFS(self, nums):
if len(nums) == 1:
return nums[0]
res = 0
for i in xrange(len(nums)):
... | true |