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 |
|---|---|---|---|---|---|
Midan_Metal_Musketoon0 = [[148, 0, 110, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+CRIT12+CRIT12', 1, 14581]
Midan_Metal_Musketoon1 = [[148, 12, 98, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+CRIT12+ACC12', 1, 14581]
Midan_Metal_Musketoon2 = [[148, 24, 86, 0, 123, 162, 73, 2.64], u'Midan Metal Musketoon+ACC12... | jrlusby/xiv-bard-calc | inventories/mch240fullmeta.py | Python | mit | 6,767 |
"""
The Kullback-Leibler divergence.
"""
import numpy as np
from .cross_entropy import get_pmfs_like
from ..helpers import normalize_rvs
from ..utils import flatten
from .kullback_leibler_divergence import kullback_leibler_divergence
__all__ = ('double_power_sum',
'hellinger_sum',
'alpha_diver... | chebee7i/dit | dit/divergences/generalized_divergences.py | Python | bsd-3-clause | 13,249 |
#
# Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
# Use of this file is governed by the BSD 3-clause license that
# can be found in the LICENSE.txt file in the project root.
#
#
# This is an InputStream that is loaded from stdin all at once
# when you construct the object.
#
import codecs
import s... | kuckaogh/csclpp | csclpp/src/csclpp/dts/antlr4/StdinStream.py | Python | gpl-3.0 | 539 |
# Copyright 2012 OpenStack Foundation
# 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... | lvdongbing/python-bileanclient | bileanclient/tests/unit/test_utils.py | Python | apache-2.0 | 8,900 |
import dork_compose.plugin
import os
import time
from docker.api.client import APIClient
from docker.errors import APIError
import logging
log = logging.getLogger(__name__)
class Plugin(dork_compose.plugin.Plugin):
def __init__(self, env, name, command):
dork_compose.plugin.Plugin.__init__(self, env, n... | iamdork/compose | dork_compose/plugins/filesystem.py | Python | mit | 4,662 |
""" PGPy :: Pretty Good Privacy for Python
"""
from ._author import *
from .pgp import PGPKey
from .pgp import PGPKeyring
from .pgp import PGPMessage
from .pgp import PGPSignature
from .pgp import PGPDetachedSignature
from .pgp import PGPUID
__all__ = ['__author__',
'__copyright__',
'__license__... | J08nY/PGPy | pgpy/__init__.py | Python | bsd-3-clause | 550 |
# -*- coding: utf-8 -*-
# Natural Language Toolkit: An Crubadan N-grams Reader
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Avital Pekker <avital.pekker@utoronto.ca>
#
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
An NLTK interface for the n-gram statistics gathered from
the corpora fo... | Reagankm/KnockKnock | venv/lib/python3.4/site-packages/nltk/corpus/reader/crubadan.py | Python | gpl-2.0 | 3,946 |
#!/usr/bin/env python3
import sys
import os
import argparse
from pylint import lint
# Use the current development version of SkoolKit
SKOOLKIT_HOME = os.environ.get('SKOOLKIT_HOME')
if not SKOOLKIT_HOME:
sys.stderr.write('SKOOLKIT_HOME is not set; aborting\n')
sys.exit(1)
if not os.path.isdir(SKOOLKIT_HOME):
... | skoolkid/skoolkit | tools/lint.py | Python | gpl-3.0 | 3,797 |
# -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | lclchen/open-hackathon | open-hackathon-client/src/client/views/__init__.py | Python | mit | 16,081 |
#!/usr/bin/env python
#
#CustomScript extension
#
# Copyright 2014 Microsoft Corporation
#
# 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
#
#... | Snesha/azure-linux-extensions | VMBackup/main/parameterparser.py | Python | apache-2.0 | 2,609 |
# -*- coding: utf-8 -*-
#
# Copyright 2008-2009 Zuza Software Foundation
#
# This file is part of the Translate Toolkit.
#
# 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... | diorcety/translate | translate/storage/test_base.py | Python | gpl-2.0 | 14,264 |
from models.usuarios import Usuario
import utils
__author__ = 'alexandreferreira'
from Crypto import Random
class Token:
def __init__(self):
self._id = None
self.token = None
self.usuario = None
self.expired = False
@staticmethod
def generate_token():
rndfile = R... | alexandreferreira/tata_library | models/token.py | Python | apache-2.0 | 1,887 |
from math import sqrt
def euclidean_distance(p1, p2):
"""
Compute euclidean distance for two points
:param p1:
:param p2:
:return:
"""
dx, dy = p2[0] - p1[0], p2[1] - p1[1]
# Magnitude. Coulomb law.
return sqrt(dx ** 2 + dy ** 2) | dsaldana/roomba_sensor_network | roomba_sensor/src/roomba_sensor/util/geo.py | Python | gpl-3.0 | 268 |
from a10sdk.common.A10BaseClass import A10BaseClass
class VlanGlobal(A10BaseClass):
"""Class Description::
Configure global options for vlan.
Class vlan-global supports CRUD Operations and inherits from `common/A10BaseClass`.
This class is the `"PARENT"` class for this module.`
:param l3_vl... | amwelch/a10sdk-python | a10sdk/core/network/network_vlan_global.py | Python | apache-2.0 | 1,434 |
# Copyright (C) 2014 Science and Technology Facilities Council.
# Copyright (C) 2015-2021 East Asian Observatory.
# All Rights Reserved.
#
# 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 ... | eaobservatory/hedwig | lib/hedwig/web/app.py | Python | gpl-3.0 | 6,738 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" An crawler leverage asyncrhonized IO.
File: __init__.py
Author: SpaceLis
Email: Wen.Li@tudelft.nl
GitHub: http://github.com/spacelis
Description:
To achieve full asynchronizibility of crawling.
"""
import gzip
from itertools import cycle
from pykka.actor import Ac... | spacelis/crawler.kka | crawler/__init__.py | Python | mit | 5,059 |
import pytest
import pickle
import numpy as np
from velox import VeloxObject, register_object
from velox.tools import (fullname, import_from_qualified_name,
obtain_padding_bytes, obtain_qualified_name,
VELOX_NEW_FILE_SIGNATURE,
VELOX_NEW_FILE_E... | lukedeo/Velox | test/test_tools.py | Python | apache-2.0 | 1,058 |
from django.contrib import admin
from event.models import Event
class EventArtistsInline(admin.TabularInline):
model = Event.artists.through
verbose_name_plural = 'Artists'
extra = 1
class EventInline(admin.StackedInline):
model = Event
extra = 1
class EventAdmin(admin.ModelAdmin):
inline... | FedorSelitsky/eventrack | event/admin.py | Python | mit | 536 |
# ##### 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 program is distrib... | nortikin/sverchok | ui/bgl_callback_nodeview.py | Python | gpl-3.0 | 8,768 |
# Django settings for example_project project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', '... | MidwestCommunications/django-linkslist | example_project/settings.py | Python | mit | 3,221 |
# awl.tests.test_contextproc.py
from django.test import TestCase
from awl.context_processors import extra_context
from awl.waelsteng import FakeRequest
# ============================================================================
class ContextProcessorTest(TestCase):
def test_extra_context(self):
reque... | cltrudeau/django-awl | awl/tests/test_contextproc.py | Python | mit | 536 |
'''
Created on Dec 10, 2014
@author: msuliga
'''
from django.contrib import admin
from .models import Person
class PersonAdmin( admin.ModelAdmin ):
search_fields = ['name']
list_display = ( 'name', 'address', 'no_index_tag', 'personal_code', 'id' )
list_editable = ('no_index_tag',)
fields = [ 'no_inde... | tigeorgia/CorpSearch | apps/person/admin.py | Python | gpl-2.0 | 531 |
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import csv
import pickle
import rasmodel
from indra import trips, reach
from indra.literature import id_lookup
from indra.util import read_unicode_csv
from assembly_eval import have_file, run_assembly
if __name__ ==... | jmuhlich/indra | indra/benchmarks/assembly_eval/batch4/run_combined.py | Python | bsd-2-clause | 1,453 |
import urllib2
import base64
import json as json_module
class PreemptiveBasicAuthHandler(urllib2.HTTPBasicAuthHandler):
'''Preemptive basic auth.
Instead of waiting for a 403 to then retry with the credentials,
send the credentials if the url is handled by the password manager.
Note: please use realm=... | ManocLabs/manoc-agent-dhcpd | manoc_agents/common/requests.py | Python | artistic-2.0 | 4,377 |
import fruit
print locals()
print fruit.utils.pathformat.prefix("hello/good")
print fruit.utils.pathformat.prefix("good")
print fruit.utils.pathformat.suffix("hello/good")
print fruit.utils.pathformat.suffix("good")
a = 'hello my name is zhaomr'
| zhaomr13/fruit | tests/test_this_module.py | Python | gpl-2.0 | 247 |
'''
Created by auto_sdk on 2015.04.21
'''
from aliyun.api.base import RestApi
class Rds20140815CreateDBInstanceRequest(RestApi):
def __init__(self,domain='rds.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.ClientToken = None
self.ConnectionMode = None
self.DBInstanceClass = None
s... | wanghe4096/website | aliyun/api/rest/Rds20140815CreateDBInstanceRequest.py | Python | bsd-2-clause | 766 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django_mysql.models
class Migration(migrations.Migration):
dependencies = [
('base', '0008_auto_20160331_1405'),
]
operations = [
migrations.AddField(
model_name='... | akatsoulas/snippets-service | snippets/base/migrations/0009_snippet_client_options.py | Python | mpl-2.0 | 448 |
# -*- coding: utf-8 -*-
"""CIFAR-100 DeepOBS dataset."""
import os
import tensorflow as tf
from . import dataset
from .. import config
class cifar100(dataset.DataSet):
"""DeepOBS data set class for the `CIFAR-100\
<https://www.cs.toronto.edu/~kriz/cifar.html>`_ data set.
Args:
batch_size (int): The mi... | fsschneider/DeepOBS | deepobs/tensorflow/datasets/cifar100.py | Python | mit | 6,777 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 问题1.8:怎样在数据字典中执行一些计算操作 (比如求最小值、最大值、排序等等)
# 解决方案:可以使用zip和sorted,min,max等函数
prices = {
'ACME': 45.23,
'APL': 612.78,
'IBM': 205.55,
'HPQ': 37.20,
'FB': 10.75
}
# 如果你在一个字典上执行普通的数学运算,你会发现它们仅仅作用于键,而不是值
# 返回ACME
print(min(prices))
# 返回IBM
print(max(prices... | felix9064/python | Demo/cookbook/operate_dict.py | Python | mit | 1,379 |
from __future__ import print_function
from pprint import pprint
import sys
sys.path.append( 'external/pycparser' )
from pycparser import c_parser, c_ast, parse_file
# Portable cpp path for Windows and Linux/Unix
CPPPATH = '../utils/cpp.exe' if sys.platform == 'win32' else 'cpp'
class IdVisitor(c_ast.NodeVisitor):
... | arunksaha/casescore | pycparser_id.py | Python | bsd-3-clause | 916 |
# -*- coding: utf-8 -*-
# @CreateTime: 2017/8/4 14:25
# @CreateBy: Alvin
# @File: xHarvester.py
# @UpdateTime:
# @UpdateBy:
import os
import sys
import getopt
from theHarvester import usage
from theHarvester import start
def x_start(arg):
if len(sys.argv) < 4:
usage()
... | cative0/TheHarvester | xHarvester.py | Python | gpl-2.0 | 1,498 |
"""
Link extractor based on lxml.html
"""
import six
from six.moves.urllib.parse import urljoin
import lxml.etree as etree
from w3lib.html import strip_html5_whitespace
from w3lib.url import canonicalize_url
from scrapy.link import Link
from scrapy.utils.misc import arg_to_iter, rel_has_nofollow
from scrapy.utils.pyt... | rolando-contrib/scrapy | scrapy/linkextractors/lxmlhtml.py | Python | bsd-3-clause | 4,962 |
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use t... | armab/st2contrib | packs/aws/sensors/service_notifications_sensor.py | Python | apache-2.0 | 4,755 |
#!/usr/bin/python
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Stardust Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import print_fun... | ctwiz/stardust | contrib/linearize/linearize-data.py | Python | mit | 8,828 |
#!/usr/bin/env python
#-*- coding: utf-8 -*-
# Obs: Need to install pygtk on windows
import pygtk
pygtk.require("2.0") #Essa linha define a versão do pygtk a ser importado
import gtk
from bet_calculator.bet_calculator import Bet_Calculator
from decimal import *
class Vision(object):
def __init__(self):
... | felipeAraujo/Bet-Calculator | main.py | Python | mit | 12,618 |
from csat.acquisition import models
class UploadConfig(models.DataCollectorConfig):
pass
| GaretJax/csat | csat/collectors/upload/models.py | Python | mit | 95 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/messages/incense_encounter_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as... | bellowsj/aiopogo | aiopogo/pogoprotos/networking/requests/messages/incense_encounter_message_pb2.py | Python | mit | 2,882 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
COMP_ID = 'compulink_mobile'
| nextgis/nextgisweb_compulink | nextgisweb_compulink/compulink_mobile/ident.py | Python | gpl-2.0 | 94 |
# Portions Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2.
# identity.py - program identity
#
# Copyright Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed accord... | facebookexperimental/eden | eden/scm/edenscm/mercurial/identity.py | Python | gpl-2.0 | 783 |
# vi: ts=8 sts=4 sw=4 et
#
# test_format.py: unit tests for draco2.util.locale
#
# This file is part of Draco2. Draco2 is free software and is made available
# under the MIT license. Consult the file "LICENSE" that is distributed
# together with this file for the exact licensing terms.
#
# Draco2 is copyright (c) 1999-... | geertj/draco2 | draco2/locale/test/test_format.py | Python | mit | 8,425 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from logging import getLogger
log = getLogger(__name__)
# test integer types
| kalefranz/auxlib | tests/test_type_coercion.py | Python | isc | 169 |
# -*- coding: utf-8 -*-
import logging
import sys
import time
class StackTraceFilter(logging.Filter):
def filter(self, record):
"""
Filter log records with stack traces.
Multi-line messages must be processed differently than those
of standard application logs.
Paramete... | dnguyen0304/tuxedo-mask | tuxedo_mask/utilities.py | Python | mit | 3,479 |
"""@file ideal_ratio_processor.py
contains the idealRatioProcessor class"""
import os
import subprocess
import StringIO
import scipy.io.wavfile as wav
import numpy as np
import processor
from nabu.processing.feature_computers import feature_computer_factory
class IdealRatioProcessor(processor.Processor):
"""a proce... | JeroenZegers/Nabu-MSSS | nabu/processing/processors/ideal_ratio_processor.py | Python | mit | 3,843 |
#~~~~~~~~Authentication for apps.twitter.com~~~~~~~~~#
#~~~~~~~~DO NOT UPLOAD THIS WITH YOUR TOKEN INFO TO ANYWHERE PUBLIC~~~~~~~~~#
CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
| WeiseGuy/WeiseBot | src/covert.py | Python | mit | 223 |
"""
Derivation and Elementary Trees live here.
"""
from __future__ import print_function
from baal.structures import Entry, ConstituencyTree, consts
from baal.semantics import Predicate, Expression
from collections import deque
from copy import copy, deepcopy
from math import floor, ceil
try:
input = raw_input
ex... | braingineer/baal | baal/structures/gist_trees.py | Python | mit | 54,149 |
# encoding: utf-8
from __future__ import absolute_import
import os
START_MONITORING_THREAD = False
SAVE_STAT = True
DISABLE_DATABASE = True
# for tests we want only 1/2 seconds timeout instead of the normal 10s
INSTANCE_TIMEOUT = int(os.environ.get('CUSTOM_INSTANCE_TIMEOUT', 500))
STAT_CIRCUIT_BREAKER_MAX_FAIL = int... | antoine-de/navitia | source/jormungandr/tests/integration_tests_settings.py | Python | agpl-3.0 | 1,696 |
# -*- coding: utf-8 -*-
"""
sphinx.application
~~~~~~~~~~~~~~~~~~
Sphinx application object.
Gracefully adapted from the TextPress system by Armin.
:copyright: 2008 by Georg Brandl, Armin Ronacher.
:license: BSD.
"""
import sys
import posixpath
from docutils import nodes
from docutils.pars... | BackupGGCode/sphinx | sphinx/application.py | Python | bsd-3-clause | 10,788 |
###
# Copyright (c) 2003-2005, Jeremiah Fincher
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of co... | tecan/xchat-rt | plugins/scripts/Supybot-0.83.4.1-bitcoinotc-bot/plugins/Internet/test.py | Python | gpl-2.0 | 2,370 |
# -*- coding: utf-8 -*-
"""
<DefineSource>
@Date : Fri Nov 14 13:20:38 2014 \n
@Author : Erwan Ledoux \n\n
</DefineSource>
A Neurongrouper
"""
#<DefineAugmentation>
import ShareYourSystem as SYS
BaseModuleStr="ShareYourSystem.Specials.Simulaters.Simulater"
DecorationModuleStr="ShareYourSystem.Standards.Classors.C... | Ledoux/ShareYourSystem | Pythonlogy/draft/Simulaters/Neurongrouper/draft/__init__ copy.py | Python | mit | 6,951 |
#Modify your code so that it normalizes the output for
#the function sense. This means that the entries in q
#should sum to one.
p=[0.2, 0.2, 0.2, 0.2, 0.2]
world=['green', 'red', 'red', 'green', 'green']
Z = 'red'
pHit = 0.6
pMiss = 0.2
def sense(p, Z):
q=[]
for i in range(len(p)):
hit = (Z == worl... | martinggww/lucasenlights | MachineLearning/AIRobots/sensefunctionWithNormalization.py | Python | cc0-1.0 | 488 |
#!/usr/bin/python
"""
This module contains an envelope class (MGE) which drives the rest of the package classes.
"""
# Importing the most important modules
# This MGE module requires numpy
from pygme.init_partMGE import nbodyMGE
__version__ = '4.0.4 (03/07/2012)'
DEBUG = 1
# Version 4.0.4: Small change replacing s... | emsellem/pygme | pygme/mge.py | Python | bsd-3-clause | 5,913 |
#!/usr/bin/env python
import os, os.path
import re
import sys
placeholder_pat = re.compile("%\((.+?)\)(\w)")
def extract_placeholders(s):
return set(placeholder_pat.findall(s))
def check_file(fn):
msgid = ''
msgstr = ''
workingon = 'msgid'
mismatches = []
for line in open(fn):
if lin... | PalmBeachPost/panda | scripts/check_po.py | Python | mit | 1,630 |
# -*- coding: utf-8 -*-
#
#
# Author: Nicolas Bessi, Guewen Baconnier, Yannick Vaucher
# Copyright 2013-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation,... | akretion/stock-logistics-workflow | stock_split_picking/__openerp__.py | Python | agpl-3.0 | 1,444 |
# Globals for the directions
# Change the values as you see fit
EAST = None
NORTH = None
WEST = None
SOUTH = None
class Robot:
def __init__(self, direction=NORTH, x_pos=0, y_pos=0):
pass
| jmluy/xpython | exercises/practice/robot-simulator/robot_simulator.py | Python | mit | 201 |
# -*- coding: utf-8 -*-
#
from .contextualize import Contextualize, contextualize
__all__ = ('Contextualize', 'contextualize')
| gonrin/gatco | gatco/cors/spf/plugins/__init__.py | Python | mit | 127 |
# -*- coding: utf-8 -*-
from optparse import make_option
from django.conf import settings
from django.core.management.base import BaseCommand
from parler.utils.context import switch_language
from aldryn_newsblog.models import Article
class Command(BaseCommand):
can_import_settings = True
base_options = (
... | Venturi/cms | env/lib/python2.7/site-packages/aldryn_newsblog/management/commands/rebuild_article_search_data.py | Python | gpl-2.0 | 1,694 |
from django.core.management.base import BaseCommand
from corehq.sql_db.shard_data_management import get_count_of_unmatched_models_by_shard
from corehq.sql_db.util import get_db_aliases_for_partitioned_query, get_all_sharded_models
class Command(BaseCommand):
help = "Print out all shard data that exists in databas... | dimagi/commcare-hq | corehq/sql_db/management/commands/locate_invalid_shard_data.py | Python | bsd-3-clause | 917 |
import csv
import sys
from django.core.management.base import BaseCommand
from django.db.models import Prefetch
from course.models import CourseModule
from deviations.models import DeadlineRuleDeviation, MaxSubmissionsRuleDeviation
from ...models import BaseExercise, Submission
from userprofile.models import UserProf... | teemulehtinen/a-plus | exercise/management/commands/export_submissions.py | Python | gpl-3.0 | 14,660 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | valentin-krasontovitsch/ansible | lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py | Python | gpl-3.0 | 19,851 |
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, transaction
from django.db.transaction import commit_on_success, commit_manually, TransactionManagementError
from django.test import TransactionTestCase, skipUnlessDBFeature
from django.test... | cobalys/django | tests/regressiontests/transactions_regress/tests.py | Python | bsd-3-clause | 8,777 |
#!/usr/bin/env python
import math, numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import roslib; roslib.load_manifest('sandbox_tapo_darpa_m3')
import hrl_lib.viz as hv
import hrl_lib.util as ut
import rospy
import pickle
def plotdata():
plot_data = ut.load_pickle('skin_data_2... | tapomayukh/projects_in_python | sandbox_tapo/src/skin_related/Misc/plotdata.py | Python | mit | 582 |
"""Lannouncer platform for notify component."""
import logging
import socket
from urllib.parse import urlencode
import voluptuous as vol
from homeassistant.const import CONF_HOST, CONF_PORT
import homeassistant.helpers.config_validation as cv
from homeassistant.components.notify import (
ATTR_DATA,
PLATFORM_... | fbradyirl/home-assistant | homeassistant/components/lannouncer/notify.py | Python | apache-2.0 | 2,459 |
#!/usr/bin/env python
from saml2.sigver import _get_xmlsec_cryptobackend, SecurityContext
from saml2.httpbase import HTTPBase
from saml2 import saml
from saml2 import md
from saml2.attribute_converter import ac_factory
from saml2.extension import dri
from saml2.extension import idpdisc
from saml2.extension import mdat... | tpazderka/pysaml2 | tools/mdexport.py | Python | bsd-2-clause | 1,912 |
#!/usr/bin/env python
from ConfigParser import ConfigParser
from ordereddict import OrderedDict
import sys
def make_parser():
parser = ConfigParser(dict_type=OrderedDict)
parser.optionxform = str
return parser
def transform(sectionName):
sectionName = sectionName.replace(",Dialog=", ", Dialog=")
... | emilybache/texttest-runner | src/main/python/storytext/bin/migrate_uimap.py | Python | mit | 1,119 |
# author: Zhongyuan Sun
# Storing the loop numbers will help improving performance from 0.63% to 93.93%
class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
if n <= 0:
return False
x = self.cal(n)
# loop_numbers = self.... | danielsunzhongyuan/my_leetcode_in_python | happy_number_202.py | Python | apache-2.0 | 1,602 |
# -*- coding: utf-8 -*-
import gevent.monkey;gevent.monkey.patch_socket()
from gevent.pool import Pool
import codecs
import requests
from redis import Redis
from rq import Queue
from pyquery import PyQuery as pq
from bs4 import BeautifulSoup
from model import OneIssue
q = Queue(connection=Redis())
# q.enqueue_call(f... | zhy0216/another-one | fetch_new.py | Python | mit | 876 |
#####################################################################################
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of th... | tempbottle/ironpython3 | Tests/interop/net/property/__init__.py | Python | apache-2.0 | 1,852 |
from bika.lims import bikaMessageFactory as _
from bika.lims.browser.bika_listing import BikaListingView
from bika.lims.permissions import *
from Products.CMFCore.utils import getToolByName
class ClientSamplePointsView(BikaListingView):
"""This is displayed in the "Sample Points" tab on each client
"""
d... | labsanmartin/Bika-LIMS | bika/lims/browser/client/views/samplepoints.py | Python | agpl-3.0 | 2,819 |
import _plotly_utils.basevalidators
class StartarrowsizeValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self,
plotly_name="startarrowsize",
parent_name="layout.scene.annotation",
**kwargs
):
super(StartarrowsizeValidator, self).__init__(
... | plotly/python-api | packages/python/plotly/plotly/validators/layout/scene/annotation/_startarrowsize.py | Python | mit | 557 |
"""
Methods responsible for managing a user's session and login/c_logout
"""
import logging
from ctypes import cast, c_ulong, byref
from .cryptoki import CK_ULONG, CA_TimeSync, CA_InitAudit, CK_SLOT_ID, CA_GetTime, CK_CHAR_PTR
from .exceptions import make_error_handle_function
logger = logging.getLogger(__name__)
d... | gemalto/pycryptoki | pycryptoki/audit_handling.py | Python | apache-2.0 | 1,343 |
# Copyright 2015
#
# 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, software
# ... | denovogroup/pox | pox/lib/packet/pilo.py | Python | apache-2.0 | 6,007 |
# 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 model 'Nonce'
db.create_table('oauth_provider_nonce', (
('id', self.gf('django.db.mod... | amrox/django-oauth-plus | oauth_provider/migrations/0001_initial.py | Python | bsd-3-clause | 9,975 |
import numpy as np
from sys import stdin, stdout, argv
# given a tree and a node, it returns all the descendant leaves from this node.
def get_leaves(tree, node):
# if node is already a leaf, return it
if node not in tree.keys():
return [node]
# otherwise explore the tree to get all leaves from th... | SembeiNorimaki/Bioinformatics | Bio_V/HierarchicalClustering.py | Python | mit | 3,386 |
# from https://hg.python.org/cpython/file/default/Lib/collections/__init__.py
from collections import MutableMapping
class ChainMap(MutableMapping):
""" A ChainMap groups multiple dicts (or other mappings) together
to create a single, updateable view.
The underlying mappings are stored in a list. That ... | skoslowski/gnuradio | grc/core/utils/backports/chainmap.py | Python | gpl-3.0 | 3,530 |
from django import forms
from django.conf import settings
from django.contrib.admin.util import flatten_fieldsets, lookup_field
from django.contrib.admin.util import display_for_field, label_for_field
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
... | rimbalinux/MSISDNArea | django/contrib/admin/helpers.py | Python | bsd-3-clause | 13,667 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Fasttree(Package):
"""FastTree infers approximately-maximum-likelihood phylogenetic
... | LLNL/spack | var/spack/repos/builtin/packages/fasttree/package.py | Python | lgpl-2.1 | 1,234 |
from django.conf.urls import patterns, url
from tests.testapp.echo.views import (
SimpleCBV, SimpleDecoratedCBV,
SimpleCBVWithParam, SimpleCBVMulti
)
urlpatterns = patterns('',
url(r'^simpleview/$', 'tests.testapp.echo.views.simpleview'),
url(r'^simpleview_required/$', 'tests.testapp.echo.views.simple... | jmcarp/webargs | tests/testapp/testapp/urls.py | Python | mit | 892 |
from sqlalchemy import Column, create_engine, orm, types
from sqlalchemy.ext.declarative import declarative_base
from django.http import Http404
from django.test import SimpleTestCase
from rest_framework.test import APIRequestFactory
from rest_witchcraft import serializers, viewsets
factory = APIRequestFactory()
... | shosca/django-rest-witchcraft | tests/test_generics.py | Python | mit | 2,086 |
# $Id$
#
# pjsua Python GUI Demo
#
# Copyright (C)2013 Teluu Inc. (http://www.teluu.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 2 of the License, or
# (at your option) ... | svn2github/pjsip | pjsip-apps/src/pygui/chat.py | Python | gpl-2.0 | 18,871 |
# -*- coding: utf-8 -*-
__author__ = """Audrey Roy Greenfeld"""
__email__ = 'aroy@alum.mit.edu'
__version__ = '0.1.0'
from _python_boilerplate import run, val | waynenilsen/cookiecutter-python-rust-proto | python_boilerplate/__init__.py | Python | mit | 160 |
from __future__ import absolute_import
from sentry import tsdb, ratelimits
from sentry.api.serializers import serialize
from sentry.plugins.base import Plugin
from sentry.plugins.base.configuration import react_plugin_config
from sentry.plugins.status import PluginStatus
class DataForwardingPlugin(Plugin):
statu... | mvaled/sentry | src/sentry/plugins/bases/data_forwarding.py | Python | bsd-3-clause | 1,514 |
"""Extreme Discovery Protocol."""
import dpkt
import sys
class EDP(dpkt.Packet):
__hdr__ = (
('v', 'B', 1),
('res', 'B', 0),
('hlen', 'H', 0),
('sum', 'H', 0),
('seq', 'H', 0),
('mid', 'H', 0),
('mac', '6s', '')
)
def __str__(self):
... | hexcap/dpkt | dpkt/edp.py | Python | bsd-3-clause | 442 |
from cli import *
def local_print_disassemble_line(cpu, address, type, print_cpu, name):
return 0
def local_pregs(processor, all):
return 0
| iniverno/RnR-LLC | simics-3.0-install/simics-3.0.31/amd64-linux/lib/python/clock_commands.py | Python | gpl-2.0 | 150 |
import weakref
class ExpensiveObject:
def __init__(self, name):
self.name = name
def __del__(self):
print('(Deleting {})'.format(self))
obj = ExpensiveObject('My Object')
r = weakref.ref(obj)
p = weakref.proxy(obj)
print('via obj:', obj.name)
print('via ref:', r().name)
print('via proxy:'... | jasonwee/asus-rt-n14uhp-mrtg | src/lesson_data_structures/weakref_proxy.py | Python | apache-2.0 | 366 |
"""
Created on June 9, 2015
@author: shiruilu
Adaptive Luminance Enhancement from AINDANE
"""
import numpy as np
import cv2
import matplotlib.pyplot as plt
from math import sqrt, pi
IMG_DIR = '../resources/images/'
BM_DIR = './benchmarks/'
eps = 1e-6 # eliminate divide by zero error in I_conv/I
def ale(I_bgr):
... | shiruilu/CAPE | aindane/aindane.py | Python | mit | 3,499 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('replays', '0030_auto_20160307_2205'),
]
operations = [
migrations.AlterField(
model_name='replay',
n... | rocket-league-replays/rocket-league-replays | rocket_league/apps/replays/migrations/0031_auto_20160307_2222.py | Python | gpl-3.0 | 791 |
"""
sentry.rules.conditions.tagged_event
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from collections import OrderedDict
from django import forms
from sentry.m... | mitsuhiko/sentry | src/sentry/rules/conditions/tagged_event.py | Python | bsd-3-clause | 2,740 |
import threading
from html.parser import HTMLParser
import django
# A global lock, showing whether linkcheck is busy
update_lock = threading.Lock()
if django.VERSION <= (3, 2):
default_app_config = 'linkcheck.apps.LinkcheckConfig'
class Lister(HTMLParser):
def reset(self):
HTMLParser.reset(self)
... | DjangoAdminHackers/django-linkcheck | linkcheck/__init__.py | Python | bsd-3-clause | 5,795 |
"""
Example of training survival model with Dask on CPU
===================================================
"""
import xgboost as xgb
import os
from xgboost.dask import DaskDMatrix
import dask.dataframe as dd
from dask.distributed import Client
from dask.distributed import LocalCluster
def main(client):
# Load a... | dmlc/xgboost | demo/dask/cpu_survival.py | Python | apache-2.0 | 2,574 |
#objects.py
from buckPasser.sqlTable import SQLTable, StagedSqlTable
from buckPasser.inventory import PassiveInventory
from . import userInput
import os
from buckPasser.menus import ObjectMenu
def objectFactory(db, code, stage):
obj = Objects(db)
obj.setCode(code)
obj.readFromDB(stage)
obj.menu.title = obj.objNam... | snhobbs/DetectiveBuckPasser | buckPasser/objects.py | Python | unlicense | 3,863 |
from __future__ import absolute_import, division, print_function, unicode_literals
from importlib import import_module
def import_function(classpath):
# Try to import a function out of a module.
parts = classpath.split('.')
function = parts.pop()
return getattr(import_module('.'.join(parts)), functio... | rec/led | led/Importer.py | Python | artistic-2.0 | 498 |
from django import template
from django.utils.safestring import mark_safe
register = template.Library()
@register.simple_tag
def upload_js():
return mark_safe("""
<!-- The template to display files available for upload -->
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i+... | raonyguimaraes/mendelmd | individuals/templatetags/upload_tags.py | Python | bsd-3-clause | 3,137 |
import json
from contextlib import contextmanager
from pathlib import Path
from unittest import mock
import pytest
from django_dynamic_fixture import get
from readthedocs.builds.storage import BuildMediaFileSystemStorage
from readthedocs.projects.constants import MKDOCS, SPHINX
from readthedocs.projects.models import... | rtfd/readthedocs.org | readthedocs/search/tests/test_parsers.py | Python | mit | 9,892 |
# -*- coding: utf-8 -*-
"""
GridCal
# Copyright (C) 2022 Santiago Peñate Vera
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any... | SanPen/GridCal | src/GridCal/Engine/IO/dgs_parser.py | Python | lgpl-3.0 | 42,978 |
"""
Defines the function approximators
"""
import numpy as np
import theano.tensor as T
# from theano.tensor.signal import downsample
from blocks.bricks import Activation, MLP, Initializable, application, Identity
from blocks.bricks.conv import ConvolutionalActivation
from blocks.initialization import IsotropicGaussi... | alexanderganderson/Diffusion-Probabilistic-Models | regression.py | Python | mit | 8,365 |
# Copyright (c) 2010 Arek Korbik
#
# 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... | arkadini/twimp | test/test_crypto_handshake.py | Python | apache-2.0 | 11,395 |
import graphene
from graphene_django.types import DjangoObjectType
from org.models import Organization
class OrganizationType(DjangoObjectType):
class Meta:
model = Organization
class Query(object):
organizations = graphene.List(OrganizationType)
def resolve_organizations(self, info, **kwargs)... | arturfelipe/condobus | backend/org/schema.py | Python | mit | 364 |
from django import template
from django.template import Context, loader
import logging
register = template.Library()
@register.inclusion_tag('licensing/setup.html')
def licensing_style(klass='openwebicon'):
'''Usage:
{% licensing_style 'foobar' %}
Render a <style> block with the (optional) class
... | editorsnotes/django-licensing | licensing/templatetags/licensing_tags.py | Python | unlicense | 878 |
# Copyright 2012 Pinterest.com
#
# 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,... | sontek/pymemcache | pymemcache/test/integration.py | Python | apache-2.0 | 9,000 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import time
import pytest
import numpy as np
from . import FitsTestCase
from .test_table import comparerecords
from ....io import fits
class TestGroupsFunctions(FitsTestCase):
def test_open(self):
with fits.open(self.data('random... | funbaker/astropy | astropy/io/fits/tests/test_groups.py | Python | bsd-3-clause | 7,893 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.