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 |
|---|---|---|---|---|---|
# -*- 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
#... | jgao54/airflow | tests/www/test_utils.py | Python | apache-2.0 | 10,792 |
"""Test generic read_raw function."""
# Authors: Clemens Brunner <clemens.brunner@gmail.com>
#
# License: BSD (3-clause)
from pathlib import Path
import pytest
from mne.io import read_raw
base = Path(__file__).parent.parent
@pytest.mark.parametrize('fname', ['x.xxx', 'x'])
def test_read_raw_unsupported(fname):
... | Teekuningas/mne-python | mne/io/tests/test_read_raw.py | Python | bsd-3-clause | 1,206 |
#!/usr/bin/env python
# coding=utf-8
## @package biopredyn
## Copyright: [2012-2019] Cosmo Tech, All Rights Reserved
## License: BSD 3-Clause
import libsbml
import libsedml
from sympy import *
import variable, parameter
## Data generation class, used for creating outputs from task results in a
## SED-ML work flow.
c... | TheCoSMoCompany/biopredyn | Prototype/python/biopredyn/datagenerator.py | Python | bsd-3-clause | 7,444 |
"""
Test finding orphans via the view and django config
"""
import json
import ddt
import six
from opaque_keys.edx.locator import BlockUsageLocator
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
from cms.djangoapps.contentstore.utils import reverse_course_url
from common.djangoapps.student.model... | stvstnfrd/edx-platform | cms/djangoapps/contentstore/tests/test_orphan.py | Python | agpl-3.0 | 10,733 |
# -*- coding: utf-8 -*-
{
"A location that specifies the geographic area for this region. This can be a location from the location hierarchy, or a 'group location', or a location that has a boundary for the area.": "Uma localização que especifica a área geográfica para esta região. Pode ser uma localização da hierarq... | gallifrey17/eden | languages/pt.py | Python | mit | 207,809 |
#!/usr/bin/env python
"""
plot.py
State Estimation and Analysis for PYthon
Module with plotting utilities
Written by Brian Powell on 10/18/13
Copyright (c)2017 University of Hawaii under the BSD-License.
"""
import numpy as np
from scipy import ndimage
import os
import re
from matplotlib import pyplot ... | dalepartridge/seapy | plot.py | Python | mit | 1,067 |
########################################################################
#
# File Name: XsltContext.py
#
#
"""
Provide contextual and state information wrt the transform processing
WWW: http://4suite.com/4XSLT e-mail: support@4suite.com
Copyright (c) 1999-2001 Fourthought Inc, USA. All Rights Reser... | Pikecillo/genna | external/PyXML-0.8.4/xml/xslt/XsltContext.py | Python | gpl-2.0 | 3,174 |
import networkx
G = networkx.petersen_graph()
| mesarpe/socialccnsim | graphs/petersen.py | Python | gpl-2.0 | 47 |
from object import Object
#-------------------------------------------------------------------------------
class Actuated(Object):
def __init__(self, actuator = None, **kargs):
self._actuator = None
super(Actuated, self).__init__(**kargs)
self.actuator = actuator
#--------------------------------... | kralf/morsel | python/lib/morsel/nodes/actuated.py | Python | gpl-2.0 | 675 |
#!/usr/bin/env python
#
# Copyright (c) 2014-2015 by Cooper Johnson <lavosprime@gmail.com>
# This program is free software provided under the terms of the MIT License.
#
# makeheromap.py: Generates a C++ source file that defines a map from hero
# aliases/nicknames to "real" hero names. Uses data from HeroNames.json... | lavosprime/heropool | makeheromap.py | Python | mit | 630 |
from django.test import RequestFactory, TestCase, Client, override_settings
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.contrib.auth.models import User
from dashboard import views
from dashboard.tests.loader import fixtures_standard
from dashboard.tests.mixins import TempFileMixin
from... | HumanExposure/factotum | dashboard/tests/functional/test_pdf_download.py | Python | gpl-3.0 | 4,217 |
#!/usr/bin/env python
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Matthieu Huin <mhu@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http:/... | redhat-cip/edeploy | tools/grapher/models/scatterplot.py | Python | apache-2.0 | 1,802 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | le9i0nx/ansible | lib/ansible/modules/network/f5/bigip_monitor_https.py | Python | gpl-3.0 | 18,712 |
from pylab import *
import scipy.interpolate
import sklearn.metrics
#Our libraries
import pathutils
pathutils.add_relative_to_current_source_file_path_to_sys_path("../..")
from coord_system import *
from flashlight.splineutils import *
from flashlight.curveutils import *
from flashlight.quadrotorcamera3d import *
fr... | stanford-gfx/Horus | Code/HorusApp/app/trajectoryAPI.py | Python | bsd-3-clause | 10,421 |
from __future__ import absolute_import
from __future__ import unicode_literals
import pytest
from pre_commit_hooks.trailing_whitespace_fixer import fix_trailing_whitespace
@pytest.mark.parametrize(
('input_s', 'expected'),
(
('foo \nbar \n', 'foo\nbar\n'),
('bar\t\nbaz\t\n', 'bar\nbaz\n'),
... | Coverfox/pre-commit-hooks | tests/trailing_whitespace_fixer_test.py | Python | mit | 3,304 |
from django.conf import settings
def paginate(iterable, per_page, page_num):
"""
recipes = Recipe.objects.all()
paginator, recipes = paginate(recipes, 12,
request.GET.get('page', '1'))
"""
from django.core.paginator import Paginator, InvalidPage, EmptyPage
paginator = Pagi... | CantemoInternal/django-knowledge | knowledge/utils.py | Python | isc | 1,375 |
# vim: set fileencoding=utf-8 :
from bottle import route, response, request, app
import markdown
@route('/rest/todo/<fmt>', method=['GET', 'POST'])
def todo(fmt):
if request.method == 'GET':
with open('/var/lib/sprava/TODO.md') as f:
md = f.read()
if fmt == 'md':
response.... | dmitriy5181/sprava | py_package/sprava.py | Python | unlicense | 628 |
# Copyright 2013 IBM Corporation
# 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 ... | zsoltdudas/lis-tempest | tempest/api/compute/admin/test_hypervisor.py | Python | apache-2.0 | 4,953 |
import sys
import os
def main(qrelFile, threshold):
curr_topic_id = None
with open(qrelFile, "r") as f:
while f:
line = f.readline()
if not line:
break
(topic_id, blank, doc_id, judgement) = line.split()
v= int(judgement)
if... | leifos/tar | scripts/convert_qrels_to_binary_qrels.py | Python | mit | 1,186 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import random
import functools
from snorky.types import MultiDict
__all__ = ('UnknownSubscription', 'SubscriptionManage... | ntrrgc/snorky | snorky/services/datasync/managers/subscription.py | Python | mpl-2.0 | 2,864 |
# -*- coding: utf8 -*-
COMMANDS_FILE_DIR = "data/commands.txt"
HELP_TEXT_SHELL = """
Type ls, cat, mkdir, cd, or any unix command to show its descrition
"""
HELP_TEXT_SHELL_ES = u"""
Estas órdenes del shell están definidas internamente. Teclee 'help' para ver esta lista.
Teclee 'help nombre' para saber más sobre la fu... | maoaiz/Unix-Shell-Emulator | src/shell.py | Python | bsd-3-clause | 5,823 |
"""UniFi Network switch platform tests."""
from copy import deepcopy
from unittest.mock import patch
from aiounifi.controller import MESSAGE_CLIENT_REMOVED, MESSAGE_EVENT
from homeassistant import config_entries, core
from homeassistant.components.device_tracker import DOMAIN as TRACKER_DOMAIN
from homeassistant.comp... | jawilson/home-assistant | tests/components/unifi/test_switch.py | Python | apache-2.0 | 28,653 |
import sys
sys.path.append("alfajor")
import boto
from alfajor import aws_ec2
account = "default"
if len(sys.argv) < 2:
account = sys.argv[1]
insttag = "tag"
if len(sys.argv) < 3:
insttag = sys.argv[2]
env = "env"
if len(sys.argv) < 4:
env = sys.argv[3]
tier = "tier"
if len(sys.argv) < 5:
ti... | base2Services/alfajor | scripts/stop_tagged_instance.py | Python | mit | 451 |
from regcore.db import storage
from regcore.responses import success
from regcore_write.views.security import json_body, secure_write
@secure_write
@json_body
def add(request, label_id, old_version, new_version):
"""Add the diff to the db, indexed by the label and versions"""
# @todo: write a schema that ve... | cmc333333/regulations-core | regcore_write/views/diff.py | Python | cc0-1.0 | 459 |
r"""OS routines for Mac, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt, os2, mac, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, ntpath, or macpath
- os.name is 'posix', 'nt', 'os2', 'mac', 'ce' or 'riscos'
- os.curdir is a string repres... | kmod/icbd | stdlib/python2.5/os.py | Python | mit | 24,641 |
# Copyright (c) 2021 PaddlePaddle 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 appli... | PaddlePaddle/Paddle | python/paddle/fluid/tests/unittests/auto_parallel/auto_parallel_relaunch_with_planner.py | Python | apache-2.0 | 1,858 |
from scripts import permit_reader
def test_date_parse():
dt = permit_reader.date_parse('1/2/2008')
assert dt.month == 1
assert dt.day == 2
assert dt.year == 2008
dt = permit_reader.date_parse('22-FEB-02')
assert dt.month == 2
assert dt.day == 22
assert dt.year == 2002
| codeforsanjose/BuildingPermitsPlus | tests/test_permit_reader.py | Python | mit | 305 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 IBM, Inc.
# Copyright (c) 2012 OpenStack LLC.
# 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... | tomasdubec/openstack-cinder | cinder/tests/test_xiv.py | Python | apache-2.0 | 8,843 |
# 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
# distribu... | jarrodmcc/OpenFermion | src/openfermion/ops/_indexing.py | Python | apache-2.0 | 1,143 |
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
Loop through users/membership-types
and add or remove the user from the group.
"""
def handle(self, *args, **kwargs):
from tendenci.apps.memberships.models import MembershipDefault
MembershipDefault... | alirizakeles/tendenci | tendenci/apps/memberships/management/commands/refresh_membership_groups.py | Python | gpl-3.0 | 338 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2018-02-06 15:19
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '... | ramonrdm/agendador | agenda/migrations/0001_initial.py | Python | gpl-2.0 | 6,198 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | changsimon/trove | trove/extensions/account/service.py | Python | apache-2.0 | 1,983 |
#!/usr/bin/env python
#
# Azure Linux extension
#
# Linux Azure Diagnostic Extension (Current version is specified in manifest.xml)
# Copyright (c) Microsoft Corporation
# All rights reserved.
# MIT License
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# ... | Azure/azure-linux-extensions | Diagnostic/lad_config_all.py | Python | apache-2.0 | 29,911 |
class BaseEnvironment(object):
def __init__(self, book):
"""
Initializes the environment with the appropriate global variables.
"""
super(BaseEnvironment, self).__init__()
def copy(self, iterable):
"""
Copies a variable from the databuild process to the hosted en... | databuild/databuild | databuild/environments/base.py | Python | bsd-3-clause | 553 |
# coding: utf-8
from test.util import build_grab
from test.util import BaseGrabTestCase
from grab.error import GrabInternalError, GrabCouldNotResolveHostError
class GrabRequestTestCase(BaseGrabTestCase):
def setUp(self):
self.server.reset()
def test_get_method(self):
g = build_grab()
... | kevinlondon/grab | test/grab_request.py | Python | mit | 2,299 |
import os
import sys
from base64 import b64encode
from json import dumps
from unittest import mock
import pytest
class BaseTestDjangoProject:
api_key = "12345"
@property
def api_key_encoded(self):
api_key_bytes = self.api_key.encode("utf8")
api_key_bytes_enc = b64encode(api_key_bytes)
... | p1c2u/openapi-core | tests/integration/contrib/django/test_django_project.py | Python | bsd-3-clause | 10,712 |
# How to defining variables ?
a = 10 # Integer variable
b = 20.1 # Float variable
c = "Hello World" # String variable
d = "A" # String variable of length 1
print("Int:", a)
print("Float:", b)
print("String:", c)
print("Character:", d)
print("\n\n")
# How to find the data type of a variable ?
print(a, "->", type(a))... | nityansuman/Python-3 | basics/introduction.py | Python | gpl-3.0 | 3,622 |
from traclinks import * # @UnresolvedImport
| kzhamaji/TracLinksPlugin | traclinks/__init__.py | Python | bsd-3-clause | 46 |
#!/usr/bin/env python
#
# Hello World
#
# Copyright 2012 Cody Van De Mark
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3.0 of the License, or (at your option) any... | renardchien/Software-Development-on-Linux--Open-Source-Course- | Labs/Lab 4/Student Files/Hello.py | Python | lgpl-3.0 | 766 |
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2020, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This program is free software you can redistribute it and/or modify
# it under... | numenta/nupic.research | projects/imagenet/experiments/sparse_r1.py | Python | agpl-3.0 | 5,411 |
from django.core import exceptions as django_exceptions
from rest_framework import generics, permissions as drf_permissions
from rest_framework.exceptions import NotFound, ValidationError, MethodNotAllowed
from rest_framework.views import Response
from framework.auth.oauth_scopes import CoreScopes
from api.base impo... | icereval/osf.io | api/wikis/views.py | Python | apache-2.0 | 8,027 |
"""Generates docs from function docstrings"""
# Oh hai there. This script is used to create the man page. It's kinda dirty. Really dirty.
# You shouldn't need to touch this or man_writing.py, they never get used by ovm-ctl proper.
# If you've made changes to stuff in other py files and would like the man page to refl... | trnubo/ovm-ctl | gen_docs.py | Python | bsd-2-clause | 7,812 |
from .common_fixtures import * # NOQA
from .docker_common import * # NOQA
@if_docker
def test_inspect_by_name(agent, responses):
delete_container('/inspect_test')
client = docker_client()
c = client.create_container('ibuildthecloud/helloworld',
name='inspect_test')
i... | sonchang/python-agent | tests/test_docker_inspect.py | Python | apache-2.0 | 1,543 |
__problem_title__ = "Number Rotations"
__problem_url___ = "https://projecteuler.net/problem=168"
__problem_description__ = "Consider the number 142857. We can right-rotate this number by moving " \
"the last digit (7) to the front of it, giving us 714285. It can be " \
... | jrichte43/ProjectEuler | Problem-0168/solutions.py | Python | gpl-3.0 | 996 |
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2012 Zenpar - http://www.zeval.com.mx/
# All Rights Reserved.
#####################################################################... | silvau/Addons_Odoo | filter_by_shop/sale_order.py | Python | gpl-2.0 | 1,619 |
from sqlalchemy import *
from migrate import *
from migrate.changeset import schema
pre_meta = MetaData()
post_meta = MetaData()
post = Table('post', pre_meta,
Column('id', INTEGER, primary_key=True, nullable=False),
Column('text', VARCHAR(length=140)),
Column('nickname', VARCHAR(length=64)),
)
post = Ta... | mencattini/ideal-pancake | microapp/db_repository/versions/003_migration.py | Python | apache-2.0 | 1,065 |
import numpy as np
import sys
import trep
import trep.discopt as discopt
# set mass, length, and gravity:
m = 1.0; l = 1.0; g = 9.8;
# initial state and timesteps:
p0 = 1 # discrete generalized momentum
q0 = 1. # theta config
x0 = np.array([q0, p0]) # initial state
dt = 0.1 # timestep
tf = 10 # final time
tvec = np.a... | MurpheyLab/trep | examples/papers/tase2012/pend-closed-loop.py | Python | gpl-3.0 | 1,569 |
"""
Copyright 2009 Chris Tarttelin and Point2 Technologies
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
conditions and the following dis... | iamwucheng/xml_models2 | xml_models/rest_client/rest_client.py | Python | bsd-2-clause | 4,307 |
# coding=utf-8
from __future__ import absolute_import, division, print_function
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
__copyright__ = "Copyright (C) 2017 The OctoPrint Project - Released under terms of the AGPLv3 License"
import sys
try:
import fcntl
except ImportEr... | Jaesin/OctoPrint | src/octoprint/util/platform/__init__.py | Python | agpl-3.0 | 2,660 |
from otfbot.lib.pluginSupport.decorators import callback
from otfbot.lib.pluginSupport import plugin
from twisted.words.xish import domish
class Plugin(plugin.Plugin):
def __init__(self, bot):
self.bot = bot
self.bot.logger.debug("Hello world")
@callback
def onMessage(self, msg):
i... | otfbot/otfbot | otfbot/plugins/xmppClient/echo.py | Python | gpl-2.0 | 898 |
# pylint: disable=missing-module-docstring, missing-class-docstring
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('dictionary', '0004_auto_20171202_1208'),
]
operations = [
migrations.RemoveField(
... | studybuffalo/studybuffalo | study_buffalo/dictionary/migrations/0005_auto_20171202_1212.py | Python | gpl-3.0 | 1,327 |
from cffi import FFI
ffi = FFI()
ffi.cdef("""
void hello();
""")
lib = ffi.dlopen("/home/zhaomr/workdir/fruit/tests/.execuable/hello.so")
lib.hello()
| zhaomr13/fruit | tests/ffi.py | Python | gpl-2.0 | 154 |
# Copyright 2015 TellApart, 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... | ruo91/aurproxy | tellapart/aurproxy/source/manager.py | Python | apache-2.0 | 12,657 |
#!/home/mshameers/Templates/py2.7_flask.9/bin/python
from app import app
app.run(debug = True)
| mshameers/me | run.py | Python | gpl-2.0 | 95 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
from __future__ import (unicode_literals, absolute_import,
division, print_function)
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from snisi_core.models.Entities impo... | yeleman/snisi | snisi_web/views/monitoring/periodic_sources.py | Python | mit | 1,547 |
from util import hook
import random
with open("plugins/data/larts.txt") as f:
larts = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/slaps.txt") as f:
slaps = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with op... | allanice001/RJ45 | plugins/attacks.py | Python | gpl-2.0 | 3,272 |
import os.path as osp
import numpy as np
import scipy.misc
from keras.preprocessing import image
from keras.preprocessing.image import load_img
from segmentation_dataset import SegmentationDatasetBase
class PascalVOC2012SegmentationDataset(SegmentationDatasetBase):
label_names = np.array([
'background'... | andrewv587/pycharm-project | myFCN/pascal.py | Python | apache-2.0 | 2,731 |
"""Routes for Tags REST API"""
from flask import Blueprint, request, jsonify, render_template
from extensions import db
from models import Tag
tags_api = Blueprint('tags', __name__)
@tags_api.route('/tags', methods=['GET', 'POST'])
def tags_index():
if request.method == 'GET':
return get_all_tags()
... | vug/personalwebapp | views/tags_api.py | Python | mit | 2,888 |
# -*- test-case-name: foolscap.test.test_banana -*-
from __future__ import print_function
from twisted.internet.defer import Deferred
from foolscap.tokens import Violation
from foolscap.slicer import BaseUnslicer
from foolscap.slicers.list import ListSlicer
from foolscap.constraint import OpenerConstraint, Any, IConst... | warner/foolscap | src/foolscap/slicers/tuple.py | Python | mit | 4,685 |
import argparse
import csv
import json
import os
from collections import namedtuple
from PIL import Image
import editdistance
import mxnet as mx
import numpy as np
from callbacks.save_bboxes import BBOXPlotter
from metrics.ctc_metrics import strip_prediction
from networks.svhn import SVHNMultiLineCTCNetwork
from uti... | Bartzi/stn-ocr | mxnet/eval_svhn_model.py | Python | gpl-3.0 | 6,433 |
##############################################################################
# Copyright (c) 2016 ZTE Corporation
# feng.xiaowei@zte.com.cn
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, ... | grakiss888/testapi | opnfv_testapi/tornado_swagger/settings.py | Python | apache-2.0 | 883 |
class A(object):
__slots__ = ("a", "b", "c")
class B(A):
__slots__ = ("d", "e")
def __init__(self):
self.a = 2
self.d = 2 | dahlstrom-g/intellij-community | python/testData/inspections/PyDunderSlotsInspection/writeToInheritedSlot.py | Python | apache-2.0 | 152 |
"""
WSGI config for offloading 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", "offloading.settings")
from django.... | willvanwazer/offloading | offloading/wsgi.py | Python | mit | 395 |
import unittest
from cpuinfo import *
import helpers
class MockDataSource(object):
bits = '32bit'
cpu_count = 2
is_windows = False
arch_string_raw = 'BePC'
uname_string_raw = 'x86_32'
can_cpuid = False
@staticmethod
def has_sysinfo():
return True
@staticmethod
def sysinfo_cpu():
returncode = 0
out... | workhorsy/py-cpuinfo | tests/test_haiku_x86_64_beta_1_ryzen_7.py | Python | mit | 4,536 |
def answer(n, i):
return 0 if n & (1 << i) == 0 else 1
| manishbisht/Competitive-Programming | Algorithms/Bit Manipulation/Get i'th bit from right in a number.py | Python | mit | 59 |
import requests
import xmltodict
import boto3
import botocore
import re
def get_latest_info():
r = requests.get("https://xkcd.com/rss.xml")
rss = xmltodict.parse(r.text)
post = dict()
post["url"] = rss["rss"]["channel"]["item"][0]["link"]
post["num"] = re.search(r"xkcd.com\/([0-9]+)",
... | bwinterton/alexa-xkcd | getter.py | Python | mit | 2,131 |
from django.db.models.signals import post_save, post_delete, m2m_changed
from manager_utils import post_bulk_operation
from entity.config import entity_registry
from entity.models import Entity
from entity.sync import sync_entities, sync_entities_watching
def delete_entity_signal_handler(sender, instance, **kwargs):... | Wilduck/django-entity | entity/signal_handlers.py | Python | mit | 3,919 |
# Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | barnsnake351/neutron | neutron/agent/ovsdb/impl_idl.py | Python | apache-2.0 | 7,813 |
#!/usr/bin/env python
"""This script is given "A DNA string t having length at most 1000 nt" and
returns "The transcribed RNA string of t".
"""
from __future__ import print_function
import argparse
def main(args):
"""Transcribing DNA into RNA"""
t = args.dataset.read()
print(t.replace('T', 'U'), end='... | iansealy/rosalind | rna/rna.py | Python | gpl-3.0 | 643 |
"""
Django settings for starter project.
Generated by 'django-admin startproject' using Django 1.10.2.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... | dwetterau/starter | starter/prod_settings.py | Python | mit | 4,236 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# With the MindfulClock you turn your device into a Bell of Mindfulness.
# Concept, Design: Marcurs Möller
# <marcus.moeller@outlook.com>
# <http://apps.microsoft.com/windows/de-de/app/
# mindfulclock/58063160-9cc6-4dee-9d92-... | MarcusMoeller/mfc | deb/builds/mfc1_1.0-3/mfc1-1.0/mfc1/msg.py | Python | gpl-3.0 | 5,415 |
#!/usr/bin/env python
"""
This script is a trick to setup a fake Django environment, since this reusable
app will be developed and tested outside any specifiv Django project.
Via ``settings.configure`` you will be able to set all necessary settings
for your app and run the tests as if you were calling ``./manage.py te... | ateoto/django-timemanager | timemanager/tests/runtests.py | Python | mit | 1,151 |
__version__ = '0.6.2'
__author__ = 'Jimmy Liu'
"""
for trading data
"""
from tushare.stock.trading import (get_hist_data, get_tick_data,
get_today_all, get_realtime_quotes,
get_h_data, get_today_ticks,
get... | xiaojingyi/tushare | tushare/__init__.py | Python | bsd-3-clause | 3,368 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from appconf import AppConf
trans_app_label = _('Core')
class OppsCoreConf(AppConf):
DEFAULT_URLS = ('127.0.0.1', 'localhost',)
SHORT = 'googl'
SHORT_URL = 'googl.short.GooglUrlShort'
CHANNEL_CONF = {}
VIEWS_LIMIT =... | laborautonomo/opps | opps/core/__init__.py | Python | mit | 4,511 |
import os
from datetime import timedelta
from OpenSSL import SSL
basedir = os.path.abspath(os.path.dirname(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'sample_db.db')
SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
SQLALCHEMY_ECHO = True
# The file name of the newly-gene... | rickyliang/auth | config.py | Python | mit | 1,595 |
#!/usr/bin/env python3.9
import os
import fnmatch
import inspect
from typing import List
from collections import defaultdict
from pathlib import Path
import yaml
import utils
from configVar import config_vars
import pybatch
class HelpItemBase(object):
def __init__(self, name) -> None:
self.name = name... | wavesaudio/instl | help/helpHelper.py | Python | bsd-3-clause | 8,484 |
#!/usr/bin/python
"""Generate directory of random files for testing."""
import sys, os
import argparse
try:
import sh
from sh import openssl
except:
print 'Please install the python sh module first : pip install sh'
exit(1)
class MyParser(argparse.ArgumentParser):
def error(self, message):
... | joe42/fusetests | testsuite/scripts/create_files.py | Python | gpl-3.0 | 2,840 |
"""
Given an almost sorted array in ascending order where only two elements are swapped,
how to sort the array efficiently.
"""
"""
Approach:
1. Scan from left to right to find the first larger element on the left side ie x[i]>x[i+1]
2. Scan from n-1 down to i, and find the first j such that x[j]<=x[i+1]
3. Swap x[i] ... | prathamtandon/g4gproblems | Sorting and Searching/sort_almost_sorted.py | Python | mit | 688 |
import sys
import os
modulepath = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
if modulepath not in sys.path:
sys.path.insert(0, modulepath)
from mdstudio.runner import main
from lie_echo.application import EchoComponent
if __name__ == '__main__':
main(EchoComponent)
| MD-Studio/MDStudio | components/lie_echo/lie_echo/__main__.py | Python | apache-2.0 | 299 |
#!/usr/bin/python
#authors: yeasy.github.com
#date: 2013-07-05
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import socket
import fcntl
import struct
import pickle
from datetime import datetime
from collections import OrderedDict
class HandlerClass(SimpleHTTPRequ... | ascode/jf-linux | docker-compose-demo/compose-haproxy-web/web/index.py | Python | artistic-2.0 | 2,930 |
'''
Created on 02/10/2013
@author: jdsantana
'''
import json
from Actions.qualifieldAction import qualifieldAction
class Recived():
def __init__(self, data):
jdata = json.loads(data)
self.__action = jdata['action']
self.__createAction(jdata['parameters'])
def __createAction(self, ... | JuanDaniel/DBOJ | Engine/src/Common/Recived.py | Python | mit | 588 |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
setup(
ext_modules = cythonize([Extension("LCEngine4", ["LCEngine4.pyx"], libraries=["irina"])])
)
| lukasmonk/lucaschess | LCEngine/setup.py | Python | gpl-2.0 | 215 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 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 datetime import datetime, timedelta
import pytest
from pytz import timezone
from indico.util.date_t... | mvidalgarcia/indico | indico/util/date_time_test.py | Python | mit | 3,878 |
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Sergio Callegari
# All rights reserved.
# This file is part of PyDSM.
# PyDSM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | sergiocallegari/PyDSM | pydsm/NTFdesign/legacy/_quantization_noise_gain.py | Python | gpl-3.0 | 2,175 |
# Copyright 2018 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.
from core.services import luci_auth
from core.services import request
SERVICE_URL = 'https://pinpoint-dot-chromeperf.appspot.com/api'
def Request(endpoin... | chromium/chromium | tools/perf/core/services/pinpoint_service.py | Python | bsd-3-clause | 1,051 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# list... | morelab/weblabdeusto | server/src/voodoo/sessions/redis_gateway.py | Python | bsd-2-clause | 9,686 |
#codecs support
__all__=['RL_Codecs']
from collections import namedtuple
StdCodecData=namedtuple('StdCodecData','exceptions rexceptions')
ExtCodecData=namedtuple('ExtCodecData','baseName exceptions rexceptions')
class RL_Codecs:
__rl_codecs_data = {
'winansi':StdCodecData({
0x007f: 0x2022, # BUL... | Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/reportlab/pdfbase/rl_codecs.py | Python | gpl-3.0 | 54,211 |
# -*- coding: utf-8 -*-
# @Author: Manuel Rodriguez <valle>
# @Date: 13-Sep-2017
# @Email: valle.mrv@gmail.com
# @Last modified by: valle
# @Last modified time: 23-Feb-2018
# @License: Apache license vesion 2.0
from kivy.uix.modalview import ModalView
from kivy.uix.button import Button
from kivy.properties impo... | vallemrv/tpvB3 | tpv/modals/efectivo.py | Python | apache-2.0 | 6,463 |
class Processor:
def get(self, key):
return None
def delete(self, key):
return False
def set(self, key, data):
return False
def add(self, key, data):
return self.set(key, data)
def len(self, key):
return "0"
def contains(self, key, data):
return False
| nmmmnu/MessageQueue | processors/processor.py | Python | gpl-3.0 | 280 |
from openerp.osv import fields, osv
class ir_actions_report_xml_ept(osv.osv):
_inherit = 'ir.actions.report.xml'
_columns = {
'custom_field_name' : fields.char("Custom Name"),
}
ir_actions_report_xml_ept() | manishpatell/erpcustomizationssaiimpex123qwe | addons/ir_actions_report_xml_ept/py/custom_fields.py | Python | agpl-3.0 | 225 |
# -*- coding: utf-8 -*-
from .core import SoyaToolkit
| streethacker/soya | soya/core/__init__.py | Python | gpl-2.0 | 55 |
####################
# Gui V3 16 Sept. 2017 Malacophonous
#####################
'''
API for Gui v3
guiAPP
guiWIN
guiWID
'''
# This class is a subclassed pyglet Window allowing for tracking of widgets and maintaining focus on different areas
import pyglet
from collections import OrderedDict
"... | Malacophonous/CogBlue | guiWIN.py | Python | mit | 7,519 |
# -*- coding: utf-8 -*-
# © 2016 Alessandro Fernandes Martini, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Partner_Wkf',
'summary': "Cria um wdget de estados que confirma as\
infomações do cliente.",
'version': '8.0.1.0.0',
'category': 'Webs... | Trust-Code/trust-addons | partner_wkf/__openerp__.py | Python | agpl-3.0 | 730 |
'''
Deep dive Transect Extraction for Fire Island, NY 2012
Requires: python 2.7, Arcpy
Author: Sawyer Stippa, modified by Ben Gutierrez & Emily Sturdivant
email: esturdivant@usgs.gov; bgutierrez@usgs.gov; sawyer.stippa@gmail.com
Date last modified: 2/26/2016
Notes:
Run in ArcMap python window;
Turn of... | esturdivant-usgs/plover_transect_extraction | TransectExtraction/archive/versions_archive/TE_FI2014.py | Python | gpl-3.0 | 36,486 |
#!/usr/bin/env python3
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & 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... | oliver-sanders/cylc | cylc/flow/scripts/get_resources.py | Python | gpl-3.0 | 2,521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutDecoratingWithFunctions(Koan):
def addcowbell(fn):
fn.wow_factor = 'COWBELL BABY!'
return fn
@addcowbell
def mediocre_song(self):
return "o/~ We all live in a broken submari... | aomelchenko/python_koans | python3/koans/about_decorating_with_functions.py | Python | mit | 905 |
if __name__ == '__main__':
import os
for root, dirs, files in os.walk(os.curdir):
for file in files:
file = file.lower()
#import pdb;pdb.set_trace()
if os.path.splitext(file)[1] in (
'.py',
'.pyw',
'.java',
... | bobwalker99/Pydev | fix_new_lines.py | Python | epl-1.0 | 985 |
import pygame, sys
from BackGround import BackGround
class TextWindow(pygame.sprite.Sprite):
def __init__(self, textFile, bgImage, pos):
pygame.sprite.Sprite.__init__(self, self.containers)
self.textSurface = self.makeTextImage(textFile)
self.image = pygame.image.load(bgImage)
... | KRHS-GameProgramming-2014/Steam-Punk-Game- | story.py | Python | bsd-2-clause | 3,061 |
# Copyright 2011-2015 MongoDB, 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 writin... | felixonmars/mongo-python-driver | test/test_ssl.py | Python | apache-2.0 | 26,393 |
# -*- coding: utf-8 -*-
#
# Copyright 2013-2020 BigML
#
# 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 ... | mmerce/python | bigml/modelfields.py | Python | apache-2.0 | 19,331 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.