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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35dc435fc1b234f6af9bc2a3ac3df27ef6bb9ed7 | Python | djohnston42/Overthewire | /Natas6.py | UTF-8 | 1,501 | 2.609375 | 3 | [] | no_license | # webscraper for natas6
import requests
from bs4 import BeautifulSoup
username = 'natas6'
password = 'aGoY4q2Dc6MgDq4oL4YtoKtyAg9PeHa1'
url = 'http://%s.natas.labs.overthewire.org/' % username
proxies = {
'http': 'http://127.0.0.1:6996',
'https': 'http://127.0.0.1:6996',
}
def initialRequest():
session = ... | true |
bd56a87169c6d2189e898a8438edd48669589b8f | Python | gitificial/BT | /Kapitel_4.5/trained/plot.py | UTF-8 | 1,936 | 2.796875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
train_sizes = [100, 250, 500, 750, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000]
train_scores = [[0.612500, 0.725000, 0.587500], [0.705000, 0.780000, 0.680000], [0.792500, 0.825000, 0.810000], [0.806667, 0.865000, 0.816667], [0.827500, 0.813750, 0.8137... | true |
17f656b37a57203658bda5f91743b7faf1a3819c | Python | EtienneCmb/tensorpac | /examples/misc/plot_fmin_fmax_optmization.py | UTF-8 | 1,202 | 2.96875 | 3 | [
"BSD-3-Clause"
] | permissive | """
==========================
Find the optimal bandwidth
==========================
Instead of looking for phase and amplitude frequency pairs (as in a
comodulogram) this example illustrate how it is possible to find starting,
ending and therefore, bandwidth coupling.
"""
from tensorpac import Pac
from tensorpac.sign... | true |
8a2c64fa0cd7b8a6ec943426d5374f72f274bef3 | Python | ShiNik/wiki_ml | /src/my_package/visualizer.py | UTF-8 | 11,681 | 2.71875 | 3 | [
"MIT"
] | permissive | # user define imports
from my_package import TableIt as TableIt
from my_package import util as util
from my_package.log_manager import LogManager
import sklearn.metrics as metrics
# python imports
import numpy as np
import matplotlib.pyplot as plt
import seaborn as seabornInstance
import pylab
import scipy.stats as st... | true |
7b12f8fab92de7782b3b718c9209c1cdcc5b6e96 | Python | limianscfox/Python_learn | /Python_Crash_Cours_2rd/7/7.2/test_7_4_1.py | UTF-8 | 250 | 3.875 | 4 | [] | no_license | prompt = "\nPlease enter Pizzas's filling:"
prompt += "\n(Enter 'quit' when you are finished.)"
acitve = True
while acitve:
ingredient = input(prompt).lower()
if ingredient != 'quit':
print(ingredient)
else:
acitve = False | true |
9246716a795191ec8a485341b7df52bfa74b9292 | Python | ShowLo/LeetCode_code | /python/problem75.py | UTF-8 | 616 | 2.890625 | 3 | [] | no_license | class Solution(object):
def sortColors(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
num0 = 0
num1 = 0
num2 = 0
for num in nums:
if num == 0:
num0 += 1
... | true |
44141037a91da12280eecf777e50f51a1c151b74 | Python | yuuurchyk/Bees-Algorithm-Functional-Optimization | /NeighbourCoordinateFabric.py | UTF-8 | 2,430 | 3.828125 | 4 | [] | no_license | from random import random
from Coordinate import Coordinate
from math import pi, sin, cos
class NeighbourCoordinateFabric:
"""
This class represents a Fabric of neighbours of some coordinate
(z coordinate is not counted)
it returns random coordinates that are not further than
described in ... | true |
e1599365ceaee6b5cd68fe5d7cef169b0be7477c | Python | Lightupdown/sina-wiebo-spiders | /get_agency_ip.py | UTF-8 | 6,726 | 2.640625 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
__title__ = ''
__author__ = 'zhang'
__mtime__ = '2017/11/2'
┏┓ ┏┓
┏┛┻━━━┛┻┓
┃ ☃ ┃
┃ ┳┛ ┗┳ ┃
┃ ┻ ┃
┗━┓ ┏━┛
┃ ┗━━━┓
┃ 神兽保佑 ... | true |
5f4d5dd612f1fc4ee12cbcb7cddfc7c4e6e8c4c8 | Python | Sergiodiaz53/tensorflow-layer-library | /TeLL/scripts/dropoutmask.py | UTF-8 | 6,754 | 2.6875 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | # -*- coding: utf-8 -*-
"""
© Michael Widrich, Markus Hofmarcher, 2017
Functions for dropout masks
"""
import tensorflow as tf
import numpy as np
import os
import argparse
from PIL import Image
from TeLL.utility.timer import Timer
import logging
def make_ising_mask(shape, keep_prob, num_steps, beta, beta_step=1.01... | true |
5ff13f11ba4394597180c5675fd468139ab5b8be | Python | jdarangop/holbertonschool-machine_learning | /math/0x02-calculus/17-integrate.py | UTF-8 | 881 | 3.5 | 4 | [] | no_license | #!/usr/bin/env python3
""" Integrate """
def poly_integral(poly, C=0):
""" Find the integrate of a polynomial
poly: list with the coeficients of the polinomial
C: int constant of integration
Return: list with the coeficients after the integration
"""
# if C is None or type(C) not i... | true |
37c9b7da7356dd5a560e5461bfa1fdde843497ef | Python | cgarrido2412/PythonPublic | /NetOps/Pandas/utilization_lab.py | UTF-8 | 1,083 | 2.875 | 3 | [] | no_license | import pandas as pd
from datetime import date
today = date.today()
d2 = today.strftime("%B %d, %Y")
def file_test(file):
try:
open(file)
except:
print('Unable to open:', file)
exit()
file1 = input('Enter file path: \n')
file_test(file1)
file2 = input('Enter secon... | true |
ee25a478b37043481bb30d2de77e294e26bc2ace | Python | insanesac/Auto-Annotator-Validator | /east_visualize.py | UTF-8 | 4,687 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 8 12:28:14 2019
@author: insanesac
"""
import csv, os, cv2
import numpy as np
import shutil, random
report_path = 'east_report.txt'
invalid = []
wrong = []
dest1 = os.path.join(os.getcwd(),'invalid')
dest2 = os.path.join(os.getcwd(),'wrong')
def... | true |
95f4b99b6881a46d61ad6ac671e101869a22764f | Python | linh-amped/InputIBA | /iba/datasets/utils.py | UTF-8 | 2,518 | 2.65625 | 3 | [
"MIT"
] | permissive | from xml.etree import ElementTree as ET
import numpy as np
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataloader import default_collate
def load_voc_bboxes(xml_file, name_to_ind_dict, ignore_difficult=False):
"""Load bounding box annotations from an xml file.
Args:
xml_file (st... | true |
c3a291667c164224a3fdbc3a85037728eb1b97ad | Python | IamShyam/sattrack | /servo_interface.py | UTF-8 | 958 | 3.375 | 3 | [] | no_license | import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
class ServoMotor():
def __init__(self,channel, frequency):
GPIO.setup(channel, GPIO.OUT)
self.pwm = GPIO.PWM(channel, frequency)
self.pwm.start(5)
print "Servo Initialised"
def update_servo_position(self, angle):
# ... | true |
c8fd744ed242a9cae5c35beadea47aeb78a34749 | Python | anamika1496/gaflaskapi | /codes/cappApi.py | UTF-8 | 1,473 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import flask
import json
from nltk import word_tokenize
import pandas as pd
from flask import Flask, request
app = Flask(__name__)
class WordPreprocess:
def __init__(self):
self.num_of_words = 2
def top_words(se... | true |
3fbc28bfb1a5816fcd8f2d63f477b889d6f7e59e | Python | apiwatc/coding-challenges | /min_set.py | UTF-8 | 1,144 | 4.3125 | 4 | [] | no_license | """
Given an array arr. You can choose a set of integers and remove all the occurrences of these integers in the array.
Return the minimum size of the set so that at least half of the integers of the array are removed.
Example 1:
Input: arr = [3,3,3,3,5,5,5,2,2,7]
Output: 2
Explanation: Choosing {3,7} will make the ... | true |
d6740e5d4e2c84fa981d0b717a07f9f9be477841 | Python | jeffzhengye/pylearn | /pybasic/speed/cython/scipy2013-cython-tutorial-master/exercises/julia/julia.py | UTF-8 | 5,525 | 2.921875 | 3 | [
"BSD-2-Clause",
"Unlicense"
] | permissive | #-----------------------------------------------------------------------------
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved. See LICENSE.txt for details.
#
# Author: Kurt W. Smith
# Date: 26 March 2012
#-----------------------------------------------------------------------------
'''
julia.py
Compute... | true |
c676450e1cff16fd9738d1c4311529b983d2cbfc | Python | goran-mahovlic/Radiona_Donationbox | /examples/update_money.py | UTF-8 | 2,545 | 2.71875 | 3 | [] | no_license | import sqlite3
import MySQLdb
from os import sys
DonationBox_Name="D11111"
mySqlServer = ""
mySqlServerDatabase = ""
mySqlServerUser = ""
mySqlServerPassword = ""
def getMoneyForProject_local(money_project):
if sys.platform == 'win32' and sys.getwindowsversion()[0] >= 5:
print ("No log on windows")
el... | true |
3de370e3717ca077ce0bb44fc730b65fe10edaa5 | Python | lastmansleeping/ml4ir | /python/ml4ir/base/features/feature_layer.py | UTF-8 | 7,494 | 2.671875 | 3 | [
"Apache-2.0"
] | permissive | import tensorflow as tf
from ml4ir.base.features.feature_config import FeatureConfig
from ml4ir.base.config.keys import SequenceExampleTypeKey
from ml4ir.base.config.keys import TFRecordTypeKey
from ml4ir.base.features.feature_fns.sequence import bytes_sequence_to_encoding_bilstm
from ml4ir.base.features.feature_fns.s... | true |
6ef33499c25ed7821eab74f43fc21ac2d3b956a4 | Python | preller/PanGaia | /pangaia/lib_compare.py | UTF-8 | 7,376 | 2.703125 | 3 | [
"MIT"
] | permissive | """"
Dedicated Class to compare the Control Sample VS. HDBSCAN selected clusters
Héctor Cánovas May 2019 - now
"""
import numpy as np
import matplotlib.pyplot as plt
from itertools import cycle
from astropy import units as u
from astropy.table import Table
from lib_plotters import LibPlotters as Pl... | true |
df81d44c6b071b7309885dd2babde2e868dac0fb | Python | shrank/networking-scripts | /scripts/cisco_find_aps.py | UTF-8 | 2,276 | 2.78125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/python
"""
find known MAC-Adresses on cisco switches
The primary goal of this script is to find known devices(e.g. Wifi APs) in the mac-address table.
It compairs all MACs against a list of known devices and assumes that all ports with
maximum 2 known devices are edge port. Those edge-ports with the mac a... | true |
bcbacefe8121912afd7337057966fb0687f3e3f3 | Python | letsjdosth/fluentPython | /chap17/arcfour_futures.py | UTF-8 | 1,605 | 2.8125 | 3 | [] | no_license | import sys
import time
from concurrent import futures
from random import randrange
from arcfour import arcfour
JOBS=12
SIZE=2**18
KEY=b'Twas brillig, and t he slithy toves\nDid gyre'
STATUS='{} workers, elapsed time:{:.2f}s'
def arcfour_test(size,key):
in_text=bytearray(randrange(256) for i in range(size))
cypher... | true |
a0e744817471d3d0ef2706666a669a27720b87be | Python | w84death/piot | /pibot/commands.py | UTF-8 | 1,691 | 3.203125 | 3 | [
"MIT"
] | permissive | import random
class Commands:
def __init__(self):
self.cmds = {
'board': {
'cmd': 'board',
'success': 'I wrote your message one the board :)',
'failure': 'Not good. Message should be *more than {min}* but less than {max}* characters.'
}... | true |
f1443fa5d7732b26019402cd390010e0dc6ae10e | Python | bholbein/cs50-problems | /pset8/finance/application.py | UTF-8 | 9,310 | 2.53125 | 3 | [] | no_license | import os
import json
from cs50 import SQL
from datetime import datetime
from flask import Flask, flash, jsonify, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from werkzeug.exceptions import default_exceptions, HTTPException, InternalServerError
from werkze... | true |
f19983551915b2f9a1c51cac6c41756300bd4f60 | Python | akhilmuraliai/Behavioral-Cloning | /pedestrian-vehicle-detection/car-pedestrian-tracking.py | UTF-8 | 1,369 | 3.140625 | 3 | [] | no_license | # importing opencv library
import cv2
# importing image/video files
image_1 = 'test-images/road_1.jpg'
image_2 = 'test-images/road_2.jpg'
video_1 = 'test-videos/subject.mp4'
video_2 = 'test-videos/pedestrians.mp4'
# harrcascade files
car_file = 'xml/cars.xml'
pedestrian_file = 'xml/pedestrians.xml'
# creating clas... | true |
ac7d3c1a60ce5200d268f990ab1ebbbcdc23002d | Python | NicolasMellein/DataScience | /1 K-Means Clustering.py | UTF-8 | 2,209 | 3.421875 | 3 | [] | no_license | # Importing the librariesh
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
# Importing the dataset
dataset = pd.read_csv('Mall_Customers.csv')
X = dataset.iloc[:, [3,4]].va... | true |
302653dbf4482372d1bf57b44a0aa28aaa152d9d | Python | CaelTintreach/QAC_Challenge | /teamwriter.py | UTF-8 | 304 | 2.671875 | 3 | [] | no_license | file = open ("Teams.txt", "w")
file.write("M.Un" + "\n")
file.write("L.Pool" + "\n")
file.write("C.Sea" + "\n")
file.write("S.Field" + "\n")
file.write("N.Iron" + "\n")
file.close
file = open ("Teams.txt", "r")
print(file.readline())
file.readline()
file.readline()
print(file.readline())
file.close | true |
934554af8a67bde61fe3fe977e390cc9558ea260 | Python | Kangfei/SPFlow | /src/spn/experiments/RandomSPNs_layerwise/rat_spn.py | UTF-8 | 14,416 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import logging
from typing import Dict, Type
import numpy as np
import torch
from dataclasses import dataclass
from torch import nn
from spn.algorithms.layerwise.distributions import Leaf
from spn.algorithms.layerwise.layers import CrossProduct, Sum
from spn.algorithms.layerwise.type_checks import check_valid
from sp... | true |
a2d52ff6c56c5f8c874331b22ea4e6a25a1bb172 | Python | Kangjinwoojwk/algorithm | /baekjoon/10102.py | UTF-8 | 244 | 3.421875 | 3 | [] | no_license | N = int(input())
data = input()
check = [0, 0]
for i in data:
if i == 'A':
check[0] += 1
elif i == 'B':
check[1] += 1
if check[0] > check[1]:
print('A')
elif check[0] < check[1]:
print('B')
else:
print('Tie') | true |
affd8ccbd064e083280aa042e125f277fdbe802b | Python | Taaaepang/bakjoon | /2048.py | UTF-8 | 6,052 | 3.140625 | 3 | [] | no_license | import math
from collections import deque
from copy import deepcopy
size = int(input())
maps = []
for i in range(size):
maps.append(deque(list(map(int, input().split()))))
# 0 up
# 1 right
# 2 down
# 3 left
maxs = -math.inf
def moving(dir, mapd):
map_temp = deepcopy(mapd)
if dir == 3: # left
for i ... | true |
be27c0226fe8aaa13c230c178f660b1e7837b7da | Python | chrisr1896/Exercises | /intro_&_enviro/hello_world/3_type_change/Solution/solution.py | UTF-8 | 163 | 3 | 3 | [] | no_license | # Code your solution here
object_1=100.0
object_2="99"
object_change_1=str(object_1)
object_change_2=int(object_2)
print(object_change_1,object_change_2) | true |
c44de6b8bec0c4ce17ee429c0f0a2ba7355f8e8e | Python | cvanelteren/CNS | /Final assignments/Boltzmann machines/bm_end.py | UTF-8 | 4,578 | 2.78125 | 3 | [] | no_license | #from pylab import *
import numpy as np
from pylab import *
import scipy.linalg
# np.random.seed(0)
class bm(object):
def __init__(self, data, noiselevel = .4):
images, targets = data
# binarize + add noise; do this as a function of noise levels
noise = np.random.rand(images.shape[0], imag... | true |
bf3ef4f7cd6dc77972a854288cf8cded9c29044e | Python | multinverse/BINGO_OpticalDesign | /Resampling.py | UTF-8 | 1,771 | 2.796875 | 3 | [] | no_license | import numpy as np
def elipse_parameters(sub):
x0 = (np.min(sub['x'])+np.max(sub['x']))/2. #x-position of the center
y0 = (np.min(sub['y'])+np.max(sub['y']))/2. #y-position of the center
a = np.absolute(np.min(sub['x'])-np.max(sub['x']))/2.#radius on the x-axis
b = np.absolute(np.m... | true |
bfe2d287a205821b62915a66902f80f88c5b3e48 | Python | jermainedilao/TechNewsAPI | /application/handlers/api/v1/newslists.py | UTF-8 | 5,179 | 2.53125 | 3 | [] | no_license | import json
import logging
import time
from application.config import constants
from application.handlers.base import BaseHandler
from google.appengine.api import urlfetch
from google.appengine.api import memcache
class NewsListsApiHandler(BaseHandler):
def post(self):
news_api_key = self.get_arg("news_a... | true |
35a6906205caf24d72c812ec3c8079ae5c387494 | Python | redoansaleh1/Weather-App | /main.py | UTF-8 | 1,717 | 2.765625 | 3 | [] | no_license | from tkinter import *
import requests
import json
root=Tk();
root.title("Weather App");
def zipLookup():
try:
api_request = requests.get(f'https://www.airnowapi.org/aq/observation/zipCode/current/?format=application/json&zipCode={zip.get()}&distance=25&API_KEY=16D0C1E0-6E73-41A7-A9F2-EA76BDDF7A62');
... | true |
3d76c79621f98c6747b0036c316ec468d669fe6a | Python | brianmack/exercises | /exercises/3sum.py | UTF-8 | 478 | 3.140625 | 3 | [] | no_license |
import random
n=10
S = dict(enumerate(sorted(random.sample(range(-10,10), n))))
print 'algo 1:'
for i in xrange(n-3):
a = S[i]
j = i + 1
k = n - 1
while j < k:
b = S[j]
c = S[k]
if a+b+c==0:
print 'a=%i, b=%i, c=%i' % (a, b, c)
break
elif a+b+c>0:
k -= 1
else:
j += 1
print '\nalgo 2:'
a =... | true |
2ce6615e6c2567ed936c77cb26ee7ca83c511023 | Python | hilali-msc/FunPython | /CompSci-Student-Lessons/Lesson-4.5-Hacking-The-Gibson/hack_my_password.py | UTF-8 | 582 | 3.109375 | 3 | [] | no_license | import random
import time
from top_secret import computer
# Alright hackers, we need to hack into the computer.
# To do that, we need to figure out its password!
#
# To hack the computer input the following command.
#
# computer.guess_password("put what you think is the password here!")
#
#
# HINT: the computer... | true |
59cf4f099549ae4237b8d3e382717c8933d06aa1 | Python | Dur09/rt-logger | /app.py | UTF-8 | 3,635 | 2.515625 | 3 | [] | no_license | import sqlite3
from sqlite3 import Error
import json
from flask import Flask, abort,request
from flask import render_template
from flask import g
from flask import make_response
import os.path
import StringIO
import csv
import datetime
db_file = '/site/rt-logger/db/rtLogger.db'
app = Flask(__name__,template_folder='/... | true |
bce56d89ae7d52290c237098b835e8562d229a18 | Python | jeffbarnette/Python-One-Liners | /data_science/bc_sa_reshape_clean.py | UTF-8 | 376 | 3.4375 | 3 | [
"MIT"
] | permissive | """Example of Broadcasting, Slice Assignment, and Reshaping to Clean
Every i-th Array Element"""
# Dependencies
import numpy as np
# Sensor data (Mo, Tu, We, Th, Fr, Sa, Su)
tmp = np.array([1, 2, 3, 4, 3, 4, 4,
5, 3, 3, 4, 3, 4, 6,
6, 5, 5, 5, 4, 5, 5])
# One-liner
tmp[6::7] = np.a... | true |
17456ba6d9d097450d9eb8dec4b2b6201a46a628 | Python | matcianfa/playground-X1rXTswJ | /python-project/Maths/Monte_carlo_plot.py | UTF-8 | 290 | 2.703125 | 3 | [] | no_license | from random import uniform
from Trouver_max_fonction import maximum
#Les paramètres que vous pouvez modifier pour visualiser
f="sqrt(1-x**2)"
a=0
b=1
nombre_de_points_affichés=500
def mon_programme(f,a,b):
#Copiez collez votre programme précédent ci-dessous pour le modifier
| true |
7d219c91d896ee8c03dae54bcbc7db687e269f7a | Python | KeCaoStevens/Genetic-Mutation-Classification | /newTrain.py | UTF-8 | 2,416 | 2.71875 | 3 | [] | no_license | import gensim
import pandas as pd
from nltk.tokenize import RegexpTokenizer
import re
import nltk
from nltk.corpus import stopwords
from nltk.stem import WordNetLemmatizer
import string
import logging
print('start')
glove = gensim.models.KeyedVectors.load_word2vec_format("C:/Users/DC20693/Documents/Hantao/Wor... | true |
c925c6164afaceda0efc4727ab86b0cc0b2be2fa | Python | chj3748/TIL | /Algorithm/programmers/pg_같은 숫자는 싫어.py | UTF-8 | 276 | 2.96875 | 3 | [] | no_license | # stack | programmers 같은 숫자는 싫어
# github.com/chj3748
import sys
def input():
return sys.stdin.readline().rstrip()
def solution(arr):
answer = []
for num in arr:
answer.append(num) if not answer or answer[-1] != num else 0
return answer | true |
ccca6bf6a3032d097acd942c7343434acdb664f3 | Python | wmuron/motpy | /motpy/testing.py | UTF-8 | 3,581 | 2.953125 | 3 | [
"MIT"
] | permissive | import math
import random
from motpy.core import Detection
CANVAS_SIZE = 1000
def _random_color():
color_rgb = [random.randint(0, 255) for _ in range(3)]
return color_rgb
class Actor():
""" Actor is a box moving in 2d space """
def __init__(self,
color=None,
max_... | true |
823ecf423d8b061f50e77e7ff24ffe4cd2653306 | Python | HenryWConklin/beecounter | /listener.py | UTF-8 | 677 | 2.90625 | 3 | [] | no_license | import socket
import sqlite3
from threading import Thread
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.bind(('', 8888))
def handle(client: socket.socket):
f = client.makefile('r')
dbConn = sqlite3.connect('bees.db')
cursor = dbConn.cursor()
for line in f:
print(line.strip())
... | true |
787395dc260b019a7c6774217395e6e393da7ac6 | Python | oahcoul/SJTU_CS489_Reinforcement_Learning | /Project4/MountainCar_v0.py | UTF-8 | 6,343 | 2.6875 | 3 | [] | no_license | # MountainCar_v0.py
import gym
import numpy as np
from matplotlib import pyplot as plt
from RL_brain import DeepQNetwork, Double_DeepQNetwork
import time
import os
# Environment
env = gym.make("MountainCar-v0")
# Remove the limits(e.g. step limits) in environment encapsulation
env = env.unwrapped
# Instantiation of ... | true |
08aa0b689d9594ab3ada8d1a14abcb25f186a741 | Python | scyther211/C4E29 | /Session 5/hw/3_11+12.py | UTF-8 | 419 | 3.65625 | 4 | [] | no_license | def is_inside(m,n):
x = m[0]
y = m[1]
a = n[0]
b = n[1]
c = n[2]
d = n[3]
if a <= x <= a + c and b <= y <= b + d:
return True
else:
return False
inside = is_inside([200, 120], [140, 60, 100, 200])
inside1 = is_inside([100, 120], [140, 60, 100, 200])
if inside == True and... | true |
c055b624c3ca73b47cb7fd3fd9dbed21e8568c85 | Python | mengyx-work/CS_algorithm_scripts | /leetcode/LC_81_search_in_rotated_sorted_array_II_iterative.py | UTF-8 | 1,013 | 3.234375 | 3 | [] | no_license | class Solution(object):
def search(self, nums, target):
if len(nums) == 0:
return False
lo, hi = 0, len(nums) - 1
while lo < hi:
mid = lo + (hi-lo) // 2
if nums[mid] > nums[hi]:
if target >= nums[lo] and target <= nums[mid]:
... | true |
b952d021d12dc52f1bf873165669686200a872bf | Python | rsx-utoronto/xhab-2 | /ground_station/imageCheck.py | UTF-8 | 2,476 | 3.421875 | 3 | [] | no_license | import pygame, time
def rot_center(image, angle):
orig_rect = image.get_rect()
rot_image = pygame.transform.rotate(image, angle)
rot_rect = orig_rect.copy()
rot_rect.center = rot_image.get_rect().center
rot_image = rot_image.subsurface(rot_rect).copy()
return rot_image
# Initialize the game en... | true |
bc5f165d4939f52428891e85bbe5da093aa8da47 | Python | EchelonFour/advent-of-code-2020 | /16/16.py | UTF-8 | 4,439 | 3.15625 | 3 | [] | no_license | from os.path import abspath, dirname, join
from typing import Dict, List, Set
with open(abspath(join(dirname(__file__), 'input'))) as f:
sections = [l.strip() for l in f.read().split(sep='\n\n')]
target_prefix = 'departure'
class Field:
def __init__(self, name: str, allowed_values: Set[int], num_possible_sl... | true |
4ec1977571bbd137e4a32cb3f2f4d50607a6e063 | Python | anamariasosam/legoMindstorm | /Educator/main.py | UTF-8 | 2,798 | 2.921875 | 3 | [] | no_license | |#!/usr/bin/env python3
'''Hello to the world from ev3dev.org'''
import os
import sys
from ev3dev2.motor import (MoveSteering, OUTPUT_B, OUTPUT_C)
from ev3dev2.sensor.lego import UltrasonicSensor
from ev3dev2.sensor import INPUT_1, INPUT_4
from ev3dev2.sensor.lego import TouchSensor
from time import sleep
from ev3dev2... | true |
561f26c261a275f7174436c6a19a32552cbb8453 | Python | wilfreud/python-tic-tac-toe | /popGUI.py | UTF-8 | 1,446 | 3.25 | 3 | [] | no_license | from tkinter import *
import os
def screenMSG(fileName, *args,): # Main function for popup PARAMS: *args=PlayerName filename=__file__
show = Tk()
show.title("")
show.geometry("200x100")
show.resizable(False, False)
show.eval('tk::PlaceWindow . center')
def bunttonFunctionExit(): # action for e... | true |
5e36b9f3ccc3e37964b682f2465ff638ecb869a3 | Python | jermenkoo/spoj.pl_solutions | /JULKA.py | UTF-8 | 104 | 3.71875 | 4 | [] | no_license | for _ in range(10):
i = int(input())
j = int(input())
print(int((i+j)//2))
print(int((i-j)//2))
| true |
42a9568e8d4c1a4c868da342862ff30e0f630f61 | Python | sifirib/project_euler_solutions | /Euler Projects/euler19.py | UTF-8 | 201 | 3.09375 | 3 | [] | no_license | from datetime import date
sundays = 0
for year in range(1901, 2001):
for month in range(1, 13):
if date(year, month, 1).weekday() == 6:
sundays += 1
print(sundays) | true |
b4cc0e0a00371e9c11b17b4b2438de246286d624 | Python | lilyqiao/15112-Term-Project | /practice.algo.py | UTF-8 | 5,710 | 2.96875 | 3 | [] | no_license |
import module_manager # from course website
module_manager.review()
from tkinter import *
import quandl
import pandas as pd
import matplotlib.pyplot as plt
quandl.ApiConfig.api_key = "mGtMJWKAbxyxUy5fTm5f" # my APIkey from Quandl acc.
def actualThing():
#######################################################... | true |
2b9e09dc0ac333f8c2497b54abb774debbb9bdb0 | Python | spinlud/Data-Mining-Course | /Homework 3/Homework3done/src/problem1/RandomApriori3.py | UTF-8 | 4,164 | 2.90625 | 3 | [] | no_license | import random
from itertools import combinations
class RandomApriori:
def __init__(self, fileInput, fileOutput, threshold, p, falseNegative):
self.frequentItemSetsCountWithFP = 0
self.frequentItemSetsCountWithoutFP = 0
#self.resultDict = {}
def randomApriori(fileInput, fileOutp... | true |
51a429528dad0a69369309a1344c7eaf2c3ce40d | Python | PalmiraPereira/curves | /test_delaunay.py | UTF-8 | 1,853 | 2.625 | 3 | [] | no_license | __author__ = 'Palmira Pereira'
from scipy.spatial import Delaunay
import numpy as np
import random
import math
lam= 5 # mean and standard deviation
s = np.random.normal(25,7,800)
p = np.random.normal(25,7,800)
points3=[]
a=65.0
b=1
k=40.0
for i in range(int(a)+1):
for j in range(int(a)+1):
... | true |
6c1b6634564d1289053aa3f86283ad3fe3c68dd7 | Python | pgrandhi/pythoncode | /Assignment7/AddressBook/AddressBook.py | UTF-8 | 6,306 | 3.109375 | 3 | [] | no_license | from tkinter import *
import pymysql
from ReadConfig import read_db_config
db=None
class AddressBook:
def __init__(self):
window = Tk()
window.title("AddressBook")
nameFrame = Frame(window)
Label(nameFrame, text="Name").grid(row=0,column=0, sticky=W)
self.nameVar = StringV... | true |
793c4cbc8ca0f0566f66010b2f326fd7cf6e9ec9 | Python | jamesremuscat/construct | /construct/lib/hex.py | UTF-8 | 2,272 | 3.03125 | 3 | [
"MIT"
] | permissive | from construct.lib.py3compat import byte2int, int2byte, bytes2str, iteratebytes, iterateints
# Map an integer in the inclusive range 0-255 to its string byte representation
_printable = dict((i, ".") for i in range(256))
_printable.update((i, bytes2str(int2byte(i))) for i in range(32, 128))
def hexdump(data, linesi... | true |
88ff91e639761d1a6611c6f15deb187eb59d6b3f | Python | natalymr/gcm | /results_analyzing/utils.py | UTF-8 | 6,845 | 2.515625 | 3 | [] | no_license | import os
import random
import string
import nltk
import numpy as np
import matplotlib.pyplot as plt
from dataclasses import dataclass
from parse import parse
from pathlib import Path
from typing import List, Optional
from subprocess import PIPE, Popen
from code2seq_dataset.global_vars import Message
@dataclass
cl... | true |
e281553d02cc836ab27d1cdff157a3128a68bd30 | Python | RafaelSanzio0/FACULDADE-PYTHON.1 | /Aula 05/EE9-Aula04.py | UTF-8 | 224 | 3.8125 | 4 | [] | no_license | #EXERCICIO EXTRA 10 - AULA 05
#Autor: Rafael Sanzio
#Data: 31/08/2017
#Entrada
n = int(input("Digite um numero: "))
dez = n%100
dado = dez//10
if (dado%2)== 0:
print("par")
else:
print("impar")
print("Dezena é,",dado) | true |
82d981b7df7619dcae33ba6956d0c669c2cb62a1 | Python | jackw99/Perceptron-from-scratch | /PerceptronImplementation.py | UTF-8 | 7,041 | 3.734375 | 4 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# # Perceptron
# In[3]:
#library
import numpy as np
# Data:
# - Three class types
# - Numeric features
# - Training three different perceptron to distinguish between each of the three classes
# In[4]:
#Getting training data
with open('train.data', 'r') as file:
train ... | true |
5e9da2dfd20332ee8bbdb2f84c285eea23fa8e7e | Python | nikhilch23/coming_soon | /app.py | UTF-8 | 630 | 2.59375 | 3 | [] | no_license | from flask import request,render_template,Flask, redirect, url_for
import csv
app=Flask('__main__')
@app.route('/')
def main():
return render_template('index.html')
row = ['Name','Email']
with open('list.csv','w') as csvFile:
writer = csv.writer(csvFile)
writer.writerow(row)
@app.route('/submit', methods = ['GE... | true |
3c3f8d03fcc0495134acb384577ba974c32ef6e7 | Python | HadeelK/Projects | /adventure_game.py | UTF-8 | 3,766 | 3.984375 | 4 | [] | no_license | import time
import random
# list for places playes will visit
places = ["field", "cave", "house"]
# lise of weapons player can use
weapons = ["trusty (but not very effective) dagger.", "magic potion", "rock"]
# list of enemies
enemy = ["wicked_fairie", "wolf", "bear"]
# function to ask to reaped the game or not
de... | true |
898084c3b357d0dd6346936a6a20ed69fdede99a | Python | Bharat437/Matrix_Theory | /Assignment3/Codes/Assignment_3.py | UTF-8 | 143 | 2.921875 | 3 | [] | no_license | import numpy as np
x=5
y=2
z=9
a=3
b=7
c=12
V= np.array([[x,a,x+a],[y,b,y+b],[z,c,z+c]])
print("Determinant of matrix V=",np.linalg.det(V))
| true |
8afc1938774b9ab2be3c8edbc0d3d45a1080ef5c | Python | fcantor/holbertonschool-higher_level_programming | /0x01-python-if_else_loops_functions/8-uppercase.py | UTF-8 | 222 | 3.6875 | 4 | [] | no_license | #!/usr/bin/python3
def uppercase(str):
for alpha in str:
if ord(alpha) >= ord('a') and ord(alpha) <= ord('z'):
alpha = chr(ord(alpha) - 32)
print("{:s}".format(alpha), end="")
print("")
| true |
0b989064baa78babdb8aa0595413c8a6dbc6f4b7 | Python | zhikunhuo/lpython | /numpy/math_func/Rational_routines/gcd.py | UTF-8 | 161 | 2.953125 | 3 | [] | no_license | import numpy as np
print("gcd(12, 20): ", np.gcd(12,20))
print("gcd[15,25,35]: ", np.gcd.reduce([15,25,35]))
print("gcd[15,25,35]: ", np.gcd(np.arange(6),20)) | true |
367be0031a9214fe6d65c7513f77c8cbd0545414 | Python | hatiferenc1/Gyakorl-s2 | /hossz.py | UTF-8 | 196 | 2.703125 | 3 | [] | no_license | def kurvaanyja():
szó = input('Adj meg egy szót ')
hossz = len(szó)
hossznégyzet = hossz ** 2
lista = []
lista.append(hossznégyzet)
return lista
print(kurvaanyja()) | true |
9afb35a48f8fb65d6ed2d7fcb89f57552e795f02 | Python | keiouok/nlp100v2020 | /ch01/ans08.py | UTF-8 | 232 | 3.1875 | 3 | [] | no_license | def cipher(text):
text = [chr(219 - ord(w)) if 97 <= ord(w) <= 122 else w for w in text]
return "".join(text)
text = "this is a message"
print(ord("a"), ord("z"))
ans = cipher(text)
print(ans)
ans = cipher(text)
print(ans)
| true |
a35a10256f9cf9937bf1ae75dc643465719f960f | Python | spendlively/snippets | /python/practice/test.py | UTF-8 | 390 | 3.15625 | 3 | [] | no_license |
try:
1 / 0
'42' + 10
except (ZeroDivisionError, TypeError):
print('Error')
try:
1 / 0
'42' + 10
except (ZeroDivisionError, TypeError) as e:
print(type(e), e)
try:
exception = Exception('spam', 'eggs')
raise exception
except ZeroDivisionError:
print('ZeroDivisionError')
except Ty... | true |
755f0369765140d4436d8dac60777b7db36f3fab | Python | daniel-reich/ubiquitous-fiesta | /EuHGfJfCeLyx9BEdG_12.py | UTF-8 | 153 | 3.046875 | 3 | [] | no_license |
def party_people(lst):
l = len(lst)
nlst = []
for p in lst:
if p <= l: nlst.append(p)
if lst == nlst: return l
return party_people(nlst)
| true |
ebfcc6cacd61abbee4d650da951dd80f8bbd0ddc | Python | qwaqwa93/tichuHelper | /tichuHelper.py | UTF-8 | 3,232 | 2.828125 | 3 | [] | no_license | from selenium import webdriver
from bs4 import BeautifulSoup
from Tkinter import *
import time
# open chorme browswer
driver = webdriver.Chrome('D:\chromedriver_win32\chromedriver')
# open onlinetichu.com
driver.get("http://www.onlinetichu.com/Site/Account/Login")
# log-in
driver.find_element_by_name('lo... | true |
c49d4196d4bcadee5833788fafa3abbaf3849e8d | Python | seoljeongwoo/learn | /algorithm/BOJ_7576.PY | UTF-8 | 971 | 2.703125 | 3 | [] | no_license | from collections import deque
import sys
input = sys.stdin.readline
def bfs(queue):
while queue:
x,y = queue.popleft()
for i in range(4):
nx,ny=x+dx[i],y+dy[i]
if nx==-1 or nx == N or ny == -1 or ny == M: continue
if visit[nx][ny] != -1 or farm[nx][ny] !=... | true |
79d275c8ff8414e5ca3a9016108b82eff0531d63 | Python | trankimtu/Python | /05_ImportMath.py | UTF-8 | 670 | 3.1875 | 3 | [] | no_license | import math
print(f"math.sqrt(25) = {math.sqrt(25)}")
print(f"math.sqrt(15) = {math.sqrt(15)}")
print(f"math.sqrt(15) = {math.floor(math.sqrt(15))}")
print(f"math.sqrt(15) = {math.ceil(math.sqrt(15))}")
print(f"math.pow(3,2) = {math.pow(3,2)}")
print(f"pi = {math.pi}")
import math as m
print(f"m.sqrt(25... | true |
7d217f45abde9b465acdabf0219c65c9aa74c7d3 | Python | bicsu/algorithm_practice | /BOJ_11047.py | UTF-8 | 196 | 3.03125 | 3 | [] | no_license | a, b = map(int, input().split())
coins = []
for i in range(a):
coins.append(int(input()))
coins.sort(reverse=True)
dap = 0
for i in coins:
while b >= i:
dap += b // i
b %= i
print(dap)
| true |
0296d34dd9029ae0e67f4f0f2eb40ad9a6d452eb | Python | BowenChan/CocktailScraper | /cockatailDb/convertArray.py | UTF-8 | 448 | 2.9375 | 3 | [
"MIT"
] | permissive | import json
tempCocktail = {}
with open('cocktail.json') as data_file:
data = json.load(data_file)
for drink in data:
drinkData = {}
tempCocktail[drink["name"]] = drink
tempCocktail[drink["name"]].pop('name', None)
with open('convertedCocktailPretty.json', 'w') as outfile:... | true |
f3f6fec0aee3d18ed21d41b3b27d7811826b8e16 | Python | NickolayStorm/vk_notifications_telegram_bot | /telegram_bot.py | UTF-8 | 3,245 | 2.765625 | 3 | [
"WTFPL"
] | permissive | #! /usr/bin/python
from telegram import Updater
import logging
from vk_messages import VkUser
TOKEN = 'XXXXXXXXXXXXXX'
updater = Updater(TOKEN)
# Job Q for reading message updates
q = updater.job_queue
# Dictionary to store users by its id
vk_tokens = {}
# Vk application id
vk_app_id = "5344498"
# Enable Logging... | true |
654492f1a464b1b846d1dd2af17264c189bc32e3 | Python | JudeJang7/CSE_331 | /CSE_331/Project 6_ Graphs Starter Code/Graph.py | UTF-8 | 8,079 | 4.0625 | 4 | [] | no_license | """ This module creates a Graph data structure
Method used for storing edges was to create a list of all the edges (edge list).
"""
import math
class Graph:
"""
A weighted graph
Features path capabilities, minimum weight, bipartite
"""
def __init__(self, n):
"""
Constructor
... | true |
0d519334097f2cc8bb5437a358c59b3edafff4ae | Python | Teinaki/dev-practicals | /04-practical/04-practical/q4.py | UTF-8 | 1,886 | 4.3125 | 4 | [] | no_license | # Research & show an example of the implementation of a queue using two stacks,
# i.e., your Queue class will use two stacks to store its data. Please comment
# your code as appropriate. It helps us understand your implementation.
class Stack:
def __init__(self):
self._stack = []
def push(self, item)... | true |
a939873880aff880b235854b5602fd0c100c1309 | Python | justinaustin/graphql-compiler | /graphql_compiler/compiler/subclass.py | UTF-8 | 2,492 | 3 | 3 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | # Copyright 2019-present Kensho Technologies, LLC.
from typing import Dict, Optional, Set
from graphql import GraphQLInterfaceType, GraphQLObjectType, GraphQLSchema, GraphQLUnionType
import six
from ..schema.typedefs import TypeEquivalenceHintsType
def compute_subclass_sets(
schema: GraphQLSchema, type_equivale... | true |
b84b294e43a7538f7151b98b407cf420880a7480 | Python | 4DD8A19D69F5324F9D49D17EF78BBBCC/algorit_hm_design_and_anal_ysis | /Stanford/part2/p2_1.py | UTF-8 | 661 | 2.796875 | 3 | [] | no_license | rawdata = open('clustering1.txt').readlines()
n = int(rawdata[0])
data = [ tuple(map(int,line.split())) for line in rawdata[1:] ]
def work(data):
data.sort(key=lambda x:x[2])
f = range(0,n+1)
cc = n
def find(x):
if x==f[x]:
return x
else:
f[x]=find(... | true |
d9c39bd7e355fbd0e7da274feb8a5d6fd718867b | Python | Beschuetzer/Python-Learning | /Matplotlib plots and other stuff.py | UTF-8 | 5,238 | 3.640625 | 4 | [] | no_license | import os
import matplotlib.pyplot as plt
# class variable_dict(dict):
# dict = dict()
# def add(self,k, v):
# self.dict[k] = v
# def remove(self,k):
# self.dict.pop(k)
# v = variable_dict()
# v.add('test',1)
# print(v.dict)
# v.remove('test')
# print(v.dict)
def calculate_linear_co... | true |
15e0c0fb2132e67a3ce4ba04c59404ac69a6578a | Python | ppizarror/tarea-1-hidraulica | /funciones.py | UTF-8 | 12,349 | 3.25 | 3 | [] | no_license | # coding=utf-8
"""
Funciones extras para calcular necesidades.
"""
# Importación de librerías
import math
import matplotlib.pyplot as plt
def get_diametern(n, dmax, dmin):
"""
Calcula el diámetro para satisfacer un largo n
:param n: largo a cubrir
:param dmax: diámetro maximo
:para... | true |
bec124ed62b05cfbeecfd9bfe1e3882aa3a9fd96 | Python | mac1755/Python_kikai | /kikai1_3.py | UTF-8 | 1,552 | 3.28125 | 3 | [] | no_license | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.datasets import make_classification
#データを生成します。
x, y = make_classification(n_samples=100, n_features=2, n_redundant=0, random_state=... | true |
c423885a65213e3dd5be65fb0a239c531383037e | Python | Akankshya-ap/networklab | /Assignment2/prog16_client1.py | UTF-8 | 233 | 2.75 | 3 | [] | no_license | import socket
s = socket.socket()
host = socket.gethostname()
port = 50000
s.connect((host, port))
msg = 'hello from client1\n' * 200 + 'bye' * 350
s.send(msg.encode())
print('Sever: ',s.recv(1024).decode())
s.close()
| true |
4370091d0b60c454e90887462bce33f07c4d81be | Python | liuhongbo830117/pcc | /python/pcc/union.py | UTF-8 | 2,292 | 2.578125 | 3 | [] | no_license | '''
Create on Feb 27, 2016
@author: Rohan Achar
'''
from attributes import spacetime_property
from _utils import build_required_attrs
class union(object):
def __init__(self, *types):
# Classes that it is going to be a union of.
self.dimensions = set()
self.dimension_names = set()
f... | true |
b3ecf8fde68c5e8a91490f94a4ca195aafe82e00 | Python | kiariepeter/politicov1 | /app/api/v2/votes/view.py | UTF-8 | 2,036 | 2.59375 | 3 | [
"MIT"
] | permissive | from flask import request, jsonify, Blueprint, make_response
from app.api.v2.votes.Vote_Model import Votes
from custom_validator import My_validator as validate
from config import tokenizer
import os
import jwt
MY_APIKEY = os.getenv('MY_APIKEY')
votes = Votes()
votes_blueprint = Blueprint('votes', __name__)
@votes_bl... | true |
9ced42eca34c1646f4463e36610e14955d7cc63d | Python | adarshd/Algorithms_practise | /exercises36/Exercise1.py | UTF-8 | 160 | 3.765625 | 4 | [] | no_license | age = int(input("Pease enter your age:"))
name = input("Please enter your name:")
print("you name is " +name +"you are going yo be 100 in "+str(100-age) ) | true |
397584602bb4c09ac3d2cb80cef7a80876f1c661 | Python | shashank1020/LeetCode | /14 Longest Common Prefix.py | UTF-8 | 762 | 3.484375 | 3 | [] | no_license | # https://leetcode.com/problems/longest-common-prefix/
'''
EXAMPLE
Input: strs = ["flower","flow","flight"]
Output: "fl"
'''
class Solution:
def longestCommonPrefix(self, strs: list[str]) -> str:
if strs == []:
return ''
low = strs[0]
for i in strs:
if len(i) < len(... | true |
ccb2f860499139b6d03b1623e62edd8bd8237094 | Python | nihal223/Python-Playground | /CTCI/Chapter4/06-successor.py | UTF-8 | 831 | 3.5625 | 4 | [] | no_license | import unittest
class Node():
def __init__(self, data, left=None, right=None):
self.data = data
self.left = left
self.right = right
def successor(root, node):
if root == node:
return root.right.data
if node.data > root.data:
return successor(root.right, node)
... | true |
a0fb3fbd693aaff577069749542d0b53806d097f | Python | Padmabala/Basic-Algo | /sorting/quickSort.py | UTF-8 | 553 | 3.765625 | 4 | [] | no_license | def partition(a, low,high):
pivot=a[high]
i=low-1
for j in range(low,high):
if(a[j]<pivot):
i=i+1
a[i],a[j]=a[j],a[i]
a[i+1],a[high]=a[high],a[i+1]
return i+1
def quickSort(a , low , high):
if(low<high):
pivot = partition(a, low, high)
quickSort(a, l... | true |
e8413f63677aff087b96c9f46406cea9cc093ff8 | Python | dpaysan/NMCO-Image-Features | /nmco/nuclear_features/Int_dist_features.py | UTF-8 | 5,145 | 3.140625 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
"""
Library for computing features that describe the intensity distribution
This module provides functions that one can use to obtain and describe the intensity distribution of a given image
Available Functions:
-hetero_euchro_measures:Computes Heterochromatin to Euchromatin features
-intensit... | true |
8816df6d7ac50a87fbee45aaed8e833048a63ec1 | Python | markmusic2727/data_statistics_calculator | /main.py | UTF-8 | 525 | 2.734375 | 3 | [
"MIT"
] | permissive | import enum
class SolveFor(enum.Enum):
mean = 1,
median = 2,
mode = 3,
dataRange = 4,
standardDeviation = 5,
class StatisticCall:
def __init__(self, numberList, solveFor):
self.numberList = numberList
self.solveFor = solveFor
def findMean(self):
print("work")
... | true |
76e89a3ee458063ffb709fdb63030321bd688781 | Python | bryano13/holbertonschool-higher_level_programming | /0x0B-python-input_output/7-save_to_json_file.py | UTF-8 | 309 | 3.53125 | 4 | [] | no_license | #!/usr/bin/python
"""Module that saves object to a Json File"""
import json
def save_to_json_file(my_obj, filename):
"""
Function that writes an Object to a text
file, using a JSON representation
"""
with open(filename, "w", encoding="utf-8") as file:
json.dump(my_obj, file)
| true |
5b17c79d9830601e3ca3f21b2d1aa8f334e93f13 | Python | piumallick/Python-Codes | /LeetCode/Problems/0104_maxDepthBinaryTree.py | UTF-8 | 1,405 | 4.21875 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu May 14 20:12:03 2020
@author: piumallick
"""
# Problem 104: Maximum Depth of a Binary Tree
'''
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the
longest path from the root node down to the farthest leaf n... | true |
b55a4ad6d88b0273c34910f868a5ac21078c515b | Python | PBearson/cracking-the-coding-interview | /7-technical-questions/core-knowledge/customGraph.py | UTF-8 | 917 | 3.5 | 4 | [] | no_license | import random
import math
class Graph:
def __init__(self):
self.graph = {}
def addEdge(self, u, v):
try:
self.graph[u].add(v)
except KeyError:
self.graph[u] = {v}
def generateRandomGraph(self, numNodes):
self.graph = {}
for n in range(numNo... | true |
530faa2e60e9628563f094365cc0ac6da4449b53 | Python | njohnson99/CS105-Speech-Algorithms | /google-long-files.py | UTF-8 | 1,227 | 2.671875 | 3 | [] | no_license | import io
import os
# Imports the Google Cloud client library
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="/Users/narijohnson/Documents/CS105-Speech-Algorithms/google private key new.json"
# Instantiates a clie... | true |
1d9c24f328c2faa96c6b30357fd760cccbae8814 | Python | zostay/dotfiles | /bin/list-macos-windows | UTF-8 | 2,392 | 3.046875 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# Handy script found here:
# https://apple.stackexchange.com/questions/317531/how-to-determine-which-one-process-owns-particular-window
import Quartz
import time
from Foundation import NSSet, NSMutableSet
def transformWindowData(data):
list1 = []
for v in data:
if not v.value... | true |
737bff8d615b1137e127d6588bfa02002a61cd60 | Python | webclinic017/histdata | /niku/module/market/modles/position.py | UTF-8 | 3,003 | 3.21875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
class Position(object):
"""
購入した資産
"""
currency_pair = None
start_at = None
end_at = None
limit_end_at = None
open_rate = None
close_rate = None
limit_rate = None
stop_lim... | true |
dd1622d0a10893a3ac2e67a6484196255eb38349 | Python | JT4life/PythonCodes | /PracticeCodes/usingQueue.py | UTF-8 | 715 | 4.21875 | 4 | [] | no_license | #Queue : First in first out data structure
import queue
'''q = queue.Queue()
q.put("A")
q.put("B")
q.put("C")
q.put("D")
q.put("E")
q.put("F")
for i in range(q.qsize()):
print(q.get())'''
#LifoQueue : Last in first out data structure
'''q = queue.LifoQueue()
q.put("A")
q.put("B")
q.put("C")
q.put("D")
q.put("E"... | true |
ce03dbc1db684a09ce4244684fa1b79e271f7c7a | Python | clbj/trains | /trains/dijkstra.py | UTF-8 | 338 | 3.046875 | 3 | [] | no_license | __author__ = 'clbj'
class Dijkstra:
def __init__(self):
# Graph: AB5, BC4, CD8, DC8, DE6, AD5, CE2, EB3, AE7
G = {'A': {'B': 5, 'D': 5, 'E': 7},
'B': {'C': 4, 'x': 2},
'C': {'D': 8, 'E': 2},
'D': {'C': 8, 'E': 6},
'E': {'B': 3}}
print(... | true |