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 |
|---|---|---|---|---|---|---|
# -*- coding: UTF-8 -*-
import logging
unicode_string = u"Татьяна"
utf8_string = "'Татьяна' is an invalid string value"
logging.warning(unicode_string)
logging.warning(utf8_string)
try:
raise Exception(utf8_string)
except Exception,e:
print "--- (Log a traceback of the exception):"
logging.exception(e... | lsaffre/blog | docs/blog/2011/0527.py | Python | agpl-3.0 | 806 | 0.017677 |
# encoding: utf-8
" This sub-module provides 'sequence awareness' for blessed."
__author__ = 'Jeff Quast <contact@jeffquast.com>'
__license__ = 'MIT'
__all__ = ('init_sequence_patterns', 'Sequence', 'SequenceTextWrapper',)
# built-ins
import functools
import textwrap
import warnings
import math
import sys
import re
... | AccelAI/accel.ai | flask-aws/lib/python2.7/site-packages/blessed/sequences.py | Python | mit | 26,038 | 0.000154 |
# -*- coding: utf-8 -*-
from .main import app
from . import views
"""
Initialize the package
"""
| stxnext-kindergarten/presence-analyzer-agrochowski | src/presence_analyzer/__init__.py | Python | mit | 97 | 0 |
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | ntt-sic/nova | nova/tests/api/openstack/compute/contrib/test_certificates.py | Python | apache-2.0 | 2,810 | 0 |
from gi.repository import Gtk, Gdk,GObject,Pango
import commands
import time
import sys,os
import threading
import sqlite3
from config_note import Config
config_note = Config()
path = "/usr/share/gnome-shell/extensions/turbonote@iksws.com.br/turbonote-adds/"
path_icon = "/usr/share/gnome-shell/extensions/turbonote@iks... | iksws/GnomeTurboNoteExtension | turbonote-adds/notestyle.py | Python | gpl-3.0 | 10,601 | 0.016602 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/protobuf/any.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 _message
from google.protobuf import reflecti... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/google/protobuf/any_pb2.py | Python | bsd-2-clause | 2,652 | 0.006787 |
import logging
from tkp.accessors import CasaImage
logger = logging.getLogger(__name__)
class AartfaacCasaImage(CasaImage):
def __init__(self, url, plane=0, beam=None):
super(AartfaacCasaImage, self).__init__(url, plane=0, beam=None)
self.taustart_ts = self.parse_taustartts()
self.teles... | bartscheers/tkp | tkp/accessors/aartfaaccasaimage.py | Python | bsd-2-clause | 1,347 | 0 |
"""
SALTS XBMC Addon
Copyright (C) 2014 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 later version.
T... | TheWardoctor/Wardoctors-repo | plugin.video.salts/scrapers/xmovies8_scraper.py | Python | apache-2.0 | 5,391 | 0.006678 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | mikehulluk/morphforge | src/morphforgeexamples/exset2_singlecell_simulations/singlecell_simulation010.py | Python | bsd-2-clause | 3,237 | 0.006179 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Library
from ..models import Espacio
register = Library()
@register.inclusion_tag('espacios/_otros_espacios.html', takes_context=True)
def otros_espacios(context):
qs = Espacio.objects.all()
if 'espacio' in context:
... | andensinlimite/metaespacio | metaespacio/espacios/templatetags/espacios.py | Python | agpl-3.0 | 441 | 0 |
import sys
import os
import xbmc
import xbmcgui
import xbmcplugin
import threading
import socket
import urllib
from Queue import Queue
import plugins
import ConfigParser
import logging
import difflib
try: current_dlg_id = xbmcgui.getCurrentWindowDialogId()
except: current_dlg_id = 0
current_win_id = xbmcgui.getCurrent... | vLBrian/boxeehack-cigamit | hack/boxee/scripts/OpenSubtitles/resources/lib/gui.py | Python | mit | 11,411 | 0.063897 |
# -*- coding: utf-8 -*-
"""
http://www.ncbi.nlm.nih.gov/Sitemap/samplerecord.html
http://www.insdc.org/documents/feature_table.html
All keys are native strings, as are values, except the origin which is always
a python 3 byte string (not unicode)
"""
import re
import io
import sys
from collections import OrderedDict
... | libnano/libnano | libnano/fileio/gb_reader_b.py | Python | gpl-2.0 | 12,973 | 0.004702 |
#!/usr/bin/env python3
import time, threading, queue
from .util import osc, log
class Driver(object):
""" This is a substitute for a realtime system """
def __init__(self):
self.voices = []
self.grain = 0.01 # hundredths are nailed by Granu, w/o load. ms are ignored.
self.t = 0.... | brianhouse/wavefarm | granu/braid/core.py | Python | gpl-3.0 | 2,215 | 0.005869 |
""" Client-side transfer class for monitoring system
"""
import time
from DIRAC.Core.DISET.RPCClient import RPCClient
from DIRAC import S_OK
class SiteMapClient:
###########################################################################
def __init__( self, getRPCClient = None ):
self.getRPCClient = getRPCCl... | Sbalbp/DIRAC | FrameworkSystem/Client/SiteMapClient.py | Python | gpl-3.0 | 1,184 | 0.033784 |
# -*- coding: utf-8 -*-
"""
wakatime.offlinequeue
~~~~~~~~~~~~~~~~~~~~~
Queue for saving heartbeats while offline.
:copyright: (c) 2014 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import logging
import os
from time import sleep
from .compat import json
from .constants import ... | wakatime/komodo-wakatime | components/wakatime/offlinequeue.py | Python | bsd-3-clause | 3,427 | 0.000875 |
from flask import render_template, redirect, request, url_for, flash
from . import auth
from ..models import User
from .forms import LoginForm, RegistrationForm
from flask_login import login_user, logout_user, login_required, current_user
from .. import db
from ..email import send_email
@auth.route('/login', methods=... | bobbyxuy/flask_web | app/auth/views.py | Python | mit | 1,344 | 0.001488 |
import socket
from .attrtree import AttrTree
from .checks import Checks
config = AttrTree()
# the list of checks
config.install_attr('checks', Checks())
# This is the base granularity (in seconds) for polling
# Each check may then individually be configured to run every N * tick
config.install_attr('base_tick', 60)... | StrasWeb/picomon | picomon/__init__.py | Python | gpl-3.0 | 2,005 | 0 |
__author__ = 'dani882'
# lecture 3.2, slide 6
# Find the cube root of a perfect cube
x = int(raw_input('Enter an integer: '))
ans = 0
while ans**3 < abs(x):
ans = ans + 1
if ans**3 != abs(x):
print(str(x) + ' is not a perfect cube')
else:
if x < 0:
ans = -ans
print('Cube root of ' + str(x) + ' ... | dani882/edX---Computer-Science | python/lecture 3.2.py | Python | gpl-2.0 | 336 | 0.002976 |
import marlin | atmb4u/marlin | marlin/__init__.py | Python | bsd-3-clause | 13 | 0.076923 |
# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lepus.uberspace.de>
# This software is distributed under the terms of the GNU GPL version 3.
from inspect import isfunction
from ranger.ext.signals import SignalDispatcher, Signal
from ranger.core.shared import FileManagerAware
from ranger.gui.colorscheme import _colors... | mullikine/ranger | ranger/container/settings.py | Python | gpl-3.0 | 8,531 | 0.001524 |
# Copyright 2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test behavior of the Librarian during a database outage.
Database outages happen by accident and during fastdowntime deployments."""
__metaclass__ = type
from cStringIO impor... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/services/librarianserver/tests/test_db_outage.py | Python | agpl-3.0 | 3,628 | 0 |
from simplequeue.lib.configuration import config
__all__ = ['config']
| geonetix/simplemq | simplequeue/__init__.py | Python | mit | 71 | 0 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (C) 2014 Didotech srl (<http://www.didotech.com>).
#
# All Rights Reserved
#
# This program is free software: you can redistr... | iw3hxn/LibrERP | sale_order_version/models/__init__.py | Python | agpl-3.0 | 1,120 | 0 |
#!/usr/bin/env python3
# This file is part of Shoop.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
"""
License header updater.
"""
from __future__ import unicode_literals
impo... | akx/shoop | _misc/ensure_license_headers.py | Python | agpl-3.0 | 4,075 | 0.001227 |
#implementation of radix sort in Python.
def RadixSort(A):
RADIX = 10
maxLength = False
tmp , placement = -1, 1
while not maxLength:
maxLength = True
buckets = [list() for _ in range(RADIX)]
for i in A:
tmp = i / placement
buckets[tmp % RADIX].append(i)
if maxLength and tmp > 0:
maxL... | applecool/Practice | Python/Sorting/RadixSort.py | Python | mit | 556 | 0.082734 |
#!/usr/bin/env python
# -*- coding: latin-1 -*-
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2014 Stanford University and the Authors
#
# Authors: Kyle A. Beauch... | msultan/mdtraj | mdtraj/nmr/scalar_couplings.py | Python | lgpl-2.1 | 8,005 | 0.001376 |
# 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.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | HalCanary/skia-hc | tools/skp/page_sets/skia_cnn_desktop.py | Python | bsd-3-clause | 1,145 | 0.00524 |
# @name <%= app_name %>
# @description
# Models for UserControler.
import json
from src.models import BaseModel
class <%= endpoint %>Model(BaseModel):
_parse_class_name = '<%= table %>'
pass | nghiattran/generator-python-parse | generators/endpoint/templates/model_template.py | Python | mit | 201 | 0.014925 |
from __future__ import absolute_import
from .base import WhiteNoise
__version__ = '2.0.3'
__all__ = ['WhiteNoise']
| KnockSoftware/whitenoise | whitenoise/__init__.py | Python | mit | 118 | 0 |
from tastypie.resources import ModelResource, ALL
from .models import Filer, Filing
from .utils.serializer import CIRCustomSerializer
class FilerResource(ModelResource):
class Meta:
queryset = Filer.objects.all()
serializer = CIRCustomSerializer()
filtering = {'filer_id_raw': ALL}
... | myersjustinc/django-calaccess-campaign-browser | calaccess_campaign_browser/api.py | Python | mit | 545 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from flask import Blueprint, request
import jimit as ji
from models import UidOpenidMapping
from models import Utils, Rules, User
__author__ = 'James Iter'
__date__ = '16/6/8'
__contact__ = 'james.iter.cn@gmail.com'
__copyright__ = '(c) 2016 by James Iter.'... | jamesiter/jimauth | views/user_mgmt.py | Python | gpl-3.0 | 14,179 | 0.001987 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-11-03 00:57
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('courses', '0001_initial'),
]
operations = [
migrations.AlterField(
... | rafaelribeiroo/ensinoDistancia | src/apps/courses/migrations/0002_auto_20171103_0057.py | Python | gpl-3.0 | 685 | 0.00292 |
"""
In order to create a package for pypi, you need to follow several steps.
1. Create a .pypirc in your home directory. It should look like this:
```
[distutils]
index-servers =
pypi
pypitest
[pypi]
username=allennlp
password= Get the password from LastPass.
[pypitest]
repository=https://test.pypi.org/legacy/
... | nafitzgerald/allennlp | setup.py | Python | apache-2.0 | 3,457 | 0.002025 |
import csv, sqlite3
con = sqlite3.connect("toto.db") # change to 'sqlite:///your_filename.db'
cur = con.cursor()
cur.execute("CREATE TABLE t (col1, col2);") # use your column names here
with open('data.csv','r') as fin: # `with` statement available in 2.5+
# csv.DictReader uses first line in file for column headi... | fccagou/tools | python/sql/csv-to-sql.py | Python | gpl-2.0 | 537 | 0.013035 |
# 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... | itaiin/arrow | python/pyarrow/types.py | Python | apache-2.0 | 6,569 | 0 |
"""The Energy integration."""
from __future__ import annotations
from homeassistant.components import frontend
from homeassistant.core import HomeAssistant
from homeassistant.helpers import discovery
from homeassistant.helpers.typing import ConfigType
from . import websocket_api
from .const import DOMAIN
from .data i... | jawilson/home-assistant | homeassistant/components/energy/__init__.py | Python | apache-2.0 | 1,029 | 0.000972 |
from django.forms.models import model_to_dict
from django.db.models import Count
from django.core.paginator import Paginator
import json
from core.apps.tools.common import render_json, dump_and_render_json,\
MeeMJSONEncoder
from core.apps.accounts.models import User
from core.apps.history.models import UserLogEnt... | houssemFat/MeeM-Dev | teacher/apps/dashboard/views.py | Python | mit | 3,848 | 0.013514 |
# Zed Attack Proxy (ZAP) and its related class files.
#
# ZAP is an HTTP/HTTPS proxy for assessing web application security.
#
# Copyright 2015 the ZAP development team
#
# 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... | 0xkasun/zaproxy | python/api/src/zapv2/core.py | Python | apache-2.0 | 14,644 | 0.010311 |
'''
Created on Jul 26, 2014
@author: lwoydziak
'''
from mockito.mocking import mock
from pertinosdk import PertinoSdk, QueryBuilder, where
from mockito.mockito import when, verify
from mockito.matchers import any, Matcher
class Contains(Matcher):
def __init__(self, sub):
self.sub = sub
def ma... | Pertino/pertino-sdk-python | pertinosdk/tests/pertinosdk_test.py | Python | mit | 3,217 | 0.009636 |
from django.template import TemplateDoesNotExist, TemplateSyntaxError
from django.test import SimpleTestCase
from ..utils import setup
from .test_extends import inheritance_templates
class ExceptionsTests(SimpleTestCase):
@setup({'exception01': "{% extends 'nonexistent' %}"})
def test_exception01(... | yephper/django | tests/template_tests/syntax_tests/test_exceptions.py | Python | bsd-3-clause | 2,158 | 0.00139 |
#!/usr/env/bin python
# TODO
# 1. fix bug that if a script shares the same name as a material dll to load,
# the material may not be loaded correctly
# 2. fix multiple definitions of c++ -> python conversion for Spectrum
import sys
import os
import math
from libgotham import *
import inspect
def normalize(x):
... | jaredhoberock/gotham | api/api.py | Python | apache-2.0 | 16,127 | 0.01637 |
import numpy as np
import seekpath
class Band:
def __init__(self,
phonon,
num_qpoints=101):
self._phonon = phonon # Phonopy object
self._num_qpoints = num_qpoints
self._band = []
self._labels = None
self._connected = None
def run(self):... | atztogo/phonondb | phonondb/phonopy/band.py | Python | bsd-3-clause | 7,188 | 0.001113 |
# -*- coding: UTF-8 -*-
from django.core.management.base import BaseCommand
from optparse import make_option
import daemon
import daemon.pidfile
from signal import SIGTSTP, SIGTERM, SIGABRT
import sys, os, subprocess
import time
from jukebox.jukebox_core import api
class Command(BaseCommand):
daemon = None
pr... | lociii/jukebox_mpg123 | jukebox_mpg123/management/commands/jukebox_mpg123.py | Python | mit | 3,441 | 0.001453 |
# -*- coding:utf-8 -*-
from collections import defaultdict
import numpy
class ThompsonAgent:
def __init__(self, seed=None):
self._succeeds = defaultdict(int)
self._fails = defaultdict(int)
self._np_random = numpy.random.RandomState(seed)
def choose(self, arms, features=None):
... | ohtaman/pynm | pynm/reinforce/bandit/thompson.py | Python | mit | 683 | 0.001464 |
# -*- coding: utf-8 -*-
__author__ = "Konstantin Klementiev", "Roman Chernikov"
__date__ = "07 Jan 2016"
PI = 3.1415926535897932384626433832795
PI2 = 6.283185307179586476925286766559
SQRT2PI = PI2**0.5 # =2.5066282746310002
SQ3 = 1.7320508075688772935274463415059
SQ2 = 2**0.5 # =1.4142135623730951
SQPI = PI**0.5 # ... | kklmn/xrt | xrt/backends/raycing/physconsts.py | Python | mit | 1,189 | 0.003364 |
from chimera.core.callback import callback
from chimera.core.exceptions import printException
from chimera.gui.modules.canvas import FITS, FITSCanvas
from chimera.gui.module import ChimeraGUIModule
from chimera.interfaces.camera import CameraStatus
from chimera.util.image import Image
import gtk
import glib
import g... | ankanaan/chimera | src/chimera/gui/modules/camera.py | Python | gpl-2.0 | 11,323 | 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_11_01/models/topology_resource_py3.py | Python | mit | 1,570 | 0.005096 |
"""Tests for the activitylog."""
from datetime import datetime
from nose.tools import eq_
import amo
import amo.tests
from mkt.webapps.models import Webapp
from mkt.users.models import UserProfile
class LogTest(amo.tests.TestCase):
def setUp(self):
u = UserProfile.objects.create(username='foo')
... | ngokevin/zamboni | apps/amo/tests/test_log.py | Python | bsd-3-clause | 976 | 0 |
import poplib
import email
import time
class MailHelper:
def __init__(self, app):
self.app = app
def get_mail(self, username, password, subject):
for i in range (5):
pop = poplib.POP3(self.app.config['james']['host'])
pop.user(username)
pop.pass_(password)... | Droriel/python_training_mantis | fixture/mail.py | Python | apache-2.0 | 858 | 0.004662 |
# Can't be run at the moment until migration with openstack-client
# Copyright (c) 2018 Intel Corporation.
#
# 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.ap... | openstack/neutron-classifier | neutron_classifier/tests/unit/cli/__test_db_classifications.py | Python | apache-2.0 | 2,667 | 0 |
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to ... | hzlf/openbroadcast | website/legacy/obp_legacy/models_legacy.py | Python | gpl-3.0 | 31,942 | 0.005134 |
# Copyright (c) 2018 Charles University, Faculty of Arts,
# Institute of the Czech National Corpus
# Copyright (c) 2018 Tomas Machalek <tomas.machalek@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 publis... | tomachalek/kontext | lib/plugins/default_token_connect/backends/treq.py | Python | gpl-2.0 | 6,004 | 0.002165 |
import sys
from Bio import SeqIO
input_file = sys.argv[1]
output_file = sys.argv[2]
def Ungap(seq):
seq.seq=seq.seq.ungap('-')
return seq
output_gen = (Ungap(seq) for seq in SeqIO.parse(input_file, 'fasta'))
SeqIO.write(output_gen,output_file, 'fasta')
| wonder041/MegaPipeline | Standardize.py | Python | mit | 264 | 0.015152 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-31 14:17
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('exoral', '0004_merge_20170327_0002'),
('exoral', '0003_auto_20170322_1453'),
]
oper... | fachschaft-medizin-rostock/django-fsmedhro | exoral/migrations/0005_merge_20170331_1617.py | Python | mit | 337 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import datetime
from django.utils import timezone
class Migration(migrations.Migration):
dependencies = [
('videos', '0014_add_enabled_and_notes'),
]
operations = [
migrations.Create... | palfrey/kitling | frontend/videos/migrations/0015_add_channel.py | Python | agpl-3.0 | 907 | 0.005513 |
from __future__ import print_function
import shutil
import os.path
import tempfile
import cProfile
import pstats
import nineml
from nineml.utils.comprehensive_example import (
instances_of_all_types, v1_safe_docs)
from nineml.serialization import ext_to_format, format_to_serializer
format_to_ext = dict((v, k) for... | INCF/lib9ML | test/serialization_profile.py | Python | bsd-3-clause | 1,617 | 0.001237 |
# -*- coding: UTF-8 -*-
#!/usr/bin/env python
from __future__ import unicode_literals
# ------------------------------------------------------------------------------
# Name: Proxy checker
# Purpose: Just a couple of functions to check various proxy configuration
#
# Author: Julien Moura (@geojulien)... | Guts/isogeo2sig | StandAlone/modules/proxy_checker.py | Python | gpl-3.0 | 2,322 | 0.004737 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('search', '0003_auto_20150321_1848'),
]
operations = [
migrations.AddField(
model_name='searchquery',
... | IllegalCactus/argument-workbench | querytool/search/migrations/0004_searchquery_scope.py | Python | gpl-3.0 | 437 | 0 |
#!/usr/bin/env python
# Copyright (c) 2015, Robot Control and Pattern Recognition Group,
# Institute of Control and Computation Engineering
# Warsaw University of Technology
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the ... | dseredyn/velma_planners | scripts/tf_pub.py | Python | gpl-2.0 | 2,492 | 0.008026 |
from console.main.command_handler.commands.command import Command
class SimpleCommand(Command):
pass
| lubokkanev/cloud-system | console/main/command_handler/commands/simple_command.py | Python | gpl-2.0 | 107 | 0 |
from models import *
from forms import CategoryImageForm
from django.contrib import admin
class CategoryImageInline(admin.TabularInline):
model = CategoryImage
form = CategoryImageForm
class CategoryOptions(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name',)}
list_display = ['name', 'slug', 'p... | howiworkdaily/scofield-project | scofield/category/admin.py | Python | bsd-3-clause | 898 | 0.010022 |
# Copyright 2016 Isotoma Limited
#
# 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... | yaybu/touchdown | touchdown/config/integer.py | Python | apache-2.0 | 1,092 | 0 |
#!/usr/bin/env python
import unittest
from test_helpers import *
contents = load_input_contents('../gdb_stacktraces/rhbz-803600')
threads_expected = 2
frames_expected = 227
expected_short_text = '''Thread no. 1 (5 frames)
#0 validate_row at gtktreeview.c:5699
#1 validate_visible_area at gtktreeview.c:5898
#2 gtk_t... | airtimemedia/satyr | tests/python/gdb.py | Python | gpl-2.0 | 5,764 | 0.00399 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
def sector_validation(apps, schema_editor):
""" Remove sector from RSR validation set """
ProjectEditorValidation = apps.get_model('rsr', 'ProjectEditorValidation')
sector_validators = ['rsr_sector', 'rsr_sector.sector_code', 'rsr_sector.... | akvo/akvo-rsr | akvo/rsr/migrations/0079_auto_20160620_1418.py | Python | agpl-3.0 | 1,137 | 0.004398 |
import time
import pymemcache.client
import pytest
from limits import RateLimitItemPerMinute, RateLimitItemPerSecond
from limits.storage import MemcachedStorage, storage_from_string
from limits.strategies import (
FixedWindowElasticExpiryRateLimiter,
FixedWindowRateLimiter,
)
from tests.utils import fixed_sta... | alisaifee/limits | tests/storage/test_memcached.py | Python | mit | 3,218 | 0.000622 |
import unittest
from conans.test.utils.tools import TestServer, TestClient
from conans.model.ref import ConanFileReference
import os
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.paths import CONANFILE, CONANFILE_TXT
from conans.util.files import load
generator = """
from conans.model... | birsoyo/conan | conans/test/generators/custom_generator_test.py | Python | mit | 3,848 | 0.001819 |
# Copyright (c) 2017 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | openstack/dragonflow | dragonflow/tests/unit/test_chassis_snat_app.py | Python | apache-2.0 | 3,471 | 0 |
"""
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide a hint that indicates how many digits in said guess match your secret number exactly in both digit and position (called "bulls... | dichen001/Go4Jobs | JackChen/hash/299. Bulls and Cows.py | Python | gpl-3.0 | 1,587 | 0.003781 |
import re
import math as maths
from typing import Iterable, Dict
from base64 import b64encode
from flask import Response, render_template, make_response, current_app
from peewee import SelectQuery
from htmlmin.minify import html_minify
from .models import Entry
PAGE_GROUP_SIZE = 5
ENTRIES_PER_PAGE = 10
class Pagin... | elcr/muhblog | muhblog/utils.py | Python | mit | 3,071 | 0 |
# -*- encoding: utf-8 -*-
from contextlib import contextmanager
from datetime import datetime
import sys
from traceback import format_exception
import colorama
from .conf import settings
def color(color_):
"""Utility for ability to disabling colored output."""
if settings.no_colors:
return ''
els... | redreamality/thefuck | thefuck/logs.py | Python | mit | 3,065 | 0.000327 |
import os
import sys
import gzip
import time
import numpy as np
import pickle as pkl
from scipy.sparse import hstack
from sklearn.metrics import roc_auc_score
from models import MTC
if len(sys.argv) != 7:
print('Usage: python', sys.argv[0],
'WORK_DIR DATASET C P N_SEED TRAIN_DEV(Y/N)')
sys.exit... | cdawei/digbeta | dchen/music/src/PLA_pop.py | Python | gpl-3.0 | 3,102 | 0.000322 |
#!/usr/bin/env python
# Copyright (c) 2016 The aionotify project
# This code is distributed under the two-clause BSD License.
import codecs
import os
import re
import sys
from setuptools import setup
root_dir = os.path.abspath(os.path.dirname(__file__))
def get_version(package_name):
version_re = re.compile(r"... | rbarrois/aionotify | setup.py | Python | bsd-2-clause | 1,579 | 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... | allenlavoie/tensorflow | tensorflow/contrib/quantize/python/quantize_graph_test.py | Python | apache-2.0 | 11,911 | 0.009151 |
''' Present a scatter plot with linked histograms on both axes.
Use the ``bokeh serve`` command to run the example by executing:
bokeh serve selection_histogram.py
at your command prompt. Then navigate to the URL
http://localhost:5006/selection_histogram
in your browser.
'''
import numpy as np
from boke... | justacec/bokeh | examples/app/selection_histogram.py | Python | bsd-3-clause | 3,598 | 0.005281 |
# Copyright (C) 2013 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | swamireddy/python-cinderclient | cinderclient/tests/v2/test_volume_backups.py | Python | apache-2.0 | 2,562 | 0 |
#------------------------------------------------------------------------------
# Copyright (C) 2009 Richard Lincoln
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation; version 2 dated June... | rwl/openpowersystem | cpsm/topology/connectivity_node.py | Python | agpl-3.0 | 2,078 | 0.006256 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2017, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import six
from shuup.apps.provides import get... | suutari-ai/shoop | shuup/admin/module_registry.py | Python | agpl-3.0 | 1,750 | 0.000571 |
#!/usr/bin/env python
# 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.
import unittest
from document_renderer import DocumentRenderer
from server_instance import ServerInstance
from test_file_system import... | chromium2014/src | chrome/common/extensions/docs/server2/document_renderer_test.py | Python | bsd-3-clause | 6,119 | 0.002125 |
"""
dwm package setup
"""
from __future__ import print_function
from setuptools import setup, find_packages
__version__ = '1.1.0'
def readme():
""" open readme for long_description """
try:
with open('README.md') as fle:
return fle.read()
except IOError:
return ''
setup(... | rh-marketingops/dwm | setup.py | Python | gpl-3.0 | 1,421 | 0.001407 |
import os
import logging
from jsub.util import safe_mkdir
from jsub.util import safe_rmdir
class Submit(object):
def __init__(self, manager, task_id, sub_ids=None, dry_run=False, resubmit=False):
self.__manager = manager
self.__task = self.__manager.load_task(task_id)
self.__sub_ids = sub_ids
self.__dry_run ... | jsubpy/jsub | jsub/operation/submit.py | Python | mit | 4,925 | 0.031675 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | rogerthat-platform/rogerthat-backend | src/rogerthat/bizz/profile.py | Python | apache-2.0 | 48,219 | 0.003152 |
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 | 0.020577 |
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: Administrator
#
# Created: 08/10/2011
# Copyright: (c) Administrator 2011
# Licence: <your licence>
#--------------------------------------------------------------------... | hemmerling/codingdojo | src/game_of_life/python_coderetreat_berlin_2014-09/python_legacycrberlin01/gol01.py | Python | apache-2.0 | 685 | 0.013139 |
from edc_base.model_mixins import BaseModel, ListModelMixin
class Cause (ListModelMixin, BaseModel):
class Meta:
ordering = ['display_index']
app_label = 'edc_death_report'
| botswana-harvard/edc-death-report | edc_death_report/models/cause.py | Python | gpl-2.0 | 196 | 0 |
import _plotly_utils.basevalidators
class VsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="vsrc", parent_name="cone", **kwargs):
super(VsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwa... | plotly/python-api | packages/python/plotly/plotly/validators/cone/_vsrc.py | Python | mit | 426 | 0 |
# -*- coding: utf-8 -*-
from eclcli.common import command
from eclcli.common import exceptions
from eclcli.common import utils
from eclcli.identity import common as identity_common
from ..sssclient.common.utils import objectify
class SetAPIKeypair(command.ShowOne):
def get_parser(self, prog_name):
parser... | anythingrandom/eclcli | eclcli/sss/v1/api_keypair.py | Python | apache-2.0 | 878 | 0.006834 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import print_function
'''
Collected utilities for pygame
It is difficult to write pixels directly in python.
There's some way to get a framebuffer bac... | michaelerule/neurotools | graphics/pygame.py | Python | gpl-3.0 | 3,004 | 0.018642 |
#!/usr/bin/python
from body3 import *
function_decl(link='extern',srcp='eval.c:216',
body=bind_expr(
body=statement_list(
E0=decl_expr(
ftype=void_type(algn='8',name='126')),
E1=decl_expr(
ftype=void_type(algn='8',name='126')),
E2=modify_expr(
OP0=var_decl(algn='32',srcp=... | h4ck3rm1k3/gcc_py_introspector | data/body4.py | Python | gpl-2.0 | 6,023 | 0.028889 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Widgets for advanced display of files."""
import json
from django import http
from grr.gui import renderers
from grr.lib import utils
class HexView(renderers.TemplateRenderer):
"""Display a HexView of a file.
Internal State:
- a... | spnow/grr | gui/plugins/fileview_widgets.py | Python | apache-2.0 | 7,084 | 0.005364 |
# Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | rahulunair/nova | nova/scheduler/filters/io_ops_filter.py | Python | apache-2.0 | 2,476 | 0 |
# -*- 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/contrib/operators/test_ecs_operator.py | Python | apache-2.0 | 11,678 | 0.001199 |
#!/usr/bin/env python
import re
import os
import sys
import math
import argparse
def count_deflines(fastafile):
"counts number of sequences are in a fasta file"
fasta_h = open(fastafile, 'rb')
counter = 0
for line in fasta_h:
if re.search('^>', line) is not None:
counter += 1
... | oxpeter/small_fry | blastfaster.py | Python | gpl-2.0 | 3,115 | 0.006742 |
import json
from datetime import datetime
from django.conf import settings
from django.core.paginator import Paginator
import requests
from rest_framework import generics
from rest_framework import views
from rest_framework.pagination import PaginationSerializer
from rest_framework.renderers import BrowsableAPIRender... | rodxavier/open-pse-initiative | django_project/api/views/quotes_views.py | Python | mit | 7,113 | 0.00478 |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from .models import EmailUser as User
from .forms import AdminUserChangeForm, UserCreationForm
@admin.register(User)
class UserAdmin(UserAdmin):
fieldsets = (
(
... | ccwang002/biocloud-server-kai | src/users/admin.py | Python | mit | 1,557 | 0 |
#!/usr/bin/env python
# Abraxas Collaborative Password Utility Documentation
#
# Converts a restructured text version of the manpages to nroff.
# License {{{1
# 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... | KenKundert/abraxas | manpage.py | Python | gpl-3.0 | 83,088 | 0.008425 |
# Copyright (c) 2013-2016 Christian Geier et al.
#
# 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, copy, modify, merge, ... | dzoep/khal | khal/settings/settings.py | Python | mit | 5,410 | 0 |
"""
Python Compression and Archiving Library
@author: Clivern U{hello@clivern.com}
"""
__VERSION__ = "1.0.0" | Clivern/PyArchiver | pyarchiver/__init__.py | Python | mit | 110 | 0.009091 |
# 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... | npuichigo/ttsflow | third_party/tensorflow/tensorflow/compiler/tests/slice_ops_test.py | Python | apache-2.0 | 5,088 | 0.004324 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('imager_profile', '0004_auto_20150802_0153'),
]
operations = [
migrations.RemoveField(
model_name='imagerprofile'... | tpeek/bike_safety | imagersite/imager_profile/migrations/0005_auto_20150802_0303.py | Python | mit | 1,491 | 0.001341 |
import BaseHTTPServer
import logging
import os
import sys
import threading
import time
from chirp.common.conf import (BARIX_STATUS_HOST, BARIX_STATUS_PORT,
BARIX_HOST, BARIX_PORT)
from chirp.stream import barix
_TIMEOUT_S = 2
_POLLING_FREQUENCY_S = 5
_STATUS_PAGE = """<html><head... | chirpradio/chirpradio-machine | chirp/stream/do_proxy_barix_status.py | Python | apache-2.0 | 4,423 | 0.000452 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.