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 |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | UnrememberMe/pants | contrib/node/src/python/pants/contrib/node/tasks/javascript_style.py | Python | apache-2.0 | 7,608 |
#!/usr/bin/env python
#
# Copyright 2010 The Closure Library 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
... | ex/js | lib/closure-library/closure/bin/scopify.py | Python | mit | 6,789 |
import urllib2
import ast
from datetime import datetime
import src.lib.fileHandler as fileHandler
from src.lib.timers import InfiniteTimer
from src.config.config import config
from src.config.config_pointsystem import pointsystem_config
class userHandler:
def __init__(self, userdata_config):
self.__user... | 901/Gwent-twitch-bot | src/lib/userHandler.py | Python | gpl-3.0 | 3,396 |
#
# This program is distributed without any warranty and it
# can be freely redistributed for research, classes or private studies,
# since the copyright notices are not removed.
#
# This file contains a function to calculate matriz convolution
#
# Jadson Santos - [email protected]
#
# http://www.scipy-lectures.org/ad... | jadsonjs/DataScience | image-processing/my_convolution2D.py | Python | apache-2.0 | 2,624 |
"""Constants and enums.
@todo: Add stencil components to L{texture_formats}.
@author: Stephan Wenger
@date: 2012-02-29
"""
import glitter.raw as _gl
from glitter.utils.dtypes import uint8, uint16, uint32, int8, int16, int32, float32
from glitter.utils.enum import Enum
format_to_length = {
#_gl.GL_COLOR_INDE... | swenger/glitter | glitter/utils/constants.py | Python | mit | 13,465 |
# -*- coding: utf-8 -*-
from django.template.defaultfilters import slugify
import factory
import factory.fuzzy
import factory.django
from kitsune.products.models import Product, Topic, Version
from kitsune.sumo.tests import FuzzyUnicode
class ProductFactory(factory.DjangoModelFactory):
class Meta:
model... | mythmon/kitsune | kitsune/products/tests/__init__.py | Python | bsd-3-clause | 1,557 |
# Scripted ROI start/end based on SimMarker iteration markers.
# Assumes start and end of each iteration is marked using SimMarker(1, i) and SimMarker(2, i), respectively.
#
# This script will switch to warmup at the beginning of iteration A (default: first SimMarker(1, *)),
# run in detailed from the start of iteratio... | yonggang985/Sniper | scripts/roi-iter.py | Python | mit | 1,747 |
from __future__ import print_function
import numpy as np
from puq.jpickle import pickle
def dump_hdf5(name, v, desc=''):
np.set_printoptions(threshold=np.nan)
line = pickle({'name': name, 'desc': desc, 'value': v})
print('HDF5:%s:5FDH' % line)
| c-PRIMED/puq | puqutil/__init__.py | Python | mit | 258 |
# Copyright (c) 2017-2018 {Flair Inc.} WESLEY PENG
#
# 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 agre... | WesleyPeng/uiXautomation | src/main/python/taf/foundation/api/plugins/cliplugin.py | Python | apache-2.0 | 861 |
"""
Given a set return all the subsets
"""
| santoshmano/technical_interviews | coding_session/01_subsets_of_set.py | Python | mit | 43 |
import os
from glue.segmentdb import segmentdb_utils
from glue.segmentdb import query_engine
from glue.ligolw import dbtables
from glue.ligolw.utils import ligolw_sqlite
from glue.segments import segment, segmentlist
def test_basic_seg_summary(engine):
res = segmentdb_utils.query_segments( engine, 'segment_sum... | spxiwh/pycbc-glue | test/test_segdb_utils.py | Python | gpl-3.0 | 2,459 |
import numpy
import argparse
import sys
import struct
from scipy.sparse import csr_matrix
class EmbeddingException(Exception):
pass
def read_vocab(vocab_fn):
word2index = {}
with open(vocab_fn, "r") as f:
for i, line in enumerate(f):
word = line.strip().split()[0]
word2ind... | hlt-bme-hu/eval-embed | convert.py | Python | lgpl-3.0 | 7,356 |
import os
import logging
from lintreview.tools import Tool, run_command, process_quickfix
from lintreview.utils import in_path
log = logging.getLogger(__name__)
class Pep8(Tool):
name = 'pep8'
def check_dependencies(self):
"""
See if pep8 is on the PATH
"""
return in_path('p... | zoidbergwill/lint-review | lintreview/tools/pep8.py | Python | mit | 1,111 |
from unittest import TestCase
from agent.lib.utils import synchronized, synchronizedInst,trackable
from threading import Lock, Thread
import threading
from agent.lib import contextutils, utils
import pylons
import os
from agent.tests.unit.test_util import commonTearDown, commonSetup
counter = 0
class TestAgentUtils(T... | cronuspaas/cronusagent | agent/agent/tests/unit/test_utils.py | Python | apache-2.0 | 3,414 |
#!/usr/bin/env python3
# Copyright 2013-4 Iain Peddie [email protected]
#
# This file is part of WellBehavedPython
#
# WellBehavedPython 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... | iain-peddie/well-behaved-python | tests/WellBehavedPythonTests/Engine/TestContextTests.py | Python | gpl-3.0 | 2,783 |
#!/usr/bin/env python
import dateutil.parser
import dateutil.tz
import feedparser
import re
from datetime import datetime, timedelta
from joblist import JobList
class FilterException(Exception):
pass
class IndeedJobList(JobList):
'''Joblist class for Indeed
This joblist is for the indeed.com rss feed. I... | keisetsu/joblist | indeed.py | Python | mit | 5,528 |
"""
You can enable picking by setting the "picker" property of an artist
(for example, a matplotlib Line2D, Text, Patch, Polygon, AxesImage,
etc...)
There are a variety of meanings of the picker property
None - picking is disabled for this artist (default)
boolean - if True then picking will be enabled and... | ajrichards/notebook | visualization/mpl-simple-pick-event.py | Python | bsd-3-clause | 6,330 |
from warnings import warn
import numpy as np
from nibabel.affines import apply_affine
from dipy.tracking.streamlinespeed import set_number_of_points
from dipy.tracking.streamlinespeed import length
from dipy.tracking.streamlinespeed import compress_streamlines
import dipy.tracking.utils as ut
from dipy.tracking.utils ... | sinkpoint/dipy | dipy/tracking/streamline.py | Python | bsd-3-clause | 8,004 |
"""some error codes for the game"""
USERNAME_NOT_SET = {"object": "error", "errorCode" : 0,
"desc": "You should have an username and a team before any operation"}
TEAM_ERROR = {"object": "error", "errorCode" : 1,
"desc": "this team doesn't exist"}
USERNAME_ALREADY_IN_USE = {"object": ... | mdl29/tidutyzef | serveur/errcode.py | Python | lgpl-3.0 | 768 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
import copy
import json
import os
import pickle
import unittest
import warnings
from django.core.exceptions import SuspiciousOperation
from django.core.serializers.json import DjangoJSONEncoder
from django.core.signals import request_finished
from djan... | beckastar/django | tests/httpwrappers/tests.py | Python | bsd-3-clause | 25,882 |
#!/usr/bin/env python
import optparse
import traceback
from feather import servers, connections, requests
import greenhouse
DEFAULT_HOST = ""
DEFAULT_PORT = 9000
connected = {}
class RequestHandler(requests.RequestHandler):
def handle(self, request):
self.connection.broadcast("%s: %s" % (
... | teepark/feather | examples/nc-chat.py | Python | bsd-3-clause | 2,428 |
# import system modules
import arcpy
from arcpy import env
# Set environment settings
env.workspace = "C:\Users\Ewan\Desktop\SFTPDST5\MapFiles"
try:
# Set the local variable
in_Table = "statues.csv"
x_coords = "X"
y_coords = "Y"
out_Layer = "Statues_Layer"
saved_Layer = "C:\Users\... | harryfb/DST5 | ArcPy Code/Statues.py | Python | apache-2.0 | 746 |
#
# main.py: a shared, automated test suite for Subversion
#
# Subversion is a tool for revision control.
# See http://subversion.tigris.org for more information.
#
# ====================================================================
# Copyright (c) 2000-2009 CollabNet. All rights reserved.
#
# This software is l... | bdmod/extreme-subversion | BinarySourcce/subversion-1.6.17/subversion/tests/cmdline/svntest/main.py | Python | gpl-2.0 | 53,871 |
import io
from textwrap import dedent
import pytest
from vdirsyncer import cli, exceptions
from vdirsyncer.cli.config import Config
invalid = object()
@pytest.fixture
def read_config(tmpdir, monkeypatch):
def inner(cfg):
errors = []
monkeypatch.setattr('vdirsyncer.cli.cli_logger.error', errors... | untitaker/vdirsyncer | tests/system/cli/test_config.py | Python | mit | 4,858 |
######################################
#
# Nikolai Rozanov (C) 2017-Present
#
# [email protected]
#
#####################################
import numpy as np
#
# This file is a way of learning the Kernel and performing a hypothesis test, by computin the test statistics
#
class TEST(object):
'''
main... | Kolyan-1/MSc-Thesis-Code | NP/TESTS/TESTS.py | Python | bsd-3-clause | 1,827 |
# vi: ts=4 expandtab
#
# Copyright (C) 2014 Canonical Ltd.
#
# Author: Ben Howard <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3, as
# published by the Free Software Foundation.
#
# Th... | racker/cloud-init-debian-pkg | cloudinit/config/cc_scripts_vendor.py | Python | gpl-3.0 | 1,398 |
'''
idea: if they keep doing this,
the situation is equivalent
to an infinite queue of the form:
1234511223344551111222233334444555511111111....
I guess there's a closed formula for that
but I'll do this iteratively with powers for now, should be log(n)
'''
def whoIsNext(names, n):
power = 1
k = len(names)
... | SelvorWhim/competitive | Codewars/DoubleCola.py | Python | unlicense | 475 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import random
import sys
from ray.rllib.optimizers.segment_tree import SumSegmentTree, MinSegmentTree
from ray.rllib.utils.annotations import DeveloperAPI
from ray.rllib.utils.compression im... | atumanov/ray | python/ray/rllib/optimizers/replay_buffer.py | Python | apache-2.0 | 8,536 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Calendar widget build with Tix (or Tk) Buttons.
Based on ttk Treeview calendar but with improvements in pre-setting date and
integration into other applications. Uses Tix if available for import or else
uses Tkinter.
If selectrange is set to True then a range of dates... | Ripley6811/TAIMAU | src/utils/calendar_tixradiobutton.py | Python | gpl-2.0 | 12,186 |
# Copyright 2017 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... | xodus7/tensorflow | tensorflow/contrib/gan/python/estimator/python/gan_estimator_impl.py | Python | apache-2.0 | 13,936 |
import base64
from django.http import HttpResponse
from django.test import TestCase
from django.test.client import RequestFactory
from django.test.utils import override_settings
from regcore_write.views import security
def _wrapped_fn(request):
return HttpResponse(status=204)
def _encode(username, password):
... | eregs/regulations-core | regcore_write/tests/views_security_tests.py | Python | cc0-1.0 | 2,119 |
from datetime import datetime
from podparser.db import connection
from podparser.parser import Parser
from time import sleep
import os
import unittest
def get_resource_dir():
test_dir = os.path.dirname(os.path.abspath(__file__))
return '%s%c%s' % (test_dir, os.sep, 'resources')
class ApiTest(unittest.TestC... | gmh04/podparser | test/tests.py | Python | gpl-3.0 | 14,371 |
# -*- coding: utf-8 -*-
__author__ = 'Alex Starov'
from django.core.management.base import BaseCommand
class Command(BaseCommand, ):
def handle(self, *args, **options):
from datetime import datetime
print datetime.now()
from applications.product.models import Category
try:
... | AlexStarov/Shop | applications/waitlist/management/commands/processing_waitlist.py | Python | apache-2.0 | 6,648 |
# -*- coding: utf-8 -*-
import datetime
import re
from urllib.parse import urlparse
from SuperGLU.Util.Serialization import SuperGlu_Serializable
class ClassifierEngine(SuperGlu_Serializable):
"""
An engine for calculating the full set of classifications
based on a starting set of classifications of intere... | GeneralizedLearningUtilities/SuperGLU | python_module/SuperGLU/Core/ClassifierEngine.py | Python | mit | 25,526 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Nils Weiss <[email protected]>
# Copyright (C) Enrico Pozzobon <[email protected]>
# This program is published under a GPLv2 license
# scapy.contrib.description = General Motors Local Area Network (GMLAN)
#... | 6WIND/scapy | scapy/contrib/automotive/gm/gmlan.py | Python | gpl-2.0 | 28,396 |
__author__ = 'oskyar'
from django.db import models
from django.utils.translation import ugettext as _
from s3direct.fields import S3DirectField
from smart_selects.db_fields import ChainedManyToManyField
# Manager de Asignatura
class SubjectManager(models.Manager):
def owner(self, pk_subject):
return self... | oskyar/test-TFG | TFG/apps/subject/models.py | Python | gpl-2.0 | 2,996 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from io import BytesIO
from feedgen.feed import FeedGenerator
from flask import session
from sqlalchemy.o... | indico/indico | indico/modules/categories/serialize.py | Python | mit | 6,156 |
"""
/*******************************************************************************
* Copyright (c) cortical.io GmbH. All rights reserved.
*
* This software is confidential and proprietary information.
* You shall use it only in accordance with the terms of the
* license agreement you entered into with cortical... | cortical-io/retina-sdk.py | retinasdk/model/retina.py | Python | bsd-2-clause | 1,224 |
import logging
import os
from .. import auth, errors, utils
from ..constants import DEFAULT_DATA_CHUNK_SIZE
log = logging.getLogger(__name__)
class ImageApiMixin:
@utils.check_resource('image')
def get_image(self, image, chunk_size=DEFAULT_DATA_CHUNK_SIZE):
"""
Get a tarball of an image. Si... | vdemeester/docker-py | docker/api/image.py | Python | apache-2.0 | 20,120 |
"""
Run acceptance tests that use the bok-choy framework
http://bok-choy.readthedocs.org/en/latest/
"""
from paver.easy import task, needs, cmdopts, sh
from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite, Pa11yCrawler
from pavelib.utils.envs import Env
from pavelib.utils.test.utils import check_firefox... | shabab12/edx-platform | pavelib/bok_choy.py | Python | agpl-3.0 | 9,358 |
# 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... | mistercrunch/panoramix | superset/datasets/commands/importers/dispatcher.py | Python | apache-2.0 | 2,694 |
import coffeewhale
import time
def main():
test_func()
@coffeewhale.on_except
def test_func():
print('start sleeping')
time.sleep(1)
print('after sleep')
raise Exception()
# coffeewhale.notify(url="https://hooks.slack.com/services/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",
# result='... | hongkunyoo/coffeewhale | main.py | Python | mit | 375 |
# -*- coding: utf-8 -*-
# Copyright 2020 Green Valley Belgium NV
#
# 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 appl... | our-city-app/oca-backend | src/solutions/common/bizz/news.py | Python | apache-2.0 | 21,315 |
# -*- coding:utf-8 -*-
from __future__ import division
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter
import os
import pandas as pd
from StringIO import StringIO
from til_france.tests.base import til_france_path, create_or_get_figures_directory, ipp_colors, get_data_directory
from til... | TaxIPP-Life/til-france | til_france/plot/population.py | Python | gpl-3.0 | 14,186 |
#
# Copyright (c) 2009-2015 Tom Keffer <[email protected]>
#
# See the file LICENSE.txt for your full rights.
#
"""Statistical accumulators. They accumulate the highs, lows, averages,
etc., of a sequence of records."""
import math
import weewx
from weewx.units import ListOfDicts
class OutOfSpan(ValueError):
... | maniac103/weewx | bin/weewx/accum.py | Python | gpl-3.0 | 14,636 |
"""Script to manage users for the Home Assistant auth provider."""
import argparse
import asyncio
import logging
import os
from homeassistant.auth import auth_manager_from_config
from homeassistant.auth.providers import homeassistant as hass_auth
from homeassistant.core import HomeAssistant
from homeassistant.config i... | fbradyirl/home-assistant | homeassistant/scripts/auth.py | Python | apache-2.0 | 3,410 |
from __future__ import (absolute_import, division, print_function)
from six.moves import (filter, input, map, range, zip) # noqa
import matplotlib.cm as mpl_cm
import matplotlib.pyplot as plt
import iris
import iris.quickplot as qplt
fname = iris.sample_data_path('air_temp.pp')
temperature_cube = iris.load_cube(fn... | duncanwp/iris | docs/iris/src/userguide/plotting_examples/cube_brewer_contourf.py | Python | lgpl-3.0 | 736 |
def callme():
print("Hello serverless world!")
return 42 | mhausenblas/fob | examples/python/helloworld.py | Python | apache-2.0 | 64 |
import math
occur = [1, 1, 1, 5, 1, 1, 2 ,1, 1, 2, 1, 1, 15, 1, 17, 1, 1, 1, 2, 1, 3, 2, 1, 2, 2,7, 1 ,1, 1, 1, 4, 1, 1 ,1, 1, 1, 3, 1, 8, 6, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 2 ,1 ,1, 1, 1, 1 ,1 ,2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 11, 5, 1 ,1, 1, 1, 1 ,1, 1, 1, 1, 1, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... | angelicstrike/Crypto | PS_7.py | Python | gpl-2.0 | 719 |
# 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/monitor/azure-mgmt-monitor/azure/mgmt/monitor/v2020_05_01_preview/aio/operations/_scheduled_query_rules_operations.py | Python | mit | 21,694 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"actualice" es una expresión opcional como "campo1=\'nuevo_valor\'". No se puede actualizar o eliminar resultados de un JOIN',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%... | LispyAriaro/instant-press | languages/es-es.py | Python | gpl-2.0 | 24,893 |
#!/usr/bin/env python
# Copyright (C) 2013 Equinor ASA, Norway.
#
# The file 'test_ecl_sum_vector.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Foundatio... | Statoil/libecl | python/tests/ecl_tests/test_ecl_sum_vector.py | Python | gpl-3.0 | 1,861 |
# coding: utf-8
# # Query `apiso:ServiceType` on pycsw endpoint
# In[1]:
from owslib.csw import CatalogueServiceWeb
from owslib import fes
import numpy as np
# In[2]:
#endpoint = 'http://geoport.whoi.edu/csw'
#endpoint = 'http://data.nodc.noaa.gov/geoportal/csw'
#endpoint = 'http://catalog.data.gov/csw-all'
end... | rsignell-usgs/notebook | CSW/data_doi_gov_pycsw.py | Python | mit | 3,014 |
"""
Tests for the bok-choy paver commands themselves.
Run just this test with: paver test_lib -t pavelib/paver_tests/test_paver_bok_choy_cmds.py
"""
import os
import unittest
from mock import patch, call
from test.test_support import EnvironmentVarGuard
from paver.easy import BuildFailure
from pavelib.utils.test.suite... | Learningtribes/edx-platform | pavelib/paver_tests/test_paver_bok_choy_cmds.py | Python | agpl-3.0 | 8,461 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-06-09 17:23
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('oppia', '0015_tracker_eve... | DigitalCampus/django-oppia | oppia/migrations/0016_auto_20180609_1723.py | Python | gpl-3.0 | 1,215 |
#!/usr/bin/python
#------------------------------------------------------------------------------
#
# This file is a part of autils.
#
# Copyright 2011-2015 Andrew Lamoureux
#
# 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
#... | lwerdna/alib | py/elf.py | Python | gpl-3.0 | 41,567 |
'''
@author: Deniz Altinbuken, Emin Gun Sirer
@note: Utility functions for the runtime. Includes a timer module for collecting measurements.
@copyright: See LICENSE
'''
import socket
import os, sys
import time
import string
import threading
from concoord.enums import *
def findOwnIP():
"""Retrieves the hostname of... | tempbottle/concoord | concoord/utils.py | Python | bsd-3-clause | 5,745 |
# encoding: utf-8
"""
http.py
Created by Thomas Mangin on 2011-12-02.
Copyright (c) 2011-2013 Exa Networks. All rights reserved.
"""
import sys
import time
#from exaproxy.html.images import logo
#from exaproxy.html.img import png
from exaproxy.configuration import load
_HTTP_NAMES = {
'100': 'CONTINUE',
'101': ... | Exa-Networks/exaproxy | lib/exaproxy/http/response.py | Python | bsd-2-clause | 2,353 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2004-2005 Eero Tamminen
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2008 Peter Landgren
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2016 Paul Franklin
#
# This program i... | dermoth/gramps | gramps/plugins/drawreport/statisticschart.py | Python | gpl-2.0 | 47,903 |
# Copyright 2016 The Oppia 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 applicable ... | bjvoth/oppia | main_taskqueue.py | Python | apache-2.0 | 1,318 |
import _plotly_utils.basevalidators
class XValidator(_plotly_utils.basevalidators.InfoArrayValidator):
def __init__(self, plotly_name="x", parent_name="layout.polar.domain", **kwargs):
super(XValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
e... | plotly/plotly.py | packages/python/plotly/plotly/validators/layout/polar/domain/_x.py | Python | mit | 666 |
#
# Copyright (c) 2014 Juniper Networks, Inc. All rights reserved.
#
"""
This file contains implementation of managing physical router configuration
"""
# Import kazoo.client before monkey patching
from cfgm_common.zkclient import ZookeeperClient
from gevent import monkey
monkey.patch_all()
from cfgm_common.vnc_cassa... | vmahuli/contrail-controller | src/config/device-manager/device_manager/device_manager.py | Python | apache-2.0 | 20,916 |
# Copyright 2013 Centrin Data Systems Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | mrunge/openstack_horizon | openstack_horizon/dashboards/settings/password/views.py | Python | apache-2.0 | 870 |
# Authors: Denis Engemann <[email protected]>
#
# License: BSD (3-clause)
import numpy as np
from numpy.polynomial.legendre import legval
from scipy import linalg
from ..utils import logger
from ..io.pick import pick_types, pick_channels, pick_info
from ..surface import _normalize_vectors
from ..bem import _fi... | cmoutard/mne-python | mne/channels/interpolation.py | Python | bsd-3-clause | 7,129 |
from __future__ import print_function, absolute_import
import re
from llvmlite.llvmpy.core import (Type, Builder, LINKAGE_INTERNAL,
Constant, ICMP_EQ)
import llvmlite.llvmpy.core as lc
import llvmlite.binding as ll
from numba import typing, types, cgutils
from numba.utils import cached_property
... | GaZ3ll3/numba | numba/cuda/target.py | Python | bsd-2-clause | 7,904 |
# Copyright 2012 Robert Schroll
#
# This file is part of prsannots and is distributed under the terms of
# the LGPL license. See the file COPYING for full details.
from datetime import datetime
from pyPdf.generic import *
YELLOW = [0.95, 0.9, 0.2]
def float_array(lst):
return ArrayObject([FloatObject(i) for i i... | rschroll/prsannots | prsannots/pdfannotation.py | Python | lgpl-3.0 | 7,437 |
"""Test the module SMOTE."""
# Authors: Guillaume Lemaitre <[email protected]>
# Christos Aridas
# License: MIT
import numpy as np
from sklearn.utils._testing import assert_allclose
from sklearn.utils._testing import assert_array_equal
from sklearn.neighbors import NearestNeighbors
from imblearn.over_s... | scikit-learn-contrib/imbalanced-learn | imblearn/over_sampling/_smote/tests/test_smote.py | Python | mit | 5,082 |
import importlib
import inspect
from celery import task
from django.conf import settings
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk as es7_bulk
from elasticsearch.helpers.errors import BulkIndexError
from elasticsearch_dsl import Document, UpdateByQuery, analyzer, char_filter, token... | mozilla/kitsune | kitsune/search/es7_utils.py | Python | bsd-3-clause | 7,848 |
import unittest
import numpy as np
import latenttrees.lt_helper as lth
from scipy.stats import norm
class TestLtHelper(unittest.TestCase):
pass
def test_norm_logpdf_generator(x, mu, std):
def test(self):
scipy_d = norm(mu, std) # scipy normal distribution
logpdf_scipy = scipy_d.log... | kaltwang/latenttrees | latenttrees/test_lt_helper.py | Python | bsd-3-clause | 880 |
################################################################################
# Copyright (C) 2016 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in th... | guacamoleo/Tensile | Tensile/BenchmarkProblems.py | Python | mit | 27,398 |
'''
qobuz.extension.kooli.script.kooli-xbmc-service
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:part_of: kodi-qobuz
:copyright: (c) 2012-2018 by Joachim Basmaison, Cyril Leclerc
:license: GPLv3, see LICENSE for more details.
'''
from os import path as P
import SocketServer
import socket
import... | tidalf/plugin.audio.qobuz | resources/lib/qobuz/extension/kooli/kooli/script/kooli-xbmc-service.py | Python | gpl-3.0 | 4,243 |
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.variable import tryFloat, mergeDicts, md5, \
possibleTitles, getTitle
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.environment import Env
from urlparse import urlparse
... | coolbombom/CouchPotatoServer | couchpotato/core/providers/base.py | Python | gpl-3.0 | 8,789 |
from twisted.internet.defer import succeed
from twisted.web import server
from twisted.web.server import Site
def resolve_result(request, result):
if isinstance(result, str):
request.write(result)
request.finish()
return succeed(request)
elif result is server.NOT_DONE_YET:
if r... | PuZZleDucK/pixelated-user-agent | service/test/unit/resources/__init__.py | Python | agpl-3.0 | 676 |
import re
type_nameformat_str = '[0-9a-zA-Z_]+'
type_nameformat = re.compile(type_nameformat_str)
type_format = re.compile('\s*type\s+({0}\s*,\s*)+{0}\s*;\s*'.format(type_nameformat_str))
class Type():
def __init__(self, statement):
if not re.fullmatch(type_format, statement):
raise ValueErr... | cepheidxa/python | selinux_check/type.py | Python | gpl-3.0 | 1,016 |
'''
en este archivo se almacenaran todas las caracteristicas de la pantalla, como los colores ancho y alto
'''
ANCHO=800
ALTO=600
BLANCO=(255,255,255)
NEGRO=(0,0,0)
ROJO=(255,0,0)
AZUL=(0,0,255)
VERDE=(0,255,0)
| Jofemago/Computacion-Grafica | plataforma/shooter/configuraciones.py | Python | mit | 212 |
import os
import numpy as np
import pandas as pd
from serenata_toolbox.chamber_of_deputies.dataset import Dataset
from serenata_toolbox.datasets import fetch
COLUMNS = {
'category': 'subquota_description',
'net_value': 'total_net_value',
'recipient_id': 'cnpj_cpf',
'recipient': 'supplier',
}
class ... | marcusrehm/serenata-de-amor | rosie/rosie/chamber_of_deputies/adapter.py | Python | mit | 3,371 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from copy import deepcopy
from io import BytesIO
from pandora.compat import iteritems
from pandora.compat import PY2
from pandora.inflect import underscore
from requests import Request
from requests.packages.urllib3.util import pa... | CorverDevelopment/Poort | src/poort/utils.py | Python | mit | 4,369 |
from Screen import Screen
from Screens.HelpMenu import HelpableScreen
from Screens.MessageBox import MessageBox
from Components.InputDevice import iInputDevices, iRcTypeControl
from Components.Sources.StaticText import StaticText
from Components.Sources.List import List
from Components.config import config, ConfigYesNo... | kajgan/stbgui | lib/python/Screens/InputDeviceSetup.py | Python | gpl-2.0 | 15,398 |
# -*- coding: utf-8 -*-
from django.apps import apps
from django.core.management.base import CommandError, LabelCommand
from django.utils.encoding import force_str
from django_extensions.management.utils import signalcommand
class Command(LabelCommand):
help = "Outputs the specified model as a form definition to... | django-extensions/django-extensions | django_extensions/management/commands/describe_form.py | Python | mit | 2,737 |
# Copyright 2018 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... | hfp/tensorflow-xsmm | tensorflow/python/data/experimental/benchmarks/matching_files_benchmark.py | Python | apache-2.0 | 3,554 |
# Copyright (c) 2018, Frappe and Contributors
# See license.txt
import unittest
import frappe
class TestQualityGoal(unittest.TestCase):
def test_quality_goal(self):
# no code, just a basic sanity check
goal = get_quality_goal()
self.assertTrue(goal)
goal.delete()
def get_quality_goal():
return frappe.get... | mhbu50/erpnext | erpnext/quality_management/doctype/quality_goal/test_quality_goal.py | Python | gpl-3.0 | 517 |
#!/usr/bin/env python
##############################################################################
##
## This file is part of Sardana
##
## http://www.sardana-controls.org/
##
## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
## Sardana is free software: you can redistribute it and/or modify
## it und... | sagiss/sardana | src/sardana/tango/pool/OneDExpChannel.py | Python | lgpl-3.0 | 7,943 |
#Basic Python Server in Flask for showing reports
#Essentially put together from this page: http://flask.pocoo.org/docs/0.10/quickstart/
#Just run this like:
#> python server.py
#and then visit http://localhost:5000
from json import dump, dumps
from datetime import datetime
from pdb import set_trace
from collections i... | matthewruttley/zenko | server.py | Python | mit | 7,255 |
# vim:fileencoding=utf-8:noet
# WARNING: using unicode_literals causes errors in argparse
from __future__ import (division, absolute_import, print_function)
import argparse
import sys
from itertools import chain
from powerline.lib.overrides import parsedotval, parse_override_var
from powerline.lib.dict import mergea... | bartvm/powerline | powerline/commands/main.py | Python | mit | 6,263 |
#!/usr/bin/python3
# level.py
#
# Copyright 2013 Robert Knauer <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | rookies/route94 | lvledit/src/level2.py | Python | gpl-2.0 | 10,726 |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
---------------------------... | teamCarel/EyeTracker | src/shared_modules/calibration_routines/visualizer_calibration.py | Python | lgpl-3.0 | 6,277 |
"""Tests for binary operators on subtypes of built-in types."""
import unittest
from test import test_support
def gcd(a, b):
"""Greatest common divisor using Euclid's algorithm."""
while a:
a, b = b%a, a
return b
def isint(x):
"""Test whether an object is an instance of int or long."""
re... | HiSPARC/station-software | user/python/Lib/test/test_binop.py | Python | gpl-3.0 | 10,741 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import unittest
from griper import (
compile_sql,
assignments_raw,
assignments,
Elements as E,
Name... | asokoloski/griper | test.py | Python | mpl-2.0 | 1,687 |
import glob
import os
import tempfile
import urllib.parse
import plugin
import pluginconf
import requests
import telepot
util = plugin.get("util")
ERROR_USER_UNKNOWN = ("I don't know you, but I'll tell you something. "
"Sometimes, I use words that I don't "
"know to make ... | alobbs/autome | plugins/telegram.py | Python | mit | 5,837 |
#app_quobit models
from django.db import models
from django.contrib.auth.models import User
class QEvent(models.Model):
title = models.CharField(max_length=50)
created_by_user_id = models.IntegerField(max_length=50)
created_by_fbid = models.IntegerField(max_length=50)
created_by_username = models.CharField(max_le... | asen6/amartyasenguptadotcom | app_quobit/models.py | Python | bsd-3-clause | 2,213 |
# -*- coding: utf8 -*-
# Copyright (c) 2015 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import colander
import datetime
import deform
import pytz
from persistent.list import PersistentList
from persistent.dict import PersistentDict
fr... | ecreall/lagendacommun | lac/content/site_folder.py | Python | agpl-3.0 | 15,489 |
# installer for the 'basic' skin
# Copyright 2014 Matthew Wall
from weecfg.extension import ExtensionInstaller
def loader():
return BasicInstaller()
class BasicInstaller(ExtensionInstaller):
def __init__(self):
super(BasicInstaller, self).__init__(
version="0.2",
name='basic... | gjr80/weewx | examples/basic/install.py | Python | gpl-3.0 | 1,046 |
# Copyright 2011 Justin Santa Barbara
# 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 requ... | tmenjo/cinder-2015.1.0 | cinder/tests/integrated/integrated_helpers.py | Python | apache-2.0 | 4,453 |
from Tools.Profile import profile
from enigma import eServiceReference
# workaround for required config entry dependencies.
import Screens.MovieSelection
from Screen import Screen
from Screens.MessageBox import MessageBox
profile("LOAD:enigma")
import enigma
#+++>
from enigma import iServiceInformation
#+++<
profil... | Taapat/enigma2-openpli-fulan | lib/python/Screens/InfoBar.py | Python | gpl-2.0 | 20,915 |
def main():
print "hello world!"
class MyClass(object):
def __init__(self, a, b):
self.a = a
self.b = b
def hello(self):
print "my name is " + self.a + " and I live in " + self.b
class MyChildClass(MyClass):
def hello(self):
print "my name is " + self.a + " and I live in " + se... | bonno800/pynet | class9/world.py | Python | apache-2.0 | 398 |
#
# @section License
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2017, Erik Moqvist
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitatio... | eerimoq/pumbaa | tst/kernel/timer/timer_suite.py | Python | mit | 2,520 |
#!/usr/bin/env python
# This is a shim to hopefully allow Github to detect the package, build is done with poetry
import setuptools
if __name__ == "__main__":
setuptools.setup(name="doubletdetection")
| JonathanShor/DoubletDetection | setup.py | Python | mit | 208 |
"""
This module contains tests for the pulp.repoauth.openssl module.
"""
import subprocess
import unittest
import mock
from pulp.repoauth import openssl
class TestCertificate(unittest.TestCase):
"""
This class contains tests for the Certificate class.
"""
def test___init__(self):
"""
... | ulif/pulp | repoauth/test/test_openssl.py | Python | gpl-2.0 | 10,139 |
# -*- coding:utf-8 -*-
author = 'huangtao'
version = (1, 3, 7)
| Demon-Hunter/tbag | tbag/__init__.py | Python | mit | 64 |
import tkinter as tk
import pytest
@pytest.fixture(scope='session')
def tk_main_win():
return tk.Tk()
| talflon/alho-py | tests/gui/conftest.py | Python | gpl-3.0 | 109 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.