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 thanatos.database import db_utils
from thanatos.database import inventory
from thanatos.database import universe
| evetrivia/thanatos | thanatos/database/__init__.py | Python | mit | 120 |
# Copyright 2015 by Raytheon BBN Technologies Corp. All rights reserved.
import ast
import pyqgl2.importer as importer
from pyqgl2.ast_util import NodeError
from pyqgl2.ast_util import NodeTransformerWithFname
from pyqgl2.ast_util import NodeVisitorWithFname
from pyqgl2.lang import QGL2
class CheckWaveforms(NodeTr... | BBN-Q/pyqgl2 | src/python/attic/check_waveforms.py | Python | apache-2.0 | 6,027 |
"""
pygments.lexers.bare
~~~~~~~~~~~~~~~~~~~~
Lexer for the BARE schema.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, words, bygroups
from pygments.token import Text, Comment, Keywo... | dscorbett/pygments | pygments/lexers/bare.py | Python | bsd-2-clause | 3,045 |
from pudzu.charts import *
df = pd.read_csv("datasets/flagstriband.csv")
df = pd.concat([pd.DataFrame(df.colours.apply(list).tolist(), columns=list("TMB")), df], axis=1).set_index("colours")
FONT, SIZE = calibri, 24
fg, bg = "black", "#EEEEEE"
default_img = "https://s-media-cache-ak0.pinimg.com/736x/0d/36/e7/0d36e7a4... | Udzu/pudzu | dataviz/flagstriband.py | Python | mit | 3,039 |
# Copyright 2016-2019 IBM Corp. 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... | zhmcclient/zhmccli | zhmccli/_cmd_vfunction.py | Python | apache-2.0 | 12,466 |
# -*- coding: utf-8 -*-
u"""Various constant values
:copyright: Copyright (c) 2019 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
# pykern uses pksetup in setup.py so requirements.txt is not yet evalua... | radiasoft/pykern | pykern/pkconst.py | Python | apache-2.0 | 1,085 |
from serialize import *
from shared import *
from gateway import *
from router import *
from transport import *
import asyncio
import websockets
class Test(TransverseObjectInterface):
def __constructor__(a:Int32):
pass
def echo(self, msg:UnicodeString) -> (UnicodeString, Int32):
pass
@implements(Test)
class Test... | disnesquick/ripley | scratch/py/backups/backup-20150509a_WIP/test.py | Python | gpl-2.0 | 3,162 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot implements a blocking review process for de-wiki first.
For other sites this bot script must be changed.
This script is run by [[de:User:xqt]]. It should
not be run by other users without prior contact.
The following parameters are supported:
-
"""
#
# (C) xq... | icyflame/batman | scripts/blockreview.py | Python | mit | 13,624 |
# 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... | pmisik/buildbot | master/buildbot/test/unit/www/test_rest.py | Python | gpl-2.0 | 40,993 |
import json
import logging
import os
import re
import uuid
from collections import OrderedDict, namedtuple
from copy import deepcopy
from django.core.cache import cache
from django.db.models import Max
from django.http import Http404
from django.urls import reverse
from django.utils.translation import ugettext as _
i... | dimagi/commcare-hq | corehq/apps/app_manager/util.py | Python | bsd-3-clause | 25,546 |
import os
import textwrap
from pip._vendor.six.moves.urllib import parse as urllib_parse
from tests.lib import pyversion
def test_find_links_relative_path(script, data):
"""Test find-links as a relative path."""
result = script.pip(
'install',
'parent==0.1',
'--no-index',
'--... | zvezdan/pip | tests/functional/test_install_index.py | Python | mit | 2,332 |
'''
Created on Jan 28, 2013
@author: joseph
'''
import os
lists = os.listdir('D:\Dhole\PtProject\Core\Application\inspector')
for l in lists:
if ".css" in l:
print '<link rel="stylesheet" type="text/css" href="%s">' % l | ptphp/PyLib | src/ptide/getCss.py | Python | apache-2.0 | 237 |
"""Tests for context_processors.active_url_name."""
# pylint: disable=invalid-name
from django.core.urlresolvers import ResolverMatch, Resolver404
from django.test import RequestFactory, TestCase
from mock import patch
from open_connect.context_processors.active_url_name import add_active_url_name
def get_resolver_m... | lpatmo/actionify_the_news | open_connect/context_processors/tests/test_active_url_name.py | Python | mit | 2,399 |
import unittest
from cvra_bootloader.page import *
class PaginationTestCase(unittest.TestCase):
def test_smaller_than_page_is_yielded(self):
"""
Tests that a page smaller than the page size is yielded entierly.
"""
b = bytes([1])
p = slice_into_pages(b, page_size=4)
... | cvra/can-bootloader | client/tests/test_pagination.py | Python | bsd-2-clause | 808 |
#
# Copyright (c) 2016 Kien Ha <kienha9922@gmail.com>
#
# 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... | joostvdg/jenkins-job-builder | tests/modules/test_helpers.py | Python | apache-2.0 | 3,147 |
from .helper import *
import open_cp.gui.predictors.sepp2 as sepp2
import open_cp.gui.predictors.predictor
#import datetime
@pytest.fixture
def analysis_model2(analysis_model):
analysis_model.time_range = (datetime.datetime(2017,5,21,12,30),
datetime.datetime(2017,5,21,13,30), Non... | QuantCrimAtLeeds/PredictCode | tests/gui/predictors/sepp2_test.py | Python | artistic-2.0 | 2,313 |
#
# Brian C. Lane <bcl@redhat.com>
#
# Copyright 2014 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,... | vpodzime/pykickstart | pykickstart/commands/sshkey.py | Python | gpl-2.0 | 3,227 |
"""Tools related tests."""
import sys
import os
import pytest
from mock import Mock
from pyramid.path import package_path
from pyramid.i18n import Localizer
from pyramid.interfaces import ILocalizer
from pyramid_localize import build_localize_config
from pyramid_localize.tools import dummy_autotranslate
from pyramid... | fizyk/pyramid_localize | tests/test_tools.py | Python | mit | 3,013 |
# DESC: Find the sum of the digits in the number 100!
import math
import time
start_time = time.clock()
print(sum(map(int, (list(str(math.factorial(100)))))))
print("--- %s seconds ---" % (time.clock() - start_time))
| Selen93/ProjectEuler | Python/Problem 20/Problem 20.py | Python | mit | 219 |
# -*- coding: utf-8 -*-
from sqlalchemy import func
from sqlalchemy.exc import IntegrityError
from ..core import db
from ..models import UserGroupPermission
def create(user_group_id, permission_id):
user_group_permission = UserGroupPermission(
user_group_id=user_group_id,
permission_id=permission_... | soasme/flask-perm | flask_perm/services/user_group_permission.py | Python | mit | 2,790 |
SQL = """
create index path_index on fsentries(path);
"""
def up(db, conf):
db.executescript(SQL)
| Outernet-Project/fsal | fsal/migrations/fs/02_00_add_path_index.py | Python | gpl-3.0 | 104 |
#!/usr/bin/env python
# http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/
# http://www.travisswicegood.com/2010/01/17/django-virtualenv-pip-and-fabric/
# http://code.djangoproject.com/svn/django/trunk/tests/runtests.py
import os
import sys
# fix sys path so we don't need to setup PYTHONPA... | alanjds/drf-nested-routers | rest_framework_nested/runtests/runtests.py | Python | apache-2.0 | 1,379 |
import logging
import random
from xmodule.x_module import XModule
from xmodule.seq_module import SequenceDescriptor
from lxml import etree
from xblock.fields import Scope, Integer
log = logging.getLogger('mitx.' + __name__)
class RandomizeFields(object):
choice = Integer(help="Which random child was chosen", ... | PepperPD/edx-pepper-platform | common/lib/xmodule/xmodule/randomize_module.py | Python | agpl-3.0 | 3,607 |
# Generated by Django 2.0.6 on 2018-09-23 02:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [("planner", "0026_school_ipeds_id")]
operations = [
migrations.CreateModel(
name="SchoolApplication",
... | mblayman/lcp | conductor/planner/migrations/0027_schoolapplication.py | Python | bsd-2-clause | 1,386 |
from ...WOS.tagProcessing.helpFuncs import getMonth
import re
def year(R):
try:
return int(R['DP'].split(' ')[0])
except ValueError:
yVal = re.search(r'-?\d{1,4}', R['DP'].split(' ')[0])
if yVal is None:
return 0
else:
return(int(yVal.group(0)))
def mon... | networks-lab/metaknowledge | metaknowledge/medline/tagProcessing/specialFunctions.py | Python | gpl-2.0 | 2,128 |
import unittest
import doctest
import random
import atypical
from .metrics import CharMarkov, CharRatio
from .scoring import Scores
class _TestMetric:
def test_untrained(self):
self.assert_empty_scores(['a', 'b', 'c'])
def test_train_empty(self):
self.metric.train([])
self.assert_em... | rectangletangle/atypical | atypical/tests.py | Python | bsd-2-clause | 4,960 |
#!/usr/bin/env python
'''
usage: metadata.py <first.pdf> [<next.pdf> ...]
Creates output.pdf
This file demonstrates two features:
1) Concatenating multiple input PDFs.
2) adding metadata to the PDF.
If you do not need to add metadata, look at subset.py, which
has a simpler interface to PdfWriter.
'''
import s... | kulbirsaini/pdfrw-fork | examples/metadata.py | Python | mit | 783 |
#!/usr/bin/env python
#coding=gbk
import threading
import time, random, sys
class Counter:
def __init__(self):
self.lock = threading.Lock()
self.value = 0
def increment(self):
self.lock.acquire()
self.value = value = self.value + 1
self.lock.release()
return v... | Hpower96/Power | backend/max_threads_test.py | Python | gpl-3.0 | 1,045 |
from django.conf.urls import url
from .viewsets import BookmarkViewSet
bookmark_list = BookmarkViewSet.as_view({
'get': 'list',
'post': 'create'
})
bookmark_detail = BookmarkViewSet.as_view({
'get': 'retrieve',
'patch': 'update',
'delete': 'destroy'
})
urlpatterns = [
url(r'^bookmarks/$', bo... | hnakamur/django-bootstrap-table-example | project/apiv2/urls.py | Python | mit | 430 |
# 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, software
# d... | openstack/heat-translator | translator/hot/tosca/tests/test_tosca_blockstorage.py | Python | apache-2.0 | 3,223 |
#!/usr/bin/python3
#
# Run Anaconda DBus services locally in separate DBus session.
#
# This script is mainly for debugging purpose.
#
import os
import tempfile
import glob
import time
import sys
import shutil
import argparse
from gi.repository import Gio
from pyanaconda.dbus import DBusConnection
from pyanaconda.mod... | vathpela/anaconda | scripts/run_boss_locally.py | Python | gpl-2.0 | 5,841 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wysadzulice', '0002_auto_20160213_1645'),
]
operations = [
migrations.CreateModel(
name='Mail',
fiel... | komitywa/wysadzulice.pl | wysadzulice/migrations/0003_mail.py | Python | mit | 534 |
"""
termcolors.py
"""
from django.utils import six
color_names = ('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white')
foreground = dict((color_names[x], '3%s' % x) for x in range(8))
background = dict((color_names[x], '4%s' % x) for x in range(8))
RESET = '0'
opt_dict = {'bold': '1', 'underscore':... | yceruto/django | django/utils/termcolors.py | Python | bsd-3-clause | 7,357 |
#! /usr/bin/env python
import sys
from binascii import a2b_base64
from random import randint
from AES_128 import AES_128_CBC_decrypt, AES_128_CBC_encrypt, pkcs_7_unpad
def gen_rand_data(length = 16):
return ''.join(chr(randint(0,255)) for i in range(length))
key = gen_rand_data()
iv = gen_rand_data()
def encrypt... | Surufel/Personal | 3.secsif/All/cryptopals-solutions-master/set2/16/oracles.py | Python | agpl-3.0 | 1,486 |
import pyorient.ogm.property
from .element import GraphElement
import pyorient.ogm.what
from .operators import LogicalConnective, ArithmeticOperation
class ArgConverter(object):
"""Convert query function argument to expected string format"""
Label = String = Format = 0
Expression = 1
Field = 2
Ve... | mogui/pyorient | pyorient/ogm/query_utils.py | Python | apache-2.0 | 2,635 |
#
# gPrime - A web-based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2008 Gary Burton
#
# 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 ... | sam-m888/gprime | gprime/plug/menu/_note.py | Python | gpl-2.0 | 1,763 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-09 06:40
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import multisites.utils.image
class Migration(migrations.Migration):
initial = True
dependencies = [
('sites', '000... | dobestan/superpun.ch | superpunch/multisites/migrations/0001_initial.py | Python | mit | 2,478 |
from django.shortcuts import render
from pages.testproj.documents.models import Document
def document_view(request, *args, **kwargs):
context = kwargs
if kwargs.get('current_page', False):
documents = Document.objects.filter(page=kwargs['current_page'])
context['documents'] = documents
if ... | batiste/django-page-cms | pages/testproj/documents/views.py | Python | bsd-3-clause | 577 |
class MockURLOpener(object):
def __init__(self):
self.responses = {}
def add_response(self, url, response):
self.responses[url] = response
def open(self, request):
url = request.get_full_url()
try:
return self.responses[url]
except KeyError:
error_msg = 'Unexpected URL\nRequested... | kylegong/dinklebot | testing/mocks.py | Python | apache-2.0 | 471 |
# encoding: utf-8
"""
The base sampler class implementing various helpful functions.
"""
from __future__ import division
__all__ = ['Sampler']
import numpy as np
try:
import acor
except ImportError:
acor = None
# === Sampler ===
class Sampler(object):
"""
An abstract sampler object that implements... | askielboe/JAVELIN | javelin/emcee_old/sampler.py | Python | gpl-2.0 | 4,069 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
"""
Copyright (C) 2008 Krzysztof Kosyl <krzysztof.kosyl@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(... | kosqx/lilyplayer | lilyplayer/utils/arguments.py | Python | gpl-2.0 | 5,086 |
"""A setup module for the GAPIC Pubsub library.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
import sys
install_requires = [
'googleapis-common-protos>=1.3.5, <2.0.0dev',
'google-gax>=0.14.1, <0.15.0dev',
... | michaelbausor/api-client-staging | generated/python/gapic-google-pubsub-v1/setup.py | Python | bsd-3-clause | 1,555 |
"""
"""
import os, sys
import py
class Checkers:
_depend_on_existence = 'exists', 'link', 'dir', 'file'
def __init__(self, path):
self.path = path
def dir(self):
raise NotImplementedError
def file(self):
raise NotImplementedError
def dotfile(self):
return self.pa... | pexip/os-codespeak-lib | py/_path/common.py | Python | mit | 12,413 |
import asyncio
import base64
import hashlib
import os
import socket
import unittest
import aiohttp
from aiohttp import web, websocket
WS_KEY = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
class TestWebWebSocketFunctional(unittest.TestCase):
def setUp(self):
self.loop = asyncio.new_event_loop()
asyn... | alexsdutton/aiohttp | tests/test_web_websocket_functional.py | Python | apache-2.0 | 12,661 |
from django.core.urlresolvers import reverse
from tests.test_utils import create_generic_job
from treeherder.model.models import JobLog
def test_get_job_log_urls(test_repository, result_set_stored,
failure_classifications,
generic_reference_data, webapp):
job1 ... | kapy2010/treeherder | tests/webapp/api/test_job_log_url_api.py | Python | mpl-2.0 | 1,524 |
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redi... | Eric-Gaudiello/tensorflow_dev | tensorflow_home/tensorflow_venv/lib/python3.4/site-packages/google/protobuf/descriptor_pool.py | Python | gpl-3.0 | 24,386 |
# Copyright (c) 2018 PaddlePaddle 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 app... | chengduoZH/Paddle | python/paddle/fluid/contrib/inferencer.py | Python | apache-2.0 | 3,989 |
import pickle
import orange
import AZBaseClasses
from AZutilities import dataUtilities
import AZOrangeConfig as AZOC
import os
from opencv import ml,cv
class CvBayesLearner(AZBaseClasses.AZLearner):
"""
Creates an opencv Normal Bayes learner derivated from AZBaseClasses.AZLearner.
It only support Classific... | JonnaStalring/AZOrange | azorange/trainingMethods/AZorngCvBayes.py | Python | lgpl-3.0 | 12,157 |
#!/usr/bin/env python
"""
Simple example for an OpenID consumer.
Once you understand this example you'll know the basics of OpenID
and using the Python OpenID library. You can then move on to more
robust examples, and integrating OpenID into your application.
"""
__copyright__ = 'Copyright 2005-2007, Janrain, Inc.'
f... | pombreda/django-hotclub | libs/external_libs/python-openid-2.1.1/examples/consumer.py | Python | mit | 18,300 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.tools import float_round
class AccountCashRounding(models.Model):
"""
In some countries, we need to be able to make appear on an invoice a rounding line, appearing there only because the
smallest coinage has been removed from the c... | Aravinthu/odoo | addons/account/models/account_cash_rounding.py | Python | agpl-3.0 | 2,276 |
#
# Copyright 2013 eNovance
#
# 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, ... | cernops/ceilometer | ceilometer/publisher/test.py | Python | apache-2.0 | 1,480 |
import _plotly_utils.basevalidators
class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self,
plotly_name="ticktextsrc",
parent_name="layout.coloraxis.colorbar",
**kwargs
):
super(TicktextsrcValidator, self).__init__(
plotly_... | plotly/python-api | packages/python/plotly/plotly/validators/layout/coloraxis/colorbar/_ticktextsrc.py | Python | mit | 506 |
#!/usr/bin/env python
#
# Copyright (C) 2020-2021 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file... | multitheftauto/mtasa-blue | vendor/freetype/builds/meson/generate_reference_docs.py | Python | gpl-3.0 | 2,316 |
def kickingSetup(origSkelName, skeletonName, baseJoint, prefix, statePreFix):
blendManager = scene.getBlendManager()
blendKicking = blendManager.createMotionBlendBase(prefix + "Kick", skeletonName, 3)
blendKicking.setBlendSkeleton(skeletonName)
originalMotions = StringVec()
originalMotions.append( "ChrGar... | gsi-upm/SmartSim | smartbody/data/behaviorsets/kicking/scripts/stateKicking.py | Python | apache-2.0 | 4,269 |
from mezzanine.conf import settings
from mezzanine.core.fields import MultiChoiceField
class MenusField(MultiChoiceField):
"""
``MultiChoiceField`` for specifying which menus a page should
appear in.
"""
def __init__(self, *args, **kwargs):
choices = [t[:2] for t in settings.PAGE_MENU_TE... | westinedu/similarinterest | mezzanine/pages/fields.py | Python | bsd-3-clause | 1,080 |
# coding=utf-8
"""Docstring for this file."""
__author__ = 'ismailsunni'
__project_name = 'watchkeeper'
__filename = 'commons'
__date__ = '5/4/15'
__copyright__ = 'imajimatika@gmail.com'
__doc__ = ''
def get_verbose_name(model_class, field_name):
"""Return verbose name of a field from a model class.
:param m... | MariaSolovyeva/watchkeeper | django_project/event_mapper/utilities/commons.py | Python | bsd-2-clause | 1,140 |
from multihash import SHA1, SHA2_256, SHA2_512, SHA3, BLAKE2B, BLAKE2S, \
decode, encode, is_valid_code, is_app_code
| mediachain/mediachain-client | multihash/__init__.py | Python | mit | 121 |
"""
This module extends the Destination class to work with a MySQL database.
"""
import sys
import mysql.connector
from mysql.connector import errorcode
from origin.server import Destination
from origin import data_types, TIMESTAMP
class MySQLDestination(Destination):
'''A class for storing data in a MySQL dat... | Orthogonal-Systems/Origin | lib/origin/server/origin_mysql_destination.py | Python | gpl-3.0 | 11,317 |
import datetime
import decimal
import json
from django.utils import simplejson
from django.utils.timezone import is_aware
from djangorestframework.renderers import DefaultRenderers, BaseRenderer, \
JSONRenderer, JSONPRenderer
from djangorestframework.utils.mediatypes import get_media_type_params
__all__ = ['NoMicr... | pombredanne/djangorestframework_extensions | djangorestframework_extensions/renderers.py | Python | bsd-2-clause | 3,193 |
import re
import ckan.logic as logic
import ckan.lib.base as base
import ckan.plugins.toolkit as toolkit
from ckan.plugins.toolkit import _, request, c
import ckan.lib.helpers as h
import ckan.logic as logic
from ckan.controllers.package import PackageController
import ckan.model as model
NotFound = logic.... | abgov/ckanext-workflow | ckanext/workflow/controllers/actions_multiple_datasets_controller.py | Python | agpl-3.0 | 8,663 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | chetan51/nupic | examples/opf/tools/dataGenerationTool.py | Python | gpl-3.0 | 14,867 |
import autograd.numpy as np
import numpy.linalg as la
from theano import tensor as T
import pymanopt
from pymanopt.manifolds import FixedRankEmbedded
from pymanopt.solvers import ConjugateGradient
def main():
# Let A be a (5 x 4) matrix to be approximated
A = np.random.randn(5, 4)
k = 2
# (a) Instan... | nkoep/pymanopt | examples/low_rank_matrix_approximation.py | Python | bsd-3-clause | 2,077 |
# -*- coding: utf-8 -*-
"""Transport handlers."""
from __future__ import unicode_literals
from django.db.models import signals
from django.dispatch import receiver
from modoboa.core import signals as core_signals
from . import backends, models, postfix_maps
@receiver(core_signals.register_postfix_maps)
def regist... | tonioo/modoboa | modoboa/transport/handlers.py | Python | isc | 726 |
#!/usr/bin/env python
from gnuradio import gr, gru, eng_notation
from gnuradio import usrp
from gnuradio.eng_option import eng_option
from gnuradio import eng_notation
from gnuradio import optfir
from optparse import OptionParser
from gnuradio.wxgui import stdgui, fftsink, waterfallsink, scopesink, form, slider
import... | trnewman/VT-USRP-daughterboard-drivers_python | gnuradio-examples/python/multi-antenna/multi_scope.py | Python | gpl-3.0 | 4,845 |
#! /usr/bin/env python
import os
from setuptools import setup, find_packages
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except IOError:
return ''
setup(
name='djpl-users',
version='0.1',
description='User functionality beyond admin us... | tonimichel/djpl-users | setup.py | Python | mit | 1,092 |
from __future__ import print_function
import pickle, os, sys, glob, hashlib
from sklearn.ensemble import RandomForestClassifier
import pandas as pd
test_files = set(pd.read_csv('./data/sampleSubmission_v2.csv').file.values)
train = pd.read_csv('./data/train_v2.csv')
df_full = pickle.load(open( "df_full.p", "rb"))
... | carlsonp/kaggle-TrulyNative | scikit_generate_prediction2.py | Python | gpl-3.0 | 1,784 |
from app import Handler
from handlers.auth import Auth
class LogoutHandler(Handler):
def get(self):
Auth.logout(self.response)
self.redirect("/")
| diegopettengill/multiuserblog | handlers/logout.py | Python | mit | 168 |
# encoding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import unittest
from datetime import timedelta
from decimal import Decimal
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.utils... | antonyr/django-haystack | test_haystack/whoosh_tests/test_whoosh_backend.py | Python | bsd-3-clause | 45,377 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (c) 2010 kazacube (http://kazacube.com).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | OpusVL/odoo | addons/l10n_ma/__openerp__.py | Python | agpl-3.0 | 2,087 |
from __future__ import absolute_import, print_function
import base64
import logging
import six
import traceback
from time import time
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.http... | gencer/sentry | src/sentry/web/api.py | Python | bsd-3-clause | 26,313 |
class Some:
pass
s1 = Some()
s2 = Some()
print (s1 == s2)
s3 = s1
print (s1 == s3)
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __setattr__(self, name, value):
if not name in self.__dict__:
self.__dict__[name] = value
elif name == 'x' ... | SidChen2012/python3 | basic/eq.py | Python | mit | 1,480 |
from .exceptions import AlreadyRegistered, NotRegistered
from .signals import content_required, existence_required, source_saved
from .utils import autodiscover, call_strategy_method
class GeneratorRegistry(object):
"""
An object for registering generators. This registry provides
a convenient way for a di... | Amechi101/concepteur-market-app | venv/lib/python2.7/site-packages/imagekit/registry.py | Python | mit | 6,755 |
from nose.tools import eq_
def compare_extraction(extractor, examples, counter_examples,
lwrap="", rwrap=""):
for example in examples:
wrapped = lwrap + example + rwrap
eq_(extractor.process(wrapped), [example])
eq_(extractor.process("Sentence " + wrapped + " sandwi... | yafeunteun/wikipedia-spam-classifier | revscoring/revscoring/languages/tests/util.py | Python | mit | 821 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Service abstraction.
#
# Liang Wang @ Computer Lab, Cambridge University
# 2015.06.15
class Service():
__slots__ = ['name', 'locator', 'status']
pass
| ryanrhymes/scandex | service.py | Python | mit | 210 |
#
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2017, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
from pyasn1 import error
from pyasn1.codec.ber import decoder
from pyasn1.compat.octets import oct2int
from pyasn1.type import univ
__all__ = ['decode']
class B... | catapult-project/catapult | third_party/gsutil/third_party/pyasn1/pyasn1/codec/cer/decoder.py | Python | bsd-3-clause | 3,718 |
import pytest
import rules
from adhocracy4.polls import phases
from adhocracy4.projects.enums import Access
from adhocracy4.test.helpers import freeze_phase
from adhocracy4.test.helpers import freeze_post_phase
from adhocracy4.test.helpers import freeze_pre_phase
from adhocracy4.test.helpers import setup_phase
from ad... | liqd/adhocracy4 | tests/polls/rules/test_rules_add_vote.py | Python | agpl-3.0 | 5,477 |
from joblib import Parallel, delayed
import multiprocessing
import psycopg2
import sys
import numpy as np
import scipy.stats # Para o kernel density estimation
import cgi, cgitb
cgitb.enable() # debug
data = cgi.FieldStorage()
latitude = []
longitude = []
dataFromPHP = ""
try:
dataFromPHP = sys.argv[1]
exce... | raulsenaferreira/W-SAGE | scripts/kde.py | Python | gpl-2.0 | 1,624 |
#-*- encoding: utf-8 -*-
class Watcher():
# Metodo constructor, seteos basicos necesarios de configuracion
def __init__(self):
self.initials = {'arg': 'Argentina', 'bo': 'Bolivia', 'pe': 'Peru'}
self.regions = [{'enabled': True, 'region_id': 1, 'country_name': 'Argentina', 'country_initial': 'arg', 'region_na... | CPedrini/TateTRES | watcher.py | Python | apache-2.0 | 1,477 |
from django.db import models
from tinymce.models import HTMLField
from sorl import thumbnail
from products.models import Product
class ProductContent(models.Model):
product_body = HTMLField(default='')
def __unicode__(self):
return 'Product content'
class FooterContent(models.Model):
contact_... | Socialsquare/verellen.biz | verellen/content/models.py | Python | mit | 2,018 |
#!/usr/bin/python2
from conf import *
import socket
import os
from threading import Thread
import time
def get_cookie(request_lines):
#print("cookie data is: " + request_lines[-3])
data = request_lines[-3].split(":")[-1]
return (data.split("=")[-1])
def error_404(addr,request_words):
print("File not ... | aadarshkarumathil/Webserver | webserver.py | Python | gpl-3.0 | 10,173 |
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
... | kustodian/ansible | lib/ansible/modules/cloud/amazon/aws_caller_info.py | Python | gpl-3.0 | 3,882 |
"""Tests for the basic ABCs implemented.
"""
import pytest
from packaging.requirements import Requirement
from packaging.version import Version
from tests.lib.yaml.abcs import YAMLCandidate, YAMLProvider
# Shorthands for writing tests
def can(arg, extras=None):
kwargs = {}
kwargs["name"], kwargs["version"] ... | pradyunsg/zazo | tests/lib/test_abcs.py | Python | mit | 4,809 |
__author__ = 'don'
import xmltodict
import geojson
import json
from datetime import datetime
from collections import OrderedDict
from operator import attrgetter
with open('inspections.xml') as fd:
obj = xmltodict.parse(fd.read())
features = []
for business in obj['Business_Inspection_Violation']['Business']:
... | dsmyth/seattlehealthgeojson | inspections.py | Python | apache-2.0 | 1,697 |
#!/usr/bin/env python
# (c) 2014, Timothy Vandenbrande <timothy.vandenbrande@gmail.com>
#
# 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 Lic... | cmvelo/ansible-modules-extras | windows/win_firewall_rule.py | Python | gpl-3.0 | 3,145 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Yanis Guenane <yanis+ansible@guenane.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_v... | kvar/ansible | lib/ansible/modules/crypto/openssl_privatekey.py | Python | gpl-3.0 | 28,158 |
import pytest
from github3 import AuthenticationFailed, GitHubError
from github3.github import GitHub
from .helper import UnitHelper, UnitIteratorHelper
def url_for(path=''):
"""Simple function to generate URLs with the base GitHub URL."""
return 'https://api.github.com/' + path.strip('/')
class TestGitHu... | itsmemattchung/github3.py | tests/unit/test_github.py | Python | bsd-3-clause | 32,206 |
from django.db import models
from django.contrib.auth.models import User
from eveonline.models import EveCorporationInfo
from eveonline.models import EveCharacter
class HRApplication(models.Model):
character_name = models.CharField(max_length=254, default="")
full_api_id = models.CharField(max_length=254, de... | RZN-FFEvo/corpauth | hrapplications/models.py | Python | gpl-2.0 | 1,473 |
# This file is part of Viper - https://github.com/botherder/viper
# See the file 'LICENSE' for copying permission.
import itertools
from viper.common.abstracts import Module
from viper.core.session import __sessions__
from viper.core.database import Database
class Editdistance(Module):
cmd = 'editdistance'
... | jorik041/viper | modules/editdistance.py | Python | bsd-3-clause | 2,030 |
# -*- coding: utf-8 -*-
from PIL import Image
import numpy
# Naredimo random array vrednosti od 0-255 dimenzij 800x800x3 in spremenimo tip
# na uint8 (to je en byte, toliko rabimo za opis barve, od 0 - 255).
# S tem torej naredimo sliko velikosti 800x800 pikslov, ki ima RGB barve. Če bi
# želeli RGBA (še transparentn... | KrozekGimVic/2013-Fraktali | numpy_pillow_example.py | Python | mit | 1,069 |
# -*- coding: utf-8 -*-
from ome.loading.model_loading import load_model
from ome.loading.component_loading import load_genome
from ome.loading import AlreadyLoadedError
from ome import base
from ome.models import *
from ome.components import *
from ome import settings
from sqlalchemy.orm import aliased
from sqlalche... | aebrahim/ome | ome/loading/model_loading/tests/test_load.py | Python | mit | 13,161 |
import os
import sys
try:
import vidcap
from roam.editorwidgets import VideoCapture as vc
hascamera = True
except ImportError:
hascamera = False
from PyQt4.QtGui import QDialog, QGridLayout, QLabel, QLayout, QPixmap, QFileDialog, QAction, QToolButton, QIcon, \
QToolBar
from PyQt4.QtGui import QWi... | lmotta/Roam | src/roam/editorwidgets/imagewidget.py | Python | gpl-2.0 | 8,876 |
"""
Base urls file.
"""
from django.conf import settings as s
from django.conf.urls import patterns, include, url
from django.contrib import admin
import os
ADMIN_DIR = os.path.dirname(os.path.abspath(admin.__file__))
urlpatterns = patterns('',
url(r'^$', 'core.views.views.index', name='index'),
url(r'^apropo... | redhat-cip/numeter | web-app/numeter_webapp/web_app/urls.py | Python | agpl-3.0 | 1,928 |
#!/usr/bin/env python
#Sahar Massachi for wikimedia
#GPL3
#April 23 - May 20, 2013
#Given
# 1. the downloaded google doc with tests to run reports for
# 2. the downloaded TBBV file
# 3. the downloaded screenshot file
#Output:
# A. SQL queries for banners, landing, and donors (*.sql)
# B. Rows to append t... | Sayhar/wiki-crunch | executable/.parseForm.py | Python | agpl-3.0 | 12,858 |
def get_ip_address(request):
ip_address = request.META.get('HTTP_X_FORWARDED_FOR')
if ip_address:
return ip_address.split(',')[-1]
return request.META.get('REMOTE_ADDR')
| jessamynsmith/boards-backend | blimp_boards/utils/request.py | Python | agpl-3.0 | 192 |
from . import test_street_3
| brain-tec/partner-contact | partner_address_street3/tests/__init__.py | Python | agpl-3.0 | 28 |
# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0:
# License: GPL2 or later see COPYING
# Written by Michael Brown
# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net>
import logging
import os
import sys
import types
import inspect
import functools
try:
basestring
except N... | nbartos/mock | py/mockbuild/trace_decorator.py | Python | gpl-2.0 | 4,987 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache/incubator-airflow | tests/providers/amazon/aws/operators/test_sagemaker_training.py | Python | apache-2.0 | 6,205 |
"""hello world"""
XXX = 'myglobal' ## this is a static string
def myprint( a:string, b:string ):
print a + b
def main():
print "hi"
myprint('hello ', 'world')
## TODO - should this automatically be converted from a static string to a String with `String.from_str()`
myprint('hi ', str(XXX) ) | pombredanne/Rusthon | regtests/go/print.py | Python | bsd-3-clause | 302 |
'''a module to define a cache class for pictures'''
# -*- coding: utf-8 -*-
# This file is part of emesene.
#
# emesene 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 Licen... | emesene/emesene | emesene/e3/cache/PictureCache.py | Python | gpl-3.0 | 4,793 |
# Copyright 2015 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... | jwlawson/tensorflow | tensorflow/python/keras/_impl/keras/layers/__init__.py | Python | apache-2.0 | 2,093 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.