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 |
|---|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013, Big Switch Networks, 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... | tanglei528/horizon | openstack_dashboard/test/api_tests/lbaas_tests.py | Python | apache-2.0 | 16,445 | 0 |
# test-icmp6.py: count types of icmp6 packets
# Copyright (C) 2016, Nevil Brownlee, U Auckland | CAIDA | Wand
from plt_testing import *
from array import *
icmp_info = {} # Empty dictionary
t = get_example_trace('icmp6-sample.pcap')
out_uri = 'pcapfile:icmp6-out.pcap'
of = plt.output_trace(out_uri)
of.start_outpu... | nevil-brownlee/pypy-libtrace | doc/examples/copy-icmp6.py | Python | gpl-3.0 | 961 | 0.004162 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-12-28 02:21
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0006_auto_20161228_1016'),
]
operations = [
migration... | SnowRomance/CMDB | app/migrations/0007_auto_20161228_1021.py | Python | gpl-3.0 | 869 | 0.001151 |
# ################################################################################
# ##
# ## https://github.com/NetASM/NetASM-python
# ##
# ## File:
# ## optimize.py
# ##
# ## Project:
# ## NetASM: A Network Assembly Language for Programmable Dataplanes
# ##
# ## Author:
# ## Muhammad Shahbaz
#... | NetASM/NetASM-python | netasm/netasm/core/optimize.py | Python | gpl-2.0 | 2,688 | 0.001488 |
from setuptools import setup
setup(name='KMOL 2016 project',
version='1.0',
description='OpenShift App',
author='KMOL',
author_email='course@mde.tw',
url='https://www.python.org/community/sigs/current/distutils-sig',
install_requires=['Flask>=0.10.1'],
)
| smpss91341/2016springcd_aG8 | users/a/g8/setup.py | Python | agpl-3.0 | 297 | 0.003367 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Getting Things GNOME! - a personal organizer for the GNOME desktop
# Copyright (c) 2008-2013 - Lionel Dricot & Bertrand Rousseau
#
# This program is free software: you can redistribute it and/or modify it under
# t... | elianerpereira/gtg | GTG/tests/test_interruptible.py | Python | gpl-3.0 | 2,149 | 0.000465 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.utils.timezone
import model_utils.fields
from django.conf import settings
from django.db import migrations, models
import waldur_core.core.fields
import waldur_core.structure.models
class Migration(migrations.Migration):
replaces = [... | opennode/nodeconductor | waldur_core/users/migrations/0001_squashed_0004.py | Python | mit | 3,908 | 0.005885 |
from rest_framework import generics
from .models import Proj
from .serializers import ProjSerializer
# Create your views here.
class ProjList(generics.ListCreateAPIView):
"""be report project list"""
queryset = Proj.objects.all()
serializer_class = ProjSerializer
class ProjDetail(generics.RetrieveUpdateDe... | cmos3511/cmos_linux | python/op/op_site/proj_checker/views.py | Python | gpl-3.0 | 442 | 0.004525 |
# vim:ts=4:et
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This prog... | zlsa/io_object_mu | import_mu.py | Python | gpl-2.0 | 13,186 | 0.003337 |
# -*- coding: utf-8 -*-
import pytest
from model_mommy import mommy
from conftest import create_user
from core.models import Class, Course
@pytest.mark.django_db
def test_lesson(admin_client):
lesson = mommy.make('Lesson', slug='lesson', status='published')
response = admin_client.get('/course/' + lesson.cou... | mupi/tecsaladeaula | core/tests/test_views.py | Python | agpl-3.0 | 13,951 | 0.00423 |
# encoding: utf-8
# module apt_pkg
# from /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
"""
Classes and functions wrapping the apt-pkg library.
The apt_pkg module provides several classes and functions for accessing
the functionality provided by the apt-pkg library. Typica... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/apt_pkg/Cdrom.py | Python | gpl-2.0 | 1,751 | 0.006853 |
__author__ = 'Sarath'
from pyNN import *
import time
from pyNN.optimization.optimization import *
from pyNN.util.Initializer import *
import pickle
class DeepCorrNet2(object):
def init(self, numpy_rng, theano_rng=None, l_rate=0.01, optimization="sgd", tied=False, n_visible_left=None, n_visible_right=None, n_hidd... | apsarath/pyNN | model/crl/deepcorrnet2.py | Python | apache-2.0 | 24,479 | 0.007394 |
# GUI Application automation and testing library
# Copyright (C) 2006-2018 Mark Mc Mahon and Contributors
# https://github.com/pywinauto/pywinauto/graphs/contributors
# http://pywinauto.readthedocs.io/en/latest/credits.html
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or with... | vasily-v-ryabov/pywinauto | pywinauto/tests/miscvalues.py | Python | bsd-3-clause | 4,700 | 0.001064 |
"""
Makes possible reporter classes,
which are triggered on particular events and may provide information to the user,
may do something else such as checkpointing, or may do both.
"""
from __future__ import division, print_function
import time
from neat.math_util import mean, stdev
from neat.six_util import itervalue... | drallensmith/neat-python | neat/reporting.py | Python | bsd-3-clause | 5,924 | 0.002363 |
import urllib, urllib2, sys, httplib
url = "/MELA/REST_WS"
#HOST_IP="128.130.172.191:8180"
newName="EventProcessingTopology_STRATEGY_MELA_COST_RECOMMENDATION_EFFICIENCY_Larger_VMs"
HOST_IP="localhost:8480"
if __name__=='__main__':
connection = httplib.HTTPConnection(HOST_IP)
description_file = open("./2... | tuwiendsg/MELA | MELA-Extensions/MELA-ComplexCostEvaluationService/tests/mela-clients/emulateCost.py | Python | apache-2.0 | 719 | 0.044506 |
# 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... | rabipanda/tensorflow | tensorflow/contrib/tpu/python/ops/tpu_ops.py | Python | apache-2.0 | 3,909 | 0.005628 |
"""
Using dates with timeseries models
"""
import statsmodels.api as sm
import numpy as np
import pandas
# Getting started
# ---------------
data = sm.datasets.sunspots.load()
# Right now an annual date series must be datetimes at the end of the year.
from datetime import datetime
dates = sm.tsa.datetools.dates_fro... | pprett/statsmodels | examples/tsa/ex_dates.py | Python | bsd-3-clause | 1,296 | 0.001543 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.translation impor... | shawnadelic/shuup | shuup/admin/modules/manufacturers/views/list.py | Python | agpl-3.0 | 872 | 0 |
import os
from app import config
"""
Revision ID: 0133_set_services_sms_prefix
Revises: 0132_add_sms_prefix_setting
Create Date: 2017-11-03 15:55:35.657488
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
revision = '0133_set_services_sms_prefix'
down_revision = '0132_add... | alphagov/notifications-api | migrations/versions/0133_set_services_sms_prefix.py | Python | mit | 1,045 | 0 |
from django.utils.translation import ugettext_lazy as _
class PersonGender():
NOT_SPECIFIED = 0
MALE = 1
FEMALE = 2
GENDER_OPTIONS = (
(NOT_SPECIFIED, _('Not specified')),
(MALE, _('Male')),
(FEMALE, _('Female')),
)
class PersonReligion():
NOT_SPECIFIED = 0
CHRIS... | BontaVlad/ExpirationDate | expirationDate/persons/constants.py | Python | mit | 599 | 0 |
# -*- coding: utf-8 -*-
"""
=============================
Chemtrails
=============================
The past trajectory of an animated plot can be visualized with the chemtrails
argument. This displays a low opacity version of the trace behind the
current points being plotted. This can be used in conjunction with the... | ContextLab/hypertools | examples/chemtrails.py | Python | mit | 575 | 0 |
#
# test_codecmaps_tw.py
# Codec mapping tests for ROC encodings
#
from test import support
from test import multibytecodec_support
import unittest
class TestBIG5Map(multibytecodec_support.TestBase_Mapping,
unittest.TestCase):
encoding = 'big5'
mapfileurl = 'http://www.unicode.org/Public/M... | jiangzhuo/kbengine | kbe/src/lib/python/Lib/test/test_codecmaps_tw.py | Python | lgpl-3.0 | 831 | 0.00361 |
import unittest
import singer.statediff as statediff
from singer.statediff import Add, Remove, Change
class TestPaths(unittest.TestCase):
def test_simple_dict(self):
self.assertEqual(
[(('a',), 1),
(('b',), 2)],
statediff.paths({'a': 1, 'b': 2}))
def test_nested_... | singer-io/singer-python | tests/test_statediff.py | Python | apache-2.0 | 2,807 | 0.002494 |
import six, json
from .logclient_operator import list_more
from .logexception import LogException
from .pluralize import pluralize
from .common_response import *
DEFAULT_MAX_LIST_PAGING_SIZE = 500
def create_entity(entity_name, root_resource=None):
def fn(self, project, detail):
""" Create {en... | wjo1212/aliyun-log-python-sdk | aliyun/log/logclient_core.py | Python | mit | 6,959 | 0.003592 |
from .modutil import (
submodules,
submodule_tree,
submodule_leaf_tree,
)
__all__ = [
"submodules",
"submodule_tree",
"submodule_leaf_tree",
]
| sejust/pykit | modutil/__init__.py | Python | mit | 168 | 0 |
import uuid
import requests
import logging
import logging.handlers
import flask_restful
from functools import wraps
from flask import request
from flask_cors import CORS
from flask_restful import Resource, reqparse
from sqlalchemy.orm.relationships import RelationshipProperty
from .. import db, app
from ..models im... | eResearchSA/reporting-unified | unified/apis/__init__.py | Python | apache-2.0 | 10,242 | 0.000683 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
## The point of a SceneNodeDecorator is that it can be added to a SceneNode, where it then provides decorations
# Decorations are functions of a SceneNodeDecorator that can be called (except for functions alr... | thopiekar/Uranium | UM/Scene/SceneNodeDecorator.py | Python | lgpl-3.0 | 934 | 0.009636 |
import json
from copy import deepcopy
from datetime import datetime
from django.core.files.storage import default_storage as storage
from django.urls import reverse
from unittest import mock
import waffle
from pyquery import PyQuery as pq
from olympia import amo
from olympia.addons.models import Addon, AddonUser
fr... | mozilla/addons-server | src/olympia/devhub/tests/test_views_validation.py | Python | bsd-3-clause | 22,989 | 0.000957 |
"""
Visualize Genetic Algorithm to find the shortest path for travel sales problem.
Visit my tutorial website for more: https://morvanzhou.github.io/tutorials/
"""
import matplotlib.pyplot as plt
import numpy as np
START_POINT = list(input("請輸入起始點"))
PASS_POINT = input("輸入要經過的點")
PASS_POINT = PASS_POINT.split(" ")
#... | zhu913104/KMdriod | gapathplanning.py | Python | mit | 5,686 | 0.006184 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/Users/chernomirdinmacuvele/Documents/workspace/PscArt2.0.X/UserInt/ui_codificadores_POT.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
... | InUrSys/PescArt2.0 | GeneratedFiles/ui_codificadores_POT.py | Python | gpl-3.0 | 3,813 | 0.0021 |
import logging
import re
import socket
import binascii
import sys
import os
import time
import gevent
import subprocess
import atexit
from Config import config
from Crypt import CryptRsa
from Site import SiteManager
from lib.PySocks import socks
from gevent.coros import RLock
from util import helper
from Debug import... | bashrc/zeronet-debian | src/src/Tor/TorManager.py | Python | gpl-2.0 | 10,295 | 0.001651 |
from django.contrib import admin
from .models import (
Group,
GroupMembership,
)
class GroupAdmin(admin.ModelAdmin):
list_display = ('name', 'group_type', 'active', 'sequence')
list_filter = ('active',)
search_fields = ('name',)
class GroupMembershipAdmin(admin.ModelAdmin):
list_display =... | ubiquitypress/rua | src/manager/admin.py | Python | gpl-2.0 | 496 | 0 |
# -*- coding: utf-8 -*-
{
'name': 'SaaS Portal Asynchronous database creation',
'version': '1.0.0',
'author': 'IT-Projects LLC',
"support": "apps@it-projects.info",
'website': "https://it-projects.info",
'license': 'GPL-3',
'category': 'SaaS',
'depends': [
'base',
'saas_p... | thinkopensolutions/odoo-saas-tools | saas_portal_async/__openerp__.py | Python | lgpl-3.0 | 459 | 0 |
def check_resource_count(expected_count):
test.assertEqual(expected_count, len(reality.all_resources()))
example_template = Template({
'A': RsrcDef({}, []),
'B': RsrcDef({'a': '4alpha'}, ['A']),
'C': RsrcDef({'a': 'foo'}, ['B']),
'D': RsrcDef({'a': 'bar'}, ['C']),
})
engine.create_stack('foo', exam... | zaneb/heat-convergence-prototype | scenarios/update_interrupt_create.py | Python | apache-2.0 | 673 | 0.001486 |
#!/usr/bin/env python3
import argparse
import struct
import sys
SPC_START_OFFSET = 0x100
SPC_RAM_SIZE = 0x10000
INST_TBL = 0x6C00
INST_ENTRY_LEN = 0x6
SAMPLE_TBL = 0x6D00
SAMPLE_ENTRY_LEN = 0x4
SAMPLE_MAX_ID = 0x4F # completely arbitrary limit
class InstrEntry (object):
srcn = None
adsr = N... | softglow/samplecheck | samplecheck.py | Python | gpl-3.0 | 1,713 | 0.008757 |
# Generated by Django 3.0.4 on 2020-11-05 22:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0010_document_file_hash'),
('pages', '0005_auto_20201105_1414'),
]
operations = [
mi... | openstax/openstax-cms | pages/migrations/0006_auto_20201105_1620.py | Python | agpl-3.0 | 631 | 0.001585 |
from ipv8.requestcache import RandomNumberCache
from tribler_core.utilities.unicode import hexlify
class SearchRequestCache(RandomNumberCache):
"""
This request cache keeps track of all outstanding search requests within the GigaChannelCommunity.
"""
def __init__(self, request_cache, uuid, peers):
... | hbiyik/tribler | src/tribler-core/tribler_core/modules/metadata_store/community/request.py | Python | lgpl-3.0 | 1,680 | 0.002381 |
# Copyright 2016 Euclidean Technologies Management LLC 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 requi... | euclidjda/dnn-quant | scripts/deep_mlp_model.py | Python | apache-2.0 | 7,953 | 0.020118 |
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# 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 limitation the
# rights to use, copy, modify, merge... | metacloud/molecule | test/unit/model/v2/test_schema.py | Python | mit | 1,235 | 0 |
from form_views import *
| jittat/ku-eng-direct-admission | application/views/__init__.py | Python | agpl-3.0 | 25 | 0 |
import TCP
import Steering
import Motor
import time
"""
add
print "right speed: " + str(right_speed)
print "left speed: " + str(left_speed)
under
def receive_message(self, type, message):
if (type == "Gyro" and self.stop == False):
and comment out
self.motors.set_right_speed(right_speed)
self.motors.set_left_... | task123/AutoTT | scriptsForTesting/steeringTest.py | Python | mit | 823 | 0.001215 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module implements more advanced transformations.
"""
import logging
import math
import warnings
from fractions import Fraction
from itertools import groupby, product
from math import gcd
from string im... | richardtran415/pymatgen | pymatgen/transformations/advanced_transformations.py | Python | mit | 88,505 | 0.001955 |
from buck import format_watchman_query_params, glob_internal, LazyBuildEnvPartial
from buck import subdir_glob, BuildFileContext
from pathlib import Path, PurePosixPath, PureWindowsPath
import os
import shutil
import tempfile
import unittest
class FakePathMixin(object):
def glob(self, pattern):
return sel... | Learn-Android-app/buck | src/com/facebook/buck/json/buck_test.py | Python | apache-2.0 | 11,264 | 0.00071 |
"""
Subspace is a modified implementation of the Kademlia protocol for `Twisted <http://twistedmatrix.com>`_.
"""
version_info = (0, 2)
version = '.'.join(map(str, version_info))
| cpacia/Subspace | subspace/__init__.py | Python | mit | 179 | 0.005587 |
# Copyright 2016 Bridgewater Associates
#
# 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 appli... | markofu/security_monkey | security_monkey/watchers/rds/rds_security_group.py | Python | apache-2.0 | 5,590 | 0.001073 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Yue-Wen FANG'
__maintainer__ = "Yue-Wen FANG"
__email__ = 'fyuewen@gmail.com'
__license__ = 'Apache License 2.0'
__creation_date__= 'Dec. 28, 2018'
"""
9-3. Users: Make a class called User . Create two attributes called first_name and last_name, and then cre... | yw-fang/readingnotes | machine-learning/Matthes-crash-course/chapt09/scripts/user_03.py | Python | apache-2.0 | 1,263 | 0.009516 |
# -*- coding: utf-8 -*-
'''
Manage VPCs
=================
.. versionadded:: 2015.8.0
Create and destroy VPCs. Be aware that this interacts with Amazon's services,
and so may incur charges.
This module uses ``boto``, which can be installed via package, or pip.
This module accepts explicit vpc credentials but can als... | smallyear/linuxLearn | salt/salt/states/boto_vpc.py | Python | apache-2.0 | 30,718 | 0.002637 |
# Copyright 2014 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.
from common.chrome_proxy_benchmark import ChromeProxyBenchmark
from integration_tests import chrome_proxy_measurements as measurements
from integration_tests... | SaschaMester/delicium | tools/chrome_proxy/integration_tests/chrome_proxy_benchmark.py | Python | bsd-3-clause | 6,825 | 0.016703 |
#!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | ThomasMiconi/nupic.research | projects/sequence_prediction/discrete_sequences/plotPerturbExperiment.py | Python | agpl-3.0 | 3,263 | 0.005516 |
#! /usr/bin/python3
import sys
import argparse
import itertools
from PIL import Image
if __name__ == '__main__':
argparser = argparse.ArgumentParser()
argparser.add_argument('input')
argparser.add_argument('palette',type=argparse.FileType('wb'))
argparser.add_argument('pattern',type=argparse.FileType(... | DrKylstein/gfxtools | nesimage.py | Python | mit | 5,828 | 0.007378 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | ivannotes/luigi | test/namespace_test.py | Python | apache-2.0 | 1,739 | 0.00345 |
import win32api
import os
import sys
import subprocess
import logging
from itertools import izip_longest
#itertools recipe
def grouper(n, iterable, fillvalue=None):
"grouper(3, 'ABCDEFG', 'x') --> ABC DEF Gxx"
args = [iter(iterable)] * n
return izip_longest(fillvalue=fillvalue, *args)
def harddrive_enumer... | yoavfrancis/KeepItUp | KeepItUp/harddrive_enumerator.py | Python | mit | 1,589 | 0.003776 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for pdeo.database.sql"""
import unittest
# import responses
from pdeo.databases import sql
# if version_info[0] == 2: # utf8 for python2
# from codecs import open
class PdeoDatabaseSqlTestCase(unittest.TestCase):
def setUp(self):
pass
... | oczkers/pdeo | tests/databases/test_sql.py | Python | gpl-3.0 | 407 | 0 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/resource/parameters.py | Python | mit | 474 | 0.00211 |
# -*- coding: utf-8 -*-
'''twoq ordering mixins'''
from threading import local
from itertools import product, groupby
from random import choice, shuffle, sample
from twoq.support import zip_longest, imap
class RandomMixin(local):
'''random mixin'''
def choice(self):
'''random choice of/from incomi... | lcrees/twoq | twoq/ordering.py | Python | bsd-3-clause | 2,474 | 0 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# 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 limitati... | deerwalk/voltdb | tests/sqlcoverage/normalizer/not-a-normalizer.py | Python | agpl-3.0 | 2,364 | 0.002538 |
#!/usr/bin/python
import getopt
import sys
import pymqi, CMQC, CMQCFC
STATE_OK = 0
STATE_WARNING = 1
STATE_CRITICAL = 2
STATE_UNKNOWN = 3
def usage():
print """Usage: rbh_check_mq_channel_status -H <HostName> -g <QMGRName> -p <PortNumber> -a <ChannelName for connection> -t <ChannelName for test>"""
def show_hel... | klapper/nagios-plugins-mq | check_mq_channel.py | Python | mit | 5,483 | 0.010213 |
import time
from PyQt4 import QtGui, QtCore, QtOpenGL
from PyQt4.QtOpenGL import QGLWidget
import OpenGL.GL as gl
import OpenGL.arrays.vbo as glvbo
import numpy as np
import raster
import slider
import draw_texture
import qt_helpers
raster_width = 1024
raster_height = 64
raster_n_neurons = 64
spikes_per_frame = 5
c... | tcstewar/opengl_texture_rendering | sparkle/main_raster.py | Python | gpl-2.0 | 3,315 | 0.00181 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | Ictp/indico | indico/tests/python/unit/util.py | Python | gpl-3.0 | 5,388 | 0.002598 |
"""
This module is essentially a broker to xmodule/tabs.py -- it was originally introduced to
perform some LMS-specific tab display gymnastics for the Entrance Exams feature
"""
from django.conf import settings
from django.utils.translation import ugettext as _, ugettext_noop
from courseware.access import has_access
f... | jbassen/edx-platform | lms/djangoapps/courseware/tabs.py | Python | agpl-3.0 | 10,813 | 0.001665 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/persistence_exp/__init__.py | Python | bsd-3-clause | 2,337 | 0.0184 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2016, MIT Probabilistic Computing Project
#
# 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.apac... | probcomp/bdbcontrib | examples/satellites/build_bdbs.py | Python | apache-2.0 | 9,056 | 0.002761 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2017 Canonical Ltd
#
# 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.
#
# This program is distributed in the h... | sergiusens/snapcraft | snapcraft/internal/project_loader/grammar_processing/_part_grammar_processor.py | Python | gpl-3.0 | 4,927 | 0 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | GoogleCloudPlatform/professional-services | examples/bq-email-exports/tests/send_email_function/test_main.py | Python | apache-2.0 | 2,421 | 0.000413 |
def test1():
SINK(SOURCE)
def test2():
s = SOURCE
SINK(s)
def source():
return SOURCE
def sink(arg):
SINK(arg)
def test3():
t = source()
SINK(t)
def test4():
t = SOURCE
sink(t)
def test5():
t = source()
sink(t)
def test6(cond):
if cond:
t = "Safe"
else... | github/codeql | python/ql/test/library-tests/taint/dataflow/test.py | Python | mit | 2,191 | 0.016431 |
"""
json_io.py
Functions related to reading/writing/mapping json
"""
import json
import ijson
from re import sub
from datetime import datetime
from os import listdir, SEEK_END
from sys import exc_info, stdout
from random import choice, randrange
from nlp import feature
TWEET_LINK_RE = "https://t.co/(\w)+"
TWEET_HAND... | TheWeiTheTruthAndTheLight/senior-design | src/json_io.py | Python | mit | 7,324 | 0.005188 |
import demistomock as demisto
from CommonServerPython import *
from CommonServerUserPython import *
from datetime import datetime, timezone
from typing import Union, Any, Dict
from dateparser import parse
import urllib3
import traceback
# Disable insecure warnings
urllib3.disable_warnings()
''' GLOBAL VARIABLES '''
... | demisto/content | Packs/CrowdStrikeIntel/Integrations/CrowdStrikeFalconIntel_v2/CrowdStrikeFalconIntel_v2.py | Python | mit | 23,184 | 0.002459 |
# Copyright 2016 Red Hat, 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 or agreed to in writing, ... | HybridF5/tempest_debug | tempest/services/identity/v2/json/endpoints_client.py | Python | apache-2.0 | 1,870 | 0 |
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware imp... | austinharris/gem5-riscv | src/arch/x86/isa/insts/general_purpose/input_output/string_io.py | Python | bsd-3-clause | 4,418 | 0 |
import sys
from datetime import datetime, timedelta
from array import array
from numpy import hsplit, asarray
class ECG:
'''Checks validity of selected .ecg file. If it is valid .ecg file creates an instance with all the data stored in .ecg file'''
def __init__(self, filename, enc='cp1250'):
'''Defaul... | panrobot/ishneECGviewer | ecgReader.py | Python | gpl-2.0 | 7,145 | 0.012596 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from dace.processdefinition.processdef import ProcessDefinition
from dace.processdefinition.activitydef import ActivityDefinition
from dace.processdefinition.gatewaydef ... | ecreall/lagendacommun | lac/content/processes/social_applications_management/definition.py | Python | agpl-3.0 | 3,478 | 0.008051 |
import binascii
import code
import importlib
import json
import psycopg2
import readline
import socket
import struct
import sys
import time
from Crypto.Cipher import AES
from datetime import datetime
from multiprocessing import Process
from threading import Thread
import config
from plugins import sensor_ht, magnet, y... | aluminiumgeek/goodbye-mihome | mihome.py | Python | bsd-2-clause | 4,258 | 0.001879 |
import urllib
def command_oraakkeli(bot, user, channel, args):
"""Asks a question from the oracle (http://www.lintukoto.net/viihde/oraakkeli/)"""
if not args: return
args = urllib.quote_plus(args)
answer = getUrl("http://www.lintukoto.net/viihde/oraakkeli/index.php?kysymys=%s&html=0" % args).getCon... | nigeljonez/newpyfibot | modules/module_oraakkeli.py | Python | bsd-3-clause | 459 | 0.010893 |
"""
PymageJ Copyright (C) 2015 Jochem Smit
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the... | nvladimus/zebrascope_targets | MultiviewRegistration/PymageJ-devel/pymagej/roi.py | Python | mit | 24,830 | 0.002416 |
from aimacode.logic import PropKB
from aimacode.planning import Action
from aimacode.search import (
Node, Problem,
)
from aimacode.utils import expr
from lp_utils import (
FluentState, encode_state, decode_state,
)
from my_planning_graph import PlanningGraph
class AirCargoProblem(Problem):
def __init__(s... | fbrei/aind | planning/my_air_cargo_problems.py | Python | mit | 11,755 | 0.003318 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
# test that admin actually saves catalog
from __future__ import unicode_literals
import d... | shoopio/shoop | shuup_tests/campaigns/test_catalog_campaign_admin.py | Python | agpl-3.0 | 7,668 | 0.002347 |
import logging
import re
from airflow.hooks import PigCliHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class PigOperator(BaseOperator):
"""
Executes pig script.
:param pig: the pig latin script to be executed
:type pig: string
:param pig_cli_con... | dud225/incubator-airflow | airflow/operators/pig_operator.py | Python | apache-2.0 | 1,716 | 0.001166 |
# -*- coding: utf-8 -*-
# Copyright 2022 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-service-control | samples/generated_samples/servicecontrol_v1_generated_service_controller_check_async.py | Python | apache-2.0 | 1,437 | 0.000696 |
import sys
sys.path.append("helper")
import web
from helper import session
web.config.debug = False
urls = (
"/", "controller.start.index",
"/1", "controller.start.one",
"/2", "controller.start.two",
)
app = web.application(urls, globals())
sessions = session.Sessions()
if __name__ == "__main__":
app.run()... | 0x00/web.py-jinja2-pyjade-bootstrap | app.py | Python | apache-2.0 | 331 | 0.036254 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 OpenStack LLC.
# 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/l... | rajarammallya/melange | melange/tests/unit/test_extensions.py | Python | apache-2.0 | 1,657 | 0.000604 |
import os,sys
parentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0,parentdir)
from pyN import *
single_neuron = AdExPopulation(name='neuron', N=1)
brain = Network(populations=[single_neuron])
stim = [{'start':10,'stop':100,'mV':14,'neurons':[0]}]
results = brain.simulate(experimen... | ericjang/pyN | pyn_examples/6_AxEx_neuron.py | Python | bsd-2-clause | 496 | 0.042339 |
# -*- coding: utf-8 -*-
from django.views.generic import FormView
class ChangePassword(FormView):
pass
change_password = ChangePassword.as_view() | tokyo-jesus/wampum | user/private_views/_change_password.py | Python | gpl-3.0 | 152 | 0.013158 |
import random
import numpy as np
import pprint
import sys
def generate_random_params(max_rumtime_mins = 2880, param_seed = 1234):
random.seed(param_seed)
np.random.seed(param_seed)
# duration
TIME_TAKEN_FOR_ONE_SIMULATION = 40 # minutes
# params we are concerened about
#CLUST... | roshantha9/AbstractManycoreSim | src/util_scripts/ccpbased_remapping_random_params_generation.py | Python | gpl-3.0 | 2,693 | 0.026365 |
import asyncio
from typing import List
import pytest
from gql import Client, gql
from gql.transport.exceptions import (
TransportClosed,
TransportProtocolError,
TransportQueryError,
)
from .conftest import WebSocketServerHelper
# Marking all tests in this file with the websockets marker
pytestmark = pyt... | graphql-python/gql | tests/test_graphqlws_exceptions.py | Python | mit | 7,525 | 0.00093 |
#!/usr/bin/env python
from runtest import TestBase
class TestCase(TestBase):
def __init__(self):
TestBase.__init__(self, 'namespace', lang="C++", result="""
# DURATION TID FUNCTION
[ 7102] | main() {
2.697 us [ 7102] | operator new();
0.842 us [ 7102] | ns::ns1::foo::foo();
... | namhyung/uftrace | tests/t036_replay_filter_N.py | Python | gpl-2.0 | 1,056 | 0.000947 |
#-------------------------------------------------------------------------------
# Name: demo_python_3
#
# This file shows how to create and populate the ChParticleClones object.
# Also, shows how to use POV ray for postprocessing, thanks to the
# utility functions in the unit_POSTPROCESS of Chrono::Engine.
#
#-... | amelmquist/chrono | src/demos/python/demo_particleclones.py | Python | bsd-3-clause | 5,706 | 0.015247 |
def function4():
return "function4"
| bazelbuild/rules_python | gazelle/testdata/relative_imports/package2/module4.py | Python | apache-2.0 | 40 | 0 |
from __future__ import absolute_import
from .MockPrinter import MockPrinter
import mock
from random import random
class M201_Tests(MockPrinter):
def setUp(self):
self.printer.path_planner.native_planner.setAcceleration = mock.Mock()
self.printer.axis_config = self.printer.AXIS_CONFIG_XY
self.printer.sp... | intelligent-agent/redeem | tests/gcode/test_M201.py | Python | gpl-3.0 | 3,414 | 0.010838 |
# 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 ... | Hybrid-Cloud/badam | patches_tool/aws_patch/aws_deps/libcloud/test/dns/test_google.py | Python | apache-2.0 | 7,924 | 0.000883 |
# -*- coding: utf-8 -*-
# Copyright (C) 2008-2011, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# License: MIT. See COPYING.MIT file in the milk distribution
from __future__ import division
from collections import defaultdict
import numpy as np
from .base import supervised... | arnaudsj/milk | milk/supervised/knn.py | Python | mit | 1,620 | 0.006173 |
# ********************************************************************************************************************************* #
# Name: api_example_python.py #
# Desc: full api example ... | johnmcilwain/cdnetworks | api_example_python.py | Python | apache-2.0 | 5,957 | 0.008058 |
from ply import lex, yacc
class Lexer:
reserved = {
#'ikawna' : 'IF',
#'syapala' : 'ELSE',
#'akona' : 'ELSEIF',
#'kamipa' : 'WHILE',
#'ibalik' : 'RETURN',
'tayona' : 'MAIN',
'ayokona' : 'END',
... | habagat/hugot214 | LexerParser.py | Python | gpl-3.0 | 9,650 | 0.023316 |
#!/usr/bin/env python
from utils import *
########################################################
# Test: Node Tuning Operator: custom tuning is working #
########################################################
# Changes: #
# skordas: ... | mffiedler/svt | openshift_tooling/node_tuning_operator/nto_test_custom_tuning.py | Python | apache-2.0 | 5,119 | 0.003907 |
# -*- coding: utf-8 -*-
import sys
import datetime
from django.core.management.base import BaseCommand, CommandError
from django.core.cache import cache
from registrations.models import Registration
from forecasts import handlers
from forecasts.lib.forecast import Forecast
class Command(BaseCommand):
def handl... | greencoder/hopefullysunny-django | forecasts/management/commands/send_daily_forecasts.py | Python | mit | 1,298 | 0.007704 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versio... | PhilLidar-DAD/geonode | geonode/layers/admin.py | Python | gpl-3.0 | 3,475 | 0.000288 |
"""Tests for user-friendly public interface to polynomial functions. """
from sympy.polys.polytools import (
Poly, PurePoly, poly,
parallel_poly_from_expr,
degree, degree_list,
LC, LM, LT,
pdiv, prem, pquo, pexquo,
div, rem, quo, exquo,
half_gcdex, gcdex, invert,
subresultants,
resu... | ChristinaZografou/sympy | sympy/polys/tests/test_polytools.py | Python | bsd-3-clause | 106,569 | 0.001314 |
# (C) 2015, 2016 Elke Schaper
"""
:synopsis: The Plate Class.
.. moduleauthor:: Elke Schaper <elke.schaper@isb-sib.ch>
"""
import itertools
import logging
import pickle
import random
import re
import string
import GPy
import numpy as np
import pylab
import scipy.stats
import hts.data_tasks.gaussian_process... | elkeschaper/hts | hts/plate/plate.py | Python | gpl-2.0 | 35,353 | 0.006082 |
keyBindings = { }
from keyids import KEYIDS
from Components.config import config
from Components.RcModel import rc_model
keyDescriptions = [{
KEYIDS["BTN_0"]: ("UP", "fp"),
KEYIDS["BTN_1"]: ("DOWN", "fp"),
KEYIDS["KEY_OK"]: ("OK", ""),
KEYIDS["KEY_UP"]: ("UP",),
KEYIDS["KEY_DOWN"]: ("DOWN",),
KEYIDS["KEY_... | opendroid-Team/enigma2-4.1 | lib/python/Tools/KeyBindings.py | Python | gpl-2.0 | 4,901 | 0.030402 |
# Copyright 2014 PressLabs SRL
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | ksmaheshkumar/gitfs | gitfs/views/read_only.py | Python | apache-2.0 | 1,744 | 0 |
# set command to set global variables
from lib.utils import *
def _help():
usage = '''
Usage: set [options] (var) [value]
[options]:
-h Print this help.
-del (var) Delete variable
(var) if defined.
where (var) is a valid
global variable
if [value] is not given,
current v... | nayas360/pyterm | bin/set.py | Python | mit | 1,471 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.