text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from lcapy import R, C
n = C('C1') | (R('R1') + (C('C2') | (R('R2') + (C('C3') | (R('R3') + C('C4'))))))
n.draw(__file__.replace('.py', '.png'), layout='ladder')
| mph-/lcapy | doc/examples/networks/ladderRC3.py | Python | lgpl-2.1 | 163 | 0.01227 |
# 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-network/azure/mgmt/network/v2018_01_01/models/network_interface_association_py3.py | Python | mit | 1,345 | 0 |
from django.db import models
# Create your models here.
class Collage(models.Model):
name = models.CharField(max_length=50)
slug = models.SlugField(unique=True)
no_of_students = models.IntegerField()
year_estd = models.IntegerField()
def __str__(self):
return self.name
class Faculty(mo... | ayys/collegesearch | main/models.py | Python | gpl-3.0 | 507 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from common import find_target_items
if len(sys.argv) != 3:
print("Find the value keyword in all pairs")
print(("Usage: ", sys.argv[0], "[input] [keyword]"))
exit(1)
find_target_items(sys.argv[1], sys.argv[2])
| BYVoid/OpenCC | data/scripts/find_target.py | Python | apache-2.0 | 282 | 0 |
from __future__ import unicode_literals
"""Migrating IPython < 4.0 to Jupyter
This *copies* configuration and resources to their new locations in Jupyter
Migrations:
- .ipython/
- nbextensions -> JUPYTER_DATA_DIR/nbextensions
- kernels -> JUPYTER_DATA_DIR/kernels
- .ipython/profile_default/
- static/custom -... | unnikrishnankgs/va | venv/lib/python3.5/site-packages/jupyter_core/migrate.py | Python | bsd-2-clause | 8,222 | 0.004014 |
import pytz
import datetime
# statics
UNKNOWN_TYPE = 'Unknown'
DEFAULT_FREQ = 0 # No automatic update by default
DEFAULT_TIMEZONE = 'UTC'
DEFAULT_STATUS = False
class Component(dict):
# Private attributes
client_hostname = None
server_host = None
server_user = None
server_password = None
# P... | AMairesse/hc-client | src/hc_component.py | Python | gpl-2.0 | 1,780 | 0.002809 |
# This file is part of curious.
#
# curious 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 3 of the License, or
# (at your option) any later version.
#
# curious is distributed in the ho... | SunDwarf/curious | curious/exc.py | Python | mit | 4,130 | 0.000484 |
import gdb
# This is not quite right, as local vars may override symname
def read_global_var (symname):
return gdb.selected_frame().read_var(symname)
def g_quark_to_string (quark):
if quark == None:
return None
quark = long(quark)
if quark == 0:
return None
try:
val = read_... | jonnyniv/boost_converter | host/gui/GTK+/share/glib-2.0/gdb/glib.py | Python | apache-2.0 | 7,426 | 0.010908 |
import socket
UDP_IP = "0.0.0.0"
UDP_PORT = 5005
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
packet_stack = {}
sequence_pointer = 1
peak_stack_size = 0
print "Listening on IP %s, Port: %s" % (UDP_IP, UDP_PORT)
def decode_packet(packet):
seq = int(packet[0:16])
siz... | cdemers/networktools | UDPNetTests/test_server.py | Python | mit | 3,592 | 0.003898 |
from django import template
from django.utils.encoding import smart_str
from django.core.urlresolvers import reverse, NoReverseMatch
from django.db.models import get_model
from django.db.models.query import QuerySet
register = template.Library()
class GroupURLNode(template.Node):
def __init__(self, view_name, g... | ericholscher/pinax | pinax/apps/groups/templatetags/group_tags.py | Python | mit | 3,311 | 0.003926 |
'''
Created on Dec 2, 2015
@author: Sameer Adhikari
'''
# Class that represents the common operations between
# composite and leaf/primitive nodes in the hierarchy
# This is a simulation which lacks a lot of operations
class Component(object):
def __init__(self, name):
self.name = name
def ... | tri2sing/PyOO | patterns/composite/entities.py | Python | gpl-2.0 | 1,989 | 0.012569 |
from .models import Site
class SitesMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
request.site = Site.objects._get_for_request(request)
return self.get_response(request)
| veselosky/webquills | webquills/sites/middleware.py | Python | apache-2.0 | 275 | 0 |
# Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this ... | hoangt/gem5v | tests/configs/o3-timing-mp.py | Python | bsd-3-clause | 2,805 | 0.010339 |
#!/usr/bin/env python
from distutils.core import setup
setup(name = "comic-utils",
version = "0.4",
description = "Comic Utils",
author = "Milan Nikolic",
author_email = "gen2brain@gmail.com",
license = "GNU GPLv3",
url = "https://github.com/gen2brain/comic-utils",
... | gen2brain/comic-utils | setup.py | Python | gpl-3.0 | 576 | 0.0625 |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | noironetworks/neutron | neutron/db/migration/alembic_migrations/versions/queens/expand/594422d373ee_fip_qos.py | Python | apache-2.0 | 1,485 | 0 |
"""Development settings and globals."""
from os.path import join, normpath
from base import *
########## DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
########## END... | browning/shows | shows/shows/settings/local.py | Python | mit | 1,629 | 0.00798 |
import pytest
from app import models
from app.extensions import db
@pytest.fixture(scope='function')
def mock_picture():
def make_mock_picture(user=None, tags=None, despriction=None, address=None):
_picture = models.Picture(
userId=str(user.id),
despriction=despriction or 'testdes',... | eightHundreds/irides | tests/mocks/pictures.py | Python | gpl-3.0 | 743 | 0.002692 |
#!/usr/bin/env python
# Jonas Schnelli, 2013
# make sure the Nichts-Qt.app contains the right plist (including the right version)
# fix made because of serval bugs in Qt mac deployment (https://bugreports.qt-project.org/browse/QTBUG-21267)
from string import Template
from datetime import date
bitcoinDir = "./... | eysho/BestKnownGame-Coins---Source | share/qt/clean_mac_info_plist.py | Python | mit | 922 | 0.016269 |
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.utils import unittest
from django.test.client import RequestFactory
from django.db.models import query
from django.contrib.admin.sites import AdminSite
from cities_light import admin as cl_admin
from cities_light import models as cl_models
... | KevinGrahamFoster/django-cities-light | test_project/tests.py | Python | mit | 1,189 | 0.004205 |
# Copyright 2021 Google LLC.
# Copyright (c) Microsoft Corporation.
#
# 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 a... | GoogleChromeLabs/chromium-bidi | tests/_helpers.py | Python | apache-2.0 | 4,890 | 0.000613 |
from django.db import models
from .querysets import SongQuerySet
class SongManager(models.Manager):
def get_queryset(self):
return SongQuerySet(self.model, using=self._db)
def available(self):
return self.get_queryset().songs().enabled().published()
| RecursiveGreen/spradio-django | savepointradio/radio/managers.py | Python | mit | 278 | 0 |
from setuptools import setup
def readme():
with open('README.rst.example') as f:
return f.read()
setup(name='manifold_gui',
version='0.1',
description='GUI for a manifold technique',
long_description=readme(),
classifiers=[
'Development Status :: 1 - Alpha',
'Enviro... | hstau/manifold-cryo | setup.py | Python | gpl-2.0 | 792 | 0.002525 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Movie.studio'
db.alter_column(u'movie_library_movie', ... | atimothee/django-playground | django_playground/movie_library/migrations/0006_auto__chg_field_movie_studio.py | Python | bsd-3-clause | 4,380 | 0.007763 |
#!/usr/bin/env python
"""
runtests.py [OPTIONS] [-- ARGS]
Run tests, building the project first.
Examples::
$ python runtests.py
$ python runtests.py -s {SAMPLE_SUBMODULE}
$ python runtests.py -t {SAMPLE_TEST}
$ python runtests.py --ipython
$ python runtests.py --python somescript.py
$ python... | moreati/numpy | runtests.py | Python | bsd-3-clause | 15,724 | 0.001717 |
__author__ = 'Andy Gallagher <andy.gallagher@theguardian.com>'
import xml.etree.ElementTree as ET
import dateutil.parser
from .vidispine_api import always_string
class VSMetadata:
def __init__(self, initial_data={}):
self.contentDict=initial_data
self.primaryGroup = None
def addValue(self,key... | fredex42/gnmvidispine | gnmvidispine/vs_metadata.py | Python | gpl-2.0 | 5,748 | 0.008525 |
"""
Python Blueprint
================
Does not install python itself, only develop and setup tools.
Contains pip helper for other blueprints to use.
**Fabric environment:**
.. code-block:: yaml
blueprints:
- blues.python
"""
from fabric.decorators import task
from refabric.api import run, info
from refa... | gelbander/blues | blues/python.py | Python | mit | 997 | 0.002006 |
"""Class to reload platforms."""
from __future__ import annotations
import asyncio
from collections.abc import Iterable
import logging
from typing import Any
from homeassistant import config as conf_util
from homeassistant.const import SERVICE_RELOAD
from homeassistant.core import Event, HomeAssistant, callback
from ... | mezz64/home-assistant | homeassistant/helpers/reload.py | Python | apache-2.0 | 5,950 | 0.00084 |
# LayerMapping -- A Django Model/OGR Layer Mapping Utility
"""
The LayerMapping class provides a way to map the contents of OGR
vector files (e.g. SHP files) to Geographic-enabled Django models.
For more information, please consult the GeoDjango documentation:
https://docs.djangoproject.com/en/dev/ref/contrib/gi... | jsoref/django | django/contrib/gis/utils/layermapping.py | Python | bsd-3-clause | 27,310 | 0.00216 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import organizations
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
os.system('python setup.py bdist_wheel upload')
sy... | bennylope/django-site-broadcasts | test.py | Python | mit | 1,601 | 0 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
from flask import url_for
from recruit_app.user.models import User
from .factories import UserFactory
class TestLoggingIn:
"""Login."""
def test_can_log_in_returns_200(self, user, testapp):
"""Login ... | tyler274/Recruitment-App | tests/test_functional.py | Python | bsd-3-clause | 3,980 | 0.000251 |
import sklearn.neural_network
class NeuralNet:
def __init__(self):
self.regression = sklearn.neural_network.MLPRegressor(hidden_layer_sizes=100)
def train(self, X, Y):
self.regression.fit(X, Y)
def score(self, X):
return self.regression.predict(X)
def set_param(self, param):
... | m5w/matxin-lineariser | matxin_lineariser/statistical_linearisation/Linearisation/NeuralNet.py | Python | gpl-3.0 | 431 | 0.006961 |
"""
Acceptance tests for Home Page (My Courses / My Libraries).
"""
from bok_choy.web_app_test import WebAppTest
from opaque_keys.edx.locator import LibraryLocator
from ...fixtures import PROGRAMS_STUB_URL
from ...fixtures.config import ConfigModelFixture
from ...fixtures.programs import ProgramsFixture
from ...pages.... | IndonesiaX/edx-platform | common/test/acceptance/tests/studio/test_studio_home.py | Python | agpl-3.0 | 5,862 | 0.001365 |
#!/usr/bin/python
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Google 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 option)... | vladimir-ipatov/ganeti | lib/tools/burnin.py | Python | gpl-2.0 | 42,651 | 0.00823 |
from django.views.generic.base import ContextMixin
class PaginationPages(ContextMixin):
"""
Class is for extending the context with pages_list and url_without_page for pagination.
"""
def get_context_data(self, **kwargs):
"""
Function extends the context with pages_list and url_withou... | rudikovrf/django_blog | generic/pagination.py | Python | mit | 1,556 | 0.003213 |
"""Tests for init functions."""
from datetime import timedelta
from zoneminder.zm import ZoneMinder
from homeassistant import config_entries
from homeassistant.components.zoneminder import const
from homeassistant.components.zoneminder.common import is_client_in_data
from homeassistant.config_entries import (
ENT... | tchellomello/home-assistant | tests/components/zoneminder/test_init.py | Python | apache-2.0 | 4,539 | 0.001763 |
"""
The MIT License (MIT)
Copyright © 2015 RealDolos
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, publi... | RealDolos/volaparrot | volaparrot/commands/info.py | Python | mit | 10,159 | 0.001084 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2017-11-15 19:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('booths', '0002_auto_20171116_0045'),
]
operations = [
migrations.AlterField... | we-inc/mms-snow-white-and-the-seven-pandas | webserver/apps/booths/migrations/0003_auto_20171116_0220.py | Python | mit | 501 | 0.001996 |
import rdflib
from rdflib.term import URIRef, Variable
from PyOpenWorm.dataObject import DataObject, InverseProperty
from PyOpenWorm.context import Context
from PyOpenWorm.context_store import ContextStore
from .DataTestTemplate import _DataTest
try:
from unittest.mock import MagicMock, Mock
except ImportError:
... | gsarma/PyOpenWorm | tests/ContextTest.py | Python | mit | 12,077 | 0.000414 |
"""Helpers that help with state related things."""
import asyncio
import datetime as dt
import json
import logging
from collections import defaultdict
from types import TracebackType
from typing import ( # noqa: F401 pylint: disable=unused-import
Awaitable, Dict, Iterable, List, Optional, Tuple, Type, Union)
from... | PetePriority/home-assistant | homeassistant/helpers/state.py | Python | apache-2.0 | 8,174 | 0 |
""" Common Authentication Handlers used across projects. """
from __future__ import absolute_import
import logging
import django.utils.timezone
from oauth2_provider import models as dot_models
from provider.oauth2 import models as dop_models
from rest_framework.exceptions import AuthenticationFailed
from rest_framewo... | ESOedX/edx-platform | openedx/core/lib/api/authentication.py | Python | agpl-3.0 | 4,363 | 0.002521 |
# -*- coding: utf8 -*-
import sys
import os
import pybossa_github_builder as plugin
from mock import patch
# Use the PyBossa test suite
sys.path.append(os.path.abspath("./pybossa/test"))
from default import with_context
def setUpPackage():
"""Setup the plugin."""
from default import flask_app
with flask... | alexandermendes/pybossa-github-builder | tests/__init__.py | Python | bsd-3-clause | 554 | 0.001805 |
# coding=utf-8
from psycopg2.extras import NamedTupleCursor, Json
from tornado.web import Application, HTTPError
from tornado import gen
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
from tornado.options import parse_command_line
import momoko
import os
from bank import SelectQuestion, get... | inuyasha2012/tornado-cat-example | example/main.py | Python | mit | 8,865 | 0.002237 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-07 14:42
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('qui... | denys-zarubin/sweetheart_test | quiz/migrations/0012_auto_20170407_1442.py | Python | unlicense | 547 | 0 |
#!/usr/bin/env python
# -*- coding, utf-8 -*-
# FIDATA. Open-source system for analysis of financial and economic data
# Copyright © 2013 Basil Peace
# This file is part of FIDATA.
#
# FIDATA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published ... | FIDATA/database-draft | predefined-data/import.py | Python | gpl-3.0 | 4,368 | 0.027033 |
#!/usr/bin/python
from sys import exit
import sys
from site_imgsrc import imgsrc
from site_imgur import imgur
from site_deviantart import deviantart
from site_photobucket import photobucket
from site_flickr import flickr
from site_twitter import twitter
from site_tumblr import tumblr
from s... | larsbegas/rip-master | sites/_minux_tst.py | Python | gpl-2.0 | 10,576 | 0.023166 |
"""
Implementation of stack data structure in Python.
"""
class Stack:
def __init__(self,*vargs):
self.stack = list(vargs)
def __repr__(self):
return str(self.stack)
def top(self):
return self.stack[0]
def push(self,elem):
self.stack.insert(0,elem)
def pop(self):... | beqa2323/learntosolveit | languages/python/design_stack.py | Python | bsd-3-clause | 507 | 0.013807 |
"""
Author: Armon Dadgar
Description:
This test checks that the dylink pre-processor methods are working properly by "including"
the sockettimeout library. We then check that the functions work.
This test uses the old "include" directive
"""
# Import the sockettimeout library
include sockettimeout
def new_conn... | sburnett/seattle | seattlelib/tests/test_dylink_include.py | Python | mit | 1,136 | 0.033451 |
# Copyright 2018 DeepMind Technologies Limited. 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 ... | deepmind/acme | acme/jax/losses/impala.py | Python | apache-2.0 | 3,849 | 0.001299 |
import rhinoscriptsyntax as rs
#Importamos random
import random as rn
#Creamos seed y listas para los puntos, lineas y triangulos
rn.seed(s)
pts = [pt0]
lines = []
triangles = []
newptList = [pt0]
#Iteramos para la creacion de cada punto linea y triangulo
for i in range(It):
#los puntos en polares con angulos y p... | Fablab-Sevilla/ghPython101 | Día_002/01_EJ/T_002/Peter random walk final.py | Python | mit | 1,275 | 0.026709 |
# -*- encoding: utf-8 -*-
"""
Usage::
hammer organization [OPTIONS] SUBCOMMAND [ARG] ...
Parameters::
SUBCOMMAND subcommand
[ARG] ... subcommand arguments
Subcommands::
add-computeresource Associate a resource
add-configtemplate Associ... | ares/robottelo | robottelo/cli/org.py | Python | gpl-3.0 | 6,156 | 0 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
"""
Generator of histology report
"""
import logging
logger = logging.getLogger(__name__)
# import funkcí z jiného adresáře
import sys
import os.path
path_to_script = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(path_to_script, "../../lar-cc/li... | mjirik/imtools | imtools/gt_lar_smooth.py | Python | mit | 14,966 | 0.00254 |
# -*- coding: utf-8 -*-
# Simple Bot (SimpBot)
# Copyright 2016-2017, Ismael Lugo (kwargs)
import re
import sys
import ssl
import time
import logging
import socket
from six import binary_type
from six import string_types
from six import PY3 as python3
from six.moves import _thread
from six.moves import queue
from . ... | IsmaelRLG/simpbot | simpbot/irc.py | Python | mit | 16,036 | 0.000873 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | jcftang/ansible | lib/ansible/module_utils/ios.py | Python | gpl-3.0 | 2,926 | 0.005126 |
import numpy as np
from imreg_dph import AffineTransform
from nose.tools import *
def test_translation():
"""make sure tranlation works"""
# AffineTransform Tests
af1 = AffineTransform(translation=(1, 2))
af2 = AffineTransform(translation=(5, 3))
af3 = af1 @ af2
assert np.array_equal(af3.trans... | david-hoffman/scripts | test_imreg_dph.py | Python | apache-2.0 | 575 | 0 |
from typing import Dict, Any
import torch
class Scheduler:
"""
A `Scheduler` is a generalization of PyTorch learning rate schedulers.
A scheduler can be used to update any field in an optimizer's parameter groups,
not just the learning rate.
During training using the AllenNLP `Trainer`, this is... | allenai/allennlp | allennlp/training/scheduler.py | Python | apache-2.0 | 3,040 | 0.003289 |
#!/usr/bin/env python
import os.path
import sys
DIRNAME = os.path.dirname(__file__)
if not DIRNAME in sys.path:
sys.path.append(DIRNAME)
from django.core.management import execute_manager
try:
import settings # Assumed to be in the same directory.
except ImportError:
import sys
sys.stderr.write("Erro... | luxnovalabs/enjigo_door | web_interface/keyedcache/test_app/manage.py | Python | unlicense | 668 | 0.005988 |
from flask import Flask, render_template
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager
from flask.ext.uploads import UploadSet, configure_uploads, IMAGES
from config import config
bootstrap = Bootstrap(... | chenke91/ihaveablog | app/__init__.py | Python | mit | 1,126 | 0.000888 |
import unittest
from datetime import datetime
import pymongo
from mongoengine import *
from mongoengine.base import BaseField
from mongoengine.connection import _get_db
class DocumentTest(unittest.TestCase):
def setUp(self):
connect(db='mongoenginetest')
self.db = _get_db()
class Pe... | alex/mongoengine | tests/document.py | Python | mit | 19,227 | 0.002236 |
#!/usr/bin/env python
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Prints the results of an Address record lookup, Mail-Exchanger record
lookup, and Nameserver record lookup for the given hostname for a
given hostname.
To run this script:
$ python testdns.py <hostname>
e.g.:
$ python t... | kernel-sanders/arsenic-mobile | Dependencies/Twisted-13.0.0/doc/names/examples/testdns.py | Python | gpl-3.0 | 1,653 | 0 |
# Copyright (C) 2021 OpenMotics BV
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero 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 distribu... | openmotics/gateway | src/gateway/apartment_controller.py | Python | agpl-3.0 | 9,287 | 0.0028 |
{% block meta %}
name: Base
description: SMACH base template.
language: Python
framework: SMACH
type: Base
tags: [core]
includes: []
extends: []
variables:
- - manifest:
description: ROS manifest name.
type: str
- - node_name:
description: ROS node name for the state machine.
type: str
- outcome... | ReconCell/smacha | smacha/src/smacha/templates/Base.tpl.py | Python | bsd-3-clause | 2,545 | 0.070334 |
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "copyright", "credits" or "license()" for more information.
>>> print("hello Joe")
hello Joe
>>>
| davisjoe/joesrobotchallenge | expermients/hello Joe.py | Python | mit | 171 | 0.035088 |
__author__ = 'SmileyBarry'
from .core import APIConnection, SteamObject, store
from .decorators import cached_property, INFINITE
class SteamApp(SteamObject):
def __init__(self, appid, name=None, owner=None):
self._id = appid
if name is not None:
import time
self._cache = d... | balohmatevz/steamapi | steamapi/app.py | Python | mit | 6,268 | 0.002234 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import django.utils.timezone
import model_utils.fields
from django.db import migrations, models
from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField
from lms.djangoapps.courseware.fields import UnsignedBigIntAutoField
... | ESOedX/edx-platform | lms/djangoapps/grades/migrations/0001_initial.py | Python | agpl-3.0 | 2,347 | 0.002983 |
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
from lettuce import step, world
from common import *
############### ACTIONS ####################
@step('There are no courses$')
def no_courses(step):
world.clear_courses()
create_studio_user()
@... | Stanford-Online/edx-platform | cms/djangoapps/contentstore/features/courses.py | Python | agpl-3.0 | 2,137 | 0.001872 |
"""
This is an example showing how to use the mgd2d solver.
A 4th order accurate solution is obtained with the 5pt stencil,
by using deferred correction.
"""
import numpy as np
import time
from mgd2d import FMG,V_cycle
#analytical solution
def Uann(x,y,n):
return np.sin(2*n*np.pi*x)*np.sin(2*n*np.pi*y)
#RHS corres... | AbhilashReddyM/GeometricMultigrid | example_FMG_defcor.py | Python | mit | 3,299 | 0.049712 |
import os
import logging
import time
import ConfigParser
from fabric.operations import get
from fabric.api import sudo, local, lcd, cd, shell_env
from aws_collector.config.config import MAIN_CFG, S3_BUCKET
OUTPUT_FILE_FMT = '%s-%s-collect-output.tar'
S3_UPLOAD_CMD = 'aws s3 cp --region us-east-1 %s s3://%s/%s'
def... | andresriancho/collector | aws_collector/utils/collect.py | Python | gpl-2.0 | 4,386 | 0.000912 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_partner
| rosenvladimirov/addons | partner_vat_search/models/__init__.py | Python | agpl-3.0 | 120 | 0 |
"""Smoke tests for the ``CLI`` end-to-end scenario.
:Requirement: Cli Endtoend
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: Hammer
:Assignee: gtalreja
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from fauxfactory import gen_alphanumeric
from fauxfactory import... | lpramuk/robottelo | tests/foreman/endtoend/test_cli_endtoend.py | Python | gpl-3.0 | 12,481 | 0.001683 |
import logging
import commands
import random
from autotest.client.shared import error
from autotest.client import utils
from virttest import utils_misc
from virttest import utils_test
from virttest import utils_net
@error.context_aware
def run(test, params, env):
"""
Test the RX jumbo frame function of vnic... | tolimit/tp-qemu | generic/tests/jumbo.py | Python | gpl-2.0 | 7,693 | 0.00052 |
#-------------------------------------------------------------------------------
# Copyright (c) 2011 Anton Golubkov.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Lesser Public License v2.1
# which accompanies this distribution, and is available at
#... | anton-golubkov/Garland | src/test/test_splitblock.py | Python | lgpl-2.1 | 4,345 | 0.008055 |
# 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 ... | SUSE/azure-sdk-for-python | azure-mgmt-sql/azure/mgmt/sql/models/encryption_protector_paged.py | Python | mit | 918 | 0 |
#!/usr/bin/env python
# Copyright 2008 Orbitz WorldWide
#
# 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 ... | eric/whisper-rb | lib/whisper/py/whisper.py | Python | mit | 21,690 | 0.026418 |
from __future__ import absolute_import
import datetime
import jwt
import re
import logging
from six.moves.urllib.parse import parse_qs, urlparse, urlsplit
from sentry.integrations.atlassian_connect import get_query_hash
from sentry.shared_integrations.exceptions import ApiError
from sentry.integrations.client import... | beeftornado/sentry | src/sentry/integrations/jira/client.py | Python | bsd-3-clause | 8,782 | 0.001822 |
# -*- coding: utf-8 -*-
import json
import datetime
import PyRSS2Gen
from werkzeug.security import generate_password_hash
from mongoengine.errors import NotUniqueError, ValidationError
from flask import make_response
from tasks.email_tasks import send_email_task
from config import Config
from model.models import (Use... | ScenK/Dev_Blog2 | blog/dispatcher/__init__.py | Python | bsd-3-clause | 18,473 | 0.000109 |
import os
import requests
import socket
import subprocess
import unittest
import json
import ray
from ray.rllib import _register_all
from ray.tune.trial import Trial, Resources
from ray.tune.web_server import TuneClient
from ray.tune.trial_runner import TrialRunner
def get_valid_port():
port = 4321
while Tru... | pcmoritz/ray-1 | python/ray/tune/tests/test_tune_server.py | Python | apache-2.0 | 5,470 | 0 |
#!/usr/bin/env python
'''
What is a FASTA format file/string?
This module follows the NCBI conventions: http://blast.ncbi.nlm.nih.gov/blastcgihelp.shtml
'''
import cStringIO
import math
def idFromName(line):
'''
line: a fasta nameline
returns: an id parsed from the fasta nameline. The id is the first
... | todddeluca/tfd | tfd/fasta.py | Python | mit | 21,889 | 0.004203 |
# Django settings for project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': '... | fmierlo/django-default-settings | release/1.2/project/settings.py | Python | bsd-3-clause | 3,293 | 0.002126 |
import argparse
import random
import time
import sys
parser = argparse.ArgumentParser('eligibility')
parser.add_argument('infile', \
help='the file containing the list of names to randomly sort')
parser.add_argument('-s', '--spots', metavar='num', required=True, type=int, \
help='the number of spots ... | wallaceicy06/Eligibility | eligibility.py | Python | mit | 5,750 | 0.003304 |
from __future__ import with_statement
from robot.api import logger
class WrongStat(AssertionError):
ROBOT_CONTINUE_ON_FAILURE = True
def get_total_stats(path):
return get_all_stats(path)[0]
def get_tag_stats(path):
return get_all_stats(path)[1]
def get_suite_stats(path):
return get_all_stats(path)... | Senseg/robotframework | atest/robot/output/html_output_stats.py | Python | apache-2.0 | 1,194 | 0.005863 |
# oppia/api/media.py
from django.conf import settings
from django.contrib.auth import authenticate
from django.http import HttpResponseRedirect, Http404, HttpResponse, JsonResponse
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.csrf import csrf_exempt
from django.contrib import me... | DigitalCampus/django-nurhi-oppia | oppia/api/media.py | Python | gpl-3.0 | 1,856 | 0.001078 |
# Copyright 2015, 2017 Jairo Llopis <jairo.llopis@tecnativa.com>
# Copyright 2016 Tecnativa, S.L. - Vicent Cubells
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Date & Time Formatter",
"summary": "Helper functions to give correct format to date[t... | Vauxoo/server-tools | datetime_formatter/__manifest__.py | Python | agpl-3.0 | 666 | 0 |
# -*- coding: utf-8 -*-
""" Python KNX framework
License
=======
- B{PyKNyX} (U{https://github.com/knxd/pyknyx}) is Copyright:
- © 2016-2017 Matthias Urlichs
- PyKNyX is a fork of pKNyX
- © 2013-2015 Frédéric Mantegazza
This program is free software; you can redistribute it and/or modify
it under the terms ... | knxd/pKNyX | pyknyx/core/dptXlator/dptXlatorDate.py | Python | gpl-3.0 | 4,000 | 0.002255 |
"""api_server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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... | AutohomeOps/Assets_Report | api_server/api_server/urls.py | Python | apache-2.0 | 846 | 0 |
# Copyright 2012 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
#
# Unless required by applicable l... | dims/glance | glance/version.py | Python | apache-2.0 | 686 | 0 |
import deepdish as dd
class Foo(dd.util.SaveableRegistry):
def __init__(self, x):
self.x = x
@classmethod
def load_from_dict(self, d):
obj = Foo(d['x'])
return obj
def save_to_dict(self):
return {'x': self.x}
@Foo.register('bar')
class Bar(Foo):
def __init__(self... | agarbuno/deepdish | doc/source/codefiles/saveable_example.py | Python | bsd-3-clause | 542 | 0.001845 |
# Copyright (c) 2014-2016, Clemson University
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditio... | ClemsonSoCUnix/django-sshkey | django_sshkey/models.py | Python | bsd-3-clause | 5,547 | 0.008293 |
"""Cache util functions for ReSDKTables."""
import os
import pickle
import sys
from shutil import rmtree
from typing import Any
from resdk.__about__ import __version__
def _default_cache_dir() -> str:
"""Return default cache directory specific for the current OS.
Code originally from Orange3.misc.environ.
... | genialis/resolwe-bio-py | src/resdk/utils/table_cache.py | Python | apache-2.0 | 2,205 | 0 |
import locale
import threading
from contextlib import contextmanager
LOCALE_LOCK = threading.Lock()
BR_DATESHORT_FORMAT = '%a, %d %b - %Hh%M'
@contextmanager
def setlocale(name):
with LOCALE_LOCK:
saved = locale.setlocale(locale.LC_ALL)
try:
yield locale.setlocale(locale.LC_ALL, name... | olavopeixoto/plugin.video.brplay | resources/lib/modules/kodi_util.py | Python | gpl-3.0 | 563 | 0.001776 |
#!/bin/env python
"""Hosts files from the local directory using SSL."""
from __future__ import print_function
import signal
import socket
import ssl
import subprocess
import sys
import threading
killed = False
# pylint: disable=C0411
if sys.version_info.major < 3:
import SimpleHTTPServer
import SocketServer... | bskari/pi-rc | host_files.py | Python | gpl-2.0 | 5,869 | 0.002045 |
# -*- coding: utf-8 -*-
# @copyright (C) 2014-2015
#Developpeurs 'BARDOU AUGUSTIN - BREZILLON ANTOINE - EUZEN DAVID - FRANCOIS SEBASTIEN - JOUNEAU NICOLAS - KIBEYA AISHA - LE CONG SEBASTIEN -
# MAGREZ VALENTIN - NGASSAM NOUMI PAOLA JOVANY - OUHAMMOUCH SALMA - RIAND MORGAN - TREIMOLEIRO ALEX - TRULLA AUREL... | ehopsolidaires/ehop-solidaires.fr | ehop/ehopSolidaire_providers_register/forms.py | Python | agpl-3.0 | 10,906 | 0.006877 |
#!/usr/bin/env python2
# vim:fileencoding=utf-8
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import errno, socket, select, os
from Cookie import SimpleCookie
from contex... | hazrpg/calibre | src/calibre/srv/utils.py | Python | gpl-3.0 | 15,349 | 0.003192 |
# (C) British Crown Copyright 2010 - 2014, Met Office
#
# This file is part of Iris.
#
# Iris 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 3 of the License, or
# (at your option) any l... | Jozhogg/iris | lib/iris/tests/test_analysis_calculus.py | Python | lgpl-3.0 | 26,634 | 0.003717 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class ItemAttribute(Document):
def validate(self):
self.valid... | treejames/erpnext | erpnext/stock/doctype/item_attribute/item_attribute.py | Python | agpl-3.0 | 1,275 | 0.025882 |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .....extern.six.moves import range
from ..mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.RandomState(42)
return 10 * rand.rand(10)
@pytest.mark.parametrize('freq', [1.0, 2])
@pytest.mark.paramet... | kelle/astropy | astropy/stats/lombscargle/implementations/tests/test_mle.py | Python | bsd-3-clause | 1,921 | 0.000521 |
"""
See peoplegui--old.py: the alternative here uses nedted row frames with fixed
widdth labels with pack() to acheive the same aligned layout as grid(), but it
takes two extra lines of code as is (though adding window resize support makes
the two techniques roughly the same--see later in the book).
"""
from tk... | simontakite/sysadmin | pythonscripts/programmingpython/Preview/peoplegui--frame.py | Python | gpl-2.0 | 2,035 | 0.00344 |
from .map_to_surface import \
MapToSurface
from .mapping_task import \
MappingTask
from .mask_task import \
MaskTask
from .move_task import \
MoveTask
from .rotate_copy import \
RotateCopy
| simvisage/oricreate | oricreate/mapping_tasks/__init__.py | Python | gpl-3.0 | 210 | 0 |
import logging
from .data import DefinedTable
logger = logging.getLogger(__name__)
def ensure_tables():
"""When called, ensure that all the tables that we need are created in the
database. The real work is supplied by the DefinedTable base class
"""
for tab in [Subject, ExpCondition]:
logge... | memphis-iis/demo-track | demotrack/model.py | Python | apache-2.0 | 1,712 | 0.001168 |
import FWCore.ParameterSet.Config as cms
from HeavyIonsAnalysis.JetAnalysis.jets.akPu3CaloJetSequence_PbPb_mc_cff import *
#PU jets: type 15
akPu3Calomatch15 = akPu3Calomatch.clone(src = cms.InputTag("akPu3CaloJets15"))
akPu3Caloparton15 = akPu3Caloparton.clone(src = cms.InputTag("akPu3CaloJets15"))
akPu3Calocorr15 =... | mverwe/JetRecoValidation | PuThresholdTuning/python/akPu3CaloJetSequence15_cff.py | Python | cc0-1.0 | 1,328 | 0.03012 |
#### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_liberation_patriot_rodian_female_01.iff"
result.attrib... | anhstudios/swganh | data/scripts/templates/object/mobile/shared_dressed_liberation_patriot_rodian_female_01.py | Python | mit | 471 | 0.046709 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.