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/env python3
import os
import docutils
import gzip
import docutils.core
import docutils.writers.manpage
from distutils.cmd import Command
from distutils.core import setup
from distutils.command.build import build
from subprocess import Popen, PIPE
class build_manpage(Command):
description = 'Generate... | ckafi/recur | setup.py | Python | mpl-2.0 | 1,794 |
# Copyright (c) 2011 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | espadrine/opera | chromium/src/third_party/WebKit/Tools/Scripts/webkitpy/common/config/contributionareas.py | Python | bsd-3-clause | 8,571 |
# -*- coding: utf-8 -*-
"""This module tests various ways how to set up the provisioning using the provisioning dialog."""
import re
from datetime import datetime, timedelta
import fauxfactory
import pytest
from cfme import test_requirements
from cfme.common.provider import cleanup_vm
from cfme.infrastructure.virtual_... | rlbabyuk/integration_tests | cfme/tests/infrastructure/test_provisioning_dialog.py | Python | gpl-2.0 | 10,935 |
# Adapted from
# https://github.com/CODAIT/text-extensions-for-pandas/blob/dc03278689fe1c5f131573658ae19815ba25f33e/text_extensions_for_pandas/array/tensor.py
# and
# https://github.com/CODAIT/text-extensions-for-pandas/blob/dc03278689fe1c5f131573658ae19815ba25f33e/text_extensions_for_pandas/array/arrow_conversion.py
... | ray-project/ray | python/ray/data/extensions/tensor_extension.py | Python | apache-2.0 | 49,546 |
import glob
import os
import shutil
import time
from pyrannosaurus.clients.metadata import MetadataClient
from pyrannosaurus.utils import zip
from app import utils
def build(filename):
client = MetadataClient()
u, p, ip = utils.retrieve_credentials()
ip = True if ip == 'True' else False
client.login(... | kcshafer/slinky | app/deploy.py | Python | gpl-2.0 | 1,919 |
# -*- coding: utf-8 -*-
'''
The static grains, these are the core, or built in grains.
When grains are loaded they are not loaded in the same way that modules are
loaded, grain functions are detected and executed, the functions MUST
return a dict which will be applied to the main grains dict. This module
will always b... | victorywang80/Maintenance | saltstack/src/salt/grains/core.py | Python | apache-2.0 | 47,280 |
"""
Django settings for snippod boilerplate project.
This is a base starter for snippod.
For more information on this file, see
https://github.com/shalomeir/snippod-boilerplate
"""
from snippod_boilerplate.settings.common import *
# from snippod_boilerplate.settings.config_dev import *
# SECURITY WARNING: keep the... | shalomeir/snippod-boilerplate | snippod_boilerplate/settings/dev.py | Python | mit | 1,919 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.23 on 2019-10-01 07:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cornerstone', '0005_auto_20190925_0730'),
]
operations = [
migrations.AddField(
model_name='cornersto... | edx/edx-enterprise | integrated_channels/cornerstone/migrations/0006_auto_20191001_0742.py | Python | agpl-3.0 | 824 |
# Copyright (C) 2014, Hitachi, Ltd.
#
# 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... | saeki-masaki/cinder | cinder/volume/drivers/hitachi/hbsd_snm2.py | Python | apache-2.0 | 43,687 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.common import Backend
from lib.core.data import conf
from lib.core.data import logger
from lib.core.dicts import DBMS_DICT
from lib.core.enums import DBMS
from l... | V11/volcano | server/sqlmap/lib/controller/handler.py | Python | mit | 4,354 |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 2 10:14:16 2019
@author: cwhanse
"""
import numpy as np
import pandas as pd
import pytest
from pandas.util.testing import assert_series_equal
from numpy.testing import assert_allclose
from pvlib import iam as _iam
from conftest import needs_numpy_1_10, requires_scipy
... | anomam/pvlib-python | pvlib/tests/test_iam.py | Python | bsd-3-clause | 6,661 |
#!/usr/bin/python
import subprocess
import sys
sys.path.append('/usr/local/munki')
from munkilib import FoundationPlist
import os
import platform
def get_status(cmd, checkstring):
status = 'Disabled'
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProce... | erikng/sal | server/plugins/encryption/scripts/encryption.py | Python | apache-2.0 | 1,192 |
#!/usr/bin/env python
import unittest
import offer
class OfferTestCase(unittest.TestCase):
def setUp(self):
self.o1 = offer.Offer(501, 101, [3], 1.0, 'all')
self.o2 = offer.Offer(501, 101, [3], 0.555, 'all')
self.o3 = offer.Offer(501, 101, [0], 0.1, 'all')
self.o4 = offer.Offer(501, 101, [247], 1.0,... | compbrain/Athena-SCG-Bot | src/offer_test.py | Python | bsd-3-clause | 2,383 |
# -*- coding: utf-8 -*-
from openerp import models, fields
# from openerp.exceptions import UserError
class AccountConfigSettings(models.TransientModel):
_inherit = 'account.config.settings'
# TODO ver si queremosimplementar esto o no
# _afip_ws_selection = (
# lambda self, *args, **kwargs: self.... | jobiols/odoo-argentina | l10n_ar_afipws_fe/res_config.py | Python | agpl-3.0 | 899 |
#!/usr/bin/env python
from LingwoNLP.document import parseString
from LingwoNLP.remote import ServerInterface
# Quick helper class to prevent us from connecting when its not necessary
class Connector(object):
def __init__(self):
self.remote = None
def get(self):
if self.remote is None:
... | dsnopek/lingwo-old | nlp/annotate.py | Python | gpl-2.0 | 3,493 |
from test import *
class RoutingTest(BerryTest):
def test_route_get(self):
self.getPage('/')
self.assertBody("index")
def test_route_get_with_url_params(self):
self.getPage('/hello/world')
self.assertBody("Hello, world!")
def test_route_post(self):
self.getPage('/post', method='POST'... | adeel/berry | tests/routing_test.py | Python | mit | 595 |
from sys import path
import modules
import modules.common
from os.path import abspath, dirname
import threading
import time
path.append(dirname(abspath(__file__)))
def get_version():
return "0.1.0-experimental"
def get_loaded_modules():
l = []
for m in modules.common.Modules.list:
l.append(m.ge... | bwall/BAMF | bamfbrute/__init__.py | Python | mit | 1,759 |
"""Support for Ebusd daemon for communication with eBUS heating systems."""
import logging
import socket
import ebusdpy
import voluptuous as vol
from homeassistant.const import (
CONF_HOST,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
CONF_PORT,
)
import homeassistant.helpers.config_validation as cv
from hom... | jawilson/home-assistant | homeassistant/components/ebusd/__init__.py | Python | apache-2.0 | 3,733 |
# -*- coding: utf-8 -*-
"""
Common structures and functions used by other scripts.
"""
from xml.etree import cElementTree as ET
str_to_entailment = {'none': 0,
'entailment': 1,
'paraphrase': 2}
entailment_to_str = {v: k for k, v in str_to_entailment.items()}
class Pair(obj... | nathanshartmann/portuguese_word_embeddings | sentence_similarity/utils/commons.py | Python | gpl-3.0 | 2,224 |
import unittest
import os
import cv2
import scanner
from scanner import getVotesFromImage
class TestSlamVotes(unittest.TestCase):
def setUp(self):
self.longMessage = True
pass
def check_all_images(self, directory):
for filename in os.listdir(directory):
if filename.end... | david-schuler/slam_votes | slam_votes/test_slam_votes.py | Python | gpl-3.0 | 2,364 |
import base64
import binascii
import io
import tempfile
import flask
import google.cloud.storage as gcloud_storage
import google.cloud.exceptions as gcloud_exceptions
from werkzeug.contrib.cache import FileSystemCache
from .. import config, model, util
from .blueprint import coordinator_api
# Cache the worker blo... | lanyudhy/Halite-II | apiserver/apiserver/coordinator/storage.py | Python | mit | 4,017 |
"""Unit tests for the io module."""
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnew... | ktan2020/legacy-automation | win/Lib/test/test_io.py | Python | mit | 105,230 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json
import frappe.permissions
import frappe.async
from frappe import _
from frappe.utils.csvutils import getlink
from frappe.utils.dateutils import parse_date
... | reachalpineswift/frappe-bench | frappe/core/page/data_import_tool/importer.py | Python | mit | 8,135 |
# coding: utf-8
class PropertyDict(dict):
def __getattr__(self, name):
if name.startswith("_") and not name == '_id':
return dict.__getattr__(self, name)
return self[name]
class Property(object):
def __init__(self, type=None, doc=None, default=None):
... | victorpantoja/scraper | scraper/repository/mongodb/orm.py | Python | mit | 2,030 |
""" Functions for estimating the quality of spike sorting results. These
functions estimate false positive and false negative fractions.
"""
from __future__ import division
import scipy as sp
from scipy.spatial.distance import cdist
import quantities as pq
import neo
from progress_indicator import ProgressIndicator
... | rproepp/spykeutils | spykeutils/sorting_quality_assesment.py | Python | bsd-3-clause | 16,506 |
#!/usr/bin/env python3
# pylint: disable=C0302
"""
Test the Lambda handler.
"""
# pylint: disable=C0103,C0111,R0904
from base64 import b32encode
from http.server import BaseHTTPRequestHandler, HTTPServer
from json import dumps as json_dumps, loads as json_loads
from logging import getLogger
from os import environ, uran... | dacut/rolemaker | tests/test_handler.py | Python | apache-2.0 | 45,942 |
"""Home Assistant auth provider."""
from __future__ import annotations
import asyncio
import base64
from collections.abc import Mapping
import logging
from typing import Any, cast
import bcrypt
import voluptuous as vol
from homeassistant.const import CONF_ID
from homeassistant.core import HomeAssistant, callback
fro... | aronsky/home-assistant | homeassistant/auth/providers/homeassistant.py | Python | apache-2.0 | 11,050 |
# Copyright 2014 Josh Pieper, [email protected].
#
# 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... | Syralist/yet-another-hexapod | hexapy/legtool/ik/gait/leg_ik.py | Python | mit | 7,942 |
from __future__ import absolute_import
from django.test import TestCase
from .models import Reporter, Article
class ManyToOneNullTests(TestCase):
def setUp(self):
# Create a Reporter.
self.r = Reporter(name='John Smith')
self.r.save()
# Create an Article.
self.a = Article... | openhatch/new-mini-tasks | vendor/packages/Django/tests/modeltests/many_to_one_null/tests.py | Python | apache-2.0 | 4,478 |
__author__ = "Hannes Hoettinger"
import numpy as np
import cv2
import time
import cv2.cv as cv
import math
import pickle
img = cv2.imread("D:\Projekte\PycharmProjects\DartsScorer\Darts\Dartboard_2.png")
img2 = cv2.imread("D:\Projekte\PycharmProjects\DartsScorer\Darts\Dartboard_3.png")
vidcap = cv2.VideoCapture("C:\U... | hanneshoettinger/opencv-steel-darts | GetDart.py | Python | gpl-3.0 | 16,538 |
from rest_framework.request import Request
from django.utils.functional import SimpleLazyObject
from django.contrib.auth.middleware import get_user
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
def get_user_jwt(request):
try:
user_jwt = JSONWebTokenAuthentication().authenticate... | verdverm/starterKit | be/django/app/middleware.py | Python | mit | 1,208 |
###############################################################################
#
# ChartLine - A class for writing the Excel XLSX Line charts.
#
# Copyright 2013-2014, John McNamara, [email protected]
#
from . import chart
class ChartLine(chart.Chart):
"""
A class for writing the Excel XLSX Line charts.
... | gcca/plaft | backend/infraestructure/xlsxwriter/chart_line.py | Python | gpl-2.0 | 2,735 |
"""NDG XACML ElementTree based Subject Element reader
NERC DataGrid
"""
__author__ = "P J Kershaw"
__date__ = "16/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "[email protected]"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Ke... | cedadev/ndg_xacml | ndg/xacml/parsers/etree/subjectreader.py | Python | bsd-3-clause | 673 |
# -*- coding: utf-8 -*-
from rest_framework.viewsets import ModelViewSet
from .models import (
UnitNestedRouterMixinUserModel as UserModel,
UnitNestedRouterMixinGroupModel as GroupModel,
UnitNestedRouterMixinPermissionModel as PermissionModel,
)
class UserViewSet(ModelViewSet):
model = UserModel
cl... | lock8/drf-extensions | tests_app/tests/unit/routers/nested_router_mixin/views.py | Python | mit | 445 |
from blob import uploadBlob
def uploadImage(username, blob, filename, token, secret, tags):
rtnBlobList = uploadBlob(username, blob, filename, token, secret)
if len(rtnBlobList) == 1:
return rtnBlobList[0]
return 'success'
def main():
print(uploadImage('fred', 'fun', 'filename','4800385332... | rjhunter8285/nsc-cloudproject-s22016 | prototype/api/verify_oauth & blob/uploadImage.py | Python | apache-2.0 | 426 |
"""
Classes holding information on global DOFs and mapping of all DOFs -
equations (active DOFs).
Helper functions for the equation mapping.
"""
from sfepy.base.base import *
from sfepy.base.compat import unique
from sfepy.fem.utils import compute_nodal_normals
from sfepy.fem.functions import Function
from sfepy.fem.c... | olivierverdier/sfepy | sfepy/fem/dof_info.py | Python | bsd-3-clause | 23,999 |
# -*- coding: utf-8 -*-
"""
Runs functions in pipeline to get query reuslts and does some caching.
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import ubelt as ub
import utool as ut
from os.path import exists
from ibeis.algo.hots import chip_match
from ibeis.algo.hots import pi... | Erotemic/ibeis | ibeis/algo/hots/match_chips4.py | Python | apache-2.0 | 14,348 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | Sorsly/subtle | google-cloud-sdk/lib/googlecloudsdk/command_lib/compute/sole_tenancy/sole_tenancy_hosts/flags.py | Python | mit | 967 |
import config
import tensorflow as tf
import tensorflow.contrib.slim as slim
import numpy as np
FLAGS = tf.app.flags.FLAGS
class Model:
def __init__(self, inputs, is_training, keep_prob):
self.inputs = inputs
self.is_training = is_training
self.keep_prob = keep_prob
self.logits = ... | donfaq/cnn-rnn | network/model.py | Python | mit | 6,648 |
# MIT License
# Copyright (c) 2017 Tuxedo
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... | TuXiaokang/pyseeta | pyseeta/common.py | Python | mit | 1,657 |
#!/usr/bin/env python
"""moose_methods.py: Some helper function related with moose to do multiscale
modelling.
Last modified: Thu Jun 05, 2014 01:20AM
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2013, NCBS Bangalore"
__credits__ = ["NCBS Bangalore", "Bhalla Lab"]
__li... | dilawar/moose-full | moose-core/python/libmumbl/helper/moose_methods.py | Python | gpl-2.0 | 5,572 |
# Copyright 2014: Mirantis 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... | amit0701/rally | tests/unit/plugins/openstack/cleanup/test_resources.py | Python | apache-2.0 | 23,018 |
from .. channel_order import ChannelOrder
from . base import SPIBase
from ... colors import gamma
SPI_SPEED_ERROR = 'WS2801 requires an SPI speed of 1MHz but was set to {}MHz'
class WS2801(SPIBase):
"""Main driver for WS2801 based LED strips on devices like the
Raspberry Pi and BeagleBone
Provides the s... | rec/BiblioPixel | bibliopixel/drivers/SPI/WS2801.py | Python | mit | 643 |
#!/usr/bin/env python
import os
COV = None
if os.environ.get('FLASK_COVERAGE'):
import coverage
COV = coverage.coverage(branch=True, include='app/*')
COV.start()
from app import create_app, db
from app.models import User, Follow, Role, Permission, Post, Comment
from flask_script import Manager, Shell
from ... | itachigiotto/flasky | manage.py | Python | mit | 2,224 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import division
from tempfile import NamedTemporaryFile, mktemp
from subprocess import check_output, call
from utils import uopen
import os
import re
import codecs
def tercom(hypotheses, references):
"""
Computes the TER between hypotheses and ref... | eske/RLPE | tercom.py | Python | apache-2.0 | 3,977 |
# !/usr/bin/python
# -*- coding: utf-8 -*-
"""
< O que é o arquivo >
author: Cassiano Kunsch das Neves
last edited: <10/12/2015>
"""
class GravaArquivo(object):
@staticmethod
def startGravacao(diretorioArqDestino, lstDados, controlador):
BufferString = ''
qtnCasaDecimais = 8
arquivo ... | LEDS/Lab303 | Solução em Desenvolvimento/Conversor/Model/Gravador.py | Python | gpl-3.0 | 887 |
from nose.tools import eq_
from receipts.receipts import Receipt
from amo.tests import TestCase
from mkt.receipts.tests.test_verify import sample
from mkt.receipts.utils import reissue_receipt
class TestReissue(TestCase):
def test_expired(self):
old = Receipt(sample).receipt_decoded()
new = Rece... | jinankjain/zamboni | mkt/receipts/tests/test_utils_.py | Python | bsd-3-clause | 871 |
from typing import Dict
from CreatureRogue.data_layer.growth_rate import GrowthRate
from CreatureRogue.data_layer.species import Species
class XpLookup:
def __init__(self, xp_map: Dict[GrowthRate, Dict[int, int]]):
self.xp_map = xp_map
def level_at_xp(self, species: Species, xp: int) -> int:
... | DaveTCode/CreatureRogue | CreatureRogue/data_layer/xp_lookup.py | Python | mit | 961 |
### Taken from https://pypi.python.org/pypi/paho-mqtt
### Requires Paho-MQTT package, install by:
### pip install paho-mqtt
import paho.mqtt.client as mqtt
# Change accordingly to the MQTT Broker and topic you want to subscribe
# In the example it would be either "test.mosquitto.org" or "fd00::1" if
# running a mosqu... | miarcompanies/sdn-wise-contiki | contiki/examples/zolertia/tutorial/04-mqtt/mqtt-client.py | Python | bsd-3-clause | 1,050 |
import six
from pyquery import PyQuery as pq
from olympia.amo.tests import BaseTestCase
from olympia.bandwagon.models import Collection
from olympia.bandwagon.templatetags.jinja_helpers import user_collection_list
class TestHelpers(BaseTestCase):
def test_user_collection_list(self):
c1 = Collection(uuid... | aviarypl/mozilla-l10n-addons-server | src/olympia/bandwagon/tests/test_helpers.py | Python | bsd-3-clause | 1,066 |
#!/usr/bin/env python
#
# $Id: iotop.py 1236 2011-12-13 19:00:35Z g.rodola $
#
# Copyright (c) 2009, Jay Loden, Giampaolo Rodola'. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
A clone of iotop (http://guichaz.free.fr/iotop/) showing real... | wilebeast/FireFox-OS | B2G/gecko/python/psutil/examples/iotop.py | Python | apache-2.0 | 4,495 |
import demistomock as demisto # noqa: F401
from CommonServerPython import * # noqa: F401
import json
from datetime import datetime
def main() -> None:
integrationInstance = demisto.integrationInstance()
demisto.debug(f'Command being called is {demisto.command()}')
try:
if demisto.command() == '... | demisto/content | Packs/JSONSampleIncidentGenerator/Integrations/JSONSampleIncidentGenerator/JSONSampleIncidentGenerator.py | Python | mit | 2,058 |
# Copyright 2016 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.
"""Pure Python implementation of the Mann-Whitney U test.
This code is adapted from SciPy:
https://github.com/scipy/scipy/blob/master/scipy/stats/stats.py... | benschmaus/catapult | dashboard/dashboard/pinpoint/mann_whitney_u.py | Python | bsd-3-clause | 2,628 |
# -*- coding: 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):
# Deleting model 'ProjectCountByMinute'
db.delete_table(u'sentry_projectcountbyminute')
# Deleting m... | looker/sentry | src/sentry/south_migrations/0115_auto__del_projectcountbyminute__del_unique_projectcountbyminute_projec.py | Python | bsd-3-clause | 36,065 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-15 10:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='userMa... | Necromoshka/orderHistory | journal/userMain/migrations/0001_initial.py | Python | mit | 660 |
import shutil
import os
for entity in os.listdir("js"):
path = os.path.abspath( os.path.join("js", entity) )
if os.path.isdir(path):
shutil.rmtree( path )
elif os.path.isfile(path):
os.remove(path)
print "Cleaned JS output directory" | Adam01/Cylinder | clean_js.py | Python | mit | 263 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Imports values from task 13 to test equality.
.. hint::
You can access task_12 data in the following example type:
.. code:: python
print task_12.FLOATVAL
"""
import task_12
FRAC_DEC_EQUAL = (task_12.DECVAL == task_12.FRACVAL)
DEC_FLOAT_INEQ... | rrafiringa/is210-week-03-warmup | task_13.py | Python | mpl-2.0 | 413 |
# Copyright © 2020, Joseph Berry, Rico Tabor ([email protected])
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... | ricotabor/opendrop | opendrop/app/common/image_acquisition/configurator/__init__.py | Python | gpl-2.0 | 1,447 |
"""
App wide event registry
Everything in the application is communicated via pubsub. These are the events
that tie everything together.
"""
import wx # type: ignore
WINDOW_STOP = wx.Window.NewControlId()
WINDOW_CANCEL = wx.Window.NewControlId()
WINDOW_CLOSE = wx.Window.NewControlId()
WINDOW_ST... | chriskiehl/Gooey | gooey/gui/events.py | Python | mit | 840 |
# -*- coding: utf-8 -*-
"""
Miscellaneous utility code for VAR estimation
"""
from statsmodels.compat.pandas import frequencies
from statsmodels.compat.python import asbytes
import numpy as np
import pandas as pd
import scipy.linalg.decomp as decomp
import scipy.stats as stats
import statsmodels.tsa.tsatools as tsa
... | jseabold/statsmodels | statsmodels/tsa/vector_ar/util.py | Python | bsd-3-clause | 9,611 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 5 08:58:46 2015
@author: msutton1
"""
import pandas as pd
import random as rd
namesList = pd.read_excel('SecretSanta.xlsx', sheetname = 'list')
i=0
usedlist = []
length = len(namesList.index)
while (i<length):
rand = rd.randint(0,length-1)... | MarshallSutton/Secret-Santa | SecretSanta.py | Python | cc0-1.0 | 568 |
import math
T = int(raw_input())
for i in range(T):
N = int(raw_input())
print int(math.sqrt(N))
| rohit91/codechef | codechef/FSQRT.py | Python | gpl-2.0 | 107 |
from pyramid.response import *
| ztane/tet | tet/response.py | Python | bsd-3-clause | 32 |
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <[email protected]> 2007
#
# 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) a... | kernevil/samba | python/samba/tests/credentials.py | Python | gpl-3.0 | 22,660 |
# Copyright 2013 Huawei Technologies Co.,LTD.
# 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
#
# Unl... | paboldin/rally | rally/plugins/openstack/scenarios/cinder/volumes.py | Python | apache-2.0 | 24,768 |
# TODO: Consider rewriting as management command
import logging
import sys
import django
from django.db import transaction
django.setup()
from osf.models import Registration
from scripts import utils as script_utils
from website import settings
from website.app import init_app
from api.share.utils import update_share
... | mfraezz/osf.io | scripts/migration/migrate_share_registration_data.py | Python | apache-2.0 | 1,325 |
# -*- coding: utf-8 -*-
# Copyright (C) 2014 Yahoo! 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... | junneyang/taskflow | taskflow/tests/unit/worker_based/test_pipeline.py | Python | apache-2.0 | 3,812 |
# 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 agreed to in writing, s... | googleapis/python-documentai | samples/snippets/process_document_splitter_sample.py | Python | apache-2.0 | 3,497 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-18 00:44
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import inventory.common.model_mi... | cnobile2012/inventory | inventory/accounts/migrations/0001_initial.py | Python | mit | 9,769 |
# Copyright 2010-2011 OpenStack Foundation
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licens... | JioCloud/oslo.db | tests/base.py | Python | apache-2.0 | 1,951 |
# This file contains custom hooks for wpull with the following functionality:
# - a domain whitelist
# - a regex-based URL blacklist
# - completion notification
import os
import re
WHITELIST_LOCATION = os.environ.get('WHITELIST', '/data/whitelist.txt')
BLACKLIST_LOCATION = os.environ.get('BLACKLIST', '/data/blacklist... | nmalkin/crawl | hook.py | Python | bsd-2-clause | 2,440 |
import cmsisdsp as dsp
import numpy as np
from scipy import signal
from pylab import figure, clf, plot, xlabel, ylabel, xlim, ylim, title, grid, axes, show,semilogx, semilogy
# Data file from https://archive.physionet.org/pn3/ecgiddb/Person_87/rec_2.dat
def q31sat(x):
if x > 0x7FFFFFFF:
return(np.int32(... | ARM-software/CMSIS_5 | CMSIS/DSP/PythonWrapper/examples/example.py | Python | apache-2.0 | 1,943 |
""" This module contain solvers for all kinds of equations:
- algebraic, use solve()
- recurrence, use rsolve()
- differential, use dsolve()
- transcendental, use tsolve()
- nonlinear (numerically), use nsolve()
(you will need a good starting point)
"""
from sympy.core.sympify import s... | jbaayen/sympy | sympy/solvers/solvers.py | Python | bsd-3-clause | 26,616 |
import numpy as np
import scipy.sparse as sp
from numpy.testing import assert_array_equal
import nose
from nose.tools import assert_raises, raises
from sklearn.utils.testing import assert_greater
from sklearn.linear_model import logistic
from sklearn import datasets
X = [[-1, 0], [0, 1], [1, 1]]
X_sp = sp.csr_matri... | sgenoud/scikit-learn | sklearn/linear_model/tests/test_logistic.py | Python | bsd-3-clause | 3,312 |
from PyQt4 import QtGui, QtCore
from shapely.geometry import Point
from shapely import affinity
from math import sqrt
import FlatCAMApp
from GUIElements import *
from FlatCAMObj import FlatCAMGerber, FlatCAMExcellon
class FlatCAMTool(QtGui.QWidget):
toolName = "FlatCAM Generic Tool"
def __init__(self, app,... | silasb/flatcam | FlatCAMTool.py | Python | mit | 8,497 |
import os
import time
import threading
import warnings
from django.conf import settings
from django.db import connections
from django.dispatch import receiver, Signal
from django.utils import timezone
from django.utils.functional import empty
template_rendered = Signal(providing_args=["template", "context"])
setting... | Beeblio/django | django/test/signals.py | Python | bsd-3-clause | 4,210 |
# Copyright 2017-present Open Networking Foundation
#
# 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... | opencord/xos | lib/xos-api/xosapi/xos_grpc_client.py | Python | apache-2.0 | 12,268 |
# -*- coding: utf-8 -*-
#
# This file is part of EUDAT B2Share.
# Copyright (C) 2016 CERN.
#
# B2Share 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... | emanueldima/b2share | b2share/modules/files/__init__.py | Python | gpl-2.0 | 908 |
from django.conf.urls import url,include
from django.contrib import admin
urlpatterns = [
url(r'',include('Register_and_login.urls')),
url(r'^homepage/',include('MainPage.urls')),
url(r'^username/cart/',include('cart.urls')),
url(r'^username/',include('customer.urls')),
url(r'^pharmacy_name/',inclu... | mpiplani/Online-Pharmacy | online_pharmacy/online_pharmacy/online_pharmacy/urls.py | Python | apache-2.0 | 542 |
#!/usr/bin/env python
# pylint: disable=missing-docstring
# flake8: noqa: T001
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ ... | zhiwliu/openshift-ansible | roles/lib_openshift/library/oc_adm_router.py | Python | apache-2.0 | 109,527 |
# Copyright 2014 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 requi... | jcsp/manila | manila/network/neutron/constants.py | Python | apache-2.0 | 705 |
# 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 Subversion(AutotoolsPackage):
"""Apache Subversion - an open source version control system... | LLNL/spack | var/spack/repos/builtin/packages/subversion/package.py | Python | lgpl-2.1 | 4,334 |
from django import forms
from account.forms import SettingsForm as AccountSettingsForm
from .models import ADOPTION_LEVEL_CHOICES
ADOPTION_LEVEL_HELP_TEXT = """
<b>Adoption level</b> determines when a new survey or game will be made available to you.
<small>
If you want access as soon as it’s launched, select... | jtauber/learning-greek | learning_greek/forms.py | Python | mit | 709 |
import threading
from coiot.device_action_list import DeviceActionList, DALDevice
from ble.device import CompositeBleDevice, drivers as ble_drivers
from gi.repository import GLib
from . import db_interface
import logging
import time
log = logging.getLogger('BLE')
db_interface.BLEDriverParameters.register()
class B... | coiot-ble/coiotd | ble/driver.py | Python | apache-2.0 | 2,852 |
# -*- coding: utf-8 -*-
"""Extension management."""
from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url
from django.utils.encoding import smart_str
class ModoExtension(object):
"""
Base extension class.
Each Modoboa extension must inherit ... | tonioo/modoboa | modoboa/core/extensions.py | Python | isc | 4,212 |
# Copyright 2019 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, ... | google-research/mixmatch | privacy/pr_mixmatch.py | Python | apache-2.0 | 2,175 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Search Architecture:
- Have a list of accounts
- Create an "overseer" thread
- Search Overseer:
- Tracks incoming new location values
- Tracks "paused state"
- During pause or new location will clears current search queue
- Starts search_worker threads
- Se... | xrobau/PoGoMap | pogom/search.py | Python | agpl-3.0 | 36,713 |
import json
from datetime import timedelta, datetime
from django.db import connection
from django.db.models.aggregates import Count
from django.contrib import messages
from django.utils.timezone import now
from django.views.generic import TemplateView
from django.template.defaultfilters import date as format_date
from... | ahharu/plugin-manager | plugin_manager/core/views.py | Python | mit | 713 |
import numpy as np
atom_dtype = np.dtype([("position","float32", 3),
("color","float32", 3),
("radius", "float32")])
radii = {
"C" : 1.70,
"O" : 1.52,
"N" : 1.55,
"H" : 1.20,
"P" : 1.80,
"S" : 1.80,
}
colors = {
"C" : [0.2, 1.0, 0.2],
"O" : [1... | sjdv1982/seamless | docs/archive/0.2-cleanup/3D/cell-load-pdb.py | Python | mit | 1,407 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010 Romain Bignon
#
# 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, version 3 of the License.
#
# This program is distributed in the hope that it will b... | jocelynj/weboob | weboob/applications/qhavesex/status.py | Python | gpl-3.0 | 4,376 |
# sqlalchemy/interfaces.py
# Copyright (C) 2007-2013 the SQLAlchemy authors and contributors <see AUTHORS file>
# Copyright (C) 2007 Jason Kirtland [email protected]
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Deprecated core ev... | Drvanon/Game | venv/lib/python3.3/site-packages/sqlalchemy/interfaces.py | Python | apache-2.0 | 10,918 |
#!/usr/bin/env python
"""git_utils.py - Wrappers and utilities for interacting with Git
"""
from __future__ import absolute_import
from subprocess import Popen, STDOUT, PIPE, CalledProcessError
from collections import namedtuple
from functools import partial
from hashlib import sha1
from six.moves import filter
from s... | oVirt/jenkins | stdci_libs/git_utils.py | Python | gpl-3.0 | 10,074 |
trna5 = 'GGCGCGTTAACAAAGCGGTTATGTAGCGGATT'
trna3 = 'AATCCGTCTAGTCCGGTTCGACTCCGGAACGCGCCTCCA'
trnaAC_R = 'tcg'
trnaAC_D = 'gtc'
flank5 = 'cccctctaga'
flank3 = 'tgggaaagataag'
mut_trna5 = trna5.replace('G','(02029402)').replace('C','(02940202)').replace('T','(02020294)').replace('A','(94020202)')
mut_trna3 = trna3.repla... | jgcwell/python_jenna | Cys tRNA sequence mutagenizer.py | Python | mit | 566 |
# Unit tests for Spanish verb conjugation
import unittest
import languages.spanish as Spanish
from functools import partial
class TestSpanishConjugator(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.test_verbs = ['hablar', 'vender', 'vivir']
def test_present(self):
expected = ... | wmealem/VerbTrainer | tests/test_spanish_conjugator.py | Python | mit | 4,633 |
import datetime
import logging
from django.conf import settings
from django.apps import apps
from django.db import models, connections
from django.dispatch import receiver
from django.db.models.signals import post_save
from google.appengine.api import datastore
from google.appengine.ext import deferred
from djangae.... | Ali-aqrabawi/ezclinic | lib/djangae/contrib/uniquetool/models.py | Python | mit | 9,821 |
#!/usr/bin/python
#
# (c) 2017 Apstra Inc, <[email protected]>
#
# 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 opt... | Jorge-Rodriguez/ansible | lib/ansible/modules/network/aos/_aos_blueprint_virtnet.py | Python | gpl-3.0 | 7,661 |
import base64
from collections import Counter
from datetime import datetime, timedelta
import logging
import re
import urllib.parse
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import ArrayField, JSONField... | zentralopensource/zentral | zentral/contrib/inventory/models.py | Python | apache-2.0 | 67,736 |
# -*- coding: utf-8 -*-
#
# Release Notes build configuration file, created by
# sphinx-quickstart on Thu Feb 12 02:10:34 2009.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickleable (mod... | Khan/reviewboard | docs/releasenotes/conf.py | Python | mit | 6,554 |
import math
import re
import numpy as np
import pytest
import tensorflow as tf
from tensorflow_similarity.retrieval_metrics import BNDCG
@pytest.fixture
def test_data():
return {
"query_labels": tf.constant([1, 1, 1, 0]),
"lookup_distances": tf.constant(
[
[0.0, 0.1, ... | tensorflow/similarity | tests/retrieval_metrics/test_bndcg.py | Python | apache-2.0 | 2,836 |
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"
shipment_advice_outgoing_backorder_policy = fields.Selection(
related="company_id.shipment_ad... | OCA/stock-logistics-transport | shipment_advice/models/res_config_settings.py | Python | agpl-3.0 | 374 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.