blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
9fea4827758101c6dbb3b5bdafe25cc554135630 | wangtianrui/NumberAnalysis | /four/least_square_method.py | UTF-8 | 1,026 | 2.96875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
def get_points():
points = [[0.0, 0.9], [0.2, 1.9], [0.4, 2.8], [0.6, 3.3], [0.8, 4.2]]
return points
def function(x, kb):
y = kb[0] + x * kb[1]
return y
def lsm(points):
xs = [x[0] for x in points]
ys = [x[1] for x in points]
xs = np.... | true |
6e18268dfeb204f21c9eee9d30110a654f389550 | simzhangbest/myleetcode | /字符串/this_is_a_pen.py | UTF-8 | 369 | 3.8125 | 4 | [] | no_license | #this is a pen ==> pen is this
class Solution(object):
def reverse_line(self, s):
res = ""
list_tmp = []
for x in s.split(" "):
list_tmp.append(x)
list_tmp.reverse()
for y in list_tmp:
res = res + y + " "
return res
solve = Solution()
res = s... | true |
a0edd34061a525321b10576ede735ca870caa1f4 | rods-honorio/flask_sample_app | /dao/sample_b_dao.py | UTF-8 | 996 | 2.515625 | 3 | [] | no_license | from model import SampleB
from dao import db
class SampleBDao:
def create_sample_b(self, sample_b):
db.session.add(sample_b)
db.session.commit()
def update_sample_b(self, sample_b):
sample = SampleB.query.get(sample_b.id_field_b, sample_b.id_field_a)
sample.text_field_b = sam... | true |
09dbe7b28e9510893f3e8ee0ebfe017550d0e2aa | lfventura/aws-scripts | /aws-autosnap.py | UTF-8 | 1,909 | 2.515625 | 3 | [] | no_license | #/usr/bin/python
#
# AWS auto snapshot script - 2013-08-17
# https://github.com/viyh/aws-scripts
#
# cron script to snapshot all EC2 volumes and delete snapshots older than retention time
#
import boto
import datetime
# number of days to retain snapshots for
retention_days = 2
# AWS access/secret keys
aws_access = ... | true |
cea233f539f4bbac982dd6df692e34a40bf2f5d7 | xiaovictoria8/Migo | /.Trash/src 3.01.49 PM/generate_worker_score_from_edinburgh.py | UTF-8 | 10,030 | 3.15625 | 3 | [] | no_license | import sys
import csv
from functions import precision, recall, f1
"""
Processes the results for workers on gold-standard Edinburgh++ HITs
Generates the following outputs:
- A CSV list of all users who completed an Edinburgh HIT, with stats on their performance (on Edinburgh and on the training HITs)
- A CSV fi... | true |
06df6c1fd70470e3ccb6a30e6aaad4e8bff2b9fe | rcorcs/phd-thesis | /plots/myplots.py | UTF-8 | 12,546 | 2.6875 | 3 | [] | no_license |
import matplotlib
import os
if os.environ.get('DISPLAY','') == '':
matplotlib.use('Agg')
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import t as student_t
from scipy.stats import norm
#"Geometric mean extension for data sets with zeros"
#Roberto de la Cruza, Jan-Ulric... | true |
b083d46bb6b6941a043d5570ef867806c093b530 | Minephliss/Project | /MetalCalculater/Calculater-ch.py | UTF-8 | 3,674 | 3.421875 | 3 | [] | no_license | class Metal:
def __init__(self, lst):
self.name = str(lst[0])
self.content = float(lst[1])
self.quantity = float(lst[2])
self.lowerLimit = float(lst[3])
self.upperLimit = float(lst[4])
self.used = int(lst[2])
metalSerialNumber = []
kindOfMetal = 0
metalList = []
targ... | true |
a1026b7da4126ded1f582b37104a4213c9767050 | lewfer/learning-pi-bot | /learnbot_viewpositions.py | UTF-8 | 392 | 3.3125 | 3 | [] | no_license | # Learnbot View Positions
#
# Run the robot though each position in turn, just so we can see them
from learnbot import *
from settings import *
#indices=['00','01','02','10','11','12']
# Create the bot
bot = Learnbot(SERVOS)
# Start it up
bot.wakeSlowly(2)
# View all the positions in order
for state in bot.stat... | true |
3155e604052ef7b04e2fb9f7da4d3c9d16ad84b1 | JoaoAlvaroFerreira/FEUP-LGP | /backend/unit_tests/services/test_administrator_service.py | UTF-8 | 4,563 | 2.625 | 3 | [] | no_license | """
Tests related to Administrator Service class
"""
import uuid
from unittest.mock import patch, Mock
from django.test import TestCase
from rest_framework.exceptions import ValidationError
from martin_helder.models import Administrator
from martin_helder.services.administrator_service import AdministratorService
from ... | true |
cf5b00f0f0a042a2dfa9b7c4a27caa1cb0ee5491 | Pgm-LabRedesYServicios/practica1_2 | /servidor.py | UTF-8 | 2,432 | 3.4375 | 3 | [] | no_license | from select import select
from socket import AF_INET, SOCK_STREAM, socket
from sys import argv, exit, stderr
def setup() -> socket:
"""
Create a socket for the server to listen
"""
# Create a TCP/IP socket
server = socket(AF_INET, SOCK_STREAM)
server.setblocking(False)
# Parse arguments
... | true |
a699123aee602a25bdd6a0872f7ae741b44016b3 | ccwu0918/class_opencv_python | /14_morphological/8_kernel_basic.py | UTF-8 | 279 | 2.75 | 3 | [] | no_license | import cv2
kernel1 = cv2.getStructuringElement(cv2.MORPH_RECT, (5,5))
kernel2 = cv2.getStructuringElement(cv2.MORPH_CROSS, (5,5))
kernel3 = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (5,5))
print("kernel1=\n",kernel1)
print("kernel2=\n",kernel2)
print("kernel3=\n",kernel3) | true |
e82f5432e2ce8604d692214c2b7a6b73132e0295 | Sana-mohd/fileQuestions | /binary_.py | UTF-8 | 317 | 3.390625 | 3 | [] | no_license | import pickle
dict={}
f=open("example.bin","ab")
total_number=int(input("enter the No.of students: "))
for i in range(total_number):
print("Enter details of the student",i+1)
dict["Roll No."]=int(input("enter the roll number: "))
dict["Name"]=input("enter the Name of the student: ")
pickle.dump(dict,f)
| true |
5cb0a45a784980e1815252e3fa097f1f974a23ef | Poelsa/advent_of_code_2016 | /1/1_1.py | UTF-8 | 928 | 3.984375 | 4 | [] | no_license | import math
#read input list
f = open("1_input.txt")
class pointAndDir:
def __init__(self):
self.x = 0
self.y = 0
self.curDir = 0
def move(self, command):
#get dir
turn = command[0]
if turn is 'R':
self.curDir += 90
elif turn is 'L':
... | true |
dc75b6b2638da09a3496a28d40988a6b22c277f9 | larsgehrke/mt | /code_archive/model/distana_th/view.py | UTF-8 | 4,721 | 2.8125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import matplotlib.animation as animation
from multiprocessing import Pool
import configuration as cfg
def plot_kernel_activity(ax, label, net_out, net_in=None, make_legend=False):
"""
This function displays the wave activity of a single kernel.
:param ax: The plot where the... | true |
0da407b72b5dcbaf0d2726146f32ef8bbce1ab27 | Coding-Aryan/Mini-Libary-Project-Python | /main.py | UTF-8 | 4,587 | 3.875 | 4 | [] | no_license | # Make a class named libary. It should have 4 functions
# display book
# lend book - (who owns the book if not present)
# add book
# return book
# Add book and make a list display books if asked and check the avibility of the book asked
# if anyone wants to add a book so take his/her name and name of book and if anyone... | true |
d5aa534f6373b4224c252f56ed38e898a3de470a | ryderautoblr/Automation | /Bizmate/tagKeywords.py | UTF-8 | 3,021 | 2.625 | 3 | [] | no_license | import xlUtils
import xlsxwriter
import os
import sys
sys.path.insert(1,"../pathInit/")
import pathInit
import excelReadProcessing
import math
import pandas
import wx
class tagKeywords():
def __init__(self):
self.names = []
self.newWords = []
self.keywordsDF = []
self.wordIndex = 0
def getFilterN... | true |
cb48bdfb34316813027f050f421d2e8c99c91e03 | GanonYou/LearnPython | /autoLoginGithub.py | UTF-8 | 503 | 2.53125 | 3 | [] | no_license | from selenium import webdriver
import os,sys
#该脚本可以实现自动打开github主页,并用命令行参数提供的账号密码自动登录
browser = webdriver.Chrome('/Users/YWY/PythonProgram/chromedriver')
browser.get('https://github.com/login')
account = sys.argv[1]
password = sys.argv[2]
accountElem = browser.find_element_by_id('login_field')
accountElem.send_keys(a... | true |
f7e993bf1270453056c0322ec26cb58c4429fb14 | lemon-sandwich/Inheritance-in-Python | /OOP-Part3 (Inheritance).py | UTF-8 | 1,024 | 4.28125 | 4 | [] | no_license | class Pet:
def __init__(self,name,age):
self.name = name
self.age = age
def show(self):
print(f"I am {self.name} and I am {self.age} years old.") # The reason we write f is: It get's the things in the flower bracket and replace them
... | true |
78f53c4a130daf34adc2ef48ec7e37be90c0a3b1 | klcysn/free_time | /climb_staircase.py | UTF-8 | 452 | 4.21875 | 4 | [] | no_license | # There exists a staircase with N steps, and you can climb up either 1 or 2 steps at a time. Given N, write a function that returns the number of unique ways you can climb the staircase. The order of the steps matters.
# For example, if N is 4, then there are 5 unique ways:
# 1, 1, 1, 1
# 2, 1, 1
# 1, 2, 1
# 1, 1, 2
# ... | true |
17a467714fe88d6df733cf531fe7657660dd1857 | k-stanislawek/flexible-notifications-from-slack | /src/slack_notifications/backend/run_config.py | UTF-8 | 1,090 | 2.5625 | 3 | [
"Apache-2.0"
] | permissive | import json
from pathlib import Path
from typing import Optional
from slack_notifications.user_api.message_type import SlackInstance
class RunConfig:
def __init__(self, path: Path):
self._path = path
self._data = {}
def _reload(self):
if not self._path.exists():
self._pat... | true |
429f922ced96e33fd46593012b2cca34b4a876c3 | Yoni-Mantzur/Automated-Reasoning-Project | /smt_solver/algorithms.py | UTF-8 | 2,908 | 2.953125 | 3 | [] | no_license | import copy
from collections import defaultdict
from itertools import product
from typing import cast
from smt_solver.formula import Formula, Term, FunctionTerm
class CongruenceClosureAlgorithm(object):
def __init__(self, formula: Formula):
self.formula = copy.deepcopy(formula)
for equality in s... | true |
c06b06e39193645a6107abc2ff89a6bf9d2da71b | django-money/django-money | /djmoney/templatetags/djmoney.py | UTF-8 | 3,393 | 2.875 | 3 | [
"BSD-3-Clause"
] | permissive | from decimal import Decimal
from django import template
from django.template import TemplateSyntaxError
from ..money import Money
from ..utils import MONEY_CLASSES
register = template.Library()
class MoneyLocalizeNode(template.Node):
def __repr__(self):
return "<MoneyLocalizeNode %d %s>" % (self.money... | true |
25344517e06b6a906b8a91c55bc51bc38b3f487e | bolade28/data_engineering_bp1 | /projects/integration/transforms-python/src/python/util/round_numeric_columns.py | UTF-8 | 684 | 3.171875 | 3 | [] | no_license | # ===== import: python function
import pyspark.sql.functions as f
# ===== import: palantir functions
# ===== import: our functions
def round_numeric_columns(df_out, rounded_cols):
'''
This function:
Rounds the cols which are in both df_out and rounded_cols
Args:
param1 (dataframe): df_o... | true |
bdce0f746713a1b0176bf58ef849195d9a61f221 | dimitar-petrov/terra-sdk-python | /terra_sdk/core/bank/msgs.py | UTF-8 | 3,002 | 2.734375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | """Bank module message types."""
from __future__ import annotations
from typing import List
from terra_sdk.core import AccAddress, Coins
from terra_sdk.core.msg import Msg
from terra_sdk.util.json import JSONSerializable
__all__ = ["MsgSend", "MsgMultiSend", "MultiSendIO"]
import attr
@attr.s
class MsgSend(Msg):... | true |
2cb5949b2a1e30a5309c4b00640f9c84c3db9604 | reyronald/playground | /Graph Search, Shortest Paths, and Data Structures/median/main.py | UTF-8 | 437 | 2.53125 | 3 | [] | no_license | from median import get_integer_array_from_file, find_median
ROOT = "D:/repos/playground/Graph Search, Shortest Paths, and Data Structures/median/"
RESULT = find_median(get_integer_array_from_file(ROOT + "tc1.txt"))
assert RESULT == 142
RESULT = find_median(get_integer_array_from_file(ROOT + "tc2.txt"))
assert RESULT... | true |
b00a760293be9ec042bee1d477c3610c90435da8 | BangLeCao/Object_Detection_SSD300 | /make_datapath.py | UTF-8 | 1,597 | 2.703125 | 3 | [] | no_license | from lib import *
def make_datapath_list(rootpath):
image_path_template = os.path.join(rootpath, 'JPEGImages', '%s.jpg')
annotation_path_template = os.path.join(rootpath, 'Annotations', '%s.xml')
train_id_names = os.path.join(rootpath, 'ImageSets/Main/train.txt')
val_id_names = os.path.join(rootpath, ... | true |
2a8a0d9768025edafbc73e59de205dd9728ce2ac | kimsutto/NetworkGraph | /graph_matplotlib.py | UTF-8 | 268 | 2.828125 | 3 | [] | no_license | # networkx matplotlib.pyplot 사용
import matplotlib.pyplot as plt
import networkx as nx
import matplotlib.pyplot as plt
graph = nx.Graph()
graph.add_nodes_from((1,2,3,4,5))
nx.draw(graph)
plt.show()
#그래프를 이미지로 저장
#plt.savefig("graph.png")
| true |
5e0f33449648a5ce4505cb62cd8f2673973b9a29 | dyrnfmxm/codeit | /0317_palindrome.py | UTF-8 | 417 | 3.734375 | 4 | [] | no_license | def is_palindrome(word):
# 코드를 입력하세요.
reverse_word = word[::-1]
for i in range(len(word)):
if word[i] != reverse_word[i]:
return False
break
return True
# 테스트
print(is_palindrome("racecar"))
print(is_palindrome("stars"))
print(is_palindrome("토... | true |
aa075b4bd3fd679f5ba0082a4b5e933a4119b4ac | cdroot92/django-sample-project | /users/tests.py | UTF-8 | 624 | 2.59375 | 3 | [
"BSD-3-Clause"
] | permissive | from datetime import timedelta
from django.test import TestCase
from django.utils import timezone
from .models import User
class UserModelTests(TestCase):
"""
longtime_no_see() returns True for user whose last_login is more than 30 days ago
"""
def test_longtime_no_see(self):
last_login = t... | true |
6e4da45a5782699677f5d5fef66476e2444b5d8d | c-yan/atcoder | /abc/abc041/abc041b.py | UTF-8 | 118 | 2.78125 | 3 | [
"MIT"
] | permissive | A, B, C = map(int, input().split())
m = 1000000007
result = A * B
result %= m
result *= C
result %= m
print(result)
| true |
26174cd2d7a6647942c2d6022acdf59ac4f6b6c2 | 66kesara99/Hackerrank-Random | /Contests/Aces Coders v6.0/SatelliteAutomation.py | UTF-8 | 217 | 3 | 3 | [] | no_license | n = int(input())
tasks = []
depend = []
for i in range(n):
a = input().split()
tasks.append(a[0])
if (len(a)>1):
depend.append(a[1])
else:
depend.append(0)
print(tasks)
print(depend)
| true |
19ddfe041c478436e562b66c03abc6691b2a1912 | coverwallet/pysoni | /tests/connection/test_cursor.py | UTF-8 | 398 | 2.75 | 3 | [
"MIT"
] | permissive | def test_cursor_triggers_cursor_in_the_connection(open_connection):
open_connection.cursor()
open_connection._connection_handler.cursor.assert_called_once()
def test_cursor_returns_a_cursor_in_the_handler(open_connection, mocker):
cursor_mock = mocker.Mock()
open_connection._connection_handler.cursor.... | true |
0687f902e5a368fe06739b618856a1080175b000 | tvorogme/house_emulator | /house_env/components/house.py | UTF-8 | 200 | 2.5625 | 3 | [] | no_license | from .room.abstraction import Metric
class House:
total_consumment = Metric(0., float)
rooms = []
def __int__(self, rooms=[]):
for room in rooms:
room.house = self
| true |
5278eeef8e071ba63f0e49423e768e54c5582ad4 | shirley1206/SI507-HW03-gofish-shirleey | /go_fish.py | UTF-8 | 7,574 | 3.96875 | 4 | [] | no_license | import random
class Card(object):
suit_names = ["Diamonds","Clubs","Hearts","Spades"]
rank_levels = [1,2,3,4,5,6,7,8,9,10,11,12,13]
faces = {1:"Ace",11:"Jack",12:"Queen",13:"King"}
def __init__(self, suit=0,rank=2):
self.suit = self.suit_names[suit]
if rank in self.faces: # self.rank ... | true |
0c7e244fe282ff8b5f89a1e8c06d457da6083746 | kottetertial/Artezio-Homework | /Lesson II/loops.py | UTF-8 | 1,378 | 4.3125 | 4 | [] | no_license | """
Hometasks 1-4 from Lesson Two
"""
def square_odd_numbers(stop):
"""
Counts the squares of all the odd numbers in the segment [0, x]
"""
counter = 0
for i in range(stop + 1):
if i % 2 != 0:
print(i**2)
counter += 1
print('There are {} odd number... | true |
72a5a4182a9c028274df427efba9b28deef3a3f0 | wangqiang3311/PythonFileDownLoader | /crawl/FileParser.py | UTF-8 | 827 | 3.046875 | 3 | [] | no_license | from openpyxl import load_workbook
class FileParser(object):
def parser(self,root_file):
if root_file is None:
return
new_urls=self._get_new_urls(root_file)
return new_urls
def _get_new_urls(self,root_file):
new_urls=set()
#读取Excel文件
urls= self.rea... | true |
cf16a7c386fb4898fd1da0365d4c6bfe82241f73 | hunsang-you/HSYOO | /ExamApp/ex0810_3.py | UTF-8 | 824 | 3.09375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 10 14:17:13 2021
@author: user16
"""
import pymysql
# db 접속
conn = pymysql.connect(host='127.0.0.1', user='bigdata', password='12345678', db = 'mysql', charset='utf8')
cursor = conn.cursor() # 커서 설정
sql = 'select * from 제품'
cursor.execute(sql) # sql 실행
result = cur... | true |
44b757c2729f9f64850bef46c7e053eb998de35d | huochf/TPN-paddle | /readers/transforms.py | UTF-8 | 14,341 | 2.578125 | 3 | [] | no_license | import sys
sys.path.append('/home/aistudio')
import random
import numpy as np
from PIL import Image
import math
__all__ = ['GroupImageTransform']
class GroupCrop(object):
def __init__(self, crop_quadruple):
self.crop_quadruple = crop_quadruple
def __call__(self, img_group, i... | true |
897d7da883031489bdb706eb2bc23682d58ea7be | dakotagrusak/python-project | /scraper.py | UTF-8 | 1,428 | 3.0625 | 3 | [] | no_license | import requests
from bs4 import BeautifulSoup
def scrape(url):
"""Scrape URLs to generate previews."""
headers = requests.utils.default_headers()
headers.update({
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20100101 Firefox/12.0'
})
r = requests.get(url, headers)
r... | true |
3377da7714e53d6950fe0433dd948a8bc602f267 | karenwsit/ToyProblems | /object_oriented_design/parking_garage.py | UTF-8 | 4,787 | 3.1875 | 3 | [] | no_license | #7.4 Parking Lot: Design a parking lot using object-oriented principles
#Questions:
#How to best structure all these different classes. Should they be subclasses? or stay separate classes?
#How to best pass variables from other classes when they are instance variables
#Reference to someone else's implementation in Pyt... | true |
c18d0ccdb79590d6bbbf769bea37ccf03fd057f7 | cuity328/python | /time value.py | UTF-8 | 961 | 3.4375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 07 09:45:14 2018
@author: cuity328
"""
import math
def future_value(v,t,r):
vt=float(v*(1+r)**t)
print vt
return vt
def present_value(vt,t,r):
v=float(vt/(1+r)**t)
print v
return v
def time(v,vt,r):
t=float(math.log(vt/v,(1+r)))
print t
... | true |
b1cd42a83c4914a9881d2bfe1b369c763e282f78 | joepope44/idi-datadive-2018 | /scrapers/fmo_scraper.py | UTF-8 | 3,451 | 2.90625 | 3 | [] | no_license | from time import sleep
from bs4 import BeautifulSoup
import pandas as pd
from selenium.webdriver.common.keys import Keys
from helpers import init_chrome_webdriver
def scrape_fmo(search_term):
return FMOScraper().scrape(search_term)
class FMOScraper(object):
DFI_NAME = 'FMO'
STARTING_URL = "https://ww... | true |
ec9947c3400777248c652733a7e97a5791040ad3 | doolcheenose/mazesolver | /search.py | UTF-8 | 9,943 | 2.953125 | 3 | [] | no_license | import numpy as np
import pygame
from pygame.locals import * # for mouse stuff
import time
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
from collections import deque
pygame.font.init()
font = pygame.font.Font('fonts/PressStart2P.ttf', 8)
WIN_SIZE = (600, 700)
GRID_WIDTH = 20
GRID_LENGTH = 25
GRI... | true |
84b10c253f45a363bc64418e08adad069c0b3568 | TNT-YYJ/firstpythonss | /com/pachong/zcoolFirst.py | UTF-8 | 750 | 3.015625 | 3 | [] | no_license |
import requests
from bs4 import BeautifulSoup
import csv
import json
## 从地址中获取图片
def getZcool(url):
urlArray = []
req=requests.get(url).text
content=BeautifulSoup(req,'html.parser')
comment_text = content.find_all('a',attrs={'class':'card-img-hover'})
for image in comment_text:
name=image.i... | true |
a383e7a62692385c952cf6fea45d92b9839104df | Bor-G/Diving_into_Python-Coursera | /Week_5/Exercises/client2.py | UTF-8 | 2,218 | 2.859375 | 3 | [] | no_license | import time
import socket
import json
class Client:
curent_time = time.time()
def __init__(self, host, port, timeout=None):
self.host = host
self.port = port
self.timeout = timeout
def get(self, key):
try:
with socket.create_connection((self.host, self.port),sel... | true |
f40d5231b3cfe2ba8a5a573d2bc0f3ea8853e0bc | rlyspn/helper_scripts | /failed_ssh_names.py | UTF-8 | 1,111 | 2.78125 | 3 | [] | no_license | #!/usr/bin/python
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import re
fileName = "/var/log/auth.log"
tell = "input_userauth_request: invalid user"
min_count = 3
title = "Failed SSH Log In Names (count > %d)" % min_count
def get_name_count(input_file, nc):
with open(in... | true |
6d09f43ad44cd28efda44d025f261b75df3db3b4 | VROOM-Project/vroom-scripts | /src/add_osrm_matrix.py | UTF-8 | 903 | 2.703125 | 3 | [
"BSD-2-Clause"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
from utils.file import load_json
from utils.matrix import add_matrix
# Parse a json-formatted input instance, add the matrix using OSRM for
# each required profile, then write a "standalone" problem instance
# that can be further solved even without ... | true |
ed834fec10ad2c3aa8f80f02aaaec9e93d40603c | tjhm9c/tjhm9c | /assignment_five/Staff.py | UTF-8 | 4,157 | 2.96875 | 3 | [] | no_license | """
@file Staff.py
@brief User Class for the Assignment Submission
@version v0.1
@par History v0.1 2/22/2020 : Initial Version
@par Description
DESCRIPTION---------------------------------------------------------------------------------------------------------... | true |
b4bddc5b8faab4bd2c9798b2ac906b6961ff0406 | birkoss/mtgstash-api | /core/helpers.py | UTF-8 | 2,583 | 2.546875 | 3 | [] | no_license | import cv2
import itertools
import json
import numpy as np
from django.db import models
from django.utils.text import slugify
from rest_framework import status
from rest_framework.response import Response
from urllib import request as urlreq
from urllib.parse import urlencode, quote_plus
def create_error_response(m... | true |
28f071aa976fb44135e565f599b2ba0c1ade1c69 | pyatkajeka/comics_fetcher | /comics_downloader/core/fetcher.py | UTF-8 | 622 | 2.53125 | 3 | [] | no_license | import urllib.request
import re
import requests
def find_link_for_image(page_content):
second_part_address = re.search('id=\"mainImage\" src=\"([^\"]+)\"', page_content).group(1)
image_link = "https://acomics.ru/" + second_part_address
return image_link
def page_source_request(string_with_link, counter)... | true |
f67a842a61f2ff308e2c2c95597f90e6fef51a30 | jmoiron/iris | /tests/lexer.py | UTF-8 | 1,497 | 3.125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""iris query tests."""
from unittest import TestCase
from iris.query import lexer as l
ME = l.FullFirstMatchException
class LexerTokenTest(TestCase):
def assertToken(self, token, type, name=None):
if isinstance(token, list) and len(token) == 1:
... | true |
67097d2ae4642e73dac16af9c0bd47b0c2800422 | jianer3456/SUSTechAPP_BackEnd_Django | /Webfunc/jwxt_Class.py | UTF-8 | 1,981 | 2.671875 | 3 | [] | no_license | # -*- coding: UTF-8 -*-
class Class(object):
"""docstring for Class_info"""
score = 0
Class_name = ""
Class_code = []
Class_major = ""
# 班级号码
Class_number = ""
Class_time = ""
Class_time_code = ""
# 课程类别(用来选课)
# JHXK KZYXK KNJXK GXK MR默认值
Class_Type = "MR"
... | true |
c2529adb86d6f36701dd0a10fc153f8b0e134b19 | mindspore-ai/mindspore | /tests/ut/python/rewrite/test_flatten_recursive_stmt.py | UTF-8 | 2,079 | 2.640625 | 3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"MPL-1.0",
"OpenSSL",
"LGPL-3.0-only",
"LicenseRef-scancode-warranty-disclaimer",
"BSD-3-Clause-Open-MPI",
"MIT",
"MPL-2.0-no-copyleft-exception",
"NTP",
"BSD-3-Clause",
"GPL-1.0-or-later",
"0BSD",
"MPL-2.0",
"LicenseRef-scancode-f... | permissive | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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 applicable law or agreed to... | true |
8ea8b34e7ad1690a6091a5018e1ecc33ba25d33c | windniw/just-for-fun | /leetcode/503.py | UTF-8 | 817 | 3.71875 | 4 | [
"Apache-2.0"
] | permissive | """
link: https://leetcode-cn.com/problems/next-greater-element-ii
problem: 求循环数组中每个数的下一个更大值,不存在时返回 -1
solution: 单调栈。遍历两次维护一个非严格递减的单调栈即可。
"""
class Solution:
def nextGreaterElements(self, nums: List[int]) -> List[int]:
stack, res = [], [_ for _ in nums]
for i, v in enumerate(nums):
... | true |
d20d4060e87fa9d6233673fc5c6fc162ee1666dd | EzioElofir/DS-lab | /out_modeling.py | UTF-8 | 3,133 | 2.9375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 28 11:51:36 2020
@author: Ema
"""
import pandas as pd
from utils_func import discretize_array, make_random_state
class Model:
def __init__(self, x_train, x_test, y_train, y_test, use_model):
self.x_train = x_train
self.x_test ... | true |
914cfc20be468e0be7d647f425ad4487ae7410e0 | go0d1uck/Desktop-environment | /main_win.py | UTF-8 | 1,490 | 2.984375 | 3 | [] | no_license | import sys
import string
# 这里我们提供必要的引用。基本控件位于pyqt5.qtwidgets模块中。
from PyQt5.QtWidgets import QApplication, QWidget,QPushButton, QAction, QMessageBox
from PyQt5.QtCore import QProcess
from PyQt5.Qt import QTextEdit
path = 'c:'
if __name__ == '__main__':
# 每一pyqt5应用程序必须创建一个应用程序对象。sys.argv参数是一个列表,从命令行输入参数。
app =... | true |
c7d1e4c1b904bb8683b5932f972f4214ffe484f7 | Joe-Jones/xpath | /tests/operators/arithmetic.py | UTF-8 | 634 | 2.59375 | 3 | [] | no_license | import unittest
tests = [
["1+2", None, 3],
["5+45", None, 50],
["1+2+3+4+5+6", None, 21],
[" 1 + 2 + 3 + 4 + 5 + 6 ", None, 21],
["5*5", None, 25],
[" 2 + 5 * 3", None, 17],
["1 div 2", None, 0.5],
["1div2", None, 0.5],
["1 * 2 div 2", None, 1],
[" (2 + 5) * 3", None, 21],
... | true |
797230d4ed2cf8ef2b1f63c1686a695be7a4dfae | Master-cai/opencv_learning | /源码/C02/2-3.py | UTF-8 | 415 | 3.15625 | 3 | [] | no_license | # coding = utf8
import threading, time
count = 0
class MyThread(threading.Thread):
def __init__(self, threadName):
super(MyThread, self).__init__(name=threadName)
def run(self):
global count
for i in range(100):
count = count + 1
time.sleep(0.3)
pr... | true |
28aa0d326ded87449a0d814905b0886adb240d5c | ericcheng09/LeetCodeSolution_Python | /Scripts/861.py | UTF-8 | 1,025 | 2.75 | 3 | [] | no_license | class Solution(object):
def matrixScore(self, A):
"""
:type A: List[List[int]]
:rtype: int
"""
row, col = len(A), len(A[0])
score = 0
# the left-most column could contribute the highest score
for y in range(row):
if A[y][0] == 0:
... | true |
4810ce367ae1e42267c1357606099086732dce69 | supermari0/cs224NFinal | /token_stats.py | UTF-8 | 6,912 | 3.390625 | 3 | [] | no_license | """ This program collects and outputs several important pieces of data for use
by the classifier, such as the top 1.5K bigrams. Much of this file is commented
out since additional data were added incrementally, and we didn't want to
overwrite previously processed data unnecessarily. """
from collections import defaultd... | true |
179b36107c776d356635757d166d18775e931a45 | GabrielaSmolen/QRS-extractor | /exercises/argparse_exercise.py | UTF-8 | 137 | 2.65625 | 3 | [] | no_license | import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--show", type=int)
args = parser.parse_args()
print(args.show)
| true |
409ab024784dc76892f452964def70f7be0d960f | iazzetta957/devops-ac5 | /com/grupoprimeiro/test/test_conta_corrente.py | UTF-8 | 520 | 2.765625 | 3 | [] | no_license | import pytest
from com.grupoprimeiro.conta_corrente import ContaCorrente
def test_alterar_nome():
conta_corrente = ContaCorrente(5, 'lucas')
conta_corrente.alterarNome('matheus')
assert conta_corrente.nomeCorrentista == 'matheus'
def test_deposito():
conta_corrente = ContaCorrente(5, 'lucas', 5)
... | true |
74e517b8690a91bf277b13e136af73acd00de055 | Zero0927/TCSS-480-Tkinter | /GuessNumber.py | UTF-8 | 2,458 | 3.421875 | 3 | [] | no_license | import sys
import random
import re
import tkinter as tk
flag = True
number = 0
num = random.randint(0,1024)
maxnumber = 1024
minnumber = 0
#Siyuan Zhou(Scott)
def Close(event):
root.destroy()
def Guessing(event):
global flag
global number
global num
global maxnumber
global minnumber
if fla... | true |
64e0ba906ca1b5b96506f6c27db877e89ba6d736 | VArdulov/alphantasy-hockey | /fantasy/scraping/utils.py | UTF-8 | 7,332 | 2.671875 | 3 | [] | no_license | import requests
import logging
from fantasy.scraping.config import (
base_url,
season_subfolder_format,
event_summary_uri,
game_summary_uri
)
from os import path
from bs4 import BeautifulSoup
from dataclasses import dataclass
from pandas import to_datetime, read_html
from pandas.errors import ParserEr... | true |
980978cc9df09f5ad451bb573397bb4f30808c9e | yxu02/RobuSTAI | /nlpoison/defences/defence_spectral_func.py | UTF-8 | 7,771 | 2.71875 | 3 | [] | no_license | def spectral_defence_tran(
overwrite_config,
config_dir,
load_activations = True,
dset_path = '',
poisoned_model_dir = '',
output_dir = '',
task = '',
max_examples = 500,
batch_s = 12,
eps_mult = 1.5,
label_strata=True):
"""
This function runs spectral signature ... | true |
74e0c7d4b439328acba651fd195605ee077754c2 | 3d-pro/harmonic_progression_matcher | /example/hpa_analyzer/python/HPA_HPSS.py | UTF-8 | 6,749 | 3.140625 | 3 | [] | no_license | def HPSS(x,nfft,noverlap,window,gamma,alpha,kmax):
# [xharmony,xpercussion]=HPSS(x,nfft,noverlap,window,gamma,alpha,kmax)
#
# Splits the harmony and percussion of a wavfile.
# Prerquist: Fourier transformation function: stft.m/istft.m
#
# INPUTS
# x - wavfile, mono
# ... | true |
2ac95109d68a1b083060216e8f918941b5e34471 | JinnieJJ/leetcode | /87-Scramble String.py | UTF-8 | 775 | 2.859375 | 3 | [] | no_license | class Solution(object):
def isScramble(self, s1, s2):
"""
:type s1: str
:type s2: str
:rtype: bool
"""
if len(s1) != len(s2):
return False
n = len(s1)
dp = [[[False for _ in range(n+1)] for _ in range(n)] for _ in range(n)]
... | true |
e5117e0d8c1ee62c7d405712d8f193129bc743e1 | ksanu/MyRecomendationSystem | /DataPreparators/DPwithMovieGenresCountriesAndDirectors.py | UTF-8 | 6,799 | 2.84375 | 3 | [] | no_license | import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import roc_curve, auc
from sklearn.linear_model import LogisticRegression
import xgboost as xgb
from sklearn.preprocessing import OneHotEncoder
from scipy.sparse import csr_matrix, hstack
class DPwithMovie... | true |
4a22182710e91f13c2d561133619ff4daad10bae | NarendraPatwardhan/gym_venv | /model.py | UTF-8 | 5,242 | 2.65625 | 3 | [
"MIT"
] | permissive | import numpy as np
import mxnet as mx
import matplotlib.pyplot as plt
#-----------------------------------------------------------------------------
class StateModel(mx.gluon.Block):
def __init__(self,config):
super(StateModel, self).__init__()
self.config = config
x = mx.nd.array(self.con... | true |
b4754840b136eee7c0576d3c469d02274daecd0a | PauKell90/neatcmd | /cmd_each.py | UTF-8 | 882 | 3.09375 | 3 | [] | no_license | #!/usr/bin/env python
# vim:fenc=utf8
"""
Run each line as parameter for a command line.
-- parameter file --
aaa bbb ccc
ddd eee fff
ggg hhh iii
[EOF
% cmd_each parameter_file "echo $1 $2 $3"
# This runs:
echo aaa bbb ccc
echo ddd eee fff
echo ggg hhh iii
"""
import os, sys, re, string
def perf_cmd(cmd, args):
... | true |
bbeb014d599efdab8f7eb37a10c0f0fbe91cd4a3 | joaopedrolourencoaffonso/projeto_aej | /elastic_feeder/elastic_feeder.py | UTF-8 | 2,794 | 2.84375 | 3 | [] | no_license | from flask import Flask, jsonify, request
import subprocess, json, requests
app = Flask(__name__)
@app.route('/', methods=['GET'])
def index():
return "Hello Moon!"
@app.route('/add/<string:word>', methods=['GET', 'POST'])
def add(word):
try:
temp = word.split('|')
... | true |
22689b04c610c82df9602fc47f0dcdc839082d12 | GuilhermeOS/JovemProgramadorSENAC | /herançaClasses/carro/carro.py | UTF-8 | 738 | 3.359375 | 3 | [] | no_license | class Carro():
def __init__(self, consumo = None, tanque = 0):
self.consumo = consumo
self.tanque = tanque
def mover(self):
distancia = float(input("Informe quantos quilômetros percorreu: "))
tanqueFinal = 0
while distancia > 1:
if self.tanqu... | true |
5f2bda724a4c3ca6471919205e51eba2d1eab094 | angelcoder/humanize-calculator | /humanize_expression.py | UTF-8 | 1,328 | 3.203125 | 3 | [] | no_license | import humanize_number as hn
import digits_library as dl
import re
def valid_input(expression, operations):
if re.sub(r'[0-9\+\-\*\/\=]+', '', expression).strip() != '':
return False
if expression[0] in {'=', '/', '*'}:
return False
if expression[len(expression) - 1] in {'-', '+', '=', '... | true |
4e726ddf9bb0f0c1448efb2797d2de8ce1daeb34 | Rishabhh/LeetCode-Solutions | /String/RegexMatching_10.py | UTF-8 | 925 | 3.328125 | 3 | [] | no_license | # the most tricky part is how to deal with '*'
# Need to look forward for matching the star.
class Solution:
def isMatch(self, s, p):
"""
:type s: str
:type p: str
:rtype: bool
"""
d = {}
def dp(i, j):
if (i, j) not in d:
res = None... | true |
b41cdd814a0d61f49c444c0e774a4c3d43330c7b | ruixia/mini_ads_engine | /ad_filter.py | UTF-8 | 947 | 2.90625 | 3 | [] | no_license | from constants import (
MINIMUM_RELEVANCE_SCORE,
MINIMUM_CLICK_PROBABILITY
)
class AdFilter:
"""An ad filter object."""
@staticmethod
def filter(relevant_ads):
"""Filter out ads whose relevant score and click probability are below
the bar.
Args:
relevant_ads: ... | true |
cedb3416e2333b027b9d4f61f5284331124ccdd3 | nicoperetti/Tesis | /vectors.py | UTF-8 | 5,628 | 2.8125 | 3 | [] | no_license | """Word Embedding Script."""
# coding: utf-8
from os.path import exists, splitext
import argparse
import numpy as np
import json
import spacy
from gensim.models import KeyedVectors
import settings
from utils import progressbar
from bertEmb import BertModel
import io
def load_vectors(fname):
"""Load Vect... | true |
e812f7400e0b95de9b9aff1d6ad8f5b742d845fe | ilkersigirci/BoardGame | /src/getInstance.py | UTF-8 | 572 | 3.46875 | 3 | [] | no_license | import weakref
class MyClass:
_instances = set()
def __init__(self, name):
self.name = name
self._instances.add(weakref.ref(self))
@classmethod
def getinstances(cls):
dead = set()
for ref in cls._instances:
obj = ref()
if obj is not None:
... | true |
6dc795b7f1e91f17d613eb4aa16d3a63dd4320a9 | ncxt/ncxt_sxtcnn | /ncxt_sxtcnn/read_write_mrc.py | UTF-8 | 1,582 | 2.796875 | 3 | [] | no_license | import struct
import numpy as np
def read_mrc(filename):
input_image=open(filename,'rb')
num_ints=56
sizeof_int=4
nlines_header=10
num_chars=80
head1=input_image.read(num_ints*sizeof_int) # read 56 long ints
head2=input_image.read(nlines_header*num_chars) #read 10 lines of 80 chars
... | true |
f878fece58b9dc59490c6a5421fbf2bb45a36bcd | yskang/AlgorithmPractice | /baekjoon/python/combination_2407.py | UTF-8 | 425 | 2.734375 | 3 | [
"MIT"
] | permissive | import sys
if __name__ == '__main__':
n, r = list(map(int, sys.stdin.readline().strip().split(' ')))
com = [[0]*(n+1) for _ in range(r+1)]
for r in range(1, r+1):
for n in range(r, n+1):
if r == 1:
com[1][n] = n
elif r == n:
com[r]... | true |
baa7d1da89a40206993992b98dc7d5d2b989e359 | anshumanghosh95/Hotel-Management | /Hotel Management/main.py | UTF-8 | 1,379 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 11 22:46:27 2019
@author: AN389897
"""
from set_details import set_required_details
from flask import Flask, render_template, request, redirect, url_for, jsonify
app = Flask(__name__)
@app.route("/home", methods = ['GET'])
def home():
return render_... | true |
43ff3d6d73d13043ac40868965ca345b2c8493fe | shorya97/AddSkill | /DS & Algo/Week 2/Sorting/Sort List.py | UTF-8 | 1,381 | 3.5 | 4 | [] | no_license | # Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def sortList(self, head: ListNode) -> ListNode:
#using merge sort
#midpoint
if not head or not head.next:
return head
... | true |
5ebc08148171de94907e162ff940662364dd6bdd | poly451/Tutorials | /cartoon_portraits/myclasses.py | UTF-8 | 13,072 | 3.046875 | 3 | [
"MIT"
] | permissive | import os, sys
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cmd
import json
import utils
from shutil import copyfile
import constants as con
class MyShell(cmd.Cmd):
program_name = "Pick a Portrait"
intro = "Welcome to {}! Type help or ? to list commands.\n".format(program_name)
i... | true |
02cf18de9090b88f9b94fe8b0a5a53d637e14610 | expowheella/News-Portal-Module-D2 | /NewsPortal/NewsPaper/views.py | UTF-8 | 967 | 2.59375 | 3 | [] | no_license | from django.shortcuts import render
# импортируем класс, который говорит нам о том,
# что в этом представлении мы будем выводить список объектов из БД
from django.views.generic import ListView, DetailView
# импортируем модель Product из models.py
from .models import Post
# создадим модель объектов, которые будем вы... | true |
cfdb0e76bf710ea19b09709bd3bdb5bf9b63e154 | hoenza/acm_vahed_excel_converter | /mainPaein.py | UTF-8 | 4,221 | 2.625 | 3 | [] | no_license | import openpyxl
import xlsxwriter
ex_in = openpyxl.load_workbook('paye.xlsx')
sheet_in = ex_in['Sheet1']
ex_out = xlsxwriter.Workbook('output1.xlsx')
sheet_out = ex_out.add_worksheet('Merged')
for i in range(2, sheet_in.max_row + 1):
p = str(sheet_in['A' + str(i)].value)
p = p.replace('\n', '')
sheet_out.... | true |
dceb0e1a7a467f5bf7e11d5f9c1b9a17cf577aa3 | bhchen-0914/PythonCourse | /python函数/class1.py | UTF-8 | 1,018 | 4.21875 | 4 | [] | no_license | """
认识函数
终端python3内输入,help(函数名)可返回该函数介绍
函数特征:
1.功能性,一个函数必定会有目的
2.隐藏细节,调用者不必关注函数内部逻辑,只需关注结果
3.避免编写重复的代码
4.可以组织代码
函数的执行流程和调用顺序
"""
result = round(3.1415, 3) # round(unm1, num2)函数,表示将num1保留到小数点后num2位,并四舍五入
print(result)
# 自定义函数
# def func_name(parameter_list): def是构造函数关键字,后面跟函数名和参数列表
# pass
'''
def print(code): ... | true |
dc47e810dfd9c47dfc03faf101fc762b8620b8f4 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2550/60620/248479.py | UTF-8 | 418 | 2.84375 | 3 | [] | no_license | N,M=map(int,input().split())
p=[0 for i in range(N)]
for i in range(M):
s=input().split()
if(s[0]=='0'):
a=int(s[1])
b=int(s[2])
for j in range(a-1,b):
if(p[j]==1):p[j]=0
elif(p[j]==0):p[j]=1
if(s[0]=='1'):
num=0
a=int(s[1])
b=int(s[2])... | true |
ee952ff58d68c53a45540c05adcea4bcb0b86bcf | lluxury/pcc_exercise | /06/pet_list.py | UTF-8 | 281 | 3.09375 | 3 | [
"MIT"
] | permissive | pet1 = {'type': 'cat', 'owner': 'cl'}
pet2 = {'type': 'dog', 'owner': 'cl2'}
pet3 = {'type': 'mouse', 'owner': 'cl3'}
pets = [pet1,pet2,pet3]
# print(friend['first_name'])
# print(friend['last_name'])
# print(friend['age'])
# print(friend['city'])
for pet in pets:
print(pet) | true |
67505ef22978d11b89119cf0d068dc97bb2e3a48 | incrl/portfolio | /CS355 Python Curriculum/Lab9/Old/Lab9-ImageWarping.py | UTF-8 | 626 | 3.09375 | 3 | [] | no_license | from scipy.ndimage import imread
import matplotlib.pyplot as plt
import numpy as np
tv = imread('tv.jpg')
plt.imshow(tv,cmap="Greys_r",vmin=0)
plt.show()
cat = imread('cat.jpg')
plt.imshow(cat,cmap="Greys_r",vmin=0)
plt.show()
class Point():
def __init__(self,x,y):
self.x = x
self.y = y
s0 = Point(0,0)
s1 = Po... | true |
03880e256a45b3a12553303da73b6a4e8232a9f3 | Paxton0222/Python-AI-class | /題目20200728/第四章/Ch4_2_1.py | UTF-8 | 255 | 3 | 3 | [] | no_license | import requests #導入requests庫
#https://requests.readthedocs.io/en/master/user/quickstart/ #requests official webpage
r = requests.get("http://www.google.com") #使用 requests庫中 get(url)方法取得資料
print(r.status_code) #http狀態碼 | true |
fc7396aa8e9de1059f86580307d77bcc996a1f00 | RuiWu-yes/leetcode | /Python/Algorithms/String/字符串基础/字符串操作问题/917 E_仅仅反转字母.py | UTF-8 | 1,660 | 4.1875 | 4 | [] | no_license | # -*- coding: utf-8 -*-
# @Author : ruiwu
# @Email : ryanwoo@zju.edu.cn
# @Title : 917 仅仅反转字母
# @Content : 给定一个字符串 S,返回 “反转后的” 字符串,其中不是字母的字符都保留在原地,而所有字母的位置发生反转。
class Solution:
def reverseOnlyLetters1(self, S: str) -> str:
# 双指针
ls = list(S)
left, right = 0, len(ls) - 1
while ... | true |
a27750fdeb60abe83fceddd6bcd369d5f3f53afb | mattbellis/Siena_College_Amanda_Depoian | /particle lifetime.py | UTF-8 | 746 | 3.03125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed May 28 11:58:12 2014
@author: Amanda
"""
import matplotlib.pylab as plt
import math
lifetime = [2.197*10**-6,2.906*10**-13,2.6*10**-8,8.4*10**-17,1.2380*10**-8,8.954*10**-11,5.116*10**-8,1.040*10**-12,1.638*10**-12,1.530*10**-12,7.2*10**-21,1.21*10**-20]
particles = ["$\mu^+... | true |
0cf111952a9f4586656b2180b185f69478d3c754 | Palem1988/coinbasepro-python | /tests/test_public_client.py | UTF-8 | 2,567 | 2.703125 | 3 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | import pytest
import time
from itertools import islice
import datetime
from dateutil.relativedelta import relativedelta
from cbpro.public_client import PublicClient
@pytest.fixture(scope='module')
def client():
return PublicClient()
@pytest.mark.usefixtures('client')
class TestPublicClient(object):
@static... | true |
7f32b1015a6a4b54ccb190d6357d603140497036 | jing1988a/python_fb | /amazon/amazon_oa/BST_distance.py | UTF-8 | 1,812 | 3.9375 | 4 | [] | no_license | # Given a list of numbers, construct a BST from it and find the distance between two nodes.
# int bstDistance(int[] values, int node1, int node2)
class Problem:
def solve(self, nums, node1, node2):
# what if node1 or node2 not in nums?
l = len(nums)
if l < 2:
return 0
ro... | true |
7b1c78dc6d4093b080e31c42f05292487c5fc313 | pedro95gomes/evg_simulation | /gamecontroller.py | UTF-8 | 4,530 | 2.90625 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import game
import random
from game import Game
def setInitialAction(matrix):
for row in range(len(matrix)):
for column in range(len(matrix)):
player = matrix[row][column]
if(random.random() < player.getProbability()):
player.setAction("C")
else:
p... | true |
37ab29b669132f5557e2450f48b6c8734e7eb94e | ShadowTender/Blockchain | /lab_blockchain/block.py | UTF-8 | 1,580 | 3.25 | 3 | [] | no_license | import json
import hashlib
class Block(object):
def __init__(self, header, transactions):
# Store everything internally
# header is a BlockHeader and transaction is a list of Transaction
self.header = header
self.transactions = transactions
self.N_STARTING_ZEROS = 4
de... | true |
47bd9b60701f86ca2eef6f48ebf5f18b5325ba9b | vinayya/FedFusion | /model/cifar_models.py | UTF-8 | 5,539 | 2.609375 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
from itertools import chain
import copy
import torch
from torch import nn
import torch.nn.functional as F
class CifarModel(nn.Module):
def __init__(self, num_class=10):
super().__init__()
self.features = nn.Sequential(
# conv1
nn.Conv2d(3, 64, kerne... | true |
52ecee226515998b5d367a38de4f67270edd3782 | vnb/ML-Python | /ex2/ex2_reg.py | UTF-8 | 4,394 | 3.53125 | 4 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 13:17:51 2018
@author: varshabhat
"""
#%% Machine Learning Online Class - Exercise 2: Logistic Regression
#%
#% Instructions
#% ------------
#%
#% This file contains code that helps you get started on the second part
#% of the exercise which... | true |
a5f1b01e38fb1eaca2b772af3a1cef5cd88fdfe1 | dtahoa/training-python | /src/daos/channel_dao.py | UTF-8 | 5,061 | 2.75 | 3 | [] | no_license | """
src/daos/channel_dao.py: Channel Dao
Copyright 2017-2018 LinhHo Training.
"""
from datetime import datetime
import pytz
from src.models.channel import Channel_Model
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
def insert_channel_from_db(session, channel_model):
"""
Insert channel in... | true |
d7c5b0c40364022c3487c0383506c814eedf5a98 | brandann/GarbageCode | /PYTHON/Examples/countdown.py | UTF-8 | 243 | 3.203125 | 3 | [] | no_license | import time
dur = int(raw_input("How long should I countdown for? ")) #dur = duration of time the timer will count for
for i in range (dur-1,0,-1):
for star in range(i):
print "*",
print
time.sleep(.001)
print "BLAST OFF!"
| true |
7c5f4549612af052430f82546ddae772c4942000 | jszendre/portfolio | /HierarchicalRNN/rnn_decoder.py | UTF-8 | 4,467 | 2.65625 | 3 | [] | no_license | import torch
from torch.autograd import Variable
from torch import nn
from torch.nn import functional as F
import numpy as np
"""
What exactly serves as the context vector(s)
-for multilayer ContextRNN does its final hidden state
for each layer count as the initial hidden in each
layer of the DecoderRNN?
Train t... | true |