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 |
|---|---|---|---|---|---|
# -*- 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):
# Deleting field 'ObjAttribute.db_value'
db.delete_column('objects_objattribute', 'db_value')
db.ren... | TaliesinSkye/evennia | src/objects/migrations/0020_remove_old_attr_value_field.py | Python | bsd-3-clause | 8,327 |
from flask import render_template, abort, request, url_for, flash, redirect
from random import choice
from datetime import datetime, date, timedelta
from twilio.twiml import Response
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound
from config import *
from config.main import *
fro... | PeterTheOne/ueberwachungspaket.at | ueberwachungspaket/views.py | Python | mit | 12,332 |
# Copyright 2012 Hewlett-Packard Development Company, L.P. All Rights Reserved.
#
# Author: Kiall Mac Innes <kiall@hpe.com>
#
# 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... | grahamhayes/designate | designate/sink/__init__.py | Python | apache-2.0 | 1,164 |
import MAX
import time
class prio_off_state(object):
def __init__(self, machine):
self._machine = machine
self._lasttime = time.time()
def event(self, event, source, params):
if source.name == 'Bedlightdesk':
if event == 'light_on':
self._machine.set_state(s... | fjacob21/MAX | service/src/state_scheduler/states/bedroom_desk_light_state/prio_off_state.py | Python | mit | 645 |
from django.db import models
class TextManager(models.Manager):
def create_text(self, title, content, created_by):
text, created = self.get_or_create(title=title, content=content, created_by=created_by)
return text
class Text(models.Model):
title = models.CharField(max_length=256)
content = models.Text... | tacitia/ThoughtFlow | project/core/models.py | Python | mit | 5,409 |
from distutils.core import setup
setup(
name='vcii',
version='0.0.0',
author='Brandon Mulcahy',
author_email='brandon@jangler.info',
url='https://github.com/jangler/vcii',
description='A TUI spreadsheet application.',
long_description=open('README.txt').read(),
packages=['vcii', 'vcii.t... | jangler/vcii | setup.py | Python | mit | 745 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015 mulhern <amulhern@redhat.com>
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation; either version 2.1 of the License, or (at your
# option) any la... | schlizbaeda/yamuplay | pyudev/src/pyudev/_ctypeslib/__init__.py | Python | gpl-3.0 | 974 |
"""
URLResolver Addon for Kodi
Copyright (C) 2016 t0mm0, tknorris
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 late... | fapeci/Filma | script.module.urlresolver/lib/default.py | Python | gpl-3.0 | 2,499 |
# Mini-project 7 for Principles of Computing class, by k., 08/02/2014
# The Fifteen Puzzle
# http://www.codeskulptor.org/#poc_fifteen_template.py
'''
Loyd's Fifteen puzzle (solver and visualizer)
note that solved configuration has the blank (zero) tile in upper left;
use the arrows key to swap this tile with its neig... | lifeloverxg/principles-of-computing-2 | mini_project7.py | Python | mit | 13,991 |
import pylab, numpy
sampleRate = 512e6
resolution = 7812.5
L = int(sampleRate/resolution)
P = 16
f_start = 11e6
f_end = 10e6
N = int(f_end/resolution)
a = sampleRate*(f_end - f_start)/L/(P-1)
print f_end-f_start, sampleRate*(f_end - f_start), L
amp = 32767.
freq = []
I, Q = numpy.array([0.]*P*L), numpy.array([0.... | bmazin/SDR | Projects/ChannelizerSim/legacy/lut_freq_ramp.py | Python | gpl-2.0 | 1,160 |
# -*- coding: utf-8 -*-
"""djangoflash.context_processors test cases.
"""
from unittest import TestCase
from django.core.exceptions import SuspiciousOperation
from django.http import HttpRequest
from djangoflash.context_processors import CONTEXT_VAR, flash
from djangoflash.models import FlashScope
class FlashCont... | danielfm/django-flash | src/djangoflash/tests/context_processors.py | Python | bsd-3-clause | 1,324 |
# -*- coding: utf-8 -*-
import datetime
import logging
import bleach
from django import http
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core import exceptions
from django.shortcuts import get_object_or_404, redirect, render
from .forms import AdminEvent... | jacobajit/ion | intranet/apps/events/views.py | Python | gpl-2.0 | 11,092 |
from django.test import Client
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
import os
from io import BytesIO
import random
from fileserver.HashCalc import HashSumType, hashsum_of_data
from fileserver.ResponseWorker import ResponseType
from fileserver.OutputTableHeader ... | opentelega/OpenTelega | fileserver/TestWorker/FileOperationsTests.py | Python | mit | 7,721 |
"""
Create an applet from a Python script.
You can drag in packages, Info.plist files, icons, etc.
It's expected that only one Python script is dragged in.
"""
from __future__ import print_function
import os, sys
from distutils.core import setup
from plistlib import Plist
import py2app
import tempfile
import shutil
... | orangeYao/twiOpinion | dustbin/py2app/.eggs/py2app-0.12-py2.7.egg/py2app/script_py2applet.py | Python | mit | 5,440 |
from webcrawler.collectors import BaseCollector
RESULT_DIR = 'result'
class ExampleCollector(BaseCollector):
def clean(self, item):
"""This implementation doesn't do anything to the item."""
return item
| mrafayaleem/simple-crawler | example/example_collector.py | Python | mit | 229 |
def foo():
pass
print foo.__name__
| csvoss/onelinerizer | tests/function_name.py | Python | mit | 39 |
#!/usr/bin/python3
######################################################################################
# Copyright 2015 Brecht Baeten
# This file is part of HomeCon.
#
# HomeCon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
... | BrechtBa/smarthome | plugins/homecon/zone.py | Python | gpl-3.0 | 7,428 |
import json
from django.contrib.auth.models import User
from awx.main.models import (
Organization,
Project,
Team,
Instance,
InstanceGroup,
JobTemplate,
Job,
NotificationTemplate,
CredentialType,
Credential,
Inventory,
Label,
WorkflowJobTemplate,
WorkflowJob,
... | snahelou/awx | awx/main/tests/factories/fixtures.py | Python | apache-2.0 | 7,663 |
from math import e as _e
def sigmoid(value):
try:
return 1/(1+_e**-value)
except OverflowError:
return 0
def scale_values(values):
max_value = float(max(values))
return [v/max_value for v in values]
| jpypi/ffnn | helpers.py | Python | mit | 235 |
"""
WSGI config for djexercise project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djexercise.settings")
from django.... | damianpv/exercise | djexercise/wsgi.py | Python | gpl-2.0 | 395 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow | tests/unit/gapic/dialogflow_v2/test_conversation_models.py | Python | apache-2.0 | 143,948 |
import json
from . import ApiBaseTest
class TestBucketlistItems(ApiBaseTest):
def setUp(self):
""" Sets up the test client"""
super(TestBucketlistItems, self).setUp()
# create a bucketlist
payload = {'name': "Cook"}
response = self.test_app.post(
'/api/v1/buck... | clementm916/CP2 | tests/test_api/test_bucketlist_items.py | Python | mit | 5,455 |
# coding=utf-8
"""InaSAFE Disaster risk tool by Australian Aid - Ash Raster on Population
Impact Function
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Softwa... | easmetz/inasafe | safe/impact_functions/ash/ash_raster_population/impact_function.py | Python | gpl-3.0 | 7,502 |
import xbmc
import xbmcaddon
from datetime import timedelta
from libs import pykodi, quickjson
from libs.pykodi import log
class TweakLastPlayedService(xbmc.Monitor):
def __init__(self):
super(TweakLastPlayedService, self).__init__()
self.waittime = 2
self.signal = None
self.watch... | rmrector/service.tweak.lastplayed | python/service.py | Python | mit | 5,103 |
"""netlink.h.
https://github.com/thom311/libnl/blob/libnl3_2_25/include/linux/netlink.h
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation version 2.1
of the License.
"""
from libnl.misc import ... | 0x90/libnl | libnl/linux_private/netlink.py | Python | lgpl-2.1 | 10,685 |
# 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... | shakamunyi/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/normal_test.py | Python | apache-2.0 | 19,677 |
# Copyright 2009-2013 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Launchpad ProjectGroup-related Database Table Objects."""
__metaclass__ = type
__all__ = [
'ProjectGroup',
'ProjectGroupSeries',
'ProjectGroupSet',
]
from... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/registry/model/projectgroup.py | Python | agpl-3.0 | 22,861 |
from __future__ import division
import os
from xml.etree import ElementTree
from distutils.version import LooseVersion
import numpy as np
from .misc import loadmat
def prairie_imaging_parameters(filepath):
"""Parse imaging parameters from Prairie/Bruker."""
def _get_prairieview_version(xml_filepath):
... | jzaremba/sima | sima/imaging_parameters.py | Python | gpl-2.0 | 6,058 |
#
# 20,000 Light Years Into Space
# This game is licensed under GPL v2, and copyright (C) Jack Whitham 2006-21.
#
import pygame
from lib20k import font
from lib20k.game_types import *
from lib20k.primitives import *
from . import unit_test
def test_font() -> None:
test_surface = unit_test.Setup_For_Unit_Test()... | 20kly/20kly | lib20ktest/test_font.py | Python | gpl-2.0 | 655 |
from itertools import count
from typing import Iterator, Tuple, Optional
from common.models.task import TaskInfo
from common.models.graph import GraphStruct, GraphInstanceInfo
from common.models.schedule import ScheduledGraph
from util.config import Config, ConfigField
from util.symver import SymVer
from util.tuned_lev... | LuckyGeck/dedalus | plugins/backends/leveldb_backend.py | Python | mit | 4,836 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Tiger Soldier
#
# This file is part of OSD Lyrics.
#
# OSD Lyrics 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... | ihacklog/osdlyrics | python/pattern.py | Python | gpl-3.0 | 5,769 |
from django.utils.functional import memoize
from staticassets import settings
from staticassets.filters import BaseFilter, CommandMixin, get_filter
_compilers = {}
_mimetypes = {}
class BaseCompiler(BaseFilter):
method = 'compile'
content_type = None
class CommandCompiler(BaseCompiler, CommandMixin):
... | davidelias/django-staticassets | staticassets/compilers/base.py | Python | mit | 885 |
# coding: utf-8
import json
from gi.repository import GObject, Gio, Gtk
class Cache(GObject.GObject):
__gsignals__ = {
'cache_changed': (
GObject.SIGNAL_RUN_FIRST,
None,
(int,))
}
def do_cache_changed(self, arg):
pass
title = GObject.property(typ... | poulp/tramontane | tramontane/cache.py | Python | gpl-3.0 | 927 |
# F3AT - Flumotion Asynchronous Autonomous Agent Toolkit
# Copyright (C) 2010,2011 Flumotion Services, S.A.
# All rights reserved.
# 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... | f3at/feat | src/feat/simulation/agency.py | Python | gpl-2.0 | 6,941 |
# 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, software
# d... | openstack/neutron-lib | neutron_lib/db/api.py | Python | apache-2.0 | 16,851 |
#!/usr/bin/python
def toggle_bit_at_position(variable, position):
if type(variable) is long or type(variable) is int:
if type(position) is long or type(position) is int:
position = position - 1
value = variable ^ (1 << position)
return ("Variable: " + str(variable) + " ... | RGU5Android/PythonLectureNotes | HomeWork/09-27-14/toggle_bit_at_position.py | Python | gpl-2.0 | 635 |
###############################################################################
#
# Emds command parser plugin
#
###############################################################################
__doc__ = """ Emds
Emds maps Opengear the "config -g config" command to zenoss data
$id: $"""
__version__ = "$Revision: 1.4... | zenoss/ZenPacks.Opengear.ConsoleServer | ZenPacks/Opengear/ConsoleServer/modeler/plugins/Emds.py | Python | gpl-2.0 | 3,171 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from textwrap import... | tejal29/pants | tests/python/pants_test/targets/test_java_thrift_library.py | Python | apache-2.0 | 2,894 |
# -*- coding: utf-8 -*-
"""
Unit tests for instructor.enrollment methods.
"""
import json
from abc import ABCMeta
import ddt
import six
from ccx_keys.locator import CCXLocator
from crum import set_current_request
from django.conf import settings
from django.utils.translation import get_language
from django.utils.tra... | edx-solutions/edx-platform | lms/djangoapps/instructor/tests/test_enrollment.py | Python | agpl-3.0 | 33,973 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PerlPadwalker(PerlPackage):
"""play with other peoples' lexical variables"""
homepage... | rspavel/spack | var/spack/repos/builtin/packages/perl-padwalker/package.py | Python | lgpl-2.1 | 565 |
import _plotly_utils.basevalidators
class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self,
plotly_name="outlinecolor",
parent_name="scatterpolar.marker.colorbar",
**kwargs
):
super(OutlinecolorValidator, self).__init__(
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatterpolar/marker/colorbar/_outlinecolor.py | Python | mit | 474 |
from collections import defaultdict
import re
import json
import os
import Pubnub as PB
PUB_KEY = os.environ["PUB_KEY"]
SUB_KEY = os.environ["SUB_KEY"]
SEC_KEY = os.environ["SEC_KEY"]
CHANNEL_NAME = os.environ["CHANNEL_NAME"]
def frequency_count(text):
"determine count of each letter"
count = defaultdict(int)... | gregory-nisbet/pubnub-api-example | subscriber.py | Python | mit | 994 |
import os
from django import shortcuts
from google.appengine.api import users
def respond(request, user, template, params=None):
"""Helper to render a response, passing standard stuff to the response.
Args:
request: The request object.
user: The User object representing the current user; or None if nobody... | wgrose/leanto | leanto/controllers/common.py | Python | apache-2.0 | 1,058 |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 17 20:36:34 2013
This file calls function from the ACS C library wrapper
@author: Pete
"""
from __future__ import division, print_function
import numpy as np
import matplotlib.pyplot as plt
import acsc
import time
axes = {'y':0, 'z':1, 'turbine':4, 'tow':5}
axis = 5
... | petebachant/ACSpy | examples/acsc_pvt_test.py | Python | mit | 1,333 |
# coding=utf-8
"""Resource Parameter Widget."""
# This import is to enable SIP API V2
# noinspection PyUnresolvedReferences
import qgis # NOQA
# noinspection PyPackageRequirements
from qgis.PyQt.QtWidgets import QLabel
from parameters.qt_widgets.float_parameter_widget import FloatParameterWidget
__copyright__ = "Co... | ismailsunni/inasafe | safe/common/parameters/resource_parameter_widget.py | Python | gpl-3.0 | 1,876 |
#!/usr/bin/env python
__revision__ = """$Id: test_BIFFWriter.py,v 1.9 2004/02/12 07:08:21 fufff Exp $"""
import unittest
import testsupport
from pyXLWriter.BIFFWriter import BIFFWriter
class BIFFWriterTest(unittest.TestCase):
def setUp(self):
self.b = BIFFWriter()
def tearDown(self):
self.... | evgenybf/pyXLWriter | tests/test_BIFFWriter.py | Python | lgpl-2.1 | 1,274 |
from django.core.management.base import BaseCommand
from django.conf import settings
from restclients.sws.term import get_term_by_year_and_quarter, get_term_by_date
from canvas_admin.unused_courses import generate_unused_course_csv
from datetime import datetime
class Command(BaseCommand):
args = "<term_sis_id>"
... | uw-it-aca/canvas-support-tools | canvas_admin/management/commands/find_unused_courses.py | Python | apache-2.0 | 882 |
from AppKit import NSAlternateKeyMask, NSApplication, NSBundle, \
NSCommandKeyMask, NSLog, NSMenuItem, NSUserDefaults
import objc
import textwrap
def fill(text, level):
initial = subsequent = len(text) - len(text.lstrip())
width = EditingMessageWebView._wrapWidth
if EditingMessageWebView._bulletLists a... | muammar/mailwrap | MailWrap.py | Python | mit | 18,357 |
import string
import os.path
import urllib
import cPickle
import copy
import sys
from glideinwms.creation.lib.matchPolicy import MatchPolicy
from glideinwms.lib import hashCrypto
#
# Project:
# glideinWMS
#
# File Version:
#
# Description:
# Frontend config related classes
#
####################################... | bbockelm/glideinWMS | frontend/glideinFrontendConfig.py | Python | bsd-3-clause | 19,293 |
import time
import zipfile
import tarfile
import re
import collections
import logging
from django.shortcuts import redirect
from models import ErrorReport
from chemtools import gjfwriter
from chemtools import fileparser
from chemtools.mol_name import name_expansion, get_exact_name
from data.models import DataPoint
f... | crcollins/chemtools-webapp | chem/utils.py | Python | mit | 5,861 |
#coding=utf8
# Create your views here.
from django.contrib.auth.decorators import login_required
from django.shortcuts import render_to_response
from django.http import HttpResponse, HttpResponseRedirect
from django.views.decorators.http import require_http_methods
from content.models import Work, Portfolio, CategoryMo... | xlk521/cloudguantou | base/views.py | Python | bsd-3-clause | 4,622 |
#!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
'''Creates dialog to allow control of book specific settings'''
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2016, Samreen Zarroug, Anthony ... | stoduk/X-Ray_Calibre_Plugin | book_config.py | Python | gpl-3.0 | 14,286 |
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://dataone.org.
#
# Copyright 2009-2019 DataONE
#
# Licensed under the Apache License, Version 2.0 (t... | DataONEorg/d1_python | gmn/src/d1_gmn/tests/test_create_resource_map.py | Python | apache-2.0 | 5,442 |
# -*- coding: ascii -*-
"""
#==============================================================================
#title :test_variable.py
#description :Test the os_modules.variable.py module
#author :OpenSesame group of GipHouse 2014, Radboud University
#programmers :Ben Bruecker, Laurens van Berc... | sakisbl/OpenSesameOnline | webapp/os_online/translator/unit_tests/test_variable.py | Python | gpl-3.0 | 1,864 |
# 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... | pmisik/buildbot | master/buildbot/process/build.py | Python | gpl-2.0 | 32,687 |
from webtest import TestApp
from mailchute.api.app import app
app = TestApp(app)
def assert_correct_cors_headers(route):
response = app.options(route, status=200)
assert response.body == b'{}'
assert response.headers['Access-Control-Allow-Headers'] == \
'Origin, Accept, Content-Type, X-Requested... | kevinjqiu/mailchute | tests/test_cors.py | Python | bsd-3-clause | 702 |
from zoo.libs.utils import unittestBase
from zoo.libs.command import command
class TestZooCommand(command.ZooCommand):
id = "helloWorld"
creator = "davidsp"
isUndoable = False
isEnabled = True
def doIt(self):
return "helloWorld"
class TestZooPrepareFailsCommand(command.ZooCommand):
... | dsparrow27/zoocore | tests/libs/command/test_command.py | Python | gpl-3.0 | 1,526 |
# Copyright 2015 Virantha Ekanayake 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 applicable la... | virantha/verifytree | verifytree/check_dirs.py | Python | apache-2.0 | 2,891 |
from unittest import TestCase
from omicexperiment.taxonomy import GreenGenesProcessedTaxonomy
class GreenGenesProcessedTaxonomyTestCase(TestCase):
def setUp(self):
pass
def test_highest_res_rank_tax_string_full(self):
test_str = "k__Fungi;p__Ascomycota;c__Eurotiomycetes;o__Eurotiale... | bassio/omicexperiment | omicexperiment/tests/test_taxonomy.py | Python | bsd-3-clause | 2,654 |
#!/usr/bin/python2.7
# Copyright 2013 Google 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
#
# Unless requi... | google/apis-client-generator | src/googleapis/codegen/javaproto_generator.py | Python | apache-2.0 | 2,443 |
import _plotly_utils.basevalidators
class HoverongapsValidator(_plotly_utils.basevalidators.BooleanValidator):
def __init__(self, plotly_name="hoverongaps", parent_name="contour", **kwargs):
super(HoverongapsValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_nam... | plotly/python-api | packages/python/plotly/plotly/validators/contour/_hoverongaps.py | Python | mit | 455 |
from __future__ import absolute_import
import logging
from functools import partial
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from edxmako.shortcuts import render_to_st... | GbalsaC/bitnamiP | cms/djangoapps/contentstore/views/preview.py | Python | agpl-3.0 | 11,170 |
from django.contrib import admin, messages
from django.utils.translation import ugettext_lazy as _
from .forms import IndexModelForm
from .models import Filter, FilterGroup, Index
def promote(modeladmin, request, queryset):
if queryset.count() > 1:
messages.error(request,
_("Can't ... | safwanrahman/kuma | kuma/search/admin.py | Python | mpl-2.0 | 2,685 |
import os, time, traceback, re, urllib2, HTMLParser
OFFICIAL_SITE_URL = "http://soundimage.org"
STORAGE_SUBFOLDER = "mp3"
CATEGORIES = [
"classical-sounding",
"corporate",
"dark-ominous",
"drama",
"drama-2",
"events",
"fantasywonder",
"fantasy-2",
"fantasy-3",
"fantasy-4",
"fantasy... | fnaith/snippet | soundimage/soundimage_2016_06_30.py | Python | apache-2.0 | 3,180 |
import pulsar as psr
def load_ref_system():
""" Returns beta-l-arabinopyranose as found in the IQMol fragment library.
All credit to https://github.com/nutjunkie/IQmol
"""
return psr.make_system("""
C 1.5195 -0.1984 -0.0100
C 0.4160 -0.6203 -1.0160
C... | pulsar-chem/Pulsar-Core | lib/systems/beta-l-arabinopyranose.py | Python | bsd-3-clause | 1,152 |
# coding=utf-8
__author__ = 'dimv36'
from flask_login import AnonymousUserMixin, LoginManager
from webtests.models import User
# Модуль инициализации менеджера входа пользователей
login_manager = LoginManager()
class AnonymousUser(AnonymousUserMixin):
id = None
login_manager.anonymous_user = AnonymousUser
log... | dimV36/webtests | webtests/auth.py | Python | gpl-2.0 | 486 |
from OpenGLCffi.GLES1 import params
@params(api='gles1', prms=['renderbuffer'])
def glIsRenderbufferOES(renderbuffer):
pass
@params(api='gles1', prms=['target', 'renderbuffer'])
def glBindRenderbufferOES(target, renderbuffer):
pass
@params(api='gles1', prms=['n', 'renderbuffers'])
def glDeleteRenderbuffersOES(n, ... | cydenix/OpenGLCffi | OpenGLCffi/GLES1/EXT/OES/framebuffer_object.py | Python | mit | 1,790 |
#!/usr/bin/python
import numpy as np
from scipy import linalg
import math
# Soft thresholding function
def soft(a,c,l):
if c < -l:
return (c + l)/a
elif c > l:
return (c-l)/a
else:
return 0.0
def gradientDescent(X, w, w0, t, l, d):
# calculate a's once
rows = X.shape[0]
cols = X.shape[1]
a ... | n7jti/machine_learning | hw1/32a.py | Python | apache-2.0 | 2,603 |
# Copyright 2021 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, ... | GoogleCloudPlatform/gcpdiag | gcpdiag/queries/gcb.py | Python | apache-2.0 | 4,342 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
CONFIG
Maneja las configuraciones del núcleo de HOA.
Autor: PABLO PIZARRO @ ppizarror
Fecha: JULIO 2015, 2017
Licencia: GPLv2
"""
# Importación de librerías
from color import color
from config import *
# Constantes
BR_ERRORxERROR_SET_FORM = 8
BR_ERRORxERROR_SET_SUBM... | ppizarror/Hero-of-Antair | bin/errors.py | Python | gpl-2.0 | 2,502 |
# -*- coding: utf-8 -*-
'''
A smarter {% if %} tag for django templates.
While retaining current Django functionality, it also handles equality,
greater than and less than operators. Some common case examples::
{% if articles|length >= 5 %}...{% endif %}
{% if "ifnotequal tag" != "beautiful" %}...{% endif %}
... | thoas/i386 | src/milkshape/application/internals/misc/templatetags/smart_if.py | Python | mit | 10,829 |
from desiutil.log import get_logger
import numpy as np
import os
import sys
import time
import re
from astropy.table import Table, vstack
## Import some helper functions, you can see their definitions by uncomenting the bash shell command
from desispec.workflow.tableio import load_tables, write_table
from desispec.work... | desihub/desispec | py/desispec/scripts/submit_night.py | Python | bsd-3-clause | 21,336 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Endre Karlson <endre.karlson@hpe.com>
#
# 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/lic... | grahamhayes/designate | designate/tests/test_network_api/test_neutron.py | Python | apache-2.0 | 2,011 |
# coding: utf-8
###################################################################
# Copyright (c) 2016-2022 European Synchrotron Radiation Facility #
# #
# Author: Marius Retegan #
# ... | mretegan/crispy | crispy/utils.py | Python | mit | 2,446 |
import exception
class Base(object):
def __init__(self, *args, **kwargs): pass
class WFS(Base):
@property
def service(self):
return 'WFS'
@property
def supported_version(self):
return ['1.1.0', '2.0.0']
@property
def version(self):
return self._versi... | iocast/libfeatureserver | libfeatureserver/request.py | Python | mit | 653 |
from django.apps import AppConfig
class TimetrackerConfig(AppConfig):
name = 'timetracker'
| jantaylor/road-home-time-tracker | timetracker/apps.py | Python | mit | 96 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | tests/gcp/hooks/test_gsheets.py | Python | apache-2.0 | 10,705 |
# -*- 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 'OpenIDRPConfig.allow_unverified'
db.add_column('ssoopenidrpconfig', 'allow_unverified',
... | miing/mci_migo | identityprovider/migrations/0004_auto__add_field_openidrpconfig_allow_unverified.py | Python | agpl-3.0 | 20,672 |
#!/usr/bin/env python
from distutils.core import setup
setup(name='physcon',
version='0.1',
description='Physical constants and units',
author='Kim G L Pedersen',
author_email='georglind@gmail.com',
py_modules=['physcon'],
url = 'http://github.com/georglind/physcon'
)
| georglind/physcon | setup.py | Python | mit | 312 |
# -*- coding: utf-8 -*-
import re
import urllib
import urlparse
import xbmc
import tools
class Cloudflare:
def __init__(self, response):
self.__is_cloudflare = True
if not ('challenge-form' and 's,t,o,p,b,r,e,a,k,i,n,g,f' and 'jschl-answer' in response['data']):
tools.write_log('[... | Makintos/plugin.video.acestream.sports | lib/cloudflare.py | Python | gpl-3.0 | 3,719 |
"""
$Id$
$URL$
Copyright (C) 2004 Matteo Merli <matteo.merli@gmail.com>
This code is licenced under the GPL. See LICENSE file.
"""
from reportlab.lib.enums import *
from reportlab.lib.colors import Color
class Style:
fontName = 'Helvetica'
fontSize = 10
leading = 12
leftIndent = 0
rightIndent = 0
firstLine... | BackupTheBerlios/pixies-svn | pixies/utils/style.py | Python | gpl-2.0 | 1,114 |
"""While we're only interested in share, like, up counts for now,
there's a lot of interesting metadata in e.g. reddit responses like
user_reports, report_reasons, num_reports, that might be useful
in building certain heuristics.
"""
providers = [
{
"provider": "facebook",
"endpoint": "https://graph.facebook... | psolbach/metadoc | metadoc/social/providers.py | Python | mit | 920 |
import os
import ntpath
import shutil
from mock import MagicMock
from dvm import repo
def cmd_add(args):
add_fpath = args['<file>']
if not os.path.isabs(add_fpath):
add_fpath = os.path.abspath(add_fpath)
if args['--link-name'] is not None:
add_filename = args['--link-name']
else:
... | boldfield/dvm | dvm/add.py | Python | mit | 2,111 |
from typing import Tuple, Any, Dict
from dependency_injector import providers
class Animal:
...
class Cat(Animal):
def __init__(self, *_, **__): ...
@classmethod
def create(cls) -> Animal:
return cls()
# Test 1: to check the return type (class)
provider1 = providers.Singleton(Cat)
anima... | rmk135/objects | tests/typing/singleton.py | Python | bsd-3-clause | 2,628 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyUtils(PythonPackage):
"""Useful, oft-repeated things for Python"""
homepage = "http... | LLNL/spack | var/spack/repos/builtin/packages/py-utils/package.py | Python | lgpl-2.1 | 738 |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_core.testing import MockIRODSTestCaseMixin
from hs_core import hydroshare
from hs_access_control.models import PrivilegeCodes
class TestExplicitGroupAccess(MockIRODSTestCaseMixin, TestCase):
def setUp(self):
super(Test... | ResearchSoftwareInstitute/MyHPOM | hs_access_control/tests/test_explicit_group_access.py | Python | bsd-3-clause | 3,590 |
# -*- coding: utf-8 -*-
"""Tests for the utilities of the moderation app"""
# pylint: disable=invalid-name
from django.contrib.auth import get_user_model
from model_mommy import mommy
from open_connect.connectmessages.tests import ConnectMessageTestCase
from open_connect.moderation.models import MessageModerationActi... | lpatmo/actionify_the_news | open_connect/moderation/tests/test_utils.py | Python | mit | 5,453 |
from datetime import timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import mail
from django.core.urlresolvers import reverse
from django.test.client import Client
from django.utils.timezone import now
f... | chirilo/remo | remo/dashboard/tests/test_views.py | Python | bsd-3-clause | 9,540 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.utils.testing import AutoTeacherTest
class TestDefaultTeacher(AutoTeacherTest):
task = "insuranceqa"
... | facebookresearch/ParlAI | parlai/tasks/insuranceqa/test.py | Python | mit | 455 |
"""
The :mod:`sklearn.pls` module implements Partial Least Squares (PLS).
"""
# Author: Edouard Duchesnay <edouard.duchesnay@cea.fr>
# License: BSD 3 clause
import warnings
from abc import ABCMeta, abstractmethod
import numpy as np
from scipy.linalg import pinv2, svd
from ..base import BaseEstimator, RegressorMixin... | anntzer/scikit-learn | sklearn/cross_decomposition/_pls.py | Python | bsd-3-clause | 36,127 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2015_06_15/models/virtual_machine_scale_set_sku.py | Python | mit | 1,647 |
from django.shortcuts import render, RequestContext
from .forms import *
import datetime
from django.forms import modelformset_factory
from .models import SubmitReport, Student, Faculty, Staff, Course
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
from django.contrib import au... | ServiceLearningB/ServiceLearningNew | submit_reports/views.py | Python | mit | 12,136 |
#! /usr/bin/python
# Derived from dupinator.py.
#
# This program takes a list of pathnames to audio files and moves them to a central archive.
# It replaces the original with a symbolic link to the archived version.
# The archived version will have several names (all hard-linked): the MD5 hash (with the extension)
# a... | jemenake/LogicProjectTools | AudioArchiver.py | Python | mit | 5,075 |
import os
import sys
import testcase_base
from bantorra.util.log import LOG as L
class TestCase_Picture(testcase_base.TestCase_Base):
def picture_crop(self, pic, box="", filename=""):
try:
return self.picture.crop_picture(pic, box, filename)
except Exception as e:
L.warnin... | tstanaka/bantorra.old | script/testcase_picture.py | Python | mit | 855 |
"""
Support for Neato botvac connected vacuum cleaners.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/neato/
"""
import logging
from datetime import timedelta
from urllib.error import HTTPError
import voluptuous as vol
import homeassistant.helpers.co... | ewandor/home-assistant | homeassistant/components/neato.py | Python | apache-2.0 | 3,962 |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from lib.common.abstracts import Package
class CPL(Package):
"""Control Panel Applet analysis package."""
PATHS = [
("SystemRoot", "sy... | liorvh/CuckooSploit | analyzer/windows/modules/packages/cpl.py | Python | gpl-3.0 | 480 |
from django.forms import Form, ModelForm, MultipleChoiceField, CharField
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.utils.translation import get_language
from jsonattrs.mixins import template_xlang_labels
from jsonattrs.forms import form_fie... | Cadasta/cadasta-platform | cadasta/core/form_mixins.py | Python | agpl-3.0 | 8,537 |
from __future__ import unicode_literals
import frappe
def execute():
frappe.reload_doc("website", "doctype", "contact_us_settings")
address = frappe.db.get_value("Contact Us Settings", None, "address")
if address:
address = frappe.get_doc("Address", address)
contact = frappe.get_doc("Contact Us Settings", "Cont... | mahabuber/erpnext | erpnext/patches/v4_0/fix_contact_address.py | Python | agpl-3.0 | 494 |
import data
import gensim as g
l_interested = data.get_entity_list(data.libinfo.interested_libs)
#l_code = list(map(data.get_code, l_interested))
l_doc = list(map(data.get_doc, l_interested))
#l_doc = list(map(p.pdoc.extract, l_doc))
documents = l_doc
texts = p.simple_process(documents=documents, stoplist=p.read_st... | jmzhao/smart-comment | src/main.py | Python | mit | 1,941 |
from __future__ import absolute_import, unicode_literals
from future.builtins import chr, int, str
try:
from html.parser import HTMLParser
from html.entities import name2codepoint
try:
from html.parser import HTMLParseError
except ImportError: # Python 3.5+
class HTMLParseError(Excepti... | gladgod/zhiliao | zhiliao/utils/html.py | Python | bsd-3-clause | 3,803 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.