code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python2.7
"""
Copyright 2018 Couchbase, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agree... | daverigby/kv_engine | scripts/cbnt_perfsuite_strip_results.py | Python | bsd-3-clause | 2,943 |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | lakshmi-kannan/st2 | contrib/runners/http_runner/http_runner.py | Python | apache-2.0 | 9,707 |
# coding: utf-8
import hashlib
from werkzeug.security import generate_password_hash, check_password_hash
from flask.ext.login import UserMixin, AnonymousUserMixin
from . import login_manager, db
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app, request
from datetime i... | wangxuan007/flasky | app/models.py | Python | gpl-3.0 | 6,772 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2021 Tobias Gruetzmacher
import re
import pytest
import responses
import dosagelib.cmd
import httpmocks
from dosagelib.plugins.s import SoloLeveling
from dosagelib.scraper import GeoblockedException
def cmd(*options):
"""'Fake' run dosage with given options.""... | webcomics/dosage | tests/test_modules.py | Python | mit | 1,726 |
from .conf import settings
def load_media_defaults():
media = []
defaults = {}
for key, backend in settings.PINAX_NOTIFICATIONS_BACKENDS.items():
# key is a tuple (medium_id, backend_label)
media.append(key)
defaults[key[0]] = backend.spam_sensitivity
return media, defaults
| pinax/pinax-notifications | pinax/notifications/utils.py | Python | mit | 317 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'Company.image_url'
db.delete_column(u'techpong_company', 'image_url')
# Adding fi... | collingreen/startuppong | techpong/apps/techpong/migrations/0005_auto__del_field_company_image_url__add_field_company_banner_url__add_f.py | Python | mit | 8,058 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'', include('users.urls', namespace='users')),
url(r'', include('website.urls', namespace='website')),
url(r'', include('manager.urls', namespace='manager')),
u... | irin4eto/Bar-Management | base_files/urls.py | Python | gpl-3.0 | 488 |
# -*- coding: utf-8 -*-
# © 2016 ClearCorp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.report import report_sxw
from openerp import models
class PayrollReportByPeriodsEmployee(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(PayrollReportByPe... | ClearCorp/odoo-costa-rica | l10n_cr_hr_payroll/report/report_payroll_periods_employee.py | Python | agpl-3.0 | 5,925 |
#!/usr/bin/env python
#
# Copyright (c) 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.
"""Command line tool for continuously printing Android graphics surface
statistics on the console.
"""
import collections
import... | patrickm/chromium.src | build/android/surface_stats.py | Python | bsd-3-clause | 3,691 |
#!/usr/bin/env python
import os
import shutil
import glob
import time
import sys
import subprocess
import string
from optparse import OptionParser, make_option
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
PKG_NAME = os.path.basename(SCRIPT_DIR)
PARAMETERS = None
XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=u... | xiaojunwu/crosswalk-test-suite | wrt/wrt-uxmanu-android-tests/inst.xpk.py | Python | bsd-3-clause | 5,919 |
#!/usr/bin/env python
''' Copyright (c) 2013 Potential Ventures Ltd
Copyright (c) 2013 SolarFlare Communications Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code ... | stuarthodgson/cocotb | cocotb/generators/packet.py | Python | bsd-3-clause | 2,962 |
from autopush.tests import setUp, tearDown
def pytest_configure(config):
"""Called before testing begins"""
setUp()
def pytest_unconfigure(config):
"""Called after all tests run and warnings displayed"""
tearDown()
| mozilla-services/autopush | autopush/tests/conftest.py | Python | mpl-2.0 | 235 |
from pathlib import PurePath
from uuid import uuid4
import iso8601
import os
from crispy_forms.layout import Submit, Row
from django import forms
from django.conf import settings
from django.core.files import File
from django.core.files.storage import default_storage
from django.db import IntegrityError
from django.fo... | lafranceinsoumise/api-django | agir/lib/form_mixins.py | Python | agpl-3.0 | 11,028 |
import numpy as np
import ctypes
import struct
import time
# relative imports in Python3 must be explicit
from .ioctl_numbers import _IOR, _IOW
from fcntl import ioctl
SPI_IOC_MAGIC = ord("k")
SPI_IOC_RD_MODE = _IOR(SPI_IOC_MAGIC, 1, "=B")
SPI_IOC_WR_MODE = _IOW(SPI_IOC_MAGIC, 1, "=B")
SPI_IOC_... | varunsuresh2912/SafeRanger | Python PiCode/Lepton.py | Python | mit | 7,177 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# This file is part of Ansible
#
# Ansible 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 Lice... | fooelisa/ansible-modules-extras | cloud/cloudstack/cs_iso.py | Python | gpl-3.0 | 10,200 |
#!/usr/bin/env python
import os
from textwrap import TextWrapper
from nexus import NexusReader, NexusWriter, NexusFormatException, VERSION
from nexus.tools import tally_by_taxon, tally_by_site
__author__ = 'Simon Greenhill <simon@simon.net.nz>'
__doc__ = """nexusmanip - python-nexus tools v%(version)s
Performs a nu... | zhangjiajie/PTP | nexus/bin/nexus_tally.py | Python | gpl-3.0 | 1,440 |
# --------------------------------------------------------------------------
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the ""Software""),... | balajikris/autorest | src/generator/AutoRest.Python.Tests/AcceptanceTests/model_flattening_tests.py | Python | mit | 11,642 |
from operator import itemgetter
__author__ = 'davide'
def pairwise(l):
for t in zip(l, l[1:]):
yield t
def pijavskij(f, L, a, b, eps=1E-5):
l = [(a, f(a)), (b, f(b))]
while True:
imin, Rmin, xmin = -1, float("inf"), -1
for i, t in enumerate(pairwise(l)):
... | DavideCanton/Python3 | num/pijavskij.py | Python | gpl-3.0 | 830 |
"""A setuptools based setup module.
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here... | ibmspp/sppclient | setup.py | Python | apache-2.0 | 3,090 |
import random
class MarkovState:
def __init__(self,charsToEmit, emissionProbs,transitionProbs):
self.charsToEmit = charsToEmit
self.emissionProbs = emissionProbs
self.transitionProbs = transitionProbs
def getEmissionIndex(self):
aRand = random.random()
cumulative = 0
index =0
for val ... | afodor/pythonExamples | src/viterbi/viterbiExample.py | Python | gpl-2.0 | 2,894 |
import os
import sys
import unittest
try:
import unittest.mock as mock
except ImportError:
try:
import mock
except ImportError:
pass
from lazydir import load_json, load_yaml, get_config, FT_MAP, ext
from lazydir import ConfigurationError
HAS_MOCK = 'mock' in sys.modules
@unittest.skipIf(... | alexpeits/lazydir | tests/test_config.py | Python | gpl-3.0 | 1,425 |
import base64
from asyncio import coroutine
from .base import Base
class Target(Base):
unary = False
@coroutine
def __call__(self, text, encoding='utf-8'):
return base64.b64encode(text.encode(encoding)).decode('ascii')
| Answeror/torabot | torabot/lang/targets/base64_encode.py | Python | mit | 243 |
"""A wrapper around requests that records all requests made with it.
Supports get, put, post, delete and request
all calls return an instance of HarvesterResponse
"""
from __future__ import absolute_import
import json
import time
import logging
import functools
from datetime import datetime
import six
import ... | jeffreyliu3230/scrapi | scrapi/requests.py | Python | apache-2.0 | 4,421 |
#coding=utf-8
import threading
import time
class PluginTimer(threading.Thread):
def __init__(self, func, args=(), sleep=10):
threading.Thread.__init__(self)
self.func = func
self.args = args
self.sleep = sleep
self.enabled = True
self.setDaemon(True)
def stop(sel... | zhongjingjogy/SmartQQBot | smartqq/plugin_timer.py | Python | gpl-2.0 | 648 |
# -*- coding: utf-8 -*-
"""This file is part of the TPOT library.
TPOT was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Weixuan Fu (weixuanf@upenn.edu)
- Daniel Angell (dpa34@drexel.edu)
- and many more generous open source contributors
TPOT is f... | weixuanfu2016/tpot | tpot/gp_deap.py | Python | lgpl-3.0 | 20,597 |
"""
Character field class: a 8-bit character
"""
from hachoir_py3.field import Bits
from hachoir_py3.core.tools import makePrintable
class Character(Bits):
"""
A 8-bit character using ASCII charset for display attribute.
"""
static_size = 8
def __init__(self, parent, name, description=None):
... | SickGear/SickGear | lib/hachoir_py3/field/character.py | Python | gpl-3.0 | 720 |
#
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | endlessm/chromium-browser | third_party/catapult/third_party/gsutil/third_party/apitools/apitools/base/py/list_pager_test.py | Python | bsd-3-clause | 11,669 |
from __future__ import absolute_import
import argparse
import subprocess
from grokcore.component import context, subscribe, baseclass
from twisted.internet import defer
from twisted.python import log
from opennode.knot.backend.compute import format_error
from opennode.knot.backend.compute import register_machine
from... | valintinr/opennode-knot | opennode/knot/backend/salt/compute.py | Python | gpl-3.0 | 3,869 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at... | FreescaleSemiconductor/quantum | quantum/tests/unit/ryu/test_ryu_db.py | Python | apache-2.0 | 1,988 |
# Copyright (C) 2015 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 v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | mulkieran/storage_alerts | tests/sources/generic/by_line/recognizers_test.py | Python | gpl-2.0 | 7,550 |
# Copyright 2013-2014 Eucalyptus Systems, Inc.
#
# Redistribution and use of this software 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 copyright notice,
# this list of conditions ... | jhajek/euca2ools | euca2ools/bundle/manifest.py | Python | bsd-2-clause | 13,594 |
from rest_framework import serializers
from jsonschema import Draft4Validator, FormatChecker
from jsonschema.exceptions import ValidationError as JSONSchemaValidationError
from .convert import to_jsonschema
_DEFAULT = object()
class JSONSchemaField(serializers.Field):
"""A field that validates incoming data agai... | isprojects/drf_jsonschema | drf_jsonschema/fields.py | Python | bsd-3-clause | 2,014 |
from .methods import *
| katakumpo/nicepy | nicepy/assertions/__init__.py | Python | mit | 23 |
from netmiko.aruba.aruba_ssh import ArubaSSH
__all__ = ['ArubaSSH']
| sbyount/my_python | netmiko-master/netmiko/aruba/__init__.py | Python | apache-2.0 | 69 |
# -*- coding: utf-8 -*-
#
# DH Box documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 14 23:54:01 2014.
#
# 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.
#
# Al... | DH-Box/DH-Box.github.io | docs/conf.py | Python | apache-2.0 | 8,328 |
import os
import shutil
git_path = os.path.join('.git')
hooks_path = os.path.join(git_path, 'hooks')
commitmsg_hook_path = os.path.join(hooks_path, 'commit-msg')
def install():
check_git_path()
if not os.path.isdir(hooks_path):
os.makedirs(hooks_path, mode=0o755, exist_ok=True)
uninstall()
c... | ngouzy/smartchangelog | smartchangelog/githook.py | Python | mit | 757 |
"""
desispec.io.util
================
Utility functions for desispec IO.
"""
import os
import astropy.io
import numpy as np
def iterfiles(root, prefix):
'''
Returns iterator over files starting with `prefix` found under `root` dir
'''
for dirpath, dirnames, filenames in os.walk(root, followlinks=True)... | gdhungana/desispec | py/desispec/io/util.py | Python | bsd-3-clause | 5,570 |
# Copyright 2018 Huawei Technologies Co.,LTD.
#
# 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... | openstack/nomad | cyborg/tests/unit/fake_attribute.py | Python | apache-2.0 | 1,989 |
import pylab as pyl
from astLib import astStats
from sklearn.metrics import median_absolute_error, mean_squared_error
import h5py as hdf
from matplotlib.ticker import AutoMinorLocator
def calc_err(pred, true):
return (pred - true) / true
golden_mean = (pyl.sqrt(5.) - 1.0) / 2.0
f = pyl.figure(figsize=(10, 10 * ... | boada/desCluster | analysis/plot_massComparison_ML_5.py | Python | mit | 11,098 |
__author__ = 'abuddenberg'
from copy import deepcopy
import json
import re
import inspect
import traceback
from dateutil.parser import parse
class Gcisbase(object):
def __init__(self, data, fields=(), trans=()):
#Setup class variables
self.gcis_fields = fields
self.translations = trans
... | USGCRP/gcis-py-client | gcis_clients/domain.py | Python | bsd-3-clause | 18,981 |
from rest_framework import viewsets, mixins
from .models import Member
from .serializers import MemberSerializer, MemberDetailSerializer
# Team app views.
# All team members
class MembersViewSet (viewsets.ReadOnlyModelViewSet):
serializer_class = MemberSerializer
queryset = Member.objects
def list(self... | aileron-split/aileron-web | server/team/views.py | Python | gpl-3.0 | 4,519 |
from __future__ import division, print_function
import numpy as np
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from matplotlib.pylab import matshow
import matplotlib.collections as mcoll
from matplotlib.patches import Circle
from matplotlib.collections import PatchCollection
from .somoclu_wrap import tr... | fredhusser/somoclu | src/Python/somoclu/train.py | Python | gpl-3.0 | 9,185 |
SCREEN_SIZE = (640, 480)
CUBE_SIZE = 300
import pygame
from pygame.locals import *
from gameobjects.vector3 import Vector3
from math import *
from random import randint
def calculate_viewing_distance(fov, screen_width):
d = (screen_width/2.0) / tan(fov/2.0)
return d
def run():... | opensvn/python | pygame/bpwpapcode/Chapter08/simple3d.py | Python | gpl-2.0 | 4,719 |
"""
Kodi resolveurl plugin
Copyright (C) 2014 smokdpi
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.
... | felipenaselva/felipe.repository | script.module.resolveurl/lib/resolveurl/plugins/videozoo.py | Python | gpl-2.0 | 3,999 |
from downloaderror import DownloadError
from pynetspeed import NetSpeed | lazycoder-ru/pyvksync | lib/pyfileget/lib/__init__.py | Python | gpl-2.0 | 71 |
"""bcrypt and hmac implementation for Django."""
import base64
import hashlib
import logging
import bcrypt
import hmac
from django.conf import settings
from django.contrib.auth.models import get_hexdigest
from django.utils.encoding import smart_str
log = logging.getLogger('django_sha2')
def create_hash(userpwd):
... | fwenzel/django-sha2 | django_sha2/bcrypt_auth.py | Python | bsd-3-clause | 3,139 |
# Copyright 2014 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 l... | noironetworks/neutron | neutron/agent/linux/iptables_comments.py | Python | apache-2.0 | 1,900 |
# This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | rkashapov/buildbot | master/buildbot/www/hooks/base.py | Python | gpl-2.0 | 3,379 |
#! /usr/bin/env python
#-*- coding utf-8 -*-
#***********************************************************************
# Imports
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
#***********************************************************************
fig = plt.figure()
ax = fig.add_s... | elsuizo/Redes_fuzzy | Guia4/ejemplo2.py | Python | gpl-3.0 | 636 |
#
# LMirror is Copyright (C) 2010 Robert Collins <robertc@robertcollins.net>
#
# LMirror 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
# versio... | rbtcollins/lmirror | l_mirror/tests/test_commands.py | Python | gpl-3.0 | 4,888 |
'''
board.py
Board module for the game of Tic-Tac-Toe
'''
import pprint
import math
class Board:
def __init__(self):
""" Constructor """
# \# Signifies empty positions on the board
self.board = [
['#','#','#'],
['#','#','#'],
['#','#','#'... | Deephan/tic-tac-toe-for-slack | application/tictactoe/board.py | Python | apache-2.0 | 2,289 |
__license__ = 'GPL v3'
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
"""
Microsoft LIT HTML tag and attribute tables, copied from ConvertLIT.
"""
TAGS = [
None,
None,
None,
"a",
"acronym",
"address",
"applet",
"area",
"b",
"base",
"basefont",
"bdo... | jelly/calibre | src/calibre/ebooks/lit/maps/html.py | Python | gpl-3.0 | 18,748 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC 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.apache.org/licenses/LICENSE-2.0
#... | deepakselvaraj/federated-horizon | openstack_dashboard/dashboards/project/networks/views.py | Python | apache-2.0 | 5,316 |
"""
ASGI config for mondja project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTIN... | y-tsutsu/mondja | mondja/asgi.py | Python | bsd-3-clause | 389 |
import argparse
import os
import sys
import unittest
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(os.path.abspath(__file__)))))
from taktyk.args import _parse, get_commands, prepare_static_args
class ParseTest(unittest.TestCase):
args = [('ModulesHandler', True),
('Configure', Tr... | kosior/taktyk | tests/test_args.py | Python | mit | 7,124 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
******************************************************************************
* Description: SimpleMail ist ein Modul zum Versenden von Emails
* mit und ohne Anhaengen.
* Filename: simplemail.py
* Created: 2004-10-06 Gerold
* License: LGPL:... | BackupTheBerlios/cuon-svn | cuon_server/src/cuon/Email2.py | Python | gpl-3.0 | 22,728 |
# proxy module
from __future__ import absolute_import
from enable.qt4.cairo import *
| enthought/etsproxy | enthought/enable/qt4/cairo.py | Python | bsd-3-clause | 85 |
import helper
import json
import pandas as pd
import mpld3
import numpy as np
import requests
import factor_analysis
import visualizations
from datetime import timedelta, datetime
from netwin_analysis import netwin_analysis
from sqlalchemy import create_engine
from generateresponsefromrequest import get_intent_entity_f... | kruegg21/casino_analytics | src/main.py | Python | apache-2.0 | 14,236 |
#
# Copyright 2015 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 v.2. This program is distributed in the hope that it
# will be useful, but WITHOUT ANY WARRANTY expressed... | KosiehBarter/anaconda | tests/dracut_tests/parse-kickstart_test.py | Python | gpl-2.0 | 14,256 |
"""
YouTrack 2.0 REST API
"""
import re
from xml.dom import Node
from xml.dom.minidom import Document
from xml.dom import minidom
from xml.sax.saxutils import escape, quoteattr
EXISTING_FIELD_TYPES = {
'numberInProject' : 'integer',
'summary' : 'string',
'description' : 'string',
... | softintouch/python-youtrack-api | sit_youtrack/youtrack/__init__.py | Python | apache-2.0 | 24,496 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Basic factory.
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import socket
from twisted.internet import protocol, reactor, task
from .protocol import CongrediPeerProtocol
from .storage.scheduled.peerBeat import peerBeat, peerSuccess... | Thetoxicarcade/ac | congredi/factory.py | Python | gpl-3.0 | 3,621 |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect 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 Lice... | redmeros/Lean | Algorithm.Python/CustomChartingAlgorithm.py | Python | apache-2.0 | 3,759 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from rest_framework import generics, permissions
from core.models import User
from core.serializers import UserSerializer
class UserListAPIView(generics.ListAPIView):
"""
Read-only API View to list all users.
"""
querys... | wbg-optronix-lab/emergence-lab | core/api/user.py | Python | mit | 460 |
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
__license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import sys, struct
class WMFHeader(object):
'''
For header documentation, see
http://www.skynet.ie/~caolan/... | yeyanchao/calibre | src/calibre/utils/wmf/parse.py | Python | gpl-3.0 | 9,698 |
# $Id$
"""Mixins that are useful for classes using vtk_kit.
@author: Charl P. Botha <http://cpbotha.net/>
"""
from external.vtkPipeline.ConfigVtkObj import ConfigVtkObj
from external.vtkPipeline.vtkMethodParser import VtkMethodParser
from module_base import ModuleBase
from module_mixins import IntrospectModuleMixin ... | nagyistoce/devide | module_kits/vtk_kit/mixins.py | Python | bsd-3-clause | 13,612 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'DMUserProfile.political'
db.add_column('accounts_dmuserprofile', 'political', s... | team-xue/xue | xue/accounts/migrations/0009_auto__add_field_dmuserprofile_political.py | Python | bsd-3-clause | 5,303 |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as mtri
import matplotlib.delaunay as mdel
from nose.tools import assert_equal
from numpy.testing import assert_array_equal, assert_array_almost_equal
from matplotlib.testing.decorators import image_comparison
def test_delaunay():
# No duplic... | lthurlow/Network-Grapher | proj/external/matplotlib-1.2.1/lib/matplotlib/tests/test_triangulation.py | Python | mit | 5,090 |
# The following comment should be removed at some point in the future.
# mypy: disallow-untyped-defs=False
from __future__ import absolute_import
import cgi
import logging
import mimetypes
import os
import re
import shutil
import sys
from pip._vendor import requests
from pip._vendor.requests.models import CONTENT_CH... | rouge8/pip | src/pip/_internal/download.py | Python | mit | 20,297 |
# https://keras-cn.readthedocs.io/en/latest/other/application/
from keras.models import Sequential
from keras.models import Model
from keras.layers import (Flatten, Dense, Conv2D, MaxPooling2D)
from keras.preprocessing import image
from keras.applications.vgg16 import preprocess_input, decode_predictions
import numpy a... | OnlyBelter/learn_neuralTalk | get_img_features_VGG16.py | Python | mit | 6,426 |
def sameSet(a, b):
a = list(set(a))
b = list(set(b))
if len(a) != len(b):
return False
for i in range(len(a)):
if a[i] != b[i]:
return False
return True
| JoachimVandersmissen/CodingSolutions | python/PythonForEveryone/chapter6/12.py | Python | apache-2.0 | 201 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.db import models
class ServerManager(models.Manager):
def active(self):
"""
Активные сервера
"""
return self.filter(is_active=True, is_broken=False)
def find_server(self, group=None):
"""
... | plazix/django-erlyvideo | djerlyvideo/models.py | Python | bsd-3-clause | 3,065 |
#!../venv/bin/python
import sys
print (sys.argv[1:])
| thinkl33t/mqtt2telegram | scripts/test.py | Python | lgpl-3.0 | 54 |
import socket
class DNSResolver:
def __init__(self):
self._cache = {}
def __call__(self, host):
if host not in self._cache:
self._cache[host] = socket.gethostbyname(host)
return self._cache[host]
def clear(self):
self._cache.clear()
def has_host(self, hos... | misssoft/Fan.Python | src/dnsresolver.py | Python | mit | 359 |
from rest_framework import routers
from django.conf.urls import url, include, patterns
import api.views as api_views
import views as html_views
router = routers.DefaultRouter()
router.register(r'genes', api_views.GeneViewSet)
urlpatterns = patterns(
'',
url(r'^api/', include(router.urls), name='browser-api'... | vlaufer/NCBI_August_Hackathon_Push_Button_Genomics_Solution | django/browser/urls.py | Python | cc0-1.0 | 829 |
import matplotlib.pyplot as plt
from matplotlib.pyplot import cm
import numpy as np
import pinocchio as se3
import tools
import bmtools.processing as bm
from IPython import embed
#from bmtools.filters import filtfilt_butter
class UCM:
def __init__(self, robot):
self.robot = robot
self.name = robot... | GaloMALDONADO/motorg | motorog/ucm2.py | Python | gpl-3.0 | 42,786 |
"""
Class to show movies of an fmri slice. Currently unused.
"""
import matplotlib as mpl
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from PyQt5 import QtCore, QtGui
import core
from matplotlib.animation import ArtistAnimation
from signals import Signals
class _MplAnimation(Signal... | AlanKuurstra/vidi3d | vidi3d/animation.py | Python | gpl-3.0 | 2,513 |
import functools
@functools.total_ordering
class Rating(object):
def __init__(self, code, character, name, nice_name, minimum_age, block_text,
additional_description=None):
self.code = code
self.character = character
self.name = name
self.minimum_age = minimum_age... | Weasyl/weasyl | libweasyl/libweasyl/ratings.py | Python | apache-2.0 | 1,790 |
try:
from FITS_Keywords import FITS_KeyDict
except ImportError:
FITS_KeyDict = {}
pass
import inspect
from copy import copy
class CalculatorExcept:
"""This class is an exception class for the Calculator module"""
def __init__(self, msg="Exception Raised in Descriptor system"):
"""This... | pyrrho314/recipesystem | trunk/astrodata/Calculator.py | Python | mpl-2.0 | 4,316 |
from uuid import uuid4
from datetime import datetime
from mongokit import IS
from . import (ValidationError,
email_validator,
url_validator,
name_validator)
from .root import RootDocument
from ..user import AuthenticatedUser
from .. import db, rights
class ResourceValidat... | jexhson/runinthebox | runinthebox/model/user.py | Python | gpl-2.0 | 3,480 |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from collections import defaultdict
from ..nlp.stemmers import null_stemmer
from ._summarizer import AbstractSummarizer
from .edmundson_cue import EdmundsonCueMethod
from .edmundson_key impo... | WangWenjun559/Weiss | summary/sumy/summarizers/edmundson.py | Python | apache-2.0 | 5,183 |
from __future__ import absolute_import
# Copyright (c) 2010-2019 openpyxl
"""Write the theme xml based on a fixed string."""
theme_xml = """<?xml version="1.0"?>
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme">
<a:themeElements>
<a:clrScheme name="Office">
<a... | cloudera/hue | desktop/core/ext-py/openpyxl-2.6.4/openpyxl/writer/theme.py | Python | apache-2.0 | 10,288 |
from django.db import models
import django
# Create your models here.
class OrigenDatos(models.Model):
id_referencia = models.BigIntegerField()
nombre = models.CharField(max_length=150)
url = models.URLField()
class Local(models.Model):
origen_referencia = models.ForeignKey(OrigenDatos)
nombre = m... | Hackatong2017Geriatricos/backend | api/models.py | Python | apache-2.0 | 1,180 |
# this class will hold and process hw part information
class Assignment(object):
def __init__(self, hwNum, partNum):
self.homework = hwNum
self.part = partNum
def getPart(self):
return self.part
def getHomework(self):
return self.homework
def __str__(s... | tanonev/codewebs | src/util/Assignment.py | Python | mit | 1,263 |
# Add here your overrides for development and add this file to .hgignore or .gitignore
CUSTOM_SETTING = 'custom setting' | delicb/django-project-template | webapp/settings/local.py | Python | mit | 121 |
# Generated by Django 2.2 on 2019-06-20 09:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tmv_app', '0118_runstats_lda_library'),
]
operations = [
migrations.AlterField(
model_name='runstats',
name='lda_learn... | mcallaghan/tmv | BasicBrowser/tmv_app/migrations/0119_auto_20190620_0908.py | Python | gpl-3.0 | 865 |
"""Write a function that returns every permutation of n numbers that
add up to k.
Examples:
k = 4, n = 2
result: [[2, 2], [2, 2], [1, 3], [3, 1]]
k = 5, n = 2
result: [[3, 2], [2, 3], [1, 4], [4, 1]]
"""
def find_n_sum_k(k, n):
space = list(range(1, k))
solutions = set()
def _find_n_sum... | rcanepa/cs-fundamentals | python/interview_questions/find_permutations_sum_k_with_n.py | Python | mit | 1,059 |
# -*- coding: utf-8 -*-
# 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, softwar... | NitishT/minio | docs/sts/client_grants/sts_element.py | Python | apache-2.0 | 3,062 |
from .leb128s import encode
from .leb128s import decode
| bright-tools/varints | varints/varints/leb128s/__init__.py | Python | apache-2.0 | 56 |
import cisreg
import numpy as np
# the color
rgb_codes={"EnhancerActive":"255,215,0", #gold, EnhancerActive
"EnhancerInactive":"184,134,11", # dark golden rod, EnhancerInactive
"PromoterActive":"255,0,0", # red, PromoterActive
"PromoterInactive":"250,128,114", # salmon, Promote... | yifeng-li/DECRES | test_module.py | Python | bsd-3-clause | 1,418 |
from .base import (
BuildableMixin,
BuildableTemplateView,
Buildable404View,
BuildableRedirectView
)
from .detail import BuildableDetailView
from .list import BuildableListView
from .dates import (
BuildableArchiveIndexView,
BuildableYearArchiveView,
BuildableMonthArchiveView,
BuildableD... | stvkas/django-bakery | bakery/views/__init__.py | Python | mit | 635 |
""" utilities for debuging code """
import json
import pprint
__author__ = "Mike Stabile"
pp = pprint.PrettyPrinter(indent=2)
def p_args(args, kwargs={}):
return "\n\t\t".join(["args[%s] = %s" % (i, v) \
for i, v in enumerate(args)]) + \
"\n\t\tkwargs = %s" % kwargs
def dumpable_obj(obj):
... | KnowledgeLinks/rdfframework | rdfframework/utilities/debug.py | Python | mit | 1,881 |
#!/usr/bin/python
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | endlessm/chromium-browser | third_party/flatbuffers/src/android/jni/msbuild.py | Python | bsd-3-clause | 2,536 |
#!/usr/bin/python
import cmd
import contextlib
import threading
import socket
import sys
import time
class CommandLineClient(cmd.Cmd):
prompt = '<<<< '
def __init__(self, sock):
cmd.Cmd.__init__(self)
self.sock = sock
def default(self, line):
self.sock.send(line + '\n')
class Rece... | BrownGLAMOR/JACK | src/jack/clients/CommandLineClient.py | Python | lgpl-3.0 | 1,059 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-#
#
#
# Copyright (C) 2013-2018 University of Zurich. All rights reserved.
#
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of th... | witlox/elasticluster | setup.py | Python | gpl-3.0 | 8,272 |
#!../../venv/bin/python
# -*- coding: utf-8 -*-
# vim: set file encoding=utf-8
# File: /home/alex/Py/CSV/debk/src/work_with.py
"""
A second level menu model to work with a specific entity.
Part of the double entry book keeping project.
If called rather than imported, it attempts to 'work_with' a
defaultentity which ... | alexKleider/debk | src/work_with.py | Python | gpl-3.0 | 7,161 |
from deployments.tasks import app
@app.task
def download_file(deployment, source, destination):
pass
@app.task
def delete_file(deployment, filename):
pass
@app.task
def echo(message):
pass
@app.task
def expect_callback(deployment, callback_name):
pass
@app.task
def ipmi_command(deployment, com... | teran/bootloader-web | bootloader/deployments/tasks/AgentTasks.py | Python | gpl-2.0 | 353 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.simulation_parameters import HeatBalanceSettingsConductionFiniteDifference
log = logging.getLogger(__name__)
class TestHeatBalanceSettingsConductionFiniteDifference(unittest.Tes... | rbuffat/pyidf | tests/test_heatbalancesettingsconductionfinitedifference.py | Python | apache-2.0 | 2,066 |
#!/usr/bin/env python
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
============================
fMRI: OpenfMRI.org data, FSL
============================
A growing number of datasets are available on `OpenfMRI <http://openfmri.org>`_.
This script... | rameshvs/nipype | examples/fmri_openfmri.py | Python | bsd-3-clause | 17,877 |
import math
from autoprotocol import UserError
from modules.utils import *
def transform(protocol, params):
# general parameters
constructs = params['constructs']
num_constructs = len(constructs)
plates = list(set([construct.container for construct in constructs]))
if len(plates) != 1:
ra... | dacarlin/TSkunkel | transform.py | Python | mit | 2,849 |
__author__ = 'Сергей'
from django.core.mail import send_mail
from django.template.loader import render_to_string
from django.conf import settings
from django.contrib.sites.shortcuts import get_current_site
from orders.models import Order
from shipping.methods import methods
from payment.gateways import gateways
def... | juntatalor/qexx | orders/utils.py | Python | mit | 2,243 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.