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 |
|---|---|---|---|---|---|
from datetime import datetime
from django.test import SimpleTestCase
from corehq.util.dates import get_quarter_date_range, get_quarter_for_date
from corehq.util.test_utils import generate_cases
class TestQuarterRanges(SimpleTestCase):
pass
@generate_cases(
(
(2016, 1, datetime(2016, 1, 1), datetime(... | dimagi/commcare-hq | corehq/util/tests/test_dates.py | Python | bsd-3-clause | 1,872 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import unittest
test_records = frappe.get_test_records('Lead')
class TestLead(unittest.TestCase):
def test_make_customer(self):
f... | indictranstech/focal-erpnext | selling/doctype/lead/test_lead.py | Python | agpl-3.0 | 697 |
from setuptools import setup, find_packages
import os
import sys
CURR_DIR = os.path.abspath(os.path.dirname(__file__))
INSTALL_REQUIRES = [
'pandas',
'six',
'python-pptx']
exec(open('pd2ppt/_version.py').read())
setup(
name='pd2ppt',
version=__version__,
description='Python utility to take a... | robintw/PandasToPowerpoint | setup.py | Python | bsd-3-clause | 563 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/utils/win32/winmanifest.py | Python | gpl-3.0 | 47,286 |
"""
Predicting potential dopants
"""
import warnings
import numpy as np
from pymatgen.analysis.structure_prediction.substitution_probability import (
SubstitutionPredictor,
)
from pymatgen.core.periodic_table import Element, Species
def get_dopants_from_substitution_probabilities(structure, num_dopants=5, thre... | gmatteo/pymatgen | pymatgen/analysis/structure_prediction/dopant_predictor.py | Python | mit | 7,469 |
#!/usr/bin/env python
import fnmatch
import glob
import os
import sys
from setuptools import setup
with open("requirements.txt") as f:
required = f.read().splitlines()
VERSION = "5.2.6"
setup(
name='musicazoo',
version=VERSION,
description='Modular media player',
author='Zach Banks',
author... | zbanks/musicazoo | setup.py | Python | mit | 1,279 |
import json
from six import StringIO
from django.core.management import call_command
from django.test import TestCase
class CommandsTestBase(TestCase):
"""
Command for testing track functionality
"""
def _run_dummy_command(self, *args, **kwargs):
"""
Calls the test command and outpu... | cpennington/edx-platform | common/djangoapps/track/management/tests/test_tracked_command.py | Python | agpl-3.0 | 767 |
from evelink import api
def parse_wallet_transactions(api_result):
rowset = api_result.find('rowset')
rows = rowset.findall('row')
result = []
for row in rows:
a = row.attrib
entry = {
'timestamp': api.parse_ts(a['transactionDateTime']),
'id': int(a['transactionI... | minlexx/pyevemon | evelink/parsing/wallet_transactions.py | Python | gpl-3.0 | 1,137 |
"""Setup for lti_consumer XBlock."""
import os
import re
from setuptools import find_packages, setup
def package_data(pkg, roots):
"""Generic function to find package_data.
All of the files under each of the `roots` will be declared as package
data for package `pkg`.
"""
data = []
for root... | edx/xblock-lti-consumer | setup.py | Python | agpl-3.0 | 5,943 |
import scipy
import matplotlib.pyplot as pyplot
import numpy
import pyfits
from NGCTools import lensletArray
LA = lensletArray()
fig = pyplot.figure(0)
fig.clear()
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
def extractCentroids(frame):
retval = []
xweight = numpy.arange(8)-3.5
yweight = numpy.arange(8)-3.5
... | soylentdeen/CIAO-commissioning-tools | sandbox/checkCentroids.py | Python | mit | 2,194 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# python import
from setuptools import setup, find_packages
version = '0.1.0'
# prepare long description
f = open('README')
LONG_DESCRIPTION = f.read().strip()
f.close()
setup(
name='emencia-django-layout-designer',
version=version,
description='emencia-djan... | pygloo/emencia-django-layout-designer | setup.py | Python | mit | 1,195 |
#!/usr/bin/env python
'''
Copyright (C) 2009 Karlisson Bezerra, contato@nerdson.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ver... | danieljabailey/inkscape_experiments | share/extensions/split.py | Python | gpl-2.0 | 7,849 |
import mandrill
from django.conf import settings
MAIL_CLIENT = None
from typing import Optional
def get_mandrill_client():
# type: () -> Optional[mandrill.Mandrill]
if settings.MANDRILL_API_KEY is None or settings.DEVELOPMENT:
return None
global MAIL_CLIENT
if not MAIL_CLIENT:
MAIL_C... | cosmicAsymmetry/zulip | zerver/lib/mandrill_client.py | Python | apache-2.0 | 397 |
import os
import time
from peek.line_parser import LineParser
from peek.log_file import LogFile
from peek.log_statistics import LogStatistics
def watch_file(file_path, delay=0.1):
with open(file_path, 'r') as log_file:
# Go to the end of the file
log_file.seek(0, 2)
while True:
... | purrcat259/peek | peek/peek_runner.py | Python | mit | 1,825 |
#!/usr/bin/env python
# -*- coding:utf-8 mode:python; tab-width:4; indent-tabs-mode:nil; py-indent-offset:4 -*-
##
import unittest
def runSuite(cls, verbosity=2, name=None):
"""Run a unit test suite and return status code.
:param cls: class that the suite should be constructed from
:type cls : class
:... | mattbernst/polyhartree | tests/common_testcode.py | Python | gpl-3.0 | 808 |
"""
This subpackage is intented for low-level extension developers and compiler
developers. Regular user SHOULD NOT use code in this module.
This contains compilable utility functions that can interact directly with
the compiler to implement low-level internal code.
"""
| jriehl/numba | numba/unsafe/__init__.py | Python | bsd-2-clause | 273 |
#!/usr/bin/env python
"""
FCKeditor - The text editor for Internet - http://www.fckeditor.net
Copyright (C) 2003-2010 Frederico Caldeira Knabben
== BEGIN LICENSE ==
Licensed under the terms of any of the following licenses at your
choice:
- GNU General Public License Version 2 or later (the "GPL")
http://www.gnu.or... | alamgir19/Project | web/bundles/projectbundlefrontend/fckeditor/editor/filemanager/connectors/py/fckoutput.py | Python | mit | 3,923 |
from unittest import TestCase
from sync_comment_h2s import *
my_path = "/".join(os.path.realpath(__file__).split('/')[:-1])
os.chdir(my_path)
sh2s = Sh2s(my_path)
class TestSh2s(TestCase):
def test_unify_function_name(self):
result = 'ostream &operator<<(ostream &, const WordTree &)'
test = 'ostr... | rockkoca/sync-comments-h2s | tests/test_sh2s.py | Python | mit | 6,270 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.api as sm
from scipy.stats import pearsonr as correl
from scipy.special import erfinv
import os
import sys
def probit(p):
'''
Probit function (inverse of standard normal cummulative distribution function)
'''
retu... | JoeJimFlood/RugbyPredictifier | 2018SuperRugby/Validation/Validation.py | Python | mit | 4,501 |
# 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
def GetRecursiveDiskUsage(path):
"""Returns the disk usage in bytes of |path|. Similar to `du -sb |path|`."""
running_size = os.path.getsize(... | appknox/xysec_adb | xysec_adb/pylib/utils/host_utils.py | Python | apache-2.0 | 536 |
import ocl
import camvtk
import time
import datetime
import vtk
def drawTree(myscreen,t,color=camvtk.red,opacity=0.2, offset=(0,0,0)):
nodes = t.get_nodes()
nmax=len(nodes)
i=0
for n in nodes:
cen = n.point()
#print "cen=",cen.str()
scale = n.get_scale()
#print "col=", n... | AlanZatarain/opencamlib | scripts/ocode/ocode_cylcutter_volume_3.py | Python | gpl-3.0 | 10,052 |
from django.db import models
# Create your models here.
class Recipes(models.Model):
class Meta:
app_label = 'recipe'
ingredList = models.TextField()
directions = models.TextField()
title = models.TextField()
| rprobotics/rprobotics | save_money_on_groceriesinator/recipes/models.py | Python | gpl-3.0 | 241 |
import attr
from widgetastic.exceptions import NoSuchElementException
from wrapanapi.systems import VMWareSystem
from . import InfraProvider
from cfme.common.candu_views import VMUtilizationView
from cfme.common.provider import DefaultEndpoint
from cfme.common.provider import DefaultEndpointForm
from cfme.exceptions i... | RedHatQE/cfme_tests | cfme/infrastructure/provider/virtualcenter.py | Python | gpl-2.0 | 4,545 |
# -*- coding: utf-8 -*-
import datetime
from django.test import TestCase
from rest_framework_extensions.test import APIRequestFactory # todo: use from rest_framework when released
from .urls import urlpatterns
from .models import Comment
factory = APIRequestFactory()
class DetailSerializerMixinTest_serializer_d... | ticosax/drf-extensions | tests_app/tests/functional/mixins/detail_serializer_mixin/tests.py | Python | mit | 3,775 |
# Copyright 2017, Google 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | tseaver/gcloud-python | language/tests/unit/gapic/v1beta2/test_language_service_client_v1beta2.py | Python | apache-2.0 | 8,919 |
import logging
class MyLogger:
@classmethod
def setupLogger(cls, moduleName='main', level=logging.INFO):
mainLogger = logging.getLogger(moduleName)
mainLogger.setLevel(level)
fileLogger = logging.FileHandler('{}.log'.format(moduleName))
fileLogger.setLevel(level)
logF... | gotunandan/pygplus | mylogger.py | Python | mit | 513 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | ghchinoy/tensorflow | tensorflow/python/autograph/core/converter.py | Python | apache-2.0 | 12,834 |
raise
raise fob
| msunardi/PTVS | Python/Tests/TestData/Grammar/RaiseStmt.py | Python | apache-2.0 | 21 |
# Licensed under GPL version 3 - see LICENSE.rst
import numpy as np
from scipy.stats import normaltest
import pytest
from ..scatter import RadialMirrorScatter, RandomGaussianScatter
from ..detector import FlatDetector
from ...utils import generate_test_photons
def test_distribution_of_scattered_rays():
'''Check t... | hamogu/marxs | marxs/optics/tests/test_scatter.py | Python | gpl-3.0 | 5,195 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('feedback', '0004_auto_20151015_0016'),
('feedback', '0003_auto_20150926_2339'),
]
operations = [
]
| dotKom/onlineweb4 | apps/feedback/migrations/0005_merge.py | Python | mit | 260 |
# -*- coding: utf-8 -*-
"""
werkzeug.wsgi
~~~~~~~~~~~~~
This module implements WSGI related helpers.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import urllib
import urlparse
import posixpath
import mimetypes
f... | t11e/werkzeug | werkzeug/wsgi.py | Python | bsd-3-clause | 27,528 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-15 17:43
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('common', '0046_auto_20161115_1703'),
]
operations = [
migrations.AlterField... | baylee-d/cos.io | common/migrations/0047_auto_20161115_1743.py | Python | apache-2.0 | 1,717 |
from pandac.PandaModules import *
from direct.gui.DirectGui import *
from direct.showbase import DirectObject
import Avatar
from direct.distributed import DistributedObject
class AvatarPanel(DirectObject.DirectObject):
currentAvatarPanel = None
def __init__(self, avatar, FriendsListPanel = None):
if A... | ksmit799/Toontown-Source | otp/avatar/AvatarPanel.py | Python | mit | 2,504 |
from nose.tools import *
from csc.conceptnet4.analogyspace import *
def test_basic_analogyspace():
mat = conceptnet_2d_from_db('en', cutoff=15)
item = mat.iteritems().next()
key, value = item
concept1, feature = key
filled_side, relation, concept2 = feature
assert filled_side in ['left', 'right... | riseofthetigers/conceptnet | test/test_analogyspace.py | Python | gpl-2.0 | 374 |
"""
Copyright 2009 asylumfunk
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it ... | asylumfunk/xbmc-script.dvdmanager | resources/lib/dvd.py | Python | gpl-3.0 | 2,275 |
# Time: O(n)
# Space: O(1)
#
# The API: int read4(char *buf) reads 4 characters at a time from a file.
#
# The return value is the actual number of characters read. For example, it returns 3 if there is only 3 characters left in the file.
#
# By using the read4 API, implement the function int read(char *buf, int n) ... | yiwen-luo/LeetCode | Python/read-n-characters-given-read4-ii-call-multiple-times.py | Python | mit | 1,921 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-04-10 07:17
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_squashed_0008'),
]
operations = [
migrations.RemoveField(
... | opennode/nodeconductor | waldur_core/core/migrations/0002_remove_organization.py | Python | mit | 398 |
#-*- encoding: utf-8 -*-
import pygtk
pygtk.require('2.0')
import gtk, gobject, cairo
import sys
from events import EVEnum, EventProcessor, ep
from state import state
class MainWindow(object):
def __init__(self, w, h, Widget):
self.window = gtk.Window()
self.window.resize(w, h)
self.window.... | snegovick/map_editor | main_window.py | Python | gpl-3.0 | 16,418 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/databoxedge/azure-mgmt-databoxedge/azure/mgmt/databoxedge/v2021_02_01_preview/operations/_containers_operations.py | Python | mit | 29,643 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Jupyter documentation build configuration file.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
import sys
import os
import shlex
# If extensions (or modules to document with autodoc) are in another directory,
# add these directo... | jupyter/jupyter | docs/source/conf.py | Python | bsd-3-clause | 7,725 |
from django.contrib.gis.geos.geometry import GEOSGeometry, wkt_regex, hex_regex
from django.utils import six
def fromfile(file_h):
"""
Given a string file name, returns a GEOSGeometry. The file may contain WKB,
WKT, or HEX.
"""
# If given a file name, get a real handle.
if isinstance(file_h, ... | simbha/mAngE-Gin | lib/django/contrib/gis/geos/factory.py | Python | mit | 995 |
"""Day 8: Space Image Format"""
from typing import Iterator, List, Tuple
import aoc_common
DAY = 8
class SpaceImage:
width: int
height: int
layers_count: int
_data: List[int]
def __init__(self, width: int, height: int, image_data: str) -> None:
self.width = width
self.height = h... | robjwells/adventofcode-solutions | 2019/python/aoc_2019_08.py | Python | mit | 3,902 |
from multiprocessing import Queue, Process
from Source.communication import Listener, Retrieve
from Source.properties import Text
class Server(object):
pipe = Queue()
listener = Process(target=Listener, args=(pipe,))
def Start(self):
if not self.listener.is_alive():
self.pipe = Que... | flippym/spytify-server | Source/process.py | Python | gpl-3.0 | 1,120 |
from __future__ import print_function, division
from sympy.core.basic import Basic
from sympy.core.mul import Mul
from sympy.core.singleton import S, Singleton
from sympy.core.symbol import Dummy, Symbol
from sympy.core.compatibility import (range, integer_types, with_metaclass,
i... | wxgeo/geophar | wxgeometrie/sympy/series/sequences.py | Python | gpl-2.0 | 29,580 |
################################################################################
# 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... | StephanEwen/incubator-flink | flink-python/pyflink/fn_execution/datastream/window/window_operator.py | Python | apache-2.0 | 24,465 |
__all__ = ["gauth", "gcalendar", "lectio", "lesson", "run"]
| Hanse00/LecToCal | lectocal/__init__.py | Python | apache-2.0 | 60 |
# Python bindings for the v4l2 userspace api
# Copyright (C) 1999-2009 the contributors
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) a... | walterbender/turtleconfusion | plugins/camera_sensor/v4l2.py | Python | mit | 52,396 |
from base import IfbyphoneApiBase
class Addons(IfbyphoneApiBase):
def list(self):
"""List all purchased Addons for an account
"""
self.options['action'] = 'addons.list'
return self.call(self.options)
def purchase(self, **kwargs):
"""Purchase an addon f... | Opus1no2/Ifbyphone-API-Module | src/Ifbyphone/api/addons.py | Python | mit | 685 |
from rest_framework.routers import (
DefaultRouter as BaseDefaultRouter,
Route,
DynamicListRoute,
DynamicDetailRoute,
)
# This was copied from rest_framework.routes.SimpleRouter. The list
# routes are unmodified, so they will have trailing slashes as
# usual. The detail routes were modified so that th... | PSU-OIT-ARC/django-arcutils | arcutils/drf/routers.py | Python | mit | 1,535 |
import hyperdex.client
c = hyperdex.client.Client("127.0.0.1", 1982)
p = c.async_put("kv", "some key", {"v": "Hello World!"})
p1 = c.loop()
print 'put objects are the same:', p is p1
p.wait()
print 'put "Hello World!"'
g = c.async_get("kv", "some key")
g1 = c.loop()
print 'get objects are the same:', g is g1
print 'go... | pombredanne/HyperDex | doc/python/client/hello-world-async-loop.py | Python | bsd-3-clause | 334 |
# Lint as: python2, python3
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
... | ppwwyyxx/tensorflow | tensorflow/tools/docs/py_guide_parser_test.py | Python | apache-2.0 | 2,513 |
from modeltranslation.translator import TranslationOptions, translator
from mezzanine.core.translation import TranslatedRichText
from mezzanine.forms.models import Field, Form
class TranslatedForm(TranslatedRichText):
fields = (
"button_text",
"response",
"email_subject",
"email_m... | stephenmcd/mezzanine | mezzanine/forms/translation.py | Python | bsd-2-clause | 593 |
# -*- coding: utf-8 -*-
"""
(c) 2015 - Copyright Vivek Anand
Authors:
Vivek Anand <vivekanand1101@gmail.com>
"""
from anitya.lib.backends import BaseBackend, get_versions_by_regex
from anitya.lib.exceptions import AnityaPluginException
REGEX = b'class="name">([^<]*[^tip])</td'
class BitBucketBackend(BaseBa... | Prashant-Surya/anitya | anitya/lib/backends/bitbucket.py | Python | gpl-2.0 | 2,572 |
# pyudmx.py - Anyma (and clones) uDMX interface module
# Copyright (C) 2016 Dave Hocker (email: AtHomeX10@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
... | dhocker/uDMX-pyusb | pyudmx/__init__.py | Python | gpl-3.0 | 712 |
import sys
from collections import defaultdict
import pandas
from crawlplot import CrawlPlot, PLOTDIR
from crawlstats import CST, MonthlyCrawl, MultiCount
from top_level_domain import TopLevelDomain
from stats.tld_alexa_top_1m import alexa_top_1m_tlds
from stats.tld_cisco_umbrella_top_1m import cisco_umbrella_top_1m... | commoncrawl/cc-crawl-statistics | plot/tld.py | Python | apache-2.0 | 11,854 |
from .util import to_list
from .sets import *
from .parameter import Parameter
from .variable import Variable
from .model import Model
from .expressions import *
def given(sets = [], parameters = [], variables = []):
''' Create a model from its sets, parameters, and variables '''
return Model.create(sets, parameters... | kurtisz/Readable-Pyomo | readablepyomo/readablepyomo.py | Python | mit | 419 |
#!/usr/bin/python
import socket
import datetime
import sys
import os
from io import StringIO
from lib import *
def main():
controllers = raid.RaidController.probe()
for controller in controllers:
controller.printInfo()
if __name__ == '__main__':
main()
| Bloodoff/raidinfo | esxi.py | Python | gpl-3.0 | 278 |
from PyQt4 import QtGui, QtCore
class MainWidget(QtGui.QWidget):
def __init__(self):
QtGui.QWidget.__init__(self)
btn = QtGui.QPushButton(u"点我", self)
self.connect(btn, QtCore.SIGNAL("clicked()"), self,
QtCore.SLOT("onClicked()"))
@QtCore.pyqtSlot()
def onClicke... | UpSea/midProjects | BasicOperations/01_01_PyQt4/02_Slot_01_Decorated.py | Python | mit | 471 |
## Contains Python client implementation of the Norman Sample Sharing
# framework class
# @copyright CrowdStrike, Inc. 2013
# @organization CrowdStrike, Inc.
#
# Copyright (C) 2013 CrowdStrike, Inc.
# This file is subject to the terms and conditions of the GNU General Public
# License version 2. See the file COPYING i... | CrowdStrike/pyNSSFClient | sample_share.py | Python | gpl-2.0 | 20,096 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Buron and Valeureux Copyright Valeureux.org
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... | Valeureux/wezer-exchange | __unreviewed__/project_marketplace/__init__.py | Python | agpl-3.0 | 965 |
#!/usr/bin/env python3
import argparse
import datetime
import socket
import sys
import time
import aircraft_map
DEFAULT_UPDATE_INTERVAL = 10.0 # seconds
MIN_ALTITUDE = 3000
MAX_ALTITUDE = 40000
MAX_DISTANCE = 70000
def map_int(x, in_min, in_max, out_min, out_max):
"""
Map input from one range to another.
... | ggood/adsbTheremin | map_driver.py | Python | unlicense | 3,058 |
from package import module as alias
class A(alias.B):
def foo(self):
pass
def func(x):
x.foo()
x.bar() | east825/green-type | test/test_data/resolve/local/import_from/absolute/import_module/with_alias.py | Python | mit | 124 |
from . import general_information
| uclouvain/OSIS-Louvain | education_group/views/serializers/__init__.py | Python | agpl-3.0 | 34 |
# Copyright (C) 2017 Linaro Limited
#
# Author: Remi Duraffort <remi.duraffort@linaro.org>
#
# This file is part of Lava Server.
#
# Lava Server is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License version 3
# as published by the Free Software Foundation
... | Linaro/lava-server | lava_scheduler_app/api/aliases.py | Python | agpl-3.0 | 3,605 |
import unittest
import numpy as np
import chainer
from chainer import backend
import chainer.initializers as I
from chainer import optimizer_hooks
from chainer import optimizers
from chainer import testing
from chainer.testing import attr
class SimpleLink(chainer.Link):
def __init__(self, w, g):
super(... | jnishi/chainer | tests/chainer_tests/optimizer_hooks_tests/test_gradient_lars.py | Python | mit | 2,062 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 Romain Boman
#
# 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
#
#... | rboman/progs | apps/EHD/sky/tests/solve1.py | Python | apache-2.0 | 829 |
from edx_ace import MessageType
# This code also exists in the Credentials app `messages.py` file. Any changes here should be duplicated there as well
# until we can come back around and create a common base Messaging class that the Credentials and Records app will
# utilize.
class ProgramCreditRequest(MessageType):
... | edx/credentials | credentials/apps/records/messages.py | Python | agpl-3.0 | 1,071 |
__author__ = 'stephen'
import os,sys
import numpy as np
HK_DataMiner_Path = os.path.relpath(os.pardir)
#HK_DataMiner_Path = os.path.abspath("/home/stephen/Dropbox/projects/work-2015.5/HK_DataMiner/")
sys.path.append(HK_DataMiner_Path)
from lumping import PCCA, PCCA_Standard, SpectralClustering, Ward, PCCA3, PCCA_Plus
f... | stephenliu1989/HK_DataMiner | hkdataminer/scripts/doLumping.py | Python | apache-2.0 | 5,531 |
"""
pyexcel.docstrings.core
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reusible docstrings for pyexcel.core
:copyright: (c) 2015-2017 by Onni Software Ltd.
:license: New BSD License
"""
from . import keywords
__GET_SHEET__ = keywords.SOURCE_PARAMS_TABLE + """
**Parameters**
""" + keywords.SOURCE_PARAMS
__GET_B... | caspartse/QQ-Groups-Spider | vendor/pyexcel/docstrings/core.py | Python | mit | 2,698 |
# import the Flask class from the flask module
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash, json
from flask.json import jsonify
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, UserMixin, current_user, login_user, \
logou... | patengelbert/spotify-jukebox | spotify-jukebox/web/jukeboxServer.py | Python | apache-2.0 | 5,435 |
from bson import DBRef, SON
from base import (BaseDict, BaseList, TopLevelDocumentMetaclass, get_document)
from fields import (ReferenceField, ListField, DictField, MapField)
from connection import get_db
from queryset import QuerySet
from document import Document
class DeReference(object):
def __call__(self, i... | newvem/mongoengine | mongoengine/dereference.py | Python | mit | 8,727 |
"""Module for Galerkin projection of LTI systems."""
import numpy as np
from . import parallel
from . import util
from .py2to3 import range
from .vectors import VecHandleInMemory
from .vectorspace import VectorSpaceArrays, VectorSpaceHandles
def standard_basis(num_dims):
"""Returns list of standard basis vectors... | belson17/modred | modred/ltigalerkinproj.py | Python | bsd-2-clause | 18,696 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... | dav1x/ansible | lib/ansible/modules/cloud/ovirt/ovirt_tags.py | Python | gpl-3.0 | 6,672 |
import copy
from direct.controls.GravityWalker import GravityWalker
from direct.directnotify import DirectNotifyGlobal
from direct.distributed import DistributedObject
from direct.distributed import DistributedSmoothNode
from direct.distributed.ClockDelta import *
from direct.distributed.MsgTypes import *
from direct.f... | linktlh/Toontown-journey | toontown/toon/DistributedToon.py | Python | apache-2.0 | 102,380 |
# Copyright 2009-2014 Justin Riley
#
# This file is part of TethysCluster.
#
# TethysCluster 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
# la... | tethysplatform/TethysCluster | tethyscluster/config.py | Python | lgpl-3.0 | 32,947 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.8 on 2018-05-17 11:09
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('account', '0004_auto_20180509_1112'),
]
operations = [
migrations.RunSQL('CREATE UN... | unicef/un-partner-portal | backend/unpp_api/apps/account/migrations/0005_auto_20180517_1109.py | Python | apache-2.0 | 401 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | etherkit/OpenBeacon2 | client/win/venv/Lib/site-packages/PyInstaller/hooks/pre_safe_import_module/hook-urllib3.packages.six.moves.py | Python | gpl-3.0 | 1,319 |
from iHunterModel.models import DomainObject
from django.db import models
class Country(DomainObject):
name = models.CharField(max_length=255, blank=False)
code = models.CharField(max_length=10, blank=True)
def __str__(self):
return self.name
class State(DomainObject):
name = models.CharField... | kumarsandeep91/Russet.iHunter.Model | iHunterModel/models/Location.py | Python | gpl-3.0 | 667 |
# 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.
from telemetry.page import page as page
from telemetry import story
class ServiceWorkerBenchmarkPage(page.Page):
"""Page for workload to measure some spe... | axinging/chromium-crosswalk | tools/perf/page_sets/service_worker_micro_benchmark.py | Python | bsd-3-clause | 1,389 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'UserKey'
db.create_table('sshkey_userkey', (
('id', self.gf('django.db.models.... | ClemsonSoCUnix/django-sshkey | django_sshkey/south_migrations/0001_initial.py | Python | bsd-3-clause | 5,536 |
import hashlib
import json
import sys
import traceback
from datetime import datetime, timedelta
from functools import wraps
import newrelic.agent
import waffle
from constance import config
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.db.mo... | openjck/kuma | kuma/wiki/models.py | Python | mpl-2.0 | 71,106 |
import subprocess
import fabric
def test():
return subprocess.call("echo Hello from a Fabric script...", shell=True)
def rve(envname):
r = subprocess.call(" ".join("pew wipeenv", envname), shell=True)
r = r & subprocess.call(" ".join("pew rm transitiondrafts", envname), shell=True)
def nve(envname):
r = subp... | BartGo/transition-drafts | fabfile.py | Python | mit | 377 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Hou Shaohui
#
# Author: Hou Shaohui <houshao55@gmail.com>
# Maintainer: Hou Shaohui <houshao55@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the ter... | hillwoodroc/deepin-music-player | src/widget/song_view.py | Python | gpl-3.0 | 25,498 |
import tacticenv
# Run sql_convert for all supported database types
class SQLConvertAll(object):
def convert_all(self):
from pyasm.search.upgrade.mysql import sql_convert
m = sql_convert.MySQLConverter()
m.convert_bootstrap()
from pyasm.search.upgrade.oracle import sql_convert... | diegocortassa/TACTIC | src/bin/util/sql_convert_all.py | Python | epl-1.0 | 749 |
# -*- 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
import os
import json
import pytest
import sys
from nose.plugins.skip i... | hryamzik/ansible | test/units/modules/network/f5/test_bigiq_application_http.py | Python | gpl-3.0 | 5,443 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/managementgroups/models/management_group.py | Python | mit | 2,625 |
"""Mirakuru exceptions."""
class ExecutorError(Exception):
"""Base exception for executor failures."""
def __init__(self, executor):
"""
Exception initialization.
:param mirakuru.base.Executor executor: for which exception occurred
"""
super(ExecutorError, self).__in... | spinus/mirakuru | src/mirakuru/exceptions.py | Python | lgpl-3.0 | 2,916 |
from numpy import sin,cos,deg2rad,rad2deg,arctan2,sqrt
import numpy
import numexpr
def cv_coord(a,b,c,fr=None,to=None,degr=False):
if degr:
degrad = deg2rad
raddeg = rad2deg
else:
degrad = lambda x: x
raddeg = lambda x: x
if fr=='sph':
x=c*cos(degrad(a))*cos(degrad(b... | adrn/gary | gala/coordinates/tests/helpers.py | Python | mit | 2,320 |
from __future__ import print_function
"""
After decompose has split (and before normalize), we still need to adjust the CLN* fields based
on the CLNALLE field.
If we have ALT=A,C,T but CLNALLE=1,3 then there will be only 2 fields in the
rest of the CLN* fields. So we always take the first to be set with ALT=A and
the 2... | bgruening/gemini | gemini/annotation_provenance/clinvar.py | Python | mit | 967 |
"""
Contains utilities for integrating XBlock with Django.
"""
| IONISx/XBlock | xblock/django/__init__.py | Python | agpl-3.0 | 63 |
# 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-servicefabric/azure/servicefabric/models/cluster_configuration.py | Python | mit | 1,022 |
#!/usr/bin/env python
"""Configure the environment for the OnRamp REST server.
Usage: ./bin/onramp_server_install.py
This script sets up a virtual environment for the REST server, installs
dependencies need by the REST server, imports default educational modules into
the environment, and creates a default admin user.... | koepked/onramp | server/bin/onramp_server_install.py | Python | bsd-3-clause | 3,517 |
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
"""
globals attached to frappe module
+ some utility functions that should probably be moved
"""
from __future__ import unicode_literals
from werkzeug.local import Local, release_local
from werkzeug.exceptions impor... | gangadharkadam/office_frappe | frappe/__init__.py | Python | mit | 18,690 |
from django.apps import apps
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.core.exceptions import FieldDoesNotExist
from django.db.models.fields import CharField, Field, related
from django.db.models.options import EMPTY_RELATION_TREE, IMMUTABLE_WARNING
from djan... | hackerbot/DjangoDev | tests/model_meta/tests.py | Python | bsd-3-clause | 11,694 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright 2011 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not... | tomasdubec/openstack-cinder | cinder/openstack/common/rpc/__init__.py | Python | apache-2.0 | 11,722 |
import web
import vobject
import datetime
from dateutil import zoneinfo
urls = (
'/(.*)', 'hello'
)
app = web.application(urls, globals())
def calendar(zone):
tz = zoneinfo.gettz(zone)
c = vobject.iCalendar()
v = c.add('vevent')
v.add('summary').value = 'test'
v.add('description').value = 'tes... | OriHoch/Open-Knesset | tests/timezone/ical.py | Python | bsd-3-clause | 570 |
# -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2018 Bob Swift
# Copyright (C) 2018 Laurent Monin
# Copyright (C) 2018, 2020 Philipp Wolfer
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as pu... | Sophist-UK/Sophist_picard | picard/util/checkupdate.py | Python | gpl-2.0 | 7,024 |
# Always be self-motivating.
from sklearn import datasets
iris = datasets.load_iris()
digits = datasets.load_digits()
print digits.data
| ProfessorX/CIS501 | scikit-test.py | Python | gpl-2.0 | 138 |
#!/bin/python3
from BlumBlumShub import BlumBlumShub
from time import time
from LCG import LCG
from MillerRabin import MillerRabin
from SolovayStrassen import SolovayStrassen
# Os tamanhos a serem considerados.
size_list = [40, 56, 80, 128, 168, 224, 256, 512, 1024, 2048, 4096]
# Gera uma semente para testar os gera... | Ghabriel/ComputerSecurity | t1/main.py | Python | apache-2.0 | 2,659 |
"""Findall regex operations in python.
findall(string[, pos[, endpos]])
Returns a list:
not like search and match which returns objects
Otherwise, it returns an empty list.
"""
import re
# look for every word in a string
pattern = re.compile(r"\w+")
result = pattern.findall("hey bro")
print result
patt = re.compile... | andela-ggikera/regex | findall.py | Python | mit | 700 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.