code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# coding=utf-8
# Copyright 2017-2020 The THUMT Authors
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
def global_norm_clipper(value):
def clip_fn(gradients, grad_norm):
if not float(value) or grad_norm < value:
return ... | thumt/THUMT | thumt/optimizers/clipping.py | Python | bsd-3-clause | 1,668 |
"""
HTML Widget classes
"""
try:
set
except NameError:
from sets import Set as set # Python 2.3 fallback
import copy
from itertools import chain
from django.conf import settings
from django.utils.datastructures import MultiValueDict, MergeDict
from django.utils.html import escape, conditional_e... | greggian/TapdIn | django/forms/widgets.py | Python | apache-2.0 | 27,947 |
# Copyright (c) 2011 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... | openstack/manila | manila/scheduler/filters/ignore_attempted_hosts.py | Python | apache-2.0 | 1,949 |
#!/bin/env python
import subprocess
import flask
import json
app = flask.Flask(__name__)
@app.route("/", methods=['GET'])
def hello():
return app.send_static_file('vpn-controller.html')
# ---------------- vpn-list ----------------
@app.route("/vpn-list", methods=['GET'])
def get_vpn_list_handler():
try:
return... | baseilos/vpn-controller | server/vpn-controller.py | Python | gpl-3.0 | 2,610 |
from tb import print_tb
def run():
print_tb()
if __name__ == '__main__':
run()
| jvkersch/cptraceback | examples/python_calling_c/example.py | Python | bsd-2-clause | 91 |
import unittest, time, sys, random, math, getpass
sys.path.extend(['.','..','../..','py'])
import h2o2 as h2o
import h2o_cmd, h2o_import as h2i, h2o_util, h2o_print as h2p, h2o_summ
from h2o_test import OutputObj
print "Same as test_summary2_uniform.py but with exponential distribution on the data"
DO_TRY_SCIPY = Fals... | YzPaul3/h2o-3 | py2/testdir_single_jvm/test_summary_samedata.py | Python | apache-2.0 | 6,121 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Temporal segmentation
=====================
Recurrence and self-similarity
------------------------------
.. autosummary::
:toctree: generated/
recurrence_matrix
recurrence_to_lag
lag_to_recurrence
timelag_filter
Temporal clustering
--------------... | r9y9/librosa | librosa/segment.py | Python | isc | 21,883 |
# coding: utf-8
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"... | szha/mxnet | python/mxnet/optimizer/lamb.py | Python | apache-2.0 | 11,192 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "docfield")
webnotes.reload_doc("support", "doctype", "support_ticket")
# customer issue resolved_by should be Profile
if webnote... | gangadhar-kadam/sapphire_app | patches/january_2013/update_closed_on.py | Python | agpl-3.0 | 1,386 |
# Copyright (C) 2012-2021 Ben Kurtovic <ben.kurtovic@gmail.com>
#
# 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, ... | earwig/mwparserfromhell | src/mwparserfromhell/parser/tokenizer.py | Python | mit | 60,323 |
# mysql/base.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: mysql
:name: MySQL
Supported Versions and Features
------------... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/sqlalchemy/dialects/mysql/base.py | Python | gpl-2.0 | 109,960 |
# -*- coding: utf-8 -*-
#
# Copyright 2015 AirPlug 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 applic... | ddinsight/dd-streamworks | stream_worker/worker/meta.py | Python | apache-2.0 | 11,124 |
# Copyright 2020 Alfredo de la Fuente - AvanzOSC
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
{
"name": "Stock Move Sale Unit Price",
"version": "12.0.1.1.0",
"license": "AGPL-3",
"depends": [
"sale_management",
"stock",
],
"author": "AvanzOSC",
"website":... | oihane/odoo-addons | stock_move_sale_unit_price/__manifest__.py | Python | agpl-3.0 | 461 |
import os
from blockstack.client import BlockstackClient
name = 'T5'
token = os.environ.get('BK_TOKEN')
client = BlockstackClient(base_uri=('%s/api' % os.environ['BK_INSTANCE']), token=token)
blue = client.wallets.get('Blue')
issuer = client.issuer
asset = issuer.assets.create('Blue', 'T5', 1000)
print(asset)
asset = ... | devrandom/python-blockstack | examples/issue_asset.py | Python | apache-2.0 | 362 |
"""
Common utilities for Contentstore APIs.
"""
from contextlib import contextmanager
from opaque_keys.edx.keys import CourseKey
from rest_framework import status
from rest_framework.generics import GenericAPIView
from common.djangoapps.student.auth import has_course_author_access
from openedx.core.djangoapps.util.... | edx/edx-platform | cms/djangoapps/contentstore/api/views/utils.py | Python | agpl-3.0 | 4,666 |
"""
raven.contrib.webpy.utils
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
import web
from raven.utils.wsgi import get_headers, get_environ
def get_data_from_request():
... | kartoza/sg-diagram-downloader | third_party/raven/contrib/webpy/utils.py | Python | gpl-2.0 | 742 |
"""Support for interface with a Bravia TV."""
from __future__ import annotations
from typing import Final
from homeassistant.components.media_player import (
MediaPlayerDeviceClass,
MediaPlayerEntity,
)
from homeassistant.components.media_player.const import (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
SU... | home-assistant/home-assistant | homeassistant/components/braviatv/media_player.py | Python | apache-2.0 | 5,525 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | HugoLnx/fofix | src/Settings.py | Python | gpl-2.0 | 92,805 |
CAS_SERVER_URL = 'http://logowanie.nowoczesnapolska.org.pl/cas/'
CAS_VERSION = '1'
| rczajka/timer | timer/settings.d/50-contrib.py | Python | agpl-3.0 | 83 |
from abc import ABCMeta, abstractmethod
class AbstractConsumer(metaclass=ABCMeta):
"""
This class provides facilities to create and manage queue consumers. To
create a consumer, subclass this class and override the :meth:`run`
method. Then, instantiate the class with the desired parameters and call
... | gst/amqpy | amqpy/consumer.py | Python | mit | 2,846 |
# -*- coding: UTF-8 -*-
##############################################################################
#
# OERPLib
# Copyright (C) 2011-2013 Sébastien Alix.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# ... | osiell/oerplib | oerplib/rpc/__init__.py | Python | lgpl-3.0 | 10,786 |
from .operations import (
AddOperation,
CopyOperation,
MoveOperation,
RemoveOperation,
ReplaceOperation,
TestOperation
)
from .exceptions import PatchException
class Patch(object):
"""
JSON Patch defines a JSON document structure for expressing a
sequence of operations to apply to ... | CptLemming/django-json-patch | json_patch/patch.py | Python | bsd-3-clause | 1,626 |
"""
homeassistant.components.sensor.transmission
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Monitors Transmission BitTorrent client API.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.transmission/
"""
import logging
from datetime import timedel... | nnic/home-assistant | homeassistant/components/sensor/transmission.py | Python | mit | 4,624 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Avanzosc - Avanced Open Source Consulting
# Copyright (C) 2011 - 2012 Avanzosc <http://www.avanzosc.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | avanzosc/avanzosc6.1 | avanzosc_prev_tesoreria_ext/__openerp__.py | Python | agpl-3.0 | 1,862 |
#
# Copyright (c) 2008-2015 Citrix Systems, 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 l... | mahabs/nitro | nssrc/com/citrix/netscaler/nitro/resource/config/dns/dnskey.py | Python | apache-2.0 | 17,166 |
import csv
import glob
from importlib import machinery
import os
from chainer.datasets import tuple_dataset
from chainer.datasets.image_dataset import _read_image_as_array
import numpy
from chainer_wing.extension.image_dataset import augment_data
from chainer_wing.subwindows.train_config import TrainParamServer
from ... | fukatani/CW_gui | chainer_wing/data_fetch.py | Python | bsd-3-clause | 10,396 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2020_04_01/operations/_available_endpoint_services_operations.py | Python | mit | 5,396 |
#!/usr/bin/python
#
# Copyright 2014 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 b... | wubr2000/googleads-python-lib | examples/dfp/v201411/activity_group_service/update_activity_groups.py | Python | apache-2.0 | 2,745 |
import renderdoc as rd
import rdtest
class D3D12_Resource_Lifetimes(rdtest.TestCase):
demos_test_name = 'D3D12_Resource_Lifetimes'
def check_capture(self):
self.check_final_backbuffer()
| TurtleRockStudios/renderdoc_public | util/test/tests/D3D12/D3D12_Resource_Lifetimes.py | Python | mit | 205 |
#!/usr/bin/env python
import sys
from ctypes import *
from ctypes.util import find_library
class loadavg(Structure):
_fields_ = [("ldavg", c_uint32 * 3),
("fscale", c_long)]
libc = cdll.LoadLibrary(find_library("c"))
def posix_sysctl_load(name):
_mem = loadavg()
_sz = c_size_t(sizeof(_mem))
... | stephen-soltesz/pipeline | src/tools/sysctl.py | Python | apache-2.0 | 956 |
# -*- 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... | googleads/google-ads-python | google/ads/googleads/v9/common/types/ad_asset.py | Python | apache-2.0 | 3,567 |
#!/usr/bin/env python
# coding: utf-8
import os
import unittest
import systran_geographic_api
import systran_geographic_api.configuration
class PoiApiTests(unittest.TestCase):
def setUp(self):
api_key_file = os.path.join(os.path.dirname(__file__), "../", "api_key.txt")
systran_geographic_api.conf... | SYSTRAN/geographic-api-python-client | tests/test_poi.py | Python | apache-2.0 | 2,435 |
# encoding: utf8
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("migrations", "0001_initial"),
]
operations = [
migrations.DeleteModel("Tribble"),
migrations.RemoveField("Author", "silly... | mbox/django | tests/migrations/test_migrations/0002_second.py | Python | bsd-3-clause | 650 |
from at_helper.modpack import Modpack
pack = Modpack('YogscastCompletePack')
print('---')
print('Is YogscastCompletePack public?')
print(pack.isPublic())
print('---')
print('What is its full name and description?')
print(pack.name())
print('---')
# print(pack.description())
print('What are its websites?')
print(pack.... | MCProHosting/at-helper | example.py | Python | mit | 878 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('django_flickr_gallery', '0002_auto_20150610_1909'),
]
operations = [
migrations.AlterField(
model_name='flickral... | arkanister/django-flickr-gallery | django_flickr_gallery/migrations/0003_auto_20150826_1557.py | Python | bsd-3-clause | 1,359 |
from __future__ import division
from numpy.random import RandomState
from numpy.testing import assert_allclose
from lim.genetics.heritability import estimate
from lim.random.canonical import bernoulli as bernoulli_sampler
from lim.genetics.phenotype import BernoulliPhenotype, BinomialPhenotype
from lim.random.canoni... | glimix/lim | lim/genetics/heritability/test/test_heritability.py | Python | mit | 1,095 |
# Copyright 2017 Google 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, ... | GoogleCloudPlatform/training-data-analyst | courses/developingapps/python/pubsub-languageapi-spanner/bonus/quiz/gcp/pubsub.py | Python | apache-2.0 | 2,828 |
from django.conf.urls import url
from atlas.special_workflows.views import *
app_name='special_workflows'
urlpatterns = [
url(r'^$', index, name='index'),
url(r'^idds_postproc/(?P<production_request>\d+)/$', idds_postproc, name='idds_postproc'),
url(r'^idds_postproc_save/(?P<step_id>\d+)/$', idds_post... | PanDAWMS/panda-bigmon-atlas | atlas/special_workflows/urls.py | Python | apache-2.0 | 527 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/handler_generator.py | Python | bsd-3-clause | 15,752 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Lp.py
from types import *
LP_ENV_PUT_COMPLETE = 'PUT_COMPLETE'
LP_ENV_ERROR_ENCOUNTERED = 'ERROR_ENCOUNTERED'
LP_ENV_BYTES_LEFT = 'BYTES_LEFT'
L... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/file/cmd/put/type_Lp.py | Python | unlicense | 384 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | rogerthat-platform/rogerthat-backend | src/rogerthat/bizz/js_embedding/mapping.py | Python | apache-2.0 | 1,064 |
# -*- coding: utf-8 -*-
"""This file contains a plugin for SSH syslog entries."""
import pyparsing
from plaso.parsers import syslog
from plaso.parsers.syslog_plugins import interface
class CronTaskRunEvent(syslog.SyslogLineEvent):
"""Convenience class for cron task run messages."""
DATA_TYPE = u'syslog:cron:tas... | dc3-plaso/plaso | plaso/parsers/syslog_plugins/cron.py | Python | apache-2.0 | 2,035 |
from __future__ import print_function
import pyxb.bundles.opengis.oseo_1_0 as oseo
import pyxb.utils.utility
import sys
import traceback
# Import to define bindings for namespaces that appear in instance documents
import pyxb.bundles.wssplat.wsnt
for f in sys.argv[1:]:
print('------------------ %s' % (f,))
xm... | CantemoInternal/pyxb | pyxb/bundles/opengis/examples/check_oseo.py | Python | apache-2.0 | 614 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | vincent-noel/libSigNetSim | libsignetsim/model/tests/TestModelDefinition.py | Python | gpl-3.0 | 10,529 |
#!/usr/bin/env python
"""
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");... | keedio/keedio-stacks | KEEDIO/1.4/services/GRAFANA/package/scripts/grafana.py | Python | apache-2.0 | 1,661 |
# Copyright 2012, Nachi Ueno, NTT MCL, 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
#
# Unles... | leeseuljeong/leeseulstack_neutron | neutron/db/securitygroups_rpc_base.py | Python | apache-2.0 | 20,934 |
"""
Utilities for cross validation.
taken from scikits.learn
# Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>,
# Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD Style.
# $Id$
changes to code by josef-pktd:
- docstring formatting: underlines of headers
"""
import numpy as np
t... | wesm/statsmodels | scikits/statsmodels/sandbox/tools/cross_val.py | Python | bsd-3-clause | 14,230 |
"""
KeepNote
Functions for iterating and inserting into textbuffers
"""
#
# KeepNote
# Copyright (c) 2008-2009 Matt Rasmussen
# Author: Matt Rasmussen <rasmus@mit.edu>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publish... | reshadh/Keepnote-LaTeX | keepnote/gui/richtext/textbuffer_tools.py | Python | gpl-2.0 | 18,602 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | noroutine/ansible | test/units/modules/network/f5/test_bigip_iapp_service.py | Python | gpl-3.0 | 11,901 |
from obdlib.elm327 import NO_RESULT
from obdlib.obd.modes import Modes
from obdlib.logging import logger
class Command(object):
"""
This class to provide the common functionality
to make PID's request
"""
def __init__(self, call_obd, units):
"""
Init the common params
... | QualiApps/obdlib | obdlib/obd/sensors.py | Python | mit | 4,747 |
from plugins.tasks.generate_plugins_xml import * | qgis/QGIS-Django | qgis-app/plugins/tasks/__init__.py | Python | gpl-2.0 | 48 |
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
class Article(models.Model):
text = models.TextField(blank=True)
annotations = GenericRelation("Annotation", object_id_field="parent_id",
... | theatlantic/host | host/articles/models.py | Python | bsd-2-clause | 786 |
import sys
import itertools, functools
import collections
import numpy
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.svm import SVC
from sklearn.datasets import fetch_mldata
from sklearn.neighbors import KNeighborsClassifier as KNN
from sklearn.preprocessing import StandardScaler
f... | neale/CS-program | 434-MachineLearning/final_project/linearClassifier/knn.py | Python | unlicense | 2,251 |
from django.contrib.gis.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from base_map.models.inheritance_managers import *
class ShapeMixin(object):
@property
def shape(self):
ctype = ContentType.objects.get_for_model(self.__cl... | spatialcollective/watsan | base_map/models/shapes.py | Python | mit | 2,163 |
from MDO import MDO
from fc_object_property import FCObjectProperty
from forecastmgmt.dao.db_connection import get_db_connection
import psycopg2.extras
class FCObject(MDO):
sql_dict={"get_all":"SELECT sid, common_name, uuid FROM fc_object",
"delete":"DELETE FROM fc_object WHERE sid=%s",
... | vvladych/forecastmgmt | src/forecastmgmt/model/fc_object.py | Python | unlicense | 2,562 |
from django.db import models
from rest_framework import serializers, viewsets, permissions
class HurricaneYear(models.Model):
year = models.PositiveSmallIntegerField()
named_storms = models.IntegerField(default=0)
hurricanes = models.IntegerField(default=0)
nino_sst_anomalies = models.FloatField(defau... | ccnmtl/wacep | wacep/forecaster/models.py | Python | gpl-3.0 | 814 |
"""
Logistic Regression Classifier with
batch gradient descent algorithm.
Splits data set as test and training data.
Shows Cost-Iteration plot for the test data
and accuracy scores for different performance metrics.
"""
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.metrics import... | alcmrt/Machine-Learning | Logistic Regression/logistic_regression_classifier.py | Python | mit | 11,942 |
# Copyright 2014 Netflix, 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... | Netflix/security_monkey | security_monkey/alerter.py | Python | apache-2.0 | 4,337 |
# Copyright 2009-2022 Joshua Bronson. All rights reserved.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""Provide typing-related objects."""
import typing as t
... | jab/bidict | bidict/_typing.py | Python | mpl-2.0 | 886 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Compares pre-calculated theorerical scattering curves to
experimental x-ray and neutron scattering curves.
"""
# Copyright 2014 University College London
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance ... | dww100/sct | python/bin/calculate_rfactor.py | Python | apache-2.0 | 4,887 |
__version__ = "0.1.dev27"
| andrefreitas/schwa | schwa/version.py | Python | mit | 26 |
#!/usr/bin/env python
# encoding: utf=8
"""
afromb.py
Re-synthesize song A using the segments of song B.
By Ben Lacker, 2009-02-24.
"""
import numpy
import sys
import time
import echonest.remix.audio as audio
from pyechonest import config
config.ECHO_NEST_API_KEY="EA4WLCKKLH82GSKVJ"
usage="""
Usage:
python af... | kunal732/emailDJ | afromb.py | Python | mit | 7,829 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | ryanss/holidays.py | holidays/countries/tunisia.py | Python | mit | 4,174 |
"""
Various codes to work with the initial mass function. Stolen shamelessly from
Adam Ginsburg's agpy code:
https://code.google.com/p/agpy/source/browse/trunk/agpy/imf.py
"""
from __future__ import print_function, division, absolute_import
import types # I use typechecking. Is there a better way to do this? (see in... | kgullikson88/gullikson-scripts | kglib/utils/IMF_utils.py | Python | mit | 9,300 |
#!/usr/bin/env python
import sys
PATH_INSTALL = "./"
sys.path.append(PATH_INSTALL)
from androguard.core.bytecodes import dvm
from androguard.core.bytecodes import apk
from androguard.core.analysis import analysis
from androguard.core import androconf
class Nop(dvm.Instruction10x):
def __init__(self):
se... | code4bones/androguard | demos/crackme_dexlabs_patch.py | Python | apache-2.0 | 1,566 |
"""
Tests for the ignore feature
"""
# pylint: disable=missing-docstring
# disable lint errors for function names longer that 30 characters
# pylint: disable=invalid-name
import os
import dploy
SUBCMD = "stow"
def test_ignore_by_ignoring_everthing(source_a, source_c, dest):
dploy.stow([source_a, source_c], dest... | arecarn/dploy | tests/test_ignore.py | Python | mit | 1,331 |
#
# Copyright (C) 2019 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be... | jkonecny12/anaconda | tests/unit_tests/pyanaconda_tests/test_simple_import.py | Python | gpl-2.0 | 3,095 |
# 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 th... | dennybaa/st2 | st2common/st2common/transport/bootstrap.py | Python | apache-2.0 | 1,220 |
# Copyright (C) 2010-2014 GRNET S.A.
#
# 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 program is distributed i... | Erethon/synnefo | snf-pithos-backend/pithos/backends/lib/sqlite/public.py | Python | gpl-3.0 | 3,407 |
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditi... | ramyfarid922/Quiz-Program | vendor/bundle/ruby/2.2.0/gems/libv8-3.16.14.7/vendor/v8/tools/testrunner/local/testsuite.py | Python | cc0-1.0 | 6,269 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache... | mycFelix/heron | heron/tools/tracker/src/python/handlers/metricshandler.py | Python | apache-2.0 | 5,834 |
# -*- coding: utf-8 -*-
# © 2016 Serpent Consulting Services Pvt. Ltd. (http://www.serpentcs.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import website
| JayVora-SerpentCS/e-commerce | website_sale_product_brand/models/__init__.py | Python | agpl-3.0 | 186 |
"""
*********
JSON data
*********
Generate and parse JSON serializable data for NetworkX graphs.
"""
| silentfuzzle/calibre | src/networkx/readwrite/json_graph/__init__.py | Python | gpl-3.0 | 102 |
import csv
import tempfile
import requests
from bs4 import BeautifulSoup
from django.core.management import BaseCommand
from gcutils.bigquery import Client, build_schema
from google.cloud.exceptions import Conflict
SCHEMA = build_schema(
("year_month", "DATE"),
("ods_code", "STRING"),
("vmp_snomed_code", ... | ebmdatalab/openprescribing | openprescribing/pipeline/management/commands/import_scmd.py | Python | mit | 4,753 |
##########################################################################
#
# Copyright (c) 2007-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | DoubleNegativeVisualEffects/cortex | test/IECore/Op.py | Python | bsd-3-clause | 5,432 |
#! /usr/bin/env python3
import sys
import math
import copy
from mule_local.JobMule import *
from mule.plotting.Plotting import *
from mule.postprocessing.JobsData import *
from mule.postprocessing.JobsDataConsolidate import *
import sys
groups = [
'runtime.timestepping_method',
]
tagname_x = 'runtime.t... | schreiberx/sweet | tests/70_program_swe_sphere_geostrophic_balance_nonlinear/postprocessing.py | Python | mit | 2,011 |
"""
EXAMPLE: Working with the uiverse class
"""
from universe import universe
import pandas as pd
# Create Instance of universe for US Equities
usEqUniverse = universe('usEquityConfig.txt')
# Get Summary Statistics
usEqUniverse.computeSummary()
# Plot Return
usEqUniverse.assetReturns.AA.plot() | pli1988/portfolioFactory | portfolioFactory/universe/example_generateUSEquityUniverse.py | Python | mit | 298 |
# -*- coding: utf-8 -*-
import math
from chempy.chemistry import Reaction
from chempy.util.testing import requires
from chempy.units import units_library, allclose, default_units as u
from ..arrhenius import arrhenius_equation, ArrheniusParam, ArrheniusParamWithUnits
def test_arrhenius_equation():
assert abs(... | bjodah/aqchem | chempy/kinetics/tests/test_arrhenius.py | Python | bsd-2-clause | 1,612 |
#!/usr/bin/env python
# coding=utf-8
#
# Copyright 2012 F2E.im
# Do have a faith in what you're doing.
# Make your life a story worth telling.
import time
from lib.query import Query
class PlaneModel(Query):
def __init__(self, db):
self.db = db
self.table_name = "plane"
super(PlaneModel, ... | bukun/ogcc | model/plane.py | Python | bsd-3-clause | 921 |
import threading
_store = threading.local()
_store.user = None
def set_user(user):
"""
Sets the current request's logged-in user. user should be a
afe.models.User object.
"""
_store.user = user
def get_user():
'Get the currently logged-in user as a afe.models.User object.'
return _stor... | lmr/autotest | frontend/thread_local.py | Python | gpl-2.0 | 327 |
#
# Copyright (C) 2014 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 wr... | nikesh-mahalka/nova | nova/tests/unit/virt/image/test_model.py | Python | apache-2.0 | 3,239 |
import pygame
from lib.cnst import *
from lib import sprite
from lib import player
def init(g, r, n, vx, *params):
s = sprite.Sprite3(g, r, 'spiner/left-0', (0, 0, 16, 16))
# s.rect.bottom = r.bottom
s.rect.centery = r.centery
s.rect.centerx = r.centerx
s.groups.add('solid')
s.grou... | TurBoss/HostilPlanet | lib/spiner.py | Python | gpl-2.0 | 1,216 |
import itertools
__author__ = 'Jan Hajic jr'
import unittest
from test.safire_test_case import SafireTestCase
import safire.data.filters.positional_filters as filters
sentences = [['This', 'is', 'a', 'sentence', '.'],
['This', 'is', 'another', 'such', 'sentence', '.'],
['This', 'is', 'not',... | hajicj/safire | test/test_positional_filters.py | Python | gpl-3.0 | 2,216 |
"""
Model classes for AppDynamics REST API
.. moduleauthor:: Todd Radel <tradel@appdynamics.com>
"""
from . import JsonObject, JsonList
from appd.time import from_ts
class MetricValue(JsonObject):
FIELDS = {
'current': '',
'min': '',
'max': '',
'value': '',
'start_time_ms... | tradel/AppDynamicsREST | appd/model/metric_value.py | Python | apache-2.0 | 1,241 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, sathishpy@gmail.com and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class CMBankAccountMapper(Document):
def autoname(self):
self.name = self.bank_accoun... | sathishpy/corrugation | corrugation/corrugation/doctype/cm_bank_account_mapper/cm_bank_account_mapper.py | Python | gpl-3.0 | 336 |
"""api_server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | wangjinyu/api_server | api_server/urls.py | Python | mit | 898 |
def bigdigits(line_splitted):
line_splitted = list(line_splitted)
string_row_one = '-**----*--***--***---*---****--**--****--**---**--'
list_row_one = list(string_row_one)
string_row_two = '*--*--**-----*----*-*--*-*----*-------*-*--*-*--*-'
list_row_two = list(string_row_two)
string_row_three = '*--*---*---... | Lhedzv/Coding_Wednesdays | bigdigits.py | Python | mit | 1,512 |
import hdtv.rootext.dlmgr
import hdtv.rootext.calibration
hdtv.rootext.dlmgr.LoadLibrary("display")
| op3/hdtv | hdtv/rootext/display.py | Python | gpl-2.0 | 101 |
"""
given:
<'a', 5, 10>
<'b', 6, 8>
<'c', 10, 11>
assume input is a list of tuples, and ordered by the start time of a log.
"""
import collections
def logger(users):
record = {}
for i in users:
try:
record[i[1]] += 1
except:
record[i[1]] = 1
try:
r... | linyaoli/acm | others/intermediate/number_of_users.log.py | Python | gpl-2.0 | 618 |
# 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
# d... | HybridF5/jacket | jacket/compute/conductor/tasks/migrate.py | Python | apache-2.0 | 2,961 |
from mednet.ushahidi.models import *
from django.contrib.gis import admin
class CategoryAdmin(admin.OSMGeoAdmin):
list_display = ('ushahidi_id', 'title', 'description', 'color', 'icon')
class CountryAdmin(admin.OSMGeoAdmin):
list_display = ('ushahidi_id', 'iso', 'name', 'capital')
class LocationAdmin(... | jj0hns0n/mednet | ushahidi/admin.py | Python | bsd-3-clause | 858 |
'''Para testing y desarrollo'''
# -*- coding: utf-8 -*-
import socket
from escpos import printer
from DriverInterface import DriverInterface
TCP_PORT = 9100
from DriverInterface import DriverInterface
class ReceiptFileDriver(printer.File, DriverInterface):
""" Generic file printer
This cl... | ristorantino/fiscalberry | Drivers/ReceiptFileDriver.py | Python | mit | 915 |
#!/usr/bin/env python
import pika
import json
import ConfigParser
import time
import random
class TaskQueue:
def __init__(self):
config = ConfigParser.RawConfigParser()
config.read('credentials.properties')
self.rabbitServer1=config.get('rabbit', 'server1');
self.rabbitServer2=config.get... | mrejster/videoWasp | service/task_queue.py | Python | apache-2.0 | 2,042 |
import xmlrpclib as xml
import time
# connect to environment via XML-RPC
e = xml.ServerProxy('http://localhost:8001')
def sense():
return e.do('sense', {'agent':'Ralph'})
def step(time):
e.do('meta_step', {'seconds':time})
def do(command, args = None):
if not args:
args = {}
args['agent'] = '... | dasmith/IsisWorld | agents/test_thoughts.py | Python | gpl-3.0 | 1,119 |
# -*- coding: utf-8 -*-
#
# vim: sw=4:expandtab:foldmethod=marker
#
# Copyright (c) 2006, Mathieu Fenniak
# Copyright (c) 2007, Ashish Kulkarni <kulkarni.ashish@gmail.com>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the foll... | kitanata/resume | env/lib/python2.7/site-packages/PyPDF2/pdf.py | Python | mit | 116,685 |
# Automatic first-order derivatives
#
# Written by Konrad Hinsen <hinsen@cnrs-orleans.fr>
# last revision: 2002-6-13
#
# Adapted slightly to work independently and use numpy - bgoli
# Brett Olivier 20070308
"""This module provides automatic differentiation for functions with
any number of variables. Instanc... | asttra/pysces | pysces/lib/FirstDerivatives.py | Python | bsd-3-clause | 9,908 |
from twython import Twython
from twython.exceptions import TwythonAuthError, TwythonRateLimitError
def oauth(config):
if config.oauth_token == '' or config.oauth_token_secret == '':
try:
t = Twython(config.consumer_key, config.consumer_secret)
print('Get authorized PIN code from ur... | kubor/chem_bot | chem_bot/twitter/auth.py | Python | mit | 1,581 |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test... | segsignal/bitcoin | qa/rpc-tests/p2p-compactblocks.py | Python | mit | 44,298 |
import sys
import os
#Go one directory up and append to path to access the deepdna package
#The following statement is equiv to sys.path.append("../")
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__),os.path.pardir)))
def main(argv):
assert coords_overlap(('chr1',40,50),('chr1'... | LarsDu/DeepNucDecomp | scripts/bed_remove_overlaps.py | Python | gpl-3.0 | 3,234 |
import logging.handlers
import re
import sys
import types
from django.utils import six
from django_compat_patcher.deprecation import *
warnings.warn("django.utils.dictconfig will be removed in Django 1.9.",
RemovedInDjango19Warning, stacklevel=2)
# This is a copy of the Python logging.config.dictconfi... | pakal/django-compat-patcher | src/django_compat_patcher/django_legacy/django1_9/utils/dictconfig.py | Python | mit | 23,222 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.