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 |
|---|---|---|---|---|---|---|
"""
Serializers and ModelSerializers are similar to Forms and ModelForms.
Unlike forms, they are not constrained to dealing with HTML output, and
form encoded input.
Serialization in REST framework is a two-phase process:
1. Serializers marshal between complex types like model instances, and
python primitives.
2. The... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/rest_framework/serializers.py | Python | agpl-3.0 | 41,575 | 0.001034 |
# Copyright (c) 2016, Matt Layman
import unittest
from tap.tests.factory import Factory
class TestCase(unittest.TestCase):
def __init__(self, methodName='runTest'):
super(TestCase, self).__init__(methodName)
self.factory = Factory()
| Mark-E-Hamilton/tappy | tap/tests/testcase.py | Python | bsd-2-clause | 258 | 0 |
#!/usr/bin/env python2.7
import json
import argparse
import codecs
import sys
def main(args):
data = args.in_lyapas.read()
data = json.dumps(data, ensure_ascii=False, encoding='utf-8')
json_data = '{"file": "' + args.in_lyapas.name + '",' + ' "source": ' + data +'}'
args.out_filename.write(json_data)
... | tsu-iscd/lyapas-lcc | lyapas_to_json.py | Python | bsd-3-clause | 753 | 0.010624 |
"""
Ridge regression
"""
# Author: Mathieu Blondel <mathieu@mblondel.org>
# Reuben Fletcher-Costin <reuben.fletchercostin@gmail.com>
# Fabian Pedregosa <fabian@fseoane.net>
# Michael Eickenberg <michael.eickenberg@nsup.org>
# License: BSD 3 clause
from abc import ABCMeta, abstractmethod
impor... | waterponey/scikit-learn | sklearn/linear_model/ridge.py | Python | bsd-3-clause | 51,357 | 0.000156 |
import unittest
from os import path
from API.directoryscanner import find_runs_in_directory
path_to_module = path.abspath(path.dirname(__file__))
class TestDirectoryScanner(unittest.TestCase):
def test_sample_names_spaces(self):
runs = find_runs_in_directory(path.join(path_to_module, "sample-names-with-s... | phac-nml/irida-miseq-uploader | Tests/unitTests/test_directoryscanner.py | Python | apache-2.0 | 1,282 | 0.00234 |
from selenium import webdriver
from time import sleep
driver=webdriver.Firefox()
#打开我要自学网页面并截图
driver.get("http://www.51zxw.net/")
driver.get_screenshot_as_file(r'E:\0python_script\four\Webdriver\zxw.jpg')
sleep(2)
#打开百度页面并截图
driver.get("http://www.baidu.com")
driver.get_screenshot_as_file(r'E:\0python_script\four\Web... | 1065865483/0python_script | four/Webdriver/screenshot.py | Python | mit | 405 | 0.008264 |
import random
N = 600851475143
def gcd(a, b):
while b > 0:
a, b = b, a % b
return a
def factorize(N):
" N の素因数分解を求める (Pollard's rho algorithm) "
factors = []
while N >= 2:
d = 1
while d == 1:
x = random.randint(1, N)
y = random.randint(1, N)
... | ys-nuem/project-euler | 003/003.py | Python | mit | 603 | 0.006861 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/kernel_tests/image_ops/decode_jpeg_op_test.py | Python | apache-2.0 | 7,835 | 0.006254 |
# -*- encoding: utf-8 -*-
def offset_happens_before_timespan_stops(
timespan=None,
offset=None,
hold=False,
):
r'''Makes time relation indicating that `offset` happens
before `timespan` stops.
::
>>> relation = timespantools.offset_happens_before_timespan_stops()
>>> prin... | mscuthbert/abjad | abjad/tools/timespantools/offset_happens_before_timespan_stops.py | Python | gpl-3.0 | 1,081 | 0.000925 |
# -*- coding: utf-8 -*-
import aaargh
from app import Negi
app = aaargh.App(description="Jinja2+JSON powered static HTML build tool")
@app.cmd(help='Parse JSON and build HTML')
@app.cmd_arg('-d','--data_dir',default='./data',help='JSON data dirctory(default:./data')
@app.cmd_arg('-t','--tmpl_dir',default='./template... | zk33/negi | negi/main.py | Python | mit | 798 | 0.035088 |
import re
from autotest.client.shared import error
from autotest.client import utils
from virttest import virsh
from virttest import utils_libvirtd
def run(test, params, env):
"""
Test the command virsh nodecpustats
(1) Call the virsh nodecpustats command for all cpu host cpus
separately
(2... | svirt/tp-libvirt | libvirt/tests/src/virsh_cmd/host/virsh_nodecpustats.py | Python | gpl-2.0 | 8,299 | 0.000361 |
# See http://cens.ioc.ee/projects/f2py2e/
from __future__ import division, print_function
from numpy.f2py.f2py2e import main
main()
| ryfeus/lambda-packs | pytorch/source/numpy/f2py/__main__.py | Python | mit | 134 | 0 |
from django.db import models
from annoying.fields import AutoOneToOneField
class SuperVillain(models.Model):
name = models.CharField(max_length="20", default="Dr Horrible")
class SuperHero(models.Model):
name = models.CharField(max_length="20", default="Captain Hammer")
mortal_enemy = AutoOneToOneField(... | YPCrumble/django-annoying | annoying/tests/models.py | Python | bsd-3-clause | 363 | 0 |
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath, OutputMultiPath
i... | grlee77/nipype | nipype/interfaces/semtools/brains/classify.py | Python | bsd-3-clause | 2,306 | 0.006071 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import json
import logging
import time
from google.appengine.ext import ndb
from google.appengine.api import urlfetch
from google.appengine.api import urlfetch_errors
class APIKey(ndb.Model):
key = ndb.StringProperty(indexed=True,required=True)
class Importer:
... | AndyHannon/ctrprogress | wowapi.py | Python | mit | 5,784 | 0.007089 |
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from .views import UploadBlackListView, DemoView, UdateBlackListView
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^upload-blacklist$', login_required(Upload... | nirvaris/nirvaris-djangofence | djangofence/urls.py | Python | mit | 566 | 0.003534 |
# -*- 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
#... | subodhchhabra/airflow | airflow/contrib/hooks/segment_hook.py | Python | apache-2.0 | 3,748 | 0.0008 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/firestore_v1beta1/proto/event_flow_document_change.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _... | jonparrott/gcloud-python | firestore/google/cloud/firestore_v1beta1/proto/event_flow_document_change_pb2.py | Python | apache-2.0 | 2,565 | 0.011696 |
# Copyright 2014 ETH Zurich
#
# 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, sof... | klausman/scion | python/sciond/sciond.py | Python | apache-2.0 | 30,793 | 0.000974 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | geotagx/geotagx-pybossa-archive | pybossa/hateoas.py | Python | agpl-3.0 | 2,393 | 0 |
#!/opt/local/bin/python
import string
import os
def header(n) :
return "//\n\
// BAGEL - Brilliantly Advanced General Electronic Structure Library\n\
// Filename: SPCASPT2_gen" + str(n) + ".cc\n\
// Copyright (C) 2014 Toru Shiozaki\n\
//\n\
// Author: Toru Shiozaki <shiozaki@northwestern.edu>\n\
// Maintainer: Sh... | nubakery/smith3 | python/spcaspt2/gen_split.py | Python | gpl-2.0 | 2,179 | 0.001377 |
#!/usr/bin/env python
# coding:utf-8
__author__ = 'lixin'
'''
°²×°MySQL
¿ÉÒÔÖ±½Ó´ÓMySQL¹Ù·½ÍøÕ¾ÏÂÔØ×îеÄCommunity Server 5.6.x°æ±¾¡£MySQLÊÇ¿çÆ½Ì¨µÄ£¬Ñ¡Ôñ¶ÔÓ¦µÄƽ̨ÏÂÔØ°²×°Îļþ£¬°²×°¼´¿É¡£
°²×°Ê±£¬MySQL»áÌáʾÊäÈërootÓû§µÄ¿ÚÁÇëÎñ±Ø¼ÇÇå³þ¡£Èç¹ûżDz»×¡£¬¾Í°Ñ¿ÚÁîÉèÖÃΪpassword¡£
ÔÚWindowsÉÏ£¬°²×°Ê±ÇëÑ¡ÔñUTF-8±àÂ룬ÒÔ±... | duanx/bdcspider | bdmysqlDB.py | Python | gpl-2.0 | 3,758 | 0.00612 |
__author__ = 'yuxiang'
import os
import datasets
import datasets.rgbd_scenes
import datasets.imdb
import numpy as np
import subprocess
import cPickle
class rgbd_scenes(datasets.imdb):
def __init__(self, image_set, rgbd_scenes_path=None):
datasets.imdb.__init__(self, 'rgbd_scenes_' + image_set)
sel... | yuxng/Deep_ISM | ISM/lib/datasets/rgbd_scenes.py | Python | mit | 4,957 | 0.004035 |
"""
Resolve unspecified dates and date strings to datetimes.
"""
import datetime as dt
from dateutil.parser import parse as parse_date
import pytz
class InvalidDateFormat(Exception):
"""
The date string could not be parsed.
"""
pass
class DateValidationError(Exception):
"""
Dates are not se... | Stanford-Online/edx-ora2 | openassessment/xblock/resolve_dates.py | Python | agpl-3.0 | 10,291 | 0.003984 |
# This script is actually for Cyber Security on Windows 7. Should mostly work
# for Windows 8 and 10 too. I just absolutely hate using Windows 8 and refuse
# to test it on any Windows 8 machine.
from __future__ import print_function
from subprocess import call
from subprocess import check_output
import os
###########... | road2ge/cyber-defense-scripts | main-for-windows.py | Python | gpl-3.0 | 9,651 | 0.017615 |
# -*- coding: utf-8 -*-
import os
from fuel import config
from fuel.datasets import H5PYDataset
from fuel.transformers.defaults import uint8_pixels_to_floatX
class SVHN(H5PYDataset):
"""The Street View House Numbers (SVHN) dataset.
SVHN [SVHN] is a real-world image dataset for developing machine
learnin... | EderSantana/fuel | fuel/datasets/svhn.py | Python | mit | 2,213 | 0 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2018_01_01/operations/_local_network_gateways_operations.py | Python | mit | 27,633 | 0.005139 |
#!/usr/bin/python
"""Test of Dojo combo box presentation."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(PauseAction(5000))
sequence.append(KeyComboAction("Tab"))
sequence.append(KeyComboAction("Tab"))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComb... | pvagner/orca | test/keystrokes/firefox/aria_combobox_dojo.py | Python | lgpl-2.1 | 4,695 | 0.000852 |
"""
Student Views
"""
import datetime
import logging
import uuid
from collections import namedtuple
from bulk_email.models import Optout
from courseware.courses import get_courses, sort_by_announcement, sort_by_start_date
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.de... | teltek/edx-platform | common/djangoapps/student/views/management.py | Python | agpl-3.0 | 44,012 | 0.002545 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2014 ASMlover. 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 copyrig... | ASMlover/study | python/src/config_parser.py | Python | bsd-2-clause | 1,635 | 0 |
"""
Create python docs for dash easily.
"""
__version__ = '0.2.1'
__author__ = 'whtsky'
__license__ = 'MIT'
| whtsky/Dash.py | dash_py/__init__.py | Python | mit | 109 | 0 |
# -*- coding: utf-8 -*-
"""
##########
# Fields #
##########
Each Field class does some sort of validation. Each Field has a clean() method,
which either raises django.forms.ValidationError or returns the "clean"
data -- usually a Unicode object, but, in some rare cases, a list.
Each Field's __init__() takes at least... | digimarc/django | tests/forms_tests/tests/test_fields.py | Python | bsd-3-clause | 83,991 | 0.005026 |
import logging
from django.db.models import DateTimeField, Model, Manager
from django.db.models.query import QuerySet
from django.db.models.fields.related import \
OneToOneField, ManyToManyField, ManyToManyRel
from django.utils.translation import ugettext_lazy as _
from django.utils.timezone import now
from django... | pmuller/django-softdeletion | django_softdeletion/models.py | Python | mit | 5,119 | 0 |
#!/usr/bin/python
# TODO: issues with new oauth2 stuff. Keep using older version of Python for now.
# #!/usr/bin/env python
from participantCollection import ParticipantCollection
import re
import datetime
import pyperclip
# Edit Me!
# This script gets run on the first day of the following month, and that month's UR... | foobarbazblarg/stayclean | stayclean-2020-january/display-final-after-month-is-over.py | Python | mit | 3,056 | 0.004254 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
float_or_none,
int_or_none,
)
class JWPlatformBaseIE(InfoExtractor):
@staticmethod
def _find_jwplayer_data(webpage):
# TODO: Merge this with JWPlayer-r... | dntt1/youtube-dl | youtube_dl/extractor/jwplatform.py | Python | unlicense | 5,161 | 0.002906 |
from .utils import PyKEArgumentHelpFormatter
import numpy as np
from astropy.io import fits as pyfits
from matplotlib import pyplot as plt
from tqdm import tqdm
from . import kepio, kepmsg, kepkey, kepfit, kepstat, kepfunc
__all__ = ['kepoutlier']
def kepoutlier(infile, outfile=None, datacol='SAP_FLUX', nsig=3.0, s... | gully/PyKE | pyke/kepoutlier.py | Python | mit | 14,393 | 0.00139 |
#!/usr/bin/env python
import urllib2
from bs4 import BeautifulSoup as BS
import re
import time
def getAgenciesList():
agenciesList_req = urllib2.Request('''http://services.my511.org/Transit2.0/GetAgencies.aspx?token=aeeb38de-5385-482a-abde-692dfb2769e3''')
xml_resp = urllib2.urlopen(agenciesList_req)
soup = BS(xm... | trthanhquang/bus-assistant | webApp/getBusTiming.py | Python | mit | 2,827 | 0.038557 |
"""
The GeometryProxy object, allows for lazy-geometries. The proxy uses
Python descriptors for instantiating and setting Geometry objects
corresponding to geographic model fields.
Thanks to Robert Coup for providing this functionality (see #4322).
"""
from django.contrib.gis import memoryview
from django.utils impor... | 912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/models/proxy.py | Python | gpl-2.0 | 2,643 | 0.001892 |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | google-research/google-research | kws_streaming/models/att_rnn.py | Python | apache-2.0 | 5,484 | 0.008388 |
# 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... | nathanielvarona/airflow | airflow/cli/commands/provider_command.py | Python | apache-2.0 | 3,862 | 0.000259 |
from build.management.commands.build_statistics_trees import Command as BuildStatisticsTrees
class Command(BuildStatisticsTrees):
pass | cmunk/protwis | build_gpcr/management/commands/build_statistics_trees.py | Python | apache-2.0 | 142 | 0.021429 |
import os
import sys
import shutil
import glob
import time
import multiprocessing as mp
if len(sys.argv)!=5:
print("Usage: ")
print("python extract_features_for_merlin.py <path_to_merlin_dir> <path_to_wav_dir> <path_to_feat_dir> <sampling rate>")
sys.exit(1)
# top merlin directory
merlin_dir = sys.argv[1]... | bajibabu/merlin | misc/scripts/vocoder/world/extract_features_for_merlin.py | Python | apache-2.0 | 5,044 | 0.011102 |
import aaf
import os
from optparse import OptionParser
parser = OptionParser()
(options, args) = parser.parse_args()
if not args:
parser.error("not enough argements")
path = args[0]
name, ext = os.path.splitext(path)
f = aaf.open(path, 'r')
f.save(name + ".xml")
f.close()
| markreidvfx/pyaaf | example/aaf2xml.py | Python | mit | 281 | 0 |
# Copyright 2017 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... | tensorflow/tensorflow | tensorflow/python/profiler/pprof_profiler_test.py | Python | apache-2.0 | 5,145 | 0.005442 |
# ElasticQuery
# File: setup.py
# Desc: needed
from setuptools import setup
if __name__ == '__main__':
setup(
version='3.2',
name='ElasticQuery',
description='A simple query builder for Elasticsearch 2',
author='Nick Barrett',
author_email='pointlessrambler@gmail.com',
... | Fizzadar/ElasticQuery | setup.py | Python | mit | 554 | 0 |
# Author: Adam Chodorowski
# Contact: chodorowski@users.sourceforge.net
# Revision: $Revision: 2224 $
# Date: $Date: 2004-06-05 21:40:46 +0200 (Sat, 05 Jun 2004) $
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# re... | jmchilton/galaxy-central | modules/docutils/languages/sv.py | Python | mit | 2,135 | 0.001405 |
#!/usr/bin/python
# (c) 2018, NetApp, Inc
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | trondhindenes/ansible | lib/ansible/modules/storage/netapp/na_ontap_svm.py | Python | gpl-3.0 | 18,691 | 0.001498 |
# -*- coding: utf-8 -*-
# ProjectEuler/src/python/problem303.py
#
# Multiples with small digits
# ===========================
# Published on Saturday, 25th September 2010, 10:00 pm
#
# For a positive integer n, define f(n) as the least positive multiple of n
# that, written in base 10, uses only digits 2. Thus f(2)=2... | olduvaihand/ProjectEuler | src/python/problem303.py | Python | mit | 475 | 0.004228 |
import logging, os, marshal, json, cPickle, time, copy, time, datetime, re, urllib, httplib
from base64 import b64encode, b64decode
from lib.crypt import encrypt, decrypt
from uuid import uuid4
from node import Node, InvalidIdentity
class FriendNode(Node):
def __init__(self, *args, **kwargs):
... | pdxwebdev/yadapy | yadapy/friendnode.py | Python | gpl-3.0 | 3,507 | 0.013117 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 VT SuperDARN Lab
# Full license can be found in LICENSE.txt
#
# 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
#... | MuhammadVT/davitpy | davitpy/pydarn/proc/music/music.py | Python | gpl-3.0 | 84,879 | 0.014338 |
# --------------------------------------------------------
# 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
from setuptools im... | mileistone/test | utils/test/setup.py | Python | mit | 5,817 | 0.003094 |
"""Support for Telegram bot using polling."""
import logging
from homeassistant.const import (
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP)
from homeassistant.core import callback
from . import (
CONF_ALLOWED_CHAT_IDS, PLATFORM_SCHEMA as TELEGRAM_PLATFORM_SCHEMA,
BaseTelegramBotEntity, initialize_... | jamespcole/home-assistant | homeassistant/components/telegram_bot/polling.py | Python | apache-2.0 | 3,026 | 0 |
# Copyright 2019 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.
import os.path
import subprocess
import sys
_enable_style_format = None
_clang_format_command_path = None
_gn_command_path = None
def init(root_src_dir, e... | scheib/chromium | third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py | Python | bsd-3-clause | 3,817 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | blutack/mavlog | docs/conf.py | Python | bsd-3-clause | 8,361 | 0.005502 |
"""Add theme to config
Revision ID: 58ee75910929
Revises: 1c22ceb384a7
Create Date: 2015-08-28 15:15:47.971807
"""
# revision identifiers, used by Alembic.
revision = '58ee75910929'
down_revision = '1c22ceb384a7'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.execute("INSERT INTO config (cat... | iseppi/zookeepr | alembic/versions/20_58ee75910929_add_theme_to_config_.py | Python | gpl-2.0 | 603 | 0.006633 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-02-02 12:18
from __future__ import unicode_literals
from django.contrib.auth.models import Permission
from django.db import migrations
def delete_old_comment_permission(apps, schema_editor):
"""
Deletes the old 'can_see_and_manage_comments' permiss... | CatoTH/OpenSlides | server/openslides/motions/migrations/0005_auto_20180202_1318.py | Python | mit | 2,199 | 0.00091 |
# Since this package contains a "django" module, this is required on Python 2.
from __future__ import absolute_import
import sys
import jinja2
from django.conf import settings
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.utils import six
from django.utils.module_loading import im... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/Django-1.9-py2.7.egg/django/template/backends/jinja2.py | Python | artistic-2.0 | 3,342 | 0.000598 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Cloudwatt
# 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/licen... | eltonkevani/tempest_el_env | tempest/api/object_storage/test_container_quotas.py | Python | apache-2.0 | 4,616 | 0 |
# -*- coding: utf-8 -*-
#
# pysysinfo documentation build configuration file, created by
# sphinx-quickstart on Fri Nov 6 16:05:30 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... | FrostyX/pysysinfo | doc/conf.py | Python | gpl-2.0 | 8,133 | 0.006271 |
#!/usr/bin/env python
import json
import argparse
from webapollo import WAAuth, WebApolloInstance, AssertUser, accessible_organisms
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="List all organisms available in an Apollo instance"
)
WAAuth(parser)
parser.add_argument(... | TAMU-CPT/galaxy-tools | tools/webapollo/list_organism_data.py | Python | gpl-3.0 | 951 | 0.001052 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.models.building_location_choice_model import BuildingLocationChoiceModel as UrbansimBuildingLocationChoiceModel
from numpy import where, arange, zeros
from numpy import logical_or, ... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim_parcel/models/building_location_choice_model.py | Python | gpl-2.0 | 5,528 | 0.009949 |
from unittest2.events import Plugin, addOption
from unittest2.util import getSource
import os
import sys
try:
import coverage
except ImportError, e:
coverage = None
coverageImportError = e
help_text1 = 'Enable coverage reporting'
class CoveragePlugin(Plugin):
configSection = 'coverage'
com... | dugan/coverage-reporter | coverage_reporter/extras/unittest2_plugin.py | Python | mit | 1,511 | 0.003971 |
# Copyright 2020 Nokia.
#
# 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 wr... | nuagenetworks/nuage-openstack-horizon | nuage_horizon/dashboards/project/gateways/urls.py | Python | apache-2.0 | 1,078 | 0 |
from __future__ import absolute_import
import os
import tempfile
from six.moves import configparser as ConfigParser
from six import iteritems
from linchpin.exceptions import LinchpinError
"""
Provide valid context data to test against.
"""
class ContextData(object):
def __init__(self, parser=ConfigParser.Con... | samvarankashyap/linch-pin | linchpin/tests/mockdata/contextdata.py | Python | gpl-3.0 | 4,450 | 0.002472 |
from enum import Enum
import re
class OutputTypes:
"""Class representing visible output types"""
class Types(Enum):
"""Types"""
Stdout = 1
Stderr = 2
Result = 3
Image = 4
Pdf = 5
def __init__(self, types_str):
"""Initialization from string"""
... | jablonskim/jupyweave | jupyweave/settings/output_types.py | Python | mit | 1,920 | 0.000521 |
# Test for one implementation of the interface
from lexicon.providers.nsone import Provider
from integration_tests import IntegrationTests
from unittest import TestCase
import pytest
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interfa... | tnwhitwell/lexicon | tests/providers/test_nsone.py | Python | mit | 972 | 0.003086 |
# Copyright 2015 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.
import logging
import re
import time
from devil.android import device_errors
from pylib import flag_changer
from pylib.base import base_test_result
from pyl... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/build/android/pylib/local/device/local_device_instrumentation_test_run.py | Python | mit | 6,414 | 0.011381 |
# -*- coding: utf-8 -*-
from module.plugins.internal.MultiHook import MultiHook
class SmoozedComHook(MultiHook):
__name__ = "SmoozedComHook"
__type__ = "hook"
__version__ = "0.04"
__status__ = "testing"
__config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" ... | fayf/pyload | module/plugins/hooks/SmoozedComHook.py | Python | gpl-3.0 | 876 | 0.025114 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import logging
import numpy
from snisi_core.models.Projects import Cluster
# from snisi_core.models.Reporting import ExpectedRepor... | yeleman/snisi | snisi_vacc/indicators.py | Python | mit | 4,346 | 0.00069 |
if __name__ == '__main__':
print("Loading Modules...")
from setuptools.command import easy_install
def install_with_easyinstall(package):
easy_install.main(["-U", package])
imported = False
tries = 0
while not imported:
try:
import socket, importlib
globals()['PIL'] = importlib.import_m... | TNT-Samuel/Coding-Projects | Image Test/_ImageEdit3MultiProcess.py | Python | gpl-3.0 | 17,506 | 0.00914 |
# deviceaction.py
# Device modification action classes for anaconda's storage configuration
# module.
#
# Copyright (C) 2009 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License... | kalev/anaconda | pyanaconda/storage/deviceaction.py | Python | gpl-2.0 | 20,775 | 0.000722 |
from django.db import models
# Create your models here.
class Autor(models.Model):
nombre = models.CharField(max_length=50)
edad = models.IntegerField(null=True, blank=True)
email = models.EmailField()
def __unicode__(self):
return self.nombre
class Meta:
verbose_name_plural = "Autores"
class Articulo(mo... | melizeche/PyBlog | blog/models.py | Python | gpl-2.0 | 607 | 0.039539 |
from django.db import models
from django import forms
class installed(models.Model):
name = models.CharField(max_length=300)
active = models.CharField(max_length=300)
class vectors(models.Model):
name = models.CharField(max_length=300)
active = models.CharField(max_len... | 0sm0s1z/subterfuge | modules/models.py | Python | gpl-3.0 | 1,614 | 0.02912 |
"""
Course rerun page in Studio
"""
from .course_page import CoursePage
from .utils import set_input_value
class CourseRerunPage(CoursePage):
"""
Course rerun page in Studio
"""
url_path = "course_rerun"
COURSE_RUN_INPUT = '.rerun-course-run'
def is_browser_on_page(self):
"""
... | ahmadiga/min_edx | common/test/acceptance/pages/studio/course_rerun.py | Python | agpl-3.0 | 971 | 0 |
'''
Copyright 2010-2013 DIMA Research Group, TU Berlin
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... | codeaudit/myriad-toolkit | tools/python/myriad/compiler/debug.py | Python | apache-2.0 | 2,056 | 0.006323 |
# 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 distributed in the hope that it will be useful,
# bu... | kenorb-contrib/BitTorrent | python_bt_codebase_library/BTL/ebrpc.py | Python | gpl-3.0 | 3,425 | 0.012555 |
from openerp import api, models, fields, SUPERUSER_ID
class reminder(models.AbstractModel):
_name = 'reminder'
_reminder_date_field = 'date'
_reminder_description_field = 'description'
# res.users or res.partner fields
_reminder_attendees_fields = ['user_id']
reminder_event_id = fields.Many... | Trust-Code/addons-yelizariev | reminder_base/reminder_base_models.py | Python | lgpl-3.0 | 6,555 | 0.001831 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
__all__ = ['quantity_input']
import inspect
from astropy.utils.decorators import wraps
from astropy.utils.misc import isiterable
from .core import Unit, UnitBase, UnitsError, add_enabled_equivalencies
from .physical import _unit_... | stargaser/astropy | astropy/units/decorators.py | Python | bsd-3-clause | 9,242 | 0.001839 |
username = "x"
password = "x"
subreddit = "x"
client_id = "x"
| ciaranlangton/reddit-cxlive-bot | config.py | Python | mit | 62 | 0 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Pedro Gómez$ <pegomez@elnogal.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the te... | Comunitea/CMNT_00040_2016_ELN_addons | sales_mrp_stock_forecast_link/wizard/__init__.py | Python | agpl-3.0 | 1,048 | 0 |
from django.contrib import admin
from .models import Type_Of_Crime
admin.site.register(Type_Of_Crime)
# Register your models here.
| shudwi/CrimeMap | Type_Of_Crime/admin.py | Python | gpl-3.0 | 131 | 0 |
import numpy as np
from sklearn import cluster, datasets, preprocessing
import pickle
import gensim
import time
import re
import tokenize
from scipy import spatial
def save_obj(obj, name ):
with open( name + '.pkl', 'wb') as f:
pickle.dump(obj, f, protocol=2)
def load_obj(name ):
with open( name + '.... | tpsatish95/Topic-Modeling-Social-Network-Text-Data | Kseeds/modifiedCluster.py | Python | apache-2.0 | 4,434 | 0.016013 |
#!/usr/bin/env python
import json
import os
import subprocess
def normalize_target(target):
if ':' in target: return target
return target + ':' + os.path.basename(target)
def gn_desc(root_out_dir, target, *what_to_show):
# gn desc may fail transiently for an unknown reason; retry loop
for i in xrange... | ianloic/fuchsia-sdk | scripts/common.py | Python | apache-2.0 | 848 | 0.004717 |
import sys, pickle, copy
import numpy as np
import matplotlib.pyplot as pl
import astropy.io.fits as pyfits
import magellanic.regionsed as rsed
import magellanic.mcutils as utils
from magellanic.lfutils import *
try:
import fsps
from sedpy import observate
except ImportError:
#you wont be able to predict... | bd-j/magellanic | magellanic/sfhs/prediction_scripts/predicted_total.py | Python | gpl-2.0 | 5,894 | 0.009841 |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4
#
# MDAnalysis --- https://www.mdanalysis.org
# Copyright (c) 2006-2020 The MDAnalysis Development Team and contributors
# (see the file AUTHORS for the full list of names)
#
# Released under t... | MDAnalysis/mdanalysis | package/MDAnalysis/analysis/hole2/hole.py | Python | gpl-2.0 | 67,157 | 0.000626 |
#!/usr/bin/env python
import os
import sys
sys.path.insert(0, os.pardir)
from testing_harness import TestHarness, PyAPITestHarness
import openmc
class FilterMaterialTestHarness(PyAPITestHarness):
def _build_inputs(self):
filt = openmc.Filter(type='material', bins=(1, 2, 3, 4))
tally = openmc.Tall... | mjlong/openmc | tests/test_filter_material/test_filter_material.py | Python | mit | 858 | 0.003497 |
from __future__ import unicode_literals
from django import forms
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
class Accounts(User):
class Meta:
proxy = True
class LoginForm(forms.Form):
# This creates two variables c... | unlessbamboo/django | accounts/models.py | Python | gpl-3.0 | 1,076 | 0.005576 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | david-ragazzi/nupic | examples/opf/simple_server/model_params.py | Python | gpl-3.0 | 9,288 | 0.001507 |
# python 3
# tensorflow 2.0
from __future__ import print_function, division, absolute_import
import os
import argparse
import random
import numpy as np
import datetime
# from numpy import linalg
import os.path as osp
import sys
cur_dir = osp.dirname(osp.abspath(__file__))
sys.path.insert(1, osp.join(cur_dir, '.'))
fr... | wangg12/IRLS_tf_pytorch | src/IRLS_tf_v2.py | Python | apache-2.0 | 6,061 | 0.003135 |
# Copyright (c) 2011 - Rui Batista <ruiandrebatista@gmail.com>
#
# 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 vers... | ragb/sudoaudio | sudoaudio/speech/__init__.py | Python | gpl-3.0 | 1,242 | 0.003221 |
import unittest
import calc
class CalcTestCase(unittest.TestCase):
"""Test calc.py"""
def setUp(self):
self.num1 = 10
self.num2 = 5
def tearDown(self):
pass
def test_add(self):
self.assertTrue(calc.add(self.num1, self.num2), self.num1 + self.num2)
... | dariosena/LearningPython | general/dry/test_calc.py | Python | gpl-3.0 | 794 | 0 |
# -*- coding: utf-8 -*-
#
# API configuration
#####################
DEBUG = False
# Top-level URL for deployment. Numerous other URLs depend on this.
CYCLADES_BASE_URL = "https://compute.example.synnefo.org/compute/"
# The API will return HTTP Bad Request if the ?changes-since
# parameter refers to a point in time ... | grnet/synnefo | snf-cyclades-app/synnefo/app_settings/default/api.py | Python | gpl-3.0 | 8,466 | 0.000472 |
#!/usr/bin/env python
from os import path
import sys
import sqlite3
import random
import argparse
import re
import gzip
import mvmv.mvmv as mvmv
import mvmv.mvmvd as mvmvd
import mvmv.parse as parse
class DownloadDB(argparse.Action):
def __init__(self, option_strings, dest, nargs=None, **kwargs):
super(D... | wmak/mvmv | mvmv/cli.py | Python | mit | 6,353 | 0.001259 |
# 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 by applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/surface/logging/sinks/list.py | Python | mit | 4,667 | 0.004928 |
"""Configuration for imitation.scripts.train_adversarial."""
import sacred
from imitation.rewards import reward_nets
from imitation.scripts.common import common, demonstrations, reward, rl, train
train_adversarial_ex = sacred.Experiment(
"train_adversarial",
ingredients=[
common.common_ingredient,
... | HumanCompatibleAI/imitation | src/imitation/scripts/config/train_adversarial.py | Python | mit | 4,850 | 0.000825 |
# Copyright (c) 2013-2014 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
#
# Un... | shakamunyi/neutron-vrrp | neutron/tests/unit/ml2/test_mechanism_odl.py | Python | apache-2.0 | 9,006 | 0 |
"""
Optional integration with django-any-Imagefield
"""
from __future__ import absolute_import
from django.db import models
from fluent_utils.django_compat import is_installed
if is_installed('any_imagefield'):
from any_imagefield.models import AnyFileField as BaseFileField, AnyImageField as BaseImageField
else:... | edoburu/django-fluent-utils | fluent_utils/softdeps/any_imagefield.py | Python | apache-2.0 | 1,856 | 0.002694 |
from django.core.management import call_command
from django.test import TestCase
from mock import call
from mock import patch
from kolibri.core.content import models as content
class DeleteChannelTestCase(TestCase):
"""
Testcase for delete channel management command
"""
fixtures = ["content_test.jso... | indirectlylit/kolibri | kolibri/core/content/test/test_deletechannel.py | Python | mit | 1,918 | 0.000521 |
import visual as vpy
import numpy as np
import anatomical_constants
from math import sin, cos, acos, atan, radians, sqrt
from conic_section import Ellipse
cam_mat_n7 = np.array([[1062.348, 0.0 , 344.629],
[0.0 , 1065.308, 626.738],
[0.0 , 0.0 , 1.0]])
# [... | errollw/EyeTab | EyeTab_Python/gaze_geometry.py | Python | mit | 5,818 | 0.010141 |
'''
Copyright (C) 2015 Constantin Tschuertz
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
any later version.
This program is distributed in the hope that it wil... | ConstantinT/jAEk | crawler/models/urlstructure.py | Python | gpl-3.0 | 1,991 | 0.00452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.