blob_id stringlengths 40 40 | content_id stringlengths 40 40 | repo_name stringlengths 5 114 | path stringlengths 5 318 | language stringclasses 5
values | extension stringclasses 12
values | length_bytes int64 200 200k | license_type stringclasses 2
values | content stringlengths 143 200k |
|---|---|---|---|---|---|---|---|---|
f98b1cbd19c0688e6c4c8ad7d82623ed404931e1 | d6cc259c8617f35eabf0ab77389856d7d775cc8a | muhammedfurkan/aiogram | /aiogram/types/successful_payment.py | Python | py | 628 | permissive | from . import base, fields
from .order_info import OrderInfo
class SuccessfulPayment(base.TelegramObject):
"""
This object contains basic information about a successful payment.
https://core.telegram.org/bots/api#successfulpayment
"""
currency: base.String = fields.Field()
total_amount: base... |
e11884bcf6da3325a40e27597fc5e932e2c1be58 | 043f31a86b2ba5abd72bfe8d107e0acfe217abcb | ouyangqq/Bioinspired_Haptic_Feedback_sys | /ultils.py | Python | py | 4,797 | no_license | from scipy import optimize
import math
import numpy as np
from scipy import stats
filepath='/home/justin/share/figures_materials/single_receptor/'
def wilcoxon_signed_rank_test(y1, y2):
res = stats.wilcoxon(y1, y2)
print(res)
def wilcoxon_rank_sum_test(x, y):
res = stats.mannwhitneyu(x ,y)
print(res)
... |
fdb9c3f9751427a1696f0c8ff21e42be941bb33f | 1139953b1f213dd630da58018f8387e1be52fa6d | Immaannn2222/holbertonschool-higher_level_programming | /0x08-python-more_classes/7-rectangle.py | Python | py | 1,712 | no_license | #!/usr/bin/python3
"""Rectangle Class"""
class Rectangle:
"""Rectangle proporties"""
number_of_instances = 0
print_symbol = "#"
def __init__(self, width=0, height=0):
self.width = width
self.height = height
Rectangle.number_of_instances += 1
@property
def width(self)... |
d9e20cbe3e9870f56d927cc5c51c07e76be7bf0c | 6868be8622a31ffd64b6ea4fce2033498c481272 | kayzhou/exp_user_behaviour | /personality_predict/feature_handler_v3.py | Python | py | 6,248 | permissive | # -*- coding: utf-8 -*-
__author__ = 'Kay'
import datetime
import json
import os
import re
import numpy as np
import pandas as pd
import pendulum
keywords = [w.strip() for w in open("data/keywords.txt")]
def load_user_data(in_name):
'''
载入用户全部数据
:param in_name:
:return:
'''
user_data = []
... |
47a4e3353d1c16888b0e5c481bb06e54df413ea8 | 60ab8b7205c0f4594fe5d1967a1870d939eb0ba6 | ksmpooh/SungminCode | /KCDC/HLAsequencing/short-read/03.combineGVCF_conda.py | Python | py | 1,595 | no_license | import os,glob
inDir = "/BDATA/smkim/HLA_seq/short-read/02.variant.call/gatk"
outDir = "/BDATA/smkim/HLA_seq/short-read/03.joint.calling"
refDir = "/BDATA/smkim/HLA_seq/REF"
#HLA.Shortread.Seq.NIH19KT2304.trimmed.align.sorted.dedup.GATK_haplotypeCaller_VariantCalling.gvcf.gz
def CombineGVCFs():
gvcfs = open(inD... |
b7f100860fc3e4c1eff479fa81719a98e943aac0 | 9a3b55b2d8aef4ef4b0412a5b44f269256818b71 | Bruce6110/bookstore_project | /books/migrations/0002_review.py | Python | py | 888 | no_license | # Generated by Django 2.2.6 on 2020-02-13 15:01
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('books', '0001_initial'),... |
96da319b383d816d2ebe3356910bfc99e3caab60 | 98d6cd5ab876151bba0a5681b78c8db07cfd4bc1 | devetrycodeforward/09-analyze-text | /test.py | Python | py | 844 | no_license | from analyze_text import analyze_text
test_cases = [
{
"input": "Eeeee",
"output": "The text contains 5 alphabetic characters, of which 5 (100.00%) are 'e'."
},
{
"input": "Blueberries are tasteee!",
"output": "The text contains 21 alphabetic characters, of which 7 (33.33%) ... |
029bce68fbb1fd71888119e9be600b67df28ae5a | 3f059a1de73112215e19e8d09abdfd452e3837d2 | alexjercan/algorithms | /old/leetcode/problems/validate-binary-search-tree.py | Python | py | 765 | no_license | import math
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def isValidBST(self, root: TreeNode) -> bool:
def validate(node, low=-math.inf, high=math.inf):
# Empty trees ar... |
985c3943be9ab9571a60caddcb3abf5e65ad1a3f | ac48925f1605f65b16ad512d8353619e4552a08b | interestingLSY/intOJ | /web/sites/problemdel.py | Python | py | 286 | permissive | #coding:utf-8
from flask import *
import pymysql
import db,modules
def Run(problem_id):
if not modules.Current_User_Privilege(2):
flash(r'无此权限','error')
return modules.Page_Back()
db.Execute("DELETE FROM problems WHERE id=%s",problem_id)
return redirect('/problemlist')
|
018e789e87b43cd83b0547c56b14c62e69830334 | ea4be060290730da75aee6db8f60dc91ade88fbf | hkxIron/hkx_tf_practice | /test_numpy/test_sklearn/encoder/rank_encoder.py | Python | py | 2,052 | no_license | import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class RankEncoder(BaseEstimator, TransformerMixin):
def __init__(self, method='min', na_option='keep'):
"""
method : {'average', 'min', 'max', 'first', 'dense'}, default 'average'
How to rank the gro... |
13961733a2c7631a32cbcf8713be8344c35a487b | b1704f4352ea2257e206ea7a541751cff69576c2 | pinkeshb/radiosity | /2D/analytical1/haar/wavelet/errors/kernel_haar_phi.py | Python | py | 472 | no_license | from mpmath import *
def project_kernel_haar_phi(n):
# kernel
f1 = lambda s, t: s - t
f = lambda s, t: f1(s, t) * pow(n, 0.5) * pow(n, 0.5)
K = matrix(n, n)
for i in range(0, n):
for j in range(0, n):
K[i, j] = quad(
f, [i / float(n), (i + 1) / float(n)], [j / ... |
b4c33b4ab6e708bc5433060f2f3170fa09c2e03e | cc9afb92d4f72c4a769d41457b9a46ab2fbd5d9e | acabhishek942/django-upload_app | /handle_upload/urls.py | Python | py | 511 | no_license | # -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from django.conf import settings
from django.conf.urls.static import static
from django.views.generic import RedirectView
urlpatterns = patterns('',
(r'^home/', include('handle_upload.upload_app.urls')),
... |
324fb34dd8430c4e72a47255b74213337348ff91 | d0c1123f88a41a68b644eef7a93fd8303f01082d | MyHiHi/tornado_server | /同步和异步/async.py | Python | py | 5,662 | no_license | # coding=utf-8
import time,threading
# def thread_run(fn):
# def run(*args):
# print args,'start'
# fn(*args)
# print args,'over'
# return threading.Thread(target=run).start()
# @thread_run
# def fn1(name):
# print name,'begin......'
# @thread_run
# def fn2(name):
# ... |
5bf7bbaa5304f93b6af4bf3d144dbb889dd0177e | bc923be36419935f65f00e23c71fe39841443bc4 | koleopteros/CameraProject | /PILpractice.py | Python | py | 281 | no_license | import os
from PIL import Image as img
im = img.open('test3.png')
print(im.format,im.size,im.mode)
for root,dirs,files in os.walk(".\800x600"):
print(root)
#for d in dirs:
# print(dirs)
for filename in files:
print(filename)
im.show()
|
f44e7f05a25075599807268ed15c3c700d9d1e2d | 98cfe30f31fe5c4be4c18b953ce7bf23c6ad6c9d | Itay2805/mcserver | /scripts/generate_items.py | Python | py | 1,033 | permissive | from ctypes import *
from datetime import datetime
import os.path as path
import urllib.request
import json
# TODO: switch to using go:generate
# This has all of the data we need
import stringcase
with urllib.request.urlopen("https://raw.githubusercontent.com/PrismarineJS/minecraft-data/master/data/pc/1.1... |
be4cdaadaf67b570aa2279016833f5168ceb6472 | 195d564203df4b41b14ff7257d2ca9a62d434b80 | AlertBear/ovirt-manager-auto | /art/tests/rhevmtests/networking/labels/fixtures.py | Python | py | 1,807 | no_license | #! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Fixtures for labels
"""
import pytest
import rhevmtests.networking.config as conf
import art.rhevm_api.tests_lib.high_level.hosts as hl_host
from art.rhevm_api.tests_lib.low_level import (
hosts as ll_hosts,
networks as ll_networks
)
@pytest.fixture(scope="cla... |
d75b28b4b8bb64e8394d27ee85e42185b22810b7 | 63de214bc4777351f11f938469b96b9d9d909207 | Sarkar22/Using-SVM-to-make-prediction | /SVM_carpred.py | Python | py | 2,685 | no_license | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 20 15:18:01 2020
@author: Dell
"""
# import libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# importing dataset
dataset=pd.read_csv('SVMdataset.csv')
X=dataset.iloc[:,[2,3]].values
Y=dataset.iloc[:,4].values
# splitting... |
c4cc2b15c19c1b627d51bc7e5d4c2e228def5df5 | a3d2af5503937471e84d01a4d61b4754c767bc94 | Liunrestrained/Python- | /Chapter3/Pan/Pan_S/utils/method.py | Python | py | 4,877 | no_license | import struct # 处理粘包
def send_message(conn, content): # 两个参数:1.用户的连接、2.消息的内容
"""将消息发送给客户端,并将数据去粘包处理,也就是增加头部和字节长度"""
data = content.encode("utf-8") # 将消息内容转码,赋值给data
header = struct.pack("i", len(data)) # 加入头部文件以及数据的字节长度
conn.sendall(header) # 先发头部和长度
conn.sendall(data) # 再发字节文件本身
... |
eda8a3d9bd2998e72cc64c7f6b8f6fb5e425d803 | f0aad8fa0443847bcddf053aa16a8ad631adbca0 | linkedinyou/nova | /nova/tests/functional/v3/test_pause_server.py | Python | py | 2,119 | permissive | # Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... |
93a4ccea75beef700b33dd131057016e627d1cb7 | e106e2ddd216c7b0d2bb68f8573dd1a2517a65a7 | jorgegomesen/djangosecommerce | /catalog/tests/test_models.py | Python | py | 700 | permissive |
from django.test import TestCase
from model_mommy import mommy
from catalog.models import Category, Product
from django.core.urlresolvers import reverse
class CategoryTestCase(TestCase):
def setUp(self):
self.category = mommy.make('catalog.Category')
def test_get_absolute_url(self):
self.asser... |
55342f2479cfc12fff4d6ac7d406b0b0651fb3da | 3dbe0f7fc13191e08ac728d645d24e6fe395803c | worachai3/ZeabusHomework | /simple_cal_pub_sub/src/simple_cal_subscriber.py | Python | py | 699 | no_license | #!/usr/bin/python2
import rospy
from simple_cal.msg import simple_cal_msg
def callback(recieveData):
if recieveData.sign == 'plus':
sign = '+'
elif recieveData == 'minus':
sign = '-'
first_num = recieveData.first_num
second_num = recieveData.second_num
msg = '%d %s %d = '%(first_n... |
3476fc060c792578011d1beccccf5237630a3de9 | d9c64c5071d256e29204f53ed05bd1a7199f87a8 | utahrobotics/pozyx_ros | /nodes/stationary_anchors.py | Python | py | 2,234 | permissive | #!/usr/bin/env python2
from __future__ import division
import rospy
import pypozyx
from pozyx_ros import PozyxCluster
from pozyx_ros.msg import DeviceRange
from std_msgs.msg import Header
from geometry_msgs.msg import (PoseStamped, Pose, Vector3)
class StationaryAnchors(object):
"""
A pozyx node that accounts for ... |
f54eec020618964c9ddb36e44bdb4bc8f848aeb1 | 75ed1603de09adf83d3e344f18ac291d9736a0bd | will0206/2021-ChatBot | /04_Flask AppEngine/webSite/check.py | Python | py | 1,914 | no_license | from firebase_admin import credentials, firestore, initialize_app
from config import keyFile, storageBucket
class CheckFootprints:
def __init__(self, event):
cred = credentials.Certificate(keyFile)
initialize_app(cred, {'storageBucket': storageBucket})
self.__db = firestore.client(... |
fb60c94268152476f619551b7c4afd48672fb4ef | 0309295804a9e7d6291e79686f171f47f57e0d3d | RoganDawes/vncdotool | /setup.py | Python | py | 1,390 | permissive | #!/usr/bin/env python
from setuptools import setup
README = open('README.rst', 'rt').read()
setup(
name='vncdotool',
version='0.10.1dev0',
description='Command line VNC client',
install_requires=[
'Twisted',
"Pillow",
],
tests_require=[
'nose',
'pexpect',
]... |
4b0478670704969cdb3880a7f70981bfbd8c6815 | 4ad589000c675bf27b2ce966f8d140b24abb9685 | happy20200/segmentation-renormalized-harmonization | /mains/train_seg_kfold.py | Python | py | 9,098 | no_license | import os, sys
sys.path.append('../')
from data.retouch_loader import h5RETOUCH, TestRETOUCH
from data.ixi_loader import h5IXI, TestIXI
from data.msseg_loader import msseg, msseg_test, msseg_k_fold, msseg_k_fold_test
from data.msseg_h5 import scanner1, scanner2, scanner3
from configs.train_options import TrainOptions
f... |
980050b1b521259d1895de891bba0260fe330912 | 160beee3baee201eeb8463b3b66b97b09703a26d | reenadhawan1/Django | /Django/MultipleApps/apps/users_app/views.py | Python | py | 401 | no_license | from django.shortcuts import render, HttpResponse
def register(request):
response = 'placeholder for users to create a new user record'
return HttpResponse(response)
def login(request):
response = 'placeholder for users to login'
return HttpResponse(response)
def index(request):
response = 'plac... |
491da2c17b04533351b22c8b994b83c4f32927bd | 49a843359df99328240c4f94eb83bc330d442a34 | Yidi0912/ChalkBox | /src/assignments/admin.py | Python | py | 341 | no_license | from django.contrib import admin
# Register your models here.
from .models import Assignment
class AssignmentModelAdmin(admin.ModelAdmin):
list_display = ["__str__", "title", "due_date", "points"]
search_fields = ["title"]
ordering = ["due_date"]
class Meta:
model = Assignment
admin.site.register(Assignment, A... |
6c057bbefbd95f7d9c23e97757052439e66ce706 | 6f6a322bf344ff836343b277ab29450bf9f1e17b | rutube/eventlet | /eventlet/greenio.py | Python | py | 19,573 | permissive | import errno
import os
from socket import socket as _original_socket
import socket
import sys
import time
import warnings
from eventlet.support import get_errno, six
from eventlet.hubs import trampoline
__all__ = ['GreenSocket', 'GreenPipe', 'shutdown_safe']
BUFFER_SIZE = 4096
CONNECT_ERR = set((errno.EINPROGRESS, e... |
b60add8bfe4560e043255d4ff8592a7e534f19fe | 75f1547f3ee0237030b888d78a286f12710f9f6e | danielhermawan/reddit-daily-programmer-challenge | /python/game_of_three.py | Python | py | 447 | no_license | """
Easy Challenge
Reddit Case Link: https://www.reddit.com/r/dailyprogrammer/comments/3r7wxz/20151102_challenge_239_easy_a_game_of_threes/
"""
try:
number = int(input('Please Input the number: '))
while number != 1:
modulo_result = (0, -1, 1)[int(number % 3)]
print("%d %d" % (number, modulo_re... |
e6cc655c514ade4b86a5c9a5c95d97c102725986 | 6996ca95244afaf51f133b06547d8fa27433f259 | michellesri/cs61a | /notes/recursion.py | Python | py | 4,935 | no_license | # mutually recursive is even and odd function
def is_even_mutual(n):
if n == 0:
return True
return is_odd_mutual(n - 1)
def is_odd_mutual(n):
if n == 0:
return False
return is_even_mutual(n - 1)
# turn into one recurisve function
def is_even(n):
if n == 0:
return True
i... |
9f5a4f46e95c6904dc845e45f572c17882c540b3 | 3afd30c7e7885ab4a65c03a919b36c83c7e1f015 | christianpostprivate/DungeonCrusaderV03 | /src/utilities.py | Python | py | 6,404 | no_license | import pygame as pg
import json
import settings as st
vec = pg.math.Vector2
def clamp(var, lower, upper):
# restrains a variable's value between two values
return max(lower, min(var, upper))
def collide_hitbox(one, two):
return one.hitbox.colliderect(two.hitbox)
def collide_with... |
fdcc12143b589231673f212330d7f50049da4d9c | efa1043994109ef7d8b1b0aa02b7e0bdca149a77 | adamltyson/cellfinder | /tests/tests/test_integration/test_extract.py | Python | py | 4,897 | permissive | import os
import pytest
import imio
import numpy as np
from tifffile import tifffile
from imlib.cells.cells import Cell
from imlib.IO.cells import get_cells
from imlib.general.system import (
delete_directory_contents,
get_sorted_file_paths,
)
import cellfinder.extract.extract_cubes as extract_cubes
data_d... |
b6d71ece08f9be79b787c8c4776cff3f315e3f37 | d386f5959192cde1629f7d0d816717340e0dd656 | OMEGAYALFA/bitcoinx2project | /contrib/pyminer/pyminer.py | Python | py | 6,435 | permissive | #!/usr/bin/python
#
# Copyright (c) 2011 The Bitcoin developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
import time
import json
import pprint
import hashlib
import struct
import re
import base64
import httplib
import... |
febab8c4f607a08ce002303dfec66992d8e2a05e | b9ffcfd09934780e795f8976d597572982ac970a | 1600kabir/wifiless-website | /app.py | Python | py | 1,856 | permissive | from flask import Flask, render_template, url_for, redirect, request
from flask_wtf import Form
from wtforms import FileField, SelectField, SubmitField
import os
from werkzeug import secure_filename
from webui import WebUI
import json
import csv
from return_keyphrases import *
from bs4 import BeautifulSoup
import reque... |
c430393dfb42bba98183de73fbda1949e3f3f482 | c935142828325b5cdedae02b3c749383ae3c953c | Jayanto-stack/HatSploit | /hatsploit/commands/log.py | Python | py | 1,478 | permissive | #!/usr/bin/env python3
#
# This command requires HatSploit: https://hatsploit.netlify.app
# Current source: https://github.com/EntySec/HatSploit
#
import os
from hatsploit.lib.config import Config
from hatsploit.lib.storage import GlobalStorage
from hatsploit.lib.command import Command
class HatSploitCommand(Comma... |
1e1386f3b9604ce0c0201b8c5c8ad1c7eb4ce48f | e127624e9aa66a6c8d0faebe860e2d8726b073ab | niyioyedele/sqlalchemy-challenge | /app.py | Python | py | 3,216 | no_license | #copy all of imports
#%matplotlib inline
from matplotlib import style
style.use('fivethirtyeight')
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
import matplotlib.dates as mdates
import numpy as np
import pandas as pd
import datetime as dt
#copy sql alchemy to set up engine and session
imp... |
faa8f129111891d89b5978b703fd264b92c02643 | 9d089d17d4fd0510304967dad8e974578cb32e0c | shback0708/Smartwardrobe | /user_interface.py | Python | py | 15,589 | no_license | import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'/clothing_recognition'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'/clothing_recognition/detector'))
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'/clothing_recognition/classifier'))
sys.path.insert(0, os.path.... |
5940f019f1faca53e34d4313db0e12893a58400b | b4360ad0e46de30b001ea5cd5389f796180e94bf | zynl/codeforces | /Inventory.py | Python | py | 487 | no_license | #http://codeforces.com/contest/569/problem/B
from collections import Counter
n = int(input())
A = list(map(int, input().split()))
def change_number(): #numbers needed
set_list = set(A)
for i in range(1, n + 1):
if i not in set_list:
yield i
C = Counter(A)
... |
52f3fbda4589a9600a90ba3f2813221a0224268a | 8125e5b9bde767be2114bebe1f970708ecba8928 | tputti2/NLP_projects | /Language Translation - IBM word alignment/hw4.py | Python | py | 10,651 | no_license | from datetime import datetime
# Constant for NULL word at position zero in target sentence
NULL = "NULL"
# Your task is to finish implementing IBM Model 1 in this class
class IBMModel1:
def __init__(self, trainingCorpusFile):
# Initialize data structures for storing training data
self.fCorpus = [... |
d6c655858fab726a4fb9670d344fd519f43833a8 | fc13c6fdb3af1223e5973c70146ded32916b9643 | VictorKamyshin/WebFirstSemestr | /askme/ask/views.py | Python | py | 16,473 | no_license | from django.shortcuts import render, render_to_response, redirect
from django.http import HttpResponse
from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.csrf import csrf_exempt
from django.core.paginator import Paginator, EmptyPage, PageNo... |
02943fcc7900609bfe77c3ad3108093a9679e9dd | b9834646d5a0c41c3661c002c73f216151773c06 | filipe-cavalcanti-fpb/SelecaoMegaPDV | /IFCardio/ifserver/ifserver/urls.py | Python | py | 1,007 | no_license | """ifserver URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
3efbb1aa39f2443b84000209a26657185b5297e7 | 2f495ce0fd0f0dc7f9234fa91aa86fafef6b32a8 | GoogleFoundation/pywikibot | /pwb.py | Python | py | 8,998 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Wrapper script to use Pywikibot in 'directory' mode.
Run scripts using:
python pwb.py <name_of_script> <options>
and it will use the package directory to store all user files, will fix up
search paths so the package does not need to be installed, etc.
"""
# (C) Py... |
d4eae69d59865c0344807686a4dfbed687cdcfd6 | 45d0a165c408e8b0be44000388587cbcfea37b8f | mikip65/ECS189M | /challenges/final/finalcrypto/substitution.py | Python | py | 340 | no_license | import random
letters="abcdefghijklmnopqrstuvwxyz"
perm=list(letters)
random.shuffle(perm)
trans=str.maketrans(letters+letters.upper(),
"".join(perm)+"".join(perm).upper())
with open("plain.txt","r") as i:
with open("cipher.txt","w") as o:
for l in i:
for c in l:
o.write(... |
8aca47739c761ca454eda69498e47509665aa46a | 2415a7cc3e20d6433742fe20b2ef24201a25bd09 | OseiasBeu/webScrapping | /.history/toolbox/middleware_20191129091524.py | Python | py | 2,916 | no_license | # -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.keys import Keys
from datetime import datetime
import toolbox.sheets as sheet
import pandas as pd
import numpy as np
def middleware():
driver = webdriver.Chrome(executable_path... |
9d1515c2a6c5a9bd9d96b489e1d99acae1957393 | fb0bd50e86b5570f89022fb1faffcd17ed1a11d7 | sebcherian/jupyter-analytics | /jupyteranalytics/__init__.py | Python | py | 752 | permissive | # jupyteranalytics
# Adds Google Analytics snippet to Jupyter and JupyterHub
#
# Author: PingThings
# Created: Tue Nov 26 11:54:33 2019 -0500
#
# Copyright (C) 2019 PingThings, Inc.
# For license information, see LICENSE.txt
#
# ID: __init__.py [] benjamin@pingthins.io $
"""
Adds Google Analytics snippet to Jupyter... |
8126f19c5cdc2d92fe9c66dd2e7657d815553043 | c0db0155123c55bb2a0eb7b5d4835dd69544fe60 | zhenming-xu/PyChemia | /setup.py | Python | py | 2,451 | permissive | import os
from setuptools import setup, find_packages, Extension
import json
try:
from Cython.Build import cythonize
from Cython.Distutils import build_ext
except ImportError:
USE_CYTHON = False
else:
USE_CYTHON = True
rf = open('pychemia' + os.sep + 'setup.json')
data = json.load(rf)
rf.close()
de... |
40b6731f1b64f275dfa2cccfdbca737c86c5db2c | 6b7d22c17f8d5b57672175e9d996d7f07393117e | realcome/gn_build | /build/android/gyp/bytecode_processor.py | Python | py | 1,714 | no_license | #!/usr/bin/env python
# Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Wraps bin/helper/java_bytecode_rewriter and expands @FileArgs."""
import argparse
import os
import sys
from util import build_util... |
762ad5298d61ee148d367bdeb1ff7ac8a8fd3339 | 6181e09db2656bf5f736c8ec06307620cda7b354 | catboost/catboost | /contrib/python/plotly/py2/plotly/graph_objs/indicator/__init__.py | Python | py | 59,713 | permissive | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Title(_BaseTraceHierarchyType):
# align
# -----
@property
def align(self):
"""
Sets the horizontal alignment of the title. It defaults to
`center` except for bullet ch... |
8ba5429557ca5dd8ddc8469f06c6517bbc7f3a7e | 0c3ef9620d7d61e2a23e1f9b53bcde138a4f8e8b | Aasthaengg/IBMdataset | /Python_codes/p03699/s202551072.py | Python | py | 247 | no_license | n=int(input())
s=[int(input()) for i in range(n)]
s.sort()
S=sum(s)
if S%10!=0:
print(S)
else:
for num in s:
if num%10!=0:
S-=num
if S%10!=0:
print(S)
exit()
print(0) |
98ff193f0d78ff954a6d2c00286b80401b8bef7d | b082c25d18fb89b9b44eaa215dd7283ee2b13e48 | cpe202spring2019/lab0-reemer30 | /planets.py | Python | py | 333 | no_license | def weight_on_planets():
# write your code here
earth = input("What do you weigh on earth? \n")
earth = float(earth)
mars = earth * 0.38
jupiter = earth * 2.34
print("On Mars you would weigh", mars, "pounds.\nOn Jupiter you would weigh", jupiter, "pounds.")
if __name__ == '__main__':
weight... |
bca3292be5f952958bf3a2e8d5cc5773e5bdf3c9 | 40e0eed1233c2f1f3ea44dade3fee4db54698d53 | Azure/azure-sdk-for-python | /sdk/connectedvmware/azure-mgmt-connectedvmware/generated_samples/create_hybrid_identity_metadata.py | Python | py | 1,692 | permissive | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... |
f07897b1e9c0424dea7f672737070e99991b4d1d | a04b7140558dcffed69fb8fcef5e887d17403049 | karimull/nova | /nova/api/openstack/placement/microversion.py | Python | py | 10,342 | permissive | # 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 in writing, software
# distributed under the... |
24da0fd1d3f2f326ebaeea92d51ae28d84ef2897 | c824d27cd699178b355e3b49235fff150f8456f4 | antrikshparashar570/System-Design | /TicTacToe/TicTacToe.py | Python | py | 2,249 | no_license | from user import User
from board import Board
class TicTacToeService:
def __init__(self, rows, columns, users):
self.userMoves = {}
for user in users:
self.userMoves[user.getId()] = []
self.users = users
self.Board = Board(rows, columns)
self.moves = []
def checkCase(self, x, y):
if x >= 0 and x < s... |
178ffbc4cd807d5cc2980c4ed27f0f16941bae84 | 0652898d5880fb95a2c2536540d97f0380cb7dd2 | Fridthoy/UNICEF | /main.py | Python | py | 298 | no_license | import os
import pandas as pd
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
def load_pickle_file(filename):
df = pd.read_pickle(ROOT_DIR + '\\pickle_files\\' + filename + '.pkl')
return df
if __name__ == '__main__':
df = load_pickle_file('Donor_File_Contacts')
print(df) |
79d37404e4c6b067f3376074020e2f65db76b722 | a3b54d07bf78ea05db8930186d49d761afc6edc2 | hakanozgur/nanodegree | /data-engineering/p5-data-pipelines/docker/plugins/operators/stage_redshift.py | Python | py | 2,961 | no_license | from airflow.models import BaseOperator
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseHook
from airflow.providers.postgres.hooks.postgres import PostgresHook
from airflow.utils.decorators import apply_defaults
class StageToRedshiftOperator(BaseOperator):
"""
Airflow plugin that copies fil... |
efdd6cfd04ee57c0dedb8633880d6ffbcb669f4b | 7fa678fe22061e2e813301d2f392402c4047fdf4 | jcsumlin/LapisMirror | /plugins/deviantart.py | Python | py | 6,386 | permissive | # The MIT License (MIT)
# Copyright (c) 2015 kupiakos
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... |
dc899499a74459532e621327ae2fe75f0fc0b1af | 2fee87c48ac562a3a53bb8f4c19360f8b2639a8f | pauloalcobia/hostap | /tests/hwsim/test_suite_b.py | Python | py | 5,675 | permissive | # Suite B tests
# Copyright (c) 2014-2015, Jouni Malinen <j@w1.fi>
#
# This software may be distributed under the terms of the BSD license.
# See README for more details.
import time
import logging
logger = logging.getLogger()
import hostapd
from utils import HwsimSkip
def test_suite_b(dev, apdev):
"""WPA2-PSK/G... |
e370b0af348e5133ab22ac76b65335737edb5283 | 47c7c9f54e2d603015b95aa2e4b153243880a3bb | dEbAR38/ITMO_ICT_WebDevelopment_2020-2021 | /students/K33401/Koretskaya_Lidiya/lab2/lab2/lab2/urls.py | Python | py | 793 | permissive | """lab2 URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vi... |
74c049c0f2cabb69f7a8205c67b3b0d7dec14014 | d2b9ee366ce2975378950f224150d45dc0a53e03 | jaymagrob/sei-project-4 | /boards/migrations/0002_board_comment.py | Python | py | 512 | no_license | # Generated by Django 2.2.9 on 2020-02-27 09:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('boards', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Board_Comment',
fields=[
('... |
947ab3d966d3362002ef895bb8df9927385de16c | 7281b67394932207ef18e5dc4aede1532f45003f | andrejeller/Learning_Python_FromStart | /Aulas/Mundo_01/Fase_09_ManipulandoStrings.py | Python | py | 2,864 | no_license | """
O que foi visto na aula 07.
- Manipulando Cadeias de Texto
Fatiamento de String
- frase[9] ... apenas o caractere 9
- frase[9:13] ... do caractere 9 até o 12
- frase[9:21:2] . do caractere 9 até o 21 pulando de 2 em 2 .. 9, 11, 13, 15, 17, 19
- frase[:5] ... do caractere 0 até o 4
- frase[15:] ... do caract... |
58ad65310f59ea568ad8ee7fbd07e44cb66b4214 | 998ca50c6e2cd13c7250cc49df0e91b8508777d2 | jinbooooom/coding-for-algorithms | /LeetCode/48-旋转图像/rotate.py | Python | py | 1,403 | permissive | """
https://leetcode-cn.com/problems/rotate-image
给定一个 n × n 的二维矩阵表示一个图像。
将图像顺时针旋转 90 度。
说明:
你必须在原地旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要使用另一个矩阵来旋转图像。
给定 matrix =
[
[ 5, 1, 9,11],
[ 2, 4, 8,10],
[13, 3, 6, 7],
[15,14,12,16]
],
原地旋转输入矩阵,使其变为:
[
[15,13, 2, 5],
[14, 3, 4, 1],
[12, 6, 8, 9],
[16, 7,10,11]
]
"""
f... |
7e570654d35f4f91b948c92f8c1f4ce667031e7f | dfed49dff6cb7ace8761c17f2602aec0d902f013 | DGG3D/make-clip | /make-clip.py | Python | py | 1,449 | permissive | # check python version, this script requires python3
import sys
if sys.version_info[0] < 3:
print('ERROR: This script requires Python 3')
sys.exit(1)
import os
import subprocess
from argparse import ArgumentParser
# ################################ #
# Main Program #
# #############... |
79d4d6e209c7cc050edc0351c5460776bca9416e | 40035e2784e80244df2c3a483cadeb493688c20d | depromeet/ZeroWaste_Server | /zerowaste/apps/mission/admin.py | Python | py | 350 | no_license | from django.contrib import admin
from apps.mission.models.mission import Mission
from apps.mission.models.certification import Certification
from apps.mission.models.likes import MissionLike, CertificationLiker
admin.site.register(Mission)
admin.site.register(MissionLike)
admin.site.register(Certification)
admin.sit... |
a7ef651c9f39e55e8a99861dcea9237b03abc1e7 | 1d99054acfd4daf950e45d6dd6eb15291caa82d1 | TejashDatta/data_visualisation | /_helpers/add_lat.py | Python | py | 1,724 | no_license | import json, csv
import urllib.request, urllib.parse
MAPS_API_KEY = 'AIzaSyAN7INNbgTIVwUR1bhKSH3Dml0DRUck6mY'
CSV_FILE_NAME = 'edu.csv'
def get_lat_long(place):
place_search_url = 'https://maps.googleapis.com/maps/api/place/findplacefromtext/json?'
place_detail_url = 'https://maps.googleapis.com/maps/api/plac... |
adf9a002252913d69fd1938665ecc6f71767c0aa | 9086d3c1b81f40a890547b38a898c1b3a25c84ac | openxla/iree | /build_tools/benchmarks/benchmark_helper_test.py | Python | py | 3,328 | permissive | #!/usr/bin/env python3
# Copyright 2023 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
import json
import unittest
import benchmark_helper
import tempfile
import path... |
947ab4e65e54efba23e0b08e4aad898a64c2a0bb | ede78d2fa167dfd77e21e841c1748508719ad256 | iovation/launchkey-python | /features/steps/directory_session_steps.py | Python | py | 2,217 | permissive | from uuid import uuid4
from behave import given, when, then
# Delete session
@when("I delete the Sessions for the current User")
def delete_session_for_current_user(context):
current_directory = context.entity_manager.get_current_directory()
user_identifier = context.entity_manager.get_current_user_identifie... |
89444224a6d3102a3187f863955bd0a20083a177 | d4d659f453c9e83f56b063784d51c22b8a998218 | Vjust/open-corroborator | /corroborator_app/migrations/0030_auto__add_field_actor_assigned_user.py | Python | py | 33,866 | no_license | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Actor.assigned_user'
db.add_column(u'corroborator_app_actor', 'assigned_user',
... |
c48c3312dc7fcbd5f6dfb496e77a0f2100c75fd6 | 7895bc2f4cfeff8d0b40e4732ed6631fd5aea692 | deyh2020/Abuse_Detection | /get_tweets.py | Python | py | 1,327 | no_license | # import required libraries
import tweepy
import time
import pandas as pd
pd.set_option('display.max_colwidth', 1000)
# api key
api_key = "Enter your API key"
# api secret key
api_secret_key = "Enter your API secret key"
# access token
access_token = "Enter your token key"
# access token secret
access_tok... |
243d15bf1ca268912645b507753a75dadbc06da7 | 473c72a38a89e37d3db67519a78f99fb537244e7 | NeolithEra/program-y | /test/programytest/processors/postquestion/test_stemming.py | Python | py | 1,728 | permissive | import unittest
from programy.processors.postquestion.stemming import StemmingPostQuestionProcessor
from programytest.client import TestClient
class MockBrain(object):
def __init__(self, question, response, client_context):
self._question = question
self._response = response
self._client_... |
b1c7967e009be10bd8d783fe86620f8f48465b5a | e0ffca385d0b69bff7c46eb59c32d2ef97d675bf | rootwish/cloudshare | /services/simulationco.py | Python | py | 4,206 | no_license | import ujson
import utils.companyexcel
import core.outputstorage
import services.company
import services.base.simulation
import extractor.information_explorer
class SimulationCO(services.base.simulation.Simulation,
services.company.Company):
YAML_TEMPLATE = (
("relatedcompany", li... |
9d67ea434e33a839a307a5eb83845cae982d4a7e | 00a9484e69c8a029796cdae94ceff51985bb5961 | ratschlab/projects2019-string-embedding | /code/python/utility.py | Python | py | 11,569 | no_license | from collections import Counter
import numpy as np
import select
import sys, os
import shutil
import argparse
from tqdm import tqdm
import time
from annoy import AnnoyIndex
from attrdict import AttrDict
import fasta_read as fasta
def proj_dir():
try:
home_dir = os.path.expanduser('~')
f = open... |
0897c5757cdc56017461a593e5f43c50ff98418f | f1a9d6d7720bdd116a4483200223135b004a5178 | UmbertoJr/my_Bi_Lstm | /my_model.py | Python | py | 17,679 | no_license | import tensorflow as tf
import numpy as np
class My_Model:
def __init__(self, hidden_Bi_Lstm, attention_hidden, graph):
self.embeddings_dim = 400 # dim sense-embeddings
self.output_class = 36
self.output_senses = 25915
self.hidden_Bi_Lstm = hidden_Bi_Lstm
self.attention_hidden = attention_hi... |
6318b3d3f96f7fcbfedba9ac6f35a3ad8bae6be5 | e771a563f650a3f0a1391f13d4d33289cba5d296 | markovianhq/convpy | /convpy/tests/conftest.py | Python | py | 4,690 | permissive | from itertools import chain
import os
from random import random
from uuid import uuid4
import numpy as np
from numpy.random import exponential
import pandas as pd
import pytest
from scipy.sparse import csr_matrix
from convpy.functions import conv_prob, hazard
from convpy.preprocessing import OneHotEncoderCOO
from con... |
564ed4cb9dd0da4ce948687aaf353a6226a45804 | 3aa521004f24ff336dd852e4336777f12f03973b | artisdom/XBox-360-AVR-flasher | /XFlash.py | Python | py | 6,804 | no_license | #!/usr/bin/env python
import usb
import sys
import struct
import pprint
import argparse
import code
pp = pprint.PrettyPrinter()
class ConsoleUI:
def opStart(self, name):
sys.stdout.write(name.ljust(40))
def opProgress(self,progress, total=-1):
if (total >= 0):
prstr = "0x%04x / 0x%04x" % (prog... |
159882955d7e3d389c9ca4660930a6d6b46624e1 | 6914530873d91151de82d69b708298ae5d12da1c | Dogknight/GNN | /project/code/ChebConv.py | Python | py | 2,059 | permissive |
import torch
import torch.nn as nn
import torch.nn.init as init
class ChebConv(nn.Module):
def __init__(self,in_c,out_c,K,normalization= True):
super(ChebConv,self).__init__()
self.weights = nn.Parameter(torch.Tensor(K,1,in_c,out_c))
init.xavier_normal_(self.weights)
... |
ef5c361f533c1e7f3c5a8c5a3a283121ef02dbd4 | feafb93165583292de62d7255e98ca6ec062ec72 | kosaris/CarND | /CarND-Advanced-Lane-Lines/perspective.py | Python | py | 1,295 | permissive | import pickle
import cv2
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob
#load camera calibration parameters
pkl_file = open('wide_dist_pickle.p', 'rb')
pkl_data = pickle.load(pkl_file)
mtx = pkl_data["mtx"]
dist = pkl_data["dist"]
#read the image and apply distortion c... |
2ac7bdf274aede884a0e173e59e4f28aa79c0deb | 5d1d6ef1e9f1f0a383b53d0dcb64ce891fa74c6f | muali/PyORM | /ORM/MongoDB/mongobase.py | Python | py | 1,477 | permissive | #!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
__author__ = 'Moskvitin Maxim'
from ORM.MongoDB.mongometa import MongoDBMeta
from ORM.exceptions import DatabaseException
class MongoBase(object, metaclass=MongoDBMeta):
_mongo_dict = {}
def __init__(self, engine, **kwargs):
super().__setattr__("engin... |
a4cbd0e3671882a91bca17657b74e5189c2c00f7 | 78d69a62a40dc38516ac630bf10e837e47b6964a | Chrlis-zhang/YingOps | /Django2YingOps/apps/assets/migrations/0003_auto_20200414_1646.py | Python | py | 923 | permissive | # Generated by Django 2.1.8 on 2020-04-14 16:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('assets', '0002_assetsinfo_product'),
]
operations = [
migrations.AlterField(
model_name='assetsinfo',
name='manufact... |
b508d2cf2da9ac3278b7c435e29559a7cc0a7f69 | 22eee36b3aef970a9585f73dda019c502dadbbec | mufarosimbisayi/python-showcase | /09_real_estate_analyzer/purchase.py | Python | py | 561 | no_license | class Purchase():
def __init__(self, purchase_dict):
self.street = purchase_dict["street"]
self.city = purchase_dict["city"]
self.zip = purchase_dict["zip"]
self.state = purchase_dict["state"]
self.beds = int(purchase_dict["beds"])
self.baths = int(purchase_dict["baths"])
self.sq__ft = purchase_dict["sq_... |
751541c79a3185decc974abc5fdfc61756f153a6 | b43db6ce6077693c5949e95b0a4347b8d739a374 | Kento-Obata/pyjpboatrace | /tests/test_certification.py | Python | py | 1,160 | permissive | import pytest
from pyjpboatrace.user_information import UserInformation
from pyjpboatrace.certification import login, check_login_status, logout
from pyjpboatrace.exceptions import LoginFailException
from ._utils import get_user_info
from ._driver_fixutures import driver_not_http_get_driver # noqa
@pytest.mark.skip... |
716f12f4df81bc63cdb1aac535c0d68537c77774 | 8b1cf653fc8ca1dab1e9afa29cea5d9b06251edd | Aasthaengg/IBMdataset | /Python_codes/p03340/s608675113.py | Python | py | 451 | no_license | def main():
ans = 0
n = int(input())
A = [int(i) for i in input().split()]+[10**9]
Sum = 0
right = 0
for left in range(n):
while(right<n):
if Sum^A[right] == Sum+A[right]:
Sum += A[right]
right += 1
else:
break
... |
420096f7c1c1d236f8d577275feb35d3c2d6fba3 | f670a2dc0bd695c001d648de266133b6ba2f470a | Jeffrey1202/comp9021 | /midterm/z5141180.files/question_1.py | Python | py | 1,787 | no_license | from random import seed, randint
import sys
def f(arg_for_seed, nb_of_elements, max_element):
'''
>>> f(0, 0, 10)
Here is L: []
The decomposition of L into longest sublists of even numbers is: []
>>> f(0, 1, 10)
Here is L: [6]
The decomposition of L into longest sublists of even... |
eef79ff22afc6b3a0051bf952b00fa806a73c075 | 7279dc65192f8e19f6cce9ce02e9207484e12793 | dczhang0/magenta | /magenta/music/encoder_decoder.py | Python | py | 29,237 | permissive | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... |
327137a773add05329d2fc2dc4e746da4f778714 | e69a1830b3e7269af082ca524aa7cde530eb89e7 | NiharikaGoel12/CS50 | /pset6/cash/cash.py | Python | py | 680 | no_license | from cs50 import get_float
def main():
change = get_float("Change owed: ")
if change >0:
calculate_change(change)
def calculate_change(change):
change = int(100 * change)
counter = 0
if(change % 25 != change):
counter += (change // 25)
change = change - (25* (change // 25)... |
4b145e622572cb1115d1d2343d9c9e6ed9563ea8 | 1f9542fea38dffb909f166b2db241cf8b4b8a898 | xuqisong/doutuba | /doutuba1.py | Python | py | 1,199 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# author:albert time:2019/1/12
#同步爬取
import os
import re
from urllib import request
import requests
from bs4 import BeautifulSoup
from lxml import etree
def parser_page(url):
print(url)
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64) App... |
9d4d30a811704ce5e8e0fa9312acda667501f38b | 00856ca74ac70c6b224dc5899360114744a5bdaa | ItsJasonPan/InterviewPractice | /practice questions/Bus_station.py | Python | py | 515 | no_license | lst = [1,2,1,1,1,2,1,3]
lstL = 8
import copy
possible = {lst[0]}
for i in range(1, lstL):
for k in range(0, i):
possible.add(sum(lst[k:i+1]))
tmp = copy.copy(possible)
result = []
for values in possible:
currentCount = 0
for elements in lst:
currentCount += elements
if currentCount ... |
294e18de0bcee31dd4bc48cc1553c686f85ebad4 | 34dc02af58671d98e9cf31b129e6f7d3da27b95a | mrunalinir/goop | /delivery_system/shop/migrations/0002_alter_product_category.py | Python | py | 409 | no_license | # Generated by Django 3.2 on 2021-04-21 11:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='product',
name='category',
fie... |
67d558a0057448519cd5abba3df93fee1a90bdef | 5dd01728fcbc4c092d331ee46f948557d6f7cb2a | Kulasus/PythonOOP | /singleInheritace.py | Python | py | 497 | no_license | class Apple:
manufacturer = "Apple Inc."
contactWebsite = "www.apple.com/contact"
def contactDetails(self):
print("To contact us, log on to ", self.contactWebsite)
class MacBook(Apple):
def __init__(self):
self.yearOfManufacture = 2017
def manufactureDetails(self):
print("T... |
0a617dc2878b4d1092621f6453bb9130715458c3 | 5f6e108675d15b3174b3e29c597aa3e4b23398a7 | Medisana/vitadock-api | /python/__init__.py | Python | py | 246 | no_license | # -*- coding: utf-8 -*-
"""
Vitadock OAuth dance Library
------------------
"""
from .api import VitadockOauthClient
# Meta.
__title__ = 'Vitadock OAuth'
__author__ = 'George Gkotsis'
__author_email__ = 'gkotsis@gmail.com'
__version__ = '0.1' |
84bc3f61ebac0b38bc6a97e90ab883bfd2e3183e | 88e914783ef3c0a1bc36a57ddc2655fef4795d73 | venkatesh551/SPOJ | /2015/July/cube_free_numbers.py | Python | py | 1,034 | no_license | '''
Created on 21-Jul-2015
@author: Venkatesh
'''
def read_int_list():
return [int(x) for x in raw_input().split()]
def read_int():
return int(raw_input())
class cube_free_num:
"""Store all the cube free numbers
"""
MAX_VAL = 1000001
def __init__(self):
self.num = [0 for _ in xra... |
355e468cdda790dd18ecc223ba8d970c74ef8aba | cc7d4f066e646fadd3ea5471e25ff43bc852fef1 | Ragnaroki127/Data-Structure-and-Algorithms- | /Algorithmic Toolbox/solutions/week2_algorithmic_warmup/5_fibonacci_number_again/fibonacci_huge.py | Python | py | 666 | no_license | # Uses python3
import sys
def calc_fib(n):
if (n <= 1):
return n
else:
result = [0, 1]
for i in range(2, n + 1):
result.append(result[i - 1] + result[i - 2])
return result[n]
def get_fibonacci_huge(n, m):
iters = 0
mods = []
for i in range(n + 1):
... |
0eff959a83bc7a22b59dd4f365c2faf21187c6c3 | ded867361da8da66a6d6b1a94b91d6123a21f683 | zmbush/website.django | /website/urls.py | Python | py | 597 | no_license | from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'website.views.home', name='home'),
# url(r'^website/', include('website.foo.urls')),
# Unc... |
90d72afd5a3323311a387dfa0db82e7543e62b0a | 107a35e0fc2e9c3fb264e51b0d4ba758e19097b0 | brianwvincent/quantum_test | /helper_fns.py | Python | py | 518 | no_license | import pandas as pd
from sklearn.preprocessing import OneHotEncoder
def perform_one_hot_encoding(df, column_name):
encoder = OneHotEncoder()
results = encoder.fit_transform(df[[column_name]])
encoded_df = pd.DataFrame(results.toarray(), columns=encoder.categories_)
return df.join(encoded_df... |
be8bd06110763c86a80632f48b7f23dcd18449bd | da95d75b9cabd383f66f9c1c0cdd0b7976b8b328 | rpetersburg/expres_agitator | /expres_agitator.py | Python | py | 10,937 | no_license | """
EXPRES Fiber Agitator Interface Module
Provides a class to send commands to and receive information from a
dual-channel Roboclaw voltage controller controlling the two DC motors
for fiber agitation. Can also be run as a script to simply control the
fiber agitator from a terminal.
"""
import num... |
38ac411bdc50949e96acc91d75f83dd4e32317a1 | 5382b34f09135dc12f2baaa1117b7aabf1e3c44d | openfun/ralph | /tests/backends/database/test_mongo.py | Python | py | 17,802 | permissive | """Tests for Ralph mongo database backend."""
import logging
from datetime import datetime
import pytest
from bson.objectid import ObjectId
from pymongo import MongoClient
from pymongo.errors import PyMongoError
from ralph.backends.database.base import DatabaseStatus, StatementParameters
from ralph.backends.database... |
308142b8a41faabb552adebbcc70819b90404b5d | 40a16c7afb0430ed3dc87f6b849e6f908a303881 | yu-supersonic/service-fabric-cli | /src/sfctl/commands.py | Python | py | 22,054 | permissive | # -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
""... |
aaa5984477b8b6d26c4ee3994cc148923ec8d5e1 | ecea990e1f606bc2655507051a656a267d9295db | dmbaggett/tlslite | /tlslite/utils/tlscrypto_aes.py | Python | py | 1,246 | permissive | "tlscrypto implementation of AES; this just uses separated-out code from pycrypto."
try:
from tlscrypto import _AES
except ImportError:
try:
import _AES
except ImportError:
_AES = None
if _AES:
from .cryptomath import *
from .aes import *
MODES = {
1: _AES.MODE_ECB,
... |
2443a65df785b65df6601f3fca4c6d49e939af39 | 66b738b6611756001847c776f1ee8e877b5d7a0a | skstupak/SI-206-Final-Project- | /TheAudioDBAPI_info.py | Python | py | 3,137 | no_license | # from the TheAudioDB API I am gathering data for:
# strGenre
# intLoved
# intTotalListeners
# intTotalPlays
import billboard
import sqlite3
import os
import json
import requests
API_KEY = "apiKey"
# pull top 100 from billboard to get a list of teack names and artists names
dir = os.path.dirname(__file__) + os.sep... |
3790c5e2b134abe92fe95c50519d140a31c4d72d | 9c23aeee4c6d1171525a4e21798b4044378c4d9c | h-gerami/flask-rest-item-store | /resources/item.py | Python | py | 1,876 | no_license | from flask_restful import Resource , reqparse
from flask_jwt import jwt_required
from models.item import ItemModel
class Item(Resource):
parser = reqparse.RequestParser()
parser.add_argument('price' ,
type = float,
required = True,
help = "This field can not be left blank!"
)
pa... |
c944045b5237d3d8669872d4b30f5f13c51893dc | 9d8731f830831ad1fd4cd1a70cc6c1ffdd3d0079 | JTFouquier/crowdflower_relation_verification | /src/aggregate_votes.py | Python | py | 755 | no_license | # last updated 2015-04-08 Tong Shu Li
import pandas as pd
def aggregate_votes(column_name, data_frame):
"""
Given all of the human responses for one work unit,
aggregates the results based on the column you give it.
For each possible choice, it calculates:
1. Total number of votes
2. C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.