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 (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that the
# above copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... | boto/requestbuilder | requestbuilder/suite.py | Python | isc | 2,659 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# 2009 Gary Burton
#
# 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... | Forage/Gramps | gramps/gui/editors/editreference.py | Python | gpl-2.0 | 8,603 |
from lentil import plotting as plt, Space, Mirror, Interface, find_cavity_modes
from lentil.plotting import plot_profile
# Indices of refraction
n0, nc = 1, 2.18
# Create cavity elements
cavity_elems = [Mirror(R='50mm', aoi='18deg'), Space('1.7cm'),
Interface(n0, nc), Space('5cm', nc),
... | natezb/Lentil | examples/cavity_modes.py | Python | gpl-3.0 | 716 |
# coding: utf-8
from os import path
from django.conf.urls.defaults import *
import views
base_dir = path.dirname(path.abspath(__file__))
media_dir = path.join(base_dir, 'media')
locale_dir = path.join(base_dir, 'locale')
js_info_dict = {
'domain': 'djangojs',
'packages': ('regressiontests.views',),
}
js_i... | mitsuhiko/django | tests/regressiontests/views/urls.py | Python | bsd-3-clause | 2,061 |
import logging
from pywink.devices.base import WinkDevice
_LOGGER = logging.getLogger(__name__)
class WinkHub(WinkDevice):
"""
Represents a Wink Hub.
"""
def __init__(self, device_state_as_json, api_interface):
super(WinkHub, self).__init__(device_state_as_json, api_interface)
... | w1ll1am23/python-wink | src/pywink/devices/hub.py | Python | mit | 3,176 |
# Django settings for giok57_site project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '/U... | giok57/django-playground | giok57_site/giok57_site/settings.py | Python | mit | 5,503 |
"""
Executed in dotnet driver container.
Assumes driver and backend has been built.
Responsible for starting the test backend.
"""
import os, subprocess, sys
if __name__ == "__main__":
backend_path = os.path.join(
"bin", "Publish", "Neo4j.Driver.Tests.TestBackend.dll"
)
logfile_path = os.path.joi... | neo4j/neo4j-dotnet-driver | testkit/backend.py | Python | apache-2.0 | 503 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# 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 versio... | ilpise/geonode | geonode/base/forms.py | Python | gpl-3.0 | 5,848 |
# coding: utf-8
from .certificate import *
from .feedback import *
from .newsletter import *
from .post import *
from .product import *
from .resource import *
from .user import *
| gmist/five-studio2 | main/forms/__init__.py | Python | mit | 181 |
###############################################################################
#
# The MIT License (MIT)
#
# Copyright (c) Crossbar.io Technologies GmbH
#
# 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 ... | technologiescollege/Blockly-rduino-communication | scripts_XP/Lib/site-packages/autobahn/wamp/test/test_protocol_peer.py | Python | gpl-3.0 | 4,497 |
from werkzeug.contrib.securecookie import SecureCookie
from werkzeug.utils import cached_property
from werkzeug.wrappers import BaseRequest
from partial import scanner
class Request(BaseRequest):
@cached_property
def session(self):
return SecureCookie.load_cookie(self, secret_key=scanner.CONFIG['SECR... | RentennaDev/partial | partial/request.py | Python | mit | 325 |
"""
WSGI config for WeatherForecast project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJA... | vinicius-ronconi/WeatherForecast | WeatherForecast/wsgi.py | Python | mit | 408 |
# Copyright (c) 2004-2009 Moxie Marlinspike
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distri... | P0cL4bs/WiFi-Pumpkin | plugins/external/sergio_proxy/sslstrip/ClientRequest.py | Python | gpl-3.0 | 8,417 |
import zlib
class GzipDecompress:
def __call__(self, data):
deco = zlib.decompressobj(16 + zlib.MAX_WBITS)
return deco.decompress(data)
class DeflateDecompress:
def __call__(self, data):
try:
return zlib.decompressobj().decompress(data)
except zlib.error:
... | quantmind/pulsar | pulsar/apps/http/decompress.py | Python | bsd-3-clause | 386 |
from __future__ import absolute_import, unicode_literals
from datetime import datetime
from operator import attrgetter
from django.core.exceptions import FieldError
from django.test import TestCase, skipUnlessDBFeature
from .models import Author, Article, Tag, Game, Season, Player
class LookupTests(TestCase):
... | mammique/django | tests/modeltests/lookup/tests.py | Python | bsd-3-clause | 33,987 |
import sys
sys.path.insert(1, "../../")
import h2o, tests
def headers():
headers = h2o.import_file(h2o.locate("smalldata/airlines/allyears2k_headers_only.csv"))
headers_and = h2o.import_file(h2o.locate("smalldata/airlines/allyears2k.zip"))
headers_and.setNames(headers.names)
print headers.na... | tarasane/h2o-3 | h2o-py/tests/testdir_misc/pyunit_headers.py | Python | apache-2.0 | 570 |
class ListTemplateType:
def __init__(self):
pass
InvalidType = -1
NoListTemplate = 0
GenericList = 100
DocumentLibrary = 101
Survey = 102
Links = 103
Announcements = 104
Contacts = 105
Events = 106
Tasks = 107
DiscussionBoard = 108
PictureLibrary = 109
Da... | vgrem/Office365-REST-Python-Client | office365/sharepoint/lists/list_template_type.py | Python | mit | 1,268 |
#!/usr/bin/env python
"""
Created on Mon Feb 3 18:27:15 2014
Author: Oren Freifeld
Email: freifeld@csail.mit.edu
"""
import numpy as np
from cpab.cpa1d.CpaSpace import CpaSpace
from cpab.cpaNd import Multiscale as MultiscaleNd
from of.gpu import CpuGpuArray
from of.utils import ipshell
from cpab.cpa1d.calcs import ... | freifeld/cpabDiffeo | cpab/cpa1d/Multiscale.py | Python | mit | 13,361 |
from django.db.models import Index
__all__ = ['BrinIndex', 'GinIndex']
class BrinIndex(Index):
suffix = 'brin'
# Allow an index name longer than 30 characters since the suffix is 4
# characters (usual limit is 3). Since this index can only be used on
# PostgreSQL, the 30 character limit for cross-dat... | mlavin/django | django/contrib/postgres/indexes.py | Python | bsd-3-clause | 2,335 |
from slackbot.bot import Bot
import logging
def main():
bot = Bot()
bot.run()
if __name__ == "__main__":
logging.basicConfig()
main()
| ianoti/sakabot | run.py | Python | gpl-3.0 | 154 |
# -*- coding: UTF-8 -*-
# This file is part of pybliographer
#
# Copyright (C) 1998-2004 Frederic GOBRY
# Email : gobry@pybliographer.org
#
# 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; ... | zkota/pyblio-1.3 | Legacy/Style/abbrv.py | Python | gpl-2.0 | 9,095 |
# Copyright 2011 OpenStack Foundation.
# Copyright 2012, Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | dsiddharth/access-keys | keystone/openstack/common/excutils.py | Python | apache-2.0 | 3,715 |
"""
Support for Tellstick covers.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.tellstick/
"""
from homeassistant.components.cover import CoverDevice
from homeassistant.components.tellstick import (
DEFAULT_SIGNAL_REPETITIONS, ATTR_DISCOVER_... | ewandor/home-assistant | homeassistant/components/cover/tellstick.py | Python | apache-2.0 | 1,995 |
# python3
# coding=utf-8
# Copyright 2020 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | google/TaglessCRM | src/dags/bq_to_ads_uac_dag.py | Python | apache-2.0 | 3,082 |
# project/user/views.py
#################
#### imports ####
#################
import datetime
from flask import render_template, Blueprint, url_for, \
redirect, flash, request
from flask_login import login_user, logout_user, \
login_required, current_user
from project.models import User
from project.email ... | CristianCantoro/flask-registration | project/user/views.py | Python | mit | 6,506 |
'''
The MIT License (MIT)
Copyright (c) 2016 Noe De La Cruz, Jr
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, ... | Triballian/stakenanny | src/stakenanny.py | Python | mit | 4,164 |
from .layer import YowStanzaRegulator | felix-dumit/campusbot | yowsup2/yowsup/layers/stanzaregulator/__init__.py | Python | mit | 37 |
import unittest
from pymal import anime
from pymal import seasons
from pymal.inner_objects import season
class TestCase(unittest.TestCase):
def setUp(self):
self.seasons = seasons.Seasons()
def test_seasons(self):
self.assertIsInstance(self.seasons.seasons, frozenset)
for ssn in se... | pymal-developers/pymal | tests/tesT_seasons.py | Python | bsd-3-clause | 1,112 |
"""Pow(x, n)
Implement pow(x,n), which calculates x raised to the the power n (x^n).
Example 1:
Input: 2.00000, 10
Output: 1024.00000
Example 2:
Input: 2.10000, 3
Output: 9.26100
Example 3:
Input: 2.00000, -2
Output: 0.25000
Explanation: 2^-2 = 1/2^2 = 1/4 = 0.25
Note:
-100.0 < x... | aiden0z/snippets | leetcode/050_Pow(x,n).py | Python | mit | 863 |
"""Find duplicate files on the file system.
Write a function duplicate_files() that takes a single argument of a directory
path (as a string) and returns a list of lists of duplicate file paths.
Example:
>>> duplicate_files('foo/bar')
[
['foo/bar/picture_1.jpg', 'foo/bar/picture_1_copy.jpg'],
['foo/bar/readm... | manahl/PythonTrainingExercises | Intermediate/DuplicateFiles/solution/DuplicateFiles.py | Python | bsd-3-clause | 2,244 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack 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/LICEN... | zestrada/nova-cs498cc | nova/tests/test_misc.py | Python | apache-2.0 | 2,249 |
'''
Speech synthesizer implementations for JSonic.
:var SYNTHS: Names paired with available ISynthesizer implementations
:type SYNTHS: dict
:requires: Python 2.6, iterpipes 0.3, espeak 1.36.02
:copyright: Peter Parente 2010
:license: BSD
'''
import iterpipes
import hashlib
import itertools
import os
class Synthesize... | uncopenweb/jsonic | server/synthesizer.py | Python | bsd-3-clause | 7,084 |
# Scanner produces tokens of the following types:
# STREAM-START
# STREAM-END
# DIRECTIVE(name, value)
# DOCUMENT-START
# DOCUMENT-END
# BLOCK-SEQUENCE-START
# BLOCK-MAPPING-START
# BLOCK-END
# FLOW-SEQUENCE-START
# FLOW-MAPPING-START
# FLOW-SEQUENCE-END
# FLOW-MAPPING-END
# BLOCK-ENTRY
# FLOW-ENTRY
# KEY
# VALUE
# AL... | muhammadfredo/FrMaya | FrMaya/vendor/yaml/scanner.py | Python | mit | 52,005 |
from importlib import import_module
import warnings
from django.core.urlresolvers import (RegexURLPattern,
RegexURLResolver, LocaleRegexURLResolver)
from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
__all__ = ['handl... | lecaoquochung/ddnb.django | django/conf/urls/__init__.py | Python | bsd-3-clause | 2,934 |
# -*- coding: utf-8 -*-
from random import choice
from django.views.generic import TemplateView
from utils import yodaize
from zen_lines import MESSAGE
__all__ = (
'IndexView',
)
class IndexView(TemplateView):
template_name = 'zen/index.html'
def get_context_data(self, **kwargs):
context = s... | averrin/emergent | zen/views.py | Python | mit | 423 |
# config/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
"""
URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2.... | wevote/WeVoteServer | config/urls.py | Python | mit | 6,666 |
# Copyright 2019 D-Wave Systems Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | oneklc/dimod | dimod/reference/composites/roofduality.py | Python | apache-2.0 | 2,998 |
#!/usr/bin/env python3
#
# Script to convert SCM AMV trajectory to xyz format trajectory
# by Patrick Melix
# 2020/10
#
# You can import the module and then call .main() or use it as a script
import sys, os, glob
from ase import io
def main(argv):
inFile = argv[0]
outFile = argv[1]
data = []
nAtoms = ... | patrickmelix/Python4ChemistryTools | amv2xyz.py | Python | mit | 993 |
#
# Migration test output result reporting
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) an... | J-Liu/qemu | tests/migration/guestperf/report.py | Python | gpl-2.0 | 3,305 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2014 Edgewall Software
# Copyright (C) 2007 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://tr... | pkdevbox/trac | sample-plugins/Timestamp.py | Python | bsd-3-clause | 1,067 |
"""Component to interface with an alarm control panel."""
from __future__ import annotations
from dataclasses import dataclass
from datetime import timedelta
import logging
from typing import Any, Final, final
import voluptuous as vol
from homeassistant.config_entries import ConfigEntry
from homeassistant.const impo... | rohitranjan1991/home-assistant | homeassistant/components/alarm_control_panel/__init__.py | Python | mit | 7,343 |
from .. import tables
__author__ = "Charles R Schmidt <schmidtc@gmail.com>"
__all__ = ['GeoDaTxtReader']
class GeoDaTxtReader(tables.DataTable):
"""GeoDa Text File Export Format
"""
__doc__ = tables.DataTable.__doc__
FORMATS = ['geoda_txt']
MODES = ['r']
def __init__(self, *args, **kwargs):
... | lixun910/pysal | pysal/lib/io/iohandlers/geoda_txt.py | Python | bsd-3-clause | 2,673 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-servicebus/azure/mgmt/servicebus/service_bus_management_client.py | Python | mit | 6,329 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2013 Roger Light <roger@atchoo.org>
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Distribution License v1.0
# which accompanies this distribution.
#
# The Eclipse Distribution Licen... | giovannicuriel/tinytools | src/python/mqtt-mirror.py | Python | bsd-2-clause | 2,670 |
"""
The temp module provides a NamedTemporaryFile that can be re-opened on any
platform. Most platforms use the standard Python tempfile.TemporaryFile class,
but MS Windows users are given a custom class.
This is needed because in Windows NT, the default implementation of
NamedTemporaryFile uses the O_TEMPORARY flag, ... | Shrews/PyGerrit | webapp/django/core/files/temp.py | Python | apache-2.0 | 2,172 |
# coding=utf8
# python code to do some molecular networking
from pprint(import PrettyPrinter)
import numpy as np
# utility function to create an edge dictionary
def create_edge_dict(scores,min_frag_overlap = 6,min_score = 0.5):
edge_dict = {}
for score_row in scores:
mol1 = score_row[0]
mol2 = score_row[1]
s... | sdrogers/ms2ldaviz | lda/code/mol_networks.py | Python | mit | 6,047 |
import pytest
import dask.array as da
from ..utils import assert_eq
xr = pytest.importorskip("xarray")
def test_mean():
y = da.mean(xr.DataArray([1, 2, 3.0]))
assert isinstance(y, da.Array)
assert_eq(y, y)
def test_asarray():
y = da.asarray(xr.DataArray([1, 2, 3.0]))
assert isinstance(y, da.Ar... | ContinuumIO/dask | dask/array/tests/test_xarray.py | Python | bsd-3-clause | 474 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This file is part of Cournal.
# Copyright (C) 2012 Fabian Henze
#
# Cournal 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, o... | KaiQ/cournal | cournal/viewer/tools/pen.py | Python | gpl-3.0 | 3,247 |
#!/usr/bin/env python
"""
kafe2 example: x_errors
=======================
kafe2 fits support the addition of x data errors - in fact we've been using them since the very first example. To take
them into account the x errors are converted to y errors via multiplication with the derivative of the model function.
In othe... | dsavoiu/kafe2 | examples/003_profiling/03_x_errors.py | Python | gpl-3.0 | 2,315 |
import _plotly_utils.basevalidators
class GridwidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="gridwidth", parent_name="layout.ternary.caxis", **kwargs
):
super(GridwidthValidator, self).__init__(
plotly_name=plotly_name,
pa... | plotly/python-api | packages/python/plotly/plotly/validators/layout/ternary/caxis/_gridwidth.py | Python | mit | 513 |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: primitive/bool.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | RobotStudio/choreo-msg | msg/primitive/bool_pb2.py | Python | gpl-3.0 | 3,176 |
class Solution(object):
def validUtf8(self, data):
"""
:type data: List[int]
:rtype: bool
"""
count = 0
for byte in data:
if count == 0:
if (byte >> 5) == 0b110:
count = 1
elif (byte >> 4) == 0b1110:
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/393_UTF-8_Validation.py | Python | mit | 637 |
from django.db.models import F
from django.utils import timezone
from misago.threads.permissions import exclude_invisible_threads
from . import signals
from .dates import is_date_tracked
from .models import CategoryRead
__all__ = ['make_read_aware', 'sync_record']
def make_read_aware(user, categories):
if not... | 1905410/Misago | misago/readtracker/categoriestracker.py | Python | gpl-2.0 | 3,587 |
# ***************************************************************************
# * (c) 2009 Yorik van Havre <yorik@uncreated.net> *
# * (c) 2010 Ken Cline <cline@frii.com> *
# * (c) 2020 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * ... | Fat-Zer/FreeCAD_sf_master | src/Mod/Draft/draftguitools/gui_rectangles.py | Python | lgpl-2.1 | 9,304 |
import datetime
import time
import website.processing
def get_laststatusloop():
try:
f = file('/home/pi/data/laststatusloop','r')
s = f.read()
f.close()
dt = datetime.datetime.strptime(s, '%Y%m%d%H%M%S')
return dt
except:
print ">> rebooter: !!! failed to read la... | omargammoh/rpislave | website/proc/rebooter.py | Python | gpl-2.0 | 1,426 |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.endpoints.access_token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the access token provider logic of
OAuth 1.0 RFC 5849. It validates the correctness of access token requests,
creates and persists tokens as well as create the p... | javier-ruiz-b/docker-rasppi-images | raspberry-google-home/env/lib/python3.7/site-packages/oauthlib/oauth1/rfc5849/endpoints/access_token.py | Python | apache-2.0 | 9,405 |
import os
import subprocess
import urllib
import orjson
from django.conf import settings
from django.http import HttpRequest, HttpResponse
from django.shortcuts import redirect, render
from django.views.decorators.http import require_safe
from confirmation.models import Confirmation, confirmation_url
from zerver.lib.... | showell/zulip | zerver/views/development/email_log.py | Python | apache-2.0 | 5,278 |
from collections import deque
import copy, time
timer, pagesize=0, 2
timeout=None
processlist=None
opt_page_seq=[]
pmem, smem=None, None
Readyqueue=None
class BarebonesPage(list):
def __init__(self, instruction):
super(BarebonesPage, self).append(instruction)
self.ts=time.time()
self.fifots=self.ts
def upda... | Coldsp33d/memory-simulator | opt_module.py | Python | unlicense | 6,374 |
import os
from gitviewfs_objects import CommitsProvider
from tests.structs.default import paths
from tests.structs.default.utils import BaseDefaultDirStructTest,\
BaseDefaultDirStructIntegrationTest
class CommitsDirPathTest(BaseDefaultDirStructTest):
def test_path(self):
self.assertPathIsDirectoryWithProvider(p... | erdavila/gitviewfs | tests/structs/default/test_commits_dir.py | Python | mit | 580 |
"""
An example for the usage of SMAC within Python.
We optimize a simple SVM on the IRIS-benchmark.
"""
import logging
import numpy as np
from ConfigSpace.conditions import InCondition
from ConfigSpace.hyperparameters import CategoricalHyperparameter, \
UniformFloatHyperparameter, UniformIntegerHyperparameter
fro... | automl/SpySMAC | test/test_files/svm.py | Python | bsd-3-clause | 5,176 |
import aurora.nn
import aurora.optim
import aurora.datasets
__all__ = ['nn', 'optim', 'datasets']
try:
from aurora.ndarray import gpu_op
__all__.append("ndarray")
except ImportError:
pass
| upul/Aurora | aurora/__init__.py | Python | apache-2.0 | 203 |
#!/usr/bin/env python2
#
# Copyright 2015-2016 Carnegie Mellon University
#
# 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 require... | lodemo/CATANA | src/external/lfw-classification-ext.py | Python | mit | 19,938 |
# vim: set ts=4 sw=4 expandtab:
from ApplicationConstants import Notification
from pyjamas.ui.DockPanel import DockPanel
from pyjamas.ui.RootPanel import RootPanelCls
from pyjamas.ui.MenuBar import MenuBar
from pyjamas.ui.MenuItem import MenuItem
from pyjamas.ui.VerticalPanel import VerticalPanel
from pyjamas.ui.Bu... | certik/pyjamas | examples/timesheet/view/components/AppFrame.py | Python | apache-2.0 | 1,055 |
def solution():
T = int(input())
for t in range(1, T+1):
solve(t)
# O(N^2)
def solve(t):
n, k = map(int, input().split(' '))
num = []
for i in range(4):
num.append(list(map(int, input().split(' '))))
dicX, dicY = {}, {}
for a in num[0]:
for b in num[1]:
x ... | sogapalag/problems | google-apac/Google-APAC-2017-University-Test/Practice-Round-APAC-test-2017/B.Robot-Rock-Band.py | Python | mit | 748 |
import json
import urllib3
from bs4 import BeautifulSoup
import os
import codecs
import genson
#create json schema from raw json data
class PersonModelExtractor:
def __init__(self):
self._schema = genson.Schema()
def extractFrom(self, dir):
if os.path.exists(dir):
dataFiles = os.li... | chapayGhub/Memorial | python/memorial/personmodelextractor.py | Python | mit | 1,019 |
""" This module contains functions to help parse the changes in a notice.
Changes are the exact details of how the pargraphs, sections etc. in a
regulation have changed. """
import logging
import copy
from collections import defaultdict
from regparser.grammar import amdpar
from regparser.grammar.tokens import Verb
f... | cmc333333/regulations-parser | regparser/notice/changes.py | Python | cc0-1.0 | 13,518 |
# -*- coding: utf-8 -*-
"""Status text processor
"""
import re
import regex
from enum import Enum
from functools import reduce
from bs4 import BeautifulSoup
from .exception import StatusTextError
class TextType(Enum):
WORDS = 0
URL = 1
HASHTAG = 2
class SplitedText(object):
def __init__(self, text... | vocalodon/dontwi | dontwi/status_text.py | Python | gpl-3.0 | 9,749 |
#!/usr/bin/python
#
# Copyright (c) 2016 Juniper Networks, Inc.
#
# author: Sanju Abraham
#
# This sceipt is called by the vrouter agent for CRUD
# of IPSEC tunnels
import argparse
import ConfigParser
import json
import logging
import requests
import sys
import time
import socket
from passlib.hash import sha256_crypt
... | rombie/contrail-controller | src/vnsw/agent/contrail/contrail_crypt_tunnel_client.py | Python | apache-2.0 | 5,208 |
from typing import NamedTuple, Optional
class OnlineDatabaseObjectsListItem(NamedTuple):
detail_href: str
record_type: str
title: str
thumbnail_url: Optional[str] = None
| minorg/pastpy | pastpy/impl/online/online_database_objects_list_item.py | Python | bsd-2-clause | 188 |
"""
Google app engine made local unit testing a pain
ImportError: No module named appengine.ext
so I'm flying blind on many parts
"""
import unittest
#import main
from app.hasher import gen_salt, hash_this, check_hash
'''class SanityTest(unittest.TestCase):
"""testing sanity"""
def setUp(self):
pass
... | timBrockman/fsnd-p2-mublog | main_test.py | Python | mit | 1,360 |
#!/usr/bin/python
#
# 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 distribut... | wrouesnel/ansible | lib/ansible/modules/network/nxos/nxos_vrf.py | Python | gpl-3.0 | 15,189 |
# #######
# Copyright (c) 2015 GigaSpaces Technologies 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
#
# Unles... | cloudify-cosmo/cloudify-host-pool-plugin | cloudify_hostpool_plugin/tests/test_tasks.py | Python | apache-2.0 | 9,618 |
#!/usr/bin/env python
"""
Migration from moin--main--1.3 pre patch-332 to post patch-332.
In patch-332 we changed the format of page lists in user data file. They
are now tab separated instead of comma separated, and page names are not
quoted using file system quoting.
You can run the script multiple times wi... | Glottotopia/aagd | moin/local/moin/build/lib.linux-x86_64-2.6/MoinMoin/script/old/migration/12_to_13_mig09.py | Python | mit | 4,931 |
# Copyright 2010-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... | dims/glance | glance/tests/unit/test_context.py | Python | apache-2.0 | 6,208 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import copy
from voluptuous import Required
from taskgraph.task import Task
from taskgraph.util.attributes import sor... | mozilla-mobile/focus-android | taskcluster/focus_android_taskgraph/loader/multi_dep.py | Python | mpl-2.0 | 3,307 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODE... | allcaps/tvdordrecht.nl | tvdordrecht/training/migrations/0001_initial.py | Python | mit | 4,179 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | Stargrazer82301/CAAPR | CAAPR/CAAPR_AstroMagic/PTS/pts/do/fitskirt/__init__.py | Python | mit | 591 |
# Django settings for django_rt project.
import os
PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Ivan Metzlar', 'metzlar@gmail.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresq... | vistacan/django-rt | django_rt/settings.py | Python | mit | 5,756 |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from tests import IntegrationTestCase
from tests.holodeck import Request
from twilio.base.exceptions import TwilioException
from twilio.http.response import Response
class FieldTypeTestCase(Integra... | tysonholub/twilio-python | tests/integration/preview/understand/assistant/test_field_type.py | Python | mit | 9,896 |
# -*- coding: utf-8 -*-
#
# Apache Libcloud documentation build configuration file, created by
# sphinx-quickstart on Wed Jul 31 12:16:27 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.... | sgammon/libcloud | docs/conf.py | Python | apache-2.0 | 8,297 |
#
from numpy import array, dot
#########################################################
# WORLDVERT class
#########################################################
class worldvert:
def __init__(self, x=0, y=0, z=0, description='', DEBUG=0):
self.tr = array([x,y,z,1]) # tr = "translate position"
se... | EducationalTestingService/VAMP | bvh/BVHplay/geo.py | Python | mit | 11,297 |
from mhz14 import mhz14
# Important: UART enable in /boot/config.txt !!
# configure the serial connections (the parameters differs on the device you are connecting to)
# /dev/ttyUSB0 is used, if USB Console Cable is connected
# Raspberry Pi3: /dev/ttyS0, else /dev/ttyAMA0
sensor=mhz14.mhz14("/dev/ttyS0")
prin... | JuFoESS/MH-Z14 | Example.py | Python | gpl-3.0 | 342 |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from telemetry.page import page as page_module
from telemetry.page.actions import scroll
from telemetry.test import tab_test_case
class Scroll... | codenote/chromium-test | tools/telemetry/telemetry/page/actions/scroll_unittest.py | Python | bsd-3-clause | 3,924 |
# -*- coding: utf-8 -*-
#
# buchner documentation build configuration file, created by
# sphinx-quickstart on Sun Mar 31 14:35:13 2013.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# A... | rehandalal/buchner | docs/conf.py | Python | bsd-3-clause | 7,703 |
import os
import sys
import operator
import numpy as np
import pandas as pd
from scipy import sparse
import xgboost as xgb
from sklearn import model_selection, preprocessing, ensemble
from sklearn.metrics import log_loss
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
def runXGB(train_X, ... | shengqiu/renthop | crossValidation.py | Python | gpl-2.0 | 4,448 |
"""
Widget displaying an image histogram along with gradient editor. Can be used to adjust the appearance of images.
This is a wrapper around HistogramLUTItem
"""
from pyqtgraph.Qt import QtGui, QtCore
from GraphicsView import GraphicsView
from pyqtgraph.graphicsItems.HistogramLUTItem import HistogramLUTItem
__all__ ... | robertsj/poropy | pyqtgraph/widgets/HistogramLUTWidget.py | Python | mit | 949 |
"""Elements for Figure S1B from the PySB publication"""
from __future__ import print_function
from pysb import *
from pysb.macros import catalyze_one_step
from pysb.bng import generate_network, generate_equations
import re
Model()
Monomer('C8', ['bf'])
Monomer('Bid', ['bf', 'state'], {'state': ['U', 'T']})
kf = Par... | LoLab-VU/pysb | pysb/examples/paper_figures/figS1b.py | Python | bsd-2-clause | 1,279 |
import os
import sys
STAGE_PRODUCT = 'firefox'
STAGE_USERNAME = 'ffxbld'
STAGE_SSH_KEY = 'ffxbld_dsa'
config = {
#########################################################################
######## WINDOWS GENERIC CONFIG KEYS/VAlUES
# if you are updating this with custom 32 bit keys/values please add them
... | escapewindow/mozharness | configs/builds/releng_base_windows_32_builds.py | Python | mpl-2.0 | 4,533 |
"""SCons.Tool.Packaging.tarbz2
The tarbz2 SRC packager.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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... | BenLand100/rat-pac | python/SCons/Tool/packaging/tarbz2.py | Python | bsd-3-clause | 1,795 |
# -*- 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... | OpusVL/odoo | addons/pos_restaurant/restaurant.py | Python | agpl-3.0 | 5,595 |
"""Brython templating engine.
Templates in HTML pages can include:
- Python code blocks:
<tr b-code="for item in items">
...
</tr>
- Python expressions:
{message}
- tag attributes:
<option value="{name}", selected="{name===expected}">
- inclusion of subtemplates:
<div b-include="men... | kikocorreoso/brython | www/src/Lib/browser/template.py | Python | bsd-3-clause | 10,901 |
__author__ = 'jeffrey'
from django import forms
from django.contrib.auth.models import User # fill in custom user info then save it
from django.contrib.auth.forms import UserCreationForm
class MyRegistrationForm(UserCreationForm):
username = forms.RegexField(label=("Username"), max_length=30, regex=r'^[\w.@+-]+... | cloudiirain/onigiri | account/forms.py | Python | gpl-3.0 | 754 |
from django.db.models.indexes import Index
def get_constraints(self, cursor, table_name):
"""
Retrieve any constraints or keys (unique, pk, fk, check, index) across
one or more columns. Also retrieve the definition of expression-based
indexes.
"""
constraints = {}
# Loop over the key table... | tomturner/django-tenants | django_tenants/postgresql_backend/_constraints.py | Python | mit | 4,362 |
import unittest
from rtruffle.node import Node
class NodeTest(unittest.TestCase):
def test_adopt_child(self):
child = ChildNode()
parent = RootNode()
self.assertIsNone(child.parent)
parent.adopt_child(child)
self.assertIs(parent, child.parent)
def test_adopt_children... | SOM-st/PySOM | tests/rtruffle_tests/test_node.py | Python | mit | 2,292 |
#!/usr/bin/env python
from Bio.SeqIO import *
import tempfile
import shutil
from os.path import join as j
import xml.etree.ElementTree as xml
def mean(l):
return float(sum(l)) / float(len(l))
def trim( reads1, trimmer_args=200, reads2=None, callback=lambda s, **v: None, assembler=lambda d: None, debug=False, **kwar... | crashfrog/Dispatch | ten_each_end_trimmer.py | Python | unlicense | 2,583 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/v2016_03_30/models/virtual_machine_image.py | Python | mit | 2,403 |
""" Timer
inspired by
http://stackoverflow.com/questions/5849800/tic-toc-functions-analog-in-python
Usage :
with Timer('foo_stuff'):
# do some foo
# do some stuff
"""
import time
from constant import *
class Timer(object):
def __init__(self, name=None):
self.name = name
def __ent... | cyrobin/patrolling | timer.py | Python | bsd-3-clause | 580 |
#!/usr/bin/env python
#
# Copyright (c) 2020 by VMware, Inc. ("VMware")
# Used Copyright (c) 2018 by Network Device Education Foundation,
# Inc. ("NetDEF") in this file.
#
# Permission to use, copy, modify, and/or distribute this software
# for any purpose with or without fee is hereby granted, provided
# that the abo... | freerangerouting/frr | tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py | Python | gpl-2.0 | 229,521 |
# OpenShot Video Editor is a program that creates, modifies, and edits video files.
# Copyright (C) 2009 Jonathan Thomas
#
# This file is part of OpenShot Video Editor (http://launchpad.net/openshot/).
#
# OpenShot Video Editor is free software: you can redistribute it and/or modify
# it under the terms of the GNU G... | i5o/openshot-sugar | openshot/openshot/blender/scripts/neon_curves.py | Python | gpl-3.0 | 5,877 |
"""
----------------------------------------------------------------------
Authors: Jan-Justin van Tonder
----------------------------------------------------------------------
Unit tests for the SA ID book module.
----------------------------------------------------------------------
"""
import pytest
from hutts_veri... | javaTheHutts/Java-the-Hutts | src/unittest/python/test_sa_id_book.py | Python | bsd-3-clause | 11,076 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.