code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
import os.path
import sys
import getopt
import math
import pandas as pd
import numpy as np
from log import logger
from Codecs.AdcpCodec import AdcpCodec
import Ensemble.Ensemble as Ensemble
import matplotlib.pyplot as plt
import seaborn as sns
from bokeh.charts import HeatMap, output_file, show
from bokeh.models impo... | ricorx7/rti-python | tests/test_plot_mag_bokeh.py | Python | bsd-3-clause | 5,892 |
from django.shortcuts import render_to_response
from system.models import Log
from django.template import RequestContext
from system.controllers.search import search_log
def logView(request):
keywords = ""
if 'keywords' in request.POST and request.POST["keywords"] != "":
keywords = request.POST["keywo... | XMLPro/ManagementSystem | system/controllers/logView.py | Python | mit | 560 |
from flask_restful import Resource
from util.request_wrapper import get_data
import util.endpoint as endpoint
class Copyright(Resource):
def get(self):
return get_data(endpoint.copyright).json() | fhollanda/Stepper-Motor-Interface | adapter/resources/copyright.py | Python | gpl-3.0 | 198 |
# Copyright (C) 2018, Bastian Eicher
# See the README file for details, or visit http://0install.net.
from __future__ import print_function
import os
from os.path import join
from xml.dom import minidom, Node
from repo import cmd, registry, merge, incoming, formatting
from repo.cmd import update
def handle(args):
... | bastianeicher/0repo | repo/cmd/modify.py | Python | lgpl-2.1 | 1,573 |
#!/usr/bin/env python3
from PyQt5 import QtQuick, QtWidgets, QtCore, QtQml
import sys
from bogguxEngine import Game, DiceRoller, spanishDiceSet
class Controller(QtCore.QObject) :
def __init__(self, parent, window, language):
super(Controller, self).__init__(parent)
self.window = window
self.roller = DiceRoller... | vokimon/boggux | boggux.py | Python | gpl-3.0 | 1,895 |
# an 'abstract' base class for a template, seems like a good idea for now
#import StringIO
import cStringIO as StringIO
import spitfire.runtime.filters
import spitfire.runtime.repeater
from spitfire.runtime.udn import (
_resolve_from_search_list, UnresolvedPlaceholder)
# NOTE: in some instances, this is faster th... | eklitzke/spitfire | spitfire/runtime/template.py | Python | bsd-3-clause | 2,584 |
from django.core.urlresolvers import reverse
from urllib import quote
def login_link(request):
"""
This assumes your login link is the Shibboleth login page for your server
and uses the 'target' url parameter.
"""
full_path = quote(request.get_full_path())
login = reverse('shibboleth:... | KonstantinSchubert/django-shibboleth-adapter | shibboleth/context_processors.py | Python | mit | 996 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('djangolettings', '0001_initial'),
]
operations = [
migrations.AddField(
model_name=... | dominicrodger/django-lettings | djangolettings/migrations/0002_add_room_image.py | Python | mit | 779 |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import glob
import os
import subprocess
import sys
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Any, Itera... | benjyw/pants | src/python/pants/testutil/pants_integration_test.py | Python | apache-2.0 | 11,626 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import encode, cstr, cint, flt, comma_or
import openpyxl
from openpyxl.styles import Font
from openpyxl import load_workbook
from six import Strin... | mbauskar/frappe | frappe/utils/xlsxutils.py | Python | mit | 1,815 |
import logging
from . import helpers, models
from .log import event_logger
logger = logging.getLogger(__name__)
def log_invoice_save(sender, instance, created=False, **kwargs):
if created:
event_logger.paypal_invoice.info(
'{invoice_invoice_date}-{invoice_end_date}. Invoice for customer {cus... | opennode/nodeconductor-assembly-waldur | src/waldur_paypal/handlers.py | Python | mit | 2,673 |
import unittest
from vectortween.NumberAnimation import NumberAnimation
from expremigen.patterns.ptween import Ptween
class TestPtween(unittest.TestCase):
def test_normal(self):
n = NumberAnimation(frm=60, to=90, tween=['linear'])
a = [i for i in Ptween(n, 0, 0, 10, 10, None)]
self.asser... | shimpe/expremigen | tests/testptween.py | Python | gpl-3.0 | 610 |
import hmac
import uuid
import urllib
import hashlib
import httplib as http
from framework.exceptions import HTTPError
from addons.base.exceptions import HookError
from addons.gitlab.api import GitLabClient
MESSAGE_BASE = 'via the Open Science Framework'
MESSAGES = {
'add': 'Added {0}'.format(MESSAGE_BASE),
... | crcresearch/osf.io | addons/gitlab/utils.py | Python | apache-2.0 | 3,598 |
#!/usr/bin/env python
import sys
import time
import mpd
import os
import logging
import logging.handlers
from sqlite3 import Error as SqlError
from socket import error as SocketError
from socket import timeout as SocketTimeout
import dbase
import daemon
#-------------------------------------------
# Change the follo... | mjessome/mpsd | mpsd.py | Python | mit | 10,490 |
#! /usr/local/anaconda3/bin/python3
##############(Python 3.5)################
###--- Lieb Lattice Band Structure --- ###
###--- Dmitry R. Gulevich ------------ ###
###--- Date: 5 Nov 2016 -------------- ###
##########################################
from pylab import *
from scipy.sparse import csc_matrix
from scipy.sp... | mitrg/lieb-lattice | lieb-bands.py | Python | mit | 2,944 |
import unittest
import uuid
import geojson as gj
import numpy as np
import datetime
import random
import logging
import emission.storage.decorations.common_trip_queries as esdctp
import emission.analysis.modelling.tour_model.cluster_pipeline as eamtcp
import emission.storage.decorations.common_place_queries as esdcpq
... | joshzarrabi/e-mission-server | emission/tests/storageTests/TestCommonTripQueries.py | Python | bsd-3-clause | 4,444 |
# !/usr/bin/python
#
# Copyright 2016 Mirantis, 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/licenses/LICENSE-2.0
#
# Unless required ... | TAJaroszewski/lma_contrail_monitoring | deployment_scripts/puppet/modules/lma_contrail_monitoring/files/scripts/check-api-contrail-9100.py | Python | apache-2.0 | 4,630 |
import angr
import logging
l = logging.getLogger(name=__name__)
class deallocate(angr.SimProcedure):
#pylint:disable=arguments-differ
def run(self, addr, length): #pylint:disable=unused-argument
# return code (see deallocate() docs)
r = self.state.solver.ite_cases((
(addr % 0x... | angr/angr | angr/procedures/cgc/deallocate.py | Python | bsd-2-clause | 1,857 |
# This Python file uses the following encoding: latin-1
#
# Copyright (c) 2016, the Cap authors.
#
# This file is subject to the Modified BSD License and may not be distributed
# without copyright and license information. Please refer to the file LICENSE
# for the text and further information on this license.
from mat... | ORNL-CEES/Cap | python/source/impedance_spectroscopy.py | Python | bsd-3-clause | 17,432 |
"""
Specific checks.
"""
from discord.ext.commands import CheckFailure, check
from joku.core.commands import DoNotRun
def is_owner(ctx):
if ctx.message.author.id not in [214796473689178133, ctx.bot.owner_id]:
raise CheckFailure(message="You are not the owner.")
return True
# overrides
def has_perm... | MJB47/Jokusoramame | joku/core/checks.py | Python | mit | 1,946 |
#!/usr/bin/env python
import os
import stat
import threading
import time
from sys import exit
try:
from flask import Flask, render_template
except ImportError:
exit("This script requires the flask module\nInstall with: sudo pip install flask")
import unicornhathd as unicorn
PORT = 8000
width,height=unicorn... | Mutiny-Games/unicorn-hat-hd | projects/unicornpaint/paint.py | Python | mit | 2,582 |
from datetime import datetime, timedelta
from django.db import models
from django.core import cache
class SubscriptionManager(models.Manager):
def _should_throttle_ip_address(self, ip_address, timestamp):
"""Check to see if we got a subscription from the same ip address too
recently.
"""
... | kmshi/miroguide | channelguide/subscriptions/models.py | Python | agpl-3.0 | 3,048 |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... | Donkyhotay/MoonPy | zope/i18n/tests/test_itranslationdomain.py | Python | gpl-3.0 | 4,019 |
import unittest
import xmlrunner
if __name__ == '__main__':
s = unittest.defaultTestLoader.discover('.')
xmlrunner.XMLTestRunner(output='/infrabox/output/upload/testresult').run(s)
| InfraBox/infrabox | src/pyinfrabox/test.py | Python | mit | 190 |
# -*- coding: utf-8 -*-
from django.db import models
from gestao.basico.models.localizacao.Endereco import Endereco
class Empresa(models.Model):
nome_de_fantasia = models.CharField(verbose_name="Nome de Fantasia", max_length=200)
razao_social = models.CharField(verbose_name="Razão Social", max_length=200)
... | marcospereirampj/gestao_empresarial | gestao/basico/models/empresa/Empresa.py | Python | cc0-1.0 | 1,488 |
# coding: utf-8
from socket import *
import struct
import sys
import threading
import time
NUM_MASTERSERVERS = 4
MASTERSERVER_PORT = 8300
TIMEOUT = 2
SERVERTYPE_NORMAL = 0
SERVERTYPE_LEGACY = 1
PACKET_GETLIST = "\x20\x00\x00\x00\x00\x00\xff\xff\xff\xffreqt"
PACKET_GETLIST2 = "\x20\x00\x00\x00\x00\x00\xff\xff\xff\... | Schwertspize/speedfng | scripts/tw_api.py | Python | gpl-2.0 | 6,423 |
# Python - 3.6.0
bool_to_word = lambda b: 'Yes' if b else 'No'
| RevansChen/online-judge | Codewars/8kyu/convert-boolean-values-to-strings-yes-or-no/Python/solution1.py | Python | mit | 64 |
import contextlib
import logging
import os
import tempfile
from django.db.utils import InternalError
from django.test import TestCase
from django.test.client import Client
from django.urls import reverse
from botocore.exceptions import ConnectionClosedError
from unittest.mock import patch
from casexml.apps.case.exce... | dimagi/commcare-hq | corehq/apps/receiverwrapper/tests/test_submit_errors.py | Python | bsd-3-clause | 14,436 |
"""Support for LIFX."""
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant import config_entries
from homeassistant.const import CONF_PORT
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from .const import DOMAIN
CONF_SERVER = "server"
CONF_BROADCAST = ... | Cinntax/home-assistant | homeassistant/components/lifx/__init__.py | Python | apache-2.0 | 1,493 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ROOT, time
toff = 0 # -8*3600
def Create_html(le,lp):
htmlhead = '''<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="author" content="Nickolai Muchnoi">
<meta http-equiv="refresh" content="30">
<title>BEPC-... | muchnoi/HPGe | bepc/ourweb.py | Python | gpl-3.0 | 5,626 |
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 3 11:31:57 2016
@author: cpkmanchee
beam_profile.py contains methods for dealing with beam profile images.
All definitions, usages, and calculations are consisten with ISO
standard 11146 (generally dealing with D4sigma beamwidths).
"""
import numpy as np
import scipy.op... | kikimaroca/beamtools | build/lib/beamtools/beam_profile.py | Python | mit | 9,793 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2017 OSGeo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | MapStory/geonode | geonode/geoserver/tasks.py | Python | gpl-3.0 | 1,980 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... | OpusVL/odoo | addons/project/tests/__init__.py | Python | agpl-3.0 | 1,059 |
# -*- python -*-
#
# This file is part of MS-DAS software
#
# Copyright (c) 2014 - EBI-EMBL
#
# File author(s): Thomas Cokelaer <cokelaer@ebi.ac.uk>, Marti Bernardo Faura
# bernardo@ebi.ac.uk
#
# Distributed under the GPLv3 License.
# See accompanying file LICENSE.txt or copy at
# http://www.gnu.org/licenses... | cokelaer/msdas | src/msdas/annotations.py | Python | gpl-3.0 | 33,536 |
def format_string(string, metadata, output_extension="", sanitizer=lambda s: s):
"""
Replaces any special tags contained in the string with their
metadata values.
Parameters
----------
string: `str`
A string containing any special tags.
metadata: `dict`
Metadata in standard... | Ritiek/Spotify-Downloader | spotdl/metadata/formatter.py | Python | mit | 2,164 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Message.writeitinstance'
db.add_column(u'nuntium_message', 'writeitinstance',
... | TEDICpy/write-it | nuntium/migrations/0005_auto__add_field_message_writeitinstance.py | Python | gpl-3.0 | 3,691 |
"""
Init file info here
"""
__all__ = ["fit_functions", "post_processing", "run_params"]
| PatricHolmvall/PostProcessingNCSM | PostProcessingNCSM/__init__.py | Python | gpl-3.0 | 90 |
import numpy as np # type: ignore
import re
import math
import warnings
from .units import angstrom_to_bohr, ev_to_hartree
from .band import Band
from copy import deepcopy
import fortranformat as ff # type: ignore
from functools import reduce
class KPoint():
def __init__( self, index, frac_coords, weight ):
... | bjmorgan/vasppy | vasppy/procar.py | Python | mit | 23,579 |
# -*- coding: utf-8 -*-
# !/usr/bin/env python
"""
-------------------------------------------------
File Name: mongodb_handler.py
Description: 处理一切与mongodb对接的工作
Author: Dexter Chen
Date:2017-09-28
-------------------------------------------------
Development Note:
1.为了减少其它函数复杂性,所有BSON构成在这里进行
--------... | cldexter/Academic-Crawler | mongodb_handler.py | Python | apache-2.0 | 7,956 |
# -*- coding: utf-8 -*-
import os
import numpy as np
import sunpy.data.test
import sunpy.map
from sunpy.instr import iris
def test_SJI_to_sequence():
test_data = os.path.join(sunpy.data.test.rootdir,'iris_l2_20130801_074720_4040000014_SJI_1400_t000.fits')
iris_cube = iris.SJI_to_sequence(test_data, start=... | dpshelio/sunpy | sunpy/instr/tests/test_iris.py | Python | bsd-2-clause | 1,189 |
# coding:Cp1252
#===============================================================================
# Import the default modules
#===============================================================================
#===============================================================================
# Make global object avai... | SMALLplayer/smallplayer-image-creator | storage/.xbmc/addons/net.rieter.xot.smallplayer.channel.be/canvas/chn_canvas.py | Python | gpl-2.0 | 9,788 |
"""
This module provides easier retrieving of loggers.
Logger name can be autoprefixed so you can customize logging output
with logging configuration.
"""
import logging
try:
from django.conf import settings
except ImportError:
print("Can't import django settings.")
settings = None
def get_logger(logger_n... | Alexx-G/tastypie-example | src/helpers/logger.py | Python | mit | 881 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google-research/torchsde | torchsde/_core/methods/tableaus/srid2.py | Python | apache-2.0 | 1,225 |
GLCDFONT = [
[0x00, 0x00, 0x00, 0x00, 0x00],
[0x3E, 0x5B, 0x4F, 0x5B, 0x3E],
[0x3E, 0x6B, 0x4F, 0x6B, 0x3E],
[0x1C, 0x3E, 0x7C, 0x3E, 0x1C],
[0x18, 0x3C, 0x7E, 0x3C, 0x18],
[0x1C, 0x57, 0x7D, 0x57, 0x1C],
[0x1C, 0x5E, 0x7F, 0x5E, 0x1C],
[0x00, 0x18, 0x3C, 0x18, 0x00],
[0xFF, 0xE7, 0x... | sethshill/final | build/lib.linux-armv7l-2.7/bibliopixel/font.py | Python | mit | 28,140 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Bismarrck/tensorflow | tensorflow/python/keras/engine/training_test.py | Python | apache-2.0 | 92,757 |
import functools
from pylearn2.models.mlp import MLP, CompositeLayer
from pylearn2.space import CompositeSpace, VectorSpace
import theano
from theano import tensor as T
from theano.compat import OrderedDict
from theano.sandbox.rng_mrg import MRG_RandomStreams
from adversarial import AdversaryPair, AdversaryCost2, Gen... | hans/adversarial | conditional/__init__.py | Python | bsd-3-clause | 19,222 |
import sys
def read_C():
try:
C = float(sys.argv[1])
except IndexError:
raise IndexError\
('Celsius degrees must be supplied on the command line')
except ValueError:
raise ValueError\
('Celsius degrees must be a pure number, '\
'not "%s"' % sys.argv[1])
... | qilicun/python | python3/src/input/c2f_cml.py | Python | gpl-3.0 | 615 |
def merge_intervals(data):
"""
data = [(10,20), (15,30), (100, 200)]
out = [(10,30), (100,200)]
"""
if len(data)==0:
return data
result = []
saved = list(data[0])
for st, en in sorted([sorted(t) for t in data]):
if st <= saved[1]:
saved[1] = max(saved[1], en)
... | matteocereda/RNAmotifs | m3_light/utils/__init__.py | Python | mit | 2,230 |
from __future__ import unicode_literals
import json
from werkzeug.exceptions import HTTPException
class BadRequestException(HTTPException):
code = 400
def __init__(self, message, **kwargs):
super(BadRequestException, self).__init__(
description=json.dumps({"Message": message, "Code": "Ba... | whummer/moto | moto/resourcegroups/exceptions.py | Python | apache-2.0 | 361 |
from setuptools import setup, find_packages
version = "5.3.1"
with open("requirements.txt", "r") as f:
install_requires = f.readlines()
setup(
name='frappe',
version=version,
description='Metadata driven, full-stack web framework',
author='Frappe Technologies',
author_email='info@frappe.io',
... | praba230890/frappe | setup.py | Python | mit | 438 |
#!/usr/bin/env python
import sys
import csv
import argparse
import getpass
import plotly
import plotly.graph_objs as go
from collections import defaultdict
from coveragestore import AmpliconCoverage
from cassandra.cqlengine import connection
from cassandra.auth import PlainTextAuthProvider
def get_regions(infile)... | dgaston/ddbio-variantstore | Misc_and_Old/coverage_analysis.py | Python | mit | 8,847 |
# -*- coding: utf-8 -*-
# utils.py
# Copyright (C) 2013 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This ... | laborautonomo/leap_mail | pkg/utils.py | Python | gpl-3.0 | 2,846 |
arr=[]
n=int(input("Please enter the number of elements and then the actual elements themselves!"))
for i in range(n):
x=int(input())
arr.append(x)
for i in range(n-1):
for j in range(0,n-i-1):
if arr[j]>arr[j+1]:
arr[j],arr[j+1]=arr[j+1],arr[j]
print("The sorted arr is",arr)
| WebClub-NITK/Hacktoberfest-2k17 | Sorting/Bubble_Sort/nishanthebbar2011.py | Python | mit | 318 |
"""
Deprecated since 3/21/2015 - please use helpers.entity
"""
import logging
# pylint: disable=unused-import
from .entity import Entity as Device, ToggleEntity as ToggleDevice # noqa
logging.getLogger(__name__).warning(
'This file is deprecated. Please use helpers.entity')
| vitorespindola/home-assistant | homeassistant/helpers/device.py | Python | mit | 282 |
#
# CDR-Stats License
# http://www.cdr-stats.org
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The Initial Develope... | cdr-stats/cdr-stats | cdr_stats/cdr_alert/admin.py | Python | mpl-2.0 | 6,696 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
def _searchsorted(array, val, side='left'):
'''
Call np.searchsorted or use a custom binary
search if necessary.
'''
if hasattr(array, 'searchsorted'):
return array.searchsorted(val, side=side)
# Python ... | funbaker/astropy | astropy/table/sorted_array.py | Python | bsd-3-clause | 9,324 |
# -*- coding: utf-8 -*-
import csv
import json
import sys
import traceback
import gevent
import requests
from gevent import wsgi
from locust import events, runners, stats, web
from locust.main import parse_options
from locust.runners import LocustRunner
from six.moves import StringIO
from .testcases import LocustTes... | bugsduggan/locust | locust/test/test_web.py | Python | mit | 5,872 |
import discord
class MyClient(discord.Client):
async def on_ready(self):
print('Logged in as')
print(self.user.name)
print(self.user.id)
print('------')
async def on_member_join(self, member):
guild = member.guild
if guild.system_channel is not None:
... | imayhaveborkedit/discord.py | examples/new_member.py | Python | mit | 483 |
# coding=utf-8
# 上面的程式內容編碼必須在程式的第一或者第二行才會有作用
################# (1) 模組導入區
# 導入 cherrypy 模組, 為了在 OpenShift 平台上使用 cherrypy 模組, 必須透過 setup.py 安裝
import cherrypy
# 導入 Python 內建的 os 模組, 因為 os 模組為 Python 內建, 所以無需透過 setup.py 安裝
import os
# 導入 random 模組
import random
import math
from cherrypy.lib.static import serve_file
# ... | 2014c2g5/cd0505 | wsgi.py | Python | agpl-3.0 | 40,148 |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import unittest
class NewVisitorTest(unittest.TestCase):
def setUp(self):
#browser = webdriver.Chrome('/path/to/chromedriver')
self.browser = webdriver.Chrome('/home/miles/ejercicios_libro/chromedriver')
self.brows... | MilesDuronCIMAT/book_exercises | chapter_4/functional_tests.py | Python | mit | 2,397 |
from base64 import b64encode
from suds.wsse import UsernameToken, Token
try:
from hashlib import sha1, md5
except:
from sha import new as sha1
class UsernameDigestToken(UsernameToken):
"""
Represents a basic I{UsernameToken} WS-Security token with password digest
@ivar username: A username.
... | ricardosiri68/patchcap | cam/wsse.py | Python | gpl-2.0 | 2,243 |
from datetime import datetime
from flask import request, jsonify
from flask_restful import Resource
from app.auth import authenticate_token
from app.models import (db, BucketList, BucketlistItemSchema,
BucketlistSchema)
schema = BucketlistItemSchema()
bucketlist_schema = BucketlistSchema()
... | andela-bmwenda/cp2-bucketlist-api | app/bucketlist_api.py | Python | mit | 5,487 |
import avango
import avango.script
from avango.script import field_has_changed
import avango.gua
from examples_common.GuaVE import GuaVE
import sys
def start(filename):
# setup scenegraph
graph = avango.gua.nodes.SceneGraph(Name = "scenegraph")
plodloader = avango.gua.nodes.PLODLoader()
plodloader.UploadBud... | vrsys/avango | examples/point_based_rendering/plod/main.py | Python | lgpl-3.0 | 3,061 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/r-registry/package.py | Python | lgpl-2.1 | 1,572 |
# PAPAS Access Point Administration System
# Copyright (c) 2010 Revolution Linux inc. <info@revolutionlinux.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
... | veloutin/papas | lib6ko/tests/mocks/models.py | Python | agpl-3.0 | 863 |
# -*- coding: utf-8 -*-
# Copyright: Damien Elmes <oldanki@ichi2.net>
# License: GNU GPL, version 3 or later; http://www.gnu.org/copyleft/gpl.html
"""\
Internationalisation
=====================
"""
__docformat__ = 'restructuredtext'
import os, sys
import gettext
import threading
threadLocal = threading.local()
# g... | Arthaey/anki | oldanki/lang.py | Python | agpl-3.0 | 1,662 |
# -*- coding: UTF-8 -*-
TIME_FORMAT = "H:i"
SHORT_DATE_FORMAT = "Y-m-d"
SHORT_DATETIME_FORMAT = SHORT_DATE_FORMAT + " " + TIME_FORMAT
| lociii/symcon-index | heroku/formats/en/formats.py | Python | mit | 135 |
import xml.etree.cElementTree as ET
import simplejson, optparse, sys, os
def elem_to_internal(elem,strip=1):
"""Convert an Element into an internal dictionary (not JSON!)."""
d = {}
for key, value in elem.attrib.items():
d['@'+key] = value
# loop over subelements to merge them
for subele... | richcaudle/ingestion-connectors | rss-connector/xml2json.py | Python | mit | 3,385 |
"""
Boolean geometry difference of solids.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities.geometry.geometry_utilities im... | dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/solids/difference.py | Python | gpl-3.0 | 1,517 |
from apps.wallposts.views import WallPostDetail
from django.conf.urls import patterns, url
from surlex.dj import surl
from .views import ReactionList, ReactionDetail, WallPostList
urlpatterns = patterns('',
url(r'^$', WallPostList.as_view(), name='wallpost-list'),
surl(r'^<pk:#>$', WallPostDetail.as_view(), na... | gannetson/sportschooldeopenlucht | apps/wallposts/urlsapi.py | Python | bsd-3-clause | 518 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from setuptools.command.test import test as TestCommand
import metacollect
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
... | onjin/metacollect | setup.py | Python | mit | 1,936 |
import math
from zend import *
import zval_utils
import happy_hash
import happy_operators
from happy_util import zend_write
from objects import zval_ptr, MutableString
def php_array_element_dump(zv, num_args, args, hash_key):
level = args[0]
if isinstance(hash_key, happy_hash.HashTableIntKey):
zend_wr... | viswimmer1/PythonGenerator | data/python_files/30542200/ext_var.py | Python | gpl-2.0 | 3,117 |
import socket
from urllib.parse import urlparse
from .waiter import Waiter
def wait_for_server_started(server_url: str, interval: int = 1000, timeout: int = 30000):
"""
Wait for the remote server to be started.
:param server_url: the url of the remote server, e.g.,"http://127.0.0.1:4728/wd/hub"
... | KarlGong/easyium | easyium/utils.py | Python | apache-2.0 | 935 |
# defivelo-intranet -- Outil métier pour la gestion du Défi Vélo
# Copyright (C) 2020 Sylvain Fankhauser <sylvain.fankhauser@liip.ch>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, eit... | defivelo/db | apps/challenge/models/invoices.py | Python | agpl-3.0 | 10,462 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
@frappe.whitelist()
def get_funnel_data(from_date, to_date):
active_leads = frappe.db.sql("""select count(name) fr... | bhupennewalkar1337/erpnext | erpnext/selling/page/sales_funnel/sales_funnel.py | Python | gpl-3.0 | 1,501 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | anish/buildbot | master/buildbot/data/test_result_sets.py | Python | gpl-2.0 | 5,494 |
"""Using GitHub release API to check update and download new version.
Download is Windows only. Old version will be renamed on-the-fly,
and new version extracted (it's a hack, and doesn't work on XP;
not sure whether it will work on Vista)"""
import os
import json
import re
import logging
import hazama
import zipfile
i... | krrr/Hazama | hazama/updater.py | Python | gpl-2.0 | 8,213 |
"""
Service functions for dealing with Bricklink. Much uglyness due to Bricklink
not exposing things sensibly.
"""
import email
import html
import imaplib
import os
import re
from datetime import date
from django.conf import settings
from django.db import transaction
from django.db.models import F, Q
from django.templ... | jensadne/brixdb | brixdb/service/bricklink.py | Python | mit | 33,156 |
#
# Mixins.py -- Mixin classes for FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
class UIMixin(object):
def __init__(self):
self.ui_active = ... | Rbeaty88/ginga | ginga/Mixins.py | Python | bsd-3-clause | 2,107 |
'map predictions from classes to real [regression] values'
import sys, csv
import numpy as np
min_salary = 8.5
max_salary = 12.0
a_range = np.arange( min_salary, max_salary + 0.1, 0.1 ) # hardcoded min & max
reverse_class_mapping = {}
for i, n in enumerate( a_range ):
reverse_class_mapping[i+1] = round(n,1)
inpu... | LiaoPan/kaggle-advertised-salaries | regression_as_classification/reverse_map.py | Python | mit | 555 |
"""Kytos Buffer Classes, based on Python Queue."""
import logging
# from queue import Queue
from janus import Queue
from kytos.core.events import KytosEvent
__all__ = ('KytosBuffers', )
LOG = logging.getLogger(__name__)
class KytosEventBuffer(object):
"""KytosEventBuffer represents a queue to store a set of K... | macartur/kytos | kytos/core/buffers.py | Python | mit | 5,160 |
from __future__ import unicode_literals
import frappe
from frappe.utils import add_days, cint, cstr, date_diff, rounded, flt, getdate, nowdate, \
get_first_day, get_last_day,money_in_words, now, nowtime
from frappe import _
from frappe.model.db_query import DatabaseQuery
# Validation for emailid on lead form
def va... | Tejal011089/huntercamp_erpnext | erpnext/crm/doctype/crm_module_customization.py | Python | agpl-3.0 | 561 |
import sys
sys.path.append('..')
import unittest
from datahandler import data_handler_factory
from sweep import Sweep
class DataHandlerTestCase(unittest.TestCase):
def setUp(self):
path = '../data/2016-09-19#015'
self.sweep = Sweep(path)
data = self.sweep.data
x = data['mL']
... | mchels/FolderBrowser | test/test_datahandler.py | Python | mit | 1,106 |
import random
import datetime
from USBIP import BaseStucture, USBDevice, InterfaceDescriptor, DeviceConfigurations, EndPoint, USBContainer
# Emulating USB mouse
# HID Configuration
class HIDClass(BaseStucture):
_fields_ = [
('bLength', 'B', 9),
('bDescriptorType', 'B', 0x21), # HID
('bcd... | smulikHakipod/USB-Emulation | hid.py | Python | bsd-2-clause | 4,982 |
from sklearn.base import BaseEstimator
import numpy as np
''' This contains a collection of image processing options which can
be used in the Pipeline and GridSearch.
To create another option, the corresponding class must have a
fit, transform, and fit_transform method. The fit method must return
itself, and the fit... | cavestruz/MLPipeline | features/data_preprocessing.py | Python | mit | 1,968 |
import requests
from bs4 import BeautifulSoup
from utils import create_dir, download_many
class MangaHostPageReader(object):
"""
docstring
"""
# TODO: exibir um numero pra cada mangá pra pessoa numeros especificos
# TODO: perguntar se a pessoa quer converter no final, (perguntar formato de saida)... | marcelomaia/manga_downloader | downloader/mangahost.py | Python | mit | 4,312 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | rogerthat-platform/rogerthat-backend | src/add_1_monkey_patches.py | Python | apache-2.0 | 19,256 |
import django.forms as forms
from django.forms import Form, ModelForm
from django.forms.widgets import DateInput
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Field, Fieldset, Div, HTML
from core.models import *
class Html5DateInput(DateInput):
input_type = 'date'
... | grapesmoker/qtour | core/forms.py | Python | mit | 5,639 |
#!/usr/bin/python
# coding: utf8
"""MMM-Facial-Recognition - MagicMirror Module
Face Recognition Script
The MIT License (MIT)
Copyright (c) 2016 Paul-Vincent Roll (MIT License)
Based on work by Tony DiCola (Copyright 2013) (MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of t... | QueroMirror/magic_mirror | modules/MMM-Facial-Recognition/facerecognition/facerecognition.py | Python | mit | 9,709 |
##
# Copyright 2009-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (F... | ocaisa/easybuild-easyblocks | easybuild/easyblocks/m/maple.py | Python | gpl-2.0 | 3,863 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def lagrange(N, i, x):
"""
Function to calculate Lagrange polynomial for order N and polynomial
i[0, N] at location x.
"""
from gll import gll
[xi, weights] = gll(N)
fac = 1
for j in range(-1, N):
if j != i:
fac = fac ... | daniel-koehn/Theory-of-seismic-waves-II | 12_1D_SH_Spectral_Elements/lagrange.py | Python | gpl-3.0 | 381 |
from compiler import Asm
from codeitembase import CodeItemBase
class SetBit(CodeItemBase):
argumentNames = ('target', 'bit', 'value')
passiveArguments = ('target', 'bit')
def resolveIdentifiers(self, containingModule):
CodeItemBase.resolveIdentifiers(self, containingModule)
if self.bit > 7 or self.bit < 0:
... | zr40/scc | compiler/syntaxitems/statement.py | Python | mit | 8,141 |
#!/usr/bin/env python
"""
hashReadData.py
Author: Tony Papenfuss
Date: Mon Aug 4 11:28:31 EST 2008
"""
import os, sys
import cPickle
from useful import progressMessage
from alchemy import *
from maq import MaqViewFile
# 1. Load annotation
class Gene(object):
def __init__(self, _id, geneId, chrom, start, end,... | PapenfussLab/Srtools | bin/old/hashReadData_test.py | Python | artistic-2.0 | 3,090 |
"""Contain the socket handler for players"""
from game import Game
from websocket import WebSocketHandler
from zone import Zone
import errcode
class AdminWs(WebSocketHandler):
"""The socket handler for websocket"""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.... | mdl29/tidutyzef | serveur/adminws.py | Python | lgpl-3.0 | 2,061 |
import array
import errno
import socket
class IO(object):
""" Base class for handling socket communication to the Kafka server. """
def __init__(self, host='localhost', port=9092):
self.socket = None
#: Hostname to connect to.
self.host = host
#: Port to connect to.
self.port = port
d... | dsully/pykafka | kafka/io.py | Python | mit | 1,901 |
from sympy import *
import pprint
from ignition import *
from ignition.dsl.flame.tensors.basic_operators import add_invertible
su_12, delta_11 = map(lambda x: Tensor(x, 0), ["su_12", "delta_11"])
p_1, p_2, r_1, r_2, x_1, x_2, u_02 = \
map(lambda x: Tensor(x, 1), ["p_1", "p_2", "r_1", "r_2", "x_1", "x_2", "u_02"]... | IgnitionProject/ignition | demo/dsl/flame/iterative/cg_simplification.py | Python | bsd-3-clause | 2,820 |
from __future__ import absolute_import
from nsq import event
class Message(event.EventedMixin):
"""
A class representing a message received from ``nsqd``.
If you want to perform asynchronous message processing use the
:meth:`nsq.Message.enable_async` method, pass the message around,
and respond ... | goller/pynsq | nsq/message.py | Python | mit | 3,841 |
#Author:Chaitanya CH
#FileName: PyGLWidget.py (modified from Arne Schmitz code)
#This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or
# (at your option) any later version.
#
# Th... | BhallaLab/moose-thalamocortical | pymoose/gui/qt/PyGLWidget.py | Python | lgpl-2.1 | 20,528 |
#!/usr/bin/env python
"""
by Sander Marechal
http://web.archive.org/web/20131017130434/http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
"""
import sys, os, time, atexit
from signal import SIGTERM
class Daemon(object):
"""
A generic daemon class.
Usage: subcla... | markgweber/garage_door | daemon.py | Python | gpl-3.0 | 4,880 |
from datetime import date
import pandas as pd
import requests
from phildb.database import PhilDB
from phildb.exceptions import DuplicateError
MEASURANDS = ['last_day', 'last_week', 'last_month']
db = PhilDB('pypi_downloads')
def get_pypi_info(package_name):
r = requests.get('https://pypi.python.org/pypi/{0}/jso... | amacd31/pypi_download_counter | count.py | Python | bsd-3-clause | 901 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.