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 |
|---|---|---|---|---|---|---|---|---|
ea56427494393a43ce756a695245d3f666678377 | 06b27874eb258d10b0587e9054623a01cd2b72ad | psterdale/ucsmsdk | /ucsmsdk/mometa/ether/EtherFcoeInterfaceStatsHist.py | Python | py | 13,959 | permissive | """This module contains the general information for EtherFcoeInterfaceStatsHist ManagedObject."""
from ...ucsmo import ManagedObject
from ...ucscoremeta import MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class EtherFcoeInterfaceStatsHistConsts:
MOST_RECENT_FALSE = "false"
MOST_RECENT_NO = "no"
... |
55d3c95334cace430cb98a0fc2bd69d28f724d0b | 9ae3a808a7dc78bcc357ed9921f7eac84375612e | phucle2411/LeetCode | /Python/add-two-numbers.py | Python | py | 1,027 | permissive | # https://leetcode.com/problems/add-two-numbers
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self, l1, l2):
"""
:type l1: ListNode
:type l2: ListNode
:rtype: ... |
0a038d3645fdb266a195bf2bb0487f2cfbb5bacc | 1c9902ba3ccfbdc86a5f63ceb091b1a504800b72 | anarcher/enso-launcher-continued | /src/platform/win32/SConsTools/Helpers.py | Python | py | 3,526 | permissive | import os
import types
def addInstanceMethodToEnv( env, function ):
"""
Adds the given function as an instance method to the given SCons
environment.
"""
envClass = env.__class__
methodName = function.__name__
# Make sure the class doesn't already have a method by the same
... |
1a526509e67805c0ffb790e5bad16d2b4c504087 | da847bdf5a047bf0a7372c8a094ca49e14cc647c | 584669/code | /dm/credit/scheme3/gotcha_gbdt.py | Python | py | 4,696 | no_license | import os
import warnings
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import lightgbm as lgb
import time
from sklearn.linear_model import HuberRegressor
import sklearn.ensemble as tree_model
from tqdm import tqdm
import datetime
pd.set_option('display.max_column',100)
warnings.filterwarnings(... |
4921c66c0031f93bcd649013de3a204f6c49def3 | 4e524388f0a7124a45fa5a69e5ab5ae29a4fe1b6 | KupitzA/BI3 | /Assign2/BioGRIDReader.py | Python | py | 3,814 | no_license | from os.path import exists
from sets import Set
class BioGRIDReader:
'''Reads BioGRID tab files'''
def __init__(self, filename):
'''
Initialization, read in file and build any data structure that makes you happy
'''
# Use dic of Sets of Tuples
self.storage = dict()
... |
385349fcfb095d0a42396280fcb405236e817ed8 | dff5354d22062b3eb165d102212d4216ba2b47c7 | yaplej/freenas | /src/middlewared/middlewared/plugins/snapshot.py | Python | py | 16,928 | no_license | from datetime import datetime, time, timedelta
import os
from middlewared.common.attachment import FSAttachmentDelegate
from middlewared.schema import accepts, returns, Bool, Cron, Dataset, Dict, Int, List, Patch, Str
from middlewared.service import CallError, CRUDService, item_method, private, ValidationErrors
import... |
b226a78216c83b2fdee822340b9f1186efe63034 | 7583dec1dd8c21ef1ee246ea9dfaa7856bb3dabc | Alex-Medium/Ensemble-Pytorch | /torchensemble/snapshot_ensemble.py | Python | py | 18,286 | permissive | """
Snapshot ensemble generates many base estimators by enforcing a base
estimator to converge to its local minima many times and save the
model parameters at that point as a snapshot. The final prediction takes
the average over predictions from all snapshot models.
Reference:
G. Huang, Y.-X. Li, G. Pl... |
a5c5f6b406d719e8ed64ac791d66c24f7633f92e | 232a75343d7fd0fac4a5f4435f34c4646005a167 | NOKIA-GAP/trouble-shooting-api | /notificaciones/migrations/0001_initial.py | Python | py | 6,798 | no_license | # Generated by Django 2.0 on 2018-01-14 04:46
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('asignaciones', '0036_asignacionni_detalle_solicitud_visita'),
('users', '0014_perfil_par'),
... |
7f4df2f73d43c326eaa6bec18480ace56cb0cdc5 | 4bca4ac0089e2ad29b1a58be932534d31cf02608 | sanchez0623/zsq.LearningPython | /oop/c3.py | Python | py | 631 | permissive | # __dict__变量的用法
class Student():
name = 'demo'
age = 18
def __init__(self, name, age):
# 错误方式:给'类变量'赋值
name = name
age = age
# 正确:给'实例变量'赋值
# self.name = name
# self.age = age
student1 = Student('zsq', 18)
# 当__dict__找不到该变量name时,会向上寻找——>类似于C#去找父类的变量
# 所以此... |
bd1f7809d062611a85bbda8415bf7ac15bedb174 | 643d0ca93f9c6b8147d23f3b09c91cf5a058c782 | jovany-wang/ray | /python/ray/_private/runtime_env/working_dir.py | Python | py | 6,234 | permissive | import logging
import os
from pathlib import Path
from typing import Any, Dict, List, Optional
from ray._private.gcs_utils import GcsAioClient
from ray._private.runtime_env.context import RuntimeEnvContext
from ray._private.runtime_env.packaging import (
Protocol,
delete_package,
download_and_unpack_packag... |
7ee3b859cf95e726c48ee7ba54efad0d1f73effb | 3e510dfa0c3be6e82d196570798ee83cfeb73ed8 | jeszytanada/pjt_inventory_proto | /pjt_inventory/migrations/0023_product_category_id.py | Python | py | 590 | no_license | # -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-07 05:39
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pjt_inventory', '0022_suppliercontact'),
]
operati... |
bdd3e8b6038636d07644a36d978ad20557797fba | 961eab516295fd55606c5ea1f77783d6ff24febc | Ammar68/hr | /dependent/models.py | Python | py | 507 | no_license | from django.db import models
class DependentName(models.Model):
class Meta:
# db_table = 'dependent_name'
verbose_name_plural = 'Dependent Name'
Sex = models.CharField(max_length=250)
Bdate = models.CharField(max_length=250)
Relationship = models.CharField(max_length=250)
... |
67e92143c1ed4906819e720bee08b1ccab98944e | cace6ceef21dc740c2e07f2ad706688daf258fc8 | renhang0214/learn_python | /qz_homework/qz_hw_day2/qz_hw_day2_5.py | Python | py | 2,930 | no_license | # /usr/local/bin/python
# -*- coding: utf-8 -*-
# Author:Ren Hang
"""
五、用户交互,显示省市县三级联动的选择
"""
dic = {
"北京": {
"朝阳区": ["123", "456"],
"崇文区": ["789", "101"]
},
"辽宁省": {
"沈阳市": ["铁西区", "沈河区"],
"锦州市": ["古塔区", "黑山县"],
},
}
exit_flag = True
while exit_flag:
print("WELCOM... |
b1b45d698d9ad5230cc1bd0da6645e8daee7b3b3 | c82f0604a1f9c077e7cfcbcef6cfb6d8d80a6bb9 | zhaipro/acm | /leetcode/509.py | Python | py | 314 | permissive | class Solution:
def fib(self, n: int) -> int:
if n == 0:
return 0
if n == 1:
return 1
f_0 = 0
f_1 = 1
f_n = 0
for _ in range(n - 1):
f_n = f_1 + f_0
f_0 = f_1
f_1 = f_n
return f_n
|
9d1f2548ccfb4029a7dcd76970d7949c8ba648ca | b480cb1ccc9b5f2ea508f1f0f3cc2ed97af33f19 | suncongch/Python_Post | /11.py | Python | py | 304 | no_license | # -*- coding: UTF-8 -*-
from urllib import requests
import io
response = request.urlopen("http://www.fanyi.baidu.com/")
html = response.read()
html = html.decode("utf-8")
f = io.open(r'C:\Users\Andy\Desktop\html.txt', 'w',encoding='utf-8')
f.write(html)
f.close()
print('鍐欏叆鎴愬姛')
|
a57e05672e057aa5b1e2a4f31639eaf18a382c96 | 5784ec111490e2862912d7a65d99f121d6cd52d6 | gjz22cn/study_repo | /tensorflow/opencv/pre_handle.py | Python | py | 11,077 | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import cv2
import numpy as np
from PIL import Image
import os
import matplotlib.pyplot as plt
g_row_fill_out_v = 10000
g_col_fill_out_v = 10000
g_labels = ['0_good',
'1_yinliesuipian',
'2_quejiaobenbian',
... |
c7c0007ce05508d632d6c653405389ab1cb5a55d | e885d61f76675e4e169efb624e7aec91e3118c0a | shafeeralip/ecommerce | /ecom/prod/migrations/0010_auto_20200928_0140.py | Python | py | 431 | no_license | # Generated by Django 3.1.1 on 2020-09-27 20:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('prod', '0009_customer_order_orderitem_shippingadress'),
]
operations = [
migrations.AlterField(
model_name='orderitem',
... |
4d628ffa297d5135d18ea6f3c761c96be4801d8a | a07f4137679b036c84ddccad27ef87a73048bcb1 | ahmedalshamary/AdventOfCode2020 | /day2/day2.py | Python | py | 1,202 | no_license | '''
Part 1 pretty straightforward, just loop through input and check if valid
Part 2 also straightforward, i wasted like 10 mins here because i used == instead of =, didn't realize cause no error message only wrong value.
'''
file = open('input.txt', 'r')
# Part 1 Solution
def is_valid_part1(min, max, password, cha... |
ba97f061af93f5d12759f797218f0a242726ac80 | b65485b9a3876236cf2bfb41c5b2bbd762e33360 | hanfang302/py- | /python基础/函数.py/函数游戏.py | Python | py | 772 | no_license | # 打开游戏 首先下载游戏,在手机界面存储游戏开关标志
account_password = {}
# 定义游戏
def wzry():
print('1. 打开王者荣耀')
# 打开后有一个注册按钮
def register():
zhanghao = input('请输入帐号')
password = input('请输入密码')
if zhanghao in account_passord.valiue():
print('对不起,帐号已经被占用')
else:
# 把注册的帐号保存起来,也可以理解为传输或则发送给腾讯服务器
account... |
2a564d3a54ed0dba65faafa8053a88fc414608ab | ca84507dc8d878d72207cb7f4664b1b6281e92d3 | swawozny/typeracer | /register/migrations/0006_auto_20200513_2058.py | Python | py | 745 | no_license | # Generated by Django 3.0.6 on 2020-05-13 20:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('register', '0005_auto_20200513_2056'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='avg_cpm'... |
24046335be8fbfdcf265282778cd9cc532be96a2 | 13565229a16bb871d5561c079efb5f4012fc4b0e | aumit210780/Practice-Python | /String Function1.py | Python | py | 489 | no_license | a = "hello world!!!"
print(a.upper())
b = "HELLO WORLD!!!"
print(b.lower())
print(a.capitalize())
print(a.index("o")) #Print leftmost index of "o"
print(a.rindex("o")) #Print rightmost index of "o"
# print(a.index("@")) ;It will give error because @ is not present in the index
print(a.find("o")) #It will pri... |
d6bfbcaa209fbf18212990e08411e3f3b314d18b | 414d683b38a30084826f8ffa37c8dcd6ded1215c | medihen/unmo | /part4/responder.py | Python | py | 2,721 | no_license | # Python初心者に送る「人工知能の作り方」
# http://sandmark.hateblo.jp/entry/2017/10/07/141339
# に掲載されたコードを写経して勉強する。
import re
from random import choice
class Responder:
"""
AIの応答を制御する思考エンジンの基底クラス。
継承して使わなければならない。
メソッド:
response(str) -- ユーザの入力
プロパティ:
name -- Responderオブジェクトの名前
"""
def __init__(s... |
9748be18d4090358831f91fd5f8f0704175a13b0 | 767d9d15db6686b3ce2f8b8da3b7415583d4757c | kartiktripathy/It-s-B.I.N.G--A-webapp-for-Flight-Rate-prediction-through-ML | /app.py | Python | py | 6,599 | no_license | #Importing the libraries
import streamlit as st
import pandas as pd
import pickle
#Loading the model from the pkl file that was stored before
load_regg = pickle.load(open('flight_rate_predictor.pkl', 'rb'))
#Taking the input from the user
st.image('flight.jpg')
st.header("It's B.I.N.G!")
st.write("Predict the prices... |
34f11781c1441edaca088d40d8f0cc3b399a8e89 | 23143ebac12a4105928333241c0168f743608ef4 | alexandermendes/explicates | /setup.py | Python | py | 968 | permissive | from setuptools import setup, find_packages
requirements = [
"Flask>=1.0.0, <1.1.0",
"SQLAlchemy>=1.2.0, <1.3.0",
"Flask-SQLAlchemy>=2.3.0, <2.4.0",
"alembic>=0.9.9, <1.0.0",
"jsonschema>=2.6.0, <3.0.0",
"flask-cors>=3.0.2, <3.0.3",
"unidecode>=1.0.22, <2.0.0",
"zipstream>=1.1.4, <1.2.0... |
ce662b7e33ff7c4ae50e2d671d8d81522128a65f | 0a85b440c1e66c9c41eac4199c466c7ebb921986 | adityavaishampayan/CMSC828C-project1 | /CMSC_828C_Project1/KNN_LDA.py | Python | py | 9,537 | permissive | #!/usr/bin/env python3
'''
Copyright (c) 2019 Aditya Vaishampayan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy... |
e3bb2e1c9ebe91aa432d65b178f63b0404d4f731 | 24b3312a8cffcc7f8f9336cadde64dca4ae3b3b2 | mcitron/LHC_recast | /for_pythia/write_pythia_input.py | Python | py | 3,441 | no_license | #!/usr/bin/env python
import sys
try:
slha_file = sys.argv[1]
mode = sys.argv[2]
energy = sys.argv[3]
nev = int(sys.argv[4])
except:
print '[slha] [mode] [energy] [nev]'
exit()
if mode in ['QqN1']: mode = 'squark_only'
if mode in ['GqqN1', 'GttN1', 'GqqN2lLlN1', 'GqqC1wN1', 'GqqC1wN2zN1']: m... |
9db92c2fc9ff82a3e3d3756f91d055968e125cca | c73077a78ae9112e1c74dc8a1fa2bd8d1cf361ff | chiruconew/NLP_tripmodel | /src/features/clean.py | Python | py | 494 | no_license | import spacy
from typing import List
import re
import pandas as pd
import gensim
from typing import Generator, List
import spacy
def clean_up_text(df:pd.DataFrame) -> List[str]:
data = df.review.values.tolist() # convertir a lista
data = [re.sub(r'\S*@\S*\s?', '', sent) for sent in data] # Quitar e-mail
... |
ace4994b9f529a14f764b5768ff5ffa9f042e83f | 9640898d88911398ca4cbd1032e4be37912e5af3 | sjdv1982/seamless | /tests/highlevel/filesystemlike.py | Python | py | 471 | permissive | from seamless.highlevel import Context
ctx = Context()
ctx.filesystem = {"test.txt": """
This
is
a
test
"""
}
ctx.job = lambda input: None
ctx.job.language = "bash"
ctx.job.code = "awk 'NF > 0{print $0 \" OK!\"}' input > RESULT"
ctx.job.input = ctx.filesystem["test.txt"]
ctx.result = ctx.job
ctx.compute()
print(ctx.res... |
3893f762bc9c4d07049857c0646c05df682531ba | aea3e04128b33027905d951cf101f08fd2e43aaa | jochym/cc1 | /src/wi/urls/user/user.py | Python | py | 3,126 | permissive | # -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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... |
2ca2f656f173a0752300fa447ab9a3db2617fb6e | 5a05b8fc8d70b330938aa4520b2bd0c738760e0a | kcelinned/Fenxi | /app/analyser.py | Python | py | 2,271 | no_license | from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import pandas as pd
import numpy as np
import re
import plotly
import plotly.express as px
import json
analyser = SentimentIntensityAnalyzer()
def get_results(df):
pos_tweets = df[df.sentiment == 'positive']
pos_retweet = 0
for tweet... |
6b19e4c83642f8776e8da67e1d074b7e66d9b3c8 | 64c3de599a6e7753620c6d310f8e655db991da48 | kkutt/cryptopals | /tests/test_set1.py | Python | py | 1,163 | permissive | #!/usr/bin/env python
# Tests for Set 1
__author__ = "Krzysztof Kutt"
__copyright__ = "Copyright 2017, Krzysztof Kutt"
from challenges import set1
# --------------- CHALLENGE 1 ---------------
def test_challenge1():
hex_input = "49276d206b696c6c696e6720796f757220627261696e206c" \
"696b65206120... |
07dee67fca9fdb75780cac39eb6316af38181ce0 | 4a2a724a8fd4c1e914429e6010b4288e1be0b28a | mmmarchman/ProjectEulerProblems | /PythonProblems/Problem8/Euler8.py | Python | py | 631 | no_license | '''
@author: McClain
Find the greatest product of five consecutive digits
in the 1000-digit number(located in prob8.txt).
http://projecteuler.net/problem=8
'''
fileName = 'prob8.txt'
greatest_product = 0
with open(fileName, 'r') as f:
content = f.read().replace("\n", "")
for i in range(0, len(content)... |
16b67d99fe403fc70592fc1cfd69b58964cbf834 | a6fc52201a9f2fcd116c36bb15219de4799ab9af | peinanteng/leetcode | /combinationSum.py | Python | py | 1,092 | no_license | class Solution(object):
def combinationSum(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: List[List[int]]
"""
# define the result
self.res = []
# sort the numbers in the candidates array
candidates.sort()
... |
fdd2b133de82bc5701ccfd6aace9d51341560551 | 949f6f096725d7ac10c7bb91b0d1bc3296e0d681 | jakubczakon/trains | /trains/backend_interface/metrics/reporter.py | Python | py | 30,611 | permissive | import json
import logging
import math
from time import time
try:
from collections.abc import Iterable # noqa
except ImportError:
from collections import Iterable
import six
import numpy as np
from threading import Thread, Event
from ..base import InterfaceBase
from ..setupuploadmixin import SetupUploadMixi... |
bc712c41e14d0278977429990507fef33a6834ed | d252e00f429677591a6b2f13f313d10ac3bda917 | AdamZhouSE/pythonHomework | /Code/CodeRecords/2522/60683/245314.py | Python | py | 270 | no_license | nums1 = eval(input())
nums2 = eval(input())
extra = []
i = 0
while i < len(nums1):
if nums1[i] not in nums2:
extra.append(nums1[i])
nums1.remove(nums1[i])
i -= 1
i += 1
res = sorted(nums1, key=lambda x: nums2.index(x)) + extra
print(res)
|
eae738f30e1ca7ca6b5843034c26dc34a0fa671f | 7e4f2f6bebc34b889107cd4b6530c2c23044b259 | LegendTianjin/DRNE | /test/test_VS.py | Python | py | 2,103 | no_license | import numpy as np
import os, sys
import networkx as nx
from scipy import stats
from scipy.spatial.distance import pdist, squareform
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, '..')))
from src.utils ... |
4b4d36ddad8d943bf72cb5a6110f51bdca5fa77f | 6cbe230a811283626325456616634b6c0f6796c6 | jagwithyou/sentiment-analysis-using-lstm | /flask_integration/tweet.py | Python | py | 1,580 | no_license | import re
import tweepy
class TwitterClient():
def __init__(self):
'''
Class constructor or initialization method.
'''
# keys and tokens from the Twitter Dev Console
consumer_key = 'Ba1b8bMxYntM3g8B7boQpx9f6'
consumer_secret = 'I8JNVAfmFaEb6iRJrCXUExe6M86BhB4mzq16qi8OMDohP4kehg'
access_token = '77... |
437f0238ce606fa7ee3d7a889a63a384f101dd22 | e00eca01925754a7d60cdd4959eb630cabc27e96 | cedricmoullet/mapproxy | /mapproxy/image/merge.py | Python | py | 5,883 | permissive | # This file is part of the MapProxy project.
# Copyright (C) 2010,2012 Omniscale <http://omniscale.de>
#
# 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/... |
47da806ae68585d34b4bcf2b7ff6699fad6e1e56 | 3e2f3ac0b84cf2914d983280210e0d3f7b5d0aa5 | burgerdev/lazyflow | /lazyflow/operators/opArrayCache.py | Python | py | 17,614 | no_license | #Python
import time
import weakref
import itertools
from threading import Lock
import logging
logger = logging.getLogger(__name__)
from functools import partial
#SciPy
import numpy
#lazyflow
from lazyflow.request import RequestPool
from lazyflow.drtile import drtile
from lazyflow.roi import sliceToRoi, roiToSlice, ge... |
afe1cf06eb1b3a66ac14f224631a4646a99b5e79 | afafc92553adea52907b207980bc6f819634da37 | wakandan/pytorch-lightning | /pytorch_lightning/utilities/arg_parse.py | Python | py | 5,152 | permissive | """
List of default args which mught be useful for all the available flags
Might need to update with the new flags
"""
import os
def add_default_args(parser, root_dir, rand_seed=None, possible_model_names=None):
# training, test, val check intervals
parser.add_argument('--eval_test_set', dest='eval_test_set'... |
430344eed1d53c0046d3e85792f56df924cc3921 | e865c3f8083ad4fa66b7fdbcb1b7114412dfa83b | watanabe8760/udacity-da-p3-map-cleansing | /4_db_query.py | Python | py | 7,131 | no_license | from pymongo import MongoClient
import json
from bson import json_util
from pprint import pprint
from pprint import pformat
from pandas import DataFrame
import calendar
import seaborn as sns
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# Connect to "singapore" collection in "map" database
m... |
5d4c0c605dca1815cb794651939455fd1305c68b | a6ccb5a967942fdbb34eb054ad9c197a76841038 | Unleash12-IT/django-oscar-adyen | /tests/settings.py | Python | py | 629 | permissive | # """
# Django settings for tests project.
# """
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = '+&l^d!%soa4gxsnx7_txbo0x3uv$@4i&n!r8yte72otwqo7vmh'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}... |
d0e60f4ef7deb32e00631b6580ca215ade23219e | 4fccacf1db45f9cbd68588e3fff73513857c4a0a | GuilleCulebras/X-Serv-Practica-Aparcamientos | /practica_final/aparcamientos/models.py | Python | py | 1,176 | permissive | from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class Aparcamiento(models.Model):
nombre = models.CharField(max_length = 200)
descripcion = models.TextField(default = "")
access = models.CharField(max_length = 2)
enlace = models.TextField()
direccio... |
5e2828d7d33b00ec9e466eca4b75b258ed1571f4 | 622d954bf18d03f84621c6781b16a870c83bbeb8 | mpimd-csc/multidim-genpod-uq | /scripts/test_pce_mc.py | Python | py | 4,521 | permissive | import numpy as np
import gen_pod_uq.mc_pce_utils as mpu
from mat_lib_plots import conv_plot_utils as cpu
nulb = 3e-4
nuub = 7e-4
cplpar = 1e-4
nprocs = 1
def simit(uncdims=1, mcsims=5, pcedims=[3],
mcrunslist=[100000]):
if uncdims == 1:
def get_output(alpha):
alpharr = np.array... |
91f895272e9c845d7c456e33016d6170bb56c1cf | 21a28faa21814f9819df75ee5397d1095a2b2952 | Lucca15n/fishing-nets | /ship.py | Python | py | 1,076 | no_license | import pygame
class Ship():
def __init__(self, screen):
self.screen = screen
self.screen_rect = screen.get_rect()
self.image_right = pygame.image.load('images/ship_right.bmp')
self.image_left = pygame.transform.flip(self.image_right, True, False)
self.image = self.image_... |
a4f2d65a739ceb897c64ddd7e5f3ce10374ed1af | 7d5a2469eb53670cb99506b3e4f787b27f235237 | The-OpenROAD-Project/yosys | /backends/smt2/witness.py | Python | py | 14,404 | permissive | #!/usr/bin/env python3
#
# yosys -- Yosys Open SYnthesis Suite
#
# Copyright (C) 2022 Jannis Harder <jix@yosyshq.com> <me@jix.one>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission... |
9e8193569a51c288c83b378311cb5162370c8355 | d04e930825ef00bd5ce54fa7973d0e6a4bebdeb4 | alexandrenorman/mixeur | /energies/libs/carbon_taxes.py | Python | py | 1,620 | no_license | # -*- coding: utf-8 -*-
from decimal import Decimal
from energies.models import CarbonTax
TAX_AMOUNT = Decimal("1.2")
def get_carbon_taxes(start, end, custom_ref_tax):
carbon_taxes = list(
CarbonTax.objects.filter(year__gte=start, year__lte=end).values(
"year", "amount"
)
)
ca... |
5286cf5940c9f9d2feaad3bd7498d815f67d5ec8 | 9f15154c4ee3c38feeacffa9aa0b5593108bc2f2 | bkimmett/polynomial-byzantine | /multibyz_kingsaia_node_old.py | Python | py | 15,951 | no_license | #!/usr/bin/env python
from __future__ import division
from sys import argv
from time import sleep
import multibyz_kingsaia_network as MessageHandler
#getting an error with the above line? 'pip install kombu'
from enum import Enum
#getting an error with the above line? 'pip install enum34'
#some concerns:
#how to add ... |
ce1a1bb45c5b1ebe725c74c0a057211332c35bfc | a5489393b06ba823ffaafadf732c662e9c83abc9 | visualkev/pi-monitor | /event-detect.py | Python | py | 716 | no_license | #!/usr/bin/python
homedir='/opt/pi-monitor/'
imgdir='/opt/img-dir/'
import datetime
import RPi.GPIO as gpio
import subprocess
print gpio.RPI_REVISION
print gpio.VERSION
gpio.setmode(gpio.BOARD)
gpio.setwarnings(False)
gpio.setup(3, gpio.IN)
gpio.setup(7, gpio.IN)
gpo.add_event_detect(3, gpio.RISING)
gpo.add_event... |
7b17b9ac2a76a3bb5e72c2d0cd56aefe4837e618 | 52343cce1c8cd4a119807f171e5ba1e8f995e9ad | connolly/GalSim | /tests/test_image.py | Python | py | 83,511 | permissive | # Copyright (c) 2012-2014 by the GalSim developers team on GitHub
# https://github.com/GalSim-developers
#
# This file is part of GalSim: The modular galaxy image simulation toolkit.
# https://github.com/GalSim-developers/GalSim
#
# GalSim is free software: redistribution and use in source and binary forms,
# with or w... |
cf61e0c529b6f5d5272e2561dce421b6f4d50210 | 9b4cb6b184242c5d71d6fd2f513610d1cc179572 | the1bit/azure-sdk-for-python | /azure-mgmt-sql/azure/mgmt/sql/models/import_extension_request.py | Python | py | 3,493 | 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 ... |
fc11650e6d323b4485e4c3baee7441f986521e5f | a757edc2e54f8f8bf973d9ca2e18a40384b363d6 | joanca/apiinfoalumno | /src/apiinfoda/infoda2.py | Python | py | 7,341 | no_license | from bs4 import BeautifulSoup
from requests import session
import base64
class Infoda():
def __init__(self, user, passw):
self.usuario = user
self.password = passw
data = {
'action': 'login',
'username': '%s' % self.usuario,
'clave': '%s' % self.password
}
with session() as self.s:
self.s.po... |
25266455b80a169163701a6d62f273871850b1b5 | 4798ef9774bfdccecc86077b684a19a9a91af0e8 | JunJieYu1996/DGA_few_shot | /LSTM_models.py | Python | py | 2,381 | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
class SiameseNet_LSTM(nn.Module):
def __init__(self, vocab_size:int):
super().__init__()
self.vocab_size = vocab_size
self.embed_dim = 200
self.hidden_dim = 256
self.hidden_layers = 3
self.embed = nn.... |
b8b5d81f11dcfa06ef56e28d176fb5e9a9da5c21 | b77fba1379754e2b79e5b75329ef66604223aa53 | scychon/openmm_drudeNose | /example/nacl_tg.py | Python | py | 4,064 | permissive | from __future__ import print_function
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from drudetgnhplugin import *
from sys import stdout
from time import gmtime, strftime
from datetime import datetime
import os
# Thermostat parameters
temperature=300*kelvin
pressure = 1.0*atmospher... |
a43d5c52d1465b96edb0e74a3791b8179857c75b | b8d28f1c4bb1321592ea2d315e41ed271171f2f9 | marchon/frappe-login-face-detection- | /frappe/email/doctype/auto_email_report/auto_email_report.py | Python | py | 5,948 | permissive | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.document import Document
from datetime import timedelta
import frappe.utils
from frappe... |
f73b57de5b76b85a8c8a275be71505e388d813ce | 6849744b556f7f73f37115ecf9028d6f3207d36b | Python1991/Aquarium-Pro | /AquariumPro/AquariumPro/evaluations/models.py | Python | py | 658 | permissive | from django.db import models
# Create your models here.
class Evaluation(models.Model):
comment = models.TextField()
score = models.IntegerField()
class Meta:
abstract = True
class StoreEveluation(Evaluation):
evaluation = models.ForeignKey('stores.Store', related_name = 'store_eveluations', ... |
28e6f411a9ff5fa74493877c5980ed25f69ea4c0 | 0032a5b5051a90c92b48a1c1243d117434268d1b | vincentpanqi/PythonLearning | /CollectSystemInformation/15.py | Python | py | 826 | no_license | #!/usr/bin/env python
# coding=utf-8
# Created by Ferris on 2016/11/29
# 按字典值排序
# 按照字典value排序,类似sort -k 命令
# import operator
# x = {1:2, 3:4, 4:3, 2:1, 0:0}
# sorted_x = sorted(x.iteritems(), key=operator.itemgetter(1))
# sorted_y = sorted(x.iteritems(),key=operator.itemgetter(1), reverse=True)
# 找出占用空间大的文件
import o... |
023a2b22e338b34ff1d7176a311ed4fbc6527673 | 02bb242d157bed2e25659b1295d2966a808cc1d2 | simonecid/cmssw | /MagneticField/Engine/test/regression.py | Python | py | 1,058 | permissive |
import FWCore.ParameterSet.Config as cms
process = cms.Process("MAGNETICFIELDTEST")
process.source = cms.Source("EmptySource")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1)
)
process.load("MagneticField.Engine.volumeBasedMagneticField_090322_2pi_scaled_cfi")
process.testMagneticField =... |
b17834c54ea2cdb37d138dbf6348824418d99f27 | 662e3222d2be2d0c1434684f77cf4c6ac1874040 | ZdenekM/srs_public | /srs_likelihood_calculation/nodes/learning_server_dynamic_v1.py | Python | py | 17,017 | no_license | #!/usr/bin/env python
#################################################################
# \note historical_data record subscriber
# \input(from DEM to learning) command and candidates
# \output(from learning to DEM) candidate and correspomding likelihood
# Project name: srs learning service for choosing priority
# \... |
724f114d34ec9c9424d91e5c2a5a6472dfdbd5ca | c54411356ca2e6eb7a822f44b3c252c0e4f77383 | djdagovs/cherokee-webserver-distribution | /build-package.py | Python | py | 15,528 | no_license | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Cherokee Distribution
#
# Authors:
# Alvaro Lopez Ortega <alvaro@alobbs.com>
#
# Copyright (C) 2011 Alvaro Lopez Ortega
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License a... |
3c730d6fdab4fb8110c145f219409026941cebaf | 117e8b4d10d27064bb35abedcb58d581c55a6eee | greensnake/sympy | /doc/src/conf.py | Python | py | 5,069 | permissive | # -*- coding: utf-8 -*-
#
# SymPy documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 22 19:34:32 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickle... |
c37364800c45586df20b8397b53cd5b8382df7d7 | b71ec079fdf8b641b1d661512d549ad2efd82061 | zysymu/Metodos-Computacionais-da-Fisica | /Métodos B/07-runge-kutta4.py | Python | py | 1,989 | no_license | import matplotlib.pyplot as plt
from math import *
import numpy as np
plt.style.use("ggplot")
#variaveis
global x_in, tau, t, tf
steps = [0.1, 0.5]
tf = 6
x_in = 10.
tau = 2.
#analitica
ta = np.arange(0, tf, 0.0001)
xa = x_in * np.exp(-ta/tau)
#funcoes
def plot(step, plot_x, plot_y, met): #plot_x e plot_y sao lista... |
55e5f7105d667a9d2944a0ce473820c198f9d5a1 | 52cef148e005352d0f01e2aac38d4aceca081523 | momnus/waapi_helpers | /tests/test_create_objects.py | Python | py | 3,257 | permissive | from tests.util import WaapiTestCase
from waapi_helpers import (
get_guid_of_path, get_object, create_objects, walk_wproj,
begin_undo_group, end_undo_group, perform_undo, get_bank_inclusions_guids,
set_bank_inclusions
)
class CreateObjectsTestCase(WaapiTestCase):
EXISTING_FOLDER_NAME = 'Existing_Folde... |
95b704d4d0e648c61a75ba63122f6eefef68fb1c | 46b8644eb35c50f0bd599892ed213b031020b3c9 | sohailRa/web_spider | /techcrunch_v2/techcrunch_v2/items.py | Python | py | 425 | no_license | # -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class Article(scrapy.Item):
title = scrapy.Field()
text = scrapy.Field()
subtitle = scrapy.Field()
# A semicolon separated list of the... |
ef30fb0db104fc172c387e530cb733d45848c35c | cca4b98f1f44864eff9da5e7dd93f80e9f462e5f | oracle/weblogic-deploy-tooling | /core/src/main/python/wlsdeploy/util/weblogic_helper.py | Python | py | 13,666 | permissive | """
Copyright (c) 2017, 2022, Oracle Corporation and/or its affiliates.
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
"""
import java.lang.Exception as JException
import weblogic.management.provider.ManagementServiceClient as ManagementServiceClient
import weblo... |
88cad2f7da3895ea07ed4966d8edae332d15a0f1 | fe83c4f8531e4b18a34fc4ada582f4be0c2b8bac | macloo/python-adv-web-apps | /python_code_examples/flask/hello2.py | Python | py | 223 | permissive | """a demo Flask app with two decorators"""
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello World!'
@app.route('/foobar')
def foobar():
return '<h1>Hi there, foobar!</h1>'
|
37f37b9eec2ae942fcf63d9a048d2d3d29cab8cc | 3a4119327b222fe5258860b5d69b8e7b8e977156 | Aasthaengg/IBMdataset | /Python_codes/p02763/s413278548.py | Python | py | 398 | no_license | f=input
n,l,q=int(f()),list(f()),int(f())
B=[[0]*-~n for i in range(26)]
def S(o,i):
s=0
while i: s+=B[o][i]; i-=i&-i
return s
def A(o,i,x):
while i<=n: B[o][i]+=x; i+=i&-i
for i in range(n): A(ord(l[i])-97,i+1,1)
for i in range(q):
a,b,c=f().split(); b=int(b)
if a>'1': print(sum(1 for o in range(26) if S(o... |
b16350b333192a1a4954d6f60a1434581f40a91a | 1cf767ad99a90e047e0273e6becfeb3d6a116929 | JonathanAlderson/Chess | /Intelligence.py | Python | py | 31,740 | no_license | import os,sys,random,time
from datetime import datetime
import tkinter as tk
from tkinter import *
class Player(object):
allsquares = [(x, y) for x in range(8) for y in range(8)]
dullmoves = 0
def __init__(self, colour, nature, name):
self.colour = colour
self.nature = nature
... |
8c59a291e1ca932ba1f2c1dcd311b7ad40b5e728 | 6ecdf7451ce41557c0b9c1eb8e605865ebad9a1e | isabella232/azure-multiapi-storage-python | /azure/multiapi/storagev2/filedatalake/v2020_02_10/aio/_models.py | Python | py | 4,666 | permissive | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: ... |
5091c15ad3b835141c4c10bd151d3eea770384a4 | 38b247c3f2313f71eafe4a7144afdaa882b22bdc | IvayloValkov/Python-the-beginning | /Conditional_statements/02_bonus_score.py | Python | py | 298 | no_license | number = int(input())
bonus = 0
if number <= 100:
bonus = 5
elif number > 1000:
bonus = bonus + number * 0.1
else:
bonus = bonus + number * 0.2
if number % 2 == 0:
bonus = bonus + 1
elif number % 10 == 5:
bonus = bonus + 2
print(bonus)
print(bonus + number)
|
caebd6315b0299e78c7ffcf09e71360180f657c4 | fb04981f899f93ecdd496b683045033099418cb1 | vladmosin/NeuralODE | /agents/CommonAgent.py | Python | py | 498 | no_license | from torch import nn
class CommonAgent(nn.Module):
def __init__(self, device, neuron_number=32, input_dim=4, output_dim=2, t=1.0):
super(CommonAgent, self).__init__()
self.model = nn.Sequential(
nn.Linear(input_dim, neuron_number),
nn.ReLU(),
nn.Linear(neuron_nu... |
67cf94e61db458beee9bb0bc4f3e27ae89841403 | b6797522b857cc676a06e5bdc825d1d5851a6325 | mauriciozago/CursoPython3 | /Exercicios/ex044.py | Python | py | 884 | permissive | preco = float(input('Entre com o valor do produto: R$'))
pagamento = int(input('Qual vai ser a forma de pagamento? \nDigite 1 para dinheiro/cheque \nDigite 2 para cartão \nForma de pagamento: '))
if pagamento == 1:
print('O preço final do seu produto com 10% de desconto fica R${:.2f}!'.format(preco*0.9))
elif paga... |
42a8766177b9e3e3955e2f0bc3421897bde4e99f | a6b7e2892e98864a0e3629accfbd625ae3363f35 | josephwilliams/dm_bot | /test.py | Python | py | 205 | no_license | import requests
import json
res = requests.post(
url="http://pomf.cat/upload.php",
files={"files[]": open("screenshot.jpg", "rb")}
)
data = json.loads(res._content)
print data["files"][0]["url"]
|
2bf9640f37b0c95928e169cc84823c08928b749d | 48e2dd97470ced8af569647a519a9a87d7e494d0 | liuzm617/nova | /nova/tests/unit/compute/test_host_api.py | Python | py | 38,340 | permissive | # Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
# Copyright 2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/lice... |
a8309d95a218249648ae4835c550c36b86afabad | 6aa53c25a8fae1346a02ab1626e735d044371f6b | quasarj/gridtest | /src/example.py | Python | py | 1,235 | no_license | '''
Created on Nov 1, 2011
@author: qajarosz
'''
import numpy
from numpy.random import random_integers as rnd
def maze(width=81, height=81, complexity=.75, density =.75):
# Only odd shapes
shape = ((height//2)*2+1, (width//2)*2+1)
# Adjust complexity and density relative to maze size
complexity = int(... |
ab45070c22ef2f3d604cfa0c0c803c13dfbca6b5 | 0242de33688f8ef12938a2f7f80987067d0a63db | dbworth/py_numerical_methods | /root_finding/solve_pair_of_equations.py | Python | py | 743 | no_license | """
Solve a pair of equations
David Butterworth
University of Queensland
"""
from scipy.optimize import fsolve
import math
#------------------------------------------------------------------------------#
# Test 1
def equations(p):
x, y = p
return (x+y**2-4, math.exp(x) + x*y - 3)
x, y = fsolve(equations,... |
8cb66e14f021f5527c0c0a4cabe052ec85c891c2 | b084103f9fea11c37ef4afb64e0bc0506cdcc353 | shineloveyc/transformers | /src/transformers/modeling_distilbert.py | Python | py | 38,799 | permissive | # coding=utf-8
# Copyright 2019-present, the HuggingFace Inc. team, The Google AI Language Team and Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.or... |
1470ea7241f7c25f05201419caf569904d94468c | f39ac5d50a256a65d9869b40560a0fbac692cd12 | blacklc/Practice-for-python | /src/test_import/argvImport.py | Python | py | 798 | no_license | #!/usr/bin/env python
#coding:utf-8
'''
Created on 2016年5月11日
@author: lichen
'''
__author__='lichen'
import sys
def readargv():
argvlist=sys.argv
length=len(argvlist)
for i in range(length):
if length==1:
print 'already read the first argv,and the first argv is \"',argvlist[0],'\"an... |
fa547f110ac6ccf45d8e09e6e88fc41876c3ed55 | f0a6917d05b94e00c1cdc5ed4564159fbbcf7534 | scottzig/interpolation_and_ode_solvers | /na2_hw3_p2.py | Python | py | 1,124 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Numerical Analysis II Homework 3 Problem 1
This code approximates the integral of sin(1/x) on 0.05 to 1
using the Romberg algorithm
"""
import numpy as np
import matplotlib.pyplot as plt
true_val = 0.50283962;
def f(x):
return np.sin(1/x)
# Romberg Algorithm
... |
375e36289b0b5abdc2bee6644809ea0f036346b1 | af0612cc1dad836035bbe196655b983b1b8101a9 | alenkalac/electrum | /electrum/lnworker.py | Python | py | 69,244 | permissive | # Copyright (C) 2018 The Electrum developers
# Distributed under the MIT software license, see the accompanying
# file LICENCE or http://www.opensource.org/licenses/mit-license.php
import asyncio
import os
from decimal import Decimal
import random
import time
from typing import Optional, Sequence, Tuple, List, Dict, T... |
e11860be33d4c021945ac4adac97fd195b397ea0 | 9b0e0d74b65da1dda16307980e180d9146e5b09c | pcwong13/wardragons-gamepedia | /spellfamily.py | Python | py | 42,089 | no_license | #!/usr/bin/env python
import csv
import glob
import buildingdata
import spell
import spelldata
import requests
import wikilogin
def createSwitchStatement(key):
#print key
string = '-->{{#vardefine:'+key+'\n|{{#switch: {{{1|{{{id}}}}}}\n'
for row in spell_data:
string += '|'+row['identifier']+' = ... |
630832d56a239b50bc067925b266adcefb1f0e4d | c964b8c78c3e1043d2409204abe64da672b4df69 | shaharit18-meet/meet201617YL1cs-mod3 | /UserAccount.py | Python | py | 1,177 | permissive | class UserAccount :
"""
A class that models a user account for mega-social-media website, GuessMySecret
"""
def __init__(self, username, password, secret):
"""
Initialize the UserAccount object:
:param username: user name (string)
:param password: password to gain access... |
24569f054723c276c870845010e562129088c4c7 | 6137b297982825bbfb30ffb01fb2bba8100be251 | wmp3/desordres | /polygons.py | Python | py | 11,007 | no_license | import argparse
from datetime import datetime
import itertools
from pathlib import Path
import random
from typing import List
import numpy as np
import svgwrite
from svgwrite.shapes import Polygon
from svgwrite.extensions import Inkscape
from utils.colors import COLORS
BASE_DIR = Path(__file__).resolve().parent
OUTP... |
86c62c7398f9fefaa9b24f190b877ff7dcc56892 | 10107dd01705fea05aaafa7e31a7522ecc69a381 | rachanaahire/Django-CollegeDepartmentWebsite | /Library/forms.py | Python | py | 203 | no_license | from django import forms
from Library.models import Book
class LibraryForm(forms.ModelForm):
post = forms.CharField()
class Meta:
model = Book
fields = ('book_name','course',)
|
9f63c48dd9e95017262328b43c0096f6bc0960a8 | 0fd3e05fa82b7339f6f66c03230ca6452359461b | miferreiro/pagina-ventas | /handlers/sales.py | Python | py | 1,815 | no_license | # coding: utf-8
import webapp2
import datetime
from webapp2_extras import jinja2
from webapp2_extras import users
from model.Sale import Sale
from model.Bid import Bid
from model.Object import Object
class SalesPage(webapp2.RequestHandler):
def get(self):
user = users.users.get_current_user()
lo... |
cff9a14b3100e259dbfee044e5d7b7c818efee01 | 4cf644fcb2934778d7fc91c0dacbec3df7e5a8a4 | asmith26/EarthSim | /earthsim/io.py | Python | py | 5,273 | permissive | """
Input and output for geo-specific data formats.
"""
import numpy as np
import pandas as pd
import fiona
import geoviews as gv
import dask.dataframe as dd
import xarray as xr
import cartopy.crs as ccrs
from osgeo import gdal, osr
def get_sampling(bounds, shape):
"""
Generates x/y coordinates from bounds ... |
8c1897814ee60d676fcb35a4cd2917a28a69b454 | 059f9c194047be74804432b1f72b03c4ffc07e36 | adnanhanif793/Python-Codes | /Master in Selenium Automation with simple Python Language/Intermediate/WindowHandling.py | Python | py | 842 | no_license | '''
Created on 11-Oct-2018
@author: adnan.hanif
'''
from selenium import webdriver
driver=webdriver.Chrome()
driver.get('https://accounts.google.com/SignUp?hl=en')
driver.maximize_window()
driver.find_element_by_link_text("Help").click()
print("Before Switching")
parent=driver.current_window_handle #id... |
f65a196f1c32532632cfb65aaec16fe0613e3f4a | 953a7082075f94d002e9f91727414cf9aaa8818f | Fresh-Orange/stargan_re-rendering | /1nn_classfier.py | Python | py | 2,316 | permissive | from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import accuracy_score
import os
import cv2
import numpy as np
gallery = "/media/data2/laixc/AI_DATA/multi_pie_id_crop_test_gallery"
gallery_gray = "/media/data2/laixc/AI_DATA/multi_pie_id_crop_test_gallery_gray"
query = "/media/data2/laixc/AI_DATA... |
2a04fb64d514f02ebbdf60c7ef369deefd8d5292 | 818aee1dc847d2866e65d62fa268a7596f0a760b | nmazzilli3/Intro_to_Self_Driving_Cars_Nanodegree | /Matrix_Class_Project/kalman_filter_demo.py | Python | py | 12,429 | no_license | """
Kalman Filter and your Matrix Class
Once you have a working matrix class, you can use the class to run a Kalman filter!
You will need to put your matrix class into the workspace:
Click above on the "JUPYTER" logo.
Then open the matrix.py file, and copy in your code there.
Make sure to save the matrix.py file.
The... |
c9cd01f96cb17c17159ac2f6ab9b97bab89dc18f | 40e9be837b26df7484a36da68c0971ce2f7990d4 | waketzheng/django-kindeditor | /kindeditor/admin.py | Python | py | 299 | permissive | from django.contrib import admin
class EditorAdminMixin:
class Media:
js = (
"kindeditor/kindeditor-all.min.js",
"kindeditor/lang/zh-CN.min.js",
"kindeditor/config.min.js",
)
class EditorAdmin(admin.ModelAdmin, EditorAdminMixin):
pass
|
81199e0ac51792d7dacf587b9be7acafd99667ef | b097768374bae9c47fac3da00116cdd273ca54b6 | randName/10.009-Digital-World-1D-Project | /app.py | Python | py | 1,980 | no_license | import time
from remote import Remote
from hardware import Curtain, Light, Environment, cleanup
def run_interval( interval ):
def interval_decorator( func ):
last_run = [0.0]
def func_wrapper( *args ):
if time.time() - last_run[0] > interval:
func( *args )
... |
b4bc13bbd5787cc1931bae743d1b347f920d6002 | a3d485004e84b2c9875d3f1418f775450c9f7e2a | alphax777/swift | /swift/common/middleware/name_check.py | Python | py | 5,332 | permissive | # Copyright (c) 2012 OpenStack Foundation
#
# 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 ... |
32d9f86071b3e94f9b91452cde1e95753585161f | a3d4af855b7ec4f2c12354d548829b49d07694b5 | Rakshith176/Hospital | /bill/migrations/0002_auto_20210324_2306.py | Python | py | 361 | permissive | # Generated by Django 3.1.7 on 2021-03-24 17:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bill', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='bill',
old_name='bill_date',
new_na... |
3477d9f1884294652609ae15def9ead81c69f4bb | 14f5b6be6649d631299bafd7375a7343b04ddefa | jimmo/micropython | /tests/thread/thread_qstr1.py | Python | py | 899 | permissive | # test concurrent interning of strings
#
# MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd
try:
import utime as time
except ImportError:
import time
import _thread
# function to check the interned string
def check(s, val):
assert type(s) == str
assert int(s) == val
# main th... |
446fe7c654ddc104ee9b7705fe30f221da2a1074 | b5835fe02fe76998e014807697e4ac6f1d7c5ce3 | prompto/prompto-python3 | /Python3-Core/src/test/prompto/translate/oeo/TestTuples.py | Python | py | 459 | no_license | from prompto.parser.o.BaseOParserTest import BaseOParserTest
class TestTuples(BaseOParserTest):
def setUp(self):
super(type(self), self).setUp()
def testMultiAssignment(self):
self.compareResourceOEO("tuples/multiAssignment.poc")
def testSingleAssignment(self):
self.compa... |
8decca6029ec21538c87bf85badc47d556fb8738 | d68619fdee94bf0a4b119268dd0f35e3dc1f0f0d | rhit-snownp/05b-Exam1Practice | /src/problem0.py | Python | py | 14,805 | permissive | """
PRACTICE Exam 1, problem 0.
These problems illustrate concepts that previous problems have not emphasized:
-- determining whether a number is odd or even (Problem 0a)
-- returning True or False (Problem 0a)
-- is_prime (Problem 0b)
-- animation (Problem 0c)
Authors: David Mutchler, Vibha Alangar, Matt Bou... |
8ca91104fa39b103148c4f7729c71612fc62c384 | 543b5eaf26522cadb778a2dbd3cd8fb9e18f0580 | williamfina20/belajar_python | /elif.py | Python | py | 278 | no_license | #Belajar elif
menu_pilihan = input("silahkan pilih dari 1-3 ")
if menu_pilihan == "1":
print("anda memilih menu 1")
elif menu_pilihan == "2":
print("anda memilih menu 2")
elif menu_pilihan == "3":
print("anda memilih menu 3")
else:
print("menu tidak tersedia") |
8b19276f2429a17444399ce210471a090ec34cca | aeea4544bcb36e8710c74a0ca99506389cdebd46 | DarkSpiritLab/BackEnd | /app/api/views.py | Python | py | 1,901 | no_license | from flask import jsonify, current_app, request
import json
import threading
from . import api
from ..tools import updater
from .. import socketio
from ..models import Report, User
from .. import db
from ..tools.read import read_relays
@api.route('/relays')
def relays():
content = json.loads(open("details").re... |
e488e2f96fb925203769064714c348f8ef7422d4 | 72dbd8e89e099703a00a59f016142eadd8bc47d9 | scalyr/scalyr-agent-2 | /scalyr_agent/third_party/pysnmp/carrier/twisted/dgram/base.py | Python | py | 2,135 | permissive | # Implements twisted-based generic DGRAM transport
import sys
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
from pysnmp.carrier.twisted.base import AbstractTwistedTransport
from pysnmp.carrier import error
from pysnmp import debug
class DgramTwistedTransport(DatagramProtoc... |
60145817d1cce3822777a76a0d0eab90574e47da | 841a68fee8a233d1eb7cb68424584436a8a9c9bc | crowdbotics-apps/soundplay-26411 | /backend/soundplay_26411/wsgi.py | Python | py | 407 | no_license | """
WSGI config for soundplay_26411 project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJAN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.