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 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 2 of the
## ... | MSusik/invenio | invenio/legacy/bibingest/storage_engine_interface.py | Python | gpl-2.0 | 2,548 |
from gevent import monkey; monkey.patch_all()
import threading
localdata = threading.local()
localdata.x = "hello"
assert localdata.x == 'hello'
success = []
def func():
try:
localdata.x
raise AssertionError('localdata.x must raise AttributeError')
except AttributeError:
pass
asse... | mgadi/naemonbox | sources/psdash/gevent-1.0.1/greentest/test__threading_patched_local.py | Python | gpl-2.0 | 510 |
"""This module contains the general information for PidCatalog ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class PidCatalogConsts:
pass
class PidCatalog(ManagedObject):
"""This is PidCatalog class."""
consts ... | ragupta-git/ImcSdk | imcsdk/mometa/pid/PidCatalog.py | Python | apache-2.0 | 3,675 |
"""
DynamoDB Models for PynamoDB
"""
import json
import time
import six
import copy
import logging
import collections
from six import with_metaclass
from pynamodb.exceptions import DoesNotExist, TableDoesNotExist, TableError
from pynamodb.throttle import NoThrottle
from pynamodb.attributes import Attribute
from pynamod... | khwilson/PynamoDB | pynamodb/models.py | Python | mit | 47,942 |
from TCAction import TCActionBase
from NativeLog import NativeLog
import time
import random
import string
TEST_COUNT_ONE_ROUND = 500
class TestCase(TCActionBase.CommonTCActionBase):
def __init__(self, test_case, test_env, timeout=45, log_path=TCActionBase.LOG_PATH):
TCActionBase.CommonTCActionBase.__init... | dschaefer/esp-idf | components/idf_test/integration_test/TestCaseScript/TCPStress/TCPMultiSTASendRecv.py | Python | apache-2.0 | 7,518 |
#!/usr/bin/python
#
# 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 required b... | caioserra/apiAdwords | examples/adspygoogle/dfp/v201306/get_team.py | Python | apache-2.0 | 1,511 |
from django.db import models
class ForbiddenWikiItems(models.Model):
title = models.CharField(max_length=100)
def __unicode__(self):
return self.title
| de1o/moedj | moedjpack/forbidden/models.py | Python | mit | 170 |
# capacityAddPassive
#
# Used by:
# Subsystems from group: Defensive Systems (16 of 16)
type = "passive"
def handler(fit, subsystem, context):
fit.ship.increaseItemAttr("capacity", subsystem.getModifiedItemAttr("capacity") or 0)
| Ebag333/Pyfa | eos/effects/capacityaddpassive.py | Python | gpl-3.0 | 235 |
# -*- coding: utf-8 -*-
# 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... | googleads/google-ads-python | google/ads/googleads/v8/resources/types/change_status.py | Python | apache-2.0 | 5,297 |
#!/usr/bin/env py3
import os
import sys
import re
'''
============================
@FileName: parserLDB
@Author: Jeff Pan (kevinjjp@gmail.com)
@Version: 1.0
@DateTime: 2017-11-06 11:01:28
============================
'''
class LDBPARSER(object):
"""docstring for LDBPARSER"""
def __init__(self, option... | JeffpanUK/NuPyTools | parseLDB.py | Python | mit | 2,921 |
#!/usr/bin/env python
from __future__ import print_function
from builtins import input
from builtins import range
import sys
from pmag_env import set_env
if not set_env.isServer:
import pmagpy.nlt as nlt
import pmagpy.pmag as pmag
import pmagpy.pmagplotlib as pmagplotlib
# initialize some variables
def save_redo(... | Caoimhinmg/PmagPy | programs/microwave_magic.py | Python | bsd-3-clause | 25,384 |
__author__ = 'LimeQM'
from flask import Blueprint
home = Blueprint('home', __name__, template_folder='./templates', url_prefix='/home')
| LimeQM/PassBank | Server/blueprints/Home/__init__.py | Python | mit | 138 |
#
# 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 us... | caneGuy/spark | python/pyspark/ml/evaluation.py | Python | apache-2.0 | 32,506 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
| sota/lang | tests/pre/stage/test_stage.py | Python | mit | 50 |
from django.conf.urls import patterns, include, url
from django.conf import settings
from cabot.cabotapp.views import (
run_status_check, graphite_api_data, checks_run_recently,
duplicate_icmp_check, duplicate_graphite_check, duplicate_http_check, duplicate_jenkins_check,
duplicate_instance, acknowledge_ale... | mcansky/cabotapp | cabot/urls.py | Python | mit | 6,860 |
#!/usr/bin/python
#
# The MIT License (MIT)
#
# Copyright (c) 2016
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, cop... | altermarkive/Android-Sensor-Readings-Uploader | scripts/excel.py | Python | lgpl-3.0 | 4,822 |
# -*- coding: utf-8 -*-
import re
import lxml.html
from billy.scrape.committees import CommitteeScraper, Committee
from openstates.utils import LXMLMixin
class NYCommitteeScraper(CommitteeScraper, LXMLMixin):
jurisdiction = "ny"
latest_only = True
def _parse_name(self, name):
"""
Split a ... | cliftonmcintosh/openstates | openstates/ny/committees.py | Python | gpl-3.0 | 8,055 |
import json
class ToJson:
"""
Enables implementations to be converted to json via a to_json method
"""
def __repr__(self):
return json.dumps(self.to_json())
def to_json(self):
"""
Converts an object to a simple json dictionary
"""
raise NotImplementedError... | gchq/gaffer-tools | fish-bowl/fishbowl/core.py | Python | apache-2.0 | 7,499 |
#!/usr/bin/env python
"""
filterMapview.py <input mapview file> <output filename>
Author: Tony Papenfuss
Date: Mon Jun 16 14:31:42 EST 2008
"""
import os, sys
from useful import progressMessage
iFilename = sys.argv[1]
oFilename = sys.argv[2]
mQ_cutoff = 40
nSeqs = 280000000
oFile = open(oFilename, 'w')
headers ... | PapenfussLab/Srtools | bin/old/filterMaqMapview.py | Python | artistic-2.0 | 1,020 |
# -*- coding:utf_8 -*-
import urllib2
from bs4 import BeautifulSoup
from Bangumi import Bangumi
class Youku(Bangumi):
link = "http://comic.youku.com"
name = u'优酷'
def getBangumi(self):
"""Youku processing function"""
# Get Youku bangumi HTML
req = urllib2.Request(self.link)
... | MrWhoami/WhoamiBangumi | Youku.py | Python | mit | 1,140 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""Comment importer from Blogger
This python script can convert comments posted to a Blogger-powered blog to a
JSON file with can then be imported into Isso (by following the procedure
explained in docs/docs/extras/advanced-migration.rst.
The script can be run like thi... | posativ/isso | contrib/import_blogger.py | Python | mit | 3,872 |
#!/usr/bin/env python3
"""
Unit Tests for the Snapper Chain problem
for Google Code Jam 2010
Qualification Round
Link to problem description:
https://code.google.com/codejam/contest/433101/dashboard#s=p0
Author:
Chris Nitsas
(nitsas)
Language:
Python 3(.4)
Date:
April, 2015
Usage:
python3 test_runme.py... | nitsas/codejamsolutions | Snapper Chain/test_runme.py | Python | mit | 1,605 |
# Miro - an RSS based video player application
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Participatory Culture Foundation
#
# 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; eithe... | debugger06/MiroX | tv/osx/plat/frontends/widgets/sparkleupdater.py | Python | gpl-2.0 | 9,606 |
# -*- coding: utf-8 -*-
"""
werkzeug.test
~~~~~~~~~~~~~
This module implements a client to WSGI applications for testing.
:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import sys
import urlparse
import mimetypes
from time ... | Chitrank-Dixit/werkzeug | werkzeug/test.py | Python | bsd-3-clause | 32,849 |
"""This module provides the functionality for writing out analysis results"""
import csv
import os
import logging
import copy
BASE_COLNAMES = ['sequence', 'hm_pos', 'cutoff_cdf', 'map', 'ltmap', 'fisher_pvalue',
'focus_pos', 'control_pos', 'focus_neg', 'control_neg']
def quant_namer(quant):
n_p... | fhcrc/hyperfreq | hyperfreq/analysis_writer.py | Python | gpl-3.0 | 2,889 |
import unittest
import cmapPy.clue_api_client.setup_logger as setup_logger
import logging
import cmapPy.clue_api_client.clue_api_client as clue_api_client
import os.path
import collections
__authors__ = "David L. Lahr"
__email__ = "dlahr@broadinstitute.org"
logger = logging.getLogger(setup_logger.LOGGER_NAME)
confi... | cmap/cmapPy | cmapPy/clue_api_client/tests/test_clue_api_client.py | Python | bsd-3-clause | 5,593 |
"""test building messages with streamsession"""
#-------------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/IPython/kernel/zmq/tests/test_session.py | Python | gpl-3.0 | 12,636 |
from flask import Blueprint, render_template
from ...middlewares import auth_manager
from .middlewares import s
from ...container import container
account = Blueprint('account', __name__, url_prefix='/account')
def view():
account = container.account
return render_template('accounts/view.html', account=acco... | masom/doorbot-api-python | doorbot/views/dashboard/account.py | Python | mit | 610 |
#!/usr/bin/python
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# This file is in the public domain
### END LICENSE
import sys
import os.path
import unittest
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), "..")))
from tilegen import AboutTile... | milkbread/TileGen | tilegen/tests/test_example.py | Python | gpl-2.0 | 836 |
#!/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
# Copyright 2016 Red Hat Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... | drewandersonnz/openshift-tools | scripts/iam-tools/aws_api_key_manager.py | Python | apache-2.0 | 16,772 |
"""Non-nullable framework components and enforce at least one True with a constraint
Revision ID: 1200
Revises: 1190
Create Date: 2018-05-18 14:55:37.248172
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.sql import table, column
# revision identifiers, used by Alembic.
revision = '1200'
down_rev... | alphagov/digitalmarketplace-api | migrations/versions/1200_non_nullable_framework_components_and_.py | Python | mit | 2,097 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 OpenStack Foundation
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Versio... | Havate/havate-openstack | proto-build/gui/horizon/Horizon_GUI/openstack_dashboard/api/keystone.py | Python | apache-2.0 | 22,790 |
#!/usr/bin/env python
"""
To facilitate WCDMA Tx tuning
This file is part of RF_Tuning_Tool.
:copyright: (c) 2013 by the A-mao Chang (maomaoto@gmail.com)
:license: MIT, see COPYING for more details.
"""
import msvcrt
import sys
from WCDMA_attributes import *
from QCOM import *
from Agilent8960 import *
from A... | tmc9031/RF_Tuning_Tool | tuning.py | Python | mit | 10,818 |
from PySide import QtGui
from PySide import QtCore
from m2u import settings
class PopoverWidget(QtGui.QWidget):
"""A widget that shows as a popup, positioned on the top-right of
a specified other widget.
"""
def __init__(self, parent, appendToWidget, *args, **kwargs):
super(PopoverWidget, se... | m2u/m2u | ui/exportsettingswidget.py | Python | mit | 1,679 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import cv2
from constants import ENV_TYPE
class Environment(object):
# cached action size
action_size = -1
@staticmethod
def create_environment():
if ... | gkwatson/lab | gavinunrealdepth/environment/environment.py | Python | gpl-2.0 | 1,742 |
path = "deep, but not private" | siosio/intellij-community | python/testData/quickFixes/PyAddImportQuickFixTest/orderingUnderscoreInPath/first/second/__init__.py | Python | apache-2.0 | 30 |
import time
import numpy as np
from scipy import sparse as sp
from matplotlib import pyplot as plt
from sklearn.model_selection import GridSearchCV
from sklearn import metrics
from sklearn.learning_curve import learning_curve
"""
Utility functions for training and testing sklearn models
"""
class ModelEvaluator():
... | GautamShine/toxic-docs | modeling.py | Python | mit | 5,991 |
# Copyright Hugh Perkins 2016
"""
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
... | hughperkins/cuda-on-cl | test/test_addressspace.py | Python | apache-2.0 | 6,193 |
# sample(modulo)
def dobra(x):
return 2*x
def triplica(x):
return 3*x
# end-sample
| darcamo/python-crash-course | code/modulo_de_funcoes.py | Python | mit | 92 |
########################################################
# run_rt.py: response-time prediction
# Author: Jamie Zhu <jimzhu@GitHub>
# Created: 2014/2/6
# Last updated: 2016/04/26
# Approaches: UPCC, IPCC, UIPCC [Zheng et al., TSC'11]
########################################################
import _... | wsdream/WS-DREAM | benchmarks/time-aware/UIPCC/run_rt.py | Python | mit | 1,746 |
#!/usr/bin/env python
from getopt import getopt, GetoptError
from random import randint
import os
SUITE=\
"""*** Settings ***
Resource resource.txt
*** Test Cases ***
%TESTCASES%
*** Keywords ***
Test Keyword
Log jee
"""
RESOURCE=\
"""*** Variables ***
@{Resource Var} MOI
*** Keywords ***
%KEYWORDS%
"""
... | fingeronthebutton/RIDE | utest/resources/robotdata/datagenerator.py | Python | apache-2.0 | 2,618 |
# -*- coding: utf-8 -*-
from django.contrib import admin
from models import *
admin.site.register(Plugin_Map) | makinacorpus/ionyweb | ionyweb/plugin_app/plugin_map/admin.py | Python | bsd-3-clause | 111 |
"""(not completed) queries the database and starts new and update crawls when needed, to be called periodically"""
from bibcrawl.utils.ohpython import *
from httplib2 import Http
def isFresh(url, etag):
"""Returns True if the resource at the given url was modified.
>>> e = first(Http().request("http://www.qua... | BlogForever/crawler | bibcrawl/blogmonitor.py | Python | mit | 1,697 |
#!/usr/bin/python
#
# Copyright 2014 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 required b... | jdilallo/jdilallo-test | examples/dfa/v1_20/get_user_roles.py | Python | apache-2.0 | 2,240 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# These tests access private methods in the speedindex module.
# pylint: disable=W0212
import json
import os
import unittest
from telemetry.core import bit... | ChromiumWebApps/chromium | tools/perf/metrics/speedindex_unittest.py | Python | bsd-3-clause | 7,804 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistrib... | dysoul/controller | kcop_control/build/devel/_setup_util.py | Python | mit | 12,329 |
#!/usr/bin/env python
# Cloned & modified from https://gist.github.com/yy/869845
# see also original Python client from the webserver's authors
# at http://llama.mshri.on.ca/software.html
import sys
import json
import httplib
class FuncassociateClient(object):
"""Query funcassociate to find out enriched GO terms.... | quimaguirre/diana | diana/toolbox/func_associate.py | Python | mit | 3,360 |
from django.shortcuts import render
from django.http import HttpResponse
from django.views.generic import ListView
from snapyak.models import Image
def home(request):
return HttpResponse("put images here")
class ListImageView(ListView):
model=Image
template_name='image_list.html'
def ImageList(request):... | KevinJiao/SnapYak | SYSite/snapyak/views.py | Python | mit | 435 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-bigquery-reservation | samples/snippets/quickstart_test.py | Python | apache-2.0 | 805 |
from __future__ import unicode_literals, division, absolute_import
import __builtin__
import logging
import re
import datetime
from copy import copy
from flexget import plugin
from flexget.event import event
from flexget.task import Task
from flexget.entry import Entry
log = logging.getLogger('if')
def safer_eval(s... | ratoaq2/Flexget | flexget/plugins/filter/if_condition.py | Python | mit | 4,613 |
"""
Monitoring Server
Copyright (C) 2016 Walid Benghabrit
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 program is dist... | hkff/AccLab | pyAAL/ui/mon.py | Python | gpl-3.0 | 17,843 |
# pylint: disable=g-bad-file-header
# Copyright 2015 The Bazel 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
... | mrdomino/bazel | scripts/packages/convert_changelog.py | Python | apache-2.0 | 2,003 |
import shogun as sg
import matplotlib.pyplot as plt
import numpy as np
N = 500
size = 100
# positive examples
mean_pos = [-1, 4]
cov_pos = [[1, 40], [50, -2]]
x_pos, y_pos = np.random.multivariate_normal(mean_pos, cov_pos, N).T
plt.plot(x_pos, y_pos, 'bo')
# negative examples
mean_neg = [0, -3]
cov_neg = [[100, 50]... | shogun-toolbox/shogun | examples/undocumented/python/graphical/mclda.py | Python | bsd-3-clause | 1,279 |
# -*- coding: utf-8 -*-
from .base import AbstractAlerterPlugin
| mwielgoszewski/doorman | doorman/plugins/alerters/__init__.py | Python | mit | 65 |
"""
Handle view-logic for the discussions app.
"""
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from rest_framework.response import Response
from rest_framework.views impor... | edx/edx-platform | openedx/core/djangoapps/discussions/views.py | Python | agpl-3.0 | 2,506 |
#!/usr/bin/env python
from __future__ import absolute_import
import unittest
import algorithms
class TestMergeSortBottomUpSort(unittest.TestCase):
def test_merge_sort_bottom_up_with_one_item(self):
iterable = [1]
algorithms.merge_sort_bottom_up(iterable)
expected = [1]
self.assertEqual(iterable,... | michaelreneer/Algorithms | python/test/test_merge_sort_bottom_up.py | Python | mit | 4,356 |
"""Per-repository configuration options."""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# abdt_repooptions
#
# Public Classes:
# Data
#
# Public Functions:
# merge_override_into_data
# me... | valhallasw/phabricator-tools | py/abd/abdt_repooptions.py | Python | apache-2.0 | 6,892 |
from __future__ import unicode_literals
from flask import Flask, render_template_string, Markup
from unittest import TestCase
import mock
import misaka
from misaka import (EXT_AUTOLINK, EXT_FENCED_CODE,
EXT_LAX_HTML_BLOCKS, EXT_NO_INTRA_EMPHASIS, EXT_SPACE_HEADERS,
EXT_STRIKETHROUGH, EXT_SUPERSCRIPT, EXT_TABLE... | alexpana/flask-misaka | tests.py | Python | mit | 7,902 |
## mojology - a syslog browser with style
## Copyright (C) 2011 Gergely Nagy <algernon@balabit.hu>
##
## Mojology 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 y... | algernon/mojology | mojology/utils.py | Python | gpl-3.0 | 2,489 |
from django import forms
class ImageUploadForm(forms.Form):
'''Image upload form.'''
image = forms.ImageField(widget=forms.ClearableFileInput(attrs={'multiple': True}))
| jr55662003/Diabetic-Retinopathy-website | website/diabetics/forms.py | Python | mit | 178 |
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations
def fill_project(apps, schema_editor):
Offering = apps.get_model('marketplace', 'Offering')
ServiceSettings = apps.get_model('structure', 'ServiceSettings')
Tenant = apps.get_model('openstack', 'Tenant')
ContentType... | opennode/nodeconductor-assembly-waldur | src/waldur_mastermind/marketplace_openstack/migrations/0009_fill_project.py | Python | mit | 1,306 |
#scores and grades
print "***Scores and Grades***"
print "Please enter your scores"
def letter(grade):
if (60<=grade<=69):
return "D"
elif (70<=grade<=79):
return "C"
elif (80<=grade<=89):
return "B"
elif (90<=grade<=100):
return "A"
elif (grade>100):
return ... | authman/Python201609 | Nguyen_Ken/Assignments/Python Fundamentals/scoresAndGrades.py | Python | mit | 560 |
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# 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 t... | jerryz1982/neutron | neutron/plugins/openvswitch/agent/openflow/ovs_ofctl/br_tun.py | Python | apache-2.0 | 10,433 |
from rest_framework import permissions
from rest_framework.permissions import BasePermission
class IsAuthenticatedOrCreate(permissions.IsAuthenticated):
def has_permission(self, request, view):
if request.method == 'POST':
return True
return super(IsAuthenticatedOrCreate, self).has_perm... | CornellProjects/hlthpal | web/project/main/permissions.py | Python | apache-2.0 | 624 |
# -*- coding: UTF-8 -*-
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
urlpatterns = [
url(r'^', include('symcon.urls')),
url(r'^pages/', include('django.contrib.flatpages.urls')),
url(r'^admin/', include(admin.... | lociii/symcon-index | heroku/urls.py | Python | mit | 376 |
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template('test.html', r=request)
if __name__ == "__main__":
app.run(host='0.0.0.0', port=8001, debug=True)
| Elemnir/presentations | utk_prog_team_2015_04_09/flask2/flask2.py | Python | bsd-2-clause | 233 |
# 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... | rahulunair/nova | nova/tests/functional/db/test_request_spec.py | Python | apache-2.0 | 3,096 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2015-2018 by ExopyHqcLegacy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the BSD license.
#
# The full license is in the file LICENCE, distributed with this software.
# ------... | Ecpy/ecpy_hqc_legacy | tests/tasks/tasks/util/test_array_tasks.py | Python | bsd-3-clause | 10,976 |
"""Tornado handlers for logging into the notebook."""
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
import re
try:
from urllib.parse import urlparse # Py 3
except ImportError:
from urlparse import urlparse # Py 2
import uuid
from tornado.escape import u... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/notebook/auth/login.py | Python | bsd-2-clause | 9,075 |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import cPickle as pickle
from uuid import UUID
class HIgnoreRuleLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HIgnoreRuleLHS.
"""
# Creat... | levilucio/SyVOLT | t_core/Mutex/HIgnoreRuleLHS.py | Python | mit | 5,943 |
class UnsupportedParserError(Exception):
"""
Exception raised when unsupported parser is specified.
"""
def __init__(self, message):
self.message = message
class UnsupportedDataStructureError(Exception):
"""
Exception raised when unsupported data structure is specified.
"""
de... | gmarciani/pymple | exception/exceptions.py | Python | mit | 1,314 |
# -*- 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 'Video2013.created'
db.add_column('videos_video2013', 'created',
self.g... | mozilla/firefox-flicks | flicks/videos/migrations/0020_auto__add_field_video2013_created.py | Python | bsd-3-clause | 7,284 |
####################################################################################################
#
# PySpice - A Spice Package for Python
# Copyright (C) 2014 Fabrice Salvaire
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published... | thomaslima/PySpice | PySpice/Tools/File.py | Python | gpl-3.0 | 7,812 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
### BEGIN LICENSE
# Copyright (c) 2012, Peter Levi <peterlevi@peterlevi.com>
# 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 So... | GLolol/variety | variety/WallhavenDownloader.py | Python | gpl-3.0 | 6,752 |
# -*- coding: utf-8 -*-
from .api import *
from .db import *
from .runner import *
from .server import *
| canaryhealth/pyramid_test | pyramid_test/__init__.py | Python | mit | 106 |
# Some useful functions to extract data out of emails
# Copyright (C) 2002-2015 John Goerzen & contributors
#
# 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 2 of the Lic... | iamprakashom/offlineimap | offlineimap/emailutil.py | Python | gpl-2.0 | 1,552 |
########################################################################
#
# File Name: Range.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright information
"""
... | wuzhenda/gaedav | pyxml/dom/Range.py | Python | lgpl-2.1 | 40,206 |
#
# Copyright 2014 by mathias herzog, <mathu at gmx dot ch>
#
# 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... | i-splunk/i-splunk-code | custom_simplexml_extensions/bin/custompics.py | Python | apache-2.0 | 2,920 |
from django.conf.urls import url, include
from . import views
urlpatterns = [
url(r'^$', views.index, {}, 'captain'),
url(r'^team/(?P<team_id>[^/]+)/edit/$', views.editteam, {}, 'captaineditteam'),
url(r'^team/(?P<team_id>[^/]+)/export/$', views.exportteam, {}, 'captain_team_export'),
url(r'^team/(?P<... | a2ultimate/ultimate-league-app | src/ultimate/captain/urls.py | Python | bsd-3-clause | 510 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 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.or... | toby82/anvil | anvil/components/cinder.py | Python | apache-2.0 | 1,740 |
##
# Copyright 2009-2018 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... | bartoldeman/easybuild-easyblocks | easybuild/easyblocks/r/rserve.py | Python | gpl-2.0 | 1,694 |
def buildMenus():
pass
on('CHANGE_GAME_STATE', 'GAME_RUNNING', buildMenus) | bartvbl/OpenRR | OpenRR/res/scripts/ingame_gui.py | Python | gpl-2.0 | 77 |
#!/usr/bin/python
import os;
import time;
import sys;
def uploadPage(local_file):
start_browser_cmd = "adb shell am start -a android.intent.action.VIEW -f 0x00008000 -n com.android.browser/com.android.browser.BrowserActivity -d ";
tmp_folder = "/mnt/sdcard/tmp";
browser_tmp_folder = "file://"+tmp_folder;
... | rex-xxx/mt6572_x201 | external/webkit/LayoutTests/fast/borders/uploadPage.py | Python | gpl-2.0 | 766 |
# coding=utf-8
# Copyright 2022 The Tensor2Tensor Authors.
#
# 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... | tensorflow/tensor2tensor | tensor2tensor/data_generators/speech_recognition.py | Python | apache-2.0 | 5,497 |
# get places from input as english text
# run via google api
# input: loc1, loc2
# output: distance
import requests, json, pprint
from itertools import permutations
# Get input from the user, example "Barbican Station, Tower Hill, Buckingham
# Palace"
my_input = raw_input()
# Split into components, remove extra spa... | destination-hack/seatguru | FlaskApp/services/googletsp.py | Python | gpl-3.0 | 1,563 |
from django.contrib.gis import admin
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from nodeshot.core.base.admin import BaseGeoAdmin, PublishActionsAdminMixin
from .settings import REVERSION_ENABLED, TEXT_HTML
from .models import Layer
# enable django-reversion accor... | sephiroth6/nodeshot | nodeshot/core/layers/admin.py | Python | gpl-3.0 | 2,353 |
import mcpi.minecraft as minecraft
import mcpi.block as block
import time
mc = minecraft.Minecraft.create()
def bomb(x, y, z):
mc.setBlock(x+1, y, z+1, block.TNT.id)
for a in range(5, 0, -1):
mc.postToChat(str(a))
time.sleep(1)
mc.postToChat("BANG!")
mc.setBlocks(x-10, y-5, z-10, x+10, y+10, z+10... | whaleygeek/school_mc_demo | demo3/detonator1.py | Python | mit | 473 |
# -*- coding: utf8 -*-
# $Id: __init__.py 6156 2009-10-08 09:42:38Z milde $
# Author: Engelbert Gruber <grubert@users.sourceforge.net>
# Copyright: This module has been placed in the public domain.
"""LaTeX2e document tree Writer."""
__docformat__ = 'reStructuredText'
# code contributions from several people include... | edisonlz/fruit | web_project/base/site-packages/docutils/writers/latex2e/__init__.py | Python | apache-2.0 | 103,494 |
# Copyright (C) 2016 East Asian Observatory
# 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 2 of the License, or (at your option) any later
# version.
#
#... | eaobservatory/hedwig | lib/hedwig/facility/example/control.py | Python | gpl-3.0 | 2,612 |
# -*- coding: utf-8 -*-
from mako.lookup import TemplateLookup
from mako import exceptions
class TemplateEngine:
def __init__(self, config: dict):
"""
Constructor
:param config: dict with keys:
'TEMPLATE_DIR' - directory where to read template html files from
'TEMPLATE_C... | minlexx/xnova_galaxy_parser | site_uni5/classes/template_engine.py | Python | gpl-3.0 | 2,675 |
"""This is the __init__.py file for fcFinder.""" | abchapman93/fcFinder | __init__.py | Python | mit | 48 |
"""
Tests of various stdlib related things that could not be tested
with "Black Box Tests".
"""
from textwrap import dedent
import pytest
@pytest.mark.parametrize(['letter', 'expected'], [
('n', ['name']),
('s', ['smart']),
])
def test_namedtuple_str(letter, expected, Script):
source = dedent("""\
... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/test_inference/test_stdlib.py | Python | gpl-3.0 | 2,739 |
#-*- coding: utf-8 -*-
from collections import deque
def sample(items):
q = deque(maxlen=3)
for i in items:
q.append(i)
print(i, "=>", q)
def sample1(items):
q = deque()
for i in items:
q.append(i)
print(i, "=>", q)
if __name__ == "__main__":
... | williechen/DailyApp | 12/py201501/Ch01_03/sample.py | Python | lgpl-3.0 | 401 |
'''
This file is part of Volapi.
Volapi 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.
Volapi is distributed in the hope that it will be u... | PhearTheCeal/Volafile-API | volapi/volapi.py | Python | gpl-3.0 | 37,586 |
import logging
import numpy as np
import pydart
from fileinfoworld import FileInfoWorld
from controller import Controller
import gltools
from spring_stair import SpringStair
from motion import *
from hyper import *
from plotter_torque import PlotterTorque
# from guppy import hpy
class Simulation(object):
def __in... | sehoonha/green_stair | simulation.py | Python | mit | 8,001 |
"""
WE'RE USING MIGRATIONS!
If you make changes to this model, be sure to create an appropriate migration
file and check it in at the same time as your model changes. To do that,
1. Go to the edx-platform dir
2. ./manage.py schemamigration courseware --auto description_of_your_change
3. Add the migration file created... | Lektorium-LLC/edx-platform | lms/djangoapps/courseware/models.py | Python | agpl-3.0 | 14,611 |
class MinStack:
def __init__(self):
"""
initialize your data structure here.
"""
from collections import deque
self.stack = deque()
self.stack.append((None, float('inf')))
def push(self, x: int) -> None:
self.stack.append((x, min(x, self.stack[-1][1])))
... | saisankargochhayat/algo_quest | leetcode/155. Min Stack/soln.py | Python | apache-2.0 | 664 |
#-------------------------------------------------------------------------
# This file contains real Python object wrappers for DB and DBEnv
# C "objects" that can be usefully subclassed. The previous SWIG
# based interface allowed this thanks to SWIG's shadow classes.
# -- Gregory P. Smith
#---------------... | ktan2020/legacy-automation | win/Lib/bsddb/dbobj.py | Python | mit | 11,613 |
# Copyright (c) 2013 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 by applicable law or agreed to in writi... | danielmellado/stackalytics | tests/unit/test_vcs.py | Python | apache-2.0 | 7,172 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons | myo_professional/models/professional_category.py | Python | agpl-3.0 | 4,368 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.