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 |
|---|---|---|---|---|---|
#!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
# Copyright (c) 2017 Dell 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_versio... | veger/ansible | lib/ansible/modules/network/dellos10/dellos10_command.py | Python | gpl-3.0 | 7,205 |
"""Support for Xiaomi Aqara sensors."""
from __future__ import annotations
import logging
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_BATTERY_LEVEL,... | rohitranjan1991/home-assistant | homeassistant/components/xiaomi_aqara/sensor.py | Python | mit | 7,176 |
import heppy.framework.config as cfg
from getFiles import getFiles
gun_211_0_20 = cfg.Component(
'gun_211_0_20',
files = getFiles("/Gun_221_0_20_ptflat/743_v1/AODSIM", cache=True),
)
gun_211_0_10 = cfg.Component(
'gun_211_0_10',
files = getFiles("/Gun_211_0_10_ptflat/743_v1/AODSIM"),
)
gun_211_Ma... | semkiv/heppy_fcc | samples/gun.py | Python | gpl-3.0 | 1,404 |
from __future__ import absolute_import, print_function, division
import re
import warnings
import six
from netlib import encoding, strutils, basetypes
from netlib.http import headers
if six.PY2: # pragma: no cover
def _native(x):
return x
def _always_bytes(x):
return x
else... | x2Ident/x2Ident | mitmproxy/netlib/http/message.py | Python | gpl-3.0 | 9,723 |
# -*- coding: utf-8 -*-
# transformations.py
# Copyright (c) 2006-2015, Christoph Gohlke
# Copyright (c) 2006-2015, The Regents of the University of California
# Produced at the Laboratory for Fluorescence Dynamics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modifica... | Gato-X/NotYourData | gameowfication/libs/transformations.py | Python | mit | 65,838 |
import locale
import os
import re
import subprocess
import sys
import platform
import time
# init libs
PROGRAM_DIR = os.path.dirname(os.path.normpath(os.path.abspath(os.path.join(__file__, os.pardir))))
LIBS_DIR = os.path.join(PROGRAM_DIR, 'libs')
sys.path.insert(0, LIBS_DIR)
# init preliminaries
SYS_ARGV = sys.argv[... | grantsewell/nzbToMedia | core/__init__.py | Python | gpl-3.0 | 33,961 |
from google.appengine.ext import ndb
import json
import re
from models.util import DateTimeProperty
from models.email import EmailReport
import actions
class RuleValidationException(Exception):
"""
RuleValidationException - a generic validation error
"""
def __init__(self, message):
super(R... | duo-labs/isthislegit | dashboard/models/rule.py | Python | bsd-3-clause | 5,412 |
import unittest
import numpy as np
import bayesnet as bn
class TestPower(unittest.TestCase):
def test_power(self):
x = bn.Parameter(2.)
y = 2 ** x
self.assertEqual(y.value, 4)
y.backward()
self.assertEqual(x.grad, 4 * np.log(2))
x = np.random.rand(10, 2)
x... | ctgk/BayesianNetwork | test/math/test_power.py | Python | mit | 555 |
import os
from json import loads
SECRET_KEY = os.environ.get('SECRET_KEY', 'devkey')
REDIS_URL = os.environ.get('REDIS_URL')
| natfoster82/desertmoon | config.py | Python | mit | 127 |
#!/usr/bin/env python
#
# Generate pnSeed[] from Pieter's DNS seeder
#
NSEEDS=600
import re
import sys
from subprocess import check_output
def main():
lines = sys.stdin.readlines()
ips = []
pattern = re.compile(r"^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3}):CM_Port")
for line in lines:
m = pa... | realspencerdupre/coinmaker | sourcecoin/contrib/seeds/makeseeds.py | Python | gpl-3.0 | 711 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2022 Smile (<https://www.smile.eu>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the ... | Smile-SA/odoo_addons | smile_api_rest/__manifest__.py | Python | agpl-3.0 | 2,259 |
"""The mütesync integration."""
from __future__ import annotations
import logging
import async_timeout
import mutesync
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
from homeassistant.helpers import update_coordinator
from ... | home-assistant/home-assistant | homeassistant/components/mutesync/__init__.py | Python | apache-2.0 | 1,978 |
# 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-batch/azure/batch/models/task_add_result.py | Python | mit | 2,414 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: orderer/configuration.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 _message
from google.protobuf import reflec... | cophey/fabric | bddtests/orderer/configuration_pb2.py | Python | apache-2.0 | 7,996 |
"""
A class that reflect a decoration to be made on certain XML node using WX
"""
import types, os
from collections import defaultdict
import glob
import logging
import random
from lxml import etree
#import cStringIO
import wx
sEncoding = "utf-8"
def setEncoding(s):
global sEncoding
sEncoding = s
class Dec... | Transkribus/TranskribusDU | TranskribusDU/visu/deco.py | Python | bsd-3-clause | 51,210 |
prob_trans = {
'P': {
'P': -10.820039589758984,
'B': -100,
'M': -13.523481487774999,
'S': -100,
'X': -100,
'L': -12.686084698370507,
'F': -12.642282075712114,
'W': -14.693552740425254,
'D': -9.2953900389075006,
'G': -12.901793271197199,
'K': -100,
'I': -11.592459951213437,
'A': -100,
'Z': -100,
'J': -10.838688148837056... | yuanlisky/linlp | linlp/algorithm/viterbiMat/prob_trans_organization.py | Python | apache-2.0 | 5,301 |
# Under MIT License, see LICENSE.txt
STRATEGY_COMMAND_TYPE = 5002
TACTIC_COMMAND_TYPE = 5003
class UIDebugCommand(object):
def __init__(self, raw_cmd):
# print(raw_cmd)
self.data = raw_cmd['data']
self.cmd_type = raw_cmd['type']
def is_strategy_cmd(self):
return self.cmd_typ... | wonwon0/StrategyIA | RULEngine/Debug/ui_debug_command.py | Python | mit | 432 |
import sys
sys.path.append('.')
from app import app as application
| xhacker/neural-alt | server/passenger_wsgi.py | Python | mit | 67 |
# -*- coding: utf-8 -*-
"""
@author: Eric Vanhove
"""
# Imports
import boto3
# Constants
#Make sure you provide / in the end unless no prefix
prefix = ''
bucket_name = 'aws-logs-079119988851-us-west-2'
path = '231856634451o.jpg'
fileName = '231856634451o.jpg'
# Ensure that your credentials are in place
s3client =... | evohnave/myAWS | Bucket_and_subfolders.py | Python | mit | 2,582 |
#!/usr/bin/env python
# Copyright 2021 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.
import os
import shutil
import sys
from tsc_ignore_errors import run_tsc_ignore_errors
webgpu_cts_dir = os.path.dirname(os.path.dirna... | nwjs/chromium.src | third_party/webgpu-cts/scripts/compile_src.py | Python | bsd-3-clause | 2,225 |
from cloudify import ctx
from cloudify.state import ctx_parameters
ctx.instance.runtime_properties['prop1'] = ctx_parameters['target_id']
| cloudify-cosmo/cloudify-manager | tests/integration_tests/resources/dsl/idd/scripts/set_target_attribute.py | Python | apache-2.0 | 139 |
# Claire Jaja
# 11/1/2014
#
# Project Euler
# Problem 2
# Even Fibonacci numbers
#
# Each new term in the Fibonacci sequence is generated by adding
# the previous two terms.
# By starting with 1 and 2, the first 10 terms will be:
# 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
# By considering the terms in the Fibonacci seque... | clairejaja/project-euler | src/main/python/problem2/even_fibonacci_numbers.py | Python | mit | 876 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-27 17:04
from __future__ import unicode_literals
import string
from django.db import migrations
def create_short_name(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects.... | joshsimmons/animportantdate | animportantdate/wedding/migrations/0010_auto_20170527_1704.py | Python | mit | 838 |
"""
Artificial Intelligence for Humans
Volume 1: Fundamental Algorithms
Python Version
http://www.aifh.org
http://www.jeffheaton.com
Code repository:
https://github.com/jeffheaton/aifh
Copyright 2013 by Jeff Heaton
Licensed under the Apache License, Version 2.0 (the "License");
... | PeterLauris/aifh | vol1/python-examples/test/aifh/__init__.py | Python | apache-2.0 | 972 |
"""The Fronius integration."""
from __future__ import annotations
import asyncio
from collections.abc import Callable
import logging
from typing import Final, TypeVar
from pyfronius import Fronius, FroniusError
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_MODEL, ATTR_SW_V... | mezz64/home-assistant | homeassistant/components/fronius/__init__.py | Python | apache-2.0 | 8,577 |
from .registry import RegistryProxy
##
## Idea: A stack of registries, the topone being the one consulted.
## This allows a test to push/pop newly initialized registries, same for custom
## setups. Optionally name levels (e.g. toplevel == global). Might even
## search across levels
class CoreRegistry(object):
de... | wheelcms/wheelcms_axle | wheelcms_axle/registries/core_registry.py | Python | bsd-2-clause | 830 |
from kivy.uix.floatlayout import FloatLayout
from kivy.properties import NumericProperty, ObjectProperty
from kivy.graphics import Color, Ellipse, Line
from kivy.graphics.transformation import Matrix
from kivy.core.window ... | shy21grams/GroundControl | Simulation/simulationCanvas.py | Python | gpl-3.0 | 3,902 |
import csv
class FieldCleaner:
""" This class takes a field definition file and cleans it, producing a field definition file that can be read by schemaLoader """
@staticmethod
def cleanFile(fileIn, fileOut):
""" Clean input file line by line and create output file """
done = False
... | fedspendingtransparency/data-act-validator | dataactvalidator/filestreaming/fieldCleaner.py | Python | cc0-1.0 | 5,683 |
import numpy as np
from math import *
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def pure_math(lengths, angles):
l1, l2 = lengths
theta1, theta2, theta3 = angles
x1, y1, z1 = 0, 0, 0
x2 = -l1 * sin(theta1) * cos(theta2)
y2 = l1 * sin(theta2)
z2 = -l1 * cos(theta1... | bobbyluig/Eclipse | src/finesse/tests/leg1.py | Python | mit | 6,403 |
from views.viewEditor import *
from views.boardPrint.board import *
from views.boardPrint.boardEditor import *
import views.resources
import boardOption
from helpOption import *
from pygobstones.commons.i18n import *
from pygobstones.commons.qt_utils import saveFileName
class Editor(QtGui.QWidget):
def __init__(s... | gobstones/PyGobstones | pygobstones/gui/editor.py | Python | gpl-3.0 | 5,582 |
# 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-web/azure/mgmt/web/models/triggered_web_job_paged.py | Python | mit | 951 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and Contributors
# See license.txt
import frappe
import unittest
# test_records = frappe.get_test_records('Quality Inspection')
class TestQualityInspection(unittest.TestCase):
pass
| bazz-erp/erpnext | erpnext/stock/doctype/quality_inspection/test_quality_inspection.py | Python | gpl-3.0 | 254 |
import numpy as np
import cv2
import timeit
import matplotlib.pyplot as plt
from skimage.segmentation import felzenszwalb,slic
from skimage.segmentation import mark_boundaries
from skimage.color import label2rgb
import multiprocessing
import random
import Obj_segment.Rect
path = "/media/iglu/Data/DatasetIglu"
u = ['us... | pazagra/catkin_ws | src/Multimodal_Interaction/Obj_segment/Obj_Cand.py | Python | gpl-3.0 | 15,760 |
#!/usr/bin/python
import sys,os
import re
import pprint
import time
import base64
import datetime
import time
import simplejson
import jsonpickle
from functools import wraps
from flask import Flask, request, session, g, redirect, url_for, abort, render_template, flash, make_response, jsonify, Markup, Response, ... | sauloal/pycluster | ui.py | Python | mit | 31,022 |
# -*- coding: utf-8 -*-
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
import io
import itertools
import logging
import operator
import os
import socket
from babelfish import Language, LanguageReverseError
from guessit import guessit
from six.moves.x... | fernandog/subliminal | subliminal/core.py | Python | mit | 30,261 |
import pytest
from xmitgcm import file_utils
@pytest.fixture(scope="session")
def directory_with_files(tmpdir_factory):
temppath = tmpdir_factory.mktemp("xmitgcm_test_data")
temppath.join('bar.0000000001.meta').ensure(file=True)
temppath.join('baz.data').ensure(file=True)
return temppath
def test_lis... | xgcm/xmitgcm | xmitgcm/test/test_file_utils.py | Python | mit | 1,228 |
# 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 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | ppasq/geonode | geonode/api/api.py | Python | gpl-3.0 | 26,619 |
# -*- python -*-
# ex: set syntax=python:
# 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/.
from buildbot.process import factory
from buildbot.steps.source import Merc... | adobe-flash/avmplus | build/buildbot/master/sandbox.py | Python | mpl-2.0 | 41,692 |
"""Tests around handling repositories which require authentication."""
from cookiecutter.prompt import read_repo_password
def test_click_invocation(mocker):
"""Test click function called correctly by cookiecutter.
Test for password (hidden input) type invocation.
"""
prompt = mocker.patch('click.prom... | audreyr/cookiecutter | tests/test_read_repo_password.py | Python | bsd-3-clause | 480 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from setuptools import setup
DESCRIPTION = 'webui for youtube-dl'
LONG_DESCRIPTION = 'Another webui for youtube-dl, powered by youtube-dl'
setup (
name='youtube_dl_webui',
version='rolling',
packages=['youtube_dl_webui'],
license='GPL-2.0',... | d0u9/youtube-dl-webui | setup.py | Python | gpl-2.0 | 770 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-07 07:44
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('veggie', '0011_auto_20170606_1913'),
]
operations = [
migrations.AlterField... | pgastinger/bratshop | veggie/migrations/0012_auto_20170607_0744.py | Python | gpl-3.0 | 609 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2019 khalim19
#
# 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 applicab... | khalim19/gimp-plugin-export-layers | export_layers/pygimplib/version.py | Python | gpl-3.0 | 8,370 |
import sys
from PySide.QtCore import *
from PySide.QtGui import *
class WorkBookWindow(QMainWindow):
def __init__(self, parent=None):
super(WorkBookWindow, self).__init__(parent)
self.lock = True
self.ID = -1
def getID(self):
return self.ID
def setID(self, newID):
self.ID = newID
def closeEvent(s... | s910324/Sloth | wbSubWin.py | Python | lgpl-3.0 | 658 |
#!/usr/bin/env python
from unittest import TestCase
from boutiques.bosh import bosh
from boutiques import __file__ as bfile
import os
import subprocess
class TestInvocation(TestCase):
def test_invocation(self):
descriptor = os.path.join(os.path.split(bfile)[0],
"schema/... | boutiques/schema | tools/python/boutiques/tests/test_invocation.py | Python | gpl-2.0 | 1,925 |
#!/usr/bin/env python3
#
# Copyright (c) 2017, Neil Booth
#
# All rights reserved.
#
# See the file "LICENCE" for information about the copyright
# and warranty status of this software.
'''Script to compact the history database. This should save space and
will reset the flush counter to a low number, avoiding overflo... | Groestlcoin/electrumx-grs | compact_history.py | Python | mit | 2,235 |
import six
from .html_elements import InputCollection
from .input import Input
from ..meta_elements import MetaHTMLElement
@six.add_metaclass(MetaHTMLElement)
class CheckBox(Input):
@property
def is_set(self):
"""
Returns True if the element is checked
:rtype: bool
"""
... | lmtierney/watir-snake | nerodia/elements/check_box.py | Python | mit | 1,069 |
from django.utils.translation import ugettext_noop as _
from transurlvania.defaults import *
urlpatterns = patterns('garfield.views',
url(r'^$', 'landing', name='garfield_landing'),
url(_(r'^the-president/$'), 'the_president', name='garfield_the_president'),
(_(r'^the-cat/$'), 'comic_strip_list', {}, 'ga... | trapeze/transurlvania | tests/garfield/urls.py | Python | bsd-3-clause | 502 |
from xblock.fields import Boolean, Scope
from group_project_v2.stage.utils import StageState
from group_project_v2.utils import gettext as _
class SimpleCompletionStageMixin(object):
"""
runtime.publish(block, 'progress', {'user_id': user_id}) properly creates completion records, but they are
unavailable... | open-craft/xblock-group-project-v2 | group_project_v2/stage/mixins.py | Python | agpl-3.0 | 1,632 |
#!/usr/bin/env python
import os
import time
import sys;
time.sleep(600)
os.system('sudo sysctl net.mpip.mpip_skype=1')
time.sleep(600)
os.system('sudo sysctl net.mpip.mpip_skype=0')
time.sleep(600)
#os.system('sudo killall emulab-iperf')
exit()
| gbtian/mptcp | sigcomm15/experiment/skype/skype.py | Python | gpl-2.0 | 248 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-21 12:42
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('database', '0018_auto_20170821_0840'),
]
operations = [
migrations.AlterFie... | ACLARKNET/aclarknet-database | aclarknet/database/migrations/0019_auto_20170821_0842.py | Python | mit | 769 |
"""
hostdev device support class(es)
http://libvirt.org/formatdomain.html#elementsHostDev
"""
from virttest.libvirt_xml.devices import base
from virttest.libvirt_xml import accessors
class Hostdev(base.TypedDeviceBase):
__slots__ = ('mode', 'hostdev_type', 'source',
'managed', 'boot_order',)
... | vipmike007/avocado-vt | virttest/libvirt_xml/devices/hostdev.py | Python | gpl-2.0 | 4,170 |
plot = coh.plot()
ax = plot.gca()
ax.set_ylabel('Frequency [Hz]')
ax.set_yscale('log')
ax.set_ylim(10, 8000)
ax.set_title('Coherence between SRCL and CARM for L1')
ax.grid(True, 'both', 'both')
plot.add_colorbar(label='Coherence', clim=[0, 1])
plot.show() | gwpy/gwpy.github.io | docs/v0.4/examples/spectrogram/coherence-4.py | Python | gpl-3.0 | 255 |
from .models import TaskState, TaskMeta, WorkerState
from rest_framework import serializers
class TaskStateSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = TaskState
class WorkerStateSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = WorkerState
... | hollowpoint/hollowpoint | hpt/core/serializers.py | Python | apache-2.0 | 427 |
""" define extension dtypes """
import re
import numpy as np
from pandas import compat
class ExtensionDtype(object):
"""
A np.dtype duck-typed class, suitable for holding a custom dtype.
THIS IS NOT A REAL NUMPY DTYPE
"""
name = None
names = None
type = None
subdtype = None
kind =... | Vvucinic/Wander | venv_2_7/lib/python2.7/site-packages/pandas/core/dtypes.py | Python | artistic-2.0 | 5,492 |
# <pep8 compliant>
import bpy
from . import import_xnalara_model
from . import import_xnalara_pose
class ArmatureBonesHideByName_Op(bpy.types.Operator):
bl_idname = 'xps_tools.bones_hide_by_name'
bl_label = 'Hide bones by name'
bl_description = 'Move bones starting with "unused" to the armature layer 2'... | feureau/Small-Scripts | Blender/Blender config/2.91/scripts/addons/XNALaraMesh/xps_toolshelf.py | Python | gpl-3.0 | 6,741 |
# 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-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/models/recovery_point_resource_paged.py | Python | mit | 1,000 |
""" Time transformations
This handles all the wibbly wobbly timey wimey stuff.
Such as easy conversions between different time systems.
Supported systems: GPS, UTC, GMST, LST, JD and MJD.
Formulae from:
IETF list of leap seconds
'Leap seconds announced by the IERS'
https://www.ietf.org/timezones/data/leap-seconds.li... | HiSPARC/sapphire | sapphire/transformations/clock.py | Python | gpl-3.0 | 10,275 |
#! /usr/bin/env python
import pytest
from lmcipy.interpret import (
process_labels,
generate_opcodes,
opcode_func_deconstruct,
load_opcodes,
eval_opcode,
interpret,
SyntaxError
)
from lmcipy.machine import MachineState
@pytest.fixture
def empty_machine():
return MachineState()
def ... | fm4d/lmcipy | tests/test_interpret.py | Python | gpl-3.0 | 3,763 |
#runas BlackScholes(range(1,100), range(1,100), range(1,100), 0.5, 0.76, 12)
#bench BlackScholes(range(1,400001), range(1,400001), range(1,400001), 0.5, 0.76, 400000)
#pythran export BlackScholes(float list, float list, float list, float, float, int)
import math
def BlackScholes(stock_price, option_strike, option_yea... | artas360/pythran | pythran/tests/cases/blacksholes.py | Python | bsd-3-clause | 1,427 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from glob import glob
import os
import sys
from setuptools import setup, Extension
from Cython.Build import cythonize
if sys.version_info[:2] < (2, 7):
print(
'nxcpy requires Python version 2.7 or later' +
' ({}.{... | OrkoHunter/nxcpy | setup.py | Python | bsd-3-clause | 1,193 |
from behaviours.Behaviour import Behaviour
from src.GameMethods import GameMethods
class Fall(Behaviour):
def update(self, delta_time, keys, config, game_methods: GameMethods):
self.owner.velocity.y += float(config["Physics"]["gravity"]) * delta_time;
| cthit/CodeIT | behaviours/Fall.py | Python | mit | 266 |
# Natural Language Toolkit: Tagged Corpus Reader
#
# Copyright (C) 2001-2016 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# Jacob Perkins <japerk@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
A reader for c... | adazey/Muzez | libs/nltk/corpus/reader/tagged.py | Python | gpl-3.0 | 12,886 |
#
# Copyright (C) 2015 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Shahanmik3/android_device_xiaomi_cancro | releasetools/releasetools.py | Python | gpl-2.0 | 841 |
#!/usr/bin/env python3
import gpio
import rospy
import time
from std_msgs.msg import Bool
from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus
CHANNEL1 = 394
CHANNEL2 = 393
gpio.setup(CHANNEL1, gpio.OUT)
gpio.setup(CHANNEL2, gpio.OUT)
FIRETIME = 0.04
t1Last = False
t2Last = False
def fireTorp1(data):
... | RoboticsClubatUCF/RoboSub | ucf_sub_embedded_ros/ucf_sub/src/sub_sensors/src/Torpedo.py | Python | mit | 900 |
"""
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | googleinterns/debaised-analysis | intents/util/date_module.py | Python | apache-2.0 | 1,544 |
# -*- coding: UTF-8 -*-
## Copyright 2013-2015 Luc Saffre
# License: BSD (see file COPYING for details)
"""
Moved to :ref:`welfare.tested.misc`.
"""
| khchine5/lino-welfare | tests/test_welfare_demo.py | Python | agpl-3.0 | 152 |
# Copyright 2018 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... | GoogleCloudPlatform/python-docs-samples | functions/tips/main_test.py | Python | apache-2.0 | 3,090 |
# Copyright 2016 Battelle Energy Alliance, 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 agr... | idaholab/civet | client/tests/LiveClientTester.py | Python | apache-2.0 | 1,201 |
def func() -> int:
pass | allotria/intellij-community | python/testData/stubs/FunctionAnnotation.py | Python | apache-2.0 | 27 |
from __future__ import absolute_import
from celery import shared_task
@shared_task(ignore_result=False)
def add(x, y):
return x + y
| delving/nave | nave/common/tasks.py | Python | gpl-2.0 | 139 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import random
import time
from user_info import get_user_info
def get_media_id_user_feed(self):
if self.login_status:
if self.is_by_tag != True:
log_string = "======> Get media id by user: %s <======" % (
self.current_u... | iamandresdiaz/botSolidarity | src/user_feed.py | Python | mit | 2,064 |
from __future__ import absolute_import, division, print_function
import copy
from ._compat import iteritems
from ._make import NOTHING, _obj_setattr, fields
from .exceptions import AttrsAttributeNotFoundError
def asdict(
inst,
recurse=True,
filter=None,
dict_factory=dict,
retain_collection_types... | fnaum/rez | src/rez/vendor/attr/_funcs.py | Python | lgpl-3.0 | 9,725 |
#!/usr/bin/env python
"""A server that retrieves Rekall profiles by name."""
import json
import urllib2
import zlib
import logging
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import config_lib
from grr.lib import rdfvalue
from grr.lib import registry
class ProfileServer(object):
__m... | pchaigno/grreat | lib/rekall_profile_server.py | Python | apache-2.0 | 4,932 |
# encoding: utf-8
# module PyQt4.QtGui
# from /usr/lib/python3/dist-packages/PyQt4/QtGui.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# imports
import PyQt4.QtCore as __PyQt4_QtCore
class QStyleOption(): # skipped bases: <class 'sip.simplewrapper'>
"""
QStyleOption(int version=QStyleOption.V... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/PyQt4/QtGui/QStyleOption.py | Python | gpl-2.0 | 2,102 |
# -*- coding: utf-8 -*-
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2016, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible 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 So... | fernandezcuesta/ansible | test/units/parsing/vault/test_vault.py | Python | gpl-3.0 | 30,935 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2016, 2017, 2018 Guenter Bartsch
#
# 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... | gooofy/nlp | zamiaai/model.py | Python | lgpl-3.0 | 3,573 |
#
# ElementTree
# $Id: ElementPath.py 1858 2004-06-17 21:31:41Z Fredrik $
#
# limited xpath support for element trees
#
# history:
# 2003-05-23 fl created
# 2003-05-28 fl added support for // etc
# 2003-08-27 fl fixed parsing of periods in element names
#
# Copyright (c) 2003-2004 by Fredrik Lundh. Al... | remybaranx/qtaste | tools/jython/lib/Lib/elementtree/ElementPath.py | Python | gpl-3.0 | 6,150 |
__author__ = 'teddydestodes'
import sys
import binascii
import socket
import select
import hashlib
class ApiRos:
"""Routeros api"""
def __init__(self, sk):
self.sk = sk
self.currenttag = 0
def login(self, username, pwd):
for repl, attrs in self.talk(["/login"]):
chal ... | TeddyDesTodes/pyflipdot | pyflipdot/plugins/mikrotik/__init__.py | Python | bsd-3-clause | 5,309 |
import collections
import operator
import os
import json
import logging
import mimetypes
import md5
from django.core.urlresolvers import reverse
from django.core.cache import cache
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.models import User
from django.http import H... | GovReady/readthedocs.org | readthedocs/projects/views/public.py | Python | mit | 16,118 |
"""Support for Ambient Weather Station binary sensors."""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.const import ATTR_NAME
from . import (
SENSOR_TYPES, TYPE_BATT1, TYPE_BATT2, TYPE_BATT3, TYPE_BATT4, TYPE_BATT5,
TYPE_BATT6, TYPE_BATT7, TYPE_BATT8,... | MartinHjelmare/home-assistant | homeassistant/components/ambient_station/binary_sensor.py | Python | apache-2.0 | 2,546 |
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
#
# sandesh_stats.py
#
class SandeshStats(object):
class SandeshStatsElem(object):
def __init__(self):
self.tx_count = 0
self.tx_bytes = 0
self.rx_count = 0
self.rx_bytes = 0
#end _... | safchain/vr_nldump | vr_nldump/pysandesh/sandesh_stats.py | Python | apache-2.0 | 1,340 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_auto_20150823_2014'),
]
operations = [
migrations.RenameModel(
old_name='Catagory',
new... | python-ning/blog | blogchen/blog/migrations/0004_auto_20150824_1217.py | Python | mpl-2.0 | 355 |
import renderdoc as rd
import rdtest
class GL_Resource_Lifetimes(rdtest.TestCase):
demos_test_name = 'GL_Resource_Lifetimes'
def check_capture(self):
self.check_final_backbuffer()
| TurtleRockStudios/renderdoc_public | util/test/tests/GL/GL_Resource_Lifetimes.py | Python | mit | 199 |
from ld2.ld2 import *
import math
samples = get_samples('./ld3/ld1/examples_boolean.txt')
results = get_results('./ld3/ld1/d_notand.txt')
class MLPerceptron():
def __init__(self, HIDDEN_COUNT, INPUT_SIZE, W, b, g, nn):
self.HIDDEN = Perceptron(
n=HIDDEN_COUNT,
m=INPUT_SIZE,
... | ktaube/neural-network-course | neural-netoworks/ld3.py | Python | mit | 4,054 |
# -*- coding: utf-8 -*-
#
# Anaconda documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 18 14:37:01 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# Al... | maxamillion/anaconda | docs/conf.py | Python | gpl-2.0 | 11,072 |
#coding: utf-8
# +-------------------------------------------------------------------
# | 宝塔Linux面板
# +-------------------------------------------------------------------
# | Copyright (c) 2015-2016 宝塔软件(http://bt.cn) All rights reserved.
# +-------------------------------------------------------------------
# | Author... | WZQ1397/automatic-repo | python/FileSystem/BTpanel/btclass/panelMysql.py | Python | lgpl-3.0 | 3,122 |
"""Support for Reddit."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (CONF_USERNAME, CONF_PASSWORD, CONF_MAXIMUM)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.enti... | MartinHjelmare/home-assistant | homeassistant/components/reddit/sensor.py | Python | apache-2.0 | 4,105 |
from test_support import *
prove_all()
gnatprove(opt=["-P", "test.gpr", "--clean"])
prove_all()
| ptroja/spark2014 | testsuite/gnatprove/tests/N730-015__clean/test.py | Python | gpl-3.0 | 96 |
from django.db import connection
from django.utils.log import getLogger
logger = getLogger(__name__)
IDENT = b'<!-- queries -->'
class QueryCountDebugMiddleware(object):
"""
This middleware will log the number of queries run
and the total time taken for each request (with a
status code of 200). It d... | Mause/pyalp | pyalp/common/middleware/query_count.py | Python | mit | 2,817 |
'''
* Copyright (C) 2015 Francisco Javier <https://mx.linkedin.com/in/fcojavierpena>
*
* 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... | FranciscoJavierPRamos/AndroidAppTranslate | Export.py | Python | apache-2.0 | 2,381 |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sjperkins/tensorflow | tensorflow/tensorboard/backend/event_processing/plugin_asset_util.py | Python | apache-2.0 | 3,278 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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) an... | Xowap/ansible | lib/ansible/constants.py | Python | gpl-3.0 | 16,541 |
from setuptools import setup
setup(
name='snappass',
version='1.5.0',
description="It's like SnapChat... for Passwords.",
long_description=(open('README.rst').read() + '\n\n' +
open('AUTHORS.rst').read()),
url='http://github.com/Pinterest/snappass/',
install_requires=['Fla... | samteezy/snappass-heroku | setup.py | Python | mit | 1,409 |
"""Deprecated; use Graph."""
from rdflib.Graph import Graph
from rdflib.store.Memory import Memory
class TripleStore(Graph):
"""
Depcrecated. Use Graph instead.
"""
def __init__(self, location=None, backend=None):
if backend==None:
backend = Memory()
super(TripleStore, se... | rwl/openpowersystem | rdflib/TripleStore.py | Python | agpl-3.0 | 491 |
import django
if django.VERSION < (2, 0):
from django.conf.urls import url, include
else:
from django.urls import re_path as url, include
from django.conf import settings
urlpatterns = []
if 'admin_tools.menu' in settings.INSTALLED_APPS:
urlpatterns.append(url(r'^menu/', include('admin_tools.menu.urls')))... | django-admin-tools/django-admin-tools | admin_tools/urls.py | Python | mit | 473 |
# -*- coding: utf-8 -*-
#
import uuid
import time
from django.core.cache import cache
from django.conf import settings
from django.utils.translation import ugettext as _
from django.utils.six import text_type
from django.contrib.auth import get_user_model
from rest_framework import HTTP_HEADER_ENCODING
from rest_fram... | sdgdsffdsfff/jumpserver | apps/authentication/backends/api.py | Python | gpl-2.0 | 7,226 |
from urllib.parse import parse_qs
from ws4py.websocket import WebSocket
from channelstream import utils
from channelstream.server_state import get_state
class ChatApplicationSocket(WebSocket):
def __init__(self, *args, **kwargs):
super(ChatApplicationSocket, self).__init__(*args, **kwargs)
self.q... | AppEnlight/channelstream | channelstream/ws_app.py | Python | bsd-3-clause | 1,621 |
from django import template
import re
register = template.Library()
@register.filter
def phone(string):
return re.sub(r'[^\+\w\d]', '', string) | maikelvl/django-boilerplate | src/main/templatetags/phone.py | Python | mit | 149 |
#*******************************************************************************
# Copyright (C) 2013-2014 Kenneth L. Ho
#
# 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 ... | klho/hypoct | examples/hypoct_driver.py | Python | gpl-3.0 | 3,364 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.