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 |
|---|---|---|---|---|---|---|---|---|
78d21885342f324782f682f2ef79f964423d3587 | a7b607465009379f2e9c616f9e2dd5584f8bcaff | liuman/config | /false_structuresv3/try.py | Python | py | 2,950 | no_license | import foolbox
import numpy as np
import torchvision.models as models
if __name__ == '__main__':
# instantiate model (supports PyTorch, Keras, TensorFlow (Graph and Eager), MXNet and many more)
model = models.resnet18(pretrained=True).eval()
preprocessing = dict(mean=[0.485, 0.456, 0.406], std=[0.229, 0.22... |
5493955d604de76a98a44138ad504c8a9365d811 | 474eeb9e9280883ea62b9752257de5b29e8449d5 | Ojansen/Hairdresser | /mysite/hairdresser/migrations/0001_initial.py | Python | py | 1,061 | no_license | # Generated by Django 2.2.1 on 2019-11-03 20:02
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Hairstyle',
fields=[
('id', models.AutoFiel... |
fef4a20f30ed30b5043ae1182244bf56d8f3c0f3 | 1bae3ef30dfda9f3d9a36a51d2dd493a08175f28 | smolkinad/smolkinad | /hw9/proga9.py | Python | py | 699 | no_license | import re
def text_from_file(filename):
f = open(filename, 'r', encoding = 'utf-8')
text = f.read()
return text
def find_forms(text):
forms1 = re.findall('["\s\n]?най[дт][иеёуя](?:те?|шь|м)?', text, flags = re.IGNORECASE)
#print(forms1)
forms2 = re.findall('["\s\n]?нашё?л[аио]?', tex... |
b5672e8ba5dc5116f0112811e67b5c5e6822b801 | 8544b4a7f0783fea915886e130cde5b85b15cc04 | Eawag-SWW/social-weather-gauge | /apis/wunderground_api.py | Python | py | 1,308 | no_license | from io import StringIO
from datetime import date
import requests
import pandas as pd
from apis import Query
class WundergroundQuery(Query):
def __init__(self, place_id: str, begin: date, end: date):
self.place_id = place_id
self.begin = begin
self.end = end
def __repr__(self):
... |
dc996692d404aa484973dcece749175cad492a86 | 8f4a8d5534696e8604ccaeae312c86e3024fe9a5 | firdavsxon/data-structure-and-algorithms | /Graph/graph1.py | Python | py | 1,131 | no_license | class Graph:
def __init__(self):
self.number_of_nodes = 0
self.adjacent_list = {}
def add_vertex(self, vertex):
self.adjacent_list[vertex] = []
self.number_of_nodes += 1
def add_edge(self, vertex1, vertex2):
if vertex1 in self.adjacent_list and vertex2 in self.adjacent_list:
self.adjacent_list[vertex... |
eb5cc83c185305ef24bf6112dc5556a198201feb | 080a739cd9c63a2e8912df6d1db125c54c90fed1 | mchaisso/hgsvg | /sv/utils/rmdup.py | Python | py | 3,501 | no_license | #!/usr/bin/env python
import sys
import Tools
import pdb
import argparse
ap = argparse.ArgumentParser(description="Remove overlapping entries, with options on how to determine overlap.")
ap.add_argument("--leftjustify", help="Only look to see if left (lower) coordinate overlaps, using window.", default=False, action=... |
54095dc13dad3e877ccf70e98f9f40b1be3dd70b | b18c3fcac06b69fe602e82892fc5df808647cc37 | shubh-agrawal/python_tools | /shubh_crawler.py | Python | py | 620 | no_license | #!/usr/bin/env python
from selenium import webdriver
from pyvirtualdisplay import Display
import webbrowser
import time
import os
i=0
chromedriver = "/home/shubh/python/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
while 1:
driver = webdriver.Chrome(chromedriver)
driver.get("http://shubhagrawa... |
4ec9af64647e7d257f42e53666d5ad41e680b7ce | 7b7ed0e725e38e410540dbe1943f37743cbd0c31 | alexiewx/PracticalDeepLearningPython | /chapter_13/mnist_cnn_exp28.py | Python | py | 2,248 | permissive | from __future__ import print_function
import keras
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers import Dense, Dropout, Flatten
from keras.layers import Conv2D, MaxPooling2D, Activation
from keras import backend as K
import time
N = 1024
batch_size = 64
num_classes = 10
epochs... |
09eb157cd0c4d6dfd171212400d792c4eb2c67ab | bd79ca8a4a014c58f8087e5d69ba4bc13db7466d | VineetMakharia/LeetCode | /332-Reconstruct-Iternary.py | Python | py | 836 | no_license | class Solution:
def findItinerary(self, tickets):
from collections import defaultdict
graph = defaultdict(list)
# Build a basic graph
for from_,to in tickets:
graph[from_].append(to)
# Sort based on the destinations you can go to
for key in graph:
... |
8a7f70c4487a1d0eb676b2d97382084102100cd8 | 2dadb408e3b61fe4f3a304fe8ea0d444a31c2476 | Ethic41/cryptohack | /general/xor/xor_starter.py | Python | py | 441 | no_license | #!/usr/bin/env python
# -=-<[ Bismillahirrahmanirrahim ]>-=-
# -*- coding: utf-8 -*-
# @Date : 2021-05-02 23:15:59
# @Author : Dahir Muhammad Dahir
# @Description : something cool
def main():
test_input = "label"
target_num = 13
new_string = ""
for i in test_input:
new_string += chr(ord(i... |
48d3dd89cd3d5b8419c95dcad959ad0d6c7dd673 | 0f60b47c42629311305a0ed41e1e59bc301c1294 | VahidooX/NeMo | /nemo_text_processing/inverse_text_normalization/ru/verbalizers/money.py | Python | py | 1,326 | permissive | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. 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 requ... |
56f7449e351e676386a2683c8363f6a7dca479be | 478648705f3d10d5111ee2cfbf411bda04287628 | tharindupr/Algorithms | /Trees/Binary_Search_Tree.py | Python | py | 4,636 | no_license | class Node:
"""
Tree node: left and right child + data which can be any object
"""
def __init__(self, data):
"""
Node constructor
@param data node data object
"""
self.left = None
self.right = None
self.data = data
def insert(self, data):
... |
c8251badd4ed635396996049744c778c3d8f48dd | 2bf76c48d015a1a73b007f46f79fd27cfb790ee0 | wangshuocas/COVID-19 | /ERSCOVIDTest/COVID-19/COVIDGenerator.py | Python | py | 4,030 | no_license | """
"""
from generator import Generator
import os
import h5py
import json
import scipy.io as sio
import numpy as np
from six import raise_from
from PIL import Image
lungNCP_classes = {
'normal' : 0,
'NCP' : 1
}
class LungNCPGenerator(Generator):
def __init__(
self,
data_dir,
... |
3c8fa0c389246c1df2627b2fd3ffdc6a4bc9ceb8 | 473c567dd87d3ffdbc97a3a2bda1938dc984545e | stitrace/zabbix_cisco_ise | /ise.py | Python | py | 1,788 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import requests
import json
import xmltodict
import datetime
from requests.packages.urllib3.exceptions import InsecureRequestWarning # @UnresolvedImport
requests.packages.urllib3.disable_warnings(InsecureRequestWarning) # @UndefinedVariable
def get_item(url):
... |
593aa634f2ad27211bfb864aaa6de3d2cb36753e | 4e95ea8479647dfa9dda648ed93ad14ac14ce3f9 | dougbrown1048/ETR107-Projects | /Ch 6 problems/Exercise 6.1.py | Python | py | 339 | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 30 13:05:00 2020
@author: dbrown
"""
def b(z):
prod = a(z,z)
print(z,prod)
return prod
def a(x,y):
x = x + 1
return x * y
def c(x,y,z):
total = x + y + z
square = b(total)**2
return square
x = 1
y = x + 1
print(c(... |
2feacf8eb64046ae5d7c72c6e44d7fca858b1161 | f5d2b0d91f7ca99514ac88c98b08b72b751ce29b | alasdairnicol/advent-of-code-2019 | /day14.py | Python | py | 1,664 | no_license | from dataclasses import dataclass
from collections import defaultdict
import math
@dataclass
class Reaction:
output_chemical: str
output_quantity: int
input_chemicals: list
def __str__(self):
return f"{self.output_quantity} {self.output_chemical}"
def read_input(filename):
with open(fil... |
766f6378481f1c7fccbb40cf750a79bb1dd6af5b | 62e2d7c8904fce48928f2d4a6b845b1cf8e85d71 | lanaHamedeh/musicPlayer_api | /TheaterL/schema.py | Python | py | 249 | no_license | import graphene
import musicLib.schema
class Query(musicLib.schema.Query, graphene.ObjectType):
# This class will inherit from multiple Queries
# as we begin to add more apps to our project
pass
schema = graphene.Schema(query=Query)
|
a61d0c2a5b0d1b0a8b6d24a98c30cb911c38e010 | 66eb021ea5a3f78811e7751111e5c1d50567db59 | lcvigano/DialogueClassifier | /lstm_effort/LSTM/lstm.py | Python | py | 1,274 | no_license | import torch
import torch.autograd as autograd
import torch.nn.functional as F
import torch.nn as nn
import torch.utils.data as data
class LSTM(nn.Module):
def __init__(self, embeddings, args):
super(LSTM, self).__init__()
self.embeddings = embeddings
vocab_size, embed_dim = embeddings.sh... |
370035adac854f81698526506d7668731afe6ed4 | dd1afd6d6649bc6b765714044020ad70e7d9a592 | joanjpx/python-csv-etl | /read.py | Python | py | 283 | no_license | import csv
import mysql.connector
mydb = mysql.connector.connect(
host="debian-sys-maint",
user="root",
password="yourpassword",
database="mydatabase"
)
with open('elements.csv') as File:
reader = csv.reader(File)
for row in reader:
print(row[0])
|
043e694b051ff136509223e624a5f26edc0b37c1 | 24c20db1314c64f1fd7eb77ab7691975dc8a0d82 | trustedanalytics/platform-tests | /project/modules/http_client/unittests/test_http_client_factory.py | Python | py | 5,366 | no_license | #
# Copyright (c) 2016 Intel Corporation
#
# 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 i... |
449337c27b39415e35c9137eb795e52e78905666 | 829d2efa1bb7e7cfd4c6ced98ca80aa8aa931bd9 | angelavelinova/Programming-101 | /week03/01.RPN/test_rpn.py | Python | py | 2,689 | no_license | import unittest
from rpn_calculate import *
class TestReversedPolishNotation(unittest.TestCase):
def test_when_single_digit_is_passed_then_return_the_same_digit(self):
expr = '45'
expected_result = '45.0'
self.assertEqual(rpn_calculate(expr),expected_result)
def test_when_two_numbers_are_pased_then_return_s... |
b140fb77c53212a8df7c99a14aadb1592fa0831f | d7e6a5873a1068a26278fd66357de5f3f3d2bd1f | chickenLags/BlenderNetworkingCode-old- | /stone_throw.py | Python | py | 456 | no_license | import bge
scene = bge.logic.getCurrentScene()
stone = scene.objects['bullet.000']
controller = bge.logic.getCurrentController()
own = controller.owner
if controller.sensors['Mouse'].status == 1 and controller.sensors['Property'].status:
stone.worldPosition = scene.objects['char.001'].worldPosition
stone.wor... |
b1801a0ab3ececd4b77a83acc847ca5300e07939 | bffd67e82b0dfc66214e683117d04c9163739b9f | lindayuanyuan/cancer-crowdfunding-explorer | /src/scrapingtools/renderercontainer.py | Python | py | 4,308 | permissive | import time
from .utils import log_message as print
import argparse
from sys import platform
from PyQt5.QtCore import QUrl
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage
class AttrDict(dict):
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__... |
4e54482dc32d8f5b3d6d085fd4637b72c5a64ff4 | be22427939a813abcb5259136b0d6686e4ced3dc | yashvarshney003/Mean-Variance-calculator | /mean_var_std.py | Python | py | 2,139 | no_license | import numpy as np
import copy
def calculate(nums:list):
calculation = {}
if(len(nums) == 9):
array = np.array(nums).reshape(3,3)
mean(array,calculation)
variance(array,calculation)
standard_deviation(array,calculation)
max1(array,calculation)
min1(array,calculation)
sum1(array,ca... |
017fd9607d55667ad492cd32fd78f0950ecffba1 | 1d8673f72edfc4465aecfa7e00afc013b06c8ddf | yephper/django | /tests/string_lookup/tests.py | Python | py | 2,690 | permissive | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase
from .models import Article, Bar, Base, Child, Foo, Whiz
class StringLookupTests(TestCase):
def test_string_form_referencing(self):
"""
Regression test for #1661 and #1662
Che... |
6757737436fa2f40494cdb039a863ed468df945c | 4cbcf07a033196a78e5fc5fb1d36f7dd8c5d321f | AkshitBahri/Our_Himachal | /project/himachaltourism/migrations/0001_initial.py | Python | py | 538 | no_license | # Generated by Django 3.0.7 on 2020-12-21 07:46
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='imageupload',
fields=[
('id', models.AutoFi... |
1590bac7637f674fc3ed7f78007b5f48102042bc | b5c0bea832f3fdb37eba77bd05870383b2a3c333 | Salmank007/King | /SALMANKHAN.py | Python | py | 18,138 | no_license | #!/usr/bin/python2
#coding=utf-8
import os,sys,time,datetime,random,hashlib,re,threading,json,urllib,cookielib,requests,mechanize
from multiprocessing.pool import ThreadPool
from requests.exceptions import ConnectionError
from mechanize import Browser
reload(sys)
sys.setdefaultencoding('utf8')
br = mechanize.Browse... |
a14f6a44d09f5218676ab09d0e59478597bdd0c4 | 2141beb52cbf87d774f69859b269ec50528f6e55 | markovg/slithy | /examples/rst_content_cam_demo/main.py | Python | py | 506 | no_license |
# export PYTHONPATH=$PYTHONPATH:$HOME/theway/project/slithy
from slithy.presentation import *
#from slithy.library import test_objects
# new slide reader
import slithy.slidereader as slidereader
from slithy.slidereader import load_env, include_slides, imagefiles_to_images
# load the image and font environments
#loa... |
4cd7101a3010932b14aa861fe1849b5c96d50ef2 | 8776ff298fffe9fc373cd2e0bf4480fc645a9e7a | hivyas/azure-sdk-for-python | /sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/aio/_key_vault_client_async.py | Python | py | 5,225 | permissive | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
5091a3d8530941578ba0a32d9a8ae533a974f275 | 5eaf2ced2b43807aee80022e4fe6498fcc80d26b | dlmao/keras-resnet | /keras_resnet/models/_2d.py | Python | py | 12,400 | permissive | # -*- coding: utf-8 -*-
"""
keras_resnet.models._2d
~~~~~~~~~~~~~~~~~~~~~~~
This module implements popular two-dimensional residual models.
"""
import tensorflow.keras.backend
import tensorflow.keras.layers
import tensorflow.keras.models
import tensorflow.keras.regularizers
import keras_resnet.blocks
import keras_r... |
2cc5bdfc3cc3fc44dfa13b086f451f84ec0104dc | 61f672a68b700a0cbbb115ef500b5dd77eafe43e | cqann/PRGM | /Python/small_projects/Bermuda Triangle/app.py | Python | py | 4,095 | no_license | import pygame as pg
import random
import math
import os
import pygame
current_path = os.path.dirname(__file__) # Where your .py file is located
resource_path = os.path.join(current_path, 'resources') # The resource folder path
screen_width = 400
screen_height = 400
class Boat:
def __init__(self, x, y, prob):
... |
99b0f92fea5349f76dc8712cf2bb57b80a0f6bb9 | f4045ff43ce01c7107c507a895ec2503a1aaccd1 | PeterFromSweden/IPMailer | /email_smtplib.py | Python | py | 2,757 | no_license | import argparse
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import keyring
import getpass
import socket
class MailService: # Office 365
def __init__(self, user, psw):
self.user = user
self.psw = psw
# set up the SMTP server
se... |
9b81381a30d9a3843649779d3c2f55481aea91b8 | 8572131c690aa9a9b8eec2f50ac62902cba776f7 | sgaamuwa/ecommerce | /ecommerce/migrations/0004_auto_20190430_2221.py | Python | py | 448 | no_license | # Generated by Django 2.2 on 2019-04-30 19:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ecommerce', '0003_auto_20190430_2147'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='date_created',
... |
b56f494c379d03c567c6629fdaae901a1c435033 | ccc7cf35c9057a04508b38f02eab427774e1cfc9 | Sanich11/QAP-6 | /PycharmProjects/Mod14/Task14_2_4.py | Python | py | 369 | no_license | def reverse_str(string):
if len(string) <= 1:
return string
return string[-1] + reverse_str(string[1:-1:]) + string[0]
print(reverse_str('1234567'))
# Вариант записи:
# def reverse_str(string):
# return \
# string \
# if len(string) <= 1 else \
# string[-1] + reve... |
a0adeff95d38f7d54b831ee4107b58cce5a033c5 | 5b958c0fcdd85bbe74bfb642c3742b43e4689a5d | Kelos-Zhu/pyleecan | /pyleecan/Methods/Geometry/Circle/rotate.py | Python | py | 833 | permissive | # -*- coding: utf-8 -*-
from numpy import exp
def rotate(self, angle):
"""Rotation of the Circle of angle
Parameters
----------
self : Circle
An Circle Object
angle : float
the angle of rotation [rad]
Returns
-------
None
Raises
-------
AngleRotationCirc... |
8f591201413a321fde15dda8b2879967ab755dcb | 8b849dbb3e01fdd3ccc3ea9efa6564d5bf7d66bb | brianmajurinen/Assignment8 | /Assignment 8.1.py | Python | py | 992 | no_license | #Brian Majurinen
#Bellevue University CIS245
import os
#checking to see if the file path exists
filePath = input("Enter the exact path of the directory you would like to save this file to:")
pathExists = os.path.exists(filePath)
if pathExists is True:
print("That is a valid directory")
else:
print ("... |
25dddc026b0b52dbc730ae7866b109ef291c3141 | 7f7491e27e9b5823dc2ef1f5657dea305be13cda | theThing92/flight_information_chatbot | /flightDataBase.py | Python | py | 12,865 | no_license | import datetime
import operator
class FLightDataBase:
def __init__(self, fileName):
self.file = fileName
#get the data saved in the file
file1 = open(self.file,"r")
rawData= file1.read()
file1.close()
#split the date at EOL sign to get rid of it and to ... |
4e823896a2ffe876dba9e2e491aca4e8b48a495a | 11d37f0084139aa33d514dec34555f939d2a3e48 | arielofer/gamebook-maker | /gamebook/game_input.py | Python | py | 676 | no_license | from gamebook.input_interface import InputInterface
class Input(object):
def __init__(self, interface: InputInterface) -> None:
self.interface = interface
@property
def interface(self) -> InputInterface:
""" reference to the InputInterface object"""
return self._interface
@i... |
b18eb27f7f7b1e9aa0bd80cab9b9509ff0f8d86c | 652e73d94ee358110e11b4e456deab26df1481d5 | wasay/Full-Stack-Foundations | /finalproject/instance/config.py | Python | py | 279 | no_license | DEBUG = True
SQLALCHEMY_ECHO = True
# google - ws.com@gmail.com
# SECRET_KEY = 'mnzQ2wUNUsYFfN2472lJDs83'
# STRIPE_API_KEY = '6792364665-j1panvshfhbqhtntn755ugm2q0e9n2co.apps.googleusercontent.com'
# fb - Sample Apps
SQLALCHEMY_DATABASE_URI = 'sqlite:///restaurantmenu.db'
|
5d3d867dc0b7afc23b4638100626a2db5b790135 | 62b0f7a3bb4878d2c1a514a0250544c8ce7f97bb | metamarcdw/.dotfiles | /eric6/.eric6/eric6plugins/ProjectDjango/DjangoMigrationSelectionDialog.py | Python | py | 2,583 | no_license | # -*- coding: utf-8 -*-
# Copyright (c) 2016 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a dialog to select an application and migration.
"""
from __future__ import unicode_literals
import os
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets impor... |
f7f60fa24e1d80804bc894ee8c6850711fac5fca | 785219b57139c6076b93a00907bd884a892cfde3 | rajikalk/Scripts | /Modules/sfrimann/logsum.py | Python | py | 3,264 | no_license | #!/usr/bin/env python
# so that python 2.x and 3.x will work the same
from __future__ import print_function, absolute_import, division
import numpy as np
def logadd(logx, logy):
"""
Return log(x+y), avoiding arithmetic underflow/overflow.
logx: log(x)
logy: log(y)
Rationale:
x + y = e^logx... |
12c8fe5123b564c64e377d3c7a1d331bdb22f87a | a1c004922fa7a9bd14fa164848d228bada791783 | syurskyi/Python_Topics | /140_gui/pyqt_pyside/examples/PyQt_PySide_book/007_Graphic scene/001_Class_QGraphicsScene/604. setSelectionArea.py | Python | py | 1,796 | no_license | # -*- coding: utf-8 -*-
from PyQt4 import QtCore, QtGui
import sys
def on_clicked():
scene.setFocus()
myPath = QtGui.QPainterPath()
myPath.addEllipse(5.0, 50.0, 500.0, 200.0)
scene.setSelectionArea(myPath, QtCore.Qt.IntersectsItemShape)
print(scene.selectedItems())
scene.addPath(myPath, pen=QtG... |
5eed5664caf58f431cba90647ae6b1d4b1197e5f | 56378ee20597f88e75b26be9d9b9ef69f8a80d16 | NHERI-SimCenter/SimCenterDocumentation | /docs/common/testbeds/lake_charles/data/WindMetaVarRulesets.py | Python | py | 13,890 | no_license | # -*- coding: utf-8 -*-
#
# Copyright (c) 2018 Leland Stanford Junior University
# Copyright (c) 2018 The Regents of the University of California
#
# This file is part of the SimCenter Backend Applications
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that... |
04a5d1437a668ca4016c1088c5611f34c83cc2ca | 3fc04ab5d1d5299d4b783026bd1a6d42e35add4e | DanielTakeshi/dqn | /dqn/optimizer.py | Python | py | 2,805 | no_license | import torch.optim as optim
from dqn.utils.schedules import PiecewiseSchedule
import logging
class Optimizer:
def __init__(self, net, opt_params, max_num_steps, train_freq_per_step):
"""
`Optimizer` object wraps on top of PyTorch `optim` but with more
freedom to control learning rates dec... |
3ef29f74fa32cab6b34c830bd01309e402d05b99 | 913c3d3d293811a93cc010766bc204c9e6415dad | UWPCE-PythonCert-ClassRepos/SP_Online_Course2_2018 | /students/DennisLee/lesson08/mailroom_neo4j/mailroom_oo_neo4j.py | Python | py | 21,397 | no_license | """
This module defines the mailroom functionality using a Neo4J
database setup for the donor information.
"""
#!/usr/bin/env python3
import logging
import os
import datetime
import mailroom_db_login
def strip_text(text):
"""
Return text stripped of leading and trailing spaces. If the input
is not an ins... |
d0a6329822c6cfe3c59c1491c0c346475393fb72 | 67c8dfbfa95fac76be5d52f7f8cc8ad9959551c4 | wangzheng62/wztest | /listener.py | Python | py | 242 | no_license | def __listener():
r='结果'
while(True):
n=yield r
if n==4:
print(n)
#调用监听
def f():
func=__listener()
func.send(None)
while(True):
n=input('输入一个数字:')
n=int(n)
func.send(n)
if __name__=='__main__':
f() |
6cd637c1a01a76770cc3888da30e4d68f736660c | ea2ff18a32ca0f9024e10d15e750eeb3b54d92b5 | kai156277/PyQt5-Study | /PyQt5/DateTime/arithmetic.py | Python | py | 539 | permissive | from PyQt5.QtCore import QDate, QDateTime, Qt
now = QDateTime.currentDateTime() # type: PyQt5.QtCore.QDateTime
print("Today:", now.toString(Qt.ISODate))
print("Adding 12 days: {0}".format(now.addDays(12).toString(Qt.ISODate)))
print("Subtracting 22 days: {0}".format(now.addDays(-22).toString(Qt.ISODate)))
print("Add... |
c730af566889a2cf8728b61b77e49c19e602407b | 797aa14926cad9d222873d5cff3054a26552db12 | crobertz/atcoder | /ABC164/battle.py | Python | py | 228 | no_license | A, B, C, D = [int(n) for n in input().split()]
counter = -1
while A > 0 and C > 0:
counter += 1
if counter % 2 == 0:
C -= B
else:
A -= D
if counter % 2 == 0:
print('Yes')
else:
print('No')
|
538d40aeec460e724725e18aa4870bf2dd05b272 | 898c0250685bf11f9c4e8b230a4bc9c186b92088 | satyakumr/flask_database_app | /sample_orm.py | Python | py | 329 | permissive | import MySQLdb
import MySQLdb.cursors
db = MySQLdb.connect(host="127.0.0.1", user="root", \
passwd="example", db="flask_example_app", \
cursorclass=MySQLdb.cursors.DictCursor)
cur = db.cursor()
cur.execute("SELECT * FROM examples")
for row in cur.fetchall():
print(row['id'], ":", row['descri... |
e020da1e5ff7ca2af44b1c352770b623f2ed4756 | 449f3f3610fe969ae681702d2dd569162d0d6162 | DeveloperLY/Python-practice | /09_oop_feature/_18___new__方法.py | Python | py | 281 | permissive | class MusicPlayer(object):
def __new__(cls, *args, **kwargs):
print("创建对象,分配空间")
instance = super().__new__(cls)
return instance
def __init__(self):
print("播放器初始化...")
player = MusicPlayer()
print(player)
|
a0f6a6f70d2a64423b5cb13adb3cbab382698c42 | 6a155a1bb087fa07b30a4f6ee4e296acdb47a065 | pgeu/pgeu-system | /postgresqleu/confreg/migrations/0092_volunteerassignment_reminder_sent.py | Python | py | 474 | permissive | # Generated by Django 3.2.14 on 2022-09-07 21:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('confreg', '0091_conferencemessaging_socialmediamanagement'),
]
operations = [
migrations.AddField(
model_name='volunteerassignm... |
6dc225d72095b6e8e20582dd982869eafcc6a315 | 769f20b6acd68b432707dc28eded22ca73b4d979 | yihuang/django-filter | /django_filters/rest_framework/backends.py | Python | py | 5,615 | permissive | import warnings
from django.template import loader
from django.utils.deprecation import RenameMethodsBase
from . import filters, filterset
from .. import compat, utils
# TODO: remove metaclass in 2.1
class RenameAttributes(utils.RenameAttributesBase, RenameMethodsBase):
renamed_attributes = (
('default_... |
15d5036dbacb05a10e1cd861c401c71360e2b1ca | 0f3f0d95e4432eb554e37155e36a1ce0a1d80760 | Jarlene/pythran | /pythran/optimizations/forward_substitution.py | Python | py | 4,602 | permissive | """
Replace variable that can be lazy evaluated and used only once by their full
computation code.
"""
from pythran.analyses import LazynessAnalysis, UseDefChains, DefUseChains
from pythran.analyses import Literals, Ancestors, Identifiers, CFG, IsAssigned
from pythran.passmanager import Transformation
import gast as ... |
cb3e59aec97f92ce36c47dc843b8afccebf06204 | 9b2eb7ca9a348b0df8b2c8068518152f9dd73aeb | tandatoua/PythonLearn | /src/DjangoPorject/mypoject/venv/Scripts/easy_install-script.py | Python | py | 469 | no_license | #!F:\Git\PythonLearn\PythonLearn\src\DjangoPorject\mypoject\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==28.8.0','console_scripts','easy_install'
__requires__ = 'setuptools==28.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(... |
2a793abd940ab4855bcc0cf8a4db61c5c61d04da | 6264ce982953216d1e350d78b1a98038b3a797a6 | Abdulk084/CardioTox | /PyBioMed/build/lib/PyBioMed/PyMolecule/molproperty.py | Python | py | 7,724 | no_license | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2017, Zhijiang Yao, Jie Dong and Dongsheng Cao
# All rights reserved.
# This file is part of the PyBioMed.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the PyBioMed source tree.
"""
#####... |
f6cac323f5a81c7984ae7502d5ae73241f005bc4 | 1d362ba4260eaf234d1cb377c011918418f1e243 | jobscry/vuln_manager | /vuln_manager/cpes/urls.py | Python | py | 448 | permissive | from django.conf.urls import url
from . import views
urlpatterns = [
url(
r'(?P<level>part|vendor|product)/$',
views.index,
name='part_index'
),
url(
r'versions/$',
views.version_index,
name='version_index'
),
url(
r'watch-toggle/$',
v... |
9d9ae6bff209d5625188e18c3b1f6604a1da137c | 326d9b8c175ecea3e39b7522649318414216b111 | pallang/secretfridge | /venv/Scripts/alembic-script.py | Python | py | 422 | no_license | #!C:\Users\shan99\Documents\app\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'alembic==1.0.11','console_scripts','alembic'
__requires__ = 'alembic==1.0.11'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.arg... |
91fe53d7f88a6fcacfd23814557c9547a0d69704 | 1046a5dcf33987cc9920f2f7d8d2d1b97a9f531b | gloriiaq/django11 | /portfolio/blog/models.py | Python | py | 766 | no_license | from django.db import models
import re
# Create your models here.
# add blog app into setting, url, views, html ( might have done it already)
# create your models here
class Blog(models.Model):
title = models.CharField(max_length=200)
pub_date = models.DateTimeField()
body = models.TextField()
imag... |
ecbd3ba37955bae625e96cbec7c8e1491d187a69 | 3e214d179af83b16a612093d64fd031d5836caba | yumiaoran13/BanxueUIAuto | /src/testcase/testresource.py | Python | py | 733 | no_license | from basecase import MyTest
import random
import resourcePage
import unittest
import screenshot
class TestResource(MyTest):
"""资源"""
def test_filter(self):
"""筛选测试"""
testresource = resourcePage.ResourcePage(self.driver)
testresource.click_filter()
screenshot.screen_shot(self.d... |
ca3cbef12224796daa5dcd2ef96184aabbcb0fc7 | 5660f4976a37290f35c35a8c567ea178dbc32d4c | Karla-BJ/Programaci-n-2020 | /Clases/Funciones/ManejoArchivos.py | Python | py | 620 | no_license | #Leer
archivo = open ("Poema.txt", encoding= "UTF-8")
print (archivo)
lines=archivo.readlines()
archivo.close()
print (lines)
listaRenglones=[]
with open ("Poema.txt", encoding= "UTF-8") as lines:
for line in lines:
print (line)
listaRenglones.append (line)
print (listaRenglones)
nombre= input ("... |
42c397866e1a0483248b89deb08496bce4980532 | b280b3837c1cb3160bce95a537208e92225fe6ce | snaj2020/snajbackend | /SNAJ_Cirugias/apps/utilidades/Choices.py | Python | py | 1,384 | no_license | class Estados():
APROBADO = ('APRO','Aprobado')
AGENDADO = ('AGEN','Agendado')
CONFIRMADO = ('CONF','Confirmado')
CANCELADO = ('CANC','Cancelado')
PENDIENTE = ('PEND','Pendiente')
RECHAZADO = ('RECH','Rechazado')
RECIBIDO = ('RECI','Recibido')
SOLICITADO = ('SOLI','Solicitado')
POR_S... |
9b1a63e42142a9f0220043b17e883d60a7e137da | 21f4ae08cafd5fc31a16ab577bd2376e4d761d5d | 01010101111/chiffrement | /explications.py | Python | py | 2,003 | no_license | import time
print("Pour crypter un message, il faut utiliser le dossier chiffrement1.py")
time.sleep(1)
print("voici de quelle maniere il faut ecrire le message afin de le chiffrer")
time.sleep(1)
print("si je veux ecrire attaque, j'ecris : ")
time.sleep(1)
print("a")
time.sleep(1)
print("t")
time.sleep(1)
print("t... |
0570a8c575aebd2846e10fcd4d01eb110097cb85 | 3bfe6ed242b90242eb874d1f7eaa142dcf56c7b8 | SubhajitPalKeysight/sonic-mgmt | /tests/common/helpers/platform_api/thermal.py | Python | py | 1,830 | permissive | """ This module provides interface to interact with the thermal of the DUT
via platform API remotely """
import json
import logging
logger = logging.getLogger(__name__)
def thermal_api(conn, index, name, args=None):
if args is None:
args = []
conn.request('POST', '/platform/chassis/thermal/{}/{}... |
075d3c6ac0be37b32fa5d5d08f1e35b2a51c1f6d | 404841884cabcfa4b0cdb969315275e0fd29eb2f | ksuchoi1219/CS-1301 | /Homeworks/hw3.py | Python | py | 2,514 | no_license | #Kwang Su Choi
#CS 1301 B5
#902969968
#kchoi20@gatech.edu
#I,Kwang Su Choi, have worked on this assignment alone using only course materials.
def letterGrade(grade):
if int(grade)<=100 and int(grade) >=90:
return ("You made a(n) A.")
elif int(grade)<=90 and int(grade) >=80:
return ("You made... |
902edb47ceebd131d4fc0b4c98c26e83117e37dc | 6e1e8d3ee7bc404786f1a0e40dfc3cc601e0fc2f | Elton47/Ableton-MRS-10.1.13 | /_MPDMkIIBase/ControlElementUtils.py | Python | py | 1,064 | no_license | # uncompyle6 version 3.6.7
# Python bytecode 2.7 (62211)
# Decompiled from: Python 2.7.17 (default, Dec 23 2019, 21:25:33)
# [GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.16)]
# Embedded file name: /Users/versonator/Jenkins/live/output/Live/mac_64_static/Release/python-bundle/MIDI Remote Scripts/_MPDMkIIBas... |
ecd3bc442b13dde0b80fd11ca5f2156e014a9447 | b48fe627a9fac227c0a9bd7cd6c3318ce69a1671 | niuyaning/PythonProctice | /06/07/Serialization_xuliehua3.py | Python | py | 307 | no_license | import pickle
class Record:
def __init__(self,name,phone_number):
self.name = name
self.phone_number = phone_number
record = Record("牛亚宁",'15010561875')
with open("d:/2.txt","wb") as f:
print(pickle.dump(Record,f))
with open("d:/2.txt","rb") as f:
print(pickle.load(f))
|
b2d24ba64d36887d86851907621bcab0f4a00964 | 7777f8c3b46bed60af39d231af0dfc76a5db716d | nguyenngochuy91/programming | /interview/BFS/BFS.py | Python | py | 2,979 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun Jul 14 15:00:25 2019
@author: huyn
"""
import heapq,typing
from collections import deque
class TreeNode(object):
def __init__(self, x,left=None,right=None):
self.val = x
self.left = left
self.right = right
# given a graph where vertices are cities,... |
9a27792d83b2208829b0eb409586e0cfbcf67f4f | 82f0a2d921cc8a57559fc9840f2de8f0b8ba44eb | johndewees/iitmigration | /aalh_iit_buildings_011/merge-title-columns.py | Python | py | 3,567 | permissive | from openpyxl import load_workbook
import re
filename = 'aalh_iit_buildings_011.xlsx'
wb = load_workbook(filename)
ws = wb['Metadata Template']
minimumcol = 2
maximumcol = 2
minimumrow = 7
maximumrow = 1324
iterationrow = 7
targetcol = 2
locationcol = 13
datecol = 15
isodatecol = 16
commaspace = '... |
82df44d434c2173a13bf463a05a998fbe8d55950 | a7dd9ae4af7e00b6f7d1c582c8898bf2d620fa77 | peter-cudmore/seminars | /Sydney2019/plots.py | Python | py | 26,381 | permissive | from IPython.core.display import HTML
from string import Template
# HTML('''require.config({paths: {d3: "http://d3js.org/d3.v4.min"}});''')
# HTML('<script src = "https://d3js.org/d3.v4.min.js"></script>')
html_template = Template('''
<style> $css_text</style>
<div id="graph-div"></div>
<script>
require(["d3"], functi... |
b08198d1f7733fdb3b42c2349b70d4782d4947ba | 1a4d5ef92d27458cca5715f5a003eea99d4e3bc3 | vs-ou/spitz-new-site | /dog/migrations/0005_auto_20190115_1042.py | Python | py | 1,311 | no_license | # Generated by Django 2.1.5 on 2019-01-15 10:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dog', '0004_showresult_show_date'),
]
operations = [
migrations.AddField(
model_name='showresult',
name='show_id',
... |
d06497640028eb2e7f67b568fb81036d04c8a711 | 65736bf20fc53567cc1281e4e231967df87b08ce | verilogofking/BNN-and-TWN-Inference-for-keras | /models/print_weight.py | Python | py | 2,426 | no_license | from __future__ import print_function
import h5py
weight_file_path = 'LSTM0724_twn3.h5'
"""
Prints out the structure of HDF5 file.
Args:
weight_file_path (str) : Path to the file to analyze
"""
f = h5py.File(weight_file_path)
try:
if len(f.attrs.items()):
print("{} contains: ".format(weight_file_path)... |
0604bc8177fba6f91173e70c273d7255a6513a5e | a4e4b1a25d2f3349970c7d9120ac2b8bee99aefd | narutsoo/holoviews | /holoviews/plotting/plotly/renderer.py | Python | py | 4,033 | permissive | from __future__ import absolute_import, division, unicode_literals
import base64
import param
import panel as pn
with param.logging_level('CRITICAL'):
import plotly.graph_objs as go
from param.parameterized import bothmethod
from ..renderer import Renderer, MIME_TYPES, HTML_TAGS
from ...core.options import Sto... |
abe5611cb92fd4f27dc0b4bd35eb7ff1eb8a628e | bc170748a5fda38af281cb78f5e7f7c1320e1def | nornagon/bookwyrm | /bookwyrm/outgoing.py | Python | py | 12,219 | no_license | ''' handles all the activity coming out of the server '''
import re
from django.db import IntegrityError, transaction
from django.http import JsonResponse
from django.shortcuts import get_object_or_404
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_GET
from markdo... |
430bff1b06684b579c227adee6f3a1cd24634c5e | f2d980b973aeeed44bd3123414989e1096fd7bc8 | ysk24ok/leetcode-submissions | /0050/binary_search.py | Python | py | 608 | no_license | from typing import *
class Solution:
def myPow(self, x: float, n: int) -> float:
ret = 1
abs_n = abs(n)
while abs_n > 0:
if abs_n & 1 == 1:
ret *= x
abs_n >>= 1
x *= x
return ret if n > 0 else 1 / ret
if __name__ == '__main__':
... |
400bd3ee27d1cff57555bb800a1eb4c552c2bf34 | b6f67e5e4a1d2d4ab64061c852ec855b0d28c433 | NguyenVanThanhHust/Python_Learning | /RealPython/Calculator/sample/hello.py | Python | py | 490 | no_license | # hello.py
"""Simple Hello, World example with PyQt6."""
import sys
# 1. Import QApplication and all the required widgets
from PyQt6.QtWidgets import QApplication, QLabel, QWidget
# 2. Create an instance of QApplication
app = QApplication([])
# 3. Create application's GUI
window = QWidget()
window.setWindowTitle("... |
61349839dd38c28bd0802f64925f5c7696a7bba2 | 04e75ec718b936a78642c2938d641e0ad1755f70 | xiaominUMD/WGEVIA | /parallelMCg2v/multiChannelGen/src/g2vpre.py | Python | py | 4,746 | no_license | from readData import ReadMCData
import numpy as np
import sys
import os
import time
import networkx as nx
import multiprocessing
from multiprocessing import Pool
from swg2v.docGen import docGen
from swg2v.graphFeatureGen import graphFeatureGen
from swg2v.represent import represent
from swg2v.doDoc2Vec import doDoc2Vec... |
8e9be18dc3d5fecf36bdaa912ff8511de4157575 | 7572392a2c5bcd0ffb9528d83e6e766130f28bf6 | Aasthaengg/IBMdataset | /Python_codes/p02916/s807345611.py | Python | py | 262 | no_license | N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
m = 0
for i in range(N):
if A[i-1] == A[i]-1 and i != 0:
m += B[A[i]-1] + C[A[i-1]-1]
else:
m += B[A[i]-1]
print(m) |
6e5e73daf93080e1f733d71bb040d3492727f22c | eab6f3c11b82454ba8f452f0c51e7c7812e6b32c | akubera/Growler | /setup.py | Python | py | 1,620 | permissive | #
# setup.py
#
"""
A micro web-framework using asyncio coroutines and chained middleware.
"""
from os import path
from glob import glob
from importlib.machinery import SourceFileLoader
from setuptools import setup, find_packages
metafile = path.join(".", "growler", "metadata.py")
metadata = SourceFileLoader("metadata... |
5d7856bcdf8509145686056b22a91e7dd0e54c12 | c4d42e39a76368de2abd39126db45a0c49631134 | Eckankar/HCI-koldskaal | /koldstart/kode/app/controllers/user.py | Python | py | 404 | no_license | # -*- coding: utf-8 -*-
from app.utils import expose, template_response, local, url_for
from werkzeug import redirect
@expose(["GET"], ["/bruger/login"])
def login():
local.response = redirect(url_for("index"))
local.response.set_cookie("user_id", 1)
@expose(["GET"], ["/bruger/log_ud"])
def logout():
loca... |
20995bcd5d7dfc86d29d1fc292248256e92d71be | 5ab2325132a9caa83639aeddc5ee1eb11ea8b388 | rogeriofalcone/salt-alert | /setup.py | Python | py | 1,783 | permissive | #!/usr/bin/python2
'''
The setup script for salt
'''
import os
import sys
from distutils import log
from distutils.core import setup
from distutils.sysconfig import get_python_lib, PREFIX
NAME = 'salt-alert'
VER = '0.1.0'
DESC = 'An alert delivery system that extends the salt core'
doc_path = os.path.join(PREFIX, 'sh... |
38d7c5796eaef3db12815f12a26430a9795079d7 | 1486aebede6ec53887a82dee54aa07efcab89a19 | cmput401-fall2018/web-app-ci-cd-with-travis-ci-dong-alex | /selenium_test.py | Python | py | 559 | permissive | from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
driver = webdriver.Chrome()
driver.get("http://204.209.76.196:8000")
def test_home():
# grab the elements for testing
assert driver.find_element_by_id("name") != None
assert driver.find_element_by_id("about") !=... |
5e027f952f958f84a1c2f410ff4a236a0ed40503 | 29b21afd02fdb8bf4160ded37d72f3c5b386d532 | TencentAILabHealthcare/scBERT | /predict.py | Python | py | 4,510 | no_license | # -*- coding: utf-8 -*-
import os
import gc
import argparse
import json
import random
import math
import random
from functools import reduce
import numpy as np
import pandas as pd
from scipy import sparse
from sklearn.model_selection import train_test_split, ShuffleSplit, StratifiedShuffleSplit, StratifiedKFold
from sk... |
013863f03a66cbb352c5738a74f8a3a48b9d75c5 | 3653b53305818454980bcb0a9fe7a54d0b9ea897 | albusdemens/Preparation_J-PARC_2014 | /Plot_result_Laplacian.py | Python | py | 425 | no_license | import numpy as np
import matplotlib.pyplot as plt
with open("file.txt") as f:
data = f.read()
data = data.split('\n')
x = [row.split(' ')[0] for row in data]
y = [row.split(' ')[1] for row in data]
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.set_title("Plot title...")
ax1.set_xlabel('your x label..')
a... |
4e8f0ab66b2ee9aaf4bbda2d15d784ab5b629658 | abba29a4d16261a7060d9aaa408f67b7924fb4bf | lfisher1998/Python-Techdegree-Project-11-FINAL | /pug-or-ugh_v1/backend/pugorugh/tests.py | Python | py | 6,278 | no_license | import json
from os import path
from django.urls import reverse
from django.contrib.auth.models import User
from rest_framework import status
from rest_framework.test import (APITestCase,
APIRequestFactory, force_authenticate)
from . import models
from . import serializers
from . impo... |
694e7c230ca3662f41a5101717127fbb11f6c7b7 | 9c2f66464621a9a0ef93dcd49221d16d7b8a0335 | sumofyouvcg/Vcg_new | /company_management/message_views.py | Python | py | 11,878 | no_license | from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib import messages
from django.shortcuts import redirect, get_object_or_404
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core.urlresolvers import reverse
from django.utils.trans... |
f2de3df60d4af2680d47a08376c5a250e551eb16 | d5c07a72dca6c9442b481abf38ab0dc137b3093c | yonicarver/cs265 | /Lab/4/lab04/id.py | Python | py | 640 | no_license | # python 3.5
# -----------------------------------------------------------------------------
# Yonatan Carver
# CS 265 - Advanced Programming
# Lab 04
# -----------------------------------------------------------------------------
# Q2.3
# -----------------------------------------------------------------------------
f... |
5685424996c90848c0d4e1c3d519fafb51b19486 | 2204e95c4ccb13716e8eea6ab1c40541d37c7979 | DinossauroBebado/Anki_Leaderboard | /lb_on_homescreen.py | Python | py | 8,682 | permissive | import datetime
from datetime import date, timedelta
try:
from aqt import gui_hooks
except:
pass
from aqt.deckbrowser import DeckBrowser
from aqt import mw
from aqt.deckbrowser import DeckBrowser
from anki.hooks import wrap
from .userInfo import start_user_info
from .config_manager import write_config
f... |
87a2e854d5be9725a52e9732912ed5297065c2d7 | 4e844875f8c4c8061b6e891551079a6d6d86c4d3 | vnitikesh/loki | /django_prjct/django_prjct/views.py | Python | py | 332 | no_license | #from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'index.html')
def signup(request):
return render(request, 'signup.html')
def login(request):
return render(request, 'login.html')
def homepage(request):
return render(request, 'hom... |
9255bc21e2844d02e3c2ecc3e34556bfcd51f9f8 | 6da0b27036649420a60f909e85ffd3f63caf578d | MatBarba/new_genome_loader | /scripts/gff_metaparser/gen_meta_conf.py | Python | py | 5,211 | permissive | import argparse
import sys
from genmetaconf.metaconf import MetaConf
from genmetaconf.manifest import Manifest
def get_args():
parser = argparse.ArgumentParser()
# in files
parser.add_argument("--raw_meta_conf", metavar="meta/species", required=False,
type=argparse.FileType('rt', encoding=... |
4c45ca51c2ba0c98b616cf2fddf3fda750df82be | 87b898461cabae1a28282eea8a362d90f335f62b | a3013998769/lps_compsci | /class_samples/3-2_logicaloperators/age_game.py | Python | py | 247 | no_license | print('How old are you?')
age = int(raw_input())
print('What is your GPA?')
GPA = float(raw_input())
if GPA > 3.0 and age > 16:
print('congratrurations, welcome to Columbia!')
if GPA <= 3.0 or age <= 16:
print('Sorry, good luck at Harvard.')
|
637d8158172412e9fd9339d7550a9cffca7594f4 | 4cddda78a1e1278d7caf45665037f7dce38ec5a5 | sanaiqbalwani/human-Bc | /video.py | Python | py | 5,383 | no_license | import distutils.spawn
import distutils.version
import os
import os.path as osp
import subprocess
import numpy as np
from gym import error
class SegmentVideoRecorder(object):
def __init__(self, predictor, env, save_dir, checkpoint_interval=500):
self.predictor = predictor
self.env = env
s... |
2b49e69200ffa2f674c2e3a568dabfd0fac5c926 | 992745809cbb2f7537d36e799f34d1e809fb9b05 | l10es/explainable-dqn-pytorch | /visualize.py | Python | py | 6,604 | no_license | import math
import torch
from torch.nn import functional as F
def gaussian_kernel(sigma=3):
"""
Compute a Gaussian kernel
:param sigma: scale of the Normal
:return: kernel of shape [5 sigma]^2
"""
kernel_size = int(5 * sigma)
# Create a x, y coordinate grid of shape (kernel_size, kernel... |
6d54905e594b4d56685e269272afcaa88850ac8f | 9768cfc380c70bbbc9833b4cf9613ad2034067c2 | garyyh78/tf-tutorial | /gan.py | Python | py | 6,694 | no_license | import tensorflow as tf
import numpy as np
import os
from tensorflow.examples.tutorials.mnist import input_data
# random data init
np.random.seed(0)
tf.set_random_seed(0)
# download MNIST
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
n_samples = mnist.train.num_examples
print("total t... |
721688fb14f040604898aa89913574ae9f831dab | d2d2af4e51e19372bae85071ae46fc19abeb3143 | hanming123/hanming | /test_selenium/test_demo.py | Python | py | 1,729 | no_license | import json
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
class TestTestweixin():
def setup_method(self):
# self.driver = webdriver.Chrome()
chrome_args = webdriver.ChromeOptions()
chrome_ar... |
953bbd542c9a4699aeb7fff4417d0637806a6b90 | a344e312f64841c4305b1dc598179dddaee25c38 | liuzhidemaomao/pywick | /pywick/models/segmentation/testnets/Unet_nested_layers.py | Python | py | 16,052 | permissive | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
def weights_init_normal(m):
classname = m.__class__.__name__
#print(classname)
if classname.find('Conv') != -1:
init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find('Linear') != -1:
init.n... |
9c5b498e52fd15de61b2e9e33d0f64a6eadfc188 | 10ec95072fa3a69640d76d010b3a7560fcf6811f | zengfung/JaneStreetMarketPrediction | /src/traditional_ml/decisiontree.py | Python | py | 1,533 | permissive | # decision tree model
import pandas as pd
x = pd.read_csv("../../dataset/input_data.csv").to_numpy()
resp = pd.read_csv("../../dataset/output_data.csv").to_numpy()
##
from sklearn.decomposition import PCA
import numpy as np
pca = PCA(n_components = 1)
resp_pca = pca.fit_transform(resp)
y = (resp_pca > 0).astype("int"... |
11a3e68378b2f4af6041a41d02f3ccf920c65da5 | 77127deb5684b356827507b44e0aaa4bfa4e2fcb | wen-chen/My_Script | /BioInfo/GTF2BED_0.2.0.py | Python | py | 2,270 | no_license | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 11:03:05 2015
@author: biochen
"""
import sys, getopt, re
opts, args = getopt.getopt(sys.argv[1:], "hi:o:")
for op, value in opts:
if op == "-i":
GTF_File_Name = value
elif op == "-o":
BED_File_Name = value
elif op == "-h":
print("... |
44741b40303311ec69564ed5f2a2a06ccbd32561 | ae96736dcc7b6b93931968632f1d5b842b1994dd | aebonilla2019/python-challenge | /PyParagraph/PyParagraph.py | Python | py | 2,278 | no_license | #load dependencies
import os
#load RegEx
import re
#Import mean from statistics
from statistics import mean
#set variable with path to source file
read_file_path = os.path.join('raw_data','paragraph_1.txt')
#define word count variable and set initial value
word_count = 0
#defie sen... |
1de2963b46ea5a8d09a54aa4507c802e1f310d7c | 84eca6076d44e11f30db495d4b7fa2f24993156d | pigycoin-project/pigycoin | /test/functional/wallet_encryption.py | Python | py | 3,621 | permissive | #!/usr/bin/env python3
# Copyright (c) 2016-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 Wallet encryption"""
import time
from test_framework.test_framework import PigycoinTestFramework... |
9e74942a1d005cdfe3cbf33b0d3ee901c3fd8c47 | c9eee67f1e8bb6bd19a81284789fe618a15a5cf0 | maainul/TryDjango | /5.Model_form/trydjango/src/products/views.py | Python | py | 516 | no_license | from django.shortcuts import render
from .models import Product
from .forms import ProductForm
# Product create form
def product_create_view(request):
form = ProductForm(request.POST or None)
if form.is_valid():
form.save()
form= ProductForm()
context={"form":form}
return render(request,"products/product_crea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.