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 |
|---|---|---|---|---|---|---|---|---|
de67ff6d2728166c15873820639a8311c64b5938 | 7fa25311a58ae16adc6d60687f9c3a0b6fb69bb8 | SKIronGhost/django_first_task | /first_task/settings.py | Python | py | 3,089 | no_license | """
Django settings for first_task project.
Generated by 'django-admin startproject' using Django 3.1.5.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from path... |
f6a1f8ee50db3464801c7648e9b560b42b692d5f | d7296301578038d2809c42563941c7cd7dde1c78 | 0lever/loghub_exporter | /loghub.py | Python | py | 1,645 | permissive | # -*- coding: utf-8 -*-
import aliyun.log as log
class LogHub(object):
endpoint = None
access_key_id = None
access_key = None
client = None
def __init__(self, endpoint, access_key_id, access_key):
self.endpoint = endpoint
self.access_key_id = access_key_id
self.access_key ... |
5b0e3ae1edcaf043af5b0c56da1ae5218f23ed25 | 45f87ecb9126db98b5c9eb15a8633fcdb9887166 | voucher-coin/voucher-coin | /qa/rpc-tests/util.py | Python | py | 12,469 | permissive | # Copyright (c) 2014 The Bitcoin Core developers
# Copyright (c) 2014-2015 The Dash developers
# Copyright (c) 2015-2017 The PIVX developers
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Helpful routines for regression te... |
93ba3a69be8d603dbddf8762c6b03ddb3ddf2f25 | 325e2f2b227840a41988a3f03072198a43c76ab8 | Adasumizox/ProgrammingChallenges | /codewars/Python/8 kyu/CenturyFromYear/century_test.py | Python | py | 818 | no_license | from century import century
import unittest
class TestCentury(unittest.TestCase):
def test(self):
self.assertEqual(century(1705), 18, 'Testing for year 1705')
self.assertEqual(century(1900), 19, 'Testing for year 1900')
self.assertEqual(century(1601), 17, 'Testing for year 1601')
... |
0cf6cc68cd809bf97f2f7d47d898ae457f8da575 | 1743f6f5a1c51cb33082aa8f1058821cfe4e332f | PanAlle/uav_mAP | /flight_log_analyzer.py | Python | py | 3,891 | no_license | import csv
import matplotlib.pyplot as plt
import numpy as np
import math
import statistics
import utm
import cv2
# ==================
# This .py file is created to read the log from the UAV.
# Linear interpolation function to pass from the lat, long to pixel_x, pixel_y
def linear_interpolation(x1, y1, x2, y2, x3):
... |
fa0c6ffabbe1e69293c2d0c0a79b917b5cf48b07 | c8864b6e5bbdcedf9d79ea42a5de2becd377153f | emfrias/python-bitshares | /bitshares/aio/bitshares.py | Python | py | 62,889 | permissive | # -*- coding: utf-8 -*-
import logging
from datetime import datetime, timedelta
from graphenecommon.aio.chain import AbstractGrapheneChain
from bitsharesapi.aio.bitsharesnoderpc import BitSharesNodeRPC
from bitsharesbase import operations
from bitsharesbase.account import PublicKey
from bitsharesbase.asset_permissio... |
8364b76cb3093c4a2285b5bbb7b09c218ab96c84 | 043e653a241d55df8851cea7a513d88392240747 | hexiaoting/gdal | /autotest/pyscripts/test_gdal_ls_py.py | Python | py | 9,313 | permissive | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: gdal_ls.py testing
# Author: Even Rouault <even dot rouault @ mines-paris dot org>
#
######################################################... |
e1e92b6d45dfa993c62cfa0a47a69730bdbea358 | 30ba1bba23333a3b4abca229efa877f2ad37becc | GeneSiriviboon/LC-Relaxation | /relaxation.py | Python | py | 8,313 | no_license | import tensorflow as tf
import numpy as np
import sys
import matplotlib.pyplot as plt
from tqdm import tqdm
from plt_quiver import quiver3D, load, quiver2D
import pandas as pd
from helper import *
from animate import render_anim
class LC(object):
"""
field - tensor (n, m, l, 3) represent LC grid
gamma - u... |
1886d33cf7ac809b70fae7a2744df92a014c4852 | b11aef3dd5a1038caeb6eb8e11a30cb5e3fb55f7 | lukehammer/tango_with_django | /tango_with_django/rango/forms.py | Python | py | 1,197 | no_license | from django import forms
from rango.models import Page, Category
class CategoryForm(forms.ModelForm):
name = forms.CharField(max_length=128, help_text="Please enter the category name.")
views = forms.IntegerField(widget=forms.HiddenInput(), initial=0)
likes = forms.IntegerField(widget=forms.HiddenInput(), ... |
0b763ae8077871cc31992c1c6e78fbe260876981 | 9a21b04d74a90b14a18acf61fc8215d4435102e4 | dimitar-daskalov/SoftUni-Courses | /python_advanced/exams/exam_preparation/exam_27_june_2020/02_snake.py | Python | py | 2,186 | no_license | def is_in_range(row_received, col_received, size):
if 0 <= row_received < size and 0 <= col_received < size:
return True
return False
matrix_size = int(input())
matrix = [[el for el in input()] for _ in range(matrix_size)]
MOVES = {
"up": (-1, 0),
"down": (1, 0),
"left": (0, -1),
"rig... |
13692cd1449dac8cccdbea2b4bdd44cb5cecec30 | 558ea133dc604cc3364c1f094e8ed2e0736c2a71 | marcostrinca/EuRobo | /_concepts/speaking_learning.py | Python | py | 6,334 | no_license | import math
import os, sys
import random
import string
import collections
import tensorflow as tf
from tensorflow.contrib import rnn
import numpy as np
import time
start_time = time.time()
def elapsed(sec):
if sec<60:
return str(sec) + " sec"
elif sec<(60*60):
return str(sec/60) + " min"
else:
return str(sec/... |
0a273df30cebc6feaf9e210ff5c65702bf9b091a | 84d059189b3a0e6884d4f3fb5a2a1629477772da | DomWeldon/pyconie-2019-dash-examples | /app00.py | Python | py | 246 | no_license | """Hello world example."""
import dash
import dash_html_components as html
app = dash.Dash(__name__)
app.layout = html.Div(children=[html.H1(children="Hello Dublin!")])
if __name__ == "__main__":
app.run_server(debug=True, host="0.0.0.0")
|
e5f78e7db72c53e92a4dda8b18c9dc624edd9c3c | 551498c2ef5e5b776360011cf4abb23ce4856de1 | nimmichele/io-sdk | /admin/actions/deploy/util/messages.py | Python | py | 937 | no_license | import base64
import time
import os
import json
import pip
import zlib
try: import redis
except:
pip.main(["install", "redis"])
import redis
def main(args):
body = args["__ow_body"]
if args["__ow_headers"]["content-type"] == "application/json":
body = base64.b64decode(body).decode("utf-8")... |
788d20e5a7c3126ad5d214ec6c457d478ba63b94 | 7b97df7eff75d69d1d0c98fc04468862c1c2bd7c | nervous-laughter/q2-composition | /q2_composition/_ancom.py | Python | py | 6,566 | permissive | # ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
6a4db9727719d098f845290c75324078327a68cd | a3aacb608029968bc0d9707c672e569b3bf1a384 | meeree/Python-stuff | /openGL/soft-body/engine.py | Python | py | 3,054 | no_license | from math import *
import numpy as np
import force
class Object():
def __init__(self, m, pos, vel, r, dynamic=True):
self.dynamic = dynamic
self.m = float(m)
self.pos = np.array(pos)
self.vel = np.array(vel)
self.forces = np.array([0, 0, 0])
self.r = r
class Spring(... |
41741d0b57279932df2c0eb895b247ac21171aba | 8fad13f29bb014a6aa5fda7cd057b121cd0cd26d | libanp/csbridging | /bridgingcs/asgi.py | Python | py | 397 | no_license | """
ASGI config for bridgingcs project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SE... |
43a1fb5a1eced8cd502a635090ca50b4da7042bc | 4d792bbbe44f50c3a6e0a5532021f237a0ce6b35 | zephyrGit/pytorch | /torch/tensor.py | Python | py | 19,313 | permissive | import sys
import torch
import torch._C as _C
from collections import OrderedDict
import torch.utils.hooks as hooks
import warnings
import weakref
from torch._six import imap
from torch._C import _add_docstr
# NB: If you subclass Tensor, and want to share the subclassed class
# across processes, you must also update ... |
7a5e4cdd76752a2ba71453939f6d1442e15cdb38 | 2712137948e532980182a19c8ac9940f3206a061 | bartenbach/intro-to-artifical-intelligence-projects | /multiagent/multiAgents.py | Python | py | 13,423 | no_license | # multiAgents.py
# --------------
# Licensing Information: You are free to use or extend these projects for
# educational purposes provided that (1) you do not distribute or publish
# solutions, (2) you retain this notice, and (3) you provide clear
# attribution to UC Berkeley, including a link to http://ai.berkeley.e... |
b98aa60729676fb04a798b8d118299f5b609974d | 57cffdd09471303adc0c576a72fad279c5843b64 | ulikoehler/UliEngineering | /tests/Physics/TestJohnsonNyquistNoise.py | Python | py | 870 | permissive | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from numpy.testing import assert_approx_equal
from UliEngineering.Physics.JohnsonNyquistNoise import *
from UliEngineering.EngineerIO import auto_format
import unittest
class TestJohnsonNyquistNoise(unittest.TestCase):
def test_johnson_nyquist_noise_current(self):
... |
0ed8815448ef575d1988b3427d53e8489b64fd7c | 39927124c5767589c22548615a9b95caea940838 | miladrux/plotly.py | /plotly/validators/layout/scene/yaxis/_ticksuffix.py | Python | py | 456 | permissive | import _plotly_utils.basevalidators
class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name='ticksuffix',
parent_name='layout.scene.yaxis',
**kwargs
):
super(TicksuffixValidator, self).__init__(
plotly_name=p... |
5acb6dfce60f732a79cfb148c024f83abf090535 | a2821aa0aca7a9049fde523458bdd803be3db777 | delispeter19/jdgConco | /EngGamesSite/venv/delispeter19@172.105.11.149~/enggames_site/events/endpoints.py | Python | py | 3,157 | no_license | import os
import secrets
from datetime import datetime
from flask import Blueprint, flash, url_for, render_template, request, redirect, current_app
from flask_login import login_required, current_user
from enggames_site import db
from enggames_site.events.forms import EventForm
from enggames_site.models import Event,... |
f3e12e1cbc5884e36d8970fe00bedcc1a9453433 | 97d9040f9360ea2d8a0470bbd132f13f0ba9a646 | simonhughes22/PythonNlpResearch | /Classifiers/RegEx/RegExLearner.py | Python | py | 17,629 | no_license | __author__ = 'simon.hughes'
from itertools import imap, izip
from Metrics import recall, precision, f1_score, rpf1
from DocumentFrequency import compute_document_frequency
from Rule import Rule, DisjointRule, PositiveNotNegativeRule
class RegExLearner(object):
def __init__(self, rule_score_fn, global_scor... |
68459d49a7b316622a5a0b4d29771325b1588b69 | cf0428b8e482b8e63b385b71aa54d8df508f8cde | jmscslgroup/panda | /tests/safety/test_hyundai.py | Python | py | 14,669 | permissive | #!/usr/bin/env python3
import unittest
import numpy as np
from panda import Panda
from panda.tests.safety import libpandasafety_py
import panda.tests.safety.common as common
from panda.tests.safety.common import CANPackerPanda, make_msg
MAX_RATE_UP = 3
MAX_RATE_DOWN = 7
MAX_STEER = 384
MAX_RT_DELTA = 112
RT_INTERVAL ... |
8c195e110f179d32b88a73b0bd76c8ef70989981 | 6f940344af4aedae079305c46a8b97519eb37596 | mor19034/Labs_Digital_2 | /Phytom_labs_digital2/Lab05.py | Python | py | 2,440 | no_license | # Código de laboratorio 5
# Universidad del Valle de Guatemala
# IE3027 - Electrónica Digital 2
# Pablo Moreno
from Adafruit_IO import Client, RequestError, Feed
import serial
import time
envio = 184 #dato que viene desde la pág
nulo = 0 #valor nulo
nulo = str(nulo)#char nulo
temporal1 = 0
temporal2 = 0
#... |
1a6c2579bb12277dd7d7317a0170b693e75a81a3 | 0913d9f87db07b54a63c45872ed44ece06c4b320 | sorensenmarius/knowit_calendar_2020 | /09/9.py | Python | py | 939 | no_license | import copy
import requests
alver = requests.get('https://julekalender-backend.knowit.no/challenges/9/attachments/elves.txt').text.split('\n')[:-1]
def naboer(y, x):
nm = [[alver[i][j] if i >= 0 and i < len(alver) and j >= 0 and j < len(alver[0]) else 0
for j in range(x-1, x+2)]
... |
4a9b1d0e0ffcae29bb6f781bf972331d121b0b92 | ed7e451f553d222a9b463bcdcb2f09e0334bbac4 | jangcode/anima | /anima/ui/scripts/max.py | Python | py | 1,342 | permissive | # -*- coding: utf-8 -*-
class Executor(object):
""" """
def __init__(self):
self.application = None
# from anima.ui.lib import QtCore
# self.event_loop = QtCore.QEventLoop()
def exec_(self, app, dialog):
self.application = app
# add event loop callback to processE... |
66a1d88eb307ed5a2f75e9ed38c3fc04ef30c6f2 | 67d90aa8caaddeef8aae79cb57a0abda01fb94bf | jrellin/sis3316-jrellin | /i2c.py | Python | py | 2,106 | no_license | from common.utils import *
from common.utils import Sis3316Except # Not required. Deals with issues on interpreters and PEP.
I2C_ACK = 1 << 8
I2C_START = 1 << 9
I2C_REP_START = 1 << 10
I2C_STOP = 1 << 11
I2C_WRITE = 1 << 12
I2C_READ = 1 << 13
I2C_BUSY = 1 << 31
class Sis3316(object):
class i2c_comm(object):
... |
ee1df1ee6421c6f34ed11034acd7c9813b029ac9 | 2a00aa5a7975342b81e09c4f8c898c9e2b7a8ee0 | Pradhiksha27/Netural-Neworks | /HW1/cs682/classifiers/softmax.py | Python | py | 3,442 | no_license | import numpy as np
from random import shuffle
def softmax_loss_naive(W, X, y, reg):
"""
Softmax loss function, naive implementation (with loops)
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X:... |
1ab0e981e72487eb07fd9754dfa1175ba13a4669 | 7c164acb15e601620216c149eb9bd0d2ad8efb6d | AndreiCatalinN/university | /stegano/caesar.py | Python | py | 305 | no_license | alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
s = 'NBY KOCWE VLIQH ZIR DOGJM IPYL NBY FUTS XIA IZ WUYMUL UHX SIOL OHCKOY MIFONCIH CM ZYCZHJBGIZXL'
def decrypt():
for i in range(1,len(s)):
print('Shift ', i)
alphabet[- i ]
def main():
return 0
if __name__ == '__main__':
main() |
7cc247fce8f074443774db160332225104e12856 | 970760373632a4a575a26deb62904477d7b4ec4c | ActiveState/pandas | /asv_bench/benchmarks/index_object.py | Python | py | 4,485 | permissive | import numpy as np
import pandas.util.testing as tm
from pandas import (Series, date_range, DatetimeIndex, Index, RangeIndex,
Float64Index)
from .pandas_vb_common import setup # noqa
class SetOperations(object):
goal_time = 0.2
params = (['datetime', 'date_string', 'int', 'strings'],
... |
f9cad50c7b5216aa9e0169b5af10be3efec1ca63 | 4140f1648fb394c95377cba93fb85d26f48f9432 | AutorestCI/azure-sdk-for-python | /azure-mgmt-compute/azure/mgmt/compute/v2017_03_30/models/virtual_machine_scale_set_vm_extensions_summary.py | Python | py | 1,431 | 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 ... |
f2bceb6b8474e208c5c9c36f67205cb90f2a8fcf | c56464d69ef25664cad2f51f352db1d8970e5526 | majiayeah/python-dnsstamps | /dnsstamps/parser/parser.py | Python | py | 4,442 | permissive | #!/usr/bin/env python
import base64
import binascii
import struct
from dnsstamps import Option
from dnsstamps import Parameter
from dnsstamps import Protocol
from dnsstamps.parser.state import State
def create_state_for_stamp(stamp):
try:
state = State()
state.data = base64.urlsafe_b64decode(sta... |
b822a6ab95020114aa58ed7e03bc07b01a0c038b | 9c577dd0f63bd8689bfd410e46237d496295616c | shiv-io/airflow | /airflow/providers/openlineage/extractors/manager.py | Python | py | 6,407 | permissive | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
d056b17e81ec5888db9799f9563df24710e05830 | fd3693582ad15493df982f973c970cb83baea598 | FrozenGene/onnxmltools | /onnxmltools/proto/__init__.py | Python | py | 2,039 | permissive | # -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
def _chec... |
34126db7d32ff45df2c5364ef769face617f1bce | b2672e008b2e2ba7359fecbd3c03e14d364d3a93 | Vignesh77/python-learning | /find_data.py | Python | py | 327 | no_license | """
@file :find_data.py
@brief :Find the given input as string|integer|float using type() and str|int|float|bool
@author :vignesh(vignesh.nanjundan@vvdntech.in)
"""
input_data = input("Enter the input data...\n")
print type(input_data)
input_data = raw_input("Enter the input data..\n")
print type(input_... |
747bce7b09018a28f0855f0f6fb0bf5006268a6f | 75c77a976e4cb58a45b80dc56e088c83c87adb0e | ikaru942/Flask-run | /Flask/app.py | Python | py | 802 | no_license | #Importing Flask class from the flask module
from flask import flask
#Create an instance of Flassk class
app = Flask(__name__)
# This we define a new route
# - Flask is designed in terms of routesselfself.
# - Routes are part of the URL a client is requestingself.
# - When a user goes to the default route - this is t... |
f12ee2c203f3db5f4e7ad14e0d42041842f543cd | 1eba9141dd57ca5f5e044668742dca859652fd23 | aCoffeeYin/pyreco | /repoData/BirdAPI-Google-Search-API/allPythonContent.py | Python | py | 99,776 | no_license | __FILENAME__ = BeautifulSoup
"""Beautiful Soup
Elixir and Tonic
"The Screen-Scraper's Friend"
http://www.crummy.com/software/BeautifulSoup/
Beautiful Soup parses a (possibly invalid) XML or HTML document into a
tree representation. It provides methods and Pythonic idioms that make
it easy to navigate, search, ... |
fa9fa88b2692ddf9cce82d1276ab4aac87094899 | 8e8c6c4b41983e7dab89b8bfda4c1c394751b992 | douglatornell/xarray | /xarray/tests/test_dataset.py | Python | py | 191,488 | permissive | # -*- coding: utf-8 -*-
import pickle
import sys
import warnings
from collections import OrderedDict
from copy import copy, deepcopy
from io import StringIO
from textwrap import dedent
import numpy as np
import pandas as pd
import pytest
import xarray as xr
from xarray import (
ALL_DIMS, DataArray, Dataset, Index... |
2cb7e9af93ead0f8f8d1d961d99fe3e3ef832afe | f1fb8579e8163e047b7ff088ba5201dda388fbc2 | lzp401/srtracker | /recordlist/templatetags/record_extension.py | Python | py | 863 | no_license | __author__ = 'victorlu'
from django import template
from recordlist.support import UrlHelper
register = template.Library()
@register.filter
def field(value, arg):
return getattr(value, arg)
@register.simple_tag
def page_url(param_str, page_number):
param_str_new = UrlHelper.update_params(param_str, page=... |
26de6aa5da542d0e8797e73effa1f8a777bdbe47 | 3c8390219c70210822c09d2f492423965dfbf917 | xgmiao/Cascade-RCNN-Tracking | /MOTDT/tracker/matching.py | Python | py | 3,792 | permissive | import cv2
import numpy as np
from scipy.spatial.distance import cdist
from sklearn.utils import linear_assignment_
from MOTDT.utils.cython_bbox import bbox_ious
from MOTDT.utils import kalman_filter
from MOTDT.utils import visualization
def _indices_to_matches(cost_matrix, indices, thresh):
matched_cost = cost_... |
b276fedad62a8a9437d042b4a3852bd45b496dea | 482714f7c52a3bc68f67cc0096de7f24d781cf7f | xeddmc/CryptsyRates | /CryptsyRatesV1.2.py | Python | py | 7,871 | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 4 14:28:55 2014
@author: chris
"""
#from Tkinter import *
import Cryptsy
import Tkinter
import sys
import webbrowser
global count
coins = dict()
Exchange = Cryptsy.Cryptsy("APIkey", "APIsecret")
orders = Exchange.api_query("marketdatav2")
for market in orders['... |
f99dd7034f5745a7d20fe30b25109d33f1332ef0 | 8c2a4670ba47d4067f3a3b875c3f5aef85dad40d | pars-linux/corporate2 | /programming/language/python/python-sphinx/actions.py | Python | py | 942 | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2008 TUBITAK/UEKAE
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
from pisi.actionsapi import pythonmodules
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
Wor... |
53aa82726a28fa603512100c7d3f1e733df0e883 | 7f87565ea0e9b36aee172618afefa0b1c95fbf97 | xuchongfeng/sharewizard | /sharewizard/ashare/migrations/0003_auto_20210530_0431.py | Python | py | 2,749 | no_license | # Generated by Django 3.2.3 on 2021-05-30 04:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ashare', '0002_auto_20210530_0039'),
]
operations = [
migrations.AlterField(
model_name='company',
name='amount',
... |
0f276026659bb2da010c42900584ef4c59edd4a5 | 704b49f686cd6aa87a34deb3819c0b2a6f7a1802 | gregorynicholas/grgrynch | /lib/flask_enum.py | Python | py | 1,364 | no_license | """
flask.ext.enum
~~~~~~~~~~~~~~
enumeration. not pythonic, but using to help enforce data in
mongodb, since that shit can get gnarly if schema get's fucked.
:copyright: (c) 2014 by gregorynicholas.
"""
from __future__ import unicode_literals
__all__ = ["Enum"]
class EnumMeta(type):
def __new__(cls, ... |
7887ad8646b710652c6be2d3602475ce818cfb01 | 38e466a26bea54f10bbbdba0bd52ed1bc4344c07 | Delaunay/mlbaselines | /olympus/dashboard/pages/study.py | Python | py | 2,978 | permissive | import rpcjs.elements as html
from rpcjs.page import Page
from rpcjs.binding import bind, redirect
from olympus.hpo.parallel import WORK_QUEUE, RESULT_QUEUE
from olympus.observers.msgtracker import METRIC_QUEUE
from olympus.dashboard.queue_pages import MetricQueue, StatusQueue, GanttQueue, InspectQueue
from olympus.ut... |
5a7bcce42a4dcf39a0d3af46a52985b4b37249d3 | 14be3de6b5ea117fdeb0450f74d8573003c95862 | Chen41284/Python | /VTK/dicom_slice_compare.py | Python | py | 10,138 | no_license | import vtk
def main():
# colors = vtk.vtkNamedColors()
filename1 = "C:\\Users\\chenjiaxing\\Desktop\\Python\\Edge220\\"
filename2 = "C:\\Users\\chenjiaxing\\Desktop\\Python\\JPEG220\\6\\"
rows = 128
columns = 128
slicenumber = 19
start_slice = 1
end_slice = 51
pixel_size = 1
s... |
b41650ff788ad2805ac6a3c4a9f6d004c3ec199d | c174e1d7b549d72d20a91cb0c89c8966d7619e6d | swapnilbutia05/carzone | /accounts/views.py | Python | py | 2,369 | no_license | from django.shortcuts import render, redirect
from django.contrib import messages, auth
from django.contrib.auth.models import User
# Create your views here.
def register(request):
if request.method == 'POST':
firstname = request.POST['firstname']
lastname = request.POST['lastname']
u... |
28aaec8306a6f92d9c9a007d95fbd5b31a60cebf | 0cffce5e03d70b1d409a4965b2425922e94bec06 | premolab/alpaca | /tests/uncertainty_estimator/test_masks.py | Python | py | 284 | no_license | import torch
from uncertainty_estimator.masks import BasicMask
def test_basic_mask():
mask = BasicMask()
x = torch.Tensor(range(6))
result = mask(x, dropout_rate=0.33)
assert result.shape == (6,)
assert sum(result) == 6
assert len(result[result != 0]) == 4
|
36fba739ce81beed6238ca7be42a968d047f5308 | 3b94540f7e044f53acba603bcf88e33a3fc9bd6c | DataShrimp/LeetCode | /python/888-UncommonWords.py | Python | py | 477 | no_license | class Solution:
def uncommonFromSentences(self, A, B):
"""
:type A: str
:type B: str
:rtype: List[str]
"""
words = A.split(" ") + B.split(" ")
ret = []
for word in words:
if words.count(word) == 1:
ret.append(word)
r... |
86442838454587f200cc4c961dc6df40827c02d1 | 604c41025becc08da7a42a99f71391260f257831 | wy-wangyao/mypython | /guestbook/__init__.py | Python | py | 2,137 | no_license | #coding:utf-8
import shelve
from datetime import datetime
from flask import Flask, request, render_template, redirect, escape, Markup
application = Flask(__name__)
DATA_FILE = 'guestbook.bat'
def save_data(name, comment, creat_at):
"""保存提交的数据
"""
#用shelve打开数据库文件
database = shelve.open(DATA_FILE)
... |
99bd64e8005db5ad075165b1a80648156204ba50 | 85c57f8fb49d361197c125462c29532f60fc6fce | GeoNode/geoserver-restconfig | /test/settingstests.py | Python | py | 10,882 | permissive | from copy import deepcopy
import unittest
import string
import random
import os
import subprocess
import re
import time
from geoserver.catalog import Catalog
from geoserver.support import StaticResourceInfo
from .utils import DBPARAMS
from .utils import GSPARAMS
try:
import psycopg2
# only used for connection... |
3d277217207853727a80041b3a3e3a01233de338 | 617a504678b112c5445ce4425188cdb40d8ed880 | mwojtczak/reservation_app | /cinema_reservation_app/settings.py | Python | py | 3,416 | no_license | """
Django settings for cinema_reservation_app project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
""... |
19097057e098323105fadca908632a036561da6a | cb0ace1e842fd18f9fd1444505a37c8509cdfa7c | NanamiTakayama/MonoTone | /monotone/Raspberry_Pi_3_Image_Classification/GoogleNet/google_net_raspi.py | Python | py | 2,368 | no_license | # Import packages
import numpy as np
import json
import argparse
import time
import cv2
# Construct the argument parse
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required=True,
help="path to input image")
args = vars(ap.parse_args())
# Define model and output labels
prototxt = "monotone/Raspberr... |
4c60daeb6ccb16646af042a8c310512bf6a7e0d2 | ab88e68ca590d962fc4d8fb19a945e7f4b64a0f8 | Trogers32/Python_Stack | /python/OOP/zoo.py | Python | py | 2,047 | no_license | class Zoo:
def __init__(self, zoo_name):
self.animals = []
self.name = zoo_name
def add_lion(self, name):
self.animals.append( name )
return self
def add_tiger(self, name):
self.animals.append( name )
return self
def add_liger(self, name):
self.ani... |
3787d4dd7a045adca1e327ec6693d90991a94c57 | bd46df389484ddbb1be00fdd40e164b1b18c92bf | SimKiSeong/NH | /bookmark/apps.py | Python | py | 201 | no_license | from django.apps import AppConfig
class BookmarkConfig(AppConfig):
name = 'bookmark'
class SubGroupConfig(AppConfig):
name = 'subgroup'
class SubListConfig(AppConfig):
name = 'sublist'
|
22894bb5eb095d2dccd61a890bbf13b0aa58bc75 | bdd0381a22df2610053a51bd04be7389d75a5c3d | mfittere/pyspec | /timbertools.py | Python | py | 4,290 | no_license | from rdmstores import *
import os as os
import cPickle as pickle
import glob as glob
import pyadt as pyadt
import pydoros as pydoros
import numpy as _np
#from pyadt import getbeta_adt
#from pydoros import getbeta_doros
import matplotlib.pyplot as _pl
def getbeta(dndata,force=False):
"""get a file with the beta* valu... |
956a036e2280ddf62a1eb87c4c4a9d7729031a5a | 429a7454f99981d64f8ec9c79aa5c2d470b81985 | Adyen/adyen-python-api-library | /Adyen/services/checkout/recurring_api.py | Python | py | 1,051 | permissive | from ..base import AdyenServiceBase
class RecurringApi(AdyenServiceBase):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, client=None):
super(RecurringApi, self).__init__(client=client)
... |
b511e4e261845c5b100e5b27a4cb784b12ec3df3 | b97c7d8e6c1eeb4263047350f9fddb098ca31c86 | LiuFang816/SALSTM_py_data | /python/pymc-devs_pymc3/pymc3-master/pymc3/tests/models.py | Python | py | 3,867 | no_license | from pymc3 import Model, Normal, Categorical, Metropolis
import numpy as np
import pymc3 as pm
from itertools import product
import theano.tensor as tt
from theano.compile.ops import as_op
def simple_model():
mu = -2.1
tau = 1.3
with Model() as model:
Normal('x', mu, tau=tau, shape=2, testval=tt.o... |
dd7f6f8256dc758bbab56ef9fe1a1edad009d39e | f03eec8d892324fcd30a3d50900ec01a5c3400f7 | kyleheckman/AltBot | /app.py | Python | py | 7,754 | no_license | import os
import json
import six
import requests
import sqlite3
from base64 import b64encode
from flask import Flask, request
#
# Database code
#
conn = sqlite3.connect('plbt.db')
cursor = conn.cursor()
def get_all_tokens():
sql = 'SELECT * FROM keystore ORDER BY id DESC'
cursor.execute(sql)
return cursor... |
0de123ecaf4dce964be9ae340c09af356e4969fe | ae3440b8e947c944ca2ac22e54b7b0a872425adc | lpxz/qiskit-sdk-py | /qiskit/tools/equivalence_checker/plot_dist_correct.py | Python | py | 2,308 | permissive |
import argparse
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def makeArgs():
parser = argparse.ArgumentParser()
parser.add_argument('--iteration_id', type=int, default=-1, #
help='paths of the qasm files') # they are separated with
pa... |
7478dc19dae629a21499c759610874dcaa889323 | 393c2396d9dacb8becbb66e3992cd8eb3bec0a5f | LevasyukDY/PC | /Задание 1/38.py | Python | py | 209 | no_license | import opentaskmodule as otm
otm.open_task("38.jpg")
x = float(input("Введите x: "))
y = float(input("Введите y: "))
if x > y:
z = x - y
else:
z = y - x + 1
print(f"\nz = {z:.6}") |
6bce2e55ae54a7131eaf8b3fe362c3cf577cdc9d | 0946b1ca1f65adb3cb366238af86020634387576 | IVladimirA/PythonHomeworks | /homework01/rsa.py | Python | py | 3,078 | no_license | import random
import typing as tp
import math
def is_prime(n: int) -> bool:
if n < 2:
return False
for i in range(2, int(math.sqrt(n)) + 1):
if n % i == 0:
return False
return True
def gcd(a: int, b: int) -> int:
if a < b:
a, b = b, a
if b == 0:
return... |
84c4e3450a1aeabd8d50d3dcee5137f90a3fa6ee | c9cf87c5793125cb413ba1ab2f4e4aabb56749cf | deClot/For_work_win | /replace_module.py | Python | py | 579 | no_license | def replace(file):
file = file.replace('+',' ')
file = file.replace('-',' ')
file = file.replace('?',' ')
file = file.replace('shum',' ')
file = file.replace('out of range',' ')
file = file.replace('vr',' ')
file = file.replace('w',' ')
file = file.replace('I',' ')
file = fi... |
b2c03cd341fce1f8a4a72d1de54b5fa4085c2167 | 8a97d76f43db91353fb8010d75976329639a934e | JDUO61299/COM404 | /1-basics/4-repetition/1-while-loop/7-factorial/Q5-2nd-practice.py | Python | py | 460 | no_license | health = 100
print("Your health is 100%. Escape is in progress...")
for count in range(0,5,1):
print("…Oh dear, who is that?")
userResponse = input()
if userResponse == "smilers bot":
health -= 20
print("time to jam out of here")
elif userResponse == "hacker":
health += 20
... |
fd7b404843e8a1710724d785b142345637f1f444 | 78b62901af6727457b3ad3acb70855bfd09861ef | shreyassgs00/Ciphers | /caesar_cipher/encrypt.py | Python | py | 613 | no_license | #To encrypt strings using Caesar ciphers (shift ciphers)
a = input('Enter a string to encrypt using Caesar cipher: ')
s = int(input('Enter the shift pattern: '))
if s > 25:
print('Shift pattern is not valid as the number is greater than or equal to 26')
else:
ans = ''
for i in range(0, len(a)):
if... |
351bd74e5192ea7793c301ec501689cda5981a68 | 9b926f7c78144cc76b20b2ebe99fa873cecbbd65 | ArnoBali/python_fundamentals | /labs/03_more_datatypes/4_dictionaries/04_17_occurrence.py | Python | py | 423 | no_license | '''
Write a script that takes a string from the user and creates a dictionary of letter that exist
in the string and the number of times they occur. For example:
user_input = "hello"
result = {"h": 1, "e": 1, "l": 2, "o": 1}
'''
input1 = input(str("please add your text here:"))
#user input
input1_list = list(input... |
00144ce50811c4b3cd056d8e3bcafd24502266d4 | 9b2d45e6d6ebb4c9433495a5b529aefab22e32e1 | genostack/modin | /modin/core/io/file_dispatcher.py | Python | py | 9,743 | permissive | # Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... |
d22965af53baa75bd8d1665062c69fd22b6aa653 | 96a3e7ceeada0cf1b7bb26de780255c2aa35c911 | sbsoumya/PolarProject-Code_Res | /Polar-slepian/V_8/capplotter.py | Python | py | 5,327 | no_license | #--------------------------------------------
# Name: capplotter.py
# Purpose: plotter for capacity and achieved rate
#
# Author: soumya
#
# Created: 19/08/2017
#----------------------------------------
import matplotlib.pyplot as plt
import json
import numpy as np
import problib as pl
#------------... |
2fa2fa75242330009c8545eae38314fa137a2a12 | 2468d34bdf6ae20531c82ec9a7be52cd78ff1fa6 | adam1643/swdisk | /algorithms/solver_random.py | Python | py | 2,168 | permissive | from utils.utils import timer, DEFAULT_TIMEOUT
import numpy as np
import threading
class SolverRandom:
def __init__(self, game):
self.game = game # object of Nonogram class=
def solve(self, stop=None, game_id=None, queue=None, algorithm=None):
"""Method for solving Nonograms. If time consu... |
4779deef1f9e1aa4de5d65ec1714bef10165037f | ebb15d296753bb08c60b2428d5c0d5c7708a7799 | linnndachen/coding-practice | /Leetcode/134.py | Python | py | 502 | no_license | from typing import List
class Solution:
def canCompleteCircuit(self, gas: List[int], cost: List[int]) -> int:
# [1,2,3,4,5] = 15
# [3,4,5,1,2] = 15
n = len(gas)
t_gas, cur_gas, start_station = 0, 0 , 0
for i in range(n):
t_gas += gas[i] - cost[i]
cur_... |
9ca6ab5c8e541d6d8d5bcb973b22337d72295450 | 1a8424422bc105abb086643554bddf09d414ea41 | xitele2036/python_workstation | /web_test/test-user-16.py | Python | py | 1,672 | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from SSH import SSHCreat
import os
import random
import string
import time
import json
import serial
import sys
import time
from io import StringIO
import datetime
from selenium import webdriver
from pysnmp.hlapi import *
from User import user
from Snmp import snmp
from ... |
14c80ba849a56443047331d8303bb31afd61ded3 | 9e97ba6b72ba2b00f37158b3811895606046d9ee | krikru/controller-video-analysis | /scrubvideo.py | Python | py | 23,481 | no_license |
################################################################################
# IMPORTS
################################################################################
# Standard library imports
import os
import sys
import argparse
# Third party imports
import numpy as np
from matplotlib.backends.backend_qt5ag... |
193062af32b8e5fd505518387f0a0c2992e70618 | 9a5f59f1b52e08c23f31e2789a5b12c939ceea65 | jiuyue-zhou/jingong-homework | /周久悦/2017312547 第四次作业 金工17-1 周久悦/restaurant实例.py | Python | py | 665 | no_license | from restaurant import Restaurant,IceCreamStand
#创建restaurant的实例
rest=Restaurant('sugar','American flavor')
rest.set_number_served(30)
rest.show_number_served()
print()
#创建两个IceCreamStand类的实例
flavorlist_1=['chocolate','strawberry','blueberry','original']
flavorlist_2=['lemon','chocolate','strawberry','blueberry']
pri... |
7279e7d17bcac420fda81241227d080c8d252f93 | 3ed0a35aa82816acce06d541e4f4e9776e601739 | veerwang/P0711Python | /project-formate/main.py | Python | py | 406 | no_license | #! /usr/bin/python
#coding=utf-8
#
# 描述: 工程测试
# 创建人: kevin.wang
# 创建日期: 2019年09月30日
# 版本: 1.0.0
import os
if __name__ == '__main__':
print("hello the world")
a = "hello the world : {version}".format(version='1.0.0')
print(a)
a = "hello the world : {:b}".format(11)
print(a)
a =... |
328ba14a28e303793e6e34b5c324262ab3bcb6fa | 91714e43e516230bfbd9c1f90f7cb4b9034a92fa | ShimSooChang/exerciosparatreino | /exercios2/5.py | Python | py | 208 | no_license | tabuada = int(0)
num = int(0)
for c in range(10):
tabuada += 1
for i in range(10):
num += 1
print( tabuada,"X",num,"=",num * tabuada )
print("------------------")
num = 0
|
a08c97813f1ca07a14233560dd392b8116b71b50 | 32607f675cd487549b563896bf83b73e8bed4dbe | Sushantmkarande/demo2 | /demoProject/urls.py | Python | py | 800 | no_license | """demoProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-b... |
3c65692928141f0e9e00e5d5fc217fd41418901f | c7cde5ab435e69da9ad48a891f3484869405793d | sumeet-iitg/ChatBotFramework | /dialoginfra/dataloaders.py | Python | py | 2,263 | no_license | """This module provides a set of basic dataloaders for different chatbot types:
``DataLoader(object)``
base class for all data loader types, implements the ``load()`` method
which constructs data-structures to store utterances and other associated properties.
These properties are pre-defined with the f... |
ee0089dd62c14570b15c22cc9bf88f516930b60f | 1737037badf6654b46ea5e6ee548b39bfd6c78b3 | scientifichackers/zproc | /zproc/consts.py | Python | py | 895 | permissive | import struct
from typing import NamedTuple
TASK_NONCE_LENGTH = ZMQ_IDENTITY_LENGTH = 5
TASK_INFO_FMT = ">III"
TASK_ID_LENGTH = TASK_NONCE_LENGTH + struct.calcsize(TASK_INFO_FMT)
CHUNK_INFO_FMT = ">i"
CHUNK_ID_LENGTH = TASK_ID_LENGTH + struct.calcsize(CHUNK_INFO_FMT)
DEFAULT_ZMQ_RECVTIMEO = -1
DEFAULT_NAMESPACE = "... |
4dc0ef46ae11f920f45ebc309884eb29e18e1eb4 | 8c0bebf409c81dc2e8f4deb257d8eca3d3495046 | aleaf/modflow-setup | /mfsetup/testing.py | Python | py | 4,366 | permissive | import numpy as np
from mfsetup.grid import get_ij, national_hydrogeologic_grid_parameters
def compare_float_arrays(a1, a2):
txt = ""
for name, where_nan in {'array 1': np.where(np.isnan(a1)),
'array 2': np.where(np.isnan(a2))}.items():
nvalues = len(where_nan)
if ... |
643085a3b7a76473acb5955ab27392f34ef9708f | bc05a22ff0e923f3dd58d0b21dbe8290cd97c86a | bhevencious/BioNEV | /src/bionev/GAE/model.py | Python | py | 5,057 | permissive | # -*- coding: utf-8 -*-
import tensorflow as tf
from bionev.GAE.layers import GraphConvolution, GraphConvolutionSparse, InnerProductDecoder
flags = tf.app.flags
FLAGS = flags.FLAGS
class Model(object):
def __init__(self, **kwargs):
allowed_kwargs = {'name', 'logging'}
for kwarg in kwargs.keys()... |
0944c69d27b06ea374e0fa0f075c7907c708e2eb | 960bece878c8ee410dd49549f94b91efab8edb55 | albertvillanova/scikit-learn-mooc | /python_scripts/linear_models_ex_03.py | Python | py | 1,768 | permissive | # %% [markdown]
# # 📝 Exercise 03
#
# In all previous notebooks, we only used a single feature in `data`. But we
# have already shown that we could add new features to make the model more
# expressive by deriving new features, based on the original feature.
#
# The aim of this notebook is to train a linear regression ... |
af232f17c39081c13851b6050ec7178991913d76 | c0fcd64649eb3c97b596ec84993d29d82a725cfc | tanishq-1011/Google-Foobar-Challenge | /gearing_up_for_destrcution.py | Python | py | 690 | no_license | from fractions import Fraction
def solution(pegs):
lgt = len(pegs)
if ((not pegs) or lgt == 1):
return [-1,-1]
evt = True if (lgt % 2 == 0) else False
s = (- pegs[0] + pegs[lgt - 1]) if evt else (- pegs[0] - pegs[lgt -1])
if (lgt > 2):
for i in xrange(1, lgt-1):
... |
a0f00145e9e28997c9372e1cecf138811b582c33 | d645668cbbaa5cd67a9353abcdd5fbc4e09e78b9 | BulgarelliM/crawlerRI | /tp-processamento-consulta/util/.ipynb_checkpoints/time-checkpoint.py | Python | py | 363 | no_license | from datetime import datetime
class CheckTime(object):
def __init__(self):
self.time = datetime.now()
def finishTime(self):
delta = datetime.now()-self.time
self.time = datetime.now()
return delta
def printDelta(self,task):
delta = self.finishTime()
print(ta... |
741d07c1e826efb7a986a37d1c4e7dd04c2d5df4 | 3ae0438c991e46ca6dae4a5ec7d64371d402f09d | philsong/hummingbot | /test/integration/test_loopring_market.py | Python | py | 6,734 | permissive |
from os.path import join, realpath
import sys
import asyncio
import conf
import contextlib
import logging
import os
import time
from typing import List
import unittest
from decimal import Decimal
from hummingbot.core.clock import Clock, ClockMode
from hummingbot.core.data_type.order_book_tracker import OrderBookTrac... |
7bbb5ad7abfbb805037ebf2835077a88145f681a | 4b386da70f984084f38d371861eee6efae8267ce | wangdi2014/isovar | /test/test_translation.py | Python | py | 1,264 | permissive | # Copyright (c) 2016. Mount Sinai School of Medicine
#
# 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 o... |
64dfc17ce9f8a938f332996cb60ba2f3209d1f97 | 0fb3781caebf0c6ae59bb59a0b85565f46ed09f5 | MoamenSoroor/Racing-Game | /Racing-Game-v2/main/camera.py | Python | py | 593 | permissive | import manager
import math
class Camera():
def __init__(self,world, entity):
self.world = world
self.entity = entity
self.entity.camera_on = True
self.offset_x = 0
self.offset_y = 0
def tick(self):
self.offset_x = self.entity.x + self.entity.move_x -... |
dc2e3bdf2293419e323d6b0925ae5bedc22c3395 | 54bcf69b46b3ac67082b63a80f59e050d9bbd326 | marlonjjtp/Sfotipy | /sfotipy/tracks/views.py | Python | py | 551 | no_license | import json
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, Http404
from .models import Track
def track_view(request, title):
track = get_object_or_404(Track,title=title)
data = {
'title': track.title,
'order':track.order,
'album':track.album.title,
'artist':{... |
14fe348a8efe97fb37941df2acac76e3525fc361 | 81d9b0aefd8f9e19caa5ef7d1e058e4d528ebd71 | acehackathon/Mask_RCNN_Car_Damage | /custom.py | Python | py | 13,999 | permissive | """
Mask R-CNN
Train on the toy Balloon dataset and implement color splash effect.
Copyright (c) 2018 Matterport, Inc.
Licensed under the MIT License (see LICENSE for details)
Written by Waleed Abdulla
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for ex... |
1d4eae36efa55bb5ef0edd8c47190d7c94c2fc0f | 180be59a198e7ffd30c9367fbb571a9baa34413d | xiaonanln/myleetcode-python | /src/735. Asteroid Collision.py | Python | py | 1,237 | permissive | class Solution(object):
def asteroidCollision(self, asteroids):
"""
:type asteroids: List[int]
:rtype: List[int]
"""
stk = []
for i, n in enumerate(asteroids):
if n > 0:
stk.append(n)
else:
while stk and 0 < stk[-1] < -n:
stk.pop()
if not stk or stk[-1] < 0:
stk.append(n)
e... |
82045390ecaa2a474f23a0178d8a8cb3d2b09397 | 7ca6d4f2ea528c38a7e7f541296ca836e6661eb8 | dcfranca/phat | /plugins/ResponseHeaders/plugin.py | Python | py | 937 | permissive | from common.core import AbstractPlugin
from common.core import logger
from common.core import store_var, replace_vars
import re
class ResponseHeadersPlugin(AbstractPlugin):
def should_run(self):
return 'response_headers' in self.item_options and self.item_options['response_headers']
def check(self):... |
4548080d5c3ef91e3ec41a47949757cf33e02896 | a2405db30a73cfee0036f71ecf2b65d7925cef3b | baeseonghyeon/hanium-smartcar | /client/smartcar/main/migrations/0002_auto_20190814_1648.py | Python | py | 558 | no_license | # Generated by Django 2.2.3 on 2019-08-14 07:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='carinfo',
name='car_code',
fie... |
4c20fbc4561bdb73c2b5916736ba72d7009d527d | 873f2b3180c9341bb4aa6fb2ebfcbfbc684a7ee9 | eea/wise.msfd | /src/wise/msfd/compliance/main.py | Python | py | 16,239 | no_license | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from datetime import datetime
from io import BytesIO
from zope.annotation.factory import factory
from zope.component import adapter
from zope.interface import alsoProvides, implementer
from BTrees.OOBTree import OOBTree
# from Products.Five.browser.paget... |
05d317815847cb8a1733211e5f177763f7b75374 | 7ba501c23c3ac350a2a872f00c00439916ab0e3b | UCLA-SEAL/QDiff | /benchmark/startQiskit_noisy920.py | Python | py | 4,033 | permissive | # qubit number=5
# total number=41
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... |
60e1f12dbdd6798bf2ae7fb18b43acd8bc2c9f84 | 47705acb4ac1b74f3db77bcbdb0cddf04292762e | Unisight-Technologies/Models-for-jugnuh | /prac2/services/models.py | Python | py | 1,890 | no_license | from django.db import models
from basic.models import Service_Provider
# Create your models here.
class Service(models.Model):
service_name = models.CharField(max_length=50)
icon = models.ImageField(upload_to="img/icons", null=True, blank=True)
description = models.CharField(max_length=2000)
def __str... |
b633c7d1e3c5db2ffb1e63117c03bb7e42806acd | 7fc55a59e64abc4e3a685cddf4e38f8bee257959 | minghao2016/molsg | /scripts/compute_spectrum.py | Python | py | 304 | permissive | """Compute example spectrum."""
from __future__ import print_function, absolute_import
import numpy as np
from molsg.laplacemesh import compute_lb_fem
mol = np.load('data/ampc/npy/actives18.pqr0.50.41.2.npy')
eigs = compute_lb_fem(vertices=mol[0], faces=mol[1], k=100)
print('eigenvalues:', eigs.lam)
|
04b9001b40699d3467312ff2ae5b69f2a14ec44e | 8f78957f9a3b0b97a45ff0bd16e28a8f2fac1b1c | ptr-yudai/ptrlib | /ptrlib/connection/sock.py | Python | py | 4,671 | permissive | # coding: utf-8
from logging import getLogger
from ptrlib.binary.encoding import *
from .tube import *
import socket
logger = getLogger(__name__)
class Socket(Tube):
def __init__(self, host: Union[str, bytes], port: Optional[int]=None, timeout: Optional[Union[int, float]]=None):
"""Create a socket
... |
008ae392160441c137b4030d0c2db491ce6aeb28 | cb0d72a62fe9e2b699f41b41e03fc3d511c3824c | yichangwang/tslearn | /tslearn/metrics/soft_dtw_fast.py | Python | py | 3,079 | permissive | # Author: Mathieu Blondel
# License: Simplified BSD
# encoding: utf-8
import numpy as np
from numba import njit, prange
DBL_MAX = np.finfo("double").max
@njit(fastmath=True)
def _softmin3(a, b, c, gamma):
"""Compute softmin of 3 input variables with parameter gamma.
Parameters
----------
a : float... |
77a20daa330da5720764c27eb8530fa2ed8033fb | 27e3482235b285eac5cdefb812aa4e6b2f65368e | cheind/pytorch-blender-dr | /record.py | Python | py | 3,768 | permissive | from pathlib import Path
from torch.utils import data
from blendtorch import btt
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
def draw_image(ax, img, cids, bboxes, visfracs, min_visfrac):
ax.imshow(img, origin='upper')
for cid, bbox, vfrac in zip(cids,bbo... |
556cdd57d304a441d40a4a9d143341080f82f498 | 1e58d29eb1a60e6c291b35ab055f0524afc9c736 | Taniaobando/ADA-COMPETITIVE-PROGRAMMING- | /Parcial_1/cut.py | Python | py | 891 | no_license | from sys import stdin,setrecursionlimit
setrecursionlimit(11000)
INF = float('inf')
def cut(startWood, endWood):
ans=INF
if(startWood+1==endWood):
return 0
else:
if(startWood,endWood) in diccionario:
ans=diccionario.get((startWood,endWood))
else:
... |
bc6969b11f81393f424dbe74d94bac703efa8ed7 | 119090bd3a80d7212ab53137dd57e1db37ee1ff5 | tuomas777/mvj | /leasing/viewsets/basis_of_rent.py | Python | py | 574 | permissive | from rest_framework import viewsets
from leasing.models import BasisOfRent
from leasing.serializers.basis_of_rent import BasisOfRentCreateUpdateSerializer, BasisOfRentSerializer
from leasing.viewsets.utils import AuditLogMixin
class BasisOfRentViewSet(AuditLogMixin, viewsets.ModelViewSet):
queryset = BasisOfRent... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.