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 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import os
from collections import OrderedDict
from odoo import api, fields, models
from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG
from odoo.exceptions import MissingError
from odoo.htt... | jeremiahyan/odoo | addons/website/models/ir_module_module.py | Python | gpl-3.0 | 19,278 | 0.004305 |
#!/usr/bin/env python2.7
#(c) 2015-2016 by Authors
#This file is a part of Nano-Align program.
#Released under the BSD license (see LICENSE file)
"""
Flips blockades signals according to the protein's AA order
"""
from __future__ import print_function
import sys
import os
nanoalign_root = os.path.dirname(os.path.di... | fenderglass/Nano-Align | scripts/flip-blockades.py | Python | bsd-2-clause | 2,322 | 0.004307 |
import gc
import pandas as pd
import numpy as np
import os
import arboretum
import json
import sklearn.metrics
from sklearn.metrics import f1_score, roc_auc_score
from sklearn.model_selection import train_test_split
from scipy.sparse import dok_matrix, coo_matrix
from sklearn.utils.multiclass import type_of_target
i... | bataeves/kaggle | instacart/imba/arboretum_submition.py | Python | unlicense | 15,544 | 0.005597 |
from django.contrib.auth.forms import PasswordResetForm
from django.shortcuts import redirect
from django.views.generic import CreateView, TemplateView, View, FormView
from django.contrib.auth import authenticate, login
from game.forms import *
from game.models import User, Game
from django.contrib.auth.forms import Au... | codyparker/channels-obstruction | game/views/views.py | Python | mit | 3,489 | 0.002006 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... | CalthorpeAnalytics/urbanfootprint | footprint/client/configuration/scag_dm/base/jurisdiction_boundary.py | Python | gpl-3.0 | 1,720 | 0 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | yarikoptic/fail2ban | fail2ban/server/filtersystemd.py | Python | gpl-2.0 | 8,738 | 0.029068 |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 20 10:52:38 2017
@author: Andrew Ruba
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 ... | andrewruba/YangLab | JPC simulations 2019/Figure 7 - symmetry compression/simulation.py | Python | gpl-3.0 | 13,921 | 0.037354 |
"""Validators to determine the current webserver configuration"""
import logging
import socket
import requests
import zope.interface
from acme import crypto_util
from acme import errors as acme_errors
from letsencrypt import interfaces
logger = logging.getLogger(__name__)
class Validator(object):
# pylint: dis... | rutsky/letsencrypt | letsencrypt/validator.py | Python | apache-2.0 | 2,825 | 0.000354 |
class Graph():
pointSet = []
# it should be a dict on {point:[list of point it connects]}
pathDic = dict()
pointTime = dict() # points' discover time and finish time
def __init__(self, points, paths):
if set(paths.keys()) - set(points):
print(
"Warning: Some poi... | ccqpein/Arithmetic-Exercises | Depth-First-Search/DFS.py | Python | apache-2.0 | 3,928 | 0.000255 |
#!/bin/python
import datetime
class message():
def __init__(self, msg_id=0, channel_id=0, source_id=0, source_chat_id='',\
msg=''):
curr_datetime = datetime.datetime.now()
self.date = curr_datetime.strftime("%Y%m%d")
self.time = curr_datetime.strftime("%H:%M:%S.%f %z")
... | gavincyi/Telex | src/message.py | Python | apache-2.0 | 2,393 | 0.008776 |
# -*- coding: utf-8 -*-
import random
import mock
from datetime import datetime
from nose.tools import * # flake8: noqa
from rest_framework import exceptions
from api.base.exceptions import Conflict
from api.base.settings.defaults import API_BASE
from api.nodes.serializers import NodeContributorsCreateSerializer
... | Nesiehr/osf.io | api_tests/nodes/views/test_node_contributors_list.py | Python | apache-2.0 | 95,975 | 0.003813 |
"""Support for XS1 switches."""
import logging
from homeassistant.helpers.entity import ToggleEntity
from . import ACTUATORS, DOMAIN as COMPONENT_DOMAIN, XS1DeviceEntity
_LOGGER = logging.getLogger(__name__)
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
"""Set ... | jnewland/home-assistant | homeassistant/components/xs1/switch.py | Python | apache-2.0 | 1,288 | 0 |
import unittest
from application.caches.local_cache import LocalCache
class LocalCacheTest(unittest.TestCase):
def setUp(self):
self.cache = LocalCache()
def tearDown(self):
pass
def test_add_element(self):
self.cache.add("test.key", "test.value")
self.assertEqual(self.cache.get("test.key"), "test.value... | andrew749/andrew749.github.io | application/caches/test/test_local_cache.py | Python | apache-2.0 | 367 | 0.029973 |
#!/usr/bin/env python3
'''Khronos OpenVG parent image binding for EGL.
http://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_vg_parent_image.txt
'''
# Copyright © 2012-13 Tim Pederick.
#
# This file is part of Pegl.
#
# Pegl is free software: you can redistribute it and/or modify it
# under the terms of the GNU... | perey/pegl | src/pegl/ext/khr_vgimage.py | Python | gpl-3.0 | 983 | 0 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from sphinx_celery import conf
globals().update(conf.build_config(
'kombu', __file__,
project='Kombu',
version_dev='4.3',
version_stable='4.2',
canonical_url='http://docs.kombu.me',
webdomain='kombu.me',
githu... | pexip/os-kombu | docs/conf.py | Python | bsd-3-clause | 924 | 0 |
from graph.graph_server import GraphServer
__all__ = ['GraphServer']
| AndreasMadsen/bachelor-code | visualizer/__init__.py | Python | mit | 71 | 0 |
# Time-stamp: <2019-09-25 10:04:48 taoliu>
"""Description: Fine-tuning script to call broad peaks from a single
bedGraph track for scores.
This code is free software; you can redistribute it and/or modify it
under the terms of the BSD License (see the file LICENSE included with
the distribution).
"""
# ------------... | taoliu/MACS | MACS2/bdgbroadcall_cmd.py | Python | bsd-3-clause | 2,141 | 0.01121 |
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import lib.images_rc
import sys
class QImportWiz(QDialog):
#
# private
#
def _getCheckableList(self, sheets):
"""return an instance model with a sheet list composed of
three columns (sheet, number of rows, number of columns)
... | csvtools/csvtools | src/widgets/importwiz.py | Python | gpl-3.0 | 3,525 | 0.003972 |
import collections
import json
import re
from dcos import util
from dcos.errors import DCOSException
logger = util.get_logger(__name__)
def parse_json_item(json_item, schema):
"""Parse the json item based on a schema.
:param json_item: A JSON item in the form 'key=value'
:type json_item: str
:param... | genome21/dcos-cli | dcos/jsonitem.py | Python | apache-2.0 | 7,404 | 0.00027 |
#!/usr/bin/env python3
# Copyright 2017-2018 Clayton Smith
#
# This file is part of bbhn-utils
#
# bbhn-utils 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, or (at your option)
# any later ... | argilo/bbhn-utils | nodeinfo.py | Python | gpl-3.0 | 1,671 | 0.000598 |
name1_1_1_0_0_1_0 = None
name1_1_1_0_0_1_1 = None
name1_1_1_0_0_1_2 = None
name1_1_1_0_0_1_3 = None
name1_1_1_0_0_1_4 = None | asedunov/intellij-community | python/testData/completion/heavyStarPropagation/lib/_pkg1/_pkg1_1/_pkg1_1_1/_pkg1_1_1_0/_pkg1_1_1_0_0/_mod1_1_1_0_0_1.py | Python | apache-2.0 | 128 | 0.007813 |
# -*- coding: utf-8 -*-
#
# Insekta documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 24 16:48:19 2011.
#
# 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.
#
# All... | teythoon/Insekta | docs/conf.py | Python | mit | 7,761 | 0.007473 |
# Copyright (c) 2014 Adafruit Industries
# Author: Tony DiCola
#
# 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, m... | RoboPi-CSEDU/rupai | Adafruit_Python_SSD1306/examples/shapes.py | Python | mit | 4,281 | 0.002569 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
##Copyright (c) 2017 Benoit Valot and Panisa Treepong
##benoit.valot@univ-fcomte.fr
##UMR 6249 Chrono-Environnement, Besançon, France
##Licence GPL
from . import variables
class ClipRead():
"""Clip read object"""
def __init__(self, alignedsegment):
self.read_... | bvalot/panISa | lib/clipread.py | Python | gpl-3.0 | 2,634 | 0.007976 |
"""
mode_calcs.py is a subroutine of EMUstack that contains methods to
calculate the modes of a given layer, either analytically
(class 'Anallo') or from the FEM routine (class 'Simmo').
Copyright (C) 2013 Bjorn Sturmberg, Kokou Dossou, Felix Lawrence
EMUstack is free software: you can r... | frownless/EMUstack | backend/mode_calcs.py | Python | gpl-3.0 | 13,371 | 0.004712 |
from django.contrib.auth import authenticate, login
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.core import serializers
from django.core.paginator import Paginator, EmptyPage
from django.core.serializers.json import DjangoJSONEncoder
from django.http.... | moteloquito/final-project | final/apps/fondo/views.py | Python | gpl-3.0 | 5,222 | 0.003255 |
# -*- coding: utf8 -*-
from django.conf import settings
from django.contrib import auth
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.views.decora... | Wang-Sen/nqzx-backend | bootcamp/app/views.py | Python | gpl-3.0 | 11,441 | 0.007145 |
#
# Copyright 2008-2019 Red Hat, Inc.
#
# 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.
#
# This program is distributed ... | oVirt/vdsm | lib/vdsm/host/__init__.py | Python | gpl-2.0 | 2,088 | 0.000479 |
import unittest
class TestExample(unittest.TestCase):
def test_example(self):
self.assertEquals(0, 0)
| ryanpdwyer/newtex | newtex/tests/test_git.py | Python | mit | 116 | 0 |
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | lemoncoin/lemoncoin | contrib/spendfrom/spendfrom.py | Python | mit | 10,043 | 0.005775 |
from sympy import (
Abs, And, Derivative, Dummy, Eq, Float, Function, Gt, I, Integral,
LambertW, Lt, Matrix, Or, Piecewise, Poly, Q, Rational, S, Symbol,
Wild, acos, asin, atan, atanh, cos, cosh, diff, erf, erfinv, erfc,
erfcinv, erf2, erf2inv, exp, expand, im, log, pi, re, sec, sin,
sinh, solve, so... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/solvers/tests/test_solvers.py | Python | mit | 58,517 | 0.002956 |
from validate_app import validateApp
import os
from distutils import spawn
import sys
from parse_files import parseOutHTseq, bringTogether
from bashSub import bashSub
def checkPreprocessApplications():
applications = ["spades.py"]
source = ["http://bioinf.spbau.ru/spades"]
i = 0;
for app in applicatio... | msettles/expHTS | expHTS/spadesCMD.py | Python | apache-2.0 | 3,121 | 0.006729 |
"""
Django settings for CL_Project project.
Generated by 'django-admin startproject' using Django 1.9.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os... | pmakahmann/CL_Project | CL_Project/settings.py | Python | mit | 3,282 | 0.001219 |
# coding: utf-8
from __future__ import unicode_literals
import re
from hashlib import sha1
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
determine_ext,
float_or_none,
int_or_none,
unified_strdate,
)
class ProSiebenSat1BaseIE(InfoExtractor... | jbuchbinder/youtube-dl | youtube_dl/extractor/prosiebensat1.py | Python | unlicense | 17,378 | 0.002303 |
# -*- coding: utf-8 -*-
"""
@title: El Coladero
@description: Aplicación web para detectar y corregir vulnerabilidades
@author: Enrique Martín Martín
@email: emartinm@ucm.es
"""
from bottle import run, template, get, post, request
import sqlite3
@get('/show_all_questions')
def show_all_questions():
conn = sqlite... | ferreiro/Python-NoSQL-Security | assignment6/El_Coladero/coladero.py | Python | mit | 2,952 | 0.006108 |
'''
Created on Sep 27, 2013
@author: leal
Default JSON MESSAGES
'''
import ast
import logging
import config.config
logger = logging.getLogger(__name__)
class Messages(object):
'''
classdocs
'''
messageTemplate = """{
'success' : '%r',
'message' : '%s',
'details' : %r
... | ricleal/reductionServer | src/data/messages.py | Python | gpl-3.0 | 1,661 | 0.022878 |
import numpy as np
from sklearn.base import BaseEstimator
import pandas as pd
import operator
from estimator_base import *
from features_base import *
BINARY = "Binary"
CATEGORICAL = "Categorical"
NUMERICAL = "Numerical"
class FeatureMapper:
def __init__(self, features):
self.features = features
... | waynezhanghk/FastCausation | features.py | Python | apache-2.0 | 23,932 | 0.013497 |
#!/usr/bin/env python
# encoding: utf-8
"""
Author(s): Matthew Loper
See LICENCE.txt for licensing and contact information.
"""
import sys
import os
import unittest
import chumpy as ch
from chumpy import Ch
import numpy as np
from util_tests import get_earthmesh
class TestGeometry(unittest.TestCase):
def setUp(... | dimatura/opendr | test_geometry.py | Python | mit | 1,656 | 0.008454 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Onset detection
===============
.. autosummary::
:toctree: generated/
onset_detect
onset_backtrack
onset_strength
onset_strength_multi
"""
import numpy as np
import scipy
from ._cache import cache
from . import core
from . import util
from .util.e... | bmcfee/librosa | librosa/onset.py | Python | isc | 19,286 | 0.001141 |
import hashlib
import os
from database import Database
from email import send_welcome_email
from flask.ext.login import UserMixin
def get_hash(data):
hash = hashlib.sha256()
hash.update(os.environ['PASSWORD_TOKEN_SALT'])
hash.update(data)
return hash.hexdigest()
class User(UserMixin):
def __init__... | bschoenfeld/va-court-scraper | courtutils/user.py | Python | mit | 990 | 0.00303 |
# Ant
#
# Copyright (c) 2012, Gustav Tiger <gustav@tiger.name>
#
# 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, m... | ddboline/Garmin-Forerunner-610-Extractor_fork | ant/base/ant.py | Python | mit | 12,100 | 0.003884 |
# useMissiles
#
# Used by:
# Modules from group: Missile Launcher Heavy (12 of 12)
# Modules from group: Missile Launcher Rocket (15 of 15)
# Modules named like: Launcher (154 of 154)
# Structure Modules named like: Standup Launcher (7 of 7)
type = 'active', "projected"
def handler(fit, src, context):
# Set reloa... | bsmr-eve/Pyfa | eos/effects/usemissiles.py | Python | gpl-3.0 | 1,203 | 0.002494 |
"""
Django settings for channel_worm project.
Generated by 'django-admin startproject' using Django 1.8.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build... | joebowen/ChannelWormDjango | ChannelWorm/channelworm/settings.py | Python | mit | 3,520 | 0 |
# -*- coding: utf-8 -*-
class TrafficEntry:
def __init__(self, broadcast_count=0L, broadcast_bytes=0L, unicast_count=0L, unicast_bytes=0L):
self.broadcast_count = broadcast_count
self.broadcast_bytes = broadcast_bytes
self.unicast_count = unicast_count
self.unicast_bytes = ... | relman/sevpn-mgmt-py | SevpnMgmtPy/admin_api/traffic.py | Python | mit | 1,143 | 0.000875 |
# coding=utf-8
"""**Tests for safe raster layer class**
contains tests for QGIS specific methods.
See test_io.py also
"""
__author__ = 'Dmitry Kolesov <kolesov.dm@gmail.com>'
__revision__ = '$Format:%H$'
__date__ = '28/12/2013'
__license__ = "GPL"
__copyright__ = 'Copyright 2012, Australia Indonesia Facility f... | dynaryu/inasafe | safe/storage/test/test_raster.py | Python | gpl-3.0 | 2,520 | 0.002778 |
#!/usr/bin/python3
#
# This file is part of Progesterone pipeline.
#
# Progesterone pipeline 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 v... | ivanamihalek/progesterone | 16_UCSC_sources_to_ENCODE.py | Python | gpl-2.0 | 3,087 | 0.024619 |
from django.shortcuts import render
from django.contrib.auth.models import User
from django.utils.text import slugify
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.p... | skeuomorf/Binge | binge/core/views.py | Python | mit | 1,811 | 0.002209 |
from flask.ext.wtf import Form
from flask.ext.wtf.html5 import EmailField
from wtforms.validators import Required
from wtforms.fields import (
TextAreaField,
HiddenField
)
class LoginForm(Form):
email = EmailField('Email address', validators=[Required()])
next = HiddenField('next')
class FeedbackF... | crossgovernmentservices/csdigital-prototype | application/frontend/forms.py | Python | mit | 402 | 0 |
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, Inc.
#
# 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
# w... | nanocell/lsync | python/boto/route53/connection.py | Python | gpl-3.0 | 13,538 | 0.000222 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: IBM Model 2
#
# Copyright (C) 2001-2013 NLTK Project
# Authors: Chin Yee Lee, Hengfeng Li, Ruxin Hou, Calvin Tanujaya Lim
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Lexical translation model that considers word order.
IBM Model 2 improv... | sdoran35/hate-to-hugs | venv/lib/python3.6/site-packages/nltk/translate/ibm2.py | Python | mit | 12,271 | 0.000815 |
def index_power(array, n):
if n>=len(array):
return -1
else:
return array[n]**n
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert index_power([1, 2, 3, 4], 2) == 9, "Square"
assert index_power([1, 3, 10, 100], 3) == 1... | nesterione/problem-solving-and-algorithms | problems/Empireofcode/IndexPower.py | Python | apache-2.0 | 441 | 0.018141 |
# Copyright (C) 2001-2005 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | liyongyue/dnsspider | dns/opcode.py | Python | isc | 2,603 | 0.005763 |
import unittest
import lexer
import parser
from tree import *
from tree import _TreeBuilder
class BuilderTest(unittest.TestCase):
''' Test of the _TreeBuilder (and Leaf and Tree) class. '''
def testTreeBuilding(self):
''' Test that the tree builder constructs trees correctly when
parsed. ... | ptdtan/Ragout | lib/newick/treetest.py | Python | gpl-3.0 | 4,858 | 0.009881 |
from rx import Observable
from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable
from rx.disposables import Disposable, SerialDisposable
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed = Reactiv... | Reactive-Extensions/RxPy | tests/test_observable_creation.py | Python | apache-2.0 | 34,022 | 0.006937 |
from .ownership import * # noqa
from .powerdns import * # noqa
from .requests import * # noqa
from .templates import * # noqa
from .tsigkeys import * # noqa
| allegro/django-powerdns-dnssec | powerdns/models/__init__.py | Python | bsd-2-clause | 162 | 0 |
import paddle.v2 as paddle
__all__ = ['googlenet']
def inception(name, input, channels, filter1, filter3R, filter3, filter5R,
filter5, proj):
cov1 = paddle.layer.img_conv(
name=name + '_1',
input=input,
filter_size=1,
num_channels=channels,
num_filters=filter... | kuke/models | legacy/image_classification/googlenet.py | Python | apache-2.0 | 5,341 | 0 |
# Copyright 2015 OpenStack Foundation.
#
# 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... | projectcalico/calico-neutron | neutron/agent/metadata/config.py | Python | apache-2.0 | 3,403 | 0 |
"""Add TagAlias table
Revision ID: 9a0f78ff57d6
Revises: d19881f4c045
Create Date: 2017-03-19 15:34:30.271997
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9a0f78ff57d6'
down_revision = 'd19881f4c045'
branch_labels = None
depends_on = None
def upgrade():
... | MJB47/Jokusoramame | migrations/versions/9a0f78ff57d6_add_tagalias_table.py | Python | mit | 1,126 | 0.008881 |
from django.shortcuts import render
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout, update_session_auth_hash
from django.core.exceptions import ObjectDoesNotExist
from django.core.cache import cache
from django.http im... | Matoking/pastebin-django | users/views.py | Python | unlicense | 14,332 | 0.012071 |
# Imports
from django.conf.urls import url
from .models import OurFoto
from .views import HomeFoto, ShowFoto, DeleteFoto, AddFoto, \
EditFoto, SearchFoto
# Urls for app
urlpatterns = [
url(r'^$', HomeFoto.as_view(model = OurFoto), name = 'index'),
url(r'^foto/(?P<pk>\d+)/$', ShowFoto.as_view(model = OurF... | Sergey19940808/OurFoto | repository_our_fotos/urls.py | Python | mit | 671 | 0.034277 |
from django.template import Library
from django.conf import settings
if "django.contrib.sites" in settings.INSTALLED_APPS:
from django.contrib.sites.models import Site
current_domain = lambda: Site.objects.get_current().domain
elif getattr(settings, "SITE_DOMAIN", None):
current_domain = lambda: settings.... | Rootbuzz/Django-Socialtags | socialtags/templatetags/social_tags.py | Python | mit | 1,400 | 0.007143 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from userena.models import UserenaBaseProfile
from caching.base import CachingManager, CachingMixin
from apps.utils.db import retrieve_i... | dvalcarce/filmyou-web | src/apps/films/models.py | Python | apache-2.0 | 9,791 | 0.000511 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from ._common import unittest
from datetime import datetime, timedelta, date
from dateutil.tz import tzoffset
from dateutil.parser import *
import six
from six import assertRaisesRegex, PY3
from six.moves import StringIO
class ParserTest(unittest.TestC... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/dateutil/test/test_parser.py | Python | gpl-3.0 | 31,922 | 0.000377 |
import json
from flask import session
from flask import url_for, redirect, request
from rauth import OAuth1Service, OAuth2Service
from meetneat.config import OAUTH_CREDENTIALS
class OAuthSignIn(object):
providers = None
def __init__(self, provider_name):
self.provider_name = provider_name
c... | anthonyabeo/MeetNEat | api/oauth.py | Python | unlicense | 3,846 | 0.00026 |
from abc import ABCMeta,abstractmethod
from my_hue import *
# Would dynamically choose a trigger based on trigger type
def trigger_factory(trigger_type):
return None
class Trigger(object):
__metaclass__ = ABCMeta
def __init__(self):
self.action()
@abstractmethod
def action(self):
... | Caveat4U/home_automation | trigger.py | Python | gpl-2.0 | 793 | 0.011349 |
#!/usr/bin/env python
__author__ = 'mehdi tlili'
import rospy
from tf2_msgs.msg import TFMessage
import tf
class Remapper(object):
def __init__(self):
self.br = tf.TransformBroadcaster()
rospy.Subscriber("/tf", TFMessage, self.tf_remapper)
def tf_remapper(self, msg):
if msg.transform... | LCAS/teaching | turtlebot_simulator/turtlebot_stdr/nodes/tf_connector.py | Python | mit | 741 | 0.002699 |
import os
import sys
import mock
import logging
import unittest
from inaugurator.server import idlistener
from inaugurator.tests.common import PikaChannelMock
class Test(unittest.TestCase):
def setUp(self):
self.consumeCallback = mock.Mock()
self.channel = PikaChannelMock(self)
self.expect... | Stratoscale/inaugurator | inaugurator/tests/test_idlistener.py | Python | apache-2.0 | 5,274 | 0.000948 |
""" Copyright 2015 Kris Steinhoff, The University of Michigan
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... | box-community/box-weekly-stats | add_shared_to_group.py | Python | apache-2.0 | 3,242 | 0.005861 |
# Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from .images import (
ImageClassificationModelJob,
GenericImageModelJob,
ImageModelJob,
)
from .job import ModelJob
__all__ = [
'ImageClassificationModelJob',
'GenericImageModelJob',
'Im... | winnerineast/Origae-6 | origae/model/__init__.py | Python | gpl-3.0 | 352 | 0 |
#coding=utf-8
import codecs
import logging
import numpy as np
import os
from collections import defaultdict
# define a logger
logging.basicConfig(format="%(message)s", level=logging.INFO)
def load_embedding(filename, embedding_size):
"""
load embedding
"""
embeddings = []
word2idx = defaultdict(... | gallupliu/QA | preprocess/data_helper.py | Python | apache-2.0 | 4,978 | 0.004219 |
import os
from setuptools import (
find_packages,
setup,
)
from setuptools.command.test import test
PACKAGE_DIR = 'src'
class PyTest(test):
def finalize_options(self):
test.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
import ... | disqus/psycopg2-managed-connection | setup.py | Python | apache-2.0 | 971 | 0.00309 |
"""
@package ssw_wrap
@brief Simple python wrapper for SSW align library
To use the dynamic library libssw.so you may need to modify the LD_LIBRARY_PATH environment
variable to include the library directory (export LD_LIBRARY_PATH=$PWD) or for definitive
inclusion of the lib edit /etc/ld.so.conf and add the path or the... | svviz/svviz | src/ssw/ssw_wrap.py | Python | mit | 15,367 | 0.00898 |
# -*- coding: utf-8 -*-
# Copyright 2015 Metaswitch Networks
#
# 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... | TrimBiggs/calico | calico/etcddriver/driver.py | Python | apache-2.0 | 43,284 | 0.000046 |
# -*- coding: utf-8 -*-
##################################################################
# Example of usage:
##################################################################
from __future__ import print_function, division, absolute_import
import sys
import time
import inspect
from numbers import Number
from dateti... | imito/odin | odin/utils/progbar.py | Python | mit | 17,930 | 0.010095 |
input = """
% Guess colours.
chosenColour(N,C) | notChosenColour(N,C) :- node(N), colour(C).
% At least one color per node.
:- #count{ C : chosenColour(X,C) } > 1, node(X).
:- #count{ C : chosenColour(X,C) } < 1, node(X).
% No two adjacent nodes have the same colour.
:- link(X,Y), X<Y, chosenColour(X,C), ch... | Yarrick13/hwasp | tests/wasp1/AllAnswerSets/3col_aggregates_1_5_enc2.test.py | Python | apache-2.0 | 14,386 | 0.001738 |
#!/usr/bin/env python3
import fcntl
import logging
import os
import shlex
import subprocess
import threading
from barython.hooks import HooksPool
from barython.tools import splitted_sleep
logger = logging.getLogger("barython")
def protect_handler(handler):
def handler_wrapper(self, *args, **kwargs):
tr... | Anthony25/barython | barython/widgets/base.py | Python | bsd-3-clause | 10,749 | 0.000558 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
from dateutil.relativedelta import relativedelta
from datetime import datetime, date
import click
from werkzeug.security import generate_password_hash
import newspipe.models
from newspipe.bootstrap import application, db
from newspipe.controller... | JARR-aggregator/JARR | newspipe/commands.py | Python | agpl-3.0 | 5,322 | 0.002067 |
""" ------------------------------
bior2_6
cwt
by BEAR, 05/04/14
------------------------------ """
import scipy as sp
import numpy as np
from scipy.signal import convolve
#import pywt
_scale_max = 1024
_scale_max = int(2**(sp.ceil(sp.log2(_scale_max))))
tmp = np.loadtxt('bior2.6_1024.txt')
_x_bior2_6 = tmp[:,0]
... | bearicc/python-wavelet-transform | mycwt.py | Python | agpl-3.0 | 1,948 | 0.010267 |
from . import orderpoint_generator
| Vauxoo/stock-logistics-warehouse | stock_orderpoint_generator/wizard/__init__.py | Python | agpl-3.0 | 35 | 0 |
# coding: utf-8
#
# Copyright © 2010—2014 Andrey Mikhaylenko and contributors
#
# This file is part of Argh.
#
# Argh is free software under terms of the GNU Lesser
# General Public License version 3 (LGPLv3) as published by the Free
# Software Foundation. See the file README.rst for copying conditions.
#
"""
Inte... | eschleicher/flask_shopping_list | venv/lib/python3.4/site-packages/argh/interaction.py | Python | mit | 2,403 | 0.00125 |
def catch_all(data):
print(data)
| PythonSanSebastian/python-rtmbot | plugins/ep_volunteer/catch_all.py | Python | mit | 38 | 0 |
from django.conf.urls.defaults import *
from wishlist.models import Item
from wishlist.views import add_item, delete_item, wishlist, bookmarklet
urlpatterns = patterns('',
(r'^add/$', add_item),
(r'^(?P<id>\d+)/delete/$', delete_item),
url(r'^tag/(?P<querytag>[^/]+)/$', view=wishlist, name="items_by_tag"),... | pigmonkey/django-wishlist | wishlist/urls.py | Python | bsd-3-clause | 443 | 0.002257 |
# Copyright 2015 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/LICENSE-2... | bacaldwell/ironic | ironic/tests/unit/drivers/modules/ilo/test_vendor.py | Python | apache-2.0 | 9,258 | 0 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
# Examples:
# url(r'^$', 'chatter.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'', include('chatter.base.urls')),
url(r'^admin/', include(admin.site.urls)... | scott-w/pyne-django-tutorial | chatter/chatter/urls.py | Python | mit | 1,113 | 0 |
# -*- coding: utf-8 -*-
"""Base module for unittesting."""
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.app.testing import IntegrationTesting
from plone.app.testing import login
from plone.app.testing import PLONE_FIXTURE
from plone.app.testing import PloneSandb... | a25kk/newe | src/newe.sitecontent/newe/sitecontent/testing.py | Python | mit | 1,963 | 0 |
from flask import current_app, redirect, url_for, request, session, flash, send_file
from flask.ext import restful
from flask.ext.login import login_required, current_user, login_user, logout_user
import twitter
from request_parsers import *
from datetime import datetime
from models import *
from rauth.service import O... | airwoot/timeline-hack-core | app/resources.py | Python | mit | 7,302 | 0.015338 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-19 15:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import hindustani.models
class Migration(migrations.Migration):
initial = True
dependencies = [
('data', '0001_in... | MTG/dunya | hindustani/migrations/0001_initial.py | Python | agpl-3.0 | 25,073 | 0.004706 |
from unittest import TestCase
from mock import patch
from regulations.generator.layers.paragraph_markers import *
class ParagraphMarkersLayerTest(TestCase):
@patch('regulations.generator.layers.paragraph_markers.loader')
def test_apply_layer(self, loader):
pml = ParagraphMarkersLayer({
'... | ascott1/regulations-site | regulations/tests/layers_paragraph_markers_tests.py | Python | cc0-1.0 | 1,212 | 0.00165 |
# -*- coding: utf-8 -*-
import re
from module.plugins.internal.Crypter import Crypter
class LetitbitNetFolder(Crypter):
__name__ = "LetitbitNet"
__type__ = "crypter"
__version__ = "0.16"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?letitbit\.net/folder/\w+'
__config__ = [... | Guidobelix/pyload | module/plugins/crypter/LetitbitNetFolder.py | Python | gpl-3.0 | 1,221 | 0.015561 |
# service.py is part of Panopticon.
# Panopticon 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.
# Panopticon is distributed in the h... | llou/panopticon | panopticon/core/actions/service.py | Python | gpl-3.0 | 3,447 | 0.004062 |
import argparse
import sys
import logging
import os
import csv
class ReadItem:
def __init__(self, sequence, totalCount):
self.Sequence = sequence
self.TotalCount = totalCount
self.SampleMap = {}
class AnnotationItem:
def __init__(self, sequence, totalCount, category, counts):
self.Sequence = seque... | shengqh/ngsperl | lib/SmallRNA/updateShortReadParentCount.py | Python | apache-2.0 | 7,328 | 0.019378 |
default_app_config = 'providers.edu.iowaresearch.apps.AppConfig'
"""
Example Record
<record>
<header>
<identifier>oai:ir.uiowa.edu:iwp_archive-1227</identifier>
<datestamp>2016-07-05T19:23:14Z</datestamp>
<setSpec>publication:iwp</setSpec>
<setSpec>publication:grad</setSpec>
... | zamattiac/SHARE | providers/edu/iowaresearch/__init__.py | Python | apache-2.0 | 1,863 | 0.000537 |
# -*- coding: utf-8 -*-
"""Version information."""
"""
Kontalk XMPP server
Copyright (C) 2014 Kontalk Devteam <devteam@kontalk.org>
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 versi... | daniele-athome/kontalk-legacy-xmppserver | kontalk/xmppserver/version.py | Python | gpl-3.0 | 967 | 0 |
#!/usr/bin/env python
__author__ = 'greghines'
import numpy as np
import os
import pymongo
import sys
import cPickle as pickle
import bisect
import random
import csv
import matplotlib.pyplot as plt
if os.path.exists("/home/ggdhines"):
base_directory = "/home/ggdhines"
else:
base_directory = "/home/greg"
def i... | camallen/aggregation | experimental/condor/presentation/condor_IBCC.py | Python | apache-2.0 | 9,662 | 0.00859 |
# -*- coding: utf-8 -*-
from exceptions import DropPage, AbortProcess
| sunlightlabs/wikipedia-dump-tools | wikitools/__init__.py | Python | gpl-3.0 | 71 | 0 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
## Copyright (C) 2012-2014 Uwe Hermann <uwe@hermann-uwe.de>
## Copyright (C) 2019 DreamSourceLab <support@dreamsourcelab.com>
##
## This program is free software; you can redistribute it and/or mo... | DreamSourceLab/DSView | libsigrokdecode4DSL/decoders/1-spi/pd.py | Python | gpl-3.0 | 13,821 | 0.002532 |
import copy
from pdcglobal import *
from .effect import Effect
import dungeon
class FloatingEyeGazeEffect(Effect):
def __init__(self, host, owner):
dur = d(10)
Effect.__init__(self, dur, host, owner)
weaponinfotext = 'Stuns the enemy'
def tick(self):
self.host.timer += ... | cycladesnz/chambersAndCreatures | src/effects/dv_effects.py | Python | gpl-2.0 | 3,581 | 0.006981 |
import re
import os.path
from operator import or_
from functools import reduce
from datetime import date
import logging
import urllib.parse
from django.conf import settings
from django.urls import reverse
from django.db.models.functions import ExtractYear
from django.db.models import Sum, Count
from django.template.lo... | dchaplinsky/declarations.com.ua | declarations_site/catalog/elastic_models.py | Python | mit | 66,029 | 0.001889 |
# -*- coding: utf-8 -*-
#
## This file is part of Invenio.
## Copyright (C) 2011, 2012 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
## License, or (at your opti... | lnielsen/invenio | invenio/modules/messages/models.py | Python | gpl-2.0 | 8,905 | 0.007748 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | oliverhr/odoo | addons/stock/stock.py | Python | agpl-3.0 | 269,349 | 0.005732 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.