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 |
|---|---|---|---|---|---|
from csacompendium.utils.pagination import APILimitOffsetPagination
from csacompendium.utils.keywordsearch import get_query, get_project_models
from csacompendium.utils.permissions import IsOwnerOrReadOnly
from rest_framework.generics import ListAPIView
from csacompendium.search.api.globalsearch.globalsearchserializers... | nkoech/csacompendium | csacompendium/search/api/globalsearch/globalsearchviews.py | Python | mit | 2,957 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | catapult-project/catapult | third_party/google-endpoints/google/api/config/service_config.py | Python | bsd-3-clause | 4,729 |
#静态类
class Lang:
"""语言包配置
>>Demo:
from lang import Lang
print Lang.getLang("ErrorCode")
"""
@staticmethod
def getLang(name):
"""获取语言包配置属性,参数name:属性名"""
return Lang.__langconfig[name]
__langconfig = {
"ErrorCode": 10000,
"ErrorInfo": "系统繁忙!"... | wenhulove333/ScutServer | Sample/Koudai/Server/src/ZyGames.Tianjiexing.Server/Script/PyScript/Lib/lang.py | Python | mit | 3,385 |
"""
curtains.py
Problem: Calculate how much material to buy, given the size of the windows.
Target Users: My friend who wants to make some curtains
Target System: GNU/Linux
Interface: Command-line
Functional Requirements: Print out the required length of fabric in meters
Print out the total price of the fabric
User mus... | r-castro/Python | curtain.py | Python | gpl-3.0 | 1,637 |
"""
===============
tao package
===============
.. toctree::
:maxdepth: 2
admin
assets
context_processors
datasets
decorators
demo
development
forms
mail
models
pagination
qa
settings
test
time
ui_modules
urls
widgets
workflow
xml_util
"""
| IntersectAustralia/asvo-tao | web/tao/__init__.py | Python | gpl-3.0 | 306 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import Form
from odoo.addons.stock.tests.test_report import TestReportsCommon
class TestMrpStockReports(TestReportsCommon):
def test_report_forecast_1_mo_count(self):
""" Creates and ... | jeremiahyan/odoo | addons/mrp/tests/test_stock_report.py | Python | gpl-3.0 | 8,272 |
"""empty message
Revision ID: 46c97aa9285d
Revises: None
Create Date: 2015-01-20 10:34:38.095562
"""
# revision identifiers, used by Alembic.
revision = '46c97aa9285d'
down_revision = None
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###... | chudichudichudi/neuro-tedx-2 | migrations/versions/46c97aa9285d_.py | Python | bsd-3-clause | 1,843 |
import os
import askmanta
import json
from dateutil import parser as dateparser
from askmanta.environment import client
class Phase(object):
# phase name = "job name: phase i"
def __init__(self, i, spec, directive):
self.i = i
self.spec = spec
self.directive = directive
self.t... | debrouwere/askmanta | askmanta/job.py | Python | mit | 6,468 |
# -*- coding: utf-8 -*-
from model.contact import Contact
def test_add_contact(app, db,check_ui, json_contacts):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.create(contact)
new_contacts = db.get_contact_list()
assert len(old_contacts) + 1 == len(new_contacts)
old_... | SentyQ/python_training | test/test_add_contact.py | Python | apache-2.0 | 662 |
import os
import shutil
from tempfile import mkstemp
from tests import TestCase, add
from mutagen.asf import ASF, ASFHeaderError, ASFValue, UNICODE, DWORD, QWORD
from mutagen.asf import BOOL, WORD, BYTEARRAY, GUID
class TASFFile(TestCase):
def test_not_my_file(self):
self.failUnlessRaises(
ASF... | hanvo/MusicCloud | Crawler/Install Files/mutagen-1.22/tests/test_asf.py | Python | bsd-3-clause | 11,868 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = """Co-Pierre Georg (co-pierre.georg@uct.ac.za)"""
import abc
from xml.etree import ElementTree
# -------------------------------------------------------------------------
#
# class Config
#
# -----------------------------------------------------------------... | cogeorg/black_rhino | examples/solow/abm_template/src/baseconfig.py | Python | gpl-3.0 | 13,029 |
# #
# Copyright 2012-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | pneerincx/easybuild-framework | easybuild/tools/parallelbuild.py | Python | gpl-2.0 | 8,870 |
# -*- python -*-
# Copyright (C) 2009 Free Software Foundation, 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 3 of the License, or
# (at your option) any later version.
#
... | GeeteshKhatavkar/gh0st_kernel_samsung_royxx | arm-2010.09/arm-none-eabi/lib/thumb2/libstdc++.a-gdb.py | Python | gpl-2.0 | 2,345 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"This is some interesting educational program"
# wxRays (C) 2013 Serhii Lysovenko
#
# 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... | Lysovenko/wxRays | v_face.py | Python | gpl-3.0 | 4,571 |
import pytest
import numpy as np
from eli5._feature_names import FeatureNames
# See also test_sklearn_utils.py::test_get_feature_names
def test_feature_names_filtered():
filtered, indices = (FeatureNames(['one', 'two', 'twenty-two'])
.filtered(lambda name: 'two' in name))
assert in... | TeamHG-Memex/eli5 | tests/test_feature_names.py | Python | mit | 4,329 |
#!/usr/bin/env python3
import os,sys;
from setuptools import setup;
if 'linux'!=sys.platform:
print("This package only supports Linux platform.");
exit(1);
setup(
name = 'telnet-ppp-server', # 在pip中显示的项目名称
version = '0.1',
author = 'Frank',
author_email = '',
license = 'MIT',
url = ''... | frank-deng/retro-works | telnet-ppp-server/setup.py | Python | mit | 552 |
from flask import Blueprint, render_template, redirect, request, g, abort
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField
from career_connections.database.models import PendingUser, User
from career_connections.utils.auth import login, logout
unauth_views_bp = Blueprint('unauthenticated... | UnboundLegacy/api | career_connections/blueprints/unauthenticated_views.py | Python | mit | 1,567 |
# -*- coding: utf-8 -*-
'''
Created : 2017-01-14
@author: Eric Lapouyade
'''
from docxtpl import DocxTemplate, InlineImage
# for height and width you have to use millimeters (Mm), inches or points(Pt) class :
from docx.shared import Mm, Inches, Pt
tpl=DocxTemplate('test_files/inline_image_tpl.docx')
context = {
... | rgusmero/python-docx-template | tests/inline_image.py | Python | lgpl-2.1 | 1,565 |
#!/usr/bin/python3
# Concatenator 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.
#
# Concatenator is distributed in the hope that... | StuntsPT/concatenator2 | concatenation.py | Python | gpl-3.0 | 945 |
import tangelo
tangelo.log("Python file plugin")
tangelo.log("This doesn't use a Python module directory.")
| Kitware/tangelo | tests/plugins/pythonfile/python.py | Python | apache-2.0 | 109 |
import sure
sure
| gabrielfalcao/carpentry | tests/unit/__init__.py | Python | gpl-3.0 | 17 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/nitroml | nitroml/automl/autotrainer/subpipeline.py | Python | apache-2.0 | 6,444 |
import django
from media_tree.models import FileNode
from media_tree.admin.utils import get_current_request, is_search_request, \
get_request_attr
from django.contrib.admin.views.main import ChangeList
from django.db import models
class MediaTreeChangeList(ChangeList):
def is_filtered(self, request):
... | samluescher/django-media-tree | media_tree/admin/change_list.py | Python | bsd-3-clause | 3,274 |
#!/usr/bin/env python
from optparse import OptionParser
from shutil import which
from subprocess import check_output, CalledProcessError
from sys import stderr
from flask import Flask, jsonify
from flask_sockets import Sockets
def get_parser():
parser = OptionParser(usage='%prog [-p|--port PORT] [-w|--websockets]... | apirogov/x11remote | x11remote.py | Python | mit | 2,220 |
#!/usr/bin/env python
# coding=utf-8
#-*- coding:utf-8 -*-
import random
N = 8 #八个网页
d = 0.85 #阻尼因子为0.85
delt = 0.00001 #迭代控制变量
#两个矩阵相乘
def matrix_multi(A,B):
result = [[0]*len(B[0]) for i in range(len(A))]
for i in range(len(A)):
for j in range(len(B[0])):
for k in range(... | zhaochl/python-utils | agrith_util/page_rank/page_rank_test.py | Python | apache-2.0 | 2,180 |
import os
import re
from honcho.procfile import Procfile
from subprocess import Popen, PIPE
from nose.tools import assert_equal, assert_true # noqa
from mock import patch, MagicMock, call # noqa
FIXTURE_ROOT = os.path.join(os.path.dirname(__file__), 'fixtures')
try:
from nose.tools import assert_regexp_matches
... | gratipay/honcho | test/helpers.py | Python | mit | 1,694 |
from rest_framework import routers, serializers, viewsets, mixins, filters, relations
from munigeo.api import GeoModelSerializer
from rest_framework.serializers import ListSerializer, LIST_SERIALIZER_KWARGS
import datetime
from .models import *
import django_filters
from django import forms
from rest_framework.except... | City-of-Helsinki/kore | schools/api.py | Python | agpl-3.0 | 24,286 |
"""
Test utilities.
Partially based on the code from http://code.activestate.com/recipes/52215/
Author(s): Elric Milon
"""
import logging
import os
import sys
from tribler_core.utilities.network_utils import get_random_port
__all__ = ["process_unhandled_exceptions"]
class UnhandledExceptionCatcher(object):
""... | hbiyik/tribler | src/tribler-core/tribler_core/tests/tools/util.py | Python | lgpl-3.0 | 3,343 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Exercise 11.3 from Kane 1985."""
from __future__ import division
from sympy import Matrix, symbols
from sympy.physics.mechanics import ReferenceFrame, Point
from sympy.physics.mechanics import dynamicsymbols
R_SQ, R_QE, R_EM, R_Ee, R_Mm = symbols('R_SQ R_QE R_EM R_Ee ... | nouiz/pydy | examples/Kane1985/Chapter6/Ex11.3.py | Python | bsd-3-clause | 3,430 |
from __future__ import unicode_literals
import unittest
from mopidy_settings import Extension, frontend as frontend_lib
class ExtensionTest(unittest.TestCase):
def test_get_default_config(self):
ext = Extension()
config = ext.get_default_config()
self.assertIn('[nadsettings]', config)... | dlogik/Mopidy-NadSettings | tests/test_extension.py | Python | apache-2.0 | 646 |
'''Please note that it's Function problem i.e.
you need to write your solution in the form of Function(s) only.
Driver Code to call/invoke your function would be added by GfG's Online Judge.'''
# Your task is to complete this function
# The function prints V space separated integers where
# the ith integer denote the ... | isendel/algorithms | algorithms/graph/dijkstra.py | Python | apache-2.0 | 1,057 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
Created on Jul 16, 2012
"""
__author__ = "Shyue Ping Ong, Stephen Dacek"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__ma... | migueldiascosta/pymatgen | pymatgen/io/vasp/tests/test_outputs.py | Python | mit | 27,721 |
import argparse
import numpy as np
import scipy.linalg
import subprocess
from shutil import copyfile
from functools import partial
import sys
import time
try:
import pickle as cpickle
except:
try:
import cpickle
except:
import _pickle as cpickle
# Add path to HydroGrid and import module
# sys.path.appen... | stochasticHydroTools/RigidMultiblobsWall | multi_bodies/examples/Rollers_Small_Example/multi_bodies.py | Python | gpl-3.0 | 38,017 |
import os
class suppress_stdout_stderr(object):
"""
Via http://stackoverflow.com/questions/11130156/suppress-stdout-stderr-print-from-python-functions
A context manager for doing a "deep suppression" of stdout and stderr in
Python, i.e. will suppress all print, even if the print originates in a
com... | skoczen/dewey | dewey/util.py | Python | mit | 1,259 |
# jsb.plugs.common/learn.py
#
#
""" learn information items .. facts .. factoids. """
## jsb imports
from jsb.lib.callbacks import callbacks
from jsb.lib.commands import cmnds
from jsb.lib.examples import examples
from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import PlugPersist
## basic imports
impo... | melmothx/jsonbot | jsb/plugs/common/learn.py | Python | mit | 3,168 |
#!/usr/bin/python
from macaroon.playback import *
import utils
sequence = MacroSequence()
#sequence.append(WaitForDocLoad())
sequence.append(PauseAction(5000))
# Work around some new quirk in Gecko that causes this test to fail if
# run via the test harness rather than manually.
sequence.append(KeyComboAction("<Con... | chrys87/orca-beep | test/keystrokes/firefox/focus_tracking_link_child_of_body.py | Python | lgpl-2.1 | 1,278 |
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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
#... | Phil-LiDAR2-Geonode/pl2-geonode | geonode/geoserver/urls.py | Python | gpl-3.0 | 2,446 |
from mrjob.job import MRJob
import sys
class GlobalState(MRJob):
def __init__(self):
self.GlobalList = []
def mapper_init(self):
print("cat", file=sys.stderr)
def mapper(self, _, lines):
if "wi" in lines:
self.GlobalList.append(lines[2:8])
yield (lines... | JasonSanchez/w261 | week5/GlobalState.py | Python | mit | 508 |
"""
Common functionality used in save() methods and the like live here.
This is basically anything that can be abstracted away for readability
like hashing or getting a media path, etc...
"""
from django.conf import settings
from django.utils import timezone
from django.db import connections
from django.db.models.fiel... | loolmeh/pytoeba | pytoeba/utils.py | Python | mit | 13,918 |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2017, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | gregcaporaso/q2cli | q2cli/handlers.py | Python | bsd-3-clause | 22,305 |
import _plotly_utils.basevalidators
class DeltaValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="delta", parent_name="indicator", **kwargs):
super(DeltaValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/indicator/_delta.py | Python | mit | 1,527 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
import os
import unittest
import warnings
import pytest
from pymatgen.analysis.functional_groups import FunctionalGroupExtractor
from pymatgen.analysis.graphs import MoleculeGraph
from pymatgen.analysis.loca... | gmatteo/pymatgen | pymatgen/analysis/tests/test_functional_groups.py | Python | mit | 5,094 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-06-08 11:44
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | nicolaszein/chat | chat/migrations/0003_userprofile.py | Python | bsd-3-clause | 1,161 |
from django import template
from django.core.urlresolvers import reverse
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter()
@stringfilter
def actionlogize(value):
"""
Converts an ActionLog-Actionkey into a translateable, human string
"""
dictionar... | vialink/skd | keys/templatetags/actionlog.py | Python | bsd-2-clause | 6,141 |
#!/usr/bin/env python
import numpy as np
import argparse
import os
from respy.python.shared.shared_auxiliary import dist_class_attributes
from respy.python.estimate.estimate_auxiliary import get_optim_paras
from respy.python.shared.shared_auxiliary import dist_model_paras
from respy.python.shared.shared_auxiliary imp... | restudToolbox/package | respy/scripts/scripts_estimate.py | Python | mit | 5,808 |
from __future__ import absolute_import
from django.http import HttpResponse
from django.views.generic.edit import CreateView, DeleteView, UpdateView
from rules.contrib.views import (
LoginRequiredMixin,
PermissionRequiredMixin,
objectgetter,
permission_required,
)
from .models import Book
class Boo... | dfunckt/django-rules | tests/testapp/views.py | Python | mit | 2,551 |
"""
Functions handling ontology annotations.
"""
from __future__ import print_function, division
import sys
import re
import bioservices
import libsbml
def getResourceUris(item):
""" Get list of resource URIs for the given element.
qualifierType = libsbml.BIOLOGICAL_QUALIFIER,
biologicalQualifierType = li... | kirichoi/tellurium | tellurium/analysis/annotations.py | Python | apache-2.0 | 5,238 |
import os, gzip, cPickle
import numpy as np
from theano import tensor as T, shared
def get_batch(iBatch, data, szBatch=256):
return data[iBatch*szBatch:(iBatch+1)*szBatch]
def load(name='mnist.pkl.gz'):
# Download the MNIST dataset if it is not present
data_dir, data_file = os.path.split(name)
if d... | pengsun/DeepLearningTutorials | mycode/dataset.py | Python | bsd-3-clause | 2,959 |
from leak import logger
def versions_split(version_str, type_applyer=int):
dots_count = version_str.count('.')
if dots_count == 0:
major, minor, patch = version_str, 0, 0
elif dots_count == 1:
major, minor = version_str.split('.')
patch = 0
elif dots_count == 2:
major, ... | bmwant21/leak | leak/version_parser.py | Python | mit | 604 |
import os
from generic import obj
from simulation import Simulation,SimulationInput,SimulationAnalyzer
from vasp_input import VaspInput,generate_vasp_input
from vasp_analyzer import VaspAnalyzer
class Vasp(Simulation):
input_type = VaspInput
analyzer_type = VaspAnalyzer
generic_identifier ... | habanero-rice/hclib | test/performance-regression/full-apps/qmcpack/nexus/library/vasp.py | Python | bsd-3-clause | 6,365 |
import logging, time, random
from autotest.client.shared import error
from qemu.tests import drive_mirror
class DriveMirrorSimple(drive_mirror.DriveMirror):
def __init__(self, test, params, env, tag):
super(DriveMirrorSimple, self).__init__(test, params, env, tag)
@error.context_aware
def query_s... | sathnaga/virt-test | qemu/tests/drive_mirror_simple.py | Python | gpl-2.0 | 1,549 |
#!/usr/bin/env python
# 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 in the hope that ... | apahim/avocado-misc-tests | io/disk/ltp_fs.py | Python | gpl-2.0 | 5,087 |
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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/os-collect-config | os_collect_config/tests/test_cfn.py | Python | apache-2.0 | 10,601 |
"""
Django settings for django_magic_login project.
Generated by 'django-admin startproject' using Django 1.10.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""... | greglinch/sourcelist | django-magic-link/django_magic_login/settings.py | Python | mit | 3,560 |
"""distutils.util
Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
__revision__ = "$Id: util.py 52231 2006-10-08 17:41:25Z ronald.oussoren $"
import sys, os, string, re
from distutils.errors import DistutilsPlatformError
from distutils.dep_util import newer
fro... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/distutils/util.py | Python | gpl-2.0 | 19,657 |
from theano import tensor as T, function, shared, config
import numpy as np
class Optimizer(object):
def update(self, param, grad, lr, transformer=None, grad_transformer=None):
if grad_transformer is not None:
grad = grad_transformer.transform(grad)
param_update, helper_update = self.... | vzhong/pystacks | pystacks/optimizer.py | Python | mit | 2,213 |
import os
path = os.path.dirname(os.path.realpath(__file__))
sbmlFilePath = os.path.join(path, 'MODEL1011090002.xml')
with open(sbmlFilePath,'r') as f:
sbmlString = f.read()
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
ret... | biomodels/MODEL1011090002 | MODEL1011090002/model.py | Python | cc0-1.0 | 427 |
# __init__.py Common functions for uasyncio primitives
# Copyright (c) 2018-2020 Peter Hinch
# Released under the MIT License (MIT) - see LICENSE file
try:
import uasyncio as asyncio
except ImportError:
import asyncio
async def _g():
pass
type_coro = type(_g())
# If a callback is passed, run it and ret... | peterhinch/micropython-async | v3/as_drivers/sched/primitives/__init__.py | Python | mit | 823 |
# 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 Licen... | jameschch/Lean | PythonToolbox/quantconnect/api.py | Python | apache-2.0 | 20,315 |
# Copyright (c) 2012 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.
"""Base class for generating wrapper functions for PPAPI methods.
"""
from datetime import datetime
import os
import sys
from idl_c_proto import CGen
f... | keishi/chromium | ppapi/generators/idl_gen_wrapper.py | Python | bsd-3-clause | 15,759 |
"""Hardware driver related utilities
Everything in this module should rely on /proc or /sys only, no executable calls
"""
# Standard Library
import os
import re
# Lutris Modules
from lutris.util.log import logger
MIN_RECOMMENDED_NVIDIA_DRIVER = 415
def get_nvidia_driver_info():
"""Return information about NVid... | lutris/lutris | lutris/util/graphics/drivers.py | Python | gpl-3.0 | 3,558 |
from __future__ import unicode_literals
from decimal import Decimal
import datetime
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core.validators import MinValueValidator, RegexValidator
from django.db.models import Manager, Q
from django.utils.encoding import python_2_unico... | Drekscott/Motlaesaleor | saleor/product/models/base.py | Python | bsd-3-clause | 10,340 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tests for the Winlogon Windows Registry plugin."""
import unittest
from dfdatetime import filetime as dfdatetime_filetime
from dfwinreg import definitions as dfwinreg_definitions
from dfwinreg import fake as dfwinreg_fake
from plaso.formatters import winreg # pylint: dis... | dc3-plaso/plaso | tests/parsers/winreg_plugins/winlogon.py | Python | apache-2.0 | 12,249 |
from __future__ import absolute_import, division, unicode_literals
import os
import sys
import unittest
import warnings
from difflib import unified_diff
try:
unittest.TestCase.assertEqual
except AttributeError:
unittest.TestCase.assertEqual = unittest.TestCase.assertEquals
from .support import get_data_files... | vitorio/NaNoGenMo2013 | ficly-scrape/html5lib/tests/test_treewalkers.py | Python | cc0-1.0 | 11,844 |
from django.conf.urls import include, url
from storages.views import add_s, edit_s, ViewStorages
urlpatterns = [
url(r'^$', ViewStorages.as_view(), name='all'),
url(r'^add/', add_s, name='add_s'),
url(r'^edit/', edit_s, name='edit'),
url(r'^api/', include('storages.api.urls')),
]
| sfcl/severcart | storages/urls.py | Python | gpl-2.0 | 298 |
from django.db import models
from django.db.models import *
from django.contrib.auth.models import User
from django.contrib import admin
from django.db.models.signals import post_save
from taggit.managers import TaggableManager
from shared.utils import *
class UserProfile(models.Model):
tab_id=models.IntegerField(pri... | shaswatsunder/aakashlabs-forum | shared/models.py | Python | gpl-3.0 | 4,263 |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# 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 a... | SuminAndrew/tornado | tornado/netutil.py | Python | apache-2.0 | 19,807 |
# -*- coding: utf-8 -*-
import sys
import os
import re
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.pat... | diacritic/wssdl | doc/conf.py | Python | gpl-3.0 | 9,145 |
#!/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='configparserdb',
version='0.1.0',
description='Python package to access config parser based database',
... | aamirmalik/configparserdb | setup.py | Python | gpl-2.0 | 544 |
import pickle
import json
import numpy as np
from clustering_methods import *
import sequenceParser
import patternRepresentation
import similarityMatrix
import cluster_postprocessing
import similarityMatrixFiltering
from file_path_global import *
sequenceParser.runProcess(filepath_sequence_pkl_w_ornament, filepath_... | xavierfav/music-pattern-discovery | clustering_example.py | Python | agpl-3.0 | 3,566 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | seaotterman/tensorflow | tensorflow/contrib/learn/python/learn/estimators/dnn_test.py | Python | apache-2.0 | 57,502 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError, RedirectWarning
PROJECT_TASK_READABLE_FIELDS = {
'allow_subtasks',
'allow_tim... | jeremiahyan/odoo | addons/hr_timesheet/models/project.py | Python | gpl-3.0 | 20,630 |
"""Unit tests for the memoryview
XXX We need more tests! Some tests are in test_bytes
"""
import unittest
import test.support
import sys
import gc
import weakref
import array
class AbstractMemoryTests:
source_bytes = b"abcdef"
@property
def _source(self):
return self.source_bytes
@property... | mancoast/CPythonPyc_test | fail/312_test_memoryview.py | Python | gpl-3.0 | 10,981 |
# sql/selectable.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""The :class:`.FromClause` class of SQL expression elements, representing
SQL table... | Cito/sqlalchemy | lib/sqlalchemy/sql/selectable.py | Python | mit | 108,071 |
from unittest.mock import Mock
import pytest
from mitmproxy import connection
from mitmproxy.proxy import events, commands
@pytest.fixture
def tconn() -> connection.Server:
return connection.Server(None)
def test_dataclasses(tconn):
assert repr(events.Start())
assert repr(events.DataReceived(tconn, b"... | mitmproxy/mitmproxy | test/mitmproxy/proxy/test_events.py | Python | mit | 957 |
#! /usr/bin/env python
'''Make sure the Riak client is sane'''
import unittest
from test import BaseTest
from simhash_db import Client
class RiakTest(BaseTest, unittest.TestCase):
'''Test the Riak client'''
def make_client(self, name, num_blocks, num_bits):
return Client('riak', name, num_blocks, nu... | seomoz/simhash-db-py | test/test_riak.py | Python | mit | 377 |
import petsc4py
import sys
petsc4py.init(sys.argv)
from petsc4py import PETSc
#import mshr
from dolfin import *
import sympy as sy
import numpy as np
import ExactSol
import MatrixOperations as MO
import CheckPetsc4py as CP
from dolfin import __version__
import MaxwellPrecond as MP
import StokesPrecond
import time
d... | wathen/PhD | MHD/FEniCS/MHD/Stabilised/SaddlePointForm/Test/SplitMatrix/ScottTest/Hartman2D/HartmanChannel.py | Python | mit | 9,266 |
from flask import render_template, request, Response
from SharedPreferences import AnglesStorage
from app import app
import requests
import urllib
import math
ipcamProtocol = 'http://'
ipcamAddress = '143.107.235.49:8085'
ipcamWebctl = '/decoder_control.cgi'
ipcamVideostream = '/videostream.cgi'
ipcamUser =... | ddmendes/R3V-Remote3DViewer | site/app/views.py | Python | mit | 4,879 |
from _ctypes.basics import _CData, _CDataMeta, cdata_from_address
from _ctypes.primitive import SimpleType, _SimpleCData
from _ctypes.basics import ArgumentError, keepalive_key
from _ctypes.basics import is_struct_shape
from _ctypes.builtin import get_errno, set_errno, get_last_error, set_last_error
import _rawffi
imp... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib_pypy/_ctypes/function.py | Python | mit | 26,457 |
# -*- 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 six
from django.contrib import messages
from django.contrib... | suutari-ai/shoop | shuup/front/apps/customer_information/views.py | Python | agpl-3.0 | 9,524 |
"""
Tests for Term.
"""
from itertools import product
from unittest import TestCase
from numpy import (
float32,
uint32,
uint8,
)
from zipline.errors import (
InputTermNotAtomic,
TermInputsNotSpecified,
WindowLengthNotSpecified,
)
from zipline.pipeline import Factor, TermGraph
from zipline.pip... | ChinaQuants/zipline | tests/pipeline/test_term.py | Python | apache-2.0 | 8,036 |
import json
import logging
from community_csdt.src.models.accounts import account
from community_csdt.src.models.classes import classroom
from community_csdt.src.models.galleries import gallery
from community_csdt.src.models.login import login
from community_csdt.src.models.logout import logout
from community_csdt.src... | electricity345/community.csdt | src/community_csdt/community_csdt/src/models/root.py | Python | mit | 1,622 |
from distutils.core import setup
from os import path
ROOT = path.dirname(__file__)
README = path.join(ROOT, 'README.rst')
setup(
name='hurl',
py_modules=['hurl'],
url='https://github.com/oinopion/hurl',
author='Tomek Paczkowski & Aleksandra Sendecka',
author_email='tomek@hauru.eu',
version='2.... | oinopion/hurl | setup.py | Python | bsd-3-clause | 827 |
import dns.resolver
import random
from time import sleep
def dns_query(search_term):
try:
my_resolver = dns.resolver.Resolver()
# List of public DNS Servers:
# https://www.lifewire.com/free-and-public-dns-servers-2626062
#
my_resolver.nameservers = ['8.8.8.8', '8.8.4.4',... | nethunteros/punter | dns_resolve.py | Python | unlicense | 985 |
# -*- coding: utf-8 -*-
#!/usr/bin/python3
import datetime
from scipy import stats
from HipDynamics.staging import *
class Analysis:
def __init__(self, pref):
self.pref = pref
self.data = []
@property
def pref(self):
return self.__pref
@pref.setter
def pref(self, input):... | KHP-Informatics/sleepsight-analytics | HipDynamics/analysis.py | Python | apache-2.0 | 12,581 |
# -*- coding: utf-8 -*-
import logging
from speaklater import make_lazy_string
from quokka.modules.accounts.models import User
logger = logging.getLogger()
def lazy_str_setting(key, default=None):
from flask import current_app
return make_lazy_string(
lambda: current_app.config.get(key, default)
... | maurobaraldi/quokka | quokka/utils/__init__.py | Python | mit | 714 |
""" Module: IDL:omg.org/CosEventComm:1.0
Automagically generated by:-
The ORB called Fnorb v1.1.Return.of.Fnorb
"""
_FNORB_ID = "IDL:omg.org/CosEventComm:1.0"
# Fnorb modules.
import Fnorb.orb.CORBA
import Fnorb.orb.TypeManager
import Fnorb.orb.Util
class Disconnected(Fnorb.orb.CORBA.UserException):
""" Excep... | mguijarr/hapPyTango | src/hapPyTango/CosEventComm/__init__.py | Python | mit | 7,461 |
#Normalize genotype and combine it with fake phenotype
import csv
import scipy as SP
import pdb
import os
import lmm_lasso
def normalize(l):
count={'A':0,'T':0,'G':0,'C':0}
for c in l:
count[c]+=1
dft=max(count,key=count.get)
r=[]
for c in l:
if c==dft:
r.append(0.0)
... | wuchenxi/lmm_group_lasso | data/normalize_step2.py | Python | gpl-3.0 | 2,000 |
import math
from flask import abort
from mongoengine import QuerySet
from models.forum_model import Category
def forum_template_data(forum):
categories = Category.objects(forum=forum)
return dict(forum_categories=categories)
class Pagination(object):
def __init__(self, iterable, page, per_page):
... | JunctionAt/JunctionWWW | blueprints/forum/forum_util.py | Python | agpl-3.0 | 1,379 |
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^api/', include('entry.urls')),
url(r'^admin/', admin.site.urls),
]
| synasius/playground-react | reaggle/backend/toggle/urls.py | Python | mit | 174 |
import math
class Solution:
# @param num, a list of integer
# @return an integer
def maximumGap(self, num):
if len(num) < 2 or min(num) == max(num):
return 0
a = min(num)
b = max(num)
size = max(1, int(math.ceil((b - a) / (len(num)-1))))
bucket = [[None,... | Crayzero/LeetCodeProgramming | Solutions/Maximum Gap/MaximumGap.py | Python | mit | 1,037 |
#!/usr/bin/python
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
module1 = Extension("openhmd",
["pyopenhmd.pyx", "OpenHMD.cpp"],
language="c++",
libraries=["openhmd"],
include_dirs=['/usr/include/openhmd'])
setup(name = 'openhmd',... | lubosz/python-rift | setup.py | Python | gpl-3.0 | 454 |
# coding: utf-8
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
r = mlab.csv2rec("avg_cpu_100.csv",names=["x","y"])
plt.plot(r["x"],r["y"],label="cpu")
r = mlab.csv2rec("avg_gpu_100.csv",names=["x","y"])
plt.plot(r["x"],r["y"],label="gpu")
plt.legend()
plt.xlabel("Grid size")
plt.ylabel("Run time")
plt.... | dorchard/ypnos | benchmarks/plot.py | Python | bsd-2-clause | 396 |
# 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 ... | v-iam/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/resource_metric_definition_paged.py | Python | mit | 938 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# Original module for stock.move from:
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny... | Micronaet/micronaet-mx8 | mx_sale/model/sale.py | Python | agpl-3.0 | 14,704 |
# -*- coding: utf-8 -*-
#
# gPodder - A media aggregator and podcast client
# Copyright (c) 2005-2010 Thomas Perl and the gPodder Team
#
# gPodder 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... | christofdamian/gpodder | src/gpodder/gtkui/frmntl/episodes.py | Python | gpl-3.0 | 8,787 |
# -*- coding: utf-8 -*-
# Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de>
#
"""
Module implementing a specialized line edit for entering IRC messages.
"""
from __future__ import unicode_literals
from PyQt5.QtCore import Qt, qVersion
from E5Gui.E5LineEdit import E5LineEdit, E5ClearableLineEdit... | davy39/eric | Network/IRC/IrcMessageEdit.py | Python | gpl-3.0 | 4,486 |
from __future__ import absolute_import
import os
import django
from celery import Celery
from django.conf import settings
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'music.settings')
django.setup() # Required for django 1.7+
app = Celery('tasks')
app.config_from_object('django.conf:settings')
app.autodiscover... | kburts/drf-music | Backend/music/celery.py | Python | mit | 359 |
#-*- coding:utf-8 -*-
#
#
# Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# 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, eith... | yvaucher/hr | __unported__/hr_report_manpower/wizard/__init__.py | Python | agpl-3.0 | 845 |
__VERSION__ = '0.5.2'
| sykora/ReSTinPeace | rip/__init__.py | Python | gpl-3.0 | 22 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.