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 |
|---|---|---|---|---|---|
# Copyright 2014 Intel Corp.
#
# 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,... | pkilambi/ceilometer | ceilometer/tests/ipmi/pollsters/test_node.py | Python | apache-2.0 | 4,896 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, The Linux Foundation. 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 th... | htc-msm8960/android_kernel_htc_msm8930 | scripts/gcc-wrapper.py | Python | gpl-2.0 | 3,965 |
import math
import itertools
def prime_list(lower, upper):
primes = []
for n in range(lower, upper, 2):
p = True
for d in range(3, int(math.sqrt(n)) + 1):
if n % d == 0:
p = False
break
if p:
primes.append(n)
return primes
d... | AustinHartman/randomPrograms | euler35.py | Python | gpl-3.0 | 1,355 |
import six
from pyrsistent._checked_types import CheckedType, _restore_pickle, InvariantException, store_invariants
from pyrsistent._field_common import (
set_fields, check_type, PFIELD_NO_INITIAL, serialize, check_global_invariants)
from pyrsistent._pmap import PMap, pmap
class _PRecordMeta(type):
def __new_... | Futrell/pyrsistent | pyrsistent/_precord.py | Python | mit | 5,764 |
import pickle
import unittest
from test import test_support as support
turtle = support.import_module('turtle')
Vec2D = turtle.Vec2D
test_config = """\
width = 0.75
height = 0.8
canvwidth = 500
canvheight = 200
leftright = 100
topbottom = 100
mode = world
colormode = 255
delay = 100
undobuffersize = 10000
shape = cir... | HiSPARC/station-software | user/python/Lib/test/test_turtle.py | Python | gpl-3.0 | 12,577 |
# -*- encoding: utf-8 -*-
# region gplv3preamble
# The Medical Simulation Markup Language (MSML) - Simplifying the biomechanical modeling workflow
#
# MSML has been developed in the framework of 'SFB TRR 125 Cognition-Guided Surgery'
#
# If you use this software in academic work, please cite the paper:
# S. Suwelack, M... | CognitionGuidedSurgery/msml | src/msml/exporter/hiflow3/__init__.py | Python | gpl-3.0 | 13,923 |
# Copyright (C) 2014 Peter Feiner
import sys
def safe_import(name):
if 'eventlet' in sys.modules:
import eventlet.patcher
return eventlet.patcher.original(name)
else:
return __import__(name)
fcntl = safe_import('fcntl')
os = safe_import('os')
select = safe_import('select')
threading ... | peterfeiner/wcp | wcp/record_impl.py | Python | gpl-2.0 | 7,068 |
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | fabian4/trove | trove/tests/unittests/backup/test_backup_models.py | Python | apache-2.0 | 20,319 |
"""Helpers for listening to events."""
import functools as ft
from datetime import timedelta
from ..const import (
ATTR_NOW, EVENT_STATE_CHANGED, EVENT_TIME_CHANGED, MATCH_ALL)
from ..util import dt as dt_util
def track_state_change(hass, entity_ids, action, from_state=None,
to_state=None)... | justyns/home-assistant | homeassistant/helpers/event.py | Python | mit | 7,340 |
from __future__ import absolute_import
from icons.literals import FIND, FIND_ADD, FIND_ARROW_LEFT
from icons import Icon
icon_search = Icon(FIND)
icon_advanced_search = Icon(FIND_ADD)
icon_search_again = Icon(FIND_ARROW_LEFT)
| smendez/lean | paart/apps/dynamic_search/icons.py | Python | gpl-3.0 | 228 |
# 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) any later version.
#
# Ansible is distributed in the hope that ... | tsdmgz/ansible | lib/ansible/module_utils/facts/hardware/darwin.py | Python | gpl-3.0 | 3,527 |
#uses the blastn outfmt=1 output and organizes it in
#contig_name blast_result score evalue
import argparse
parser = argparse.ArgumentParser(description="blast output organization")
parser.add_argument("-in",dest="outputdoblast",required=True,help="Provide the blast output")
parser.add_argument("-out",des... | Nymeria8/SpeciesSplit | blastaaa1.py | Python | gpl-2.0 | 1,545 |
# -*- coding: utf-8 -*-
#
# pyvips documentation build configuration file, created by
# sphinx-quickstart on Wed Aug 9 15:19:17 2017.
#
# 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... | kleisauke/pyvips | doc/conf.py | Python | mit | 8,396 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import sys
import time
import requests
from bs4 import BeautifulSoup as bs
from sasila.system_normal.downloader.web_driver_pool import get_web_driver_pool
from sasila.system_normal.utils.cookie import formart_selenium_cookies
from sasila.system_normal.utils impo... | DarkSand/Sasila | sasila/system_instant/crawler/jd/request.py | Python | apache-2.0 | 4,578 |
# Copyright (c) 2013 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 ... | noironetworks/neutron | neutron/tests/unit/plugins/ml2/drivers/linuxbridge/mech_driver/test_mech_linuxbridge.py | Python | apache-2.0 | 2,987 |
def handler(db_conn, event):
return 'hello'
| Vishakha1990/Lambdas | testing/lambdas/hello.py | Python | apache-2.0 | 48 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import atexit
import argparse
import getpass
import sys
import textwrap
import time
from pyVim import connect
from pyVmomi import vim
import requests
requests.packages.urllib3.disable_warnings()
import ssl
try:
_create_unverified_https_context = ssl._create_unver... | kenelite/vmapi | 050getvmlist.py | Python | mit | 3,072 |
GREEN = '\033[92m'
BLUE = '\033[94m'
PINK = '\033[95m'
YELLOW = '\033[93m'
RED = '\033[91m'
ENDC = '\033[0m' | valferon/stageaobd2 | utils.py | Python | gpl-2.0 | 109 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lecture10.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that th... | CSUChico-CINS465/CINS465-Fall2016-Lecture-Examples | lecture10/lecture10/manage.py | Python | mit | 807 |
#pragma repy
def foo(ip,port,sockobj, ch,mainch):
stopcomm(mainch)
stopcomm(ch)
if callfunc == 'initialize':
waitforconn('127.0.0.1',<connport>,foo)
sleep(.1)
openconn('127.0.0.1',<connport>)
| sburnett/seattle | repy/tests/ut_repytests_teststopcomm2.py | Python | mit | 204 |
#!/usr/bin/python
'''
(C) 2010-2012 ICM UW. All rights reserved.
'''
import string;
import sys;
import re;
import collections;
import pickle
f_key = open(sys.argv[1],'r')
a_key = pickle.load(f_key)
f_key.close()
a_val = sys.argv[2].split('_')
in_path=sys.argv[3]
name_from = sys.argv[4];
name_to = sys.argv[5];
out_... | CeON/CoAnSys | document-classification/document-classification-logic/src/main/python/opts_chooser.py | Python | agpl-3.0 | 727 |
{
#LDFLAGS='-lm'
'repo_type' : 'svn',
'url' : 'svn://svn.code.sf.net/p/xavs/code/trunk',
'folder_name' : 'xavs_svn',
'configure_options' : '{autoconf_prefix_options} --cross-prefix={cross_prefix_bare}',
'run_post_install' : [
'rm -f NUL', # uh???
],
'packages' : {
'arch' : [ 'yasm' ],
},
'_info' : { 'vers... | DeadSix27/python_cross_compile_script | packages/dependencies/xavs.py | Python | mpl-2.0 | 369 |
import action
import entityeffect
class UnequipAction(action.Action):
"""
An Item with this component can be unequipped.
If an item is already in that
equipment slot that item will be unequipped first.
"""
def __init__(self):
super(UnequipAction, self).__init__()
self.componen... | co/TheLastRogue | equipactions.py | Python | bsd-2-clause | 1,584 |
# Copyright 2014 NEC Corporation. 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 ... | vedujoshi/os_tempest | tempest/api_schema/compute/v3/keypairs.py | Python | apache-2.0 | 1,333 |
from ..internal.Addon import Addon
class LinkFilter(Addon):
__name__ = "LinkFilter"
__type__ = "hook"
__version__ = "0.14"
__status__ = "testing"
__config__ = [("activated", "bool", "Activated", False),
("filter", "str", "Filter links containing (seperate by comma)", "ul.to,sha... | Velociraptor85/pyload | module/plugins/hooks/LinkFilter.py | Python | gpl-3.0 | 1,205 |
"""
This module implements an interface to the critic2 Bader analysis code.
For most Bader analysis purposes, users are referred to
pymatgen.command_line.bader_caller instead, this module is for advanced
usage requiring identification of critical points in the charge density.
This module depends on a compiled critic2... | vorwerkc/pymatgen | pymatgen/command_line/critic2_caller.py | Python | mit | 33,844 |
from docopt import docopt
import sys
#transforms wlp files into plaintext
def main(args):
RAW = 0
LEMMA = 1
POS = 2
in_files = args["<wlp_files>"]
column = LEMMA if args["--lemma"] else RAW
lower = args["--lower"]
for in_file in in_files:
txt = []
try:
with ... | hellrich/JeSemE | pipeline/preprocessing/coha_converter.py | Python | mit | 1,534 |
#
# Copyright (c) 2009-2021 Tom Keffer <tkeffer@gmail.com> and
# Matthew Wall
#
# See the file LICENSE.txt for your full rights.
#
"""Utilities for managing the config file"""
from __future__ import print_function
from __future__ import absolute_import
import sys
import configobj
imp... | weewx/weewx | bin/weecfg/config.py | Python | gpl-3.0 | 6,561 |
# coding: utf-8
from django.conf.urls import url, patterns
from rest_framework import routers
from parkkeeper import views
from rest_framework.urlpatterns import format_suffix_patterns
router = routers.DefaultRouter()
router.register('host', views.HostViewSet)
router.register('host_group', views.HostGroupViewSet)
rout... | telminov/django-park-keeper | parkkeeper/urls.py | Python | mit | 788 |
# -*- coding: utf-8; mode: python; -*-
"""
A package that implements offline messages for Django
Web Framework.
(C) 2011 oDesk www.oDesk.com w/revisions by Zapier.com
"""
from setuptools import setup, find_packages
setup(
name='fool-django-offline-messages',
version='0.3.9.dev0',
description='A package t... | themotleyfool/django-offline-messages | setup.py | Python | bsd-3-clause | 1,409 |
import sys
import os
import logging as log
import numpy as np
from ex.common import *
from ex.io.common import *
import ex.pp.mr as mr
import ex.array as ea
import sdss_info as sinfo
import base
class Mapper(mr.BaseMapper):
'''compact the data. input files should be grouped to reduce the
size of inmmediate r... | excelly/xpy-ml | sdss/uw_data/mr_compact_data.py | Python | apache-2.0 | 2,044 |
# -*- coding: utf-8 -*-
from health_mdg6 import *
| kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/modules/health_mdg6/__init__.py | Python | gpl-3.0 | 50 |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE.txt in the project root for
# license information.
# -------------------------------------------------------------------------
import unit... | Azure/azure-sdk-for-python | sdk/communication/azure-communication-chat/tests/_shared/test_communication_identifier_serializer.py | Python | mit | 5,721 |
# GENERATED FILE - DO NOT EDIT THIS FILE UNLESS YOU ARE A WIZZARD
#pylint: skip-file
from heat.engine import properties
from heat.engine import constraints
from heat.engine import attributes
from heat.common.i18n import _
from avi.heat.avi_resource import AviResource
from avi.heat.avi_resource import AviNestedResource... | avinetworks/avi-heat | avi/heat/resources/se_group.py | Python | apache-2.0 | 63,203 |
"""
Output Format Module
Secret: The format and structure of the output data.
Service: Outputs the results of the calculations, including the input parameters, the demand, the capacity,
the probability of breakage, and both safety requirements.
"""
def display_output(filename, q, j, q_hat_tol, pb, lr, nfl, is_safe1, is... | JacquesCarette/literate-scientific-software | Presentations/WG2_11/GlassBR_Code/original/outputFormat.py | Python | bsd-2-clause | 1,130 |
import numpy as np
def nan_rmse(A, B):
'''
Returns RMSE between two numpy arrays
'''
dat = (A - B) ** 2
mdat = np.ma.masked_array(dat, np.isnan(dat))
return np.sqrt(np.mean(mdat))
| jniznan/edami | edami/utils.py | Python | mit | 206 |
# encoding: utf-8
# module samba.dcerpc.dfs
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/dfs.so
# by generator 1.135
""" dfs DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class Info4(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signature unknown
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/dfs/Info4.py | Python | gpl-2.0 | 1,231 |
"""Unsupervised nearest neighbors learner"""
from .base import NeighborsBase
from .base import KNeighborsMixin
from .base import RadiusNeighborsMixin
from .base import UnsupervisedMixin
class NearestNeighbors(NeighborsBase, KNeighborsMixin,
RadiusNeighborsMixin, UnsupervisedMixin):
"""Unsu... | WangWenjun559/Weiss | summary/sumy/sklearn/neighbors/unsupervised.py | Python | apache-2.0 | 4,461 |
"""distutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution)."""
__revision__ = "$Id$"
import os
import string
import sys
from glob import glob
from warnings import warn
from distutils.core import Command
from distutils import dir_util, dep_util, file_util, archive... | martinbuc/missionplanner | packages/IronPython.StdLib.2.7.4/content/Lib/distutils/command/sdist.py | Python | gpl-3.0 | 18,344 |
"""Denon HEOS Media Player."""
from functools import reduce, wraps
import logging
from operator import ior
from typing import Sequence
from pyheos import HeosError, const as heos_const
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player.const import (
ATT... | tchellomello/home-assistant | homeassistant/components/heos/media_player.py | Python | apache-2.0 | 12,782 |
# xiaolongdolly 2017.8.20
numbers = [number for number in range(1, 10)]
for output_number in numbers:
print(output_number**3)
| xiaolongdolly/Python_Course | chapter_4/cubes/cubes.py | Python | gpl-3.0 | 131 |
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import hr_department_type, hr_department
| open-synergy/opnsynid-hr | hr_department_type/models/__init__.py | Python | agpl-3.0 | 176 |
# coding=utf-8
"""
InaSAFE Disaster risk assessment tool developed by AusAid - **Memory Checker.**
Contact : ole.moller.nielsen@gmail.com
.. note:: 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 Foun... | danylaksono/inasafe | safe_qgis/utilities/memory_checker.py | Python | gpl-3.0 | 6,439 |
#
# Encapsulation of statistics for a 6D particle distribution.
#
#
# Python imports
import math
# SciPy imports
import numpy as np
import scipy as sp
def calcAverages6D(array6D):
return sp.average(array6D, axis=1)
def subtractAverages6D(array6D):
averages6D = calcAverages6D(array6D)
for nLoop in ran... | radiasoft/radtrack | radtrack/statistics/RbStatistics6D.py | Python | apache-2.0 | 5,823 |
from urlparse import urlparse
import requests
def userinfo(url, accept="text/html"):
o = urlparse(url)
r = requests.get('{}://{}'.format(o.scheme, o.netloc),
headers={'User-Info': o.username,
'Accept': accept})
return r
| BigBlueHat/userinfo | python/client/userinfo.py | Python | apache-2.0 | 287 |
# 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 ... | ntt-sic/python-cinderclient | cinderclient/v1/contrib/list_extensions.py | Python | apache-2.0 | 1,447 |
input()
liste = list(map(int,input().split()))
liste.sort()
print(liste[(len(liste)//2)])
| omergulen/brainhack17 | wtf/wtf.py | Python | mit | 90 |
#!/usr/bin/env python
# coding=utf-8
from toughlib.utils import safeunicode,get_currtime
from toughwlan.manage.api.api_base import ApiHandler
from toughlib.permit import permit
from toughwlan import models
import random
@permit.route(r"/api/isp/query")
class IspQueryHandler(ApiHandler):
def get(self):
se... | talkincode/toughwlan | toughwlan/manage/api/api_isp.py | Python | agpl-3.0 | 4,654 |
import pexpect
import unittest
import sys
import os.path
DATADIR = os.path.join(os.path.dirname(__file__), 'data')
KEYA_VDO = os.path.join(DATADIR, 'samplea.vdo')
KEYB_VDO = os.path.join(DATADIR, 'sampleb.vdo')
class TestSendEvents(object):
def setUp(self):
cmd = 'vncev -rfbport 5933 -rfbwait 1000'
... | dtreiter/vncdotool | tests/functional/test_send_events.py | Python | mit | 2,385 |
# little grammar for test
from pyrser import grammar
class CSV(grammar.Grammar):
entry = "csv"
grammar = """
csv = [ [@ignore("null") line : l #add_line(_, l)]+ eof ]
line =
[
item : c #add_col(_, c)
[';' item : c #add_col(_, c)]*
eol
]
... | LionelAuroux/pyrser | tests/grammar/csv.py | Python | gpl-3.0 | 572 |
#$ -t 1-240
import os
import glob
SGE_TASK_ID = int(os.environ['SGE_TASK_ID'])
os.system('date')
os.system('hostname')
InputFiles = glob.glob('dyna*.mat')
print(InputFiles[SGE_TASK_ID])
os.system('matlab -nodesktop -nosplash -r "run_makeLoadsTemps(\'%s\')"' % InputFiles[SGE_TASK_ID])
| Guokr1991/cervix | field/9L4/makeLoads.sge.py | Python | mit | 289 |
#!/usr/bin/python
import sqlite3
import common
class DbCreator:
@staticmethod
def createEmpty(filename=None):
if None == filename:
filename=common.Config.getDbFilename()
print "create db in file :"+filename
conn = sqlite3.connect(filename)
print co... | elektroid/SensorinoServer | server/database.py | Python | gpl-2.0 | 1,270 |
"""Support to turn on lights based on the states."""
from datetime import timedelta
import logging
import voluptuous as vol
from homeassistant.components.light import (
ATTR_PROFILE,
ATTR_TRANSITION,
DOMAIN as DOMAIN_LIGHT,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
EVENT_HOMEASSISTANT_ST... | nkgilley/home-assistant | homeassistant/components/device_sun_light_trigger/__init__.py | Python | apache-2.0 | 8,416 |
#!/usr/bin/env python
"""
Author: Derek Hohls
Date: June 2016
Purpose:
Generate a file (e.g. PDF or Excel) containing details of games (or game-
like objects). Basic layout is a table-per-game or a row-per-game.
Notes:
Huge thanks to authors and developers of the following Python Libraries:
* boardgame... | gamesbook/gamereporter | report_builder.py | Python | mit | 18,929 |
#!/usr/bin/env python3
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free S... | nirbheek/cerbero | cerbero/tools/strip.py | Python | lgpl-2.1 | 2,480 |
import numpy as np
import pylab as pl
from math import sqrt
import os
from scipy.ndimage import gaussian_filter
def save_data(filename, data):
print("Saving data")
f = open(filename, 'w')
np.save(f, data)
f.close()
def save_dict(filename, data):
import pickle
print("Saving data")
f = open... | DiamondLightSource/auto_tomo_calibration-experimental | old_code_scripts/plot_radii.py | Python | apache-2.0 | 3,693 |
# Модуль os
import os
# Константа
# os.curdir Текущий каталог
print(os.curdir)
# os.pardir Родительский каталог
print(os.pardir)
# os.sep Разделитель элементов пути
print(os.sep)
# os.altsep Другой разделитель элементов пути
print(os.altsep)
# os.pathsep Разделитель путей в списке путей
print(os.pathsep)
# os.defpath С... | janusnic/21v-python | unit_06/ospath.py | Python | mit | 4,620 |
# Copyright 2016 Neverware 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... | neverware/bios_pnp | setup.py | Python | apache-2.0 | 1,303 |
from unittest import mock
import pytest
import ispyb.model.pdb
def test_pdb_values_are_immutable():
P = ispyb.model.pdb.PDB()
with pytest.raises(AttributeError):
P.name = "test"
with pytest.raises(AttributeError):
P.rawfile = "test"
with pytest.raises(AttributeError):
P.code ... | DiamondLightSource/ispyb-api | tests/model/test_pdb.py | Python | apache-2.0 | 1,164 |
# -*- coding: utf-8 -*-
import os
import json
import logging
os.environ['GIT_WEBHOOK_CONFIG'] = 'config_test.py'
logging.basicConfig(level=logging.DEBUG)
TEST_DIR = os.path.dirname(__file__)
WEBHOOKDATA_DIR = os.path.join(TEST_DIR, 'webhookdata')
WEBHOOKDATA = {}
for filename in os.listdir(WEBHOOKDATA_DIR):
name ... | hustcc/git_hooks | tests/__init__.py | Python | mit | 868 |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoind with different proxy configuration.
Test plan:
- Start bitcoind's with different proxy c... | ericshawlinux/bitcoin | test/functional/feature_proxy.py | Python | mit | 8,335 |
from __future__ import unicode_literals
import warnings
from django.contrib import admin
from django.contrib.auth import logout
from django.contrib.messages import error
from django.contrib.redirects.models import Redirect
from django.core.exceptions import MiddlewareNotUsed
from django.core.urlresolvers import rever... | ryneeverett/mezzanine | mezzanine/core/middleware.py | Python | bsd-2-clause | 13,114 |
# MIT License
#
# Copyright (c) 2018 Jonathan Lorraine, Google LLC
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from .unet import UNet
from .resnet import ResNet18
class CBRStudent(nn.Module):
def __init__(self, num_channels, num_clas... | googleinterns/commentaries | third_party/implicit_hyper_opt/models/simple_models.py | Python | apache-2.0 | 12,560 |
import logging
from pathlib import Path
from pymerra2 import download
# Here we process multiple variables at a time to avoid downloading
# original data twice (all these variables are in the same files).
# These variables names are user choices, their merra-2 equivalent are
# specified below or in the default pymerra... | bstdenis/pymerra2 | scripts/merra2_subdaily_download.py | Python | apache-2.0 | 1,774 |
#!/usr/bin/env python
# encoding: utf-8
"""
Waf tool for PX4 build
"""
from waflib import Errors, Logs, Task, Utils
from waflib.TaskGen import after_method, before_method, feature
import os
import shutil
import sys
_dynamic_env_data = {}
def _load_dynamic_env_data(bld):
bldnode = bld.bldnode.make_node('modules/... | Aerotenna/APM_OcPoC_Zynq | Tools/ardupilotwaf/px4.py | Python | gpl-3.0 | 11,357 |
# SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: CC0-1.0
import pytest
from pytest_embedded import Dut
@pytest.mark.supported_targets
@pytest.mark.generic
def test_timer_group_example(dut: Dut) -> None:
dut.expect(r'Init timer with auto-reload', timeout=5)
re... | espressif/esp-idf | examples/peripherals/timer_group/legacy_driver/pytest_timer_group.py | Python | apache-2.0 | 808 |
#
# kickstart.py : Apply kickstart configuration to a system
#
# Copyright 2007, Red Hat Inc.
#
# 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 2 of the License.
#
# This program is dis... | ykhodorkovskiy/clip | packages/livecd-tools/livecd-tools-20.6/imgcreate/kickstart.py | Python | apache-2.0 | 20,666 |
"""The Environment Canada (EC) component."""
from functools import partial
import logging
from env_canada import ECData, ECRadar
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
from .const import CONF_LANGUAGE, CONF_STATION, DOMAIN
PLATFORMS = ["c... | lukas-hetzenecker/home-assistant | homeassistant/components/environment_canada/__init__.py | Python | apache-2.0 | 2,354 |
# -*- coding: utf-8 -*-
from datetime import timedelta
import logging
import re
from django.utils import timezone
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.core.cache import cache
from django.db.utils import IntegrityError
from activeusers import utils
from activ... | arteria/django-activeusers | activeusers/middleware.py | Python | mit | 5,591 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | yoer/hue | desktop/libs/liboozie/src/liboozie/submission2.py | Python | apache-2.0 | 13,378 |
from office365.onedrive.conflictBehavior import ConflictBehavior
from office365.onedrive.fileSystemInfo import FileSystemInfo
from office365.onedrive.uploadSession import UploadSession
from office365.runtime.client_query import ServiceOperationQuery, CreateEntityQuery
from office365.runtime.client_result import ClientR... | vgrem/SharePointOnline-REST-Python-Client | office365/onedrive/driveItem.py | Python | mit | 6,316 |
# coding=utf-8
from .Axes import Axes
from .TimeLine import TimeLine
from .LockView import LockView
from .Colorbar import Colorbar
# from LinkColorbar import LinkColorbar
# from LinkView import LinkView
from .Overlay import Overlay
from .Transform import Transform
from .SwitchBetweenGridAndStackedView import SwitchBetw... | radjkarl/dataArtist | dataArtist/figures/image/tools/view/__init__.py | Python | gpl-3.0 | 486 |
"""
A fake TwistedBot!
"""
import re
class Logger():
def log(self, *args):
pass
class TestedBot:
bot_messages = []
logger = Logger()
functions = []
messages = {}
__funcs = {}
def __init__(self):
pass
def msg(self, channel, message):
self.bot_messages.append(... | andimiller/twistedbot | test/fake_tbot.py | Python | mit | 1,008 |
##############################################################################
#
# Copyright (C) 2019 jeo Software (http://www.jeosoft.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | jobiols/odoo-addons | product_create_restriction/__manifest__.py | Python | agpl-3.0 | 1,368 |
#!/usr/bin/env python3
#
# Copyright 2013 Simone Campagna
#
# 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 ... | simone-campagna/statcode | lib/python/statcode/progressbar.py | Python | apache-2.0 | 6,925 |
import datetime as dt
from unittest import SkipTest, skipIf
import numpy as np
from holoviews import (
Dimension, Curve, Points, Image, Dataset, RGB, Path, Graph, TriMesh,
QuadMesh, NdOverlay, Contours, Spikes, Spread, Area, Rectangles,
Segments, Polygons, Nodes
)
from holoviews.streams import Tap
from h... | ioam/holoviews | holoviews/tests/operation/test_datashader.py | Python | bsd-3-clause | 59,238 |
# -*- coding: utf-8 -*-
#
# 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
... | zodiac/incubator-airflow | tests/operators/__init__.py | Python | apache-2.0 | 741 |
# #
# Copyright 2012-2016 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | hpcleuven/easybuild-framework | easybuild/toolchains/mpi/mpich.py | Python | gpl-2.0 | 3,346 |
import requests
import json
import time
from collections import OrderedDict
from test_framework.test_framework import OpenBazaarTestFramework, TestFailure
class CompleteDirectOnlineTest(OpenBazaarTestFramework):
def __init__(self):
super().__init__()
self.num_nodes = 2
def run_test(self):
... | duomarket/openbazaar-test-nodes | qa/complete_direct_online.py | Python | mit | 9,485 |
import numpy
from trefoil.geometry.bbox import BBox
from ncdjango.geoprocessing.data import Raster
from seedsource_core.django.seedsource.tasks.generate_scores import GenerateScores
def test_generate_scores_workflow_sanity():
# Simple
raster_1 = Raster(numpy.reshape(numpy.arange(100), (10, 10)), BBox((0, 0, ... | consbio/seedsource-core | seedsource_core/django/seedsource/tests/test_score_calculation.py | Python | bsd-3-clause | 1,290 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-rdbms/azure/mgmt/rdbms/postgresql/models/name_availability.py | Python | mit | 1,227 |
import elementary
import evas
import os
class stationWindow(elementary.Box):
def __init__( self, parent ):
#builds a elementary box to accept login information
elementary.Box.__init__(self, parent.mainWindow)
self.ourPlayer = parent.ourPlayer
self.win = parent.mainWindow
se... | JeffHoogland/eandora | eAndora/stationWindow.py | Python | bsd-3-clause | 4,504 |
from distutils.core import setup, Extension
include_dirs = []
library_dirs = []
libraries = []
runtime_library_dirs = []
extra_objects = []
define_macros = []
setup(name = "villa",
version = "0.1",
author = "Li Guangming",
license = "MIT",
url = "https://github.com/cute/villa",
packages ... | cute/villa | setup.py | Python | mit | 1,149 |
from datetime import time
from pytest import approx
from libretime_shared.datetime import time_in_milliseconds, time_in_seconds
def test_time_in_seconds():
value = time(hour=0, minute=3, second=34, microsecond=649600)
assert time_in_seconds(value) == approx(214.65, abs=0.009)
def test_time_in_milliseconds... | LibreTime/libretime | shared/tests/datetime_test.py | Python | agpl-3.0 | 435 |
from . import time_weekday
from . import time_window_mixin
| OCA/server-tools | base_time_window/models/__init__.py | Python | agpl-3.0 | 59 |
from builtins import object
from collections import namedtuple
from itertools import combinations
import numpy as np
class KendallColijn(object):
"""
Data structure that stores info about a tree
that is needed to compute the Kendall-Colijn
tree distance metric - i.e. the vectors
m and M
"... | DessimozLab/treeCl | treeCl/utils/kendallcolijn.py | Python | mit | 3,393 |
# -*- coding: utf-8 -*-
from io import BytesIO
from pytest import raises
from translate.misc.multistring import multistring
from translate.storage import base, jsonl10n, test_monolingual
JSON_I18NEXT = b"""{
"key": "value",
"keyDeep": {
"inner": "value"
},
"keyPluralSimple": "the singular",
... | unho/translate | translate/storage/test_jsonl10n.py | Python | gpl-2.0 | 7,825 |
from setuptools import setup, find_packages
import sys, os
'''
NOTE: Para versionamento usar "MAJOR.MINOR.REVISION.BUILDNUMBER"! By Questor
http://programmers.stackexchange.com/questions/24987/what-exactly-is-the-build-number-in-major-minor-buildnumber-revision
'''
setup(name='liblightbase',
version='0.3.3.0',
... | lightbase/liblightbase | setup.py | Python | gpl-2.0 | 995 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='SkipRequest',
fields=[
('id', models.AutoField(... | katajakasa/utuputki | Utuputki/manager/migrations/0001_initial.py | Python | mit | 1,910 |
from itertools import chain
from multiqc.plots import linegraph
def plot_indelhist(samples, file_type, **plot_args):
"""Create line graph plot of histogram data for BBMap 'indelhist' output.
The 'samples' parameter could be from the bbmap mod_data dictionary:
samples = bbmap.MultiqcModule.mod_data[file_... | ewels/MultiQC | multiqc/modules/bbmap/plot_indelhist.py | Python | gpl-3.0 | 1,537 |
###############################################################################
##
## A sample device driver v0.01
## @Copyright 2014 MySensors Research Project
## SCoRe Lab (www.scorelab.org)
## University of Colombo School of Computing
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you... | kasundezoysa/senze | testv/myDriver.py | Python | apache-2.0 | 3,282 |
# encoding: utf-8
"""
Step implementations for section-related features
"""
from __future__ import absolute_import, print_function, unicode_literals
from behave import given, then, when
from docx import Document
from docx.enum.section import WD_ORIENT, WD_SECTION
from docx.shared import Inches
from helpers import ... | LuoZijun/uOffice | temp/pydocxx/features/steps/section.py | Python | gpl-3.0 | 4,958 |
# coding: utf-8
import unittest
from landchina.spiders.deal import Mapper
from scrapy.http import Request
class UrlMapperTestCase(unittest.TestCase):
def setUp(self):
self.obj = Mapper()
def tearDown(self):
self.obj = None
def test_url_map(self):
prvns = {u'江苏省': '32'}
... | sundiontheway/landchina-spider | tests/test_url.py | Python | mit | 997 |
# 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... | lukeiwanski/tensorflow | tensorflow/contrib/all_reduce/python/all_reduce.py | Python | apache-2.0 | 32,747 |
#! /usr/bin/env python
import angr
from angrutils import plot_func_graph
def analyze(b, name):
cfg = b.analyses.CFG(normalize=True)
for func in proj.kb.functions.values():
if func.name.find('Java_') == 0:
plot_func_graph(b, func.transition_graph, "%s_%s_cfg" % (name, func.name), asminst=T... | axt/angr-utils | examples/plot_func_graph/plot_func_graph_example.py | Python | bsd-2-clause | 526 |
"""
title : monitoringAgent.py
description : includes
a) register name prefix
b) response Interest messages which have matching name prefixes
source :
author : Adisorn Lertsinsrubtavee
date : 19 May 2017
version : 1.0
contributors ... | AdL1398/PiCasso | source/modules/Monitoring/monitoringAgent.py | Python | mit | 5,667 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicabl... | j2sol/giftwrap | giftwrap/tests/utils.py | Python | apache-2.0 | 1,369 |
from oscar.apps.basket.abstract_models import AbstractBasket
from oscar.core.loading import get_class
OrderNumberGenerator = get_class('order.utils', 'OrderNumberGenerator')
class Basket(AbstractBasket):
@property
def order_number(self):
return OrderNumberGenerator().order_number(self)
from oscar.... | janusnic/ecommerce | ecommerce/extensions/basket/models.py | Python | agpl-3.0 | 411 |
# 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
# distributed under the Li... | HonzaKral/warehouse | warehouse/migrations/versions/20f4dbe11e9_normalize_function.py | Python | apache-2.0 | 1,393 |
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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,... | slightstone/SickRage | sickbeard/webserve.py | Python | gpl-3.0 | 214,679 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.