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) 2014 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | tracyajones/driverlog | driverlog/dashboard/parameters.py | Python | apache-2.0 | 1,280 |
from django.forms import Media
from wagtail.admin.staticfiles import versioned_static
# Feature objects: these are mapped to feature identifiers within the rich text
# feature registry (wagtail.core.rich_text.features). Each one implements
# a `construct_options` method which modifies an options dict as appropriate t... | timorieber/wagtail | wagtail/admin/rich_text/editors/draftail/features.py | Python | bsd-3-clause | 2,173 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from __future__ import print_function
import warnings
import numpy as np
import pytest
import librosa
from test_core import load, srand
# Disable cache
import os
try:
os.environ.pop('LIBROSA_CACHE_DIR')
except KeyError:
pass
__EXAMPLE_FILE = os.path.join('te... | carlthome/librosa | tests/test_features.py | Python | isc | 35,237 |
# Copyright 2017 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, s... | tseaver/google-cloud-python | error_reporting/tests/system/test_system.py | Python | apache-2.0 | 4,116 |
import pytest
from wunderlist.factories import WunderlistFactory
from wh_habitica.factories import HabiticaFactory
def get_user():
"""
Returns a user which is connected with wunderlist and habitica.
"""
wunderlist = WunderlistFactory.create()
habitica = HabiticaFactory.create()
habitica.owne... | passuf/WunderHabit | wunderhabit/tests/utils.py | Python | mit | 945 |
# Copyright 2014 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
import unittest
from telemetry.core import browser_finder
from telemetry.core import extension_to_load
from telemetry.core import util
from teleme... | Jonekee/chromium.src | tools/telemetry/telemetry/core/backends/chrome/cros_test_case.py | Python | bsd-3-clause | 3,360 |
import json
class Model:
def to_json_string(self):
return json.dumps(self, cls=_Encoder, indent=2)
def to_json_file(self, file):
json.dump(self, file, cls=_Encoder, indent=2)
@classmethod
def from_json_string(cls, json_str):
return cls.from_json(json.loads(json_str))
@cl... | Monofraps/Mocca | models/model.py | Python | mit | 731 |
# $Id: manpage.py 5901 2009-04-07 13:26:48Z grubert $
# Author: Engelbert Gruber <grubert@users.sourceforge.net>
# Copyright: This module is put into the public domain.
"""
Simple man page writer for reStructuredText.
Man pages (short for "manual pages") contain system documentation on unix-like
systems. The pages ar... | dbbhattacharya/kitsune | vendor/packages/nose/doc/manpage.py | Python | bsd-3-clause | 35,518 |
from django.apps import AppConfig
class PublicationsConfig(AppConfig):
name = 'entities.publications'
verbose_name = "Publications"
| morelab/labman_ud | labman_ud/entities/publications/apps.py | Python | gpl-3.0 | 143 |
"""
Django settings for JustABlogSite project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, .... | fenexomega/JustABlogSite | JustABlogSite/settings.py | Python | gpl-3.0 | 2,050 |
import pyosm.model
from pyosm.parsing import iter_osm_file
import sys
import unicodecsv
import gzip
import re
class ThingHolder(object):
def __init__(self, nodes, ways, relations, changesets):
self.nodes = nodes
self.ways = ways
self.relations = relations
self.changesets = changeset... | iandees/pyosm | examples/osm2csv.py | Python | mit | 5,252 |
# Django settings for example 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': '... | stepank/pyws | examples/_django/settings.py | Python | mit | 3,098 |
# -*- coding: utf-8 -*-
#***************************************************************************
#* Copyright (c) 2010 Juergen Riegel <juergen.riegel@web.de> *
#* *
#* This file is part of the FreeCAD CAx development system.... | Fat-Zer/FreeCAD_sf_master | src/Mod/Test/UnitTests.py | Python | lgpl-2.1 | 6,892 |
"""Common exception classes used by MAEC conversion tools."""
"""Indicates a failure caused by a rejected API key."""
class APIKeyException(Exception):
pass
"""Indicates a failure caused by a rejected API key."""
class NetworkFailureException(Exception):
pass
"""Indicates a failure caused by a requ... | MAECProject/python-maec | maec/misc/exceptions.py | Python | bsd-3-clause | 515 |
import pytest
from awx.main.access import (
JobAccess,
AdHocCommandAccess,
InventoryUpdateAccess,
ProjectUpdateAccess
)
from awx.main.models import (
Job,
JobTemplate,
AdHocCommand,
InventoryUpdate,
InventorySource,
ProjectUpdate,
User
)
@pytest.fixture
def normal_job(depl... | snahelou/awx | awx/main/tests/functional/test_rbac_job.py | Python | apache-2.0 | 9,805 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from collections import defaultdict
from datetime import date, timedelta
from sqlalchemy.orm import joine... | pferreir/indico | indico/util/suggestions.py | Python | mit | 5,681 |
# -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, json, copy
from frappe import msgprint, _
from six import string_types, iteritems
from frappe.model.document import Docu... | ESS-LLP/erpnext | erpnext/manufacturing/doctype/production_plan/production_plan.py | Python | gpl-3.0 | 29,331 |
##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | cedriclaunay/gaffer | python/GafferSceneTest/SceneTestCase.py | Python | bsd-3-clause | 10,714 |
# encoding=utf-8
import json
import sys
import os
import os.path
import logging
import argparse
import tarfile
from .. import redis
from .. import db
from .. import app
from .. import file
from .. import models
import psycopg2
logger = logging.getLogger(__name__)
def main(*args):
"""
Creates an archive... | karih/photo-manager | pm/commands/qarchive.py | Python | gpl-3.0 | 939 |
import pytest
from bs4 import BeautifulSoup
from ckan.lib.helpers import url_for
from ckan.plugins import toolkit as tk
import ckan.model as model
from ckan.tests import factories, helpers
from ckanext.showcase.model import ShowcasePackageAssociation
import logging
log = logging.getLogger(__name__)
@pytest.mar... | ckan/ckanext-showcase | ckanext/showcase/tests/test_plugin.py | Python | agpl-3.0 | 15,163 |
# 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/v2017_06_01/operations/express_route_circuits_operations.py | Python | mit | 41,523 |
import uuid
from motey.models.image import Image
from motey.models.service_state import ServiceState
class Service(object):
"""
Model object. Represent a service.
A service can have multiple states, action types and service types.
"""
def __init__(self, service_name, images, id=uuid.uuid4().hex,... | Neoklosch/Motey | motey/models/service.py | Python | apache-2.0 | 2,107 |
###############################################################################
# #
# 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 ... | ctSkennerton/CompareM | comparem/lgt_dinucleotide.py | Python | gpl-3.0 | 13,790 |
#!/usr/bin/env python
#
# Copyright 2014 Institute for Theoretical Information Technology,
# RWTH Aachen University
# www.ti.rwth-aachen.de
#
# This 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 S... | rwth-ti/gr-ofdm | python/ofdm/preambles_grc.py | Python | gpl-3.0 | 67,078 |
import time
import zmq
import numpy as np
import ctypes
context = zmq.Context()
socket = context.socket(zmq.PUB)
socket.bind("tcp://*:12322")
i = 1
while True:
frame = np.random.randint(0, high=i, size=(512, 2048)).astype(np.uint16) #high=65536
img = frame
buff = np.getbuffer(img)
start_time = time.tim... | cweninger/lcls-monitoring | server.py | Python | gpl-2.0 | 441 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 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... | OmeGak/indico-plugins | chat/indico_chat/controllers/base.py | Python | gpl-3.0 | 1,652 |
from dos import config
class RoleCollection:
pass
class Policy:
def __init__(self, **kwargs):
self.cfg = {}
for k, v in kwargs.items():
self.cfg[k] = v
def policy_setup(self):
pass
def apply(self):
"""
return a RoleCollection
"""
... | meantheory/dotfiles | dos/src/dos/policies/policy.py | Python | mit | 327 |
# http://deeplearning.net/tutorial/code/mlp.py
"""
This tutorial introduces the multilayer perceptron using Theano.
A multilayer perceptron is a logistic regressor where
instead of feeding the input to the logistic regression you insert a
intermediate layer, called the hidden layer, that has a nonlinear
activation fu... | cliffclive/neuromancy | neuromancy/theano_tutorials/tutorial_mlp.py | Python | mit | 13,906 |
#!/usr/bin/env python
from tigershark.X12.parse import Message
from tigershark.X12.parse import Loop
from tigershark.X12.parse import Segment
from tigershark.X12.parse import Composite
from tigershark.X12.parse import Element
from tigershark.X12.parse import Properties
parse_278 = Message( '278', Properties(desc='278'... | sbuss/TigerShark | tests/example_278_deep.py | Python | bsd-3-clause | 7,249 |
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from mongoengine import Document
from mongoengine.fields import StringField
class Keyboard(Document):
color = StringField(required=True, unique=True, primary_key=True)
def add_key(self, name):
from kb14.backends.key import Key
key = Key(name=na... | numberly/europython2014 | kb14-api/kb14/backends/keyboard.py | Python | gpl-2.0 | 1,126 |
#!/usr/bin/env python3
import paho.mqtt.client as mqtt
import time
from robot import message_handler
from config import HOST, NAME, INIT_TOPIC, STATE_TOPIC
###############################################
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing ... | daniel-k/mooc-tu9-maze | main.py | Python | mit | 1,024 |
"""763. Partition Labels
https://leetcode.com/problems/partition-labels/
A string S of lowercase English letters is given.
We want to partition this string into as many parts as possible so that
each letter appears in at most one part, and return a list of integers
representing the size of these parts.
Example 1:
In... | isudox/leetcode-solution | python-algorithm/leetcode/problem_763.py | Python | mit | 1,218 |
"""Test the open functionality."""
from aiofiles.threadpool import open as aioopen, wrap
import pytest
@pytest.mark.asyncio
@pytest.mark.parametrize("mode", ["r", "rb"])
async def test_file_not_found(mode):
filename = "non_existent"
try:
open(filename, mode=mode)
except Exception as e:
ex... | Tinche/aiofiles | tests/threadpool/test_open.py | Python | apache-2.0 | 714 |
#!/usr/bin/python
recv = []
propagate = []
# local catalog
with open("92-files/catalog-lbl.log", "r") as ins:
for line in ins:
if "!!!" in line:
line = line.strip().split()
#print line[-1]
recv.append(float(line[-1]))
#print recv
# remote catalog
with open("92-files/c... | susmit85/ndn-sci-evaluation | catalog/sync-test-res/parse-log.py | Python | gpl-3.0 | 735 |
import pandas
import pylab
from calm.pandas_time_series import PandasTimeSeries
s1 = PandasTimeSeries()
s2 = PandasTimeSeries()
s3 = PandasTimeSeries()
s1.load_csv('noisy_simple_3state.csv')
s2.load_csv('freemat_jump.csv')
s3.load_csv('output_from_jp_test.csv')
pylab.plot(s1.series.index, s1.series, 'k', lw=2)
pylab.p... | grollins/calm | calm/test_data/plot_freemat_output.py | Python | bsd-2-clause | 426 |
import json
import logging
import psycopg2
import requests
import sys
from patroni.async_executor import AsyncExecutor
from patroni.exceptions import DCSError, PostgresConnectionException
from multiprocessing.pool import ThreadPool
logger = logging.getLogger(__name__)
class Ha:
def __init__(self, patroni):
... | pgexperts/patroni-compose | patroni/patroni/ha.py | Python | mit | 20,538 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import itertools
from six.moves import range
from curtsies import fsarray, fmtstr
from curtsies.formatstring import linesplit
from curtsies.fmtfuncs import bold
from bpython.curtsiesfrontend.parse import func_for_letter
from bpython._py3c... | kdart/bpython | bpython/curtsiesfrontend/replpainter.py | Python | mit | 7,805 |
# (C) Copyright 2017 SUSE 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, sof... | stackforge/monasca-persister | monasca_persister/repositories/cassandra/metric_batch.py | Python | apache-2.0 | 5,556 |
from __future__ import absolute_import
import contextlib
import errno
import hashlib
import logging
import os
from pip._vendor import contextlib2
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.typing import MYPY_CHECK_RUNNING
if MYPY_CHECK_RUNNING:
from types import TracebackTyp... | foobarbazblarg/stayclean | stayclean-2020-december/venv/lib/python3.8/site-packages/pip/_internal/req/req_tracker.py | Python | mit | 4,691 |
from haystack.generic_views import SearchView
from datapoint.models import SavedSearch
class LackawannaSearchView(SearchView):
template_name = 'search/search.html'
def get_queryset(self):
queryset = super(LackawannaSearchView, self).get_queryset()
return queryset
def get_context_data(sel... | allyjweir/lackawanna | lackawanna/search/views.py | Python | bsd-3-clause | 565 |
# Copyright 2015 Google Inc. All Rights Reserved.
"""Provides methods for controlling jobs.
"""
import itertools
import logging
import sys
import time
from googlecloudapis.apitools.base import py as apitools_base
from googlecloudsdk.bigquery.lib import bigquery
from googlecloudsdk.bigquery.lib import job_ids
from go... | wemanuel/smry | smry/server-auth/ls/google-cloud-sdk/lib/googlecloudsdk/bigquery/lib/job_control.py | Python | apache-2.0 | 8,548 |
# -*- encoding: utf-8 -*-
import numpy as np
from ..Utils import Ode as o
"""Package contenant méthodes et classes travaillant autour du modèle de
sphère auto-gravitante, isotherme et tronquée.
"""
class SIB(o.Ode):
"""Cette classe dérive de la classe de résolution des ODE du
package Outils et implémente la résolu... | ElricleNecro/LibThese | LibThese/Models/SIB.py | Python | lgpl-3.0 | 1,199 |
#!/usr/bin/python
#
# 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
#... | groschovskiy/gsa-admin-toolkit | gsa_admin.py | Python | apache-2.0 | 48,428 |
from tkinter import *
import tkinter.messagebox
from socket import *
import json
from Constant import *
from StringData import *
from RegisteredNameCheck import *
class LoginApp(Frame):
def __init__(self,master):
super().__init__(master)
self.pack()
self.create_wdigets()
def cre... | imscs21/myuniv | 1학기/programming/basic/파이썬/teamProject/mytest/Login.py | Python | apache-2.0 | 2,600 |
"""
Core components of Home Assistant.
Home Assistant is a Home Automation framework for observing the state
of entities and react to changes.
"""
import asyncio
from concurrent.futures import ThreadPoolExecutor
import datetime
import enum
import functools
import logging
import os
import pathlib
import threading
from ... | qedi-r/home-assistant | homeassistant/core.py | Python | apache-2.0 | 46,940 |
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
#
# 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 appli... | platformio/platformio | platformio/package/manifest/schema.py | Python | apache-2.0 | 7,931 |
"""Support for MySensors binary sensors."""
from homeassistant.components import mysensors
from homeassistant.components.binary_sensor import (
DEVICE_CLASSES, DOMAIN, BinarySensorDevice)
from homeassistant.const import STATE_ON
SENSORS = {
'S_DOOR': 'door',
'S_MOTION': 'motion',
'S_SMOKE': 'smoke',
... | jnewland/home-assistant | homeassistant/components/mysensors/binary_sensor.py | Python | apache-2.0 | 1,398 |
from marshmallow_jsonapi import Schema, fields
class RatingSchema(Schema):
id = fields.Str(dump_only=True)
mean = fields.Float()
deviation = fields.Float()
class Meta:
type_ = 'rating'
class AvatarSchema(Schema):
id = fields.Str(dump_only=True)
url = fields.Url(required=True)
to... | FAForever/faftools | faf/api/player_schema.py | Python | gpl-3.0 | 1,017 |
# Generated by Django 3.0.6 on 2020-05-22 09:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("trans", "0079_auto_20200519_1436"),
]
operations = [
migrations.AlterField(
model_name="unit",
name="extra_context",... | nijel/weblate | weblate/trans/migrations/0080_auto_20200522_0909.py | Python | gpl-3.0 | 584 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-14 12:51
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0043_sitesettings_show_only_translated_pages'),
]
operations = [
mig... | praekelt/molo | molo/core/migrations/0044_add_topic_of_the_day_fields.py | Python | bsd-2-clause | 902 |
"""
Setup script for the Gimbal package
"""
from setuptools import setup
from setuptools import find_packages
def readme():
"""Returns the contents of the README without the header image."""
header = '======\nGimbal\n======\n'
with open('README.rst', 'r') as f:
f.readline()
return header +... | ryjmacdonell/geomtools | setup.py | Python | mit | 1,588 |
from unittest import TestCase
from decimal import Decimal
import datetime
import sys
import validictory
if sys.version_info[0] == 3:
unicode_str = '\u2603'
else:
unicode_str = unicode('snowman')
class TestType(TestCase):
def test_schema(self):
schema = {
"type": [
{"ty... | sunlightlabs/validictory | validictory/tests/test_type.py | Python | mit | 5,391 |
""" Implements a fully blocking kernel client.
Useful for test suites and blocking terminal interfaces.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2012 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# ... | sserrot/champion_relationships | venv/Lib/site-packages/ipykernel/inprocess/blocking.py | Python | mit | 3,068 |
from pywps import Process, LiteralInput
from pywps.app.Common import Metadata
from pywps.ext_autodoc import MetadataUrl
from pywps.app.exceptions import ProcessError
import logging
LOGGER = logging.getLogger("PYWPS")
class ShowError(Process):
"""Show a user friendly error message using :class:`ProcessError`.
... | bird-house/emu | emu/processes/wps_error.py | Python | apache-2.0 | 2,148 |
#!/usr/bin/env python
import vtk
def main():
# Create a graph
graph = vtk.vtkMutableDirectedGraph()
v1 = graph.AddVertex()
v2 = graph.AddVertex()
v3 = graph.AddVertex()
graph.AddEdge(v1,v2)
graph.AddEdge(v2,v3)
# Manually set the position of the vertices
points = vtk.vtkP... | lorensen/VTKExamples | src/Python/Graphs/ColorVerticesLookupTable.py | Python | apache-2.0 | 1,712 |
import _plotly_utils.basevalidators
class FamilyValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="family",
parent_name="scatter3d.marker.colorbar.title.font",
**kwargs
):
super(FamilyValidator, self).__init__(
plotly_n... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/marker/colorbar/title/font/_family.py | Python | mit | 558 |
'''
A module to contain code flow analysis for envi opcode objects...
'''
import copy
import envi
import envi.memory as e_mem
class CodeFlowContext(object):
def __init__(self, mem, opcallback=None, funccallback=None):
self._funcs = {}
self._func_list = []
self._entries = {}
self.... | joxeankoret/nightmare | lib/interfaces/envi/codeflow.py | Python | gpl-2.0 | 4,348 |
#!/usr/bin/env python3
# -*-coding:UTF-8 -*
'''
Flask functions and routes for the trending modules page
'''
import redis
import json
import os
import sys
import flask
from flask import Flask, render_template, jsonify, request, Blueprint, make_response, Response, send_from_directory, redirect, url_for, abort
from... | CIRCL/AIL-framework | var/www/modules/showpaste/Flask_showpaste.py | Python | agpl-3.0 | 19,911 |
# -*- coding: utf-8 -*-
# This file is part of IRIS: Infrastructure and Release Information System
#
# Copyright (C) 2013 Intel Corporation
#
# IRIS is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2.0 as published by the Free Software Foundation.... | 117111302/tryiris | iris/core/views/base.py | Python | gpl-2.0 | 3,214 |
{
"name" : "championship",
"version" : "0.1",
"author" : "Castillo",
"website" : "http://openerp.com",
"category" : "Unknown",
"description": """ Module for a Championship """,
"depends" : ['base','report_webkit','sale'],
"init_xml" : [ ],
"demo_xm... | xxjcaxx/openerp-learning-module2 | championship/__openerp__.py | Python | gpl-2.0 | 525 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-19 01:00
from __future__ import unicode_literals
from django.db import migrations, models
import image.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
... | welliam/imagersite | image/migrations/0001_initial.py | Python | mit | 876 |
import unittest
from powerline_shell.utils import RepoStats
class RepoStatsTest(unittest.TestCase):
def setUp(self):
self.repo_stats = RepoStats()
self.repo_stats.changed = 1
self.repo_stats.conflicted = 4
def test_dirty(self):
self.assertTrue(self.repo_stats.dirty)
def ... | banga/powerline-shell | test/repo_stats_test.py | Python | mit | 687 |
from collections import defaultdict
from casexml.apps.stock.models import StockTransaction
from corehq.apps.commtrack.models import StockState
from corehq.apps.locations.models import SQLLocation
from corehq.apps.products.models import SQLProduct
from corehq.apps.reports.commtrack.const import STOCK_SECTION_TYPE
from c... | puttarajubr/commcare-hq | custom/ewsghana/reports/email_reports.py | Python | bsd-3-clause | 8,587 |
import time
t1=.3
t2=.1
path="~/Dropbox/Ingenieria/asignaturas_actuales"
time.sleep(t2)
keyboard.send_key("<f6>")
time.sleep(t2)
keyboard.send_keys(path)
time.sleep(t1)
keyboard.send_key("<enter>")
| andresgomezvidal/autokey_scripts | data/General/file manager/asignaturas_actuales.py | Python | mit | 200 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Michael Droettboom All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, t... | mdboom/freetypy | docstrings/sfntnames.py | Python | bsd-2-clause | 2,188 |
"""Handle AMQP Heartbeats"""
import logging
import rez.vendor.pika.exceptions
from rez.vendor.pika import frame
LOGGER = logging.getLogger(__name__)
class HeartbeatChecker(object):
"""Sends heartbeats to the broker. The provided timeout is used to
determine if the connection is stale - no received heartbeat... | instinct-vfx/rez | src/rez/vendor/pika/heartbeat.py | Python | apache-2.0 | 8,203 |
"""
pinq.tests
~~~~~~~~~~~~
Loads all tests for pinq and runs them.
"""
from os import walk
import unittest
if __name__ == "__main__":
tests = unittest.TestSuite()
for _, _, filenames in walk("./tests"):
for filename in filenames:
if ".py" in filename and ".pyc" not in filename:
... | dlshriver/pinq | tests/__main__.py | Python | mit | 485 |
import logging
from collections import defaultdict
from langid.langid import LanguageIdentifier, model
# https://github.com/saffsd/langid.py
from aleph.core import language_whitelist
from aleph.analyze.analyzer import Analyzer
log = logging.getLogger(__name__)
THRESHOLD = 0.9
CUTOFF = 50
class LanguageAnalyzer(Ana... | gazeti/aleph | aleph/analyze/language.py | Python | mit | 1,290 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | cryptapus/electrum | electrum/qrscanner.py | Python | mit | 3,493 |
"""Package marker file."""
import pkgutil
__path__ = pkgutil.extend_path(__path__, __name__)
| endlessm/chromium-browser | third_party/catapult/third_party/gsutil/third_party/apitools/samples/storage_sample/storage_v1/__init__.py | Python | bsd-3-clause | 95 |
from pytest import fixture, raises
from ebu_tt_live.config import AppConfig, UniversalNodes
import ebu_tt_live.config.node as node_config
import ebu_tt_live.config.carriage as carriage_config
import ebu_tt_live.node as processing_node
from ebu_tt_live.config.common import ConfigurableComponent
from ebu_tt_live.errors ... | bbc/ebu-tt-live-toolkit | testing/test_config.py | Python | bsd-3-clause | 6,309 |
#!/usr/bin/env python3
#
#
#
# This file is part of librix-thinclient.
#
# librix-thinclient 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 ver... | andrevmatos/Librix-ThinClient | src/defs.py | Python | gpl-2.0 | 1,039 |
import logging
def registerLoggingHander(dependencies):
plexHandler = PlexLoggerHandler()
for dependency in dependencies:
Log.Debug("Registering LoggerHandler for dependency: %s" % dependency)
log = logging.getLogger(dependency)
log.setLevel('DEBUG')
log.addHandler(plexH... | dantebarba/docker-media-server | plex/Subliminal.bundle/Contents/Code/logger.py | Python | gpl-3.0 | 1,288 |
"""
* --------------------- *
| |
| Coding Game Server |
| |
* --------------------- *
Authors: M. Pecheux (based on T. Hilaire and J. Brajard template file)
Licence: GPL
File: aliceRandomPlayer.py
Contains the class aliceRandomPlayer
-> defines a dummy Alice player t... | thilaire/CodingGameServer | games/Networks/server/AliceRandomPlayer.py | Python | gpl-3.0 | 4,279 |
# -*- coding: utf-8 -*-
#
# 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
#... | Fokko/incubator-airflow | airflow/gcp/hooks/datastore.py | Python | apache-2.0 | 14,347 |
N = int(input())
# считываем в очередь первые 6 чисел
Q = [int(input()) for i in range(6)]
min_even = 1001 #минимальное четное - начальное значение
beta = 1000001
for i in range(N-6):
# первый элемент покидает очередь - и соревнуется с текущими минимальными
x = Q[0]
min_x = min(_x, x)
if x%2 == 0 and x ... | tuhbatshina/kpk_Python | algorythm/EGE_2016_demo27.py | Python | gpl-3.0 | 728 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-05 09:48
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lorawan', '0001_initial'),
]
operations = [
... | BFH-E2d/iotdemo | lorawan/migrations/0002_device_location.py | Python | mit | 510 |
# Copyright 2012 Tomasz Kontusz
#
# This file is part of Spanel.
#
# Spanel 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.
#
# Spanel ... | ktosiek/spanel | widgets/command.py | Python | gpl-3.0 | 1,171 |
# pylint: disable=missing-docstring
def do_stuff(some_random_list):
for var in some_random_list:
pass
return var # [undefined-loop-variable]
def do_else(some_random_list):
for var in some_random_list:
if var == 42:
break
else:
var = 84
return var
__revision__ ... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/pylint/test/functional/undefined_loop_variable.py | Python | apache-2.0 | 733 |
import pytest
import copy
import json
from django.db import DatabaseError
from awx.main.utils.common import (
model_instance_diff,
model_to_dict,
get_model_for_type
)
from awx.main import models
@pytest.mark.django_db
def test_model_to_dict_user(alice):
username = copy.copy(alice.username)
pass... | wwitzel3/awx | awx/main/tests/functional/utils/test_common.py | Python | apache-2.0 | 2,741 |
from nucleus import *
from atom import *
from electron import *
#N0 ---> p+ + e- + v|e
n_zero = neutron(neutron_mass_u,neutron_charge)
p_plus = proton(proton_mass_u,proton_charge)
e_minus = electron(electron_mass_u1,electron_charge)
| defm03/chemistry-cc | src/nucleosynthesis.py | Python | gpl-3.0 | 240 |
# Copyright 2014-2015 0xc0170
#
# 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,... | ARMmbed/yotta_osx_installer | workspace/lib/python2.7/site-packages/project_generator/generate.py | Python | apache-2.0 | 2,826 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0006_auto_20150825_1720'),
]
operations = [
migrations.AlterIndexTogether(
name='platform',
... | chouseknecht/galaxy | galaxy/main/migrations/0007_auto_20150825_1723.py | Python | apache-2.0 | 375 |
from paraview.simple import *
import os
import numpy as np
model = GetActiveSource()
renderView1 = GetActiveViewOrCreate('RenderView')
renderView1.CameraParallelProjection = 1
Hide(model, renderView1)
# waves
extractBlock1 = ExtractBlock(Input=model)
extractBlock1.BlockIndices = [1, 2]
extractBlock1Display = Show(ext... | ratanakso/WEC-Sim | source/paraview_macros/WEC-Sim.py | Python | apache-2.0 | 2,530 |
from tests.utils import storage
from indy import ledger
import json
import pytest
import logging
logging.basicConfig(level=logging.DEBUG)
@pytest.fixture(autouse=True)
def before_after_each():
storage.cleanup()
yield
storage.cleanup()
@pytest.mark.asyncio
async def test_build_get_txn_request_works():
... | MRJCrunch/indy-sdk | wrappers/python/tests/ledger/test_build_get_txn_request.py | Python | apache-2.0 | 637 |
import os
from sqlobject.dbconnection import DBConnection
########################################
## Test _parseURI
########################################
def test_parse():
_parseURI = DBConnection._parseURI
user, password, host, port, path, args = _parseURI("mysql://user:password@host/database")
asse... | fregaham/DISP | sqlobject/tests/test_parse.py | Python | gpl-2.0 | 1,999 |
"""
Benchmark for SGD regression
Compares SGD regression against coordinate descent and Ridge
on synthetic data.
"""
print(__doc__)
# Author: Peter Prettenhofer <peter.prettenhofer@gmail.com>
# License: BSD 3 clause
import numpy as np
import pylab as pl
import gc
from time import time
from sklearn.linear_model i... | RPGOne/Skynet | scikit-learn-c604ac39ad0e5b066d964df3e8f31ba7ebda1e0e/benchmarks/bench_sgd_regression.py | Python | bsd-3-clause | 4,594 |
# 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 by applicable law or agree... | rahulunair/nova | nova/tests/unit/objects/test_keypair.py | Python | apache-2.0 | 10,288 |
# Tools to check the output file
# Useful!
import os
import sys
import re
import subprocess
import optparse
all_env = {}
class CheckRootException(Exception):
def __init__(self, error):
Exception.__init__(self, error)
class OutputChecker(object):
'''Base class for the output checker
'''
def _... | ganga-devs/ganga | ganga/GangaSNOplus/Lib/Applications/check_root_output.py | Python | gpl-3.0 | 4,115 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Dylan Martin <dmartin@seattlecentral.edu>
#
# 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 v... | j-carl/ansible | lib/ansible/plugins/action/unarchive.py | Python | gpl-3.0 | 4,895 |
class Singleton(object):
"""Singleton class"""
__instances = {}
_baseclass = object
def __new__(cls, *args, **kwargs):
instance = Singleton.__instances.get(cls)
if instance is None:
Singleton.__instances[cls] = cls._baseclass.__new__(cls, *args, **kwargs)
instan... | viatoriche/dynamite | dynamite/patterns.py | Python | mit | 375 |
# Author: Bichen Wu (bichen@berkeley.edu) 08/25/2016
"""Model configuration for pascal dataset"""
import numpy as np
from config import base_model_config
def kitti_squeezeDet_config():
"""Specify the parameters to tune below."""
mc = base_model_config('KITTI')
mc.IMAGE_WIDTH =... | BichenWuUCB/squeezeDet | src/config/kitti_squeezeDet_config.py | Python | bsd-2-clause | 2,028 |
#!/usr/bin/env python
import ode, xode.parser, pygame, socket, subprocess
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
from numpy import *
import math, time, copy, sys, os
# needs to add the path of ltlmop_root to sys path
sys.path.append('../../..')
sys.path.append('.')
import lib.region... | jadecastro/LTLMoP | src/lib/simulator/ode/pioneer/PioneerSim.py | Python | gpl-3.0 | 24,491 |
from . import abstract_models
class TwitterEmbedItem(abstract_models.AbstractTwitterEmbedItem):
"""
An embeded twitter tweet.
"""
pass
| ic-labs/django-icekit | icekit/plugins/twitter_embed/models.py | Python | mit | 153 |
"""one_finger 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. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-... | zhaogaolong/oneFinger | event/urls.py | Python | apache-2.0 | 775 |
# Generated by Edulix on 2021-12-30 11:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0047_userdata_use_generated_auth_code'),
]
operations = [
migrations.AlterField(
model_name='authevent',
name='status... | agoravoting/authapi | authapi/api/migrations/0048_authevent_allowed_statuses.py | Python | agpl-3.0 | 767 |
from django import template
from webui.models import STATUS_CHOICES
register = template.Library()
@register.filter
def get_status(value):
for p in STATUS_CHOICES:
if p[0] == value:
return p[1]
return "Unknown"
| lairdm/islandviewer-ui | webui/templatetags/runstatus.py | Python | gpl-3.0 | 246 |
"""
WSGI config for elevendance 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.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "elevendance.settings")
from djang... | paulmand3l/elevendance | elevendance/wsgi.py | Python | mit | 397 |
# Copyright 2011 Citrix System.
# 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 b... | JioCloud/neutron | neutron/api/api_common.py | Python | apache-2.0 | 10,760 |
"""
The ``ordered_set`` module provides classes for constructing and
manipulating **ordered** collections of unique elements.
:copyright: 2008 by Takanori Ishikawa
:license: MIT, see LICENSE for more details.
"""
import weakref
__all__ = ['OrderedSet']
class _Node(object):
def __init__(self, element):... | ishikawa/modipyd | modipyd/utils/ordered_set.py | Python | mit | 2,908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.