text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
Usefull method and classes not belonging anywhere and depending on opcua library
"""
from dateutil import parser
from datetime import datetime
from enum import Enum, IntEnum
import uuid
from opcua import ua
from opcua.ua.uaerrors import UaError
def val_to_string(val):
"""
convert a python object or pyth... | bitkeeper/python-opcua | opcua/common/ua_utils.py | Python | lgpl-3.0 | 8,286 | 0.002414 |
from difflib import get_close_matches
from thefuck.utils import sudo_support, get_all_executables, get_closest
@sudo_support
def match(command, settings):
return 'not found' in command.stderr and \
bool(get_close_matches(command.script.split(' ')[0],
get_all_executable... | mbbill/thefuck | thefuck/rules/no_command.py | Python | mit | 580 | 0 |
import datetime
import os
import sys
import time
import warnings
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
from django.core import serializers
from django.core.urlresolvers import reverse
from django.db import connection
from django.db.models import Min, Max
from django... | akaihola/django | tests/modeltests/timezones/tests.py | Python | bsd-3-clause | 49,481 | 0.002466 |
# Copyright 2015 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... | hehongliang/tensorflow | tensorflow/python/keras/engine/training.py | Python | apache-2.0 | 109,170 | 0.004598 |
import rsa
from Products.CMFCore.utils import getToolByName
from uwosh.simpleemergency.utils import disable_emergency
se_default_profile = 'profile-uwosh.simpleemergency:default'
def install(context):
if not context.readDataFile('uwosh.emergency.client.txt'):
return
site = context.getSite()... | uwosh/uwosh.emergency.client | uwosh/emergency/client/importexport.py | Python | gpl-2.0 | 877 | 0.010262 |
# Copyright 2015 Internap.
#
# 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, so... | mlecours/netman | netman/api/switch_api.py | Python | apache-2.0 | 29,194 | 0.002877 |
"Usage: unparse.py <path to source file>"
import sys
import ast
import cStringIO
import os
# Large float and imaginary literals get turned into infinities in the AST.
# We unparse those infinities to INFSTR.
INFSTR = "1e" + repr(sys.float_info.max_10_exp + 1)
def interleave(inter, f, seq):
"""Call f on each item ... | h2oloopan/easymerge | EasyMerge/merger/unparse.py | Python | mit | 24,407 | 0.007211 |
# -*- coding: utf-8 -*-
import cgi
import logging
import os
import uuid
from collections import namedtuple
import requests
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.runtime.client_request import ClientRequest
from office365.runtime.utilities.http_method import Htt... | Unifield/ufload | ufload/webdav.py | Python | mit | 8,486 | 0.003889 |
"""
Prototype demo:
python holoviews/ipython/convert.py Conversion_Example.ipynb | python
"""
import ast
from nbconvert.preprocessors import Preprocessor
def comment_out_magics(source):
"""
Utility used to make sure AST parser does not choke on unrecognized
magics.
"""
filtered = []
for line ... | basnijholt/holoviews | holoviews/ipython/preprocessors.py | Python | bsd-3-clause | 7,474 | 0.003077 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: ASCII visualization of NLTK trees
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Andreas van Cranenburgh <A.W.vanCranenburgh@uva.nl>
# Peter Ljunglöf <peter.ljunglof@gu.se>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Pretty-pr... | nelango/ViralityAnalysis | model/lib/nltk/treeprettyprinter.py | Python | mit | 24,360 | 0.001314 |
import CatalogItem
from toontown.toonbase import ToontownGlobals
from toontown.toonbase import TTLocalizer
from otp.otpbase import OTPLocalizer
from direct.interval.IntervalGlobal import *
from direct.gui.DirectGui import *
class CatalogNametagItem(CatalogItem.CatalogItem):
sequenceNumber = 0
def makeNewItem(... | silly-wacky-3-town-toon/SOURCE-COD | toontown/catalog/CatalogNametagItem.py | Python | apache-2.0 | 3,692 | 0.002167 |
"""Test jail_code.py"""
import os
import shutil
import sys
import textwrap
import tempfile
import unittest
from nose.plugins.skip import SkipTest
from codejail.jail_code import jail_code, is_configured, Jail, configure, auto_configure
auto_configure()
def jailpy(code=None, *args, **kwargs):
"""Run `jail_code`... | StepicOrg/codejail | codejail/tests/test_jail_code.py | Python | agpl-3.0 | 11,655 | 0.000601 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | assessments/views/common/score_encoding_progress_overview.py | Python | agpl-3.0 | 2,568 | 0.001558 |
"""Tests for the litejet component."""
from homeassistant.components import scene, switch
from homeassistant.components.litejet import DOMAIN
from homeassistant.const import CONF_PORT
from homeassistant.helpers import entity_registry as er
from tests.common import MockConfigEntry
async def async_init_integration(
... | jawilson/home-assistant | tests/components/litejet/__init__.py | Python | apache-2.0 | 1,438 | 0 |
from __future__ import absolute_import, unicode_literals
import time
from datetime import timedelta
from djcelery_transactions import task
from django.utils import timezone
from redis_cache import get_redis_connection
from .models import CreditAlert, Invitation, Org, TopUpCredits
@task(track_started=True, name='sen... | ewheeler/rapidpro | temba/orgs/tasks.py | Python | agpl-3.0 | 1,662 | 0.001203 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
from osgeo import ogr
import numpy as np
from gislib import projections
def array2p... | lizardsystem/flooding | gislib/vectors.py | Python | gpl-3.0 | 6,539 | 0.000153 |
import asyncio
class FakeProtocol(asyncio.Protocol):
def __init__(self, name):
self.name = name
self.connections_made = 0
self.data = []
self.connection_errors = []
self.expected_received = 0
self.expected = 0
self.connected = asyncio.Future()
self.c... | madedotcom/photon-pump | test/connection/fake_server.py | Python | mit | 1,317 | 0 |
__author__ = 'Tom Schaul, tom@idsia.ch'
from random import choice
from scipy import zeros
from twoplayergame import TwoPlayerGame
# TODO: undo operation
class CaptureGame(TwoPlayerGame):
""" the capture game is a simplified version of the Go game: the first player to capture a stone wins!
Pass moves are f... | daanwierstra/pybrain | pybrain/rl/environments/twoplayergames/capturegame.py | Python | bsd-3-clause | 9,101 | 0.007911 |
from __future__ import with_statement
from contextlib import closing
import simplejson as json
import urllib2
from urllib import urlencode
import os
import re
import tempfile
import time
from _multipartformdataencode import encode_multipart_formdata
missing = object()
class TypeChecker(object):
def __init__(s... | yaelelmatad/EtsyApiTest | etsy/_core.py | Python | gpl-3.0 | 10,263 | 0.005164 |
# -*- coding:utf-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from unittest import SkipTest
import pytest
from django.db import connection, migrations, models, transaction
from django.db.migrations.state import ProjectState
from django.test import TransactionTestCas... | nickmeharry/django-mysql | tests/testapp/test_operations.py | Python | bsd-3-clause | 11,174 | 0 |
from django.apps.registry import Apps
from django.db import models
from django.db.migrations.state import ProjectState, ModelState, InvalidBasesError
from django.test import TestCase
class StateTests(TestCase):
"""
Tests state construction, rendering and modification by operations.
"""
def test_creat... | mbox/django | tests/migrations/test_state.py | Python | bsd-3-clause | 12,382 | 0.001131 |
def foo(self):
x = 1
y = 2
<caret>
z = 3 | idea4bsd/idea4bsd | python/testData/copyPaste/multiLine/IndentInnerFunction2.dst.py | Python | apache-2.0 | 55 | 0.090909 |
r"""UUID objects (universally unique identifiers) according to RFC 4122.
This module provides immutable UUID objects (class UUID) and the functions
uuid1(), uuid3(), uuid4(), uuid5() for generating version 1, 3, 4, and 5
UUIDs as specified in RFC 4122.
If all you want is a unique ID, you should probably call uuid1() ... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib-python/2.7/uuid.py | Python | mit | 21,448 | 0.001958 |
"""Training and Predicting Cifar10 with Mutant Networks.
The networks mutate their architecture using genetic algorithms.
Author: Lucas David -- <ld492@drexel.edu>
Licence: MIT License 2016 (c)
"""
import logging
import artificial as art
import numpy as np
import tensorflow as tf
from artificial.utils.experiments i... | Comp-UFSCar/neural-networks-2 | mutant-networks/experiments/cifar-genetic/cifar-genetic.py | Python | mit | 2,889 | 0.000346 |
import httplib
try:
import json
except ImportError: # < Python 2.6
from django.utils import simplejson as json
from testcases import TestServerTestCase
class HTTPTestCase(TestServerTestCase):
def setUp(self):
self.start_test_server(address='localhost', port=8001)
def tearDown(self):
s... | grischa/django-tastypie | tests/alphanumeric/tests/http.py | Python | bsd-3-clause | 4,725 | 0.002751 |
def ContinueCurse():
test_note_1 = (int(input("Type first Test Value: ")))
test_note_2 = (int(input("Type Second Test Value: ")))
tmp_note = (((test_note_1 + test_note_2)/2)*0.6)
if ((3 - tmp_note)/0.4) <= 5:
print "Keep Studying :D"
else:
print "Cancel course :/"
print "=== P... | 13lcp2000/pythonExercises | script3.py | Python | mit | 414 | 0.014493 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | cloudbase/neutron-virtualbox | neutron/tests/unit/test_linux_dhcp.py | Python | apache-2.0 | 56,280 | 0.000018 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_operations.py | Python | mit | 5,336 | 0.003936 |
#!/usr/bin/env python
import os
import json
from flask import Flask, abort, jsonify, request, g, url_for
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.httpauth import HTTPBasicAuth
from passlib.apps import custom_app_context as pwd_context
from itsdangerous import (TimedJSONWebSignatureSerializer
... | emilio-simoes/qt-rest-client | tools/test-service/server.py | Python | gpl-3.0 | 4,688 | 0.009812 |
# -*- coding: utf-8 -*-
# Copyright (C) 2010 Holoscopio Tecnologia
# Author: Marcelo Jorge Vieira <metal@holoscopio.com>
# Author: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | offlinehacker-playground/sltv | sltv/input/xinput.py | Python | gpl-2.0 | 2,132 | 0.001876 |
from preprocessing.img_segmenting import ImgSegmenter
from preprocessing.NoiseRemoval import NoiseRemoval
from preprocessing.imageScaler import imageScaler
noise_remover = NoiseRemoval()
img_scaler = imageScaler()
segmenter = ImgSegmenter(5)
| lisiyuan656/Gesture-Recognizer | preprocessing/__init__.py | Python | gpl-2.0 | 250 | 0 |
import sys
def ruler_algorithm(n1, n2):
"""
Ruler Algorithm yani Cetvel Algoritmasi. Verilen aralik ikiye bolundugunde
her alt parca da devamli olarak ikiye bolunmekte. Alt parcalarin uzunlugu
onceden verilen degere erisinceye kadar devam edilir.
"""
dot = (n1+n2)/2
if abs((n2-n1)) < 2:
return
print("[%s]" %... | aligoren/pyalgo | ruler_algorithm.py | Python | mit | 1,641 | 0.014016 |
import sys
import numpy as np
import matplotlib.pyplot as plt
import math
#from datetime import datetime
#import os
# load csv file
PATH = "./data/"
FILENAME = "Sample_F5_21_2_1mA_trial2";
#TIMESTAMP = datetime.now().strftime('%D_%H:%M')
#OUTPUT = ''+ os.path.splitext(FILENAME)[0] + '_' + TIMESTAMP + '.png'
field, res... | caspar/KentLab | scripts/GMRplot3.py | Python | mit | 1,307 | 0.026014 |
from synapse.tests.common import *
import synapse.lib.fifo as s_fifo
class FifoTest(SynTest):
def test_fifo_nack_past(self):
with self.getTestDir() as dirn:
conf = {
'dir': dirn,
'file:maxsize': 1024,
'window:max': 4,
'window:mi... | vivisect/synapse | synapse/tests/test_lib_fifo.py | Python | apache-2.0 | 9,331 | 0.000214 |
import exceptions
class OpenCLClientException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
| apatriciu/OpenStackOpenCL | computeOpenCL/nova/nova/OpenCL/OpenCLClientException.py | Python | apache-2.0 | 173 | 0.017341 |
from django.contrib.gis.db import models
class TestTable(models.Model):
field0 = models.CharField(max_length = 50)
def __unicode__(self):
return self.field0
class TestPoint(models.Model):
field0 = models.CharField(max_length = 50)
field1 = models.IntegerField()
field2 = models.DateTimeField()
field3 = models... | gista/django-geoshortcuts | geoshortcuts/tests/test_app/models.py | Python | gpl-2.0 | 1,245 | 0.036948 |
import logging
import emission.storage.timeseries.abstract_timeseries as esta
import emission.core.wrapper.entry as ecwe
def get_last_entry(user_id, time_query, config_key):
user_ts = esta.TimeSeries.get_time_series(user_id)
# get the list of overrides for this time range. This should be non zero
# o... | yw374cornell/e-mission-server | emission/analysis/configs/config_utils.py | Python | bsd-3-clause | 967 | 0.004137 |
from flask import Flask
app = Flask('keyhub')
| ttycl/keyhub | keyhub/wsgi.py | Python | apache-2.0 | 46 | 0 |
import kivy
kivy.require('1.9.1')
from utils import kvFind
from kivy.core.window import Window
from kivy.properties import NumericProperty
from autosportlabs.racecapture.views.dashboard.widgets.gauge import CustomizableGauge
class GraphicalGauge(CustomizableGauge):
_gaugeView = None
gauge_size = NumericPropert... | ryandoherty/RaceCapture_App | autosportlabs/racecapture/views/dashboard/widgets/graphicalgauge.py | Python | gpl-3.0 | 864 | 0.013889 |
callback_classes = [
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', 'ns3::Address const&', 'ns3::Address const&', 'ns3::NetDevice::PacketType', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['bool', 'ns3::Ptr<ns3::NetDevice>', 'ns3::Ptr<ns3::Packet const>', 'unsigned short', ... | kuropatkin/lte | src/virtual-net-device/bindings/callbacks_list.py | Python | gpl-2.0 | 1,101 | 0.00545 |
from django.shortcuts import render
from django.http import HttpResponse, Http404
from minitwitter.app.models import Tweet
def index(request):
last_tweets = Tweet.objects.all().order_by('-timestamp')[:15]
return render(request, 'tweets/index.html', {'last_tweets': last_tweets})
def show(request, user, tweet... | RomuloOliveira/django-dojo | minitwitter/app/views.py | Python | mit | 544 | 0.005515 |
#!/usr/bin/env python
from bs4 import BeautifulSoup
# Constants
DEFAULT = "Default:"
# Methods
def processDefaults(soup, swagger):
default = ''
for string in soup.code.stripped_strings :
default = ' and'.join(', '.join(string.split(',')).rsplit(',', 1))
swagger['default'] = default
if "true" in defau... | warehouseman/trello-swagger-generator | processDefaults.py | Python | mit | 931 | 0.025779 |
"""
Support for control of ElkM1 sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.elkm1/
"""
from homeassistant.components.elkm1 import (
DOMAIN as ELK_DOMAIN, create_elk_entities, ElkEntity)
DEPENDENCIES = [ELK_DOMAIN]
async def asy... | tinloaf/home-assistant | homeassistant/components/sensor/elkm1.py | Python | apache-2.0 | 7,872 | 0 |
print ("Hello World !!")
| ronas/PythonGNF | Eduardo/L01.ExeSeq01.py | Python | gpl-3.0 | 25 | 0.04 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v6/nuavatar.py | Python | bsd-3-clause | 9,831 | 0.009155 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
sagaproviderplugin.py
---------------------
Date : May 2021
Copyright : (C) 2021 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
**********... | uclaros/QGIS | python/plugins/sagaprovider/SagaProviderPlugin.py | Python | gpl-2.0 | 1,562 | 0 |
#!/usr/bin/python
#-*- coding:utf-8 -*-
__author__ = 'david'
import numpy as np
import nibabel as nib
import resources as rs
# from vispy import app
from plot import Canvas
import matplotlib.pyplot as plt
import gc
np.random.seed()
class Clarity(object):
def __init__(self,token,imgfile=None,pointsfile=None):
... | NeuroDataDesign/seelviz | scripts/clearity/__init__.py | Python | apache-2.0 | 5,716 | 0.013821 |
import argparse
import os.path as op
from datetime import datetime
from rdflib import Graph, Literal
from rdflib.namespace import RDF, OWL
from ns import ns_property, ns_type
from util import query_freebase
def node2mid(node):
s = node.toPython()
return '/m/' + s.split('.')[-1]
def pull_genelection(graph, ke... | hsoft/dgeq-rdf | freebase_pull.py | Python | bsd-3-clause | 2,455 | 0.004481 |
# -*- coding: utf-8 -*-
"""ConfigTest Module
This module handles the setup for running tests agains the OpenRecords application.
.. _Flask Tutorial:
http://flask.pocoo.org/docs/1.0/tutorial/
"""
import sys
import os
import pytest
from app import create_app, db as _db
from flask import Flask
from flask_sqlalchemy ... | CityOfNewYork/NYCOpenRecords | tests/conftest.py | Python | apache-2.0 | 2,096 | 0.001431 |
#-*- coding: utf-8 -*-
import os
import pandas as pd
import config
import pandas
import re
import math
from modules.valuations.valuation import Valuation
# 현 EPS 과거 5년 PER 평균을 곱한 값
class PER(Valuation):
def __init__(self, valuation):
data = valuation.get_data()
json = valuation.get_json()
Valuation.__i... | jongha/stock-ai | modules/valuations/per.py | Python | mit | 540 | 0.015385 |
#Copyright 2012 EasyDevStdio , wes342
#
#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, ... | wes342/EasyDevStudio | scripts/RomOther.py | Python | apache-2.0 | 18,124 | 0.008828 |
import math
import scipy.optimize as opt
log = math.log
exp = math.exp
small = 1e-20 # unitless
T0 = 1 # K
Tcrit = 650 # K
zero_C = 273.15 # K
p0 = 1 # Pa
atm = 101325 # Pa
bar = 100000 ... | estansifer/mape | src/thermo.py | Python | mit | 10,645 | 0.007797 |
"""Configure number in a device through MQTT topic."""
from __future__ import annotations
import functools
import logging
import voluptuous as vol
from homeassistant.components import number
from homeassistant.components.number import (
DEFAULT_MAX_VALUE,
DEFAULT_MIN_VALUE,
DEFAULT_STEP,
NumberEntity... | home-assistant/home-assistant | homeassistant/components/mqtt/number.py | Python | apache-2.0 | 8,276 | 0.000967 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, 2008, 2011 Uninett AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License version 3 as published by the Free
# Software Foundation.
#
# Thi... | hmpf/nav | python/nav/web/alertprofiles/views.py | Python | gpl-3.0 | 87,463 | 0.00104 |
#!/usr/bin/env python
# Copyright (C) 2014 Yahoo! Inc. 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... | mc2014/anvil | setup.py | Python | apache-2.0 | 2,199 | 0 |
"""Defines the symbolic functions:
- norm(x): returns the L-2 norm of a vector
- norm2(x): returns the squared L-2 norm of a vector
- norm_L1(x): returns the L-1 norm of a vector
- norm_Linf(x): returns the L-infinity norm of a vector
- norm_fro(A): returns the Frobeneus norm of a matrix
- distance(x,y): returns the L... | krishauser/Klampt | Python/python2_version/klampt/math/symbolic_linalg.py | Python | bsd-3-clause | 9,854 | 0.032576 |
#!/usr/bin/python
# Copyright (C) 2016 Google 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 by applicable law or ... | sjaoudi/hangout-app | transcribe_streaming.py | Python | mit | 8,465 | 0.000236 |
'''
Copyright 2015 Travel Modelling Group, Department of Civil Engineering, University of Toronto
This file is part of the TMG Toolbox.
The TMG Toolbox 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 Fou... | TravelModellingGroup/TMGToolbox | TMGToolbox/src/analysis/traffic/Export_Count_Station_Location.py | Python | gpl-3.0 | 5,176 | 0.013717 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Landing pages administration module
===============================================
.. module:: landingpages.admin
:platform: Django
:synopsis: Landing pages administration module
.. moduleauthor:: (C) 2015 Oliver Gutiérrez
"""
# Django imports
fr... | R3v1L/django-landingpages | landingpages/admin.py | Python | mit | 813 | 0.012315 |
__author__ = 'Călin Sălăgean'
from events.models.event import Event
from events.repositories.event import EventRepository
from events.repositories.person_event import PersonEventRepository
from events.repositories.person import PersonRepository
class EventController():
def __init__(self):
'''
Even... | dooma/Events | events/controllers/event.py | Python | mit | 6,395 | 0.003911 |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
try:
from xml.sax import make_parser
from xml.sax.handler import ContentHandler
except ImportError:
has_xml=False
ContentHandler=object
else:
has_xml=True
import os,sys
f... | oli-kester/advanced-av-examples | amp-osc-lv2/.waf-1.8.5-3556be08f33a5066528395b11fed89fa/waflib/Tools/qt5.py | Python | gpl-2.0 | 14,329 | 0.056878 |
#!/usr/bin/env python
import os
import sys
import django
from django.conf import settings
DEFAULT_SETTINGS = dict(
INSTALLED_APPS=[
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"account",
"account.tests"
],
MIDDLEWARE_CLASSES=[],
... | pinax/django-user-accounts | makemigrations.py | Python | mit | 904 | 0 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the h... | attente/snapcraft | snapcraft/tests/test_plugin_gulp.py | Python | gpl-3.0 | 5,389 | 0 |
import numpy as np
LARGE = 200.
SMALL = 1. / LARGE
def _find_contpix_given_cuts(f_cut, sig_cut, wl, fluxes, ivars):
""" Find and return continuum pixels given the flux and sigma cut
Parameters
----------
f_cut: float
the upper limit imposed on the quantity (fbar-1)
sig_cut: float
... | annayqho/TheCannon | TheCannon/find_continuum_pixels.py | Python | mit | 3,465 | 0.003463 |
import os
import time
import datetime
import logging
import gzip
from hardware.channel import Channel
"""
Sensor Class
- ggf. Logfile als Datasource per Parameter
- Logging in eigene Klasse oder Scheduler
"""
class Sensor:
def __init__(self, device):
self.initialized = False
self.device = device
self.in... | Psychedelic-Engineering/sleep-machine | hardware/sensors.py | Python | mit | 2,531 | 0.034374 |
'''
Configuration object
====================
The :class:`Config` object is an instance of a modified Python ConfigParser.
See the `ConfigParser documentation
<http://docs.python.org/library/configparser.html>`_ for more information.
Kivy has a configuration file which determines the default settings. In
order to cha... | niavlys/kivy | kivy/config.py | Python | mit | 27,319 | 0.000146 |
from django.contrib.sitemaps import Sitemap
from events.models import Event
class EventsSitemap(Sitemap):
changefreq = "never"
priority = 1.0
def items(self):
return Event.objects.public()
def lastmod(self, obj):
return obj.date_modified | asgardproject/asgard-calendar | events/sitemaps.py | Python | bsd-3-clause | 251 | 0.047809 |
import logging
from django_registration.backends.one_step.views import RegistrationView
from django.urls import reverse
from django.contrib.auth import authenticate, get_user_model, login
from django_registration import signals
from django.conf import settings
from invite.models import CategoryInvitation
logger=loggin... | jeromecc/doctoctocbot | src/registration/views.py | Python | mpl-2.0 | 1,823 | 0.003291 |
# Written by Stephen Fromm <stephenf nero net>
# Copyright (C) 2016-2017 University of Oregon
#
# This file is part of netspryte
#
# netspryte 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 o... | sfromm/snmpryte | lib/netspryte/db/influx.py | Python | gpl-3.0 | 4,597 | 0.00261 |
from django.conf.urls import url
from django.contrib import admin
from UserManagement import views
from django.contrib.auth import views as auth_views
app_name = 'UserManagement'
urlpatterns = [
url(r'^register$', views.register, name="register"),
url(r'^login$', views.login, name='login'),
url(r'^logout_us... | Piotr95/Yummy_Pies | UserManagement/urls.py | Python | mit | 359 | 0.002786 |
# 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... | eunchong/build | third_party/buildbot_8_4p1/buildbot/manhole.py | Python | bsd-3-clause | 11,523 | 0.001909 |
# Copyright 2017 Bracket Computing, Inc. 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.
# A copy of the License is located at
#
# https://github.com/brkt/brkt-cli/blob/master/LICENSE
#
# or in the "license" file... | brkt/brkt-cli | brkt_cli/test_version.py | Python | apache-2.0 | 2,893 | 0 |
#!/usr/bin/python -O
#
# /usr/sbin/webapp-config
# Python script for managing the deployment of web-based
# applications
#
# Originally written for the Gentoo Linux distribution
#
# Copyright (c) 1999-2007 Authors
# Released under v2 of the GNU GPL
#
# ===========================================... | Feandil/webapp-config | WebappConfig/selinux.py | Python | gpl-2.0 | 4,699 | 0.005533 |
import unittest
import os
import shelve
import time
from tests_common import CommonTests, add_server_methods
from tests_xml import XmlTests
from tests_subscriptions import SubscriptionTests
from datetime import timedelta, datetime
from tempfile import NamedTemporaryFile
import opcua
from opcua import Server
from opcu... | bitkeeper/python-opcua | tests/tests_server.py | Python | lgpl-3.0 | 27,210 | 0.00294 |
from jinja2 import escape
from flask.globals import _request_ctx_stack
from flask import json
from wtforms import widgets
from mytrade.utils import _, get_url
class Select2Widget(widgets.Select):
"""
`Select2 <https://github.com/ivaynberg/select2>`_ styled select widget.
You must include select2... | hellwen/mytrade | mytrade/form/widgets.py | Python | bsd-3-clause | 8,982 | 0.001113 |
import collections
import typing
from typing import TypeVar
Key = TypeVar('Key')
class Meta(collections.OrderedDict, typing.MutableMapping[Key, float]):
def __init__(self, *args, **kwargs) -> None:
self._smallest = float('inf')
self._largest = 0
self._ordered = True
super(Meta, self).__init__(*args... | PhilHarnish/forge | src/data/meta.py | Python | mit | 1,361 | 0.011756 |
# pylint:disable=missing-docstring,invalid-name,too-few-public-methods,old-style-class
class SomeClass: # [blank-line-after-class-required]
def __init__(self):
pass
| Shopify/shopify_python | tests/functional/blank_line_after_class_required.py | Python | mit | 178 | 0 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Tangible()
result.template = "object/tangible/loot/tool/shared_recording_rod_broken.iff"
result.attribute_templat... | anhstudios/swganh | data/scripts/templates/object/tangible/loot/tool/shared_recording_rod_broken.py | Python | mit | 461 | 0.045553 |
import re
# Resolutions
resolution = re.compile(r'(?P<vres>4320|2160|1080|720|480|360)(?P<scan>[pi])', re.I)
# Sources
tv = re.compile(r'([sph]d).?tv|tv(rip|mux)', re.I)
dvd = re.compile(r'(?P<hd>hd)?dvd(?P<rip>rip|mux)?', re.I)
web = re.compile(r'(web(?P<type>rip|mux|hd|.?dl|\b))', re.I)
bluray = re.compile(r'(blu... | kingmotley/SickRage | sickrage/recompiled/tags.py | Python | gpl-3.0 | 869 | 0.002301 |
##########
import os
import web
import pylibmc
from etherpad_lite import EtherpadLiteClient
from jinja2 import Environment,FileSystemLoader
##########
def render(template_name, **context):
"""
Jinja2 Template Handler
This function renders the html template Jinja2 style
Extra parameters for substituti... | lauhuiyik/same-page | src/lib/utils.py | Python | mit | 1,770 | 0.015819 |
# -*- coding: utf-8 -*-
from django.core.mail.backends.base import BaseEmailBackend
from django.core.mail.message import sanitize_address
from django.conf import settings
import requests
import logging
logger = logging.getLogger(__name__)
class Newsletter2GoEmailBackend(BaseEmailBackend):
n2g_api_endpoint = '... | lukasklein/django-newsletter2go | newsletter2go/backends.py | Python | bsd-3-clause | 1,590 | 0.001258 |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import os
from os.path import join as pjoin
import numpy as np
from dis... | yuxng/Deep_ISM | FCN/lib/setup.py | Python | mit | 5,133 | 0.003702 |
# Write a program that prompts for the day and month of the user’s birthday and then
# prints a horoscope. Make up fortunes for programmers, like this:
# Please enter your birthday.
# month: 6
# day: 16
# Gemini are experts at figuring out the behavior of complicated programs.
# You feel where bugs... | futurepr0n/Books-solutions | Python-For-Everyone-Horstmann/Chapter3-Decisions/P3.22.py | Python | mit | 2,601 | 0.001924 |
from django.conf import settings
_TRACKING_USPS_URL = 'http://trkcnfrm1.smi.usps.com/PTSInternetWeb/InterLabelInquiry.do?origTrackNum='
TRACKING_USPS_URL = getattr(settings, 'OWNEY_USPS_TRACKING_URL', _TRACKING_USPS_URL)
_USPS_API_URL = 'http://production.shippingapis.com/ShippingAPI.dll'
USPS_API_URL = getattr(setti... | JohnSpeno/owney | owney/conf/settings.py | Python | mit | 635 | 0.006299 |
# 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... | Huyuwei/tvm | python/tvm/contrib/debugger/debug_runtime.py | Python | apache-2.0 | 8,948 | 0.000894 |
# dyndlg.py
# contributed by Curt Hagenlocher <chi@earthlink.net>
# Dialog Template params:
# Parameter 0 - Window caption
# Parameter 1 - Bounds (rect tuple)
# Parameter 2 - Window style
# Parameter 3 - Extended style
# Parameter 4 - Font tuple
# Parameter 5 - Menu name
# Parameter 6 - Window class
# Dialo... | zhanqxun/cv_fish | pythonwin/pywin/Demos/dyndlg.py | Python | apache-2.0 | 2,568 | 0.030763 |
import sys
def output_results(results, split_id='results', output_stream=None):
'''
Log `results` readably to `output_stream`, with a header
containing `split_id`.
:param results: a dictionary of summary statistics from an evaluation
:type results: dict(str -> object)
:param str split_id: an... | arunchaganty/presidential-debates | third-party/stanza/stanza/research/output.py | Python | mit | 770 | 0 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class ColorBar(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scattergeo.marker"
_path_str = "scattergeo.marker.colorbar"
_valid_props = {
"bgco... | plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scattergeo/marker/_colorbar.py | Python | mit | 78,668 | 0.000953 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-LockWorkStation',
'Author': ['@harmj0y'],
'Description': ("Locks the workstation's display."),
'Background' : False,
'OutputE... | Hackplayers/Empire-mod-Hpys-tests | lib/modules/powershell/management/lock.py | Python | bsd-3-clause | 3,056 | 0.008835 |
from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen, ConfigList
from Components.ActionMap import ActionMap
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigBoolean, getConfigListEntry, ConfigSelection, ConfigYesNo, Config... | XTAv2/Enigma2 | lib/python/Screens/InstallWizard.py | Python | gpl-2.0 | 5,974 | 0.026783 |
# -*- coding: utf-8 -*-
from django.db import models
from ..Models import *
from center.Exceptions.ModelsExceptions import *
class Tools_todo(models.Model):
STATUS_TYPES = (
(1, u'New'),
(2, u'Doing'),
(3, u'Waiting'),
(4, u'Done'),
)
SPECIES_TYPES = (
(1, u'Task')... | swxs/web | cloudplat/center/Models/Tools_todo_Model.py | Python | mit | 1,457 | 0.004844 |
import asyncio
import click
import logging
import sys
import time
from os.path import expanduser
from . import config as peerme_config
from . import peeringdb_mysql
from . import peeringdb_api
from . import euroix_json
from .commands.generate import GenerateConfigCli
from .commands.discover import DiscoverCli
from .co... | cooperlees/peerme | peerme/main.py | Python | bsd-2-clause | 3,155 | 0.001585 |
from neon.transforms.cost import Cost
class MulticlsSVMLoss(Cost):
def __init__(self, delta=1.):
self.delta = delta
def __call__(self, y, t):
T = self.be.empty_like(y)
T[:] = self.be.max(y * t, axis=0)
# T = self.be.array(self.be.max(y * t, axis=0).asnumpyarray(), y.shape[0], ... | cs-chan/fuzzyDCN | prune_neon/transformation/cost.py | Python | bsd-3-clause | 979 | 0.003064 |
#!/usr/bin/python
# coding=utf-8
'''
@authors: David,Erwan, Theo
version Python 2.7 and 3.4
This prog permits configure Precidot and Novar according to 2 input files.
first one is created from eagle by a module "testeur_UM.pnp" and contains components and pins x & y coordonates
second one is not yet defin... | theouf/CMStools | CMS_Conf.py | Python | gpl-2.0 | 6,570 | 0.059209 |
import numpy as np
import cv2
import math
from Contours import *
#Basic measures
def calcLeafMinAndMaxContourPoints(binaryImage, contours=None):
if (contours==None):
contours = getContours(binaryImage)
xs = contours[0][:,0][:,0]
ys = contours[0][:,0][:,1]
minx = np.min(xs)
miny = np.min(ys)... | maeotaku/leaf_recognition_sdk | src/Features/Morphology.py | Python | mit | 3,273 | 0.018637 |
from .stt import ApiRobot
from .stt import BingRobot
from .stt import WatsonRobot
from .stt import WitaiRobot
from .stt import GoogleRobot
class RobotFactory:
@staticmethod
def produce(config, speaker, actions):
configSTT = config['stt']
if configSTT == 'bing':
return BingRobot(confi... | lowdev/alfred | robot/robotFactory.py | Python | gpl-3.0 | 721 | 0.006935 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
''' Processor functions for images '''
import numpy as np
def squeeze_image(img):
''' Return image, remove axes length 1 at end of image shape
For example, an image may have shape (10,20,30,1,1). ... | satra/NiPypeold | nipype/externals/pynifti/funcs.py | Python | bsd-3-clause | 2,788 | 0.001435 |
##############################################################################
# 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... | EmreAtes/spack | var/spack/repos/builtin/packages/py-flask-socketio/package.py | Python | lgpl-2.1 | 2,117 | 0.000945 |
#!/usr/bin/env python
#
# Copyright 2018 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | Aloomaio/googleads-python-lib | examples/adwords/v201809/advanced_operations/add_multi_asset_responsive_display_ad.py | Python | apache-2.0 | 5,311 | 0.005649 |
# -*- coding: utf-8 -*-
#BEGIN_HEADER
# The header block is where all import statments should live
import os
import uuid
from KBaseReport.KBaseReportClient import KBaseReport
#END_HEADER
class RRoller:
'''
Module Name:
RRoller
Module Description:
A KBase module: RRoller
This sample module con... | sychan/RRoller | lib/RRoller/RRollerImpl.py | Python | mit | 4,705 | 0.003826 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.