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 |
|---|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright (c) 2014 CNRS
# Author: Steve Tonneau
#
# This file is part of hpp-rbprm-corba.
# hpp-rbprm-corba is free software: you can redistribute it
# and/or modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either version
# 3 of ... | rlefevre1/hpp-rbprm-corba | src/hpp/corbaserver/rbprm/rbprmbuilder.py | Python | lgpl-3.0 | 12,303 | 0.017719 |
# -*- coding: utf-8 -*-
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_generated_aiplatform_v1_model_service_export_model_sync.py | Python | apache-2.0 | 1,552 | 0.000644 |
import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_browse as h2b, h2o_import as h2i, h2o_glm
def write_syn_libsvm_dataset(csvPathname, rowCount, colCount, SEED):
r1 = random.Random(SEED)
dsf = open(csvPathname, "w+")
for i in range(rowCount):
rowDa... | vbelakov/h2o | py/testdir_single_jvm/test_GLM2_many_cols_libsvm.py | Python | apache-2.0 | 2,663 | 0.009763 |
# -*- coding: utf-8 -*-
from django.db import migrations
from django.core.management.sql import emit_post_migrate_signal
PERMISSIONS = {
'mailstatus': [
('add_mailstatus', 'Can add mail status'),
('change_mailstatus', 'Can change mail status'),
('change_mine_mailstatus', 'Can change_mine ma... | crunchmail/munch-core | src/munch/apps/campaigns/migrations/0002_permissions.py | Python | agpl-3.0 | 9,257 | 0.001296 |
from twisted.trial import unittest
from rtpmidi.engines.midi.recovery_journal_chapters import *
class TestNote(unittest.TestCase):
def setUp(self):
self.note = Note()
def test_note_on(self):
#simple
note_to_test = self.note.note_on(100, 90)
#Testing type
assert(type(n... | avsaj/rtpmidi | rtpmidi/test/test_recovery_journal_chapters.py | Python | gpl-3.0 | 22,784 | 0.01207 |
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, run_all
from utilities import side_by_side_image
import os, mapnik
import re
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))... | TemplateVoid/mapnik | tests/python_tests/image_filters_test.py | Python | lgpl-2.1 | 2,704 | 0.005547 |
# Copyright 2020 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... | frreiss/tensorflow-fred | tensorflow/python/ops/numpy_ops/np_array_ops.py | Python | apache-2.0 | 60,984 | 0.010675 |
#! /usr/bin/env python
# This script converts the fits files from the NIRCam CRYO runs
# into ssb-conform fits files.
import sys, os,re,math
import optparse,scipy
from jwst import datamodels as models
from astropy.io import fits as pyfits
import numpy as np
class nircam2ssbclass:
def __init__(self):
... | JarronL/pynrc | dev_utils/DMS/nircam2ssb.py | Python | mit | 16,914 | 0.018565 |
#!/usr/bin/python
import glob,re,sys,math,pyfits
import numpy as np
import utils
if len( sys.argv ) < 2:
print '\nconvert basti SSP models to ez_gal fits format'
print 'Run in directory with SED models for one metallicity'
print 'Usage: convert_basti.py ez_gal.ascii\n'
sys.exit(2)
fileout = sys.argv[1]
# try to... | drdangersimon/EZgal | examples/convert/convert_basti.py | Python | gpl-2.0 | 3,979 | 0.047751 |
from __future__ import print_function, absolute_import
import numpy as np
from numba import cuda, int32, float32
from numba.cuda.testing import unittest
from numba.config import ENABLE_CUDASIM
def useless_sync(ary):
i = cuda.grid(1)
cuda.syncthreads()
ary[i] = i
def simple_smem(ary):
N = 100
sm ... | ssarangi/numba | numba/cuda/tests/cudapy/test_sync.py | Python | bsd-2-clause | 3,582 | 0 |
"""Spectral Embedding"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Wei LI <kuantkid@gmail.com>
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import sparse
from scipy.linalg import eigh
from scipy.sparse.linalg import lobpcg
from ..base import BaseEstimator
from ..ext... | thilbern/scikit-learn | sklearn/manifold/spectral_embedding_.py | Python | bsd-3-clause | 19,492 | 0.000103 |
"""
Oozebane is a script to turn off the extruder before the end of a thread and turn it on before the beginning.
The default 'Activate Oozebane' checkbox is on. When it is on, the functions described below will work, when it is off, the functions
will not be called.
The important value for the oozebane preferences ... | natetrue/ReplicatorG | skein_engines/skeinforge-0006/skeinforge_tools/oozebane.py | Python | gpl-2.0 | 29,728 | 0.038415 |
__source__ = 'https://leetcode.com/problems/binary-tree-tilt/'
# Time: O(n)
# Space: O(n)
#
# Description: 563. Binary Tree Tilt
#
# Given a binary tree, return the tilt of the whole tree.
#
# The tilt of a tree node is defined as the absolute difference between the sum of all left subtree node values
# and the sum of... | JulyKikuAkita/PythonPrac | cs15211/BinaryTreeTilt.py | Python | apache-2.0 | 2,991 | 0.003009 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# CAVEAT UTILITOR
#
# This file was automatically generated by Grako.
#
# https://pypi.python.org/pypi/grako/
#
# Any changes you make to it will be overwritten the next time
# the file is generated.
from __future__ import print_function, division, absolute_import, un... | rjw57/rbc | rbc/parser.py | Python | mit | 24,773 | 0.000121 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/vault_secret_group_py3.py | Python | mit | 1,468 | 0.001362 |
"""
WSGI config for mjuna project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mjuna.settings")
from django.core.wsgi ... | timokoola/mjuna | mjuna/mjuna/wsgi.py | Python | apache-2.0 | 385 | 0.002597 |
# -*- coding: utf-8 -*-
import datetime
import json
import time
from unittest import TestCase
import requests_mauth
import mock
from mock import patch
from six import assertRegex
from flask_mauth.mauth.authenticators import LocalAuthenticator, AbstractMAuthAuthenticator, RemoteAuthenticator, \
mws_attr
from flas... | mdsol/flask-mauth | tests/test_authenticators.py | Python | mit | 42,880 | 0.002705 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 requir... | mrunge/openstack_horizon | openstack_horizon/dashboards/identity/groups/tables.py | Python | apache-2.0 | 8,157 | 0 |
from hypothesis import given, strategies as st
import numpy as np
from pysaliency.numba_utils import auc_for_one_positive
from pysaliency.roc import general_roc
def test_auc_for_one_positive():
assert auc_for_one_positive(1, [0, 2]) == 0.5
assert auc_for_one_positive(1, [1]) == 0.5
assert auc_for_one_pos... | matthias-k/pysaliency | tests/test_numba_utils.py | Python | mit | 762 | 0.001312 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Utility for checking and processing licensing information in third_party
directories.
Usage: licenses.py <command>
Commands:
... | mogoweb/chromium-crosswalk | tools/licenses.py | Python | bsd-3-clause | 16,956 | 0.002359 |
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | noroutine/ansible | lib/ansible/modules/cloud/amazon/s3_lifecycle.py | Python | gpl-3.0 | 15,265 | 0.002489 |
from setuptools import setup
setup(
name="pystor",
version="0.9.1",
author="Ethronsoft",
author_email='dev@ethronsoft.com',
zip_safe=False,
packages=["ethronsoft", "ethronsoft.pystor"],
license=open("LICENSE.txt").read(),
include_package_data=True,
keywords="nosql document store se... | ethronsoft/stor | bindings/python/setup.py | Python | bsd-2-clause | 737 | 0.004071 |
from . import views
def register_in(router):
router.register(r'openstack', views.OpenStackServiceViewSet, base_name='openstack')
router.register(r'openstack-images', views.ImageViewSet, base_name='openstack-image')
router.register(r'openstack-flavors', views.FlavorViewSet, base_name='openstack-flavor')
... | opennode/nodeconductor-openstack | src/waldur_openstack/openstack/urls.py | Python | mit | 928 | 0.009698 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-07 23:02
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):
initial = True
dependencies = [
('auth', ... | PreppyLLC-opensource/django-advanced-filters | advanced_filters/migrations/0001_initial.py | Python | mit | 1,420 | 0.003521 |
# 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 ... | henrymp/coursebuilder | controllers/utils.py | Python | apache-2.0 | 17,556 | 0.000627 |
"""
Test helper functions and base classes.
"""
import inspect
import json
import unittest
import functools
import operator
import pprint
import requests
import os
import urlparse
from contextlib import contextmanager
from datetime import datetime
from path import Path as path
from bok_choy.javascript import js_defined... | shashank971/edx-platform | common/test/acceptance/tests/helpers.py | Python | agpl-3.0 | 24,524 | 0.003058 |
from random import random
from banti.linegraph import LineGraph
class Weight():
def __init__(self, val):
self.val = val
def combine(self, other):
return random() < .3, Weight(int(100*random())+(self.val+other.val)//2)
def strength(self):
return self.val
def __repr__(self):
... | TeluguOCR/banti_telugu_ocr | tests/linegraph_test.py | Python | apache-2.0 | 691 | 0.002894 |
__all__ = ['chatcommand', 'execute_chat_command', 'save_matchsettings', '_register_chat_command']
import functools
import inspect
from .events import eventhandler, send_event
from .log import logger
from .asyncio_loop import loop
_registered_chat_commands = {} # dict of all registered chat commands
async def exe... | juergenz/pie | src/pie/chat_commands.py | Python | mit | 3,649 | 0.004111 |
from __future__ import absolute_import
import base64
import typing as tp
from selenium.common.exceptions import WebDriverException
from applitools.core import EyesScreenshot, EyesError, Point, Region, OutOfBoundsError
from applitools.utils import image_utils
from applitools.selenium import eyes_selenium_utils
from a... | applitools/eyes.selenium.python | applitools/selenium/capture/eyes_webdriver_screenshot.py | Python | apache-2.0 | 9,401 | 0.004148 |
from functools import wraps
from flask import Flask, make_response
from werkzeug.contrib.atom import AtomFeed
from datetime import datetime as dt
from HTMLParser import HTMLParser
from bs4 import BeautifulSoup
import praw
app = Flask(__name__)
def get_api():
USER_AGENT = "reddit_wrapper for personalized rss see: ... | kotfic/reddit_elfeed_wrapper | reddit_elfeed_wrapper/app.py | Python | gpl-2.0 | 2,387 | 0.001676 |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | tsdmgz/ansible | lib/ansible/modules/storage/netapp/sf_account_manager.py | Python | gpl-3.0 | 8,755 | 0.002284 |
import sys, os
import tweepy
# File with colon-separaten consumer/access token and secret
consumer_file='twitter.consumer'
access_file='twitter.access'
def __load_auth(file):
if os.path.exists(file):
with open(file) as f:
tokens = f.readline().replace('\n','').replace('\r','').split(':')
... | marc0uk/twit | twit.py | Python | mit | 1,468 | 0.008174 |
# -*- coding: utf-8 -*-
from __future__ import with_statement, print_function, absolute_import
import os
from requests_oauthlib import OAuth1Session
def create_oauth_token(expiration=None, scope=None, key=None, secret=None, name=None, output=True):
"""
Script to obtain an OAuth token from Trello.
Must ha... | sarumont/py-trello | trello/util.py | Python | bsd-3-clause | 3,964 | 0.002018 |
import renderer | ellmo/rogue-python-engine | rpe/rendering/__init__.py | Python | gpl-3.0 | 15 | 0.066667 |
from model.contact import Contact #создаем скрипт для генерации групп с последующим сохранением в файл
import random
import string
import os.path
import jsonpickle
import getopt
import sys
try: #почитай про трай
opts, args = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts","file"]) #опция n задает кол-во... | HowAU/python-training | generator/contact.py | Python | apache-2.0 | 2,357 | 0.017288 |
#Made by Zachary C. on 9/21/16 last edited on 9/21/16
#CONSTANTS
HOURS_DAY = 24
MINUTES_HOUR = 60
SECONDS_MINUTE = 60
#1. Greet the user and explain the program
#2. Ask the user to input the number of days
#3. save the number of days
days = float(input('This program converts days into hours, minutes, and seconds.\nPle... | Tiduszk/CS-100 | Chapter 2/Practice Exam/Practice Exam.py | Python | gpl-3.0 | 1,064 | 0.032895 |
# -*- coding: utf-8 -*-
import sys, numpy, scipy
import scipy.cluster.hierarchy as hier
import scipy.spatial.distance as dist
import csv
import scipy.stats as stats
import json
import networkx as nx
from networkx.readwrite import json_graph
def makeNestedJson(leaf) :
leaf=json.loads(leaf)
#A tree is ... | ChunggiLee/ChunggiLee.github.io | Heatmap/newData.py | Python | bsd-3-clause | 22,372 | 0.013767 |
r"""
Description: Generates 2-D data maps from OpenFoam data saved by paraview
as a CSV file. The data has to be saved as point data and the following fields
are expected p, points:0->2, u:0->2. An aperture map is the second main input
and is used to generate the interpolation coordinates as well as convert
the flow ve... | stadelmanma/netl-AP_MAP_FLOW | apmapflow/scripts/apm_process_paraview_data.py | Python | gpl-3.0 | 6,758 | 0.000148 |
# encoding: 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 'VoterFile.voter_file_content'
db.add_column('helios_voterfile', 'voter_file_content', self... | dmgawel/helios-server | helios/south_migrations/0007_auto__add_field_voterfile_voter_file_content__chg_field_voterfile_vote.py | Python | apache-2.0 | 11,336 | 0.00891 |
#!/usr/bin/env python3
import sys
from collections import defaultdict, deque
from dataclasses import dataclass
@dataclass
class Nobe:
children: object
metadata: object
argh = 0
def parse(data):
global argh
children = data.popleft()
metadata = data.popleft()
print(children, metadata)
nobe... | msullivan/advent-of-code | 2018/8a.py | Python | mit | 712 | 0.007022 |
from chatterbot.adapters import Adapter
from chatterbot.adapters.exceptions import AdapterNotImplementedError
class IOAdapter(Adapter):
"""
This is an abstract class that represents the interface
that all input-output adapters should implement.
"""
def process_input(self):
"""
Ret... | DarkmatterVale/ChatterBot | chatterbot/adapters/io/io.py | Python | bsd-3-clause | 594 | 0 |
# Copyright (c) 2020 Greg Pintilie - pintilie@mit.edu
# 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, me... | gregdp/segger | Segger/iseg_dialog.py | Python | mit | 43,661 | 0.0366 |
# -*- coding: utf-8 -*-
# strsync - Automatically translate and synchronize .strings files from defined base language.
# Copyright (c) 2015 metasmile cyrano905@gmail.com (github.com/metasmile)
from __future__ import print_function
import strparser, strparser_intentdefinition, strlocale, strtrans
import time, os, sys, ... | metasmile/strsync | strsync/strsync.py | Python | gpl-3.0 | 26,146 | 0.004169 |
from collections import defaultdict
from django.core.files.storage import DefaultStorage
from django.core.management.base import BaseCommand, CommandError
from candidates.csv_helpers import list_to_csv, memberships_dicts_for_csv
from elections.models import Election
def safely_write(output_filename, memberships_lis... | DemocracyClub/yournextrepresentative | ynr/apps/candidates/management/commands/candidates_create_csv.py | Python | agpl-3.0 | 3,846 | 0.00026 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/v2017_10_01/models/effective_network_security_rule_py3.py | Python | mit | 5,742 | 0.003657 |
from flask import render_template, jsonify, url_for, abort, request, redirect, current_app
from flask_wtf import Form
from flask_user import current_user
from silverflask import db
from silverflask.models import User
from silverflask.fields import GridField
from silverflask.core import Controller
from silverflask.cont... | wolfv/SilverFlask | silverflask/controllers/security_controller.py | Python | bsd-2-clause | 1,824 | 0.002193 |
# Copyright (C) 2013, Walter Bender - Raul Gutierrez Segales
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This ... | icarito/sugar | extensions/cpsection/webaccount/view.py | Python | gpl-3.0 | 4,477 | 0 |
# -*- coding: UTF-8 -*-
# Copyright 2017-2021 Rumma & Ko Ltd
# License: BSD, see LICENSE for more details.
"""Utilities for atelier.invlib
"""
from invoke.exceptions import Exit
from atelier.utils import confirm, cd
def must_confirm(*args, **kwargs):
if not confirm(''.join(args)):
raise Exit("User fai... | lsaffre/atelier | atelier/invlib/utils.py | Python | bsd-2-clause | 8,921 | 0.000897 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack, 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.... | tylertian/Openstack | openstack F/cinder/cinder/api/sizelimit.py | Python | apache-2.0 | 1,789 | 0.001118 |
# Copyright 2015 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 agreed to in writing, s... | googleapis/python-dns | tests/unit/test_changes.py | Python | apache-2.0 | 12,894 | 0.000388 |
from lumberjack.client.file_descriptor import FileDescriptorEndpoint
from lumberjack.client.message_receiver import MessageReceiverFactory
from lumberjack.client.message_forwarder import RetryingMessageForwarder
from lumberjack.client.protocol import LumberjackProtocolFactory
from lumberjack.util.object_pipe import Obj... | tuck182/syslog-ng-mod-lumberjack-py | src/lumberjack/client/process.py | Python | gpl-2.0 | 3,727 | 0.015562 |
# Copyright (c) 2016 The Johns Hopkins University/Applied Physics Laboratory
# 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/LICEN... | viktorTarasov/PyKMIP | kmip/services/server/crypto/api.py | Python | apache-2.0 | 2,580 | 0 |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
# -*- test-case-name: flocker.provision.test.test_install -*-
"""
Install flocker on a remote node.
"""
import posixpath
from textwrap import dedent
from urlparse import urljoin, urlparse
from effect import Func, Effect
import yaml
from zope.interface impo... | Azulinho/flocker | flocker/provision/_install.py | Python | apache-2.0 | 36,812 | 0 |
i = 0
while i <3:
while i <2:
i += 1
i += 1
| RedHatQE/python-moncov | test/code/while_some_while_some.py | Python | gpl-3.0 | 48 | 0.104167 |
from math import pi, sin, cos, tan, sqrt
from recordclass import recordclass
import numpy as np
import scipy.signal as signal
import matplotlib.pyplot as plt
from functools import reduce
def db2a(db):
return np.power(10, (db / 20.0))
def a2db(a):
return 20 * np.log10(a)
def series_coeffs(c):
return redu... | reuk/waveguide | scripts/python/boundary_modelling.py | Python | gpl-2.0 | 3,922 | 0.001785 |
################################################################################
# Copyright (C) 2012-2013 Leap Motion, Inc. All rights reserved. #
# Leap Motion proprietary and confidential. Not for distribution. #
# Use subject to the terms of the Leap Motion SDK Agreement available at ... | if1live/marika | server/sample.py | Python | mit | 6,943 | 0.004609 |
"""
Installs and configures Cinder
"""
import os
import re
import uuid
import logging
from packstack.installer import exceptions
from packstack.installer import processors
from packstack.installer import validators
from packstack.installer import basedefs
from packstack.installer import utils
from packstack.modules... | radez/packstack | packstack/plugins/cinder_250.py | Python | apache-2.0 | 16,938 | 0.010922 |
"""Testing the StringEnum class."""
import ezenum as eze
def test_basic():
"""Just check it out."""
rgb = eze.StringEnum(['Red', 'Green', 'Blue'])
assert rgb.Red == 'Red'
assert rgb.Green == 'Green'
assert rgb.Blue == 'Blue'
assert rgb[0] == 'Red'
assert rgb[1] == 'Green'
assert rgb[2... | shaypal5/ezenum | tests/test_string_enum.py | Python | mit | 408 | 0 |
# -*- coding:utf-8 -*-
#
# Copyright 2014 Hewlett-Packard Development Company, L.P.
#
# SPDX-License-Identifier: Apache-2.0
import bandit
from bandit.core import test_properties as test
def get_bad_proto_versions(config):
return config['bad_protocol_versions']
def gen_config(name):
if name == 'ssl_with_bad... | sonntagsgesicht/regtest | .aux/venv/lib/python3.9/site-packages/bandit/plugins/insecure_ssl_tls.py | Python | apache-2.0 | 9,646 | 0 |
from __future__ import absolute_import
import logging
import struct
import six
from six.moves import xrange
import kafka.common
import kafka.protocol.commit
import kafka.protocol.fetch
import kafka.protocol.message
import kafka.protocol.metadata
import kafka.protocol.offset
import kafka.protocol.produce
from kafka... | gamechanger/kafka-python | kafka/protocol/legacy.py | Python | apache-2.0 | 14,397 | 0.002084 |
#
# Copyright 2008 Google Inc. All Rights Reserved.
"""
The user module contains the objects and methods used to
manage users in Autotest.
The valid action is:
list: lists user(s)
The common options are:
--ulist / -U: file containing a list of USERs
See topic_common.py for a High Level Design and Algorithm.
"""
... | lmr/autotest | cli/user.py | Python | gpl-2.0 | 2,827 | 0 |
# This file is part of the FragDev Website.
#
# the FragDev Website 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.
#
# the FragDev W... | lo-windigo/fragdev | images/urls.py | Python | agpl-3.0 | 801 | 0.004994 |
from Graph import Graph
def mkTestGraph4():
return Graph(
['a','b','c','d'],
[ ('a','b'),
('b','c'),
('c','a'),
('a','d')
]
)
def mkTestGraph4b(): ## isomorphic with 4
return Graph(
['a','c','b','d'],
... | J-Adrian-Zimmer/GraphIsomorphism | TestGraphs.py | Python | mit | 5,052 | 0.047902 |
#!/usr/bin/env priithon
import os, sys
import six
import wx, wx.lib.scrolledpanel as scrolled
import wx.lib.agw.aui as aui # from wxpython4.0, wx.aui does not work well, use this instead
try:
from ..Priithon import histogram, useful as U
from ..PriCommon import guiFuncs as G ,microscope, imgResample
... | macronucleus/chromagnon | Chromagnon/ndviewer/main.py | Python | mit | 43,167 | 0.011328 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2013, Adam Miller <maxamillion@fedoraproject.org>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadat... | valentin-krasontovitsch/ansible | lib/ansible/modules/system/firewalld.py | Python | gpl-3.0 | 29,694 | 0.001886 |
# encoding: 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 'Flag.testing'
db.add_column('waffle_flag', 'testing', self.gf('django.db.models.fields.Boo... | mark-adams/django-waffle | waffle/south_migrations/0004_auto__add_field_flag_testing.py | Python | bsd-3-clause | 5,923 | 0.008779 |
from datetime import datetime
class ModelManager(object):
def __init__(self, db, collection_name, has_stats=False, **kwargs):
self.property_helper = None
self.log_helper = None
self.collection_name = collection_name
self.db = db
if 'logger' in kwargs:
self.log_... | texttochange/vusion-backend | vusion/persist/model_manager.py | Python | bsd-3-clause | 2,407 | 0.001662 |
#***************************************************************************
#* *
#* Copyright (c) 2015 - Victor Titov (DeepSOIC) *
#* <vv.titov@gmail.com> *
#* ... | DeepSOIC/Lattice | latticeShapeString.py | Python | lgpl-2.1 | 12,398 | 0.014518 |
#
# Copyright 2009 Eigenlabs Ltd. http://www.eigenlabs.com
#
# This file is part of EigenD.
#
# EigenD 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) a... | Eigenlabs/EigenD | plg_macosx/caprobe.py | Python | gpl-3.0 | 794 | 0.002519 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import logging
import time
import logging.config
dir_cur = os.path.normpath(os.path.dirname(os.path.abspath(__file__)).split('bin')[0])
if dir_cur not in sys.path:
sys.path.insert(0, dir_cur)
log_dir = os.path.normpath(dir_cur + os.path.sep + 'logs' ... | lowitty/zacademy | bin/trap_snmp_v2_v3.py | Python | mit | 6,374 | 0.004864 |
from cl.api import views
from cl.audio import api_views as audio_views
from cl.people_db import api_views as judge_views
from cl.search import api_views as search_views
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
# Search & Audio
router.register(... | voutilad/courtlistener | cl/api/urls.py | Python | agpl-3.0 | 2,240 | 0 |
l, r = [int(x) for x in input().split()]
if max(l,r) == 0:
print("Not a moose")
elif l == r:
print("Even {}".format(l+r))
else:
print("Odd {}".format(max(l,r)*2))
| rvrheenen/OpenKattis | Python/judgingmoose/judgingmoose.py | Python | mit | 176 | 0.017045 |
"""
Created on April 14, 2017
@author Miguel Contreras Morales
"""
import QueryTool
import datetime
import cherrypy as QueryServer
import os
if __name__ == "__main__":
"""
This initializes CherryPy services
+ self - no input required
"""
print "Intializing!"
portn... | neosinha/automationengine | AutomationEngine/QueryTool/Main.py | Python | mit | 1,129 | 0.009743 |
from bokeh.util.deprecate import deprecated_module
deprecated_module('bokeh.properties', '0.11', 'use bokeh.core.properties instead')
del deprecated_module
from .core.properties import * # NOQA
| phobson/bokeh | bokeh/properties.py | Python | bsd-3-clause | 195 | 0.010256 |
# -*- coding: utf-8 -*-
# Copyright 2017 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Indonesia - Bukti Potong PPh 4 Ayat 2 (F.1.1.33.09)",
"version": "8.0.1.1.0",
"category": "localization",
"website": "https://opensynergy-indonesia.com/",
"author... | open-synergy/opnsynid-l10n-indonesia | l10n_id_taxform_bukti_potong_pph_f113309/__openerp__.py | Python | agpl-3.0 | 719 | 0 |
import gzip
import os
import numpy as np
import cPickle as pickle
import six
from six.moves.urllib import request
import scipy
from scipy import io
# from sklearn import decomposition
'''
BVH
'''
def load_bvh_data(file_path):
frames = 0
frame_time = 0.0
with open(file_path, "rb") as f:
lines... | ruohoruotsi/Wavelet-Tree-Synth | nnet/keeper_LSTMVRAE-JayHack-RyotaKatoh-chainer/dataset.py | Python | gpl-2.0 | 7,469 | 0.002946 |
#!/usr/bin/env python
from livereload import Server, shell
server = Server()
style = ("style.scss", "style.css")
script = ("typing-test.js", "typing-test-compiled.js")
server.watch(style[0], shell(["sass", style[0]], output=style[1]))
server.watch(script[0], shell(["babel", script[0]], output=script[1]))
server.wat... | daschwa/typing-test | server.py | Python | mit | 395 | 0 |
from collections import Counter
def TFIDF(TF, complaints, term):
if TF >= 1:
n = len(complaints)
x = sum([1 for complaint in complaints if term in complaint['body']])
return log(TF + 1) * log(n / x)
else:
return 0
def DF(vocab, complaints):
term_DF = dict()
for term in ... | ryanarnold/complaints_categorizer | categorizer/feature_selection.py | Python | mit | 2,179 | 0.005048 |
# Copyright 2016-17 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models
class StockChangeStandardPrice(models.TransientModel):
_inherit = "stock.change.standard.price"
@api.model
... | Vauxoo/stock-logistics-warehouse | stock_inventory_revaluation/wizards/stock_change_standard_price.py | Python | agpl-3.0 | 974 | 0 |
import unittest
from pyml.nearest_neighbours import KNNClassifier, KNNRegressor
from pyml.datasets import gaussian, regression
from pyml.preprocessing import train_test_split
class TestKNNClassifier(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.datapoints, cls.labels = gaussian(n=100, d=2... | gf712/PyML | tests/nearest_neighbours_tests.py | Python | mit | 2,186 | 0.004575 |
""" Default urlconf for noisefilter """
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.sitemaps.views import index, sitemap
from django.views.generic.base import TemplateView
from django.views.de... | itsMagondu/IoTNeuralNetworks | noisefilter/noisefilter/urls.py | Python | mit | 1,603 | 0.001871 |
#!/usr/bin/env python
"""
rpgtoolkit.py
Generate a random webpage from a config file.
Lots of gaming resources are simple variations on a theme. Here's a big list, choose a random thing from the list, and interpolate a bit using data from some other lists.
Here's how this program works: given a config file, figure o... | jmcguire/rpg-toolkit-website | rpgtoolkit.py | Python | mit | 4,134 | 0.012821 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.23
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | kubernetes-client/python | kubernetes/client/models/v1_ingress_class_spec.py | Python | apache-2.0 | 5,087 | 0 |
# -*- coding: utf-8 -*-
import datetime as dt
from tradenews.database import (
Column,
db,
Model,
SurrogatePK,
)
class NewsCluster(SurrogatePK, Model):
__tablename__ = 'newscluster'
# id = Column(db.Integer(), nullable=False, primary_key=True)
date = Column(db.Text(), nullable=False, def... | morreene/tradenews | tradenews/newscluster/models.py | Python | bsd-3-clause | 533 | 0.001876 |
# Copyright (c) 2007, Enthought, Inc.
# License: BSD Style.
#--(Interfaces)-----------------------------------------------------------------
"""
Interfaces
==========
In Traits 3.0, the ability to define, implement and use *interfaces* has been
added to the package.
Defining Interfaces
-------------------
Interfa... | burnpanck/traits | examples/tutorials/traits_4.0/interfaces/interfaces.py | Python | bsd-3-clause | 4,275 | 0.011696 |
# 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... | chemelnucfin/tensorflow | tensorflow/python/data/kernel_tests/multi_device_iterator_test.py | Python | apache-2.0 | 19,062 | 0.00724 |
# SPDX-License-Identifier: MIT
# Copyright (C) 2019-2020 Tobias Gruetzmacher
# Copyright (C) 2019-2020 Daniel Ring
from .common import _ParserScraper
class ProjectFuture(_ParserScraper):
imageSearch = '//td[@class="tamid"]/img'
prevSearch = '//a[./img[@alt="Previous"]]'
def __init__(self, name, comic, fi... | webcomics/dosage | dosagelib/plugins/projectfuture.py | Python | mit | 2,118 | 0 |
"""
Management command to load language fixtures as tags
"""
from __future__ import unicode_literals
import csv
import os
import re
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from orb.models import Category, Tag
def has_data(input):
"""Identify... | mPowering/django-orb | orb/management/commands/load_orb_languages.py | Python | gpl-3.0 | 2,656 | 0.002259 |
class Solution:
# @param {integer[]} nums
# @param {integer} target
# @return {integer[]}
def searchRange(self, nums, target):
res = []
l, r = 0, len(nums) - 1
while l <= r:
m = (l + r) /2
if nums[m] < target:
l = m + 1
else:
... | Chasego/codirit | leetcode/034-Search-for-a-Range/SearchForaRange_001.py | Python | mit | 654 | 0.010703 |
# Copyright 2019 kubeflow.org.
#
# 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,... | kubeflow/kfserving-lts | test/e2e/predictor/test_torchserve.py | Python | apache-2.0 | 2,082 | 0.000961 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import time
from creds import get_nova_obj
from scit_config import *
from scit_db import *
#get authed nova obj
nova = get_nova_obj()
def create_nova_vm(logger, server_name, usr_dst):
conf = getScitConfig()
retry = int(conf["scit"]["scit_clean_retry"])
... | Colstuwjx/scit-sys | openstack_api.py | Python | gpl-2.0 | 7,352 | 0.005849 |
# coding: utf8
# jmdict.py
# 2/14/2014 jichi
if __name__ == '__main__':
import sys
sys.path.append('..')
def get(dic):
"""
@param dic str such as ipadic or unidic
@return bool
"""
import rc
return rc.runscript('getcabocha.py', (dic,))
if __name__ == "__main__":
get('unidic')
# EOF
| Dangetsu/vnr | Frameworks/Sakura/py/libs/scripts/cabocha.py | Python | gpl-3.0 | 307 | 0.026059 |
from django.db import models
from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.utils.translation import ugettext_lazy as _
from django.conf import settings... | gzqichang/wa | qevent/qevent/models.py | Python | mit | 5,215 | 0.001778 |
#!/usr/bin/python3
"""
Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2]
< nums[3]....
Example 1:
Input: nums = [1, 5, 1, 1, 6, 4]
Output: One possible answer is [1, 4, 1, 5, 1, 6].
Example 2:
Input: nums = [1, 3, 2, 2, 3, 1]
Output: One possible answer is [2, 3, 1, 3, 1, 2].
Note:
You m... | algorhythms/LeetCode | 324 Wiggle Sort II py3.py | Python | mit | 2,047 | 0.000489 |
"""Tests for items views."""
import json
import re
from datetime import datetime, timedelta
from unittest.mock import Mock, PropertyMock, patch
import ddt
from django.conf import settings
from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls i... | edx/edx-platform | cms/djangoapps/contentstore/views/tests/test_item.py | Python | agpl-3.0 | 160,015 | 0.003406 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | SKIRT/PTS | modeling/fitting/component.py | Python | agpl-3.0 | 4,328 | 0.000693 |
#!/usr/bin/env python3
# ScatterBackup - A chaotic backup solution
# Copyright (C) 2015 Ingo Ruhnke <grumbel@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the... | Grumbel/scatterbackup | tests/test_fileinfo.py | Python | gpl-3.0 | 1,443 | 0.000693 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import base
from misc import GetPageInfo
from models import PageIdentifier
from category import GetSubcategoryInfos
from revisions import GetCurrentContent, GetPageRevisionInfos
from meta import GetSourceInfo
def test_unicode_title():
get_beyonce ... | mahmoud/wapiti | wapiti/operations/test_basic.py | Python | bsd-3-clause | 1,717 | 0 |
#!/usr/bin/env python
'''
OWASP ZSC | ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
shellcode template used : http://shell-storm.org/shellcode/files/shellcode-57.php
'''
from core import stack
from core import template
def run(dirname):
command = 'mkdir %s' %(str(dirname))
return template.sys(stack.... | Yas3r/OWASP-ZSC | lib/generator/linux_x86/dir_create.py | Python | gpl-3.0 | 378 | 0.026455 |
# -*- coding: utf-8 -*-
import os
import errno
import stat
import unicodedata
import hashlib
import shutil
import logging
import config
class Fsdb(object):
"""File system database
expose a simple api (add,get,remove)
to menage the saving of files on disk.
files are placed under specified fs... | boyska/pyFsdb | fsdb/Fsdb.py | Python | lgpl-3.0 | 9,607 | 0.001353 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.