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 |
|---|---|---|---|---|---|---|---|---|
4f358c61e7d3f7a6abfbfe6842014e553f68784b | 9af88f18a24045b477f255d2b155243ef3726217 | bbreddy123/cs595-f14 | /A9/Q1/test/createMDS.py | Python | py | 308 | no_license | #!/usr/bin/env python
import clusters
def main():
blognames,words,data=clusters.readfile('blogdata.txt')
coords=clusters.scaledown(data)
clusters.draw2d(coords,blognames,jpeg='blogs2d.jpg')
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
sys.exit(1) |
c0f85e2fa8b239e815364646b7507f8da02839c6 | 04518ad611a203f01016b87747340fd0f941aa2b | lianxiaopang/camel-store-api | /apps/trade/migrations/0045_orders_payjs_order_id.py | Python | py | 454 | permissive | # Generated by Django 2.1.8 on 2019-10-14 09:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trade', '0044_exportdelivery'),
]
operations = [
migrations.AddField(
model_name='orders',
name='payjs_order_id',
... |
0091a9c1bca6283e7344adcc19f652463ca1ec60 | 29b1e2945f7ccbe512c10332d51b7f4e57a07bd5 | luke-1995/crm_pro | /crm_pro/web/handler/course.py | Python | py | 276 | no_license | #!usr/bin/env python
# -*- coding:utf-8 -*-
# 内置模块
# 第三方模块
# 本地库
from stark.utils.stark_site import ModelHandler
class CourseHandler(ModelHandler):
field = ['name', '_edit', '_delete']
search_list = ['name__contains']
per_page_count = 5
|
fd224686c64d30b8ede85ffebd8113d642b03f4f | 9132af8af52a3a21e6d63675e2d376a30618efab | Cmathou/S8-Simulated-Pepper-Project | /softbankRobotics/choregraphe-suite-2.5.5.5-linux64/share/doc/_downloads/almotion_openHand.py | Python | py | 1,083 | permissive | #! /usr/bin/env python
# -*- encoding: UTF-8 -*-
"""Example: Use openHand Method"""
import qi
import argparse
import sys
def main(session):
"""
This example uses the openHand method.
"""
# Get the service ALMotion.
motion_service = session.service("ALMotion")
# Example showing how to open... |
53ebcacaa237dd87958c2bde75d5be5ae3c531af | da90fb43a3425e31a54c152607a5190ec05f115d | luna-cd2011/AID2005 | /select_test.py | Python | py | 435 | no_license | from socket import *
from select import select
from time import sleep
#
# f=open("my.log","rb")
tcp_sock=socket()
tcp_sock.bind(("0.0.0.0",8888))
tcp_sock.listen(5)
connfd,addr=tcp_sock.accept()
# udp_sock=socket(AF_INET,SOCK_DGRAM)
# udp_sock.bind(("0.0.0.0",8866))
print("监控IO")
sleep(5)
# rs,ws,xs=select([tcp_sock... |
53f4b2fa9fa1f0ae6d19f1efadde232a7c5c923e | e6d4abd05dc7b0281b9af4f231384423f55818b8 | DariusFeher/Control-Room | /client_code/Station_section.py | Python | py | 7,890 | no_license | from ._anvil_designer import Station_sectionTemplate
from anvil import *
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
import anvil.server
from . import Methods
class Station_section(Station_sectionTemplate):
def __init__(self, rotate_angle_in = 0, train_id="109", t... |
3bd77f7a5311ef83e664737f6122e432ef64566a | 05eadcb5229dfc7edb6376741d9fe5bb44e9beb9 | ericchen12377/Leetcode-Algorithm-Python | /DS-400/Easy/9-Palindrome Number/ReverseAll.py | Python | py | 427 | permissive | class Solution(object):
def isPalindrome(self, x):
"""
:type x: int
:rtype: bool
"""
if x < 0 or x > 2**31 - 1:
return False
else:
res = 0
x_org = x
while x != 0:
res = 10 * res + (x % 10)
... |
2b43b39617640b990930602f7944e1742e0712b7 | ab5127da9ff2a2fdfbc90d0fde73d7b012ba262b | zaboevai/python_base | /lesson_016/python_snippets/external_data/spidyquotes/spidyquotes/items.py | Python | py | 292 | no_license | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class SpidyquotesItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
|
e918a2b67bae69ccc7471c07cb93cf7ea45cb45f | b0bf82037c060bb2e078deeb404ec1eafbd2485f | spring01/deep_q_learning | /dqn/qnetwork.py | Python | py | 4,119 | no_license |
from keras.layers import Input, Conv2D, Flatten, Dense, Lambda
from keras.layers import TimeDistributed, LSTM, GRU
from keras.layers import add, dot
from keras.models import Model
from keras import backend as K
def qnetwork_add_arguments(parser):
parser.add_argument('--model_name', default='dqn', type=str,
... |
f4068f67c5ca5a8dfc0d2c097d5639b4a5604a63 | 33ced990999aa626bf2276068f95be88447e7e57 | gregoil/rotest | /src/rotest/common/utils.py | Python | py | 4,239 | permissive | """Common useful utils."""
# pylint: disable=protected-access
from __future__ import absolute_import
import os
import json
from shutil import copy
from itertools import count
from datetime import datetime
from attrdict import AttrDict
from jsonschema import validate
from future.builtins import next
RUNTIME_ORDER = '... |
48636565ad5ff6bd6ae5e10991c34290e8a13371 | d8635da7e5e2f8b03651418481596d810174c3eb | alphagov/notifications-delivery | /notifications_delivery/clients/sms/__init__.py | Python | py | 352 | permissive | from notifications_delivery.clients import (Client, ClientException)
class SmsClientException(ClientException):
'''
Base Exception for SmsClients
'''
pass
class SmsClient(Client):
'''
Base Sms client for sending smss.
'''
def send_sms(self, *args, **kwargs):
raise NotImpleme... |
8746260967c4f2abb2ef64490612ba931793931f | 32b05caa38cf4b0e442213e71ee356524814cb8d | rzf16/mrover-workspace | /jetson/teleop/src/__main__.py | Python | py | 7,734 | no_license | import asyncio
import math
from rover_common import heartbeatlib, aiolcm
from rover_common.aiohelper import run_coroutines
from rover_msgs import (Joystick, DriveVelCmd, KillSwitch,
Xbox, Temperature, RAOpenLoopCmd,
SAOpenLoopCmd, GimbalCmd, HandCmd,
... |
194c8998901e78bd5a30dc15e333776761103ea7 | cfa4b618cd70db0a68a8b6120410a5596e2d20cf | fs-fi/django_interview_test | /restbucks/migrations/0001_initial.py | Python | py | 4,019 | no_license | # Generated by Django 3.2.6 on 2021-10-26 05:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_fsm
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... |
005f538cb11b39262d81093db5f887be5fd85ccb | 12bba672395070ade681243a16a3c067b9b2e2cd | penguinwang96825/Auto-Trading | /haohaninfo/Python_Future_Sample/實單交易/129.py | Python | py | 5,175 | no_license | # -*- coding: UTF-8 -*-
# 載入相關套件
import sys,indicator,datetime,haohaninfo
# 券商
Broker = 'Masterlink_Future'
# 定義資料類別
Table = 'match'
# 定義商品名稱
Prod = sys.argv[1]
# 取得當天日期
Date = datetime.datetime.now().strftime("%Y%m%d")
# K棒物件
KBar = indicator.KBar(Date,'time',1)
# 定義RSI指標、MA快線、MA慢線的週期
RSIPeriod=20
Fas... |
11e19dee4de4760a33f4e3f1184646e2bef35f77 | d5e21767ded9a614525843066bfc1cf641bf2733 | dougbrn/STIS-TV | /comp_temp.py | Python | py | 7,815 | no_license | from astropy.io import fits
import numpy as np
import matplotlib.pyplot as plt
import csv
from astropy.stats import sigma_clip
from scipy import interpolate
import os
import datetime
from pixelcorrection import compute_sv
import matplotlib as mpl
import time
import glob
import json
plt.style.use('seaborn-paper')
mpl.rc... |
5b807783ad7b1a084044e41a2f15c653de111f28 | 4f41285a2e8113d618adb6d76904df9763451f41 | nnmm/w2v-pointreg | /load.py | Python | py | 288 | no_license | # coding: utf-8
import logging
import config
from music2vec import *
from sys import argv
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
# the models
m = []
for i in range(1, len(argv)):
m.append(Music2Vec.load(config.model_dir + argv[i]))
|
3af342527a84704c734c85e1fc25e34c1dfcab78 | 83394dc51e6456bd4cac6d2afdad7819794226dd | yfauser/vmware-nsx | /vmware_nsx/tests/unit/nsx_v/test_nsxv_loadbalancer.py | Python | py | 4,677 | permissive | # Copyright 2014 VMware, 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 appl... |
fb02dc139f80ed2845e3550b804c779c4c6d2c87 | f282ae11f8d33be8d9f4799b70f35a4c01be0b29 | K-Frash/Curiosity-Driven-RL-TankGame | /TanksEnvironment/gym_tanks/envs/tanks_environment.py | Python | py | 12,143 | no_license | import gym
from gym import spaces
from copy import deepcopy
import pygame
# Constants
NUM_ACTIONS = 5
"""
Actions are:
1: Up
2: Left
3: Down
4: Right
5: Shoot
"""
ACT_UP = 0
ACT_LEFT = 1
ACT_DOWN = 2
ACT_RIGHT = 3
ACT_SHOOT = 4
GRID_WIDTH = 62
GRID_HEIGHT = 47
# CELL CONSTANTS
CELL_GROUND = 0
CELL_WALL = 1
CELL_TANK... |
5b4324280cfe08e15b66b557208a66b3fc3bf415 | 4e492d77a6ae6d638d2779d6bf9b31636f9ee337 | crdoconnor/prettystack | /hitch/key.py | Python | py | 4,013 | permissive | from hitchstory import StoryCollection
from pathquery import pathquery
from click import argument, group, pass_context
import hitchpylibrarytoolkit
from engine import Engine
toolkit = hitchpylibrarytoolkit.ProjectToolkitV2(
"PrettyStack",
"prettystack",
"crdoconnor/prettystack",
image="",
)
@group(i... |
6594b5322c01bb865fac61464daea0173da1c551 | 03e7b745a83539b414f09b9206a2beba55c76611 | mnaumovfb/pytorch | /setup.py | Python | py | 44,550 | permissive | # Welcome to the PyTorch setup.py.
#
# Environment variables you are probably interested in:
#
# DEBUG
# build with -O0 and -g (debug symbols)
#
# MAX_JOBS
# maximum number of compile jobs we should use to compile your code
#
# NO_CUDA
# disables CUDA build
#
# CFLAGS
# flags to apply to both C ... |
da8c20e68e5cfb7f6d858233561b68a7031fe125 | 2a152bf860337f32a97b31a72a7b53aa65a52d8f | Asap7772/railrl_evalsawyer | /experiments/ashvin/vae/fixed/pusher2d/relabel_sparse2.py | Python | py | 2,406 | permissive | from rlkit.envs.multitask.point2d import MultitaskImagePoint2DEnv
from rlkit.envs.multitask.pusher2d import FullPusher2DEnv
from rlkit.launchers.arglauncher import run_variants
import rlkit.misc.hyperparameter as hyp
from rlkit.torch.vae.relabeled_vae_experiment import experiment
if __name__ == "__main__":
# noin... |
c5880426496dbe975d03ee50b47dbcc92597f518 | a500734c498a31b5f5b85c228b5d37842731c5eb | alexiswilliams/sauceCon_API_in_120_minutes | /tests/test_entries.py | Python | py | 383 | permissive | def test_entries_get(saucelog):
response = saucelog.get("/entries")
assert response.status_code_is(200)
def test_entries_post(saucelog):
example_post = {
'title': "A Sauce",
'description': 'Some kind of hot sauce',
'heat_level': 'medium'
}
response = saucelog.post("/entrie... |
c6976e49a51479068814d02817879e5d6a5f4cbd | 308baff30bfab687d361b039f9fe857cdcc863cf | TeachingDataScience/gadsdc | /10-python/scrape.py | Python | py | 552 | no_license | #!/usr/bin/env python
import requests
from bs4 import BeautifulSoup
url = "http://html.cita.illinois.edu/nav/dtable/dtable-example-simple.php"
response = requests.get(url)
soup = BeautifulSoup(response.text)
values = list()
for table in soup.find_all('table'):
for tr in table.find_all('tr'):
for td in tr.fi... |
2e957b632535f78177469583cf59c41e84edbced | 8bb1b410c1d9bfd257f1f5080dde07a9ebac9475 | AroraShreshth/CiscoDevnetSIH2020_Kamikazey | /backend/school/migrations/0011_fooditem_nutrition.py | Python | py | 386 | no_license | # Generated by Django 2.2.10 on 2020-08-01 07:49
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('school', '0010_auto_20200801_0950'),
]
operations = [
migrations.AddField(model_name='fooditem', name='nutrition', field=models.DecimalFiel... |
3ed3d267d28340b32df952639030964d2bae70de | 3f92faf46a291a677463f1a0efc7ae72559814f5 | rYoussefAli/Problems-vs-Algorithms | /problem_3.py | Python | py | 1,176 | permissive | def rearrange_digits(input_list):
"""
Rearrange Array Elements so as to form two number such that their sum is maximum.
Args:
input_list(list): Input List
Returns:
(int),(int): Two maximum sums
"""
inp = len(input_list)
if inp <= 1:
return [-1, -1]
freq = [0] * 10
... |
bb75d33045b39127893d892dbbb5a406f6379d6d | 7a8932ff4278034cb94a5bebe7d4318f6dcce5ec | goharalisiddiqui/ISFET | /ISFET_fluidbias.py | Python | py | 1,412 | no_license | #! /usr/bin/python3
import matplotlib.pyplot as pylab
from datetime import datetime
import os
import sys
import shelve
import numpy as np
import progressbar
import matplotlib.ticker as ticker
import glob
## Some parameters
Na = 6.022140857e23
img_dpi = 400
figFB, axFB = pylab.subplots()
## Retrieving Sh... |
8136523107e41908ee7253a5cd968d2c73c266b4 | 6ca581bf2ccb0b759262101cf40635a1916e0709 | Aqw0rd/AdventOfCode2017 | /day5.py | Python | py | 678 | no_license | with open('files/day5.txt') as file:
data = file.readlines()
data = [int(line.strip()) for line in data]
def partOne():
counter = 0
steps = 0
while True:
if counter >= len(data):
break
temp = data[counter]
data[counter] = data[counter] + 1
counter += temp
... |
dbfe270bd4df8ee51390c6b99c7b6bef3e3af3aa | f985f2a9a8a8852e3a9fa0b169cac5d3f3f631be | koty/drf_writable_nested_sample | /api/serializers.py | Python | py | 2,901 | no_license | # https://github.com/beda-software/drf-writable-nested/blob/master/tests/serializers.py
from rest_framework import serializers
from drf_writable_nested import WritableNestedModelSerializer
from . import models
class AvatarSerializer(serializers.ModelSerializer):
image = serializers.CharField()
class Meta:
... |
04d5d447f8297297f87eda2db523945bf87f2ec7 | 7ed21ed1a03fb4a9ba1655b0cd7347fe5af8eb0f | dustball/grow | /test.py | Python | py | 642 | no_license | #!/usr/bin/python3
import cgi
import cgitb; cgitb.enable()
import mysql.connector
from myconfig import get_db
import os
import time
print ('Content-Type: text/html\n')
arguments = cgi.FieldStorage()
mydb = get_db()
mycursor = mydb.cursor()
mycursor.execute("select id,TIMESTAMPDIFF(SECOND,dt,now()) as old,temp,rh ... |
be78678ac202df71239721759f70a0e37da5b6c1 | 659ff59f0ddc0c1ac4a4103758496e19843cce3a | sgeerish/sirr_production | /extra-addons/nan_account_payment_term_extension/__openerp__.py | Python | py | 1,855 | no_license | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 NaN Projectes de Programari Lliure, S.L. All Rights Reserved
# http://www.NaN-tic.com
# $Id$
#
# This program is free software: you can redis... |
196f02a3dd20ab11c0761dacfa00de9832c9f688 | d2811599305426e0569b9b76e27fcc532911629e | MthwRobinson/shir-connect-app | /server/shir_connect/database/member_loader.py | Python | py | 1,126 | no_license | """ Utility for uploading member data into the database """
import logging
import os
import daiquiri
from shir_connect.etl.sources.mm2000 import MM2000
from shir_connect.database.database import Database
class MemberLoader:
"""
Uploads members into the member database
Current supports the following forma... |
4e43a66c9641672394296270ad6539047f33b3d7 | a165f081cb5a44293465e0509016ddc7e23893ea | FrenshGeek/Extraction-d-information | /stat_tags_scraping.py | Python | py | 1,039 | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 28 12:41:29 2020
@author: Damien AUBAIL
"""
def tag_stat(url):
"""Cette fonction se connecte à une page web donnée par l’utilisateur,
elle analyse le site et calcule en pourcentages
l’utilisation des tags dans cette page"""
from requests impor... |
03cc677e2c61b1f7f87bb433524224d3cf6d4ef3 | 003ae9e9797d7eebfe43d62b7d7ffc1495f7daac | lxzsgit/test01 | /AutoTest/FunctionTest/test_case/SKZS_daily_review_adding.py | Python | py | 2,246 | no_license | # coding=utf-8
import unittest
from FunctionTest.func_script.func_lib import *
class AddTestcase(unittest.TestCase, AppiumInit, ScreenShot, GetInfo, UserOperation, FindElement,
Waiting, PhoneSetting, AppOperation, PopupHandle, CreateThread, Logcat):
# 以下为用例编写方法和规范,如有不清楚的地方可询问作者(@eternalsunshine... |
dd732ccfb4d96f6daf7e7a3b6269b5f1768f4cfc | ae8056246df39d193eaf08dcff2ce5fb56ebd8d8 | niolha/Introduction-to-Python | /extra_task_maze.py | Python | py | 3,418 | no_license | """
1) Лабиринт
Дан лабиринт (Матрица NxN) дана точка входа в лабиринт. Стеной является символ - # коридор - . Например
##########
.........#
######.###
#......###
#.####.###
#........#
##.#######
##.##.####
##......##
#######.##
enter = [1, 0]
exit = ???
Найти выход из лабиринта.
Учтите что лабиринты могут быть самы... |
677782eb635909a6a143d2a7af01cf8c6be59c8d | 8f1b29b14ab956d0549ccb2b146dab295aebcfe6 | Extreme-lxh/ERAS | /stand-alone-tuning/nas/utils/tensor_utils.py | Python | py | 4,425 | no_license | from __future__ import print_function
import json
import logging
import os
from collections import defaultdict
from datetime import datetime
import numpy as np
import torch
from torch.autograd import Variable
class keydefaultdict(defaultdict):
def __missing__(self, key):
if self.default_factory is None:... |
573b0d59bf42a79d06597c3ee36a555f57b12aa9 | 3307c7709eff3a3969934edfe92b19eae3f548d2 | EliTheCreator/AdventOfCode | /2016/day03/task2.py | Python | py | 557 | no_license |
def main():
with open("input", "r") as file:
triangles = [[int(x) for x in line.strip().split()]
for line in file.readlines()]
possibleTriangles = 0
for col in range(len(triangles[0])):
for row in range(0, len(triangles), 3):
a = triangles[row][col]
... |
55154a612a0a75034f2f5d21dd9071c9b466ef35 | 60257da44277734c751ab4afa6e2a75710b727ae | OmairK/airflow | /airflow/sensors/smart_sensor_operator.py | Python | py | 30,944 | permissive | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... |
29ed6443eb223df1bbf86081e83d2fd960a38099 | 2a81ca7258931dae741c852226c0c2929d284390 | patcorwin/fossil | /pdil/tool/fossil/_lib/pickwalk.py | Python | py | 11,228 | permissive | from __future__ import absolute_import, division, print_function
import re
from pymel.core import createNode, listConnections, connectAttr, select, mel
from maya.api import OpenMaya
from maya.cmds import ls
import pdil
from ._lib2 import controllerShape, cardlister
def makePickwalkNode(ikControls=None, fkControl... |
26f391b3e22c8b0115274df2c7042ae4f6d42ba7 | 1ed469ed939efa635627e3a05ecdac7c09eac3c6 | Guillethecoder/FastAPI | /blog/router/authentication.py | Python | py | 1,053 | no_license | from fastapi.exceptions import HTTPException
from fastapi.param_functions import Depends
from fastapi import status
from fastapi.security.oauth2 import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from blog import schemas
from fastapi import APIRouter
from .. import schemas, database, models, token
from sqlalchemy.o... |
ffbd187288abcbe72ae31c02cf3e2abc9d3823ea | 786d6f3460efac464877b361678e9dcb89406a23 | Fahad-CSE16/TextUtils | /textutils/settings.py | Python | py | 3,150 | no_license | """
Django settings for textutils project.
Generated by 'django-admin startproject' using Django 3.0.7.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
... |
17a597357059897e99fded5e7d39c7c9157a3b75 | ec47a2322d2f868ba5caa9a5198dc31ae99f8d87 | jurajmaslej/neuronky | /projekt3/util.py | Python | py | 3,500 | no_license | import atexit
import numpy as np
import matplotlib
matplotlib.use('TkAgg') # todo: remove or change if not working
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import os
import time
## globals
width = None
height = None
def util_setup(w, h):
global width, height
width = w
hei... |
635c78e78342536f5bd79afab512cd4fb553bc52 | a010636fb0ee76c975a70556f05b94a98d645a2a | AkiraKane/python-and-data-science | /ch2_matplotlib.py | Python | py | 1,916 | no_license | import numpy as np
import matplotlib.pyplot as plt
import pdb
def simple_line_plot(x,y,figure_no):
plt.figure(figure_no)
plt.plot(x,y)
plt.xlabel('xvalues')
plt.ylabel('yvalues')
plt.title('Simple Line')
def simple_dots(x,y,figure_no):
plt.figure(figure_no)
plt.plot(x,y,'or')
plt.xlabe... |
2dec3a038270decebf60189711e26505249e4826 | 46d869289073883301d2a2ce47d765c44a8211b1 | azlaanmsamad/webscraping | /scraper/selenium_Introduction/selenium_tutorial.py | Python | py | 1,098 | no_license | # Selenium Tutorials
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
PATH = '/home/azlaan/chromedriver'
driver ... |
a6290c95f849c7ddab0ac9aac6d6a1d0605860d8 | af6830a313a47befc970d1de4cf4df07ab63af6e | LucasNoga/Python | /Bibliotheques/Django-1.9.2/django/db/backends/sqlite3/base.py | Python | py | 18,127 | permissive | """
SQLite3 backend for django.
Works with either the pysqlite2 module or the sqlite3 module in the
standard library.
"""
from __future__ import unicode_literals
import datetime
import decimal
import re
import warnings
from django.conf import settings
from django.db import utils
from django.db.backends import utils ... |
e45f00f0628bb5cabcda1afc5af6da9b338d9db2 | 0743465e95dc5262d44378b52bf60a1fc234f996 | skisa31/learning_deeplearning | /common/functions.py | Python | py | 685 | no_license | from common.np import *
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def relu(x):
return np.maximum(0, x)
def softmax(x):
if x.ndim == 2:
x = x - x.max(axis=1, keepdims=True)
x = np.exp(x)
x /= x.sum(axis=1, keepdims=True)
elif x.ndim == 1:
x = x - np.max(x)
x = np.exp(x) / np.sum(np.exp(x... |
fe4bcb0ad5a25b4501427598593e412794e14500 | f0351a66ef6e925df729462fbce33ecc4d26347e | einashaddad/dogs | /model/user.py | Python | py | 219 | no_license | class User:
def __init__(
self,
user_id=None,
name=None,
email_address=None,
):
self.user_id = user_id
self.name = name
self.email_address = email_address
|
ff0c059419aa4804a104a3a8149c7efae11dd938 | fdd30c57136ffee177e10e45754f3e4e2ca13384 | ICGC-TCGA-PanCancer/pcawg_delly_workflow | /deprecated/bin/py/pybedtools/colorize.py | Python | py | 412 | no_license | import pybedtools
from pybedtools.featurefuncs import add_color
a = pybedtools.example_bedtool('a.bed')
def modify_scores(f):
fields = f.fields
fields[4] = str(f[2])
return pybedtools.create_interval_from_list(fields)
a = a.each(modify_scores).saveas()
print(a)
from matplotlib import cm
cmap = cm.jet
no... |
e9ae632176d91354542be8d0b5d5943e5e3dc6b1 | c079d73290f4462ebde87a1eb9d70973832733a2 | angelusualle/algorithms | /cracking_the_coding_interview_qs/1.4/is_palindrome_permutation_test.py | Python | py | 500 | permissive | import unittest
from is_palindrome_permutation import is_palindrome_permutation
class Test_Case_Is_Palindrome_Permutation(unittest.TestCase):
def test_is_palindrom_permutation(self):
self.assertTrue(is_palindrome_permutation("Taco cat"))
self.assertFalse(is_palindrome_permutation("Taco zcat"))
... |
4c4e47c1b2a2954cac1b93c7da749d81df33ef47 | 82ea61655c527da1f547f33b9aaaccd38641adf2 | Andy-wangke/Scrapy_Samples | /inAction/coursetalk/coursetalk/pipelines.py | Python | py | 290 | no_license | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class CoursetalkPipeline(object):
def process_item(self, item, spider):
return item
|
99d3eab2358fcce03af064c30d4ef2804394cf91 | 49d42ebbed1065e036c5aa59894605aad7096f11 | box/box-python-sdk | /test/integration_new/context_managers/box_test_file.py | Python | py | 785 | permissive | from typing import Any, Optional
from test.integration_new import util
from test.integration_new import CLIENT
from boxsdk.object.file import File
from boxsdk.object.folder import Folder
class BoxTestFile:
def __init__(self, *, file_path: str, name: str = None, parent_folder: Optional[Folder] = None):
i... |
1bf5f43219981b2c321e8a54bbedff287d6e2f9c | 4b52faff16f860ea724eba83671cfb7a2afb0a84 | wimpywarlord/hacker_earth_and_hacker_rank_solutions | /KillCode's Wish.py | Python | py | 547 | no_license | t=int(input())
for i in range(0,t):
x=input()
n,m=x.split()
n=int(n)
m=int(m)
z=input()
l=z.split()
for j in range(0,len(l)):
l[j]=int(l[j])
print(l)
'''#include <stdlib.h>
#include<stdio.h>
int main()
{
int t,i,j,k,n,m;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&m);
int a[n];... |
699ac4a774b73ff5cb3a1d7a9bc79aa589dadae4 | dff99483c1009edc052eaf3f1f7df9530c08acc4 | GiovannaMelchiorre/VRProject | /ROS_VM/rosbridge_suite/rosbridge_library/test/capabilities/test_call_service.py | Python | py | 2,905 | permissive | #!/usr/bin/env python
import sys
import rospy
import rostest
import unittest
import time
from roscpp.srv import GetLoggers
from json import loads, dumps
from std_msgs.msg import String
from rosbridge_library.capabilities.call_service import CallService
from rosbridge_library.protocol import Protocol
from rosbridge_l... |
ed9b610bd3c679948db2656a12308d6de5484ff0 | 4525fb2fb952997bdc1e5703fc9650491b03d014 | hyperledger-archives/indy-stp | /stp_raet/test/test_raet_comm_with_one_key.py | Python | py | 3,422 | no_license | from binascii import hexlify
import pytest
from raet.raeting import AutoMode, Acceptance
from raet.road.estating import RemoteEstate
from raet.road.stacking import RoadStack
from stp_raet.test.helper import handshake, sendMsgs, cleanup
from stp_core.crypto.nacl_wrappers import Signer
from stp_core.crypto.util import ... |
e6d9c1a1e5f29ccc3170e99167ebec464a5d57c5 | dccb1f105a5295568f8c1956e250881f0091306c | teffland/chainer-monitor | /chainer_monitor/__init__.py | Python | py | 482 | no_license | from activation_monitor import ActivationMonitorExtension
from array_summary import ArraySummary, DictArraySummary
from backprop_monitor import BackpropMonitorExtension
from better_report import BetterLogReport
from mongo_report import MongoLogReport
from early_stopping import PatientMinValueTrigger, PatientMaxValueTri... |
0b1979bae057a66044e01910049a0bacf44074f6 | e164b4f2db8b6cabe2214b463f360d77558a5a8b | bartonwu/mysite | /comment/migrations/0001_initial.py | Python | py | 1,070 | no_license | # Generated by Django 2.2 on 2019-01-02 08:40
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swapp... |
e11188542963c8e4bd20843bf5104c6c68f269f0 | c19469378190e07d8ee763a14d86093b09442eb5 | FuongHoa/hoalephuong-lab-C4E22 | /lab1/gmail_sample.py | Python | py | 850 | no_license | from gmail import GMail, Message
gmail = GMail('phuonghoa2303.2000@gmail.com', 'dmthangancap123')
# msg = Message("Don't follow your dream, follow me on instagram", to='c4e.techkidsvn@gmail.com',text="hihi",html="https://www.instagram.com/phng.hoa/",attachments=['hoa.jpg'])
html_template = '''
<p>Hello, tomorrow ... |
a908ee467108b1c6aa6068135b313395112c4d2b | 37969475aca9dbef72aa372b0c93b46a049d4b80 | crowdbotics-apps/trendy-20623 | /backend/users/migrations/0002_auto_20200924_0145.py | Python | py | 894 | no_license | # Generated by Django 2.2.16 on 2020-09-24 01:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='email',
field... |
c7b2f33b5a62e54589f54bb2dfbb38160721398f | 4f68dd4e4be631a859a6c9a7b33c661763c18fb8 | apxep/management-lightbulb-provisioner | /roles/provision-ansible-tower/templates/cloudforms.py | Python | py | 18,042 | no_license | #!/usr/bin/env python
# vim: set fileencoding=utf-8 :
#
# Copyright (C) 2016 Guido Günther <agx@sigxcpu.org>
#
# This script is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
... |
4b667c8d65cd85311634506445e493791d835900 | 84c3ea19303424c80b89fe1d0aef63a79065d65e | sdss/mangadap | /outofdate/obsinput.py | Python | py | 6,719 | permissive | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
r"""
Define a parameter instance that holds the input information needed to
run the DAP for a specific MaNGA observation.
Class usage examples
--------------------
To define a set of observation parameteters::
from mangadap.p... |
fa11d277de397464f6520642eed7ee3d07426fad | 4f7abde13cf52af1453ee0bb983307667e38585f | strategist922/globus-cli | /tests/functional/test_task_list.py | Python | py | 486 | permissive | import responses
def test_task_list_success(run_line, load_api_fixtures):
load_api_fixtures("task_list.yaml")
result = run_line("globus task list")
assert "SUCCEEDED" in result.output
assert "TRANSFER" in result.output
# check that empty filters aren't passed through
filters = dict(
x.... |
36263d60556d2622424991b0c2f28bb63b3eef6c | aaf6bbd8dd90d15e9d53bb7c3ff38dcf9c33e6cc | sninala/pytest-polarion | /tests/test_01.py | Python | py | 513 | no_license | import pytest
import time
@pytest.mark.polarion_id("CMP-9301")
def test_foo_good():
print "This test is a good one"
time.sleep(3)
assert True
@pytest.mark.polarion_id("CMP-9307")
def test_foo_bad():
print "This test is a bad one"
time.sleep(3)
assert False, "just being bad"
@pytest.mark.sk... |
b35bc62d856ede73df6f8bb4ef5b9b07e85e7663 | 561518327db504a71d003b143c58986f36095b77 | zyh1999/pytorch-quantum | /examples/script/eval_subnet_rand_real_x2_opt2.py | Python | py | 720 | permissive | import subprocess
from torchpack.utils.logging import logger
if __name__ == '__main__':
pres = ['python',
'examples/eval.py',
'examples/configs/mnist/four0123/eval/x2/real/opt2/300.yml',
'--jobs=4',
'--run-dir']
with open('logs/sfsuper/eval_subnet_rand_x2_real_3... |
e06c7d002b986f9f2ff4601f42bc3355ea9afe1f | 0b6c4b6af35c72d23f88f7616a42e9a3ea79c65d | Huawei-Ascend/modelzoo | /built-in/TensorFlow/Research/cv/image_classification/Cars_for_TensorFlow/automl/vega/search_space/networks/pytorch/utils/bbox_utils/sampler/pseudo_sampler.py | Python | py | 1,748 | permissive | # -*- coding: utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the... |
f106867a888c6b6e6ea31dd576e359ada8a754ce | 84d6862e94dd819e2cdda6914fa91bf9b6be952c | tszssong/mac-py-frcnn | /pytools/analyzedata.py | Python | py | 2,733 | permissive | # -*- coding: utf-8 -*-
import sys
import os
import re
import cv2
import random
import xml.etree.cElementTree as ET
from xml.etree.cElementTree import Element, SubElement, tostring
from xml.dom.minidom import parseString
import numpy as np
import math
import matplotlib.pyplot as plt
wkdir = "/Users/momo/wkspace/caffe_s... |
6685e407fd553bb48e6888d19a3fb36455f63b14 | a2c48e9a41e0d07a14eec91dcb6b3a19aa1ae352 | DialBird/argo | /yukiko/python/4_omori_tenbin.py | Python | py | 559 | no_license | class Yukicoder:
def __init__(self):
_ = int(input())
self.w_list = [int(i) for i in input().split()]
def run(self):
total = sum(self.w_list)
if total & 1: return "impossible"
half = total >> 1
dp = set([0])
for w in self.w_list:
new_dp = set... |
9f148d4e14a64f772bffd79143552aba9f11af44 | 35effff2ea79f63c845d70077f70967d16090e68 | WireFisher/afl-pwnable | /fuzzer-scheduling/process_util.py | Python | py | 447 | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
import psutil
def pause_process(pid):
p = psutil.Process(pid)
p.suspend()
def resume_process(pid):
p = psutil.Process(pid)
p.resume()
def kill_process_familly(pid):
parent = psutil.Process(pid)
children = []
for child in parent.children(recur... |
06fd3439cf5ea053de75d35cbd245d55c618fb3e | 9a5c538f9b83b34bd54cd413899599468582a92e | DSwieca/videogame_catalog | /videogame/migrations/0001_initial.py | Python | py | 1,327 | no_license | # Generated by Django 2.2.7 on 2019-11-28 16:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Genres',
fields=[
... |
f18e9cd8e334120dcd32d6068c241c35e41df1ac | 47d810f6f1719ee5c1b8287a797df10d53465642 | vietnvri/detect-from-video-SVM | /extract_dict.py | Python | py | 2,445 | no_license | import os
import cv2
import numpy as np
from sklearn.cluster import KMeans
from scipy.spatial.distance import cdist
import time
# return link to datas and labels respectively
start = time.time()
def readData(curDir):
trainingset = curDir + 'trainingset'
datas = []
labels = []
layer = 1
... |
bddfcd1f738a645e3013d1ed91fffe5540cb0343 | 7e82ce66cff754f622e8e51ac1d0501a76f6027b | Gokul-Balaji/Machine-Learning | /Python_Data_Visualization.py | Python | py | 5,783 | no_license | #Open Machine Learning Course
#Topic 2. Visual Data Analysis with Python
#Initializing the Environment
import pandas as pd
import numpy as np
pd.options.display.max_columns=12
#Disable Warnings in Anaconda
import warnings
warnings.simplefilter('ignore')
import matplotlib.pyplot as plt
import seaborn as... |
7ca5370506a76161b0f0aae6d1b4d2ecc581bec6 | e13be7b6fcbac621c6e9107f43834ce8cfd2aa45 | yaii/pyink-lite | /pyink.py | Python | py | 1,007 | no_license | import pybInkscape
import pygtk
import gtk
import os
from yai import Wrapper
wrapper = None
def act_desktop(inkscape, ptr):
global wrapper
""" Handler for desktop activation events."""
# Get Python wrapper of SPDesktop passed by ptr.
desktop = pybInkscape.GPointer_2_PYSPDesktop(ptr)
print "A desktop has con... |
076dc2515b72daa0f56c5471b70e8a396e2300df | 6dcb7ade2c8e9e8e9b323015b4b531dcf4f1b0b1 | piszewc/Gym_Buddy | /manage.py | Python | py | 541 | no_license | #!/usr/bin/env python
import os
import sys
if __name__ == '__main__':
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'gym_buddy.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Ar... |
57c00665a7d0bbbd6b29174f727a8b2cc31512b6 | c8ef8c96aaf6746ec8e371bfbad549f47fe4a85b | imrehg/mlflow | /mlflow/pyfunc/scoring_server/client.py | Python | py | 1,920 | permissive | import requests
import time
import json
from mlflow.pyfunc import scoring_server
from mlflow.utils.proto_json_utils import _DateTimeEncoder
class ScoringServerClient:
def __init__(self, host, port):
self.url_prefix = f"http://{host}:{port}"
def ping(self):
ping_status = requests.get(url=self... |
c24f4fb5bdab5da6b2e930dc872eef6ffcda993f | fa87daca102674d51204288746e612c904c172d5 | ebarillot/Python2 | /Excel/test_openpyxl.py | Python | py | 2,740 | no_license | # -*- coding: utf-8 -*-
from openpyxl.styles.named_styles import NamedStyle
import datetime
__author__ = 'Emmanuel Barillot'
"""
Petites expériences avec openpyxl
Documentation ici: https://openpyxl.readthedocs.io/en/default/
doc sur les worksheets ici https://openpyxl.readthedocs.io/en/default/api/openpyxl.workshee... |
590f843a08a7fb60ea7dd2aa59bd902f4816f0df | 53290fb520259c3436dc02256c55f212709f40ad | KisImre/rpi-bare-metal-prototyping-framework | /framework/rpibaremetal/connection/serialconnection.py | Python | py | 1,038 | permissive | # Copyright (c) 2020, Kis Imre. All rights reserved.
# SPDX-License-Identifier: MIT
""" Connection implementation for serial ports. """
from serial import Serial, SerialException, SerialTimeoutException
from rpibaremetal.connection.connection import Connection
class SerialConnection(Connection):
""" Connection i... |
c285883b85e84bcaa31d3bb7e5135ac23899a371 | ac442c5c263a3c1189a864a2393dd02fcc027c58 | kyliejtan/python-challenge | /PyPoll/main.py | Python | py | 4,364 | no_license | #Your task is to create a Python script that analyzes the votes and calculates each of the following:
# The total number of votes cast
# A complete list of candidates who received votes
# The percentage of votes each candidate won
# The total number of votes each candidate won
# The winner of the election based on popu... |
7d651bd1801f081849d3c45a38ce07c92c710954 | 004d97d9547e44a73c0dc97f56876f656e3749b9 | adamchainz/cmsplugin-filer | /cmsplugin_filer_image/migrations/0003_mv_thumbnail_option_to_filer_20160119_1720.py | Python | py | 1,916 | no_license | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
def move_thumbnail_opt_to_filer(apps, schema_editor):
ThumbnailOption = apps.get_model('cmsplugin_filer_image', 'ThumbnailOption')
ThumbnailOptionNew = apps.get_model('filer', 'ThumbnailOption')
for ob... |
652b2d04b22297c547505c600037ea0622117a5b | f8e9fe7a40193cce22e6fbabddc234ea36d15990 | stakater-lab/docker-training | /labs/backend/hello-world-back.py | Python | py | 227 | no_license | #!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/getmessage')
def hello_world():
return 'Hello Docker World!'
if __name__ == '__main__':
app.debug = True
app.run(host='0.0.0.0', port=5000)
|
0a279e974d549a3b020f2a02bb346d7b53ab0867 | fccd7f34112b3677a87c3de3a4ce67cf8759781a | NatchapolColab/qiskit-translations | /jupyter_execute/stubs/qiskit.circuit.library.QFT.py | Python | py | 555 | no_license | #!/usr/bin/env python
# coding: utf-8
# In[1]:
from qiskit.circuit.library import QFT
import qiskit.tools.jupyter
circuit = QFT(4)
get_ipython().run_line_magic('circuit_library_info', 'circuit')
# In[2]:
from qiskit.circuit.library import QFT
import qiskit.tools.jupyter
circuit = QFT(4).inverse()
get_ipython().r... |
a14377b864c4ce49c32be1b6f66391c35216f612 | c1fb3b4318a7390f2f13578302db00741637e54d | tcund/SimpleRLFrame | /dict_deque.py | Python | py | 1,041 | no_license | #!/usr/bin/env python
# encoding: utf8
#
# @author : tcund@126.com
# @file : dict_deque.py
# @date : 2018/05/03 18:50
from collections import deque
class DictDeque(object):
def __init__(self, maxlen):
self.__que = deque()
self.__dict = dict()
self.__m... |
7757c96584a32e7e376e22b5398ad6079f82e297 | e317a803eb0e79d39816f2be0367d8d9e8a3ba59 | rmoorewrs/tic-windows-remote-clients | /wrs-remote-clients-2.0.2/python-wrs-system-client-1.0/cgtsclient/v1/storage_tier_shell.py | Python | py | 5,784 | permissive | #!/usr/bin/env python
#
# Copyright (c) 2017-2018 Wind River Systems, Inc.
#
# The right to copy, distribute, modify, or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# All Rights Reserved... |
72f59c10f1e0b2c8ea0b823f5e9f778f9fdddd61 | 0e9436fc12685ec0dd14dd775a5c61b87d8599a4 | cebartling/project-euler-solutions | /problem-004/python/solution.py | Python | py | 452 | no_license | #!/usr/bin/env python
largest_palindrome = 0
first_factor = 0
second_factor = 0
for i in range(100, 1000):
for j in range(100, 1000):
current = i * j
if (str(current) == str(current)[::-1]) and (current > largest_palindrome):
first_factor = i
second_factor = j
l... |
33842003af13a2f48769227f5f7d5f6e180f72d5 | a416bc8d8f4876be486e09ee689e7c82254435a5 | JeffYFHuang/gpuaccounting | /k8sdeployment/k8sstat/python/kubernetes/test/test_v1_load_balancer_status.py | Python | py | 978 | permissive | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.15.6
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... |
30cd53c7117932062fbbfe03de5709d6aaa50902 | c1ecc4fb4fe7a0771a41167cb1c3cfceceb75017 | tsaith/htracking | /htracking/utils/image_utils.py | Python | py | 1,647 | no_license | import numpy as np
class patch_extractor:
"""
Image patch extractor.
Assume that image has the format of (height, width, channels).
"""
def __init__(self, width, height):
self.image_w = width
self.image_h = height
self.bbox = None
def locate(self, bbox):
"""
... |
f3c77f471ce87345554c1e105efe5bb0a030432e | 05a36e00a577be73c0f5e58f73cc38033c20f666 | pranavmswamy/leetcode | /subtreeOfAnotherTree.py | Python | py | 1,411 | no_license | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSubtree(self, s: TreeNode, t: TreeNode) -> bool:
# TRAVERSE TREE IN PREORDER (COULD HAVE DONE ... |
62952cc10c0860a763510550ff3d9777063cd92e | 1d4f140956917b10f24b0b12e8d27cd22d78a8af | jackispm/bitcoin-abc | /test/functional/rpc_psbt.py | Python | py | 22,097 | permissive | #!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the Partially Signed Transaction RPCs.
"""
import json
import os
from decimal import Decimal
from tes... |
5e5d718b6f4c79264e379fba89ca3c502c7ecf40 | df93915133794ac74c6b36717cc3558f926386ea | doismellburning/cla_backend | /cla_backend/apps/legalaid/migrations/0042_auto__chg_field_case_outcome_code.py | Python | py | 36,973 | permissive | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Case.outcome_code'
db.alter_column(u'legalaid_case', '... |
d7e2dbee44cc0bc84c391f97a9d466b3f3bf2dd9 | a838aaa13a4a24530bfa09e9c3bec5466c584221 | Aneeq-Younas/Calculator | /cal.py | Python | py | 818 | no_license |
num1= int (input("Enter your first number: "))
num2= int (input("Enter your second number: "))
print("Enter your choose ")
print("Addition +")
print("multiplication *")
print("subtraction -")
print("division /")
print("reminder %")
print("power **")
choose= input("select you choose for calulation: ")
... |
59cece3669d9ad8d3b0292dd6f01a395aab89c16 | 87db1ef0eb851ca9e2a289cc1a3db94ce38ab7fc | qh73xe/SRP | /srp/tts/views.py | Python | py | 3,074 | no_license | # -*- coding: utf-8 -*
""" tts.views.py
OpenJtalk 用の Views
"""
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView, FormView
from django.views.generic.detail import DetailView
from django.urls import reverse_lazy
from .models import Roid
from .forms import TalkFo... |
a28076cc7ca78b0a63d58bdb0395a40ebb14ec54 | 980a4ab55d7178053a7eb4c642994dee9e5cb524 | murrayrm/BioCRNPyler | /biocrnpyler/dcas9.py | Python | py | 2,369 | permissive | # Copyright (c) 2019, Build-A-Cell. All rights reserved.
# See LICENSE file in the project root directory for details.
from .component import Component, RNA
from .mechanism import Reversible_Bimolecular_Binding
from .chemical_reaction_network import Species
class guideRNA(RNA):
def __init__(self, guide_name, d... |
9a8c64a1846223c1f584671a76f57c7664de23aa | f9653e14d8c8e1f75197a642260bf24715d3c1bd | cruzeMc/capstone2 | /app/.~c9_invoke_SJOnFG.py | Python | py | 18,280 | no_license | from app import app
from flask import render_template, request, redirect, url_for, send_file, flash, g, jsonify
import os
from app import db, login_manager, UPLOAD_FOLDER, ALLOWED_EXTENSIONS
from flask.ext.login import login_user, logout_user, current_user, login_required
from werkzeug import secure_filename
from app.m... |
ab04ebd9aeb09e9ba66010c14bfd2a70d3e4d2d9 | 6dada1ded7ff2be6cf7281b15297a06347da5bb2 | Aries5522/daily | /2021届秋招/leetcode/动态规划/礼物最大价值.py | Python | py | 1,352 | no_license |
'''
在一个 m*n 的棋盘的每一格都放有一个礼物,每个礼物都有一定的价值(价值大于 0)。你可以从棋盘的左上角开始拿格子里的礼物,
并每次向右或者向下移动一格、直到到达棋盘的右下角。给定一个棋盘及其上面的礼物的价值,请计算你最多能拿到多少价值的礼物?
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/li-wu-de-zui-da-jie-zhi-lcof
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
动态规划
第一列和第一排的数字很容易知道
依次填第二排的数字
依次第三排...
'''
class Solution:
def maxV... |
35446284194434e437fb996497cd2c887a29d007 | db709ab4bb51bb45581819e308cb44a02df64dab | shekarneo/ocr-teamcode | /vedastr_cstr/vedastr/converter/ctc_converter.py | Python | py | 1,393 | permissive | # modify from clovaai
import torch
from .base_convert import BaseConverter
from .registry import CONVERTERS
@CONVERTERS.register_module
class CTCConverter(BaseConverter):
def __init__(self, character: str, batch_max_length: int):
list_token = ['[blank]']
list_character = list(character)
... |
cb164ed8fe83208d186b602faa1b938590ff47e6 | 757d9fb44281ae78397b93f34e5c2ac9eaf7df27 | RealGeeks/django-admin-oauth2 | /test/test_middleware.py | Python | py | 2,116 | no_license | from mock import Mock
from freezegun import freeze_time
from django.contrib.auth.models import AnonymousUser
from django.test.utils import override_settings
from oauthadmin.middleware import OauthAdminSessionMiddleware
def setup_module(mod):
global mw
global request
mw = OauthAdminSessionMiddleware()
reque... |
544c839bd51b22d417b80fe335b861786a9fb1f6 | d451cf6b656852cd1aa7c0821692258e4de0bdee | avinashraghuthu/Arrays | /sort_0_1_2.py | Python | py | 444 | no_license | # http://www.geeksforgeeks.org/sort-an-array-of-0s-1s-and-2s/
def sort_0_1_2(arr, arr_len):
low = 0
mid = 0
high = arr_len - 1
while mid <= high:
if arr[mid] == 0:
arr[low], arr[mid] = arr[mid], arr[low]
low += 1
mid += 1
elif arr[mid] == 1:
mid += 1
else:
arr[high], arr[mid] = arr[mid], arr... |
7cd5431ce0d4bb3d790b1a045d7010e20d54c100 | c718a453587f2523d16189c7363ca55c6bca7a18 | datadevopscloud/fugue | /tests/fugue_sql/test_utils.py | Python | py | 2,931 | permissive | from fugue_sql._utils import fill_sql_template
def test_fill_sql_template():
data = {"a": 1, "b": "x"}
assert ( "select * from tbl where a = 1 and b = 'x'"
== fill_sql_template("select * from tbl where a = {{a}} and b = '{{b}}'", data)
)
assert ("""select * from tbl where a = 1 and b = "x" """
... |
3eba72811ba7b06ef4544880131dfd1e614f5162 | 0f174c0c3103691c06c6aec2b66e0e1ec1de078d | xxdecryptionxx/ToontownOnline | /toontown/safezone/MMPlayground.py | Python | py | 1,730 | no_license | # File: t (Python 2.4)
from pandac.PandaModules import *
import Playground
import random
from direct.fsm import ClassicFSM, State
from direct.actor import Actor
from toontown.toonbase import ToontownGlobals
class MMPlayground(Playground.Playground):
def __init__(self, loader, parentFSM, doneEvent):
P... |
fa2443c15343f13902b52ac647624ba886851177 | 40aaf59f63fb6c017998e54a70910b15e9d36282 | DESY-CMS-SUS/cmgtools-lite | /HToZZ4L/python/tools/DiObjectPair.py | Python | py | 3,024 | no_license | from ROOT import TLorentzVector
from CMGTools.HToZZ4L.tools.DiObject import DiObject
class DiObjectPair( TLorentzVector ):
'''Class used for A->VV'''
def __init__(self, leg1, leg2,leg3,leg4):
a=DiObject(leg1,leg2, doSort=False)
b=DiObject(leg3,leg4, doSort=False)
lv=a+b
super( D... |
a6b34022ee522518100f39bdf049921fdb5e7341 | 6b89aba1caa389f75b4a5e5eb59d04b8ce6f4f33 | antoine-thibaut/3YP-Code | /Regenerative braking modelling code/regenerative_model_updated.py | Python | py | 41,876 | no_license | # NOTE: This code borrows a similar structure used for route modelling in Section 4
# References:
# [1]: FreeMapTools. (2019). Elevation Finder. [Online].
# Available at: https://www.freemaptools.com/elevation-finder.htm.
# [Accessed 26h of March 2021]
# [2]: Oxford Bus Company. (2020). park&ride500 Covid-... |
43d51feaa20d433122892c338d2b22edff50ff59 | efc62ffcd123637ddc46c2a1530d8881d5adbe8e | qwc-services/qwc-feature-info-service | /server.py | Python | py | 6,220 | permissive | import locale
import os
from flask import Flask, Response, jsonify, request
from flask_restx import Api, Resource, reqparse
from jwt.exceptions import InvalidSignatureError
from qwc_services_core.auth import auth_manager, optional_auth, get_identity
from qwc_services_core.api import CaseInsensitiveArgument
from qwc_s... |
4450033cd9b8faca4ad597c8a86d2c75b6b9e84b | bc46c37bbc19b3da6227281d26e10d60ebba00a6 | Sundaaay/3.23__D2D | /New/server/server.py | Python | py | 3,967 | no_license | '''
该项目修改思想:
将介于client与server之间的固定的通信流程修改为:
1、server不会无故向client发送消息
2、每个client与server之间初始建立连接时会初始化传递一些变量(此处通信流程为固定)
3、client向server发送消息类型暂时分为三类:ClientPosition,HowToDelete,RequestFile
server对收到的信息类型进行判断,并作出相应行为(每类消息中的通信流程为固定)
'''
import socketserver
import json
import time
import os
from .file_system import get_all... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.