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 |
|---|---|---|---|---|---|---|
""" Simple wrapper for a Spark Context to provide loading functionality """
import os
from thunder.utils.common import checkParams, handleFormat, raiseErrorIfPathExists
from thunder.utils.datasets import DataSets
from thunder.utils.params import Params
class ThunderContext():
"""
Wrapper for a SparkContext ... | pearsonlab/thunder | thunder/utils/context.py | Python | apache-2.0 | 36,355 | 0.004924 |
# -*- coding: utf-8 -*-
# Copyright 2017, 2021 ProjectQ-Framework (www.projectq.ch)
#
# 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.... | ProjectQ-Framework/ProjectQ | projectq/cengines/_main_test.py | Python | apache-2.0 | 7,119 | 0.000421 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licen... | BT-ojossen/website | website_logo/models/company.py | Python | agpl-3.0 | 1,095 | 0 |
'''Module containing a DensityFunc abstract class, with common probability densities
@since: Jan 10, 2013
@author: kroon
'''
from __future__ import division
import numpy as np
class Gaussian(object):
'''
Class for representing a multi-dimensional Gaussian distribution of dimension d,
given mean and c... | scjrobertson/xRange | kalman/gaussian.py | Python | gpl-3.0 | 4,271 | 0.012409 |
""" A pair of numbers is considered to be cool if their product is divisible by their sum. More formally,
a pair (i, j) is cool if and only if (i * j) % (i + j) = 0.
Given two lists a and b, find cool pairs with the first number in the pair from a, and the second one from b.
Return the number of different sums of el... | ntthuy11/CodeFights | Arcade/04_Python/05_ComplexityOfComprehension/coolPairs.py | Python | mit | 853 | 0.014068 |
"""Operator classes for eval.
"""
from datetime import datetime
from distutils.version import LooseVersion
from functools import partial
import operator as op
import numpy as np
from pandas._libs.tslibs import Timestamp
from pandas.compat import PY3, string_types, text_type
from pandas.core.dtypes.common import is_... | MJuddBooth/pandas | pandas/core/computation/ops.py | Python | bsd-3-clause | 16,387 | 0 |
import sys, os, math
import time
import numpy as np
from pandas.io.parsers import read_csv
from sklearn.decomposition import PCA
from sklearn.cross_validation import StratifiedShuffleSplit
from sklearn import metrics
import sklearn.svm as svm
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes impo... | flyingpoops/kaggle-digit-recognizer-team-learning | plot.py | Python | apache-2.0 | 1,298 | 0.008475 |
from .connection import Connection
from .group import Group, SerialGroup, ThreadingGroup
from .tasks import task
| github/codeql | python/ql/test/query-tests/Security/lib/fabric/__init__.py | Python | mit | 113 | 0 |
"""
UNFINISHED
Fixer for turning multiple lines like these:
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
into a single line like this:
from __future__ import (absolute_import, division, print_function)
This helps with testing of ``futu... | thonkify/thonkify | src/lib/libfuturize/fixes/fix_order___future__imports.py | Python | mit | 830 | 0 |
import axi2s_c
import sys
uut = axi2s_c.axi2s_c()
uut.read(sys.argv[1])
| ruishihan/R7-with-notes | src/python/ioread.py | Python | apache-2.0 | 82 | 0.012195 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
import utils
import xml_utils
from parser_exception import ParserException
class Event(object):
def __init__(self, node):
""" Constructor
Keyword arguments:
node -- XML node defining this event
"""
self.node = node
self.name = node.get('name')
uti... | dergraaf/xpcc | tools/system_design/xmlparser/event.py | Python | bsd-3-clause | 1,538 | 0.048114 |
"""
Utility function to facilitate testing.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import re
import operator
import warnings
from functools import partial
import shutil
import contextlib
from tempfile import mkdtemp, mkstemp
from .nosetester import import_nose
from ... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/numpy/testing/utils.py | Python | mit | 66,431 | 0.001114 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blogg', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
... | ishahid/django-blogg | source/blogg/migrations/0002_comment.py | Python | mit | 1,206 | 0.004146 |
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015-2016 Cara Vinson <ceridwenv@gmail.com>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/astroid/raw_building.py | Python | apache-2.0 | 15,733 | 0.001525 |
# coding: utf-8
"""
HDL Testing Platform
REST API for HDL TP # noqa: E501
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.task import Task ... | autosub-team/autosub | src/plugins/vels_ob/test/test_task.py | Python | gpl-2.0 | 776 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('discussions', '0004_auto_20150430_1641'),
]
operations = [
migrations.AlterField(
model_name='discussion',
... | ZackYovel/studybuddy | server/studybuddy/discussions/migrations/0005_auto_20150430_1645.py | Python | mit | 459 | 0.002179 |
'''
File: input.py
Author: Tristan van Vaalen
Handles user input
'''
import signal
import sys
import verbose
v = verbose.Verbose()
class InputHandler():
def __init__(self):
v.debug('Initializing input handler').indent()
self.running = True
self.signal_level = 0
v.debug('Regist... | Scoudem/audiolyze | inputhandler.py | Python | mit | 1,620 | 0 |
import networkx as nx
import itertools
import matplotlib.pyplot as plt
fig = plt.figure()
fig.subplots_adjust(left=0.2, wspace=0.6)
G = nx.Graph()
G.add_edges_from([(1,2,{'w': 6}),
(2,3,{'w': 3}),
(3,1,{'w': 4}),
(3,4,{'w': 12}),
(4,5,{'w': 13})... | CSB-IG/natk | ninnx/pruning/mi_triangles.py | Python | gpl-3.0 | 1,793 | 0.026771 |
#!/usr/bin/env python
import glob, os, sys
import sipconfig
from PyQt4 import pyqtconfig
def get_diana_version():
depends = filter(lambda line: line.startswith("Depends:"),
open("debian/control").readlines())
for line in depends:
pieces = line.split()
for piece in pi... | dboddie/python-diana | configure.py | Python | gpl-2.0 | 5,321 | 0.008081 |
import unittest
from flip_bit_to_win import flip_bit
class TestFlipBit(unittest.TestCase):
def test_flip_bit(self):
self.assertEquals(flip_bit(0b1011100101), 4)
self.assertEquals(flip_bit(1775), 8)
if __name__ == '__main__':
unittest.main()
| heitorschueroff/ctci | ch5/5.03_Flip_Bit_To_Win/test_flip_bit_to_win.py | Python | mit | 269 | 0 |
#
# rtlsdr_scan
#
# http://eartoearoak.com/software/rtlsdr-scanner
#
# Copyright 2012 - 2015 Al Brown
#
# A frequency scanning GUI for the OsmoSDR rtl-sdr library at
# http://sdr.osmocom.org/trac/wiki/rtl-sdr
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... | mvdroest/RTLSDR-Scanner | src/misc.py | Python | gpl-3.0 | 6,123 | 0.000327 |
"""
Testing python specific API for Minimizer related classes.
"""
import sys
import os
import unittest
import bornagain as ba
class TestMinimizerHelper:
def __init__(self):
self.m_ncalls = 0
self.m_pars = None
def objective_function(self, pars):
self.m_ncalls += 1
self.m_pars... | gpospelov/BornAgain | Tests/Functional/PyFit/minimizer_api.py | Python | gpl-3.0 | 2,947 | 0.000679 |
from django.contrib.messages import constants, get_level, set_level, utils
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
from django.contrib.messages.storage import base, default_storage
from django.contrib.messages.storage.base import Message
from d... | ar4s/django | tests/messages_tests/base.py | Python | bsd-3-clause | 14,187 | 0.000705 |
# Copyright 2019 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.
"""Script to create the Chrome Updater Installer archive.
This script is used to create an archive of all the files required for a
Chrome Updater instal... | endlessm/chromium-browser | chrome/updater/win/installer/create_installer_archive.py | Python | bsd-3-clause | 13,828 | 0.011065 |
""""
Meaningful Scales Detection: an Unsupervised Noise Detection Algorithm for \
Digital Contours
Demo Editor: B. Kerautret
"""
from lib import base_app, build, http, image, config
from lib.misc import app_expose, ctime
from lib.base_app import init_app
import cherrypy
from cherrypy import TimeoutError
import os.path... | juan-cardelino/matlab_demos | ipol_demo-light-1025b85/app_available/75/app.py | Python | gpl-2.0 | 17,698 | 0.00825 |
import json
import os
import datetime
for i in range(9):
try:
os.chdir('../call_record/')
with open('callsSortedperson_'+str(i)+'.json','r') as f:
data=json.load(f)
print 'User: ',i
#print len(data)
friends=[]
for j in range(len(data)):
#print data[j][0]
friends.append(data[j][0])
... | shreya2111/Recommender-System | outgoing_call_count.py | Python | gpl-2.0 | 1,175 | 0.095319 |
#!/usr/bin/python
# ===========================================================================
# Hatalogico KNIGHT RIDER for 8 LEDs - powered by Adafruit's Libraries
# -------------------------------------------------
# Date: 12/4/2015
# Author: John Lumley
#
# BIG THANKS TO ADAFRUIT INDUSTRIES FOR MAKING THIS POSSIB... | Jelby/Hatalogico | ledKnightRider16.py | Python | mit | 9,635 | 0.019512 |
callback_classes = [
['ns3::ObjectBase *', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['... | pradeepnazareth/NS-3-begining | src/lte/bindings/callbacks_list.py | Python | gpl-2.0 | 6,324 | 0.006167 |
from django.shortcuts import render
from django.utils.translation import activate
def index(request):
# latest_question_list = Question.objects.order_by('-pub_date')[:5]
# context = {'latest_question_list': latest_question_list}
# activate('pt-br')
# print(request.LANGUAGE_CODE)
context = {}
re... | torchmed/torchmed | torchmed/views.py | Python | mit | 364 | 0.002747 |
########################################################################
# MCU Gear(R) system Sample Code
# Auther:y.kou.
# web site: http://www.milletool.com/
# Date : 8/OCT/2016
#
########################################################################
#Revision Information
#
#########################################... | yoshinarikou/MilleFeuilleRaspberryPi | milpython/MoistureTest.py | Python | mit | 835 | 0.027545 |
# Copyright (c) 2012-2013 Mitch Garnaat http://garnaat.org/
# Copyright 2012-2014 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/botocore/retryhandler.py | Python | mit | 13,631 | 0.000147 |
from __future__ import print_function
import zlib
import numpy as np
from . import ncStream_pb2 as stream # noqa
MAGIC_HEADER = b'\xad\xec\xce\xda'
MAGIC_DATA = b'\xab\xec\xce\xba'
MAGIC_VDATA = b'\xab\xef\xfe\xba'
MAGIC_VEND = b'\xed\xef\xfe\xda'
MAGIC_ERR = b'\xab\xad\xba\xda'
def read_ncstream_messages(fobj):
... | hyoklee/siphon | siphon/cdmr/ncstream.py | Python | mit | 5,147 | 0.000971 |
#!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -t {SAMPLE_TEST}
"""
from __future__ import division, print_function
PROJECT_MODULE = "msmbuilder"
PROJECT_ROOT_FILES = ['msmbuilder', 'LICENSE', 'setup.py']
... | Eigenstate/msmbuilder | runtests.py | Python | lgpl-2.1 | 6,293 | 0.000953 |
import fauxfactory
import pytest
from widgetastic.utils import partial_match
from wrapanapi.exceptions import ImageNotFoundError
from cfme import test_requirements
from cfme.cloud.provider.azure import AzureProvider
from cfme.cloud.provider.ec2 import EC2Provider
from cfme.exceptions import ItemNotFound
from cfme.mark... | izapolsk/integration_tests | cfme/tests/cloud/test_tag_mapping.py | Python | gpl-2.0 | 9,719 | 0.001338 |
"""Helpers for testing Met Office DataPoint."""
from homeassistant.components.metoffice.const import DOMAIN
from homeassistant.const import CONF_API_KEY, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
TEST_DATETIME_STRING = "2020-04-25T12:00:00+00:00"
TEST_API_KEY = "test-metoffice-api-key"
TEST_LATITUDE_WAVERTREE = 53.3... | jawilson/home-assistant | tests/components/metoffice/const.py | Python | apache-2.0 | 2,161 | 0.000463 |
from sys import stdin
def readLine():
return stdin.readline().strip()
def readInt():
return int(readLine())
def readInts():
return list(map(int, readLine().split()))
def main():
T = readInt()
for i in range(T):
pages = [{'url': None, 'v': 0} for j in range(10)]
for j in range(10):
pages[j]['url'], pag... | mikebsg01/Contests-Online | UVa/12015-GoogleisFeelingLucky.py | Python | mit | 604 | 0.038079 |
import sys
import numpy as np
from copy import copy, deepcopy
import multiprocessing as mp
from numpy.random import shuffle, random, normal
from math import log, sqrt, exp, pi
import itertools as it
from scipy.stats import gaussian_kde, pearsonr
from scipy.stats import ttest_1samp
from itertools import product
try:
... | Gibbsdavidl/miergolf | src/corEdges.py | Python | bsd-3-clause | 3,914 | 0.020184 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import django.core.validators
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [... | CharlesGust/django-imagr | imagr_site/imagr_app/migrations/0001_initial.py | Python | mit | 5,413 | 0.00388 |
from argh import dispatch_commands
from argh.decorators import named, arg
from geobricks_raster_correlation.core.raster_correlation_core import get_correlation
@named('corr')
@arg('--bins', default=150, help='Bins')
def cli_get_correlation(file1, file2, **kwargs):
corr = get_correlation(file1, file2, kwargs['bins... | geobricks/geobricks_raster_correlation | geobricks_raster_correlation/cli/cli_argh.py | Python | gpl-2.0 | 493 | 0.006085 |
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.dashboards.groups import dashboard
class Instances(horizon.Panel):
name = _("Groups")
slug = "instances"
dashboard.Groups.register(Instances)
| icloudrnd/automation_tools | openstack_dashboard/dashboards/groups/instances/panel.py | Python | apache-2.0 | 250 | 0.004 |
import striga
class CustomContext(striga.context):
pass
| ateska/striga2-sampleapp | app/appweb/context.py | Python | unlicense | 58 | 0.034483 |
# This file is part of h5py, a Python interface to the HDF5 library.
#
# http://www.h5py.org
#
# Copyright 2008-2013 Andrew Collette and contributors
#
# License: Standard 3-clause BSD; see "license.txt" for full license terms
# and contributor agreement.
from __future__ import absolute_import
import tempf... | ryfeus/lambda-packs | HDF4_H5_NETCDF/source2.7/h5py/tests/old/test_h5f.py | Python | mit | 2,360 | 0.002119 |
########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | isaac-s/cloudify-manager | tests/integration_tests/tests/agentless_tests/scale/test_scale_in.py | Python | apache-2.0 | 9,915 | 0 |
# Copyright 2009 Daniel Woodhouse
#
#This file is part of mtp-lastfm.
#
#mtp-lastfm 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.
#
#mtp... | woodenbrick/mtp-lastfm | mtplastfm/webservices.py | Python | gpl-3.0 | 7,361 | 0.01277 |
import unittest
import unittest.mock
import random
import time
import pickle
import warnings
from functools import partial
from math import log, exp, pi, fsum, sin
from test import support
class TestBasicOps:
# Superclass with tests common to all generators.
# Subclasses must arrange for self.gen to retrieve t... | jiangzhuo/kbengine | kbe/src/lib/python/Lib/test/test_random.py | Python | lgpl-3.0 | 31,638 | 0.002497 |
from django.forms.widgets import TextInput
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.safestring import mark_safe
class TagAutocompleteTagIt(TextInput):
def __init__(self, max_tags, *args, **kwargs):
self.max_tags = (
max_tags
if... | hzlf/openbroadcast.org | website/apps/ac_tagging/widgets.py | Python | gpl-3.0 | 4,147 | 0.001206 |
from django import forms
from django.contrib.auth import get_user_model
from django.utils.translation import ugettext_lazy as _
from apps.grid.fields import TitleField, UserModelChoiceField
from apps.grid.widgets import CommentInput
from .base_form import BaseForm
class DealActionCommentForm(BaseForm):
exclude_i... | sinnwerkstatt/landmatrix | apps/grid/forms/deal_action_comment_form.py | Python | agpl-3.0 | 3,733 | 0.001607 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
#-------------------------------------------------------------------
# tarfile.py
#-------------------------------------------------------------------
# Copyright (C) 2002 Lars Gustäbel <lars@gustaebel.de>
# All rights reserved.
#
# Permission is hereby granted, fre... | microdee/IronHydra | src/IronHydra/Lib/tarfile.py | Python | mit | 88,997 | 0.001888 |
"""config_test.py - test config module
RMM, 25 may 2019
This test suite checks the functionality of the config module
"""
from math import pi, log10
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup as mplcleanup
import numpy as np
import pytest
import control as ct
@pytest.mark.u... | python-control/python-control | control/tests/config_test.py | Python | bsd-3-clause | 12,736 | 0.000157 |
# Generated by Django 2.2.4 on 2019-08-26 18:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('helpdesk', '0027_auto_20190826_0700'),
]
operations = [
migrations.AlterFi... | auto-mat/klub | local_migrations/migrations_helpdesk/0028_auto_20190826_2034.py | Python | gpl-3.0 | 2,149 | 0.002792 |
# coding: utf8
"""
Delphi decision maker
"""
module = "delphi"
if deployment_settings.has_module(module):
########
# Groups
########
resourcename = "group"
tablename = module + "_" + resourcename
table = db.define_table(tablename, timestamp,
Field("name", notnu... | ksetyadi/Sahana-Eden | models/delphi.py | Python | mit | 9,575 | 0.014413 |
# -*- coding: utf-8 -*-
import logging
from wakatime.compat import u
try:
import mock
except ImportError:
import unittest.mock as mock
try:
# Python 2.6
import unittest2 as unittest
except ImportError:
# Python >= 2.7
import unittest
class TestCase(unittest.TestCase):
patch_these = []
... | Djabbz/wakatime | tests/utils.py | Python | bsd-3-clause | 1,355 | 0.002214 |
# CIS 410/510pm
# Homework 5 beta 0.0.1
# Cameron Palk
# May 2016
#
# Special thanks to Daniel Lowd for the skeletor code
import sys
import tokenize
from functools import reduce
global_card = []
num_vars = 0
''' Calc Strides
'''
def calcStrides( scope ):
rev_scope = list( reversed( scope ) )
res = [ 1 ] + [ 0 ] *... | CKPalk/ProbabilisticMethods | A5/hw5_start.py | Python | mit | 4,767 | 0.064821 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import cv2
import torch
from torchvision import transforms as T
from maskrcnn_benchmark.modeling.detector import build_detection_model
from maskrcnn_benchmark.utils.checkpoint import DetectronCheckpointer
from maskrcnn_benchmark.structures.image_l... | mlperf/training_results_v0.7 | NVIDIA/benchmarks/maskrcnn/implementations/pytorch/demo/predictor.py | Python | apache-2.0 | 15,180 | 0.000791 |
from ...utils.code_utils import deprecate_module
deprecate_module("EMUtils", "waveform_utils", "0.16.0", error=True)
from .waveform_utils import *
| simpeg/simpeg | SimPEG/electromagnetics/utils/EMUtils.py | Python | mit | 149 | 0.006711 |
class Breakpoint():
def __init__(self, breakpointNumber):
self.breakpointNumber = breakpointNumber
class BreakpointPPUByTime(Breakpoint):
def __init__(self, breakpointNumber, scanline, tick):
Breakpoint.__init__(self, breakpointNumber)
self._scanline = scanline
self._t... | aLaix2/O-Nes-Sama | DebuggerClient/Breakpoint.py | Python | gpl-3.0 | 1,060 | 0.00283 |
#!/usr/bin/env python
from flask import Flask, jsonify, request, abort, render_template
app = Flask(__name__)
@app.route("/",methods=['GET'])
def index():
if request.method == 'GET':
return render_template('index.html')
else:
abort(400)
@app.route("/devices",methods=['GET'])
def devices():
if request.m... | mattiasgiese/squeezie | app/master.py | Python | mit | 476 | 0.021008 |
# -*- coding: utf-8 -*-
#
# 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 "L... | ConeyLiu/spark | python/pyspark/ml/tests/test_param.py | Python | apache-2.0 | 16,252 | 0.002031 |
#
# 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 us... | iemejia/incubator-beam | sdks/python/apache_beam/io/external/xlang_kafkaio_it_test.py | Python | apache-2.0 | 4,950 | 0.005253 |
from bibliopixel.animation.circle import Circle
from bibliopixel.colors import palettes
class Swirl(Circle):
COLOR_DEFAULTS = ('palette', palettes.get('three_sixty')),
def __init__(self, layout, angle=12, **kwds):
super().__init__(layout, **kwds)
self.angle = angle
def pre_run... | ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/circle/swirl.py | Python | mit | 586 | 0 |
from task_manager.tag_manager.tag_manager import TaggingModel
from task_manager.models import Task
import numpy as np
import json
enabled_tagger_ids = [tagger.pk for tagger in Task.objects.filter(task_type='train_tagger').filter(status='completed')]
enabled_taggers = {}
# Load Tagger models
for _id in enabled_tagger... | cbentes/texta | dataset_importer/document_preprocessor/preprocessors/text_tagger.py | Python | gpl-3.0 | 3,426 | 0.007589 |
#!/usr/bin/env python3
# -*- coding : utf-8 -*-
from collections import Iterable
from collections import Iterator
isinstance([], Iterable)
isinstance({}, Iterable)
isinstance((), Iterable)
isinstance('abc', Iterable)
isinstance((x for x in range(10)), Iterable)
isinstance(100, Iterable)
# Iterable but not Iterator
i... | kmahyyg/learn_py3 | adv_feature/adv_feature_iterable.py | Python | agpl-3.0 | 894 | 0.001119 |
# Copyright (c) 2011-2015 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
import json
import requests
from django.conf import settings
def get_contact(school):
if not settings.ZOHO_CREDENTIALS:
return
list_url = 'https://invoic... | ctmunwebmaster/huxley | huxley/utils/zoho.py | Python | bsd-3-clause | 1,767 | 0.01245 |
# coding: UTF-8
#
# Copyright 2014 by SCSK Corporation.
#
# This file is part of PrimeCloud Controller(TM).
#
# PrimeCloud Controller(TM) is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | yterauchi/primecloud-controller | iaas-gw/src/iaasgw/controller/ec2/ec2VolumController.py | Python | gpl-2.0 | 17,993 | 0.013944 |
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | nextsmsversion/macchina.io | platform/JS/V8/v8-3.28.4/PRESUBMIT.py | Python | apache-2.0 | 7,096 | 0.008737 |
"""
CacheItem interface:
'_id': string,
'url': string,
'response_url': string,
'body': string,
'head': string,
'response_code': int,
'cookies': None,#grab.response.cookies,
"""
from hashlib import sha1
import zlib
import logging
import marshal
import time
from grab.response import Response
from grab.cookie import Cook... | subeax/grab | grab/spider/cache_backend/postgresql.py | Python | mit | 6,990 | 0.001001 |
import websocket
import package
import thread
import time
import run
import random
import config
import dht
import logging
logging.basicConfig()
def on_message(ws, message):
#d = package.LoadPackage(message)
#res = run.PackageParser(d)
#ws.send(package.DumpPackage(res))
print message
def on_error(ws... | spacemeowx2/remote-web | client/client.py | Python | mit | 1,269 | 0.01576 |
# Copyright 2012 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 a... | harshilasu/LinkurApp | y/google-cloud-sdk/platform/gcutil/lib/google_compute_engine/gcutil_lib/firewall_cmds.py | Python | gpl-3.0 | 12,747 | 0.005021 |
import os
import os.path
from freight.constants import PROJECT_ROOT
from freight.exceptions import CommandError
class UnknownRevision(CommandError):
pass
class Vcs(object):
ssh_connect_path = os.path.join(PROJECT_ROOT, "bin", "ssh-connect")
def __init__(self, workspace, url, username=None):
se... | getsentry/freight | freight/vcs/base.py | Python | apache-2.0 | 1,987 | 0 |
"""Top level site urls."""
from django.conf.urls import patterns, include, url
from quiz2 import views
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns(
'',
url(r'^$', views.home, name='home'),
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.u... | hillscottc/quiz2 | quiz2/urls.py | Python | agpl-3.0 | 1,275 | 0.002353 |
def get_weekday(current_weekday, days_ahead):
""" (int, int) -> int
Return which day of the week it will be days_ahead days from
current_weekday.
current_weekday is the current day of the week and is in the range 1-7,
indicating whether today is Sunday (1), Monday (2), ..., Saturday (7).
days... | simontakite/sysadmin | pythonscripts/practicalprogramming/functions/days_bad.py | Python | gpl-2.0 | 1,684 | 0.000594 |
from .base import * # noqa
INTERNAL_IPS = INTERNAL_IPS + ('', )
ALLOWED_HOSTS = []
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'app_kdl_liv',
'USER': 'app_kdl',
'PASSWORD': '',
'HOST': ''
},
}
# ------------------------------... | kingsdigitallab/kdl-django | kdl/settings/liv.py | Python | mit | 1,127 | 0 |
# -*- coding: utf-8 -*-
from django.conf.urls import url
from projects import views
urlpatterns = [
url(r'^$', views.MainPageView.as_view(), name='main'),
# Inlist
url(r'^inlist/$', views.InlistView.as_view(), name='inlist'),
url(r'^inlist/(?P<pk>[0-9]+)/delete/$', views.InlistItemDelete.as_view(),
... | XeryusTC/projman | projects/urls.py | Python | mit | 1,477 | 0 |
from pydevin import *
import math
# ball parameters definitions
BALL_POS_Y_MAX = 115
BALL_POS_Y_MIN = 5
BALL_POS_Y_CENTER = (BALL_POS_Y_MAX + BALL_POS_Y_MIN) / 2.0
BALL_POS_X_MAX = 125
BALL_POS_X_MIN = 20
BALL_POS_X_CENTER = (BALL_POS_X_MAX + BALL_POS_X_MIN) / 2.0
A_X = -1.0/(BALL_POS_X_MAX - BALL_POS_X_CENTER)
B_... | QJonny/spin_emulator | pydevin/devinManager.py | Python | lgpl-2.1 | 2,573 | 0.026817 |
# -*- coding: utf-8 -*-
# © 2016 Cyril Gaudin (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import api, fields, models
class MrpConfigSettings(models.TransientModel):
""" Add settings for dismantling BOM.
"""
_inherit = 'mrp.config.settings'
dismantling_pr... | houssine78/addons | mrp_bom_dismantling/models/res_config.py | Python | agpl-3.0 | 1,008 | 0 |
'''
9.5 First, you have to resolve assignment9_3. This is slightly different.
This program records the domain name (instead of the address) where the message
was sent from instead of who the mail came from (i.e., the whole email address).
At the end of the program, print out the contents of your dictionary.
Sample:
py... | hosseinoliabak/learningpy | 09_5_dictionary.py | Python | gpl-3.0 | 877 | 0.004561 |
# -*- 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 field 'Reference_Domain.external_id'
db.add_column(u'django_reference_data_reference_domain', 'exte... | jonathanmorgan/django_reference_data | migrations/0005_auto__add_field_reference_domain_external_id__add_field_reference_doma.py | Python | gpl-3.0 | 5,852 | 0.00769 |
import os
import sys
import json
import yaml
import time
import tempfile
import inspect
import warnings
import re
import math
import codecs
class StimelaCabRuntimeError(RuntimeError):
pass
class StimelaProcessRuntimeError(RuntimeError):
pass
CPUS = 1
from .xrun_poll import xrun
def assign(key, value):
... | SpheMakh/Stimela | stimela/utils/__init__.py | Python | gpl-2.0 | 11,642 | 0.002233 |
from django.contrib import admin
from achievs.models import Achievement
# from achievs.models import Gold
# from achievs.models import Silver
# from achievs.models import Bronze
# from achievs.models import Platinum
from achievs.models import Level
# class PlatinumInline(admin.StackedInline):
# model=Platinum
# cla... | eawerbaneth/Scoreboard | achievs/admin.py | Python | bsd-3-clause | 1,116 | 0.031362 |
# ============================================================================
#
# Copyright (c) 2007-2010 Integral Technology Solutions Pty Ltd,
# All Rights Reserved.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL... | Integral-Technology-Solutions/ConfigNOW | wlst/persist.py | Python | mit | 8,036 | 0.015928 |
d = {}
for i in range(100000):
d[i] = i
JS_CODE = '''
var d = {};
for (var i = 0; i < 100000; i++) {
d[i] = i;
}
'''
| kikocorreoso/brython | www/speed/benchmarks/add_dict.py | Python | bsd-3-clause | 124 | 0 |
from __future__ import unicode_literals
from django.apps import AppConfig
class PaypalConfig(AppConfig):
name = 'paypal'
| linkingcharities/linkingcharities | Linking_Charities/payment/apps.py | Python | mit | 128 | 0 |
import matplotlib
matplotlib.use('WXAgg')
from matplotlib import cm
import matplotlib.pyplot as plt
import numpy as np
import CoolProp
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize=(2, 2))
ax = fig.add_subplot(111, projection='3d')
NT = 1000
NR = 1000
rho, t = np.logspace(np.log10(2e-3), np.log10(1... | CoolProp/CoolProp | Web/scripts/logo_2013.py | Python | mit | 1,263 | 0.005542 |
#!/usr/bin/env python
from __future__ import absolute_import
import os
import shutil
import tempfile
from distutils.core import setup
from .Dependencies import cythonize, extended_iglob
from ..Utils import is_package_dir
from ..Compiler import Options
try:
import multiprocessing
parallel_compiles = int(mult... | thedrow/cython | Cython/Build/Cythonize.py | Python | apache-2.0 | 6,882 | 0.001453 |
# -*- coding: utf-8 -*-
"""
Running the Gibbs sampler on flowcymetry data
http://www.physics.orst.edu/~rubin/nacphy/lapack/linear.html
matlab time: Elapsed time is 1.563538 seconds.
improve sample_mu:
python: 0.544 0.005 0.664
cython_admi: 0.469 0.005 0.493
moved_index_in_cyt... | JonasWallin/BayesFlow | examples/flowcymetry_normalMixture.py | Python | gpl-2.0 | 5,242 | 0.014117 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-02-12 06:08
from __future__ import unicode_literals
from django.db import migrations
import fossevents.users.models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_user_is_moderator'),
]
operations = [
m... | fossevents/fossevents.in | fossevents/users/migrations/0005_auto_20170212_1138.py | Python | mit | 504 | 0 |
# -*- coding: utf-8 -*-
"""The app module, containing the app factory function."""
from flask import Flask, render_template, Markup
from . import public, admin
from .extensions import *
from .config import Config
#extensions
def getPackage(num):
packages = {
"0": "No Package",
"1": "Basic Package"... | rileymjohnson/fbla | app/main.py | Python | mit | 3,324 | 0.008724 |
#!/usr/bin/env python
# Copyright 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.
"""Tests for the module module, which contains Module and related classes."""
import os
import unittest
from tvcm import fake_fs
from... | dstockwell/catapult | tracing/third_party/tvcm/tvcm/module_unittest.py | Python | bsd-3-clause | 3,914 | 0.005876 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api, _
from odoo.exceptions import UserError, ValidationError
MAP_INVOICE_TYPE_PARTNER_TYPE = {
'out_invoice': 'customer',
'out_refund': 'customer',
'in_invoice': 'supplier',
'in_refund': 'supplier',
}
# Since invoice amounts are unsigned, this ... | richard-willowit/odoo | addons/account/models/account_payment.py | Python | gpl-3.0 | 35,920 | 0.004928 |
"""
JSONField automatically serializes most Python terms to JSON data.
Creates a TEXT field with a default value of "{}". See test_json.py for
more information.
from django.db import models
from django_extensions.db.fields import json
class LOL(models.Model):
extra = json.JSONField()
"""
from __future__ impo... | pabulumm/neighbors | lib/python3.4/site-packages/django_extensions/db/fields/json.py | Python | bsd-3-clause | 3,459 | 0.000289 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""setup
(C) Franck Barbenoire <fbarbenoire@yahoo.fr>
License : GPL v3"""
from distutils.core import setup
from setuptools import find_packages
setup(name = "django-openzoom",
version = "0.1.1",
description = "Django application for displaying very high resolution... | franckinux/django-openzoom | setup.py | Python | gpl-3.0 | 925 | 0.035676 |
from __future__ import print_function
def validate_book(body):
'''
This does not only accept/refuse a book. It also returns an ENHANCED
version of body, with (mostly fts-related) additional fields.
This function is idempotent.
'''
if '_language' not in body:
raise ValueError('language... | boyska/libreant | libreantdb/api.py | Python | agpl-3.0 | 7,780 | 0.002314 |
# -*- coding: UTF-8 -*-
##############################################################################
#
# OERPLib
# Copyright (C) 2012-2013 Sébastien Alix.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# ... | etsinko/oerplib | oerplib/rpc/xmlrpclib_custom.py | Python | lgpl-3.0 | 5,967 | 0.000168 |
"""Univariate features selection."""
# Authors: V. Michel, B. Thirion, G. Varoquaux, A. Gramfort, E. Duchesnay.
# L. Buitinck, A. Joly
# License: BSD 3 clause
import numpy as np
import warnings
from scipy import special, stats
from scipy.sparse import issparse
from ..base import BaseEstimator
from ..prepr... | toastedcornflakes/scikit-learn | sklearn/feature_selection/univariate_selection.py | Python | bsd-3-clause | 25,381 | 0.000394 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from os.path import join, isfile
from os import walk
import io
import os
import sys
from shutil import rmtree
from setuptools import find_packages, setup, Command
def read_file(filename):
with open(filename) as fp:
return fp.read().strip()
def read_requirem... | Gerapy/Gerapy | setup.py | Python | mit | 3,683 | 0.000544 |
#
# Copyright 2017 Ericsson India Global Services Pvt Ltd. 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 ... | openstack/networking-odl | networking_odl/tests/unit/ceilometer/network/statistics/opendaylight_v2/test_driver.py | Python | apache-2.0 | 25,998 | 0 |
# 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 use ... | andrewsomething/libcloud | libcloud/test/dns/test_route53.py | Python | apache-2.0 | 14,213 | 0.000211 |
def sum_args(*args):
return sum(args)
| the-zebulan/CodeWars | katas/kyu_7/sum_of_all_arguments.py | Python | mit | 42 | 0 |
# i18n markers
def N_(msg):
'''
Single translatable string marker.
Does nothing, just a marker for \\*.pot file compilers.
Usage::
n = N_('translate me')
translated = env.gettext(n)
'''
return msg
class M_(object):
'''
Marker for translatable string with plural form.
... | boltnev/iktomi | iktomi/utils/i18n.py | Python | mit | 2,033 | 0.001476 |
"""This module provides the components needed to build your own __import__
function. Undocumented functions are obsolete.
In most cases it is preferred you consider using the importlib module's
functionality over this module.
"""
# (Probably) need to stay in _imp
from _imp import (lock_held, acquire_lock, release_lo... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/imp.py | Python | gpl-3.0 | 10,631 | 0.000094 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.