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 |
|---|---|---|---|---|---|
from .AlFeatureTemplate import AlFeatureTemplate
from .sensorCountRoutine import AlFeatureSensorCountRoutine
import numpy as np
class AlFeatureSensorCount(AlFeatureTemplate):
def __init__(self, normalize=False):
"""
Initialization of Template Class
:return:
"""
AlFeatureTe... | TinghuiWang/ActivityLearning | actlearn/feature/sensorCount.py | Python | bsd-3-clause | 1,358 |
import sqlalchemy
import config, constants, util
def textclause_repr(self):
return 'text(%r)' % self.text
def table_repr(self):
data = {
'name': self.name,
'columns': constants.NLTAB.join([repr(cl) for cl in self.columns]),
'constraints': constants.NLTAB.join(
[repr(cn) for... | DarioGT/SqlAutoCode- | sqlautocode/formatter.py | Python | mit | 3,809 |
# -*- coding: utf-8 -*-
"""Scripts for counting recently added users by email domain; pushes results
to the specified project.
"""
import csv
import datetime
import collections
from cStringIO import StringIO
import requests
from dateutil.relativedelta import relativedelta
from framework.auth import Auth
from framewo... | AndrewSallans/osf.io | scripts/analytics/tabulate_emails.py | Python | apache-2.0 | 1,617 |
# -*- coding: UTF-8 -*-
from django.db import models
from django.contrib.contenttypes import generic
from django.contrib.auth.models import User
import datetime
from south.modelsinspector import add_introspection_rules
from ckeditor.fields import RichTextField
from multimedia.models import Audio, Fotos, Videos, Adjunt... | CARocha/sitioreddes | foros/models.py | Python | mit | 2,070 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# 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 t... | LordSputnik/beets | beets/dbcore/__init__.py | Python | mit | 1,103 |
import sys
r, c = map(int, input().split())
while r and c:
lines = [input().strip() for i in range(r)]
rotatedLines = []
for i in range(c):
rotatedLines.append("".join([lines[j][i] for j in range(r)]))
rotatedLines.sort(key=lambda s: s.lower())
for i in range(r):
print("".join([rotatedLines[j][i] for j in ran... | SirDavidLudwig/KattisSolutions | problems/sidewayssorting/sidewayssorting.py | Python | gpl-3.0 | 372 |
# -*- coding: utf-8 -*-
"""
Generate commands and configs for codalab runs.
"""
# Copyright (c) 2018 Ben Zimmer. All rights reserved.
import os
import shutil
import attr
from handwriting import run_charclassml, config as cf
DATE = "20180610"
RUN_COMMAND_PREFIX = "source activate handwriting36; export OMP_NUM_TH... | bdzimmer/handwriting | handwriting/runs.py | Python | bsd-3-clause | 2,766 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Huyuwei/tvm | nnvm/tests/python/frontend/caffe2/test_graph.py | Python | apache-2.0 | 1,699 |
import datetime
import os.path
from django.utils import timezone
from django.db import models
from tinymce.models import HTMLField
from django.contrib.auth.models import User
from django import forms
from django.forms import ModelForm
from captcha.fields import CaptchaField
class Category(models.Model):
name = mod... | bolan/django_simple_blog | blog/models.py | Python | gpl-3.0 | 1,456 |
from sklearn import datasets
from fickle.testing import TestCase
from fickle.predictors import GenericSVMClassifier as Backend
class BackendTest(TestCase):
def test_load(self):
backend = Backend()
dataset = datasets.load_iris()
self.assertTrue(backend.load(dataset))
def test_isloade... | norbert/fickle | test/backend_test.py | Python | mit | 1,757 |
# Copyright 2016 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... | frreiss/tensorflow-fred | tensorflow/python/kernel_tests/distributions/special_math_test.py | Python | apache-2.0 | 17,681 |
#!/usr/bin/env python
import argparse
import json
import os
import random
import numpy as np
import ray
from ray.tune import Trainable, run, sample_from
from ray.tune.schedulers import AsyncHyperBandScheduler
class MyTrainableClass(Trainable):
"""Example agent whose learning curve is a random sigmoid.
The... | stephanie-wang/ray | python/ray/tune/examples/async_hyperband_example.py | Python | apache-2.0 | 2,373 |
# coding=utf-8
# URL: https://pymedusa.com
#
# This file is part of Medusa.
#
# Medusa 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.... | Thraxis/pymedusa | sickbeard/indexers/indexer_exceptions.py | Python | gpl-3.0 | 1,776 |
"""This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import numpy as np
import pandas as pd
import thinkbayes2
import thi... | AllenDowney/ProbablyOverthinkingIt | survival.py | Python | mit | 8,921 |
from django.db import models
from django.db.models import Count
import data
import datetime
import sys
class House(models.Model):
year_construct = models.IntegerField(verbose_name="Year of construction")
TYPE_FLAT = "FLAT"
TYPE_HOUSE_4FACE = "H4"
TYPE_HOUSE_3FACE = "H3"
TYPE_HOUSE_2FACE = "H2"
... | tbarbette/monitoring | builder/models.py | Python | gpl-2.0 | 11,895 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Software License Agreement (BSD License)
#
# Copyright (c) 2016, Martin Guenther
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistrib... | bobman192/ROS | csv2bag.py | Python | bsd-3-clause | 16,639 |
# flake8: NOQA
from cupyx.scipy.fft._fft import (
fft, ifft, fft2, ifft2, fftn, ifftn,
rfft, irfft, rfft2, irfft2, rfftn, irfftn,
hfft, ihfft, hfft2, ihfft2, hfftn, ihfftn
)
from cupyx.scipy.fft._fft import (
__ua_domain__, __ua_convert__, __ua_function__)
from cupyx.scipy.fft._fft import _scipy_150, _s... | cupy/cupy | cupyx/scipy/fft/__init__.py | Python | mit | 591 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnaire', '0015_merge'),
]
operations = [
migrations.AlterModelOptions(
name='questionnaire',
... | CDE-UNIBE/qcat | apps/questionnaire/migrations/0016_auto_20170124_1119.py | Python | apache-2.0 | 1,191 |
"""
yamllog
===============
.. moduleauthor:: David Fallis
"""
import yaml
OUTPUT_ORDER = ['plot_name',
'variable',
'depth',
'plot_projection',
'plot_type',
'comp_file',
'dates',
'comp_dates',
... | fallisd/validate | validate/yamllog.py | Python | gpl-2.0 | 1,682 |
import typing
from os import PathLike
from starlette.background import BackgroundTask
from starlette.responses import Response
from starlette.types import Receive, Scope, Send
try:
import jinja2
# @contextfunction renamed to @pass_context in Jinja 3.0, to be removed in 3.1
if hasattr(jinja2, "pass_contex... | encode/starlette | starlette/templating.py | Python | bsd-3-clause | 3,288 |
from thefuck.rules.ls_all import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Command('ls', ''))
assert not match(Command('ls', 'file.py\n'))
def test_get_new_command():
assert get_new_command(Command('ls empty_dir', '')) == 'ls -A empty_dir'
assert get_new... | scorphus/thefuck | tests/rules/test_ls_all.py | Python | mit | 359 |
import os
import subprocess
import tempfile
from mozprocess import ProcessHandler
from tools.serve.serve import make_hosts_file
from .base import Browser, require_arg, get_free_port, browser_command, ExecutorBrowser
from ..executors import executor_kwargs as base_executor_kwargs
from ..executors.executorservodriver ... | danlrobertson/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/browsers/servodriver.py | Python | mpl-2.0 | 5,486 |
class LocusItem(object):
def __init__(self):
self.Locus = ""
self.Chromosome = ""
self.Start = 0
self.End = 0
self._name = ""
self.Overlapped = False
def setLocus(self, chromosome, start, end):
self.Chromosome = chromosome
self.Start = start
self.End = end
def getLocusStr... | shengqh/ngsperl | lib/CQS/LocusItem.py | Python | apache-2.0 | 2,423 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/modeling/fitting/initialization.py | Python | mit | 34,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pygtk, gtk, os
pygtk.require("2.0")
from tab_channels import GuiTabChannels
class GuiConfig:
def __init__(self, desc, text = None, choices = None, integer = None, boolean = None, mini = None, maxi = None):
self.tab = [desc]
if text != None:
self.tab.append... | JackDesBwa/IrisMonitor | gui/__init__.py | Python | mit | 1,900 |
from setuptools import setup, find_packages
install_requires = ["execnet>=1.1", "pytest>=4.4.0", "pytest-forked", "six"]
with open("README.rst") as f:
long_description = f.read()
setup(
name="pytest-xdist",
use_scm_version={"write_to": "src/xdist/_version.py"},
description="pytest xdist plugin for d... | RonnyPfannschmidt/pytest-xdist | setup.py | Python | mit | 1,890 |
from ..route_handler import BaseModelRouter, SUCCESS, ERROR
from ..serializers.model_serializer import ModelSerializer
from .dragon_test_case import DragonTestCase
from swampdragon.tests.models import TwoFieldModel
class Serializer(ModelSerializer):
class Meta:
update_fields = ('text', 'number')
m... | h-hirokawa/swampdragon | swampdragon/tests/test_base_model_router_create.py | Python | bsd-3-clause | 1,357 |
# Definition for a binary tree node
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
# @param root, a tree node
# @return a list of integers
# only have to use level order traversal.
def rightSideVie... | linyaoli/acm | tree/intermediate/binary_tree_right_side_view.py | Python | gpl-2.0 | 787 |
# encoding: utf-8
"""
Expose the multiengine controller over the Foolscap network protocol.
"""
__docformat__ = "restructuredtext en"
#-------------------------------------------------------------------------------
# Copyright (C) 2008 The IPython Development Team
#
# Distributed under the terms of the BSD Licens... | mastizada/kuma | vendor/packages/ipython/IPython/kernel/multienginefc.py | Python | mpl-2.0 | 30,932 |
# coding utf-8
import unittest
from processor.processor import *
from bs4 import BeautifulSoup
class TestProcessor(unittest.TestCase):
def setUp(self):
html = """
<html>
<head>
<link href="link_link" rel="stylesheet" />
<script></scr... | pitomba/libra | libra/test_processor.py | Python | mit | 2,993 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "appservercms.settings.dev")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| markussitzmann/webapps | wagtail/project_template/appservercms/manage.py | Python | mit | 259 |
import os
import logging
import traceback
import shlex
import subprocess
import string
from collections import defaultdict
from loader import Loader, LoadResult, Timeout, TimeoutError
NODE = '/usr/bin/env node'
NODEHTTP2 = 'node-http2/example/objloader_client.js' # Put your path here
class NodeJsLoader(Loader):
'... | dtnaylor/web-profiler | webloader/nodejs_loader.py | Python | mit | 3,959 |
from flask import render_template, flash, request, redirect, url_for
from flask_login import login_required
from kernel import agileCalendar
from kernel.DataBoard import Data
from kernel.NM_Aggregates import WorkBacklog, DevBacklog, RiskBacklog
from kconfig import coordinationBookByName
from . import coordination
__a... | flopezag/fiware-backlog | app/coordination/views.py | Python | apache-2.0 | 6,105 |
from django.shortcuts import render_to_response
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django import forms
from models import *
class WaiverForm(forms.ModelForm):
"A form for submitting waivers"
class Meta:
model = RGUser
fields = ['name', 'email', 'address', '... | RobotGarden/rgdjapps | views.py | Python | bsd-2-clause | 377 |
import datetime
from mock import patch
import urllib
from django.test import TestCase
from django.test.client import RequestFactory
from django.urls import reverse
from django.conf import settings
from django.test.utils import override_settings
import django.contrib.auth.models as auth_models
from toolkit.members.m... | BenMotz/cubetoolkit | toolkit/members/tests/test_members.py | Python | agpl-3.0 | 40,693 |
#!/usr/bin/env python2.7
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | tst-mswartz/earthenterprise | earth_enterprise/src/fusion/portableglobe/servers/mac/globe_selector.py | Python | apache-2.0 | 1,895 |
import json
import os
import tempfile
import shutil
from git.remote import PushInfo
import pytest
import requests_mock
from click.testing import CliRunner
# By doing this import we make sure that the plugin is made available
# but the entry points loading inside gg.main.
# An alternative would we to set `PYTHONPATH=.... | peterbe/gg | gg/builtins/push/tests/test_gg_push.py | Python | mit | 1,854 |
class Person(object):
def __init__(self, name):
self.na##|me = name
def __str__(self):
return "Person " + self.name
Person("Lancelot").name
robin = Person("Sir Robin")
print robin
print robin.name
##r
class Person(object):
def __init__(self, name):
self.p = name
... | aptana/Pydev | tests/org.python.pydev.refactoring.tests/src/python/coderefactoring/rename/successful/testRenameAttribute1.py | Python | epl-1.0 | 455 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# nodectl
#
# Copyright (C) 2016 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; either version 2 of the License, or
# (at your optio... | oVirt/ovirt-node-ng | src/nodectl/info.py | Python | gpl-2.0 | 3,934 |
#!/usr/bin/python
from hwdata import PCI, USB
# for obtaining real id of your devices you can use package python-gudev
pci_vendor_id = '0e11'
pci_device_id = 'b01e'
usb_vendor_id = '03f0'
usb_device_id = '1f12'
pci = PCI()
print("Vendor: %s" % pci.get_vendor(pci_vendor_id))
print("Device: %s" % pci.get_device(pci... | colloquium/spacewalk | projects/python-hwdata/example.py | Python | gpl-2.0 | 484 |
# coding: utf-8
"""
Initializes flask server and assigns all routes by importing modules
"""
import flask
#import config
import util
from model.config import Config # NB The model module needs to be imported *after* setting CURRENT_VERSION_TIMESTAMP,
# since model.ndbModelBase uses it as default value for v... | chdb/DhammaMap1 | main/main.py | Python | mit | 2,227 |
from django.db import models
from datetime import datetime
# from django.contrib.auth.models import AbstractBaseUser
from mongoengine import *
from mongoengine.django.auth import *
from slugify import slugify
from django.core.urlresolvers import reverse
class Author(User):
firstname = StringField(required=True, max_l... | gusaul/gigsblog | apps/blog/models.py | Python | mit | 1,734 |
# Copyright (c) 2017 Microsoft Corporation.
#
# 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, publis... | domin1101/malmo-challenge | malmopy/agent/astar.py | Python | mit | 2,799 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
PcrasterMapstackVisualisationDialog
A QGIS plugin
PCRaster Mapstack visualisation
-------------------
begin : 2014-06-28
... | mugwizaleon/PCRasterMapstacks | pcrastermapstackvisualisationdialog.py | Python | apache-2.0 | 1,556 |
# Copyright 2019 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-google/cirq_google/ops/sycamore_gate.py | Python | apache-2.0 | 2,159 |
__author__= "barun"
__date__ = "$20 May, 2011 12:19:25 PM$"
## Defines a collection of metrics that can be used to analyze the performance
# of a network.
class Metrics(object):
## Calculate average throughput as: total_bytes_rcvd / duration.
#
# @param pkts_list An iterator object in the... | barun-saha/ns2web | ns2trace/metrics.py | Python | gpl-2.0 | 8,308 |
import numpy as np
from openglider.vector.functions import normalize
class Plane(object):
def __init__(self, p0, v1, v2):
self.p0 = np.array(p0)
self.v1 = np.array(v1)
self.v2 = np.array(v2)
def point(self, x1, x2):
return self.p0 + x1 * self.v1 + x2 * self.v2
def cut(se... | hiaselhans/OpenGlider | openglider/vector/plane.py | Python | gpl-3.0 | 1,988 |
from django.db import models
from django.contrib.postgres.fields.jsonb import JSONField
class Supplier(models.Model):
name = models.CharField(max_length=50)
tax_id = models.CharField(max_length=10)
def __str__(self):
return self.name
class Bargain(models.Model):
sku = models.CharField(max_l... | sebastian-code/jsonb-test | jsonb/emporium/models.py | Python | mit | 986 |
# ===============================================================================
# Copyright 2015 Jake Ross
#
# 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... | USGSDenverPychron/pychron | pychron/pipeline/tasks/panes.py | Python | apache-2.0 | 28,668 |
import spirit.spiritlib as spiritlib
import ctypes
### Load Library
_spirit = spiritlib.LoadSpiritLibrary()
### Read an image from disk
_Image_Read = _spirit.IO_Image_Read
_Image_Read.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_int, ctypes.c_int, ctypes.c_int]
_Image_Read.restype = None... | Disselkamp/spirit | core/python/spirit/io.py | Python | mit | 2,661 |
# ----------------------------------------------------------------
# Copyright 2016 Cisco Systems
#
# 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/LICENS... | psykokwak4/ydk-gen | sdk/python/packages/setup.py | Python | apache-2.0 | 2,597 |
def rm_dup(s):
d = {}
for i in s:
if i not in d:
d[i] = 1
else:
d[i] += 1
in_stk, stk = set(), []
for i in s:
if i not in in_stk:
while stk and stk[-1] > i and d[stk[-1]]:
in_stk.remove(stk.pop())
stk += i
... | LeonardCohen/coding | py/remove_duplicate_letters.py | Python | gpl-2.0 | 447 |
from kfp.components import InputPath, OutputPath, create_component_from_func
def catboost_train_classifier(
training_data_path: InputPath('CSV'),
model_path: OutputPath('CatBoostModel'),
starting_model_path: InputPath('CatBoostModel') = None,
label_column: int = 0,
loss_function: str = 'Logloss',
... | kubeflow/pipelines | components/contrib/CatBoost/Train_classifier/from_CSV/component.py | Python | apache-2.0 | 3,545 |
from distutils.core import setup
from sys import argv
import shutil
import py2exe
from os import path, getcwd, system
# get the name of this directory
name = path.basename(getcwd())
# seed the install command line with what we want
argv += ["py2exe"]
setup(
windows = [
{
"script"... | chr15m/rjzserver | build-windows.py | Python | lgpl-3.0 | 549 |
#!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | sunqm/pyscf | pyscf/lib/logger.py | Python | apache-2.0 | 6,296 |
"""
Course API Views
"""
from completion.exceptions import UnavailableCompletionData
from completion.utilities import get_key_to_last_completed_block
from django.urls import reverse
from django.utils.translation import gettext as _
from edx_django_utils.cache import TieredCache
from edx_rest_framework_extensions.auth.j... | arbrandes/edx-platform | openedx/core/djangoapps/courseware_api/views.py | Python | agpl-3.0 | 31,995 |
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio 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 ... | MSusik/invenio | invenio/legacy/bibconvert/api.py | Python | gpl-2.0 | 66,991 |
# encoding=utf8
# -*- coding: utf-8 -*-
import requests
from pyquery import PyQuery as pq
# 获取亚马逊的所有书名
# python3
# 访问分类页面的url
clc_url = 'https://www.amazon.cn/Kindle%E7%94%B5%E5%AD%90%E4%B9%A6/b?ie=UTF8&node=116169071&ref_=nav_topnav_giftcert'
'''
访问首页的header
'''
headers = {'Host': 'www.amazon.cn',
'Co... | wang153723482/HelloWorld_my | HelloWorld_python/http_spider/amazon/get_books.py | Python | apache-2.0 | 6,587 |
# Copyright 2013 OpenStack Foundation
# Copyright 2013 IBM Corp
# 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/LICE... | vedujoshi/tempest | tempest/api/image/v2/test_images.py | Python | apache-2.0 | 16,568 |
#!/usr/bin/env python
# encoding: utf-8
"""
misc.EventSystem.py
Copyright (C) 2018 Stefan Braun
registered handlers (a bag of handlers) getting called when event gets fired
using ideas from "axel events" https://github.com/axel-events/axel
and "event system" from http://www.valuedlessons.com/2008/04/events-in-python.... | stefanbraun-private/pyVisiToolkit | src/misc/EventSystem.py | Python | gpl-3.0 | 12,113 |
"""
create specializer projects
basically copies all files and directories from a template.
"""
from __future__ import print_function
import sys
import argparse
import collections
import shutil
import os
import ctree
from ctree.tools.generators.builder import Builder
if sys.version_info >= (3, 0, 0): # python 3
... | mbdriscoll/ctree | ctree/tools/runner.py | Python | bsd-2-clause | 5,409 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-bigquery-connection | samples/generated_samples/bigqueryconnection_v1_generated_connection_service_create_connection_async.py | Python | apache-2.0 | 1,563 |
# Copyright 2021 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, ... | google-research/falken | service/api/create_brain_handler_test.py | Python | apache-2.0 | 3,929 |
from collections import OrderedDict
import ntpath
import StringIO
from ..base import Processor
class Append(Processor):
def __init__(self, pipeline, additional_files):
super(Append, self).__init__(pipeline)
self.additional_files = additional_files
def process(self, inputs):
"""
... | potatolondon/assetpipe | assetpipe/processors/append.py | Python | bsd-2-clause | 991 |
import coloreffect, inkex
class C(coloreffect.ColorEffect):
def colmod(self,r,g,b):
hsl = self.rgb_to_hsl(r/255.0, g/255.0, b/255.0)
#inkex.debug("hsl: " + str(hsl[0]) + ", " + str(hsl[1]) + ", " + str(hsl[2]))
hsl[1] = hsl[1] + 0.05
if hsl[1] > 1.0:
hsl[1] = 1.0
rgb = self.hsl_to_rgb(... | NirBenTalLab/proorigami-cde-package | cde-root/usr/local/apps/inkscape/share/inkscape/extensions/color_moresaturation.py | Python | mit | 429 |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import pytest
from indico.modules.events.contributions.lists import ContributionListGenerator
from indico... | indico/indico | indico/modules/events/contributions/lists_test.py | Python | mit | 4,479 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-15 21:37
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependen... | mrkiwi-nz/django-helpdesk | helpdesk/migrations/0012_queue_default_owner.py | Python | bsd-3-clause | 739 |
# PENMAN MONTEITH ETP
def ETp(T, Z, u2, Rn, night, Rh, hc):
"""
Potential Evapotranspiration Calculation with hourly/daily Penman-Monteith
T = Temperature raster map [°C]
Z = DEM raster map [m a.s.l.]
u2 = Wind Speed raster map [m/s]
Rn = Net Solar Radiation raster map [MJ/m2/h]
Rh = Relative Umidity raster map... | YannChemin/wxGIPE | RS_functions/evapo_pm.py | Python | unlicense | 5,290 |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Fujicoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the listsinceblock RPC."""
from test_framework.address import key_to_p2wpkh
from test_framework.... | fujicoin/fujicoin | test/functional/wallet_listsinceblock.py | Python | mit | 14,650 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | addition-it-solutions/project-all | addons/mrp_byproduct/mrp_byproduct.py | Python | agpl-3.0 | 8,865 |
import csv
import cStringIO
from io import BytesIO
from datetime import datetime, timedelta
import logging
from reportlab.lib import colors
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT, TA_JUSTIFY
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch
... | jcalazan/glucose-tracker | glucosetracker/glucoses/reports.py | Python | mit | 16,741 |
# This file is part of Indico.
# Copyright (C) 2002 - 2020 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.core.db import db
from indico.util.string import form... | mic4ael/indico | indico/modules/events/registration/models/legacy_mapping.py | Python | mit | 1,557 |
#! /usr/bin/python2
# -*- coding: utf-8; -*-
#
# (c) 2013 booya (http://booya.at)
#
# This file is part of the OpenGlider project.
#
# OpenGlider 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 ... | hiaselhans/OpenGlider | tests/input/visual_test_input.py | Python | gpl-3.0 | 2,297 |
"""
Tracks devices by sending a ICMP ping.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.ping/
device_tracker:
- platform: ping
count: 2
hosts:
host_one: pc.local
host_two: 192.168.2.25
"""
import logging
import sub... | kyvinh/home-assistant | homeassistant/components/device_tracker/ping.py | Python | apache-2.0 | 2,962 |
# Copyright (c) 2013 Red Hat, Inc.
#
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of... | candlepin/subscription-manager | src/subscription_manager/entbranding.py | Python | gpl-2.0 | 4,891 |
# encoding: utf-8
from __future__ import unicode_literals
import re
from hashlib import sha1
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
)
from ..utils import (
ExtractorError,
determine_ext,
float_or_none,
int_or_none,
unified_strdate,
)
class ProSiebenSat1... | miminus/youtube-dl | youtube_dl/extractor/prosiebensat1.py | Python | unlicense | 13,995 |
import os, sys
if os.path.isfile("/proc/device-tree/hat/product"):
file = open("/proc/device-tree/hat/product","r")
hat = file.readline()
if hat == "Sense HAT\x00":
print('Sense HAT detected')
mypath = os.path.dirname(os.path.abspath(__file__))
file.close()
os.system("/usr/bin/env python3 " + mypath+"/8x8g... | topshed/RPi_8x8GridDraw | 8x8grid.py | Python | mit | 898 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-securitycenter | samples/generated_samples/securitycenter_v1_generated_security_center_get_iam_policy_sync.py | Python | apache-2.0 | 1,489 |
# Copyright 2009 Shikhar Bhushan <shikhar@schmizz.net>
#
# This file is part of the Sweetmail activity for Sugar.
#
# Sweetmail 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,... | FOSSRIT/sweetermail | msginfo.py | Python | gpl-3.0 | 3,348 |
"""Provide CudaNdarrayType
"""
from __future__ import print_function
import os
import six.moves.copyreg as copyreg
import warnings
import numpy
import theano
from theano import Type, Variable
from theano import tensor, config
from theano import scalar as scal
from six import StringIO
try:
# We must do those impo... | nke001/attention-lvcsr | libs/Theano/theano/sandbox/cuda/type.py | Python | mit | 20,739 |
''' Some tests for filters '''
from __future__ import division, print_function, absolute_import
import sys
import numpy as np
from numpy.testing import (assert_equal, assert_raises,
assert_array_equal, TestCase, run_module_suite)
import scipy.ndimage as sndi
def test_ticket_701():
# ... | valexandersaulys/airbnb_kaggle_contest | venv/lib/python3.4/site-packages/scipy/ndimage/tests/test_filters.py | Python | gpl-2.0 | 7,092 |
import codecs
from setuptools import setup
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with codecs.open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='zenbu',
version='1.0.5',
descrip... | metakirby5/zenbu | setup.py | Python | mit | 1,288 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import cherrypy
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import rsa
import json
import os
import re
from urllib.parse import urlparse, urlunparse, parse_q... | data-exp-lab/girder_ythub | server/rest/ythub.py | Python | bsd-3-clause | 12,034 |
from tests.base_case import ChatBotTestCase
from chatterbot.logic import MathematicalEvaluation
from chatterbot.conversation import Statement
class MathematicalEvaluationTests(ChatBotTestCase):
def setUp(self):
super().setUp()
self.adapter = MathematicalEvaluation(self.chatbot)
def test_can_... | vkosuri/ChatterBot | tests/logic/test_mathematical_evaluation.py | Python | bsd-3-clause | 4,970 |
from __future__ import absolute_import
import logging
from django.shortcuts import render_to_response, render, get_object_or_404, redirect
from django.template import RequestContext
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirec... | underlost/Replica | replica/contrib/blip/dashboard/views.py | Python | mit | 5,663 |
from __future__ import division
from nose.tools import assert_equal
from nose.tools import assert_false
from nose.tools import assert_raises
from nose.tools import raises
import networkx as nx
from networkx.utils import pairwise
def validate_path(G, s, t, soln_len, path):
assert_equal(path[0], s)
assert_equ... | cmtm/networkx | networkx/algorithms/shortest_paths/tests/test_weighted.py | Python | bsd-3-clause | 25,025 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2017-01-29 02:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('human_feedback_api', '0003_auto_20170129_0220'),
]
operations = [
migrations... | nottombrown/rl-teacher | human-feedback-api/human_feedback_api/migrations/0004_auto_20170129_0223.py | Python | mit | 1,448 |
from C4CApplication.page_objects.FixedPage import FixedPage
from selenium.common.exceptions import NoSuchElementException
class MemberDetailsPage(FixedPage):
def __init__(self, driver):
super().__init__(driver)
self.favorite_button = None
self.log_as_button = None
try:
... | dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/page_objects/MemberDetailsPage.py | Python | agpl-3.0 | 968 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f3822.py | Python | mit | 5,003 |
# -*- coding: utf-8 -*-
# pylint: disable=bad-whitespace
""" rTorrent web apps.
Copyright (c) 2013 The PyroScope Project <pyroscope.project@gmail.com>
"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Softwar... | pyroscope/pyrocore | src/pyrocore/daemon/webapp.py | Python | gpl-2.0 | 9,247 |
# example2.py
#
# Singleton
class Singleton(type):
def __init__(self, *args, **kwargs):
self.__instance = None
super().__init__(*args, **kwargs)
def __call__(self, *args, **kwargs):
if self.__instance is None:
self.__instance = super().__call__(*args, **kwargs)
... | tuanavu/python-cookbook-3rd | src/9/using_metaclasses_to_control_instance_creation/example2.py | Python | mit | 558 |
# Copyright (c) 2015 Tencent Inc.
# All rights reserved.
#
# Author: Li Wenting <wentingli@tencent.com>
# Date: August 28, 2015
"""
This is the maven module which manages jar files downloaded
from maven repository
"""
import os
import shutil
import subprocess
import time
import configparse
import console
def i... | project-zerus/blade | src/blade/maven.py | Python | bsd-3-clause | 8,974 |
# Copyright (C) 2005 Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
# Copyright (C) 2005 XenSource Ltd
# This file is subject to the terms and conditions of the GNU General
# Public License. See the file "COPYING" in the main directory of
# this archive for more details.
import errno
import threading
from xen.xe... | kaustubh-kabra/modified-xen | tools/python/xen/xend/xenstore/xswatch.py | Python | gpl-2.0 | 2,418 |
import cv2
import numpy as np
img = cv2.imread('alpha_o.JPG',1)
scaledown = cv2.resize(img,(0,0),fx=0.25,fy=0.25)
color_space = cv2.cvtColor(scaledown,cv2.COLOR_RGB2HSV)
sift = cv2.SIFT(7)
kp = sift.detect(color_space,None)
scaledown = cv2.drawKeypoints(color_space,kp)
cv2.imshow('image',scaledown)
cv2.waitK... | xgt001/uav_msr_ip14 | opencv_rnd/buff.py | Python | mit | 373 |
"""
Cluster definition
part of context, Cluster is used to save connection information.
"""
from teuthology.orchestra import run
class Cluster(object):
"""
Manage SSH connections to a cluster of machines.
"""
def __init__(self, remotes=None):
"""
:param remotes: A sequence of 2-tuples ... | ceph/teuthology | teuthology/orchestra/cluster.py | Python | mit | 6,697 |
# Copyright (C) 2014 Red Hat, Inc.
#
# Author: Rich Megginson <rmeggins@redhat.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | melodous/designate | designate/tests/test_backend/test_ipa.py | Python | apache-2.0 | 12,721 |
import os
import random
import tweepy
import redis
CONSUMER_KEY = os.environ.get('TWITTER_CONSUMER_KEY')
CONSUMER_SECRET = os.environ.get('TWITTER_CONSUMER_SECRET')
ACCESS_TOKEN = os.environ.get('TWITTER_ACCESS_TOKEN')
ACCESS_TOKEN_SECRET = os.environ.get('TWITTER_ACCESS_TOKEN_SECRET')
r = redis.from_url(os.environ.g... | avyfain/a-link-please | tweet.py | Python | mit | 1,359 |
# -*- coding: utf-8 -*-
"""
DNSLabel/DNSBuffer - DNS label handling & encoding/decoding
"""
import fnmatch
from dnslib.bit import get_bits,set_bits
from dnslib.buffer import Buffer, BufferError
class DNSLabelError(Exception):
pass
class DNSLabel(object):
"""
Container for DNS label
Supports... | xyuanmu/XX-Net | code/default/lib/noarch/dnslib/label.py | Python | bsd-2-clause | 8,345 |
import numpy as np
from r_support import *
def forest_aad_loss_linear(w, xi, yi, qval, in_constr_set=None, x_tau=None, Ca=1.0, Cn=1.0, Cx=1.0,
withprior=False, w_prior=None, sigma2=1.0):
"""
Computes AAD loss:
for square_slack:
( score_loss + 1/(2*sigma2) * (w - ... | shubhomoydas/pyaad | pyalad/forest_aad_loss.py | Python | mit | 10,027 |
# -*- test-case-name: twisted.test.test_udp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Various asynchronous UDP classes.
Please do not use this module directly.
@var _sockErrReadIgnore: list of symbolic error constants (from the C{errno}
module) representing socket errors whe... | ecolitan/fatics | venv/lib/python2.7/site-packages/twisted/internet/udp.py | Python | agpl-3.0 | 11,644 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.