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 |
|---|---|---|---|---|---|
''' Code for running Gridlab and getting results into pythonic data structures. '''
from __future__ import print_function
import sys, os, subprocess, platform, re, datetime, shutil, traceback, math, time, tempfile, json
from os.path import join as pJoin
from copy import deepcopy
# Locational variables so we don't hav... | dpinney/omf | omf/solvers/gridlabd_gridballast/__init__.py | Python | gpl-2.0 | 10,839 |
"""
Views related to operations on course objects
"""
import copy
from django.shortcuts import redirect
import json
import random
import logging
import string # pylint: disable=deprecated-module
from django.utils.translation import ugettext as _
import django.utils
from django.contrib.auth.decorators import login_requ... | hamzehd/edx-platform | cms/djangoapps/contentstore/views/course.py | Python | agpl-3.0 | 67,900 |
# Copyright 2019 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... | ppwwyyxx/tensorflow | tensorflow/lite/testing/op_tests/logic.py | Python | apache-2.0 | 3,152 |
import unittest
from flask.ext.imagine.filters.interface import ImagineFilterInterface
class TestImagineFilterInterface(unittest.TestCase):
interface = None
def setUp(self):
self.interface = ImagineFilterInterface()
def test_not_implemented_apply_method(self):
with self.assertRaises(NotI... | FlaskGuys/Flask-Imagine | tests/filters/test_interface.py | Python | mit | 375 |
import sys
from unittest.case import SkipTest
from batchy.compat import PY3
from batchy.local import RunLoopLocal
from batchy.runloop import coro_return, runloop_coroutine, deferred, future, current_run_loop, wait
from . import BaseTestCase
@runloop_coroutine()
def increment(arg):
coro_return(arg + 1)
yield
... | mikekap/batchy | tests/runloop_tests.py | Python | apache-2.0 | 9,494 |
import numpy as np
import scipy.linalg
from scipy.sparse import csc_matrix
from scipy.optimize._trustregion_constr.projections \
import projections, orthogonality
from numpy.testing import (TestCase, assert_array_almost_equal,
assert_equal, assert_allclose)
try:
from sksparse.cholmod... | WarrenWeckesser/scipy | scipy/optimize/_trustregion_constr/tests/test_projections.py | Python | bsd-3-clause | 8,820 |
#!/usr/bin/env python
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
#
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/... | injcristianrojas/heartbleed-example | heartbleed.py | Python | mit | 17,715 |
# -*- coding: utf-8 -*-
"""
eve.methods
~~~~~~~~~~~
This package implements the HTTP methods supported by Eve.
:copyright: (c) 2015 by Nicola Iarocci.
:license: BSD, see LICENSE for more details.
"""
# flake8: noqa
from eve.methods.get import get, getitem
from eve.methods.post import post
from e... | eduardomb/eve | eve/methods/__init__.py | Python | bsd-3-clause | 432 |
"""
The main script
"""
import argparse
import summaryrank.features
import summaryrank.importers
import summaryrank.tools
DESCRIPTION = '''
SummaryRank is a set of tools that help producing machine-learned
summary/sentence rankers. It supports a wide range of functions such
as generating judgments in trec_eval forma... | rmit-ir/SummaryRank | summaryrank/__main__.py | Python | mit | 2,623 |
import os
import sys
import shutil
import tools
import subprocess
import helpers
sys.path.insert(0,"../..")
def list_to_str(l):
ans=""
if len(l)==0:
return ans
for i in range(0,len(l)-1):
ans+=l[i]+"\n"
ans+=l[len(l)-1]
return ans
def test():
print "test"
def pwd():
... | log4leo/Shell4Win | src/utilities.py | Python | mit | 4,412 |
import asyncio
import aiozmq
import zmq
async def monitor_stream(stream):
try:
while True:
event = await stream.read_event()
print(event)
except aiozmq.ZmqStreamClosed:
pass
async def go():
router = await aiozmq.create_zmq_stream(zmq.ROUTER, bind="tcp://127.0.0.1:... | aio-libs/aiozmq | examples/stream_monitor.py | Python | bsd-2-clause | 919 |
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM 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... | afrolov1/nova | nova/tests/integrated/v3/test_admin_password.py | Python | apache-2.0 | 1,153 |
#!/usr/bin/env python
# Output formatters (for printing info and data files)
#
# Copyright (C) 2014 Peter Wu <peter@lekensteyn.nl>
import math
from defs import info, data
# Python 2.7 compatibility
if b'' == '':
import functools, itertools
iterbytes = functools.partial(itertools.imap, ord)
else:
iterbytes... | Lekensteyn/el4000 | printers.py | Python | mit | 3,032 |
from django.core.urlresolvers import reverse
import django.http
import django.utils.simplejson as json
import functools
def make_url(request, reversible):
return request.build_absolute_uri(reverse(reversible))
def json_output(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
output = ... | ukch/online_sabacc | src/sabacc/api/viewhelpers.py | Python | gpl-3.0 | 494 |
from textwrap import wrap
import matplotlib.gridspec as gridspec
import matplotlib.pyplot as plt
import numpy as np
from flask import current_app
from flask_babel import gettext
from netCDF4 import Dataset, chartostring
import plotting.utils as utils
from plotting.plotter import Plotter
class Class4Plotter(Plotter)... | DFO-Ocean-Navigator/Ocean-Data-Map-Project | plotting/class4.py | Python | gpl-3.0 | 10,590 |
#!/usr/bin/env python3
# Copyright (c) 2017 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 deprecation of RPC calls."""
from test_framework.test_framework import BitcoinTestFramework
class Depr... | TheBlueMatt/bitcoin | test/functional/rpc_deprecated.py | Python | mit | 1,498 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Streamz documentation build configuration file, created by
# sphinx-quickstart on Wed Apr 12 18:41:31 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
# au... | jrmlhermitte/streamz | docs/source/conf.py | Python | bsd-3-clause | 5,154 |
"""
Tests of RPI-specific functionality (adapters and sensors).
"""
import asyncio
import unittest
import platform
from utils import ValueListSensor
from thingflow.base import Scheduler, SensorAsOutputThing
import thingflow.filters.map
from thingflow.filters.output import output
from thingflow.filters.combinators imp... | mpi-sws-rse/thingflow-python | tests/test_rpi_adapters.py | Python | apache-2.0 | 1,694 |
"""tsbp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based ... | lvercelli/pytsbp | tsbp/urls.py | Python | mit | 903 |
# HealthPotion.py Health potion item.
# Copyright Kevin Smith 2007.
#
# This file is part of HelHack.
#
# HelHack 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 ... | Kev/helhack | src/item/HealthPotion.py | Python | gpl-3.0 | 973 |
#!/usr/bin/env python
"""
.. py:currentmodule:: pymcxray.FileFormat.Results.test_XraySpectraRegionEmitted
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module `XraySpectraRegionEmitted`.
"""
# Script information for the file.
__author__ = "Hendrix Demers (hendrix.demers@mail.mcgill.ca... | drix00/pymcxray | pymcxray/FileFormat/Results/test_XraySpectraRegionEmitted.py | Python | apache-2.0 | 13,861 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2015 Craig Anderson
#
# 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 opt... | beernarrd/gramps | gramps/plugins/lib/librecurse.py | Python | gpl-2.0 | 18,750 |
"""
Google OpenID and OAuth support
OAuth works straightforward using anonymous configurations, username
is generated by requesting email to the not documented, googleapis.com
service. Registered applications can define settings GOOGLE_CONSUMER_KEY
and GOOGLE_CONSUMER_SECRET and they will be used in the auth process.
... | marco-lancini/Showcase | social_auth/backends/google.py | Python | mit | 9,593 |
# Copyright (C) 2009, 2010, 2011 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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... | linostar/timeline-clone | release/buildtool/build.py | Python | gpl-3.0 | 11,324 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | b1-systems/kiwi | kiwi/system/kernel.py | Python | gpl-3.0 | 5,751 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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... | reactormonk/eve-wspace | evewspace/POS/templatetags/posstatus.py | Python | gpl-3.0 | 1,782 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import base64
import uuid
import pycurl
from module.network.HTTPRequest import BadHeader
from module.network.RequestFactory import getRequest as get_request
from module.plugins.internal.Addon import Addon
from module.plugins.internal.misc import threaded
... | rlindner81/pyload | module/plugins/hooks/ExpertDecoders.py | Python | gpl-3.0 | 3,102 |
# This implements the "diagnose-unwind" command, usually installed
# in the debug session like
# command script import lldb.diagnose
# it is used when lldb's backtrace fails -- it collects and prints
# information about the stack frames, and tries an alternate unwind
# algorithm, that will help to understand why lldb... | s20121035/rk3288_android5.1_repo | external/lldb/examples/python/diagnose_unwind.py | Python | gpl-3.0 | 11,798 |
'''
Created on Nov 3, 2016
The set of cards in the deck
@author: mjw
'''
from random import randint
from .Baron import Baron
from .Countess import Countess
from .Prince import Prince
from .Priest import Priest
from .Princess import Princess
from .King import King
from .Guard import Guard
from .Handmaid import Handmai... | matthewjwolff/LoveLetter | engine/Deck.py | Python | gpl-3.0 | 1,402 |
# -*- coding: utf-8 -*-
# +---------------------------------------------------------------------------+
# | 01001110 01100101 01110100 01111010 01101111 01100010 |
# | |
# | Netzob : Inferring communication prot... | dasbruns/netzob | src/netzob/Common/Models/Vocabulary/Domain/Variables/Nodes/Repeat.py | Python | gpl-3.0 | 11,690 |
#!/usr/bin/env python
"""Full set of annotations can be used to set TermCounts. No need to break it up."""
# https://github.com/tanghaibao/goatools/issues/88
from __future__ import print_function
import os
import sys
from goatools.semantic import TermCounts
from goatools.base import get_godag
from goatools.associatio... | tanghaibao/goatools | tests/semantic_ns.py | Python | bsd-2-clause | 1,596 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
import xmodule_django.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations ... | nttks/edx-platform | lms/djangoapps/bulk_email/migrations/0001_initial.py | Python | agpl-3.0 | 3,047 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLocator.
.. 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 Foundation; either version 2 of the License, or
(at your option) any later version.
"""
__auth... | pblottiere/QGIS | tests/src/python/test_qgslocator.py | Python | gpl-2.0 | 17,778 |
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
from datetime import date, datetime, timedelta
from icalendar import Calendar, Event, vRecur
import json
import os.path
from os.path import dirname
from uuid import uuid4
class iCalSchedule(object):
DAYS = ['MO', 'TU', 'WE', 'TH', 'FR', 'SA', 'SU']
def __init_... | bfontaine/edt2ics | edt2ics/ical.py | Python | mit | 3,060 |
# -*- coding: utf-8 -*-
import unittest
from .base import BaseComposedPermission
from .base import BasePermissionComponent
from .base import And, Or
def create_component(value, instance=False):
class SimpleComponent(BasePermissionComponent):
def has_permission(self, permission, request, view):
... | pombredanne/djangorestframework-composed-permissions | restfw_composed_permissions/tests.py | Python | bsd-3-clause | 7,449 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
import pytest
from ansible.module_utils.common import warnin... | dmsimard/ansible | test/units/module_utils/basic/test_deprecate_warn.py | Python | gpl-3.0 | 3,387 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ceph_db_viewer.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| accelazh/ceph_db_viewer | manage.py | Python | mit | 257 |
from __future__ import absolute_import
from . import TypeSlots
from .ExprNodes import not_a_constant
import cython
cython.declare(UtilityCode=object, EncodedString=object, BytesLiteral=object,
Nodes=object, ExprNodes=object, PyrexTypes=object, Builtin=object,
UtilNodes=object)
from . imp... | ABcDexter/cython | Cython/Compiler/Optimize.py | Python | apache-2.0 | 169,504 |
from nose.tools import ok_, eq_
from dxr.testing import DxrInstanceTestCaseMakeFirst
LATEST_REVISION = "5e2b2b554eb86f90e189217fa9dc2eba66259910"
PREVIOUS_REVISION = "cb339834998124cb8165aa35ed4635c51b6ac5c2"
class GitTests(DxrInstanceTestCaseMakeFirst):
"""Test our Git integration, both core and omniglot."""
... | bozzmob/dxr | tests/test_vcs_git/test_vcs_git.py | Python | mit | 3,300 |
'''
Created on Feb 26, 2010
@author: ivan
'''
def size2text(size):
if size > 1024 * 1024 * 1024:
return "%.2f Gb" % (size / (1024 * 1024 * 1024.0))
if size > 1024 * 1024:
return "%.2f Mb" % (size / (1024 * 1024.0))
if size > 1024:
return "%.2f Kb" % (size / 1024.0)
return size
... | foobnix/foobnix | foobnix/util/time_utils.py | Python | gpl-3.0 | 803 |
# -*- coding: utf8 -*-
from itertools import groupby
from django.core.paginator import EmptyPage
from django.db.models import Count
from django.utils.translation import ugettext_lazy as _
__all__ = 'GroupedQuerySetLaxPage', 'GroupedQuerySetLaxPaginator', 'EmptyPage'
class GroupedQuerySetLaxPage(object):
def _... | k0001/django-gqslpagination | django_gqslpagination/__init__.py | Python | bsd-3-clause | 6,640 |
# 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://apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwa... | googlecodelabs/analyze_gsimg | alt/analyze_gsimg-newauth.py | Python | apache-2.0 | 7,125 |
# Copyright 2012 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Django command: start a database shell.
Overrides the default implementation.
"""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)... | cloudbase/maas | src/maasserver/management/commands/dbshell.py | Python | agpl-3.0 | 852 |
# Higgins - A multi-media server
# Copyright (c) 2007-2009 Michael Frank <msfrank@syntaxjockey.com>
#
# This program is free software; for license information see
# the COPYING file.
from higgins.logger import Loggable
class UPnPLogger(Loggable):
log_domain = "upnp"
logger = UPnPLogger()
| msfrank/Higgins | higgins/upnp/logger.py | Python | lgpl-2.1 | 296 |
"""Pluggable module registries
Copyright (C) 2014, Digium, Inc.
Kinsey Moore <kmoore@digium.com>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
"""
import logging
import re
LOGGER = logging.getLogger(__name__)
class PluggableRegistry(object):
"""Registry... | asterisk/testsuite | lib/python/asterisk/pluggable_registry.py | Python | gpl-2.0 | 1,893 |
DEFAULT_BOX = ('precise64', 'http://files.vagrantup.com/precise64.box') | pdiazv/minty | mt-vagrant/mt_vagrant/settings.py | Python | mit | 71 |
"""
===========================================================
A demo of K-Means clustering on the handwritten digits data
===========================================================
In this example with compare the various initialization strategies for
K-means in terms of runtime and quality of the results.
As the ... | soulmachine/scikit-learn | examples/cluster/plot_kmeans_digits.py | Python | bsd-3-clause | 4,526 |
"""
Utils to be used by third_party_auth app.
This helps to reduce merge conflicts.
"""
import re
from random import randrange
from django.conf import settings
def clean_username(suggested_username):
"""
Cleans the username if APPSEMBLER_FEATURES.ENABLE_THIRD_PARTY_AUTH_CLEAN_USERNAMES is set.
if the F... | gymnasium/edx-platform | common/djangoapps/appsembler/third_party_auth_utils.py | Python | agpl-3.0 | 2,066 |
from enum import Enum
from collections import namedtuple
import settings
import os
import dbaccess
import urllib.request
import ast
import shutil
def move_file(filename, src, dest):
src = os.path.join(src, filename)
dest = os.path.join(dest, filename)
shutil.move(src, dest)
def create_file(filename, path... | thyagostall/apollo | src/problem.py | Python | mit | 6,320 |
#
# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
#
# 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 distributed in the hope... | ioggstream/mysql-utilities | mysql/utilities/common/binary_log_file.py | Python | gpl-2.0 | 14,122 |
"""
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 use this ... | arenadata/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.0/hooks/before-ANY/scripts/shared_initialization.py | Python | apache-2.0 | 7,546 |
from bin.main import Main
import os
if __name__ == "__main__":
absolute_path = os.path.abspath(__file__)
directory = os.path.dirname(absolute_path)
os.chdir(directory)
Main().run()
| rCorvidae/OrionPI | src/OrionPI.py | Python | mit | 200 |
import _plotly_utils.basevalidators
class AlignsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(
self, plotly_name="alignsrc", parent_name="pointcloud.hoverlabel", **kwargs
):
super(AlignsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_... | plotly/python-api | packages/python/plotly/plotly/validators/pointcloud/hoverlabel/_alignsrc.py | Python | mit | 469 |
# Copyright 2015 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... | tensorflow/tensorflow | tensorflow/python/ops/ragged/ragged_factory_ops_test.py | Python | apache-2.0 | 5,128 |
import psycopg2
import scipy.io
import os
# Set to true if you want to query tables before adding data:
queryConfigs = False
queryTimeSeries = False
# Create a connection to RoboticBicycle database
conn = psycopg2.connect(database="robot_bicycle_parameters", user="hazelnusse")
cur = conn.cursor()
def insert_statemen... | hazelnusse/robot.bicycle | data/physicalparameters/RawData/PeriodMeasurements/RearWheel/populateTable.py | Python | bsd-2-clause | 2,289 |
store_contents = {
'bagone': ['testsrc/test.tid', 'testsrc/file.css']
}
| tiddlyweb/tiddlywebplugins.ibuilder | testpackage/instance.py | Python | bsd-3-clause | 76 |
from django.conf import settings
from django.contrib.admin.widgets import AdminTextareaWidget
from django.forms.utils import flatatt
from django.forms.widgets import Widget
from django.template.loader import render_to_string
from django.utils.encoding import smart_text
from django.utils.html import escape
from django.u... | edoburu/django-fluent-contents | fluent_contents/forms/widgets.py | Python | apache-2.0 | 3,830 |
#coding=utf-8
import time
import threading
class ConnectionPool(object):
def __init__(self, connection_class, args, kwargs=None, max_size=5):
self.connection_class = connection_class
self._args = args
self._kwargs = kwargs
self.max_size = max_size
self._size = 0
se... | seraphlnWu/in_trip | in_trip/in_trip/lib/pool.py | Python | mit | 1,892 |
from __future__ import absolute_import
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.comments import signals
from django.contrib.comments.models import Comment
from . import CommentTestCase
from ..models import Article, Book
post_redirect_re = re.compile... | lisael/pg-django | tests/regressiontests/comment_tests/tests/comment_view_tests.py | Python | bsd-3-clause | 11,790 |
# -*- coding: utf-8 -*-
# Copyright 2016 Bruno Cauet
# Split an album-file in tracks thanks a cue file
from __future__ import division, absolute_import, print_function
import subprocess
from os import path
from glob import glob
from beets.util import command_output, displayable_path
from beets.plugins import BeetsPl... | clinton-hall/nzbToMedia | libs/common/beetsplug/cue.py | Python | gpl-3.0 | 1,898 |
import hashlib
import sys
import datetime
class EmailObject:
def __init__(self, sender, date, subject, body):
self.sender = sender
self.date = datetime.datetime.strptime(date[5:25], '%d %b %Y %H:%M:%S') #TODO: FIX THIS CODE TO BE MORE ROBUST
self.body = body
self.subject = subject
... | liamneath1/SUMOWaferBackend | PythonBackend/EmailObject.py | Python | mit | 1,333 |
"""
Specialization of einops for torch.
Unfortunately, torch's jit scripting mechanism isn't strong enough,
and to have scripting supported at least for layers,
a number of changes is required, and this layer helps.
Importantly, whole lib is designed so that you can't use it
"""
from typing import Dict, List
import... | arogozhnikov/einops | einops/_torch_specific.py | Python | mit | 2,804 |
# -*- coding: utf-8 -*-
from functools import wraps
import os.path
import click
import ndef
version_message = '%%(prog)s %%(version)s (ndeflib %s)' % ndef.__version__
command_plugins = os.path.join(os.path.dirname(__file__), 'commands')
def echo(*args, **kwargs):
click.echo(*args, **kwargs)
def info(*args):
... | nfcpy/ndeftool | src/ndeftool/cli.py | Python | isc | 5,162 |
"""
Python Interchangeable Virtual Instrument Library
Copyright (c) 2012-2016 Alex Forencich
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... | Diti24/python-ivi | ivi/agilent/agilent3000A.py | Python | mit | 6,792 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-production | mrp_future_used_material/__init__.py | Python | agpl-3.0 | 1,054 |
# pylint: disable=too-many-lines
"""
Component to interface with cameras.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/camera/
"""
import asyncio
import logging
from aiohttp import web
from homeassistant.helpers.entity import Entity
from homeassista... | srcLurker/home-assistant | homeassistant/components/camera/__init__.py | Python | mit | 5,960 |
import os
os.system('cls')
opcao = 'c'
while opcao == 'c':
print("Opcao ==> c")
opcao = input("digite uma opcao: ") | ronas/PythonGNF | Artur/ExRev06.py | Python | gpl-3.0 | 132 |
#
# Copyright (c) 2008--2011 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 c... | hustodemon/spacewalk | client/rhel/rhnlib/rhn/rhnLockfile.py | Python | gpl-2.0 | 3,331 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Module for Latent Semantic Analysis (aka Latent Semantic Indexing) in Python.
Implements fast truncated SVD (Singular Value Decomp... | akutuzov/gensim | gensim/models/lsimodel.py | Python | lgpl-2.1 | 34,447 |
###############################################################################
##
## Copyright (c) Crossbar.io Technologies GmbH
##
## 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... | tavendo/AutobahnTestSuite | autobahntestsuite/autobahntestsuite/case/case2_7.py | Python | apache-2.0 | 1,300 |
from snippets.models import Snippet
from snippets.serializers import SnippetSerializer, UserSerializer
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from rest_framework import mixins
from rest_framework import gene... | nimiq/test-django-rest | snippets/views.py | Python | apache-2.0 | 7,781 |
## Bokeh server for button click
from bokeh.io import curdoc
from bokeh.layouts import row
from bokeh.models import Button, ColumnDataSource
from bokeh.plotting import figure
x=[3,4,6,12,10,1]
y=[7,1,3,4,1,6]
source = ColumnDataSource(data=dict(x=x, y=y))
plot_figure = figure(height=450, width=600,
to... | bokeh/bokeh | examples/reference/models/button_server.py | Python | bsd-3-clause | 750 |
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_nonbonded_type import AbstractNonbondedType
class LjCNonbondedType(AbstractNonbondedType):
__slots__ = ['C6', 'C12', 'type']
@accepts_compatible_units(None, None,
... | shirtsgroup/InterMol | intermol/forces/lj_c_nonbonded_type.py | Python | mit | 1,413 |
import csv
import os
import copy
import re
from decimal import Decimal
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse, FormRequest
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy.http.c... | 0--key/lib | portfolio/Python/scrapy/bosch_german_professional/svh24.py | Python | apache-2.0 | 1,479 |
def plus(num):
return num + 1
def mult(num):
return mult * 2
lst = [plus, mult]
print (lst[0](3))
| BogdanShevchenko/PythonGames | deijkstra.py | Python | gpl-2.0 | 109 |
import os
from . import igm
from . import param
from . import templates
from . import filters
from . import photoz
from .version import __version__, __long_version__, __version_hash__
def symlink_eazy_inputs(path='$EAZYCODE', get_hdfn_test_catalog=False, copy=False):
"""
Make symbolic links to EAZY inputs
... | gbrammer/eazy-py | eazy/__init__.py | Python | mit | 3,736 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | uq_benchmark_2019/metrics_lib_test.py | Python | apache-2.0 | 9,261 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | XeCycle/indico | indico/MaKaC/review.py | Python | gpl-3.0 | 133,200 |
__author__ = 'mglass'
| radiasoft/optics | optics/magnetic_structures/__init__.py | Python | apache-2.0 | 22 |
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2014,2015,2016,2017 Contributor
#
# 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 Li... | quattor/aquilon | lib/aquilon/worker/dbwrappers/cluster.py | Python | apache-2.0 | 5,714 |
"""
bbss - BBS Student Management
Exports student data for FreeRadius server configuration.
Created on Mon Feb 26 15:08:56 2014
@author: Christian Wichmann
"""
import logging
import os
from itertools import chain
__all__ = ['export_data']
logger = logging.getLogger('bbss.radius')
def export_data(output_fil... | wichmann/bbss | bbss/radius.py | Python | gpl-2.0 | 1,456 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="family", parent_name="waterfall.hoverlabel.font", **kwargs
):
super(FamilyValidator, self).__init__(
plotly_name=plotly_name,
parent... | plotly/plotly.py | packages/python/plotly/plotly/validators/waterfall/hoverlabel/font/_family.py | Python | mit | 574 |
from django.contrib import admin
from .models import File
admin.site.register(File) | goldhand/django-nufiles | nufiles/admin.py | Python | bsd-3-clause | 85 |
"""Class to represent a device."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
class Device(object):
"""Represents a Device."""
def __init__(self, job=None, replica=None, task=None, device_type=None,
device_index=None):
... | arunhotra/tensorflow | tensorflow/python/framework/device.py | Python | apache-2.0 | 6,508 |
import unittest
import traceback
import shutil
from yarom.configure import Configuration, Configureable
from yarom.data import Data
from yarom.sleepycat import SleepyCatSource
from .base_test import TEST_NS, make_graph
HAS_BSDDB = False
try:
import bsddb
print("BSDDB:", bsddb.__file__)
HAS_BSDDB = True
e... | mwatts15/YAROM | tests/test_sleepycat.py | Python | bsd-3-clause | 1,353 |
"""Lite version of scipy.linalg.
Notes
-----
This module is a lite version of the linalg.py module in SciPy which
contains high-level Python interface to the LAPACK library. The lite
version only accesses the following LAPACK functions: dgesv, zgesv,
dgeev, zgeev, dgesdd, zgesdd, dgelsd, zgelsd, dsyevd, zheevd, dgetr... | b-carter/numpy | numpy/linalg/linalg.py | Python | bsd-3-clause | 77,776 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('annotation', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='annotation',
opti... | PsypherPunk/django-annotations | annotation/migrations/0002_auto_20160129_1311.py | Python | apache-2.0 | 369 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "edjango.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| sarusso/eDjango | manage.py | Python | apache-2.0 | 250 |
# Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 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/LICENSE-2.0... | nkrinner/nova | nova/tests/virt/vmwareapi/stubs.py | Python | apache-2.0 | 3,654 |
#-*- coding: UTF-8 -*-
from PIL import Image, ImageDraw, ImageFont
#第 0000 题:将你的 QQ 头像(或者微博头像)右上角加上红色的数字,类似于微信未读信息数量那种提示效果。 类似于图中效果
def add_num(image_file_path, num, fill, font_name):
im = Image.open(image_file_path)
x_size, y_size = im.size
draw = ImageDraw.Draw(im)
text = str(num)
font = ImageF... | zhangmianhongni/MyPractice | Python/Python 练习册(show-me-the-code)/0000/0000.py | Python | apache-2.0 | 748 |
import logging, gensim, pickle, re
from gensim import corpora,models
from nltk.corpus import stopwords
import nltk
from nltk.stem.lancaster import LancasterStemmer
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
from gensim import corpora,models, similarities
pronounlist = ['... | leahrnh/ticktock_text_api | word2vec/user_input_word_all.py | Python | gpl-2.0 | 3,290 |
import socket
import sys
import time
from urlparse import urlparse
SCHEME_PORT_MAP = {'http': 80,
'https': 443}
def time_connect(url):
"""Return time in seconds to connect to socket of url,
or very large number if error in connection"""
parsed = urlparse(url)
if parsed.port:
... | quaddra/engage | python_pkg/engage/utils/socktime.py | Python | apache-2.0 | 934 |
#!/usr/bin/env python
import json, web, urllib2, re
db = json.load(open("db.access"))
db = web.database(dbn=str(db['type']), db=str(db['name']), user=str(db['user']), pw=str(db['pass']))
def build_rating_db():
debug = False
if debug: print "Processing account_27"
path = "http://raw2.github.com/Unthinkingbit/chari... | hunterbunter/dvccountdown | modules/ratings.py | Python | gpl-3.0 | 3,672 |
foo = 23 + 3
foo = 4 + 5
foo = 4 + 5
foo = 4 + 5
foo = 4 + 5
i = i + 1
submitted += 1
x = x * 2 - 1
hypot2 = x * x + y * y
c = (a + b) * (a - b)
foo(bar, key='word', *args, **kwargs)
foo(bar, key='word', *args, **kwargs)
x = (3 +
2)
x = (3
+ 2)
x = 3 + \
2
x = 3 + \
2
def func(foo, bar='tester'):
... | michaelBenin/pep8ify | tests/fixtures/whitespace_around_operator/whitespace_around_operator1_out.py | Python | apache-2.0 | 627 |
# 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-coral/demo-manufacturing | models/retraining/train_classifier.py | Python | apache-2.0 | 9,469 |
# Copyright 2016 Leon Poon and Contributors
#
# 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 ... | LeonPoon/XMLExplode | src-test/test/xmlxplode/test_xml_walk.py | Python | apache-2.0 | 1,191 |
import os.path, simplejson
from twisted.trial import unittest
from twisted.python import usage
from twisted.internet import defer
from allmydata.scripts import cli
from allmydata.util import fileutil
from allmydata.util.encodingutil import (quote_output, get_io_encoding,
unicod... | gsb-eng/tahoe-lafs | src/allmydata/test/test_cli_cp.py | Python | gpl-2.0 | 44,518 |
from threading import Thread #threading module should be imported
def tryit1():
name=input("Enter your name")
print("Hi your name is ",name)
def tryit2():
for i in range(1,1000000):
x=i*2.0
print("Done")
thread1=Thread(target=tryit1) #we are creating one thread for t... | pk-python/basics | basics/concurrency.py | Python | mit | 580 |
from numpy import *
from time import sleep
def loadDataSet(fileName):
dataMat = []; labelMat = []
fr = open(fileName)
for line in fr.readlines():
lineArr = line.strip().split('\t')
dataMat.append([float(lineArr[0]), float(lineArr[1])])
labelMat.append(float(lineArr[2]))
return d... | huaj1101/ML-PY | ML_IN_ACTION/C6/svmMLiA.py | Python | apache-2.0 | 15,888 |
# Copyright (c) 2012-2014 Andy Davidoff http://www.disruptek.com/
#
# 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... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/boto/mws/connection.py | Python | agpl-3.0 | 49,807 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.