text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from sys import exit
import numpy as np
np.random.seed(4) # chosen by fair dice roll. guaranteed to be random.
from sklearn.linear_model import LinearRegression, LassoCV
from sklearn.pipeline import Pipeline
from plotypus.preprocessing import Fourier
from plotypus.utils import colvec
from plotypus.resources import matp... | astroswego/plotypus | test/demo.py | Python | gpl-3.0 | 2,337 | 0.012409 |
from kik.resource import Resource
class Attribution(Resource):
"""
Parent class for all attribution types
"""
pass
class CustomAttribution(Attribution):
"""
Attribution class for custom attributions, as documented at `<https://dev.kik.com/#/docs/messaging#attribution>`_
Usage:
>>> ... | kikinteractive/kik-python | kik/messages/attribution.py | Python | mit | 1,812 | 0.001104 |
# -*- coding: utf-8 -*-
from .auto_slug import (
AutoSlugPopulateFromModel, AutoSlugModel,
AutoSlugDefaultModel, AutoSlugBadPopulateFromModel
)
from .task_result import TaskResultModel
__all__ = [
'AutoSlugPopulateFromModel', 'AutoSlugModel',
'AutoSlugDefaultModel', 'AutoSlugBadPopulateFromModel',
... | nitely/Spirit | spirit/core/tests/models/__init__.py | Python | mit | 341 | 0 |
"""
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print(df.format('jS F Y H:i'))
7th October 2003 11:39
>>>
"""
import calendar
import datetime
from email.utils import format_datetime as format_datet... | atul-bhouraskar/django | django/utils/dateformat.py | Python | bsd-3-clause | 10,213 | 0.001175 |
def glTypesNice(types):
"""Make types into English words"""
return types.replace('_',' ').title()
def getLatLong(latitude, longitude):
"""returns the combination of latitude and longitude as required for ElasticSearch"""
return latitude+", "+longitude | rajagopal067/testrepo | karma/python/google.py | Python | apache-2.0 | 258 | 0.031008 |
# Copyright (C) 2016 Universidad Politecnica de Madrid
#
# 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 la... | ging/keystone | keystone/contrib/oauth2/migrate_repo/versions/009_support_postgresql.py | Python | apache-2.0 | 3,936 | 0.002541 |
class Solution(object):
def searchMatrix(self, matrix, target):
"""
:type matrix: List[List[int]]
:type target: int
:rtype: bool
"""
m, n = len(matrix), len(matrix[0]) if matrix else 0
l, r = 0, m * n - 1
while l <= r:
mid = (l + r) / 2
... | zqfan/leetcode | algorithms/74. Search a 2D Matrix/solution.py | Python | gpl-3.0 | 543 | 0.003683 |
# linearizedGP -- Implementation of extended and unscented Gaussian processes.
# Copyright (C) 2014 National ICT Australia (NICTA)
#
# This file is part of linearizedGP.
#
# linearizedGP is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by... | NICTA/linearizedGP | linearizedGP/gputils.py | Python | gpl-3.0 | 4,822 | 0 |
# 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... | kevin-coder/tensorflow-fork | tensorflow/python/keras/regularizers_test.py | Python | apache-2.0 | 3,702 | 0.005673 |
from django.db import models
# Create your models here.
class Record(models.Model):
description=models.TextField()
distance=models.IntegerField()
reg_date=models.DateTimeField('date published')
reg_user=models.IntegerField()
| speedyGonzales/RunTrainer | record/models.py | Python | gpl-3.0 | 244 | 0.02459 |
# -*- 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):
# Adding model 'NoticeQueueBatch'
db.create_table('notification_noticequeuebatch', (
('id', self... | arctelix/django-notification-automated | notification/migrations/0004_auto__add_noticequeuebatch.py | Python | mit | 7,050 | 0.007801 |
# -*- coding: utf-8 -*-
class ResourceOptions(object):
"""
A configuration class for ``Resource``.
Provides sane defaults and the logic needed to augment these settings with
the internal ``class Meta`` used on ``Resource`` subclasses.
"""
allowed_methods = ['get', 'post', 'put', 'delete', 'pat... | codeboy/coddy-sitetools | sitetools/coddy_api/api_resource.py | Python | bsd-3-clause | 1,729 | 0.001157 |
import re
import time
import urlparse
import requests
from flask import Blueprint, Response, abort, stream_with_context, request, url_for, jsonify, current_app
from labmanager.db import db
from labmanager.models import AllowedHost
proxy_blueprint = Blueprint('proxy', __name__)
WHITELIST_REQUEST_HEADERS = ["Accept-L... | labsland/labmanager | labmanager/views/proxy.py | Python | bsd-2-clause | 7,224 | 0.007198 |
#! /usr/local/bin/python
"""Script for producing a RASPP curve: the average disruption (energy)
and average mutation of libraries that have the lowest average energy
given constraints on fragment length.
******************************************************************
Copyright (C) 2005 Allan Drummond, Cali... | mattasmith/SCHEMA-RASPP | rasppcurve.py | Python | gpl-3.0 | 7,335 | 0.022904 |
import httplib as http
from dataverse import Connection
from dataverse.exceptions import ConnectionError, UnauthorizedError, OperationFailedError
from framework.exceptions import HTTPError
from addons.dataverse import settings
from website.util.sanitize import strip_html
def _connect(host, token):
try:
... | aaxelb/osf.io | addons/dataverse/client.py | Python | apache-2.0 | 3,545 | 0.001975 |
#common exception types
ArrayOOB = 'java/lang/ArrayIndexOutOfBoundsException', 0
ArrayStore = 'java/lang/ArrayStoreException', 0
ClassCast = 'java/lang/ClassCastException', 0
MonState = 'java/lang/IllegalMonitorStateException', 0
NegArrSize = 'java/lang/NegativeArraySizeException', 0
NullPtr = 'java/lang/NullPointerExc... | sahilshekhawat/ApkDecompiler | javadecompiler/Krakatau/ssa/excepttypes.py | Python | gpl-2.0 | 368 | 0.005435 |
from django import forms
from django.utils.translation import ugettext_lazy as _
from .models import Invitation
class InvitationForm(forms.ModelForm):
class Meta:
model = Invitation
fields = ('email', 'text')
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user', None)
... | thoas/django-fairepart | fairepart/forms.py | Python | mit | 787 | 0.002541 |
"""
Created on June 10, 2012
@author: peta15
"""
from wtforms import fields
from wtforms import Form
from wtforms import validators
from lib import utils
from webapp2_extras.i18n import lazy_gettext as _
from webapp2_extras.i18n import ngettext, gettext
FIELD_MAXLENGTH = 50 # intended to stop maliciously long input
... | roninio/gae-boilerplate | boilerplate/forms.py | Python | lgpl-3.0 | 5,505 | 0.00545 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-12-06 02:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('season', '0003_auto_20161206_0216'),
]
operations = [
migrations.AddField(
... | biddellns/litsl | season/migrations/0004_groupround_schedule_is_set.py | Python | gpl-3.0 | 464 | 0 |
from __future__ import absolute_import, print_function
import os
import logging
from topik.intermediaries.raw_data import output_formats
# imports used only for doctests
from topik.tests import test_data_path
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s',
level=logging.... | kcompher/topik | topik/readers.py | Python | bsd-3-clause | 15,758 | 0.004823 |
from holodeck.settings import *
import os
import sys
# Django settings for Holodeck project.
PATH = os.path.split(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]))))[0]
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
# Local time zone for t... | shaunsephton/holodeck | holodeck/django_settings.py | Python | bsd-3-clause | 5,258 | 0.000761 |
#The new version is in polishNotation2.py. Use that version instead of using this version.
#To do:
#Find out how to split a string using matches of a regular expression as the separator.
#Test everything in polyglotCodeGenerator.py
#Use re.match(expr, stringToSplit).groups() to split a string with its paramet... | jarble/EngScript | libraries/polishNotation.py | Python | mit | 14,320 | 0.023673 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import controllers
from . import models
from . import wizard
from . import report
| t3dev/odoo | addons/event/__init__.py | Python | gpl-3.0 | 189 | 0 |
#procesamiento digital de senales
#universidad santiago de cali
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('tools/')
from fourierFunc import fourierAn
from scipy.signal import get_window
##########################################
#BLOQUE 1
#definir la frecue... | miltonsarria/dsp-python | filters/ex2/ejemplo_window.py | Python | mit | 1,773 | 0.038917 |
import pytest
from drivers.keysight11713C import *
@pytest.mark.skip
def test_set_get():
attenuator = Keysight11713C("swc1", "Y")
for i in range(82):
attenuator.set_attenuation(i)
assert i == attenuator.get_attenuation()
| vdrhtc/Measurement-automation | tests/test_keysight11713C.py | Python | gpl-3.0 | 249 | 0.004016 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUME... | Jorge-Rodriguez/ansible | lib/ansible/modules/cloud/ovirt/ovirt_disk.py | Python | gpl-3.0 | 29,884 | 0.002577 |
#!/usr/bin/env python
# -- Content-Encoding: UTF-8 --
"""
Pelix interactive shell
Provides a console interface for the Pelix shell, based on readline when
available.
:author: Thomas Calmant
:copyright: Copyright 2020, Thomas Calmant
:license: Apache License 2.0
:version: 1.0.1
..
Copyright 2020 Thomas Calmant
... | tcalmant/ipopo | pelix/shell/console.py | Python | apache-2.0 | 20,364 | 0.000049 |
import sys
from copy import deepcopy
from math import sqrt
def read_num():
return list(map(int, sys.stdin.readline().split()))
def read_sudoku():
try:
n = read_num()
if not n:
n = read_num()
n = n[0]
return [read_num() for _ in range(n*n)]
except Exception:
... | secnot/uva-onlinejudge-solutions | 989 - Su Doku/main.py | Python | mit | 2,568 | 0.005062 |
import os;
import sys;
import traceback;
#####################################################################
## Update Thread Pool size
#####################################################################
def configureThreadPool(clusterName, threadPoolName, minSize, maxSize):
print "Cluster Name = " + ... | muthu-s/chef-repo | cookbooks/wsi/files/configurethreadpool.py | Python | apache-2.0 | 1,835 | 0.012534 |
"""ShutIt module. See http://shutit.tk
"""
from shutit_module import ShutItModule
class ruby(ShutItModule):
def build(self, shutit):
shutit.send('mkdir -p /tmp/build/ruby')
shutit.send('cd /tmp/build/ruby')
shutit.send('wget -qO- http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz | tar -zxf -')
shut... | ianmiell/shutit-distro | ruby/ruby.py | Python | gpl-2.0 | 863 | 0.040556 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 VMware, Inc.
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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
# ... | ntt-sic/nova | nova/virt/vmwareapi/network_util.py | Python | apache-2.0 | 7,362 | 0.002309 |
##############################################################################
#
# Copyright (C) 2014 Comunitea Servicios Tecnológicos All Rights Reserved
# $Kiko Sánchez <kiko@comunitea.com>$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gen... | Comunitea/CMNT_004_15 | project-addons/product_outlet_loss/models/product.py | Python | agpl-3.0 | 1,853 | 0.00054 |
# Copyright 2020 Open Source Robotics Foundation, 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... | ros2/launch | launch/launch/conditions/launch_configuration_equals.py | Python | apache-2.0 | 2,600 | 0.001923 |
# -*- coding: utf-8 -*-
# ###
# Copyright (c) 2013-2016, Rice University
# This software is subject to the provisions of the GNU Affero General
# Public License version 3 (AGPLv3).
# See LICENCE.txt for details.
# ###
from pyramid import httpexceptions
from pyramid.view import view_config
from ..db import poke_publica... | Connexions/cnx-publishing | cnxpublishing/views/moderation.py | Python | agpl-3.0 | 3,154 | 0 |
import functools
import operator
import unittest
from itertools import count
from scrapy.utils.python import str_to_unicode, unicode_to_str, \
memoizemethod_noargs, isbinarytext, equal_attributes, \
WeakKeyCache, stringify_dict, get_func_args
__doctests__ = ['scrapy.utils.python']
class UtilsPythonTestCase(u... | ofanoyi/scrapy | scrapy/tests/test_utils_python.py | Python | bsd-3-clause | 6,570 | 0.001218 |
from setuptools import setup
from chaosproxy.chaosproxy import __version__
setup(
name='ChaosProxy',
version=__version__,
description='ChaosProxy is an http 1.0 proxy / forward server that creates unstable connections.',
url='http://github.com/mcmartins/chaosproxy',
author='Manuel Martins',
aut... | mcmartins/chaosproxy | setup.py | Python | mit | 564 | 0.001773 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | BackupTheBerlios/espressopp | src/esutil/NormalVariate.py | Python | gpl-3.0 | 1,470 | 0.009524 |
"""
Each store has slightly different semantics wrt draft v published. XML doesn't officially recognize draft
but does hold it in a subdir. Old mongo has a virtual but not physical draft for every unit in published state.
Split mongo has a physical for every unit in every state.
Given that, here's a table of semantics... | UQ-UQx/edx-platform_lti | common/lib/xmodule/xmodule/modulestore/xml_importer.py | Python | agpl-3.0 | 40,861 | 0.002007 |
from dec.grid1 import *
import matplotlib.pyplot as plt
N = 4
#g = Grid_1D.periodic(N)
g = Grid_1D.regular(N)
#g = Grid_1D.chebyshev(N)
z = linspace(g.xmin, g.xmax, 100) #+ 1e-16
B0, B1, B0d, B1d = g.basis_fn()
H0, H1, H0d, H1d = hodge_star_matrix(g.projection(), g.basis_fn())
H1d = linalg.inv(H0)
#polynomial fit
#d... | drufat/dec | doc/plot/cheb/basis_forms.py | Python | gpl-3.0 | 1,067 | 0.008435 |
# -*- coding: utf-8 -*-
#
# Thumbor documentation build configuration file, created by
# sphinx-quickstart on Mon Sep 1 13:18:38 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.
#
# A... | thumbor-community/shortener | docs/conf.py | Python | mit | 8,491 | 0.005889 |
class _Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(_Singleton, cls).__call__(
*args, **kwargs)
return cls._instances[cls]
class Singleton(_Singleton('SingletonMeta', (object,), {})):... | ssut/PushBank | pushbank/_singleton.py | Python | mit | 330 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2017 Anki, 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 in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | manxueitp/cozmo-test | object_recognition/04_exposure.py | Python | mit | 4,967 | 0.001812 |
class __ConfigBus(object):
def __init__(self):
"""Private object *_ConfigBus* provides private functions for various config classes.
"""
self.conf = 'eems.conf'
def _read(self):
"""Private function *_read* reads the eems.conf file and returns all lines.
:return: *l... | enricoba/eems-box | configbus.py | Python | mit | 2,756 | 0.003266 |
from horizon import tables
from tasa.store import connection
class RestartWorker(tables.Action):
name = 'restart'
verbose_name = 'Restart Worker'
data_type_singular = 'Worker'
action_present = 'restart'
requires_input = False
classes = ('btn-warning',)
def handle(self, data_table, reques... | jorik041/shmoocon_2014_talk | caravan/caravan/dashboards/infrastructure/workers/tables.py | Python | bsd-2-clause | 977 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2016_12_01/models/flow_log_information_py3.py | Python | mit | 2,020 | 0.00099 |
#!/usr/bin/env python
import os.path as path
import sys
root=path.abspath(path.dirname(__file__))
sys.path.insert(0,root)
| stiletto/bnw | bnw_shell.py | Python | bsd-2-clause | 122 | 0.016393 |
import sqlite3
import shutil
import win32crypt
import sys, os, platform
class Chrome():
def __init__(self):
pass
def run(self):
database_path = ''
if 'HOMEDRIVE' in os.environ and 'HOMEPATH' in os.environ:
# For Win7
path_Win7 = os.environ.get('HOMEDRIVE') + o... | mehulj94/Radium-Keylogger | Recoveries/chrome.py | Python | apache-2.0 | 2,142 | 0.010271 |
"""
Tests for Blocks api.py
"""
from django.test.client import RequestFactory
from course_blocks.tests.helpers import EnableTransformerRegistryMixin
from student.tests.factories import UserFactory
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestC... | antoviaque/edx-platform | lms/djangoapps/course_api/blocks/tests/test_api.py | Python | agpl-3.0 | 2,533 | 0.003158 |
import structlog
from more_itertools import chunked
from rache import delete_job, scheduled_jobs
from . import SentryCommand
from ...models import UniqueFeed
from ....utils import get_redis_connection
logger = structlog.get_logger(__name__)
class Command(SentryCommand):
"""Syncs the UniqueFeeds and the schedule... | feedhq/feedhq | feedhq/feeds/management/commands/sync_scheduler.py | Python | bsd-3-clause | 1,310 | 0 |
# coding: utf-8
import re, time, hashlib, logging, json, functools
from leancloud import Object
from leancloud import User
from leancloud import Query
from leancloud import LeanCloudError
from flask import request
from flask import make_response
from flask import session
from develop.models import Blog, Comments, Pa... | autorealm/MayoiNeko | develop/apis.py | Python | apache-2.0 | 9,771 | 0.005366 |
__author__ = 'Schmidtz'
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from numpy import matlib
from numpy import *
from numpy.random import *
import pylab as p
import math
from scipy import sta... | jminyu/PatternRecognition_library | Data_generation.py | Python | gpl-3.0 | 2,150 | 0.012093 |
# -*- coding: utf-8 -*-
from modules import Robot
import time
r = Robot.Robot()
state = [0, 1000, 1500]
(run, move, write) = range(3)
i = run
slowdown = 1
flag_A = 0
flag_C = 0
lock = [0, 0, 0, 0]
while(True):
a = r.Read()
for it in range(len(lock)):
if lock[it]:
lock[it] = lock[it] - 1
... | KMPSUJ/lego_robot | pilot.py | Python | mit | 4,781 | 0.001884 |
import numpy as np
import pandas as pd
# from matplotlib.pyplot import plot,show,draw
import scipy.io
import sys
sys.path.append("../")
from functions import *
from pylab import *
from sklearn.decomposition import PCA
import _pickle as cPickle
import matplotlib.cm as cm
import os
#####################################... | gviejo/ThalamusPhysio | python/figure_talk/main_talk_7_corr.py | Python | gpl-3.0 | 14,903 | 0.034825 |
#! coding: utf-8
import re
from urllib import quote
from urlparse import urlsplit, urlunsplit
TRAILING_PUNCTUATION = ['.', ',', ':', ';', '.)']
WRAPPING_PUNCTUATION = [('(', ')'), ('<', '>'), ('[', ']'), ('<', '>')]
unquoted_percents_re = re.compile(r'%(?![0-9A-Fa-f]{2})')
word_split_re = re.compile(r'(\s+)')
... | juposocial/jupo | src/lib/url.py | Python | agpl-3.0 | 2,529 | 0.016607 |
def load_keys(filepath):
"""
Loads the Twitter API keys into a dict.
:param filepath: file path to config file with Twitter API keys.
:return: keys_dict
:raise: IOError
"""
try:
keys_file = open(filepath, 'rb')
keys = {}
for line in keys_file:
key, value =... | nhatbui/LebronCoin | lebroncoin/key_loader.py | Python | mit | 654 | 0.001529 |
#!/bin/env python2.7
# -*- coding: utf-8 -*-
# This file is part of EPlatform.
#
# EPlatform 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 ... | bjura/EPlatform | EMatch.py | Python | gpl-3.0 | 18,227 | 0.038094 |
#!/usr/bin/env python
# Copyright 2018 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-speech | samples/snippets/transcribe_enhanced_model.py | Python | apache-2.0 | 2,170 | 0.000461 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
from odoo.tools.safe_eval import safe_eval
class AccountTaxPython(models.Model):
_inherit = "account.tax"
amount_type = fields.Selection(selection_add=[('code', 'Python Cod... | t3dev/odoo | addons/account_tax_python/models/account_tax.py | Python | gpl-3.0 | 4,229 | 0.010877 |
# -*- coding: utf-8 -*-
from gluon import current
from s3 import *
from s3layouts import *
try:
from .layouts import *
except ImportError:
pass
import s3menus as default
red_cross_filter = {"organisation.organisation_type_id$name" : "Red Cross / Red Crescent"}
# ==============================================... | flavour/tldrmp | private/templates/IFRC/menus.py | Python | mit | 31,780 | 0.005129 |
import os
import shutil
import unittest
from flask import json
class NewsView(unittest.TestCase):
def setUp(self):
import web
reload(web)
self.app = web.app.test_client()
def tearDown(self):
try:
shutil.rmtree('urlshortner')
except:
pass
def... | loogica/urlsh | test_views.py | Python | mit | 2,651 | 0.002641 |
#!/usr/bin/python3 -S
# -*- coding: utf-8 -*-
import netaddr
from cargo.fields import Cidr
from unit_tests.fields.Field import TestField
from unit_tests import configure
class TestCidr(configure.NetTestCase, TestField):
@property
def base(self):
return self.orm.cidr
def test___call__(self):
... | jaredlunde/cargo-orm | unit_tests/fields/Cidr.py | Python | mit | 2,247 | 0.000445 |
# -*- coding: utf-8 -*-
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2010, 2011 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at... | jmacmahon/invenio | modules/websearch/lib/websearch_external_collections_templates.py | Python | gpl-2.0 | 7,238 | 0.005388 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.asm
~~~~~~~~~~~~~~~~~~~
Lexers for assembly languages.
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, include, bygroups, using, DelegatingL... | sysbot/pastedown | vendor/pygments/pygments/lexers/asm.py | Python | mit | 12,130 | 0.001319 |
import re
from .._compat import PY2, iteritems, integer_types, to_unicode
from .._globals import IDENTITY
from .base import SQLAdapter
from . import adapters, with_connection_or_raise
long = integer_types[-1]
class Slicer(object):
def rowslice(self, rows, minimum=0, maximum=None):
if maximum is None:
... | stephenrauch/pydal | pydal/adapters/mssql.py | Python | bsd-3-clause | 6,306 | 0.00111 |
# Copyright 2014 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# Copyright 2015 Antonio Espinosa <antonioea@antiun.com>
# Copyright 2015 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2017 David Vidal <david.vidal@tecnativa.com>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Partne... | syci/partner-contact | partner_contact_job_position/__manifest__.py | Python | agpl-3.0 | 823 | 0 |
# Generated by Django 2.2.5 on 2019-09-26 12:18
from django.db import migrations, models
import weblate.utils.backup
class Migration(migrations.Migration):
dependencies = [("wladmin", "0005_auto_20190926_1332")]
operations = [
migrations.AddField(
model_name="backupservice",
... | dontnod/weblate | weblate/wladmin/migrations/0006_auto_20190926_1218.py | Python | gpl-3.0 | 1,322 | 0 |
parts = (('house', 'Jack built'),
('malt', 'lay in'),
('rat', 'ate'),
('cat', 'killed'),
('dog', 'worried'),
('cow with the crumpled horn', 'tossed'),
('maiden all forlorn', 'milked'),
('man all tattered and torn', 'kis... | Winawer/exercism | python/house/house.py | Python | cc0-1.0 | 886 | 0.022573 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# So, the problem is that the gigantic file is actually not a valid XML, because
# it has several root elements, and XML declarations.
# It is, a matter of fact, a collection of a lot of concatenated XML documents.
# So, one solution would be to split the file into separate... | krzyste/ud032 | Lesson_2_Problem_Set/06-Processing_Patents/split_data.py | Python | agpl-3.0 | 1,803 | 0.004437 |
# $Id$
#
import inc_const as const
PJSUA = ["--null-audio --max-calls=1 --no-tcp $SIPP_URI"]
PJSUA_EXPECTS = [[0, "Audio updated", ""]]
| ismangil/pjproject | tests/pjsua/scripts-sipp/uas-answer-183-without-to-tag.py | Python | gpl-2.0 | 138 | 0 |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'requirements.txt')) as fp:
requires = fp.readlines()
setup(
name='cebulany manager',
version='0.0.4',
classifiers=[],
author='Firemark',
author_email='marpiec... | hackerspace-silesia/cebulany-manager | setup.py | Python | mit | 495 | 0 |
# -*- coding: utf-8 -*-
'''
Genesis Add-on
Copyright (C) 2015 lambda
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 ... | wndias/bc.repository | plugin.video.superlistamilton/service.py | Python | gpl-2.0 | 837 | 0.001195 |
# 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... | xhochy/arrow | python/pyarrow/tests/test_ipc.py | Python | apache-2.0 | 27,938 | 0 |
#!/usr/bin/python
from azuremodules import *
import sys
import shutil
import time
import re
import os
import linecache
import imp
import os.path
import zipfile
current_distro = "unknown"
distro_version = "unknown"
sudo_password = ""
startup_file = ""
rpm_links = {}
tar_link = {}
current_distro = ... | Azure/azure-linux-automation | remote-scripts/SETUP-INSTALL-PACKAGES.py | Python | apache-2.0 | 22,500 | 0.014622 |
import SpaceScript
import multiprocessing
from multiprocessing import Process, Queue, Pipe, Lock
from SpaceScript import frontEnd
from SpaceScript import utility
from SpaceScript.frontEnd import terminal
from SpaceScript.utility import terminalUtility
from SpaceScript.terminal import terminal as terminal
from SpaceScri... | Sauron754/SpaceScript | old/testEnvironments/SpaceScript/threadingFunctions.py | Python | gpl-3.0 | 1,480 | 0.031757 |
# -*- coding: utf-8 -*-
import time
import unittest
from nive.security import User
"""
#totest:
templates/
definitions.py
parts.py
root.py
search.py
view.py
"""
class IfaceTest:#(unittest.TestCase): # TODO tests
def setUp(self):
app = App()
app.SetConfiguration({"objects": [typedef]})
self.c = IFace(app)
... | nive/nive | nive/components/iface/tests/test_iface.py | Python | gpl-3.0 | 1,151 | 0.034752 |
"""Tests for forms in eCommerce app."""
from django.test import TestCase
from ecommerce.forms import OrderForm
required_fields = {
'phone': '123456789',
'email': 'valid@email.ru',
}
invalid_form_email = {
'email': 'clearly!not_@_email',
'phone': '123456789'
}
no_phone = {'email': 'sss@sss.sss'}
cla... | fidals/refarm-site | tests/ecommerce/tests_forms.py | Python | mit | 1,163 | 0.00086 |
# -*- encoding: utf-8 -*-
# pilas engine: un motor para hacer videojuegos
#
# Copyright 2010-2014 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
#
# Website - http://www.pilas-engine.com.ar
from pilasengine import colores
from pilasengine.fondos.fondo import Fondo
class Fondos(object):
... | hgdeoro/pilas | pilasengine/fondos/__init__.py | Python | lgpl-3.0 | 2,302 | 0.000435 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
import invoice
| Elico-Corp/openerp-7.0 | sale_bom_split_anglo_saxon/__init__.py | Python | agpl-3.0 | 158 | 0 |
# https://www.codewars.com/kata/55902c5eaa8069a5b4000083
def format_money(amount):
# your formatting code here
return '${:.2f}'.format(amount) | fahadkaleem/CodeWars | 8 kyu/python/Dollars and Cents.py | Python | mit | 151 | 0.006623 |
try:
from django.conf.urls import *
except ImportError: # django < 1.4
from django.conf.urls.defaults import *
from .views import EventDetail, EventList, EventCreate, EventCreateJSON, EventDelete, EventUpdate
urlpatterns = patterns("events.views",
url(r"^$", EventList.as_view(template... | goldhand/onegreek | onegreek/events/urls.py | Python | bsd-3-clause | 1,273 | 0.011783 |
"""
Django settings for juanlumn project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pat... | juanlumn/juanlumn | juanlumn/juanlumn/settings.py | Python | mit | 2,719 | 0 |
"""
Example of how to use byte-code execution technique to trace accesses to numpy arrays.
This file demonstrates two applications of this technique:
* optimize numpy computations for repeated calling
* provide automatic differentiation of procedural code
"""
import __builtin__
import os
import sys
import inspect
im... | teoliphant/numba | numba/ad.py | Python | bsd-2-clause | 7,869 | 0.002796 |
# 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.
'''A container for timeline-based events and traces and can handle importing
raw event data from different sources. This model closely resembles that in t... | ChromiumWebApps/chromium | tools/telemetry/telemetry/core/timeline/model.py | Python | bsd-3-clause | 7,997 | 0.009003 |
import socket
import select
import signal
import sys
from communication import send, receive
class ChatServer(object):
def sighandler(self,signum,frame):
print('Shutting down server...')
for o in self.outputs:
o.close()
self.server.close()
def __init__(self, port=3490, back... | carlosb1/examples-python | architecture/chatserver.py | Python | gpl-2.0 | 3,299 | 0.007881 |
'''
ÏÂÀý չʾÁË traceback Ä£¿éÔÊÐíÄãÔÚ³ÌÐòÀï´òÓ¡Òì³£µÄ¸ú×Ù·µ»Ø(Traceback)ÐÅÏ¢, ÀàËÆÎ´²¶»ñÒ쳣ʱ½âÊÍÆ÷Ëù×öµÄ.
'''
# ×¢Òâ! µ¼Èë traceback »áÇåÀíµôÒ쳣״̬, ËùÒÔ
# ×îºÃ±ðÔÚÒì³£´¦Àí´úÂëÖе¼Èë¸ÃÄ£¿é
import traceback
try:
raise SyntaxError, "example"
except:
traceback.print_exc() | iamweilee/pylearn | traceback-example-1.py | Python | mit | 285 | 0.014035 |
import statistics
from typing import TextIO, Tuple, Dict
from aoc2019.intcode import Computer, read_program
def render_screen(computer: Computer, screen: Dict[Tuple[int, int], int]):
while computer.output:
x = computer.output.popleft()
y = computer.output.popleft()
val = computer.output.p... | bertptrs/adventofcode | 2019/aoc2019/day13.py | Python | mit | 1,338 | 0 |
#
# Created by: Pearu Peterson, September 2002
#
import sys
import subprocess
import time
from functools import reduce
from numpy.testing import (assert_equal, assert_array_almost_equal, assert_,
assert_allclose, assert_almost_equal,
assert_array_equal)
import pyt... | WarrenWeckesser/scipy | scipy/linalg/tests/test_lapack.py | Python | bsd-3-clause | 116,267 | 0.000017 |
from functools import total_ordering
from .base import PydeckType
@total_ordering
class String(PydeckType):
"""Indicate a string value in pydeck
Parameters
----------
value : str
Value of the string
"""
def __init__(self, s: str, quote_type: str = ""):
self.value = f"{quote... | uber-common/deck.gl | bindings/pydeck/pydeck/types/string.py | Python | mit | 531 | 0 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
from typing import Iterable, Mapping
from packaging.utils import canonicalize_name as canonicalize_project_name
from pants.backend.python.ma... | pantsbuild/pants | src/python/pants/backend/python/macros/poetry_requirements_caof.py | Python | apache-2.0 | 3,874 | 0.003098 |
"""Support Google Home units."""
import logging
import asyncio
import voluptuous as vol
from homeassistant.const import CONF_DEVICES, CONF_HOST
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.aiohttp_client import async_get_clientsession
_LOG... | jamespcole/home-assistant | homeassistant/components/googlehome/__init__.py | Python | apache-2.0 | 3,612 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/agfood/azure-mgmt-agfood/azure/mgmt/agfood/aio/__init__.py | Python | mit | 588 | 0.003401 |
# -*- coding: utf-8 -*-
from optparse import make_option
from django.core.management.base import BaseCommand
from messytables import XLSTableSet, headers_guess, headers_processor, offset_processor
from data.models import Source, Course, MerlotCategory
class Command(BaseCommand):
help = "Utilities to merge our da... | ocwc/ocwc-data | search/data/management/commands/courses.py | Python | apache-2.0 | 3,372 | 0.005635 |
#!/usr/bin/env python
'''
Project: Geothon (https://github.com/MBoustani/Geothon)
File: Vector/zonal_statistics.py
Description: This code calculates statistics of GeoTIFF with polygon Shapefile
Author: Maziyar Boustani (github.com/MBoustani)
'''
import numpy as np
try:
import ogr
except Im... | MBoustani/Geothon | Spatial Analyst Tools/zonal_statistics.py | Python | apache-2.0 | 2,677 | 0.007471 |
#!/usr/bin/python
from functools import wraps
import unittest
from CoordinateMapper import CoordinateMapper
from MapPositions import GenomePositionError
from MapPositions import ProteinPositionError
from MapPositions import CDSPosition, CDSPositionError
from SeqFeature import FeatureLocation, SeqFeature
from Bio.SeqR... | HaseloffLab/PartsDB | partsdb/tools/CoordinateMapper/testCoordinateMapper.py | Python | mit | 13,945 | 0.001004 |
from __future__ import print_function
from . import pddl_types
def parse_condition(alist):
condition = parse_condition_aux(alist, False)
# TODO: The next line doesn't appear to do anything good,
# since uniquify_variables doesn't modify the condition in place.
# Conditions in actions or axioms are uni... | miquelramirez/lwaptk-v2 | external/fd/pddl/conditions.py | Python | gpl-3.0 | 13,297 | 0.007596 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2015_06_15/models/virtual_network_paged.py | Python | mit | 962 | 0.00104 |
# Copyright (c) 2012 Hesky Fisher
# See LICENSE.txt for details.
#
# processlock.py - Cross platform global lock to ensure plover only runs once.
"""Global lock to ensure plover only runs once."""
import sys
class LockNotAcquiredException(Exception):
pass
if sys.platform.startswith('win32'):
from ctypes ... | nimble0/plover | plover/oslayer/processlock.py | Python | gpl-2.0 | 2,400 | 0.002083 |
from trashcli.put import TrashDirectoryForPut
from nose.tools import assert_equals
from mock import Mock
class TestHowOriginalLocationIsStored:
def test_for_absolute_paths(self):
fs = Mock()
self.dir = TrashDirectoryForPut('/volume/.Trash', '/volume', fs = fs)
self.dir.store_absolute_paths(... | sein-tao/trash-cli | unit_tests/test_storing_paths.py | Python | gpl-2.0 | 1,446 | 0.009682 |
import numpy as np
import itertools
import logging
import time
import traceback
from collections import Mapping
from ..conventions import cf_encoder
from ..core.utils import FrozenOrderedDict
from ..core.pycompat import iteritems, dask_array_type, OrderedDict
# Create a logger object, but don't add any handlers. Leav... | drewokane/xray | xarray/backends/common.py | Python | apache-2.0 | 7,619 | 0.000263 |
from __future__ import print_function
import torch.utils.data as data
from PIL import Image
import os
import os.path
import errno
import numpy as np
import torch
import codecs
class MNIST(data.Dataset):
"""`MNIST <http://yann.lecun.com/exdb/mnist/>`_ Dataset.
Args:
root (string): Root directory of da... | jrdurrant/vision | torchvision/datasets/mnist.py | Python | bsd-3-clause | 12,198 | 0.003771 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.