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
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/dependency.py | Python | mit | 1,508 |
from clarifai_basic import ClarifaiCustomModel
import os
import urllib2, socket
# instantiate clarifai client
clarifai = ClarifaiCustomModel()
p=os.getcwd()
p=p.replace('\\','/')
#XXXXXXXXXXXXXXXXXXX CAR XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
POSITIVES = []
pos=p+"/images/cars.txt"
with open(pos) as f:
POSITIVES = [x.stri... | shivansh-pro/Sights | customTrainer.py | Python | mit | 7,757 |
#Copyright (c) 2016 Vladimir Vorobev.
#
#Permission is hereby granted, free of charge, to any person obtaining a copy
#of this software and associated documentation files (the "Software"), to deal
#in the Software without restriction, including without limitation the rights
#to use, copy, modify, merge, publish, distri... | unreg/actorbot | actorbot/api/basemessage.py | Python | mit | 4,135 |
import unittest
import logging
import pickle
import inv_erf
from elo import probability_points as prob
logging.basicConfig(level=logging.INFO)
class TestInvErf(unittest.TestCase):
def setUp(self):
with open('random_state.pickle', 'rb') as f:
state = pickle.load(f)
inv_erf.random.sets... | lbianch/nfl_elo | tests/test_inv_erf.py | Python | mit | 2,693 |
from sympy import (Symbol, Rational, Order, C, exp, ln, log, O, var, nan, pi,
S, Integral, sin, conjugate, expand, transpose)
from sympy.utilities.pytest import XFAIL, raises
from sympy.abc import w, x, y, z
def test_caching_bug():
#needs to be a first test, so that all caches are clean
#cache it
e = O... | flacjacket/sympy | sympy/series/tests/test_order.py | Python | bsd-3-clause | 9,210 |
"""
Given four lines in general position,
there are two lines which meet all four given lines.
With Pieri homotopies we can solve this Schubert problem.
For the verification of the intersection conditions, numpy is used.
The plots are made with matplotlib.
"""
from numpy import zeros, array, concatenate, matrix
import ... | janverschelde/PHCpack | src/Python/PHCpy3/examples/fourlines.py | Python | gpl-3.0 | 12,371 |
"""Given user GO ids and parent terms, group user GO ids under one parent term.
Given a group of GO ids with one or more higher-level grouping terms, group
each user GO id under the most descriptive parent GO term.
Each GO id may have more than one parent. One of the parent(s) is chosen
to best represent... | tanghaibao/goatools | goatools/grouper/grprdflts.py | Python | bsd-2-clause | 3,204 |
from __future__ import absolute_import
import responses
from mock import patch
from sentry.constants import SentryAppInstallationStatus
from sentry.mediators.sentry_app_installations import Creator
from sentry.models import (
AuditLogEntry,
AuditLogEntryEvent,
ApiGrant,
ServiceHook,
ServiceHookPr... | mvaled/sentry | tests/sentry/mediators/sentry_app_installations/test_creator.py | Python | bsd-3-clause | 4,113 |
<<<<<<< HEAD
<<<<<<< HEAD
""" Test Iterator Length Transparency
Some functions or methods which accept general iterable arguments have
optional, more efficient code paths if they know how many items to expect.
For instance, map(func, iterable), will pre-allocate the exact amount of
space required whenever the iterable... | ArcherSys/ArcherSys | Lib/test/test_iterlen.py | Python | mit | 22,013 |
import sys
import os
# enable local imports; redirect config calls to general config
def add_install_path():
local_path = os.path.dirname(__file__)
add_paths = [
os.path.join(local_path, '..', '..'), # Install
os.path.join(local_path, '..',), # Install/toolbox
os.path.join(l... | genegis/genegis | Install/toolbox/scripts/add_install_path.py | Python | mpl-2.0 | 583 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Ponzoni, Nelson"
__copyright__ = "Copyright 2015"
__credits__ = ["Ponzoni Nelson"]
__maintainer__ = "Ponzoni Nelson"
__contact__ = "npcuadra@gmail.com"
__email__ = "npcuadra@gmail.com"
__license__ = "GPL"
__version__ = "1.0.0"
_... | lerker/cupydle | cupydle/test/dbn_prueba_GS.py | Python | apache-2.0 | 6,800 |
########################################################################
# Rancho - Open Source Group/Project Management Tool
# Copyright (C) 2008 The Rancho Team
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by t... | joaquimrocha/Rancho | rancho/todo/urls.py | Python | agpl-3.0 | 1,432 |
# -*- coding: utf-8 -*-
"""
A sample of kay settings.
:Copyright: (c) 2009 Accense Technology, Inc.
Takashi Matsuo <tmatsuo@candit.jp>,
All rights reserved.
:license: BSD, see LICENSE for more details.
"""
DEFAULT_TIMEZONE = 'Asia/Tokyo'
DEBUG = True
PROFILE = False
SECRET_... | calvinchengx/O-Kay-Blog-wih-Kay-0.10.0 | kay/tests/datastore_settings.py | Python | bsd-3-clause | 1,101 |
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | adobe-apiplatform/user-sync.py | user_sync/connector/directory_csv.py | Python | mit | 7,836 |
"""Test the demo_commands.py file."""
from memoization import cached
from sw_client.demo_commands import _get_movie, _set_max_id
def test_max_id():
"""Test _test_max_id."""
@_set_max_id(max_id=10)
@cached
def _test_max_id(_id: int) -> int:
return _id
_test_max_id.cache_clear() # act
... | KyleKing/My-Programming-Sketchbook | Assorted_Snippets/python/fake_data_wip/sw_tests.py | Python | mit | 1,026 |
"""
Notebook Tag
------------
This is a liquid-style tag to include a static html rendering of an IPython
notebook in a blog post.
Syntax
------
{% notebook filename.ipynb [ cells[start:end] language[language] ]%}
The file should be specified relative to the ``notebooks`` subdirectory of the
content directory. Optio... | howthebodyworks/pelican-plugins | liquid_tags/notebook.py | Python | agpl-3.0 | 10,596 |
"""
Write a function name_and_age that takes
as input the parameters name (a string) and age (a number)
and returns a string of the form "% is % years old."
Where the percents are the string forms of name and age.
"""
# Name and age formula
def name_and_age(name, age):
return str(name) + ' is ' + str(age)... | PableraShow/Learn-to-program-with-Python-guide | 02 - Functions, logic and conditionals/exercises/name-and-age.py | Python | mit | 592 |
# -*- coding: utf-8 -*-
__author__ = 'study_sun'
import requests
import sys
import urllib
reload(sys)
sys.setdefaultencoding('utf-8')
class SBDownloader(object):
def download(self, url, cookie=None, headers=None):
if url is None:
return None
if cookie == None:
response = re... | s6530085/FundSpider | spider_base/downloader.py | Python | mit | 1,040 |
#!/usr/bin/env python
'''
Project: Geothon (https://github.com/MBoustani/Geothon)
File: Vector/create_geojson_multipoint.py
Description: This code creates a geojson multipoint file from couple point data.
Author: Maziyar Boustani (github.com/MBoustani)
'''
try:
import ogr
except ImportErro... | MBoustani/Geothon | Create Spatial File/Vector/create_geojson_multipoint.py | Python | apache-2.0 | 792 |
import random,math,string
from random import randint
target="11110000"
class Trial:
def __init__(self,seed):
self.value=seed
def score(self,target):
#Harshly punish valuees that aren't the right length
score= (-2)*abs(len(self.value)-len(target))
#Optionally, provide a minor ... | tekdemo/genetic-testing | stringmatch/stringmatch.py | Python | mit | 3,583 |
#! /usr/bin/python
answerx = 0
answery=0
def palindrom(num):
palin=''
tmp = str(num)
y=0
for x in reversed(range(len(tmp))):
palin=palin+str(tmp[x])
y=y+1
return int(palin)
for x in range(100,999):
for y in range(100,999):
if (x * y) == palindrom(x*y):
... | jasimmonsv/CodingExercises | EulerProject/python/problem4.py | Python | gpl-2.0 | 510 |
#!/usr/bin/env python
##~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##~ Copyright (C) 2002-2004 TechGame Networks, LLC.
##~
##~ This library is free software; you can redistribute it and/or
##~ modify it under the terms of the BSD style License as found in the
##~ LICENSE file included with this distribution.... | zulumarketing/html2pdf | xhtml2pdf/w3c/css.py | Python | apache-2.0 | 28,785 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Matt Martz <matt@sivel.net>
# Copyright (C) 2016 Rackspace US, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | kvar/ansible | test/lib/ansible_test/_data/sanity/validate-modules/validate_modules/module_args.py | Python | gpl-3.0 | 4,786 |
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. 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 require... | google/grr | grr/core/accelerated/setup.py | Python | apache-2.0 | 1,089 |
import utils
import logging
import json
from bills import bill_ids_for, save_bill_search_state
from bill_info import fetch_bill, output_for_bill
from amendment_info import fetch_amendment
def run(options):
amendment_id = options.get('amendment_id', None)
bill_id = options.get('bill_id', None)
search_st... | chriscondon/billtext | tasks/amendments.py | Python | cc0-1.0 | 1,859 |
# Copyright (C) 2015 Optiv, Inc. (brad.spengler@optiv.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 3 of the License, or
# (at your option) any later version.
#
# This p... | lixiangning888/whole_project | modules/signatures_orginal_20151110/network_dga.py | Python | lgpl-3.0 | 2,518 |
from gpaw.xc.libxc import LibXC
from gpaw.xc.lda import LDA
from gpaw.xc.gga import GGA
from gpaw.xc.mgga import MGGA
def XC(kernel, parameters=None):
"""Create XCFunctional object.
kernel: XCKernel object or str
Kernel object or name of functional.
parameters: ndarray
Parameters for BEE ... | robwarm/gpaw-symm | gpaw/xc/__init__.py | Python | gpl-3.0 | 3,256 |
class FeatureExtractor:
def guesses(self, question):
"""
Returns all of the guesses for a given question. If this depends on
another system for generating guesses, it can return an empty list.
"""
raise NotImplementedError
@staticmethod
def has_guess():
ret... | EntilZha/qb | feature_extractor.py | Python | mit | 1,200 |
#!/usr/bin/env python
#
# test_codecencodings_jp.py
# Codec encoding tests for Japanese encodings.
#
from test import support
from test import test_multibytecodec_support
import unittest
class Test_CP932(test_multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp932'
tstring = test_multibytecod... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.1/Lib/test/test_codecencodings_jp.py | Python | mit | 3,940 |
# Author: Philippe Katz <philippe.katz@gmail.com>,
# Flavien garcia <flavien.garcia@free.fr>,
# Sylvain Takerkart <Sylvain.Takerkart@incm.cnrs-mrs.fr>
# License: BSD Style.
# Averages a region of interest from an averaged image created using average_trial process
# Imports
from neuroProcesses import *... | SylvainTakerkart/vobi_one | brainvisa/toolboxes/vobi_one/processes/Session Post-Analysis/average_region.py | Python | gpl-3.0 | 10,760 |
"""
Interop PyOpenCL
~~~~~~~~~~~~~~~~
"""
from bohrium_api import stack_info
from .bhary import get_base
from ._bh import get_data_pointer, set_data_pointer, get_device_context
def _import_pyopencl_module():
"""Help function to import PyOpenCL and checks that a OpenCL backend is present"""
try:
import... | madsbk/bohrium | bridge/npbackend/bohrium/interop_pyopencl.py | Python | apache-2.0 | 4,528 |
# -*- coding: utf8
"""Random Projection transformers.
Random Projections are a simple and computationally efficient way to
reduce the dimensionality of the data by trading a controlled amount
of accuracy (as additional variance) for faster processing times and
smaller model sizes.
The dimensions and distribution of R... | xuewei4d/scikit-learn | sklearn/random_projection.py | Python | bsd-3-clause | 23,301 |
"""
URL patterns for the views included in ``django.contrib.auth``.
Including these URLs (via the ``include()`` directive) will set up the
following patterns based at whatever URL prefix they are included
under:
* User login at ``login/``.
* User logout at ``logout/``.
* The two-step password change at ``password/c... | torchingloom/django-registration | registration/auth_urls.py | Python | bsd-3-clause | 2,744 |
# -*- coding: utf-8 -*-
# Path auto-discovery ###################################
import os
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
#########################################################
DEBUG = False
TEMPLATE_DEBUG = DEBUG
SITE_ID = 1
USE_I18N = True
TIME_ZONE = 'America/Sao_Paulo'
LANGUAGE_COD... | ricobl/django-importer | sample_project/settings.py | Python | lgpl-3.0 | 955 |
import unittest
from ..expinfo import *
class TestHelpers(unittest.TestCase):
def test_interval(self):
self.assertEqual(interval([1, 2]), [1., 2.])
self.assertRaises(AssertionError, interval, [0, 0])
self.assertRaises(AssertionError, interval, [0, -1])
def test_check_markers(self):
self.assertEqua... | wmvanvliet/psychic | psychic/tests/testexpinfo.py | Python | bsd-3-clause | 1,636 |
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorboard | tensorboard/uploader/formatters_test.py | Python | apache-2.0 | 8,256 |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function, unicode_literals
import argparse
import os
import subprocess
import btrgit.btrgit as app
HERE = os.path.dirname(__file__)
def make_readme_text():
parser = app.build_parser()
help_text = parser.format_help()
with open('R... | facetframer/btrgit | make-readme.py | Python | gpl-3.0 | 1,368 |
# -*- coding: utf-8 -*-
#
# SWF Sphinx Extension documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 26 00:40:29 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated ... | bboalimoe/ndn-cache-policy | docs/sphinx-contrib/swf/docs/conf.py | Python | gpl-3.0 | 8,111 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import re
from crontab import CronTab
from getpass import getuser
from os.path import abspath, dirname
import sys
sys.path.append(abspath(dirname(abspath(__file__)) + '../../../'))
from core.utils.utils import text2int
ROBOT_DIR = '/home/vs/smarty'
cla... | vsilent/smarty-bot | core/unittest/remind.py | Python | mit | 21,796 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2004-2014 Pexego Sistemas Informáticos All Rights Reserved
# Copyright (C) 2015-2016 Comunitea Servicios Tecnológicos All Rights Reserved
#
# This program is free software: you can redistri... | Comunitea/CMNT_00040_2016_ELN_addons | maintenance/__openerp__.py | Python | agpl-3.0 | 1,851 |
""" addons.xml generator """
import os, md5
class Generator:
"""
Generates a new addons.xml file from each addons addon.xml file.
Must be run from the root of the checked-out repo. Only handles
single depth folder structure.
"""
def __init__( self ):
# generate file
... | poolbuzz/pbstream | zips/addons_xml_generator.py | Python | gpl-2.0 | 2,745 |
"""Defines an equlibration scheme with pH calculation."""
from __future__ import absolute_import
import numpy as np
from .Equilibrator import Equilibrator
from .Multiroot import Multiroot
# pylint: disable=W0232, E1101, W0201, E1103
# TODO: Pull constants from ionize.
# Physical Constants
k_water = 1E-14
lpm3 = 1000... | lewisamarshall/emigrate | emigrate/equilibration_schemes/VariablepH.py | Python | gpl-2.0 | 7,224 |
#!/usr/bin/env python
# -*- encoding:utf-8 -*-
from __future__ import absolute_import
import argparse
import inspect
__all__ = [
'ClimsonException',
'ValidateError',
'BaseCommand',
'add',
'make_option'
]
class ClimsonException(Exception):
pass
class ValidateError(ClimsonException):
def... | takumakanari/climson | climson/climson.py | Python | mit | 2,388 |
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.test import TestCase
from simple_forums.notifications import models
from simple_forums.notifications.testing_utils import (
create_thread_notification)
from simple_forums.tests.testing_utils import create_thread... | smalls12/django_simple_forums | simple_forums/notifications/tests/test_views.py | Python | gpl-3.0 | 4,105 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/util/tf_stack.py | Python | apache-2.0 | 5,298 |
import os
import struct
import urllib.request
import zlib
import re
class PDFImage(object):
def __init__(self, session, path, name):
self.pal = None
self.palette_length = None
self.session = session
self.path = path
self.name = name
self.cursor = None
self... | katerina7479/pypdflite | pypdflite/pdfobjects/pdfimage.py | Python | mit | 10,585 |
#!/bin/env python2.7
"""Main executable for dbdnsd."""
import json
from argparse import ArgumentParser
from time import sleep
from twisted.internet import reactor
from twisted.names import dns, server
from DBResolver import DynamicDBResolver
from models import Base
from sqlalchemy import create_engine
from sqlalchemy.... | luaks/dbdnsd | dbdnsd/dbdnsd.py | Python | mit | 3,066 |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008
# Global Map Tiles Classes
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326,
# generate a simple HTML... | LudvikAdamec/diplomova-prace | public/tileXYZgenerator/globalmaptiles.py | Python | apache-2.0 | 18,239 |
from Memory import *
from Giga import *
from Cube import *
def executeVirtualMachine(functions, quadruples, constants):
print("Virtual machine running...")
countQuadruples = 0
activeMemory = Memory('module', constVarCount , tempVarCount)
globalMemory = Memory('main', globalVarCount , 0)
while quadruples[c... | sanchezz93/Giga-Compiler | Entrega 5/Machine.py | Python | mit | 8,699 |
#!/usr/bin/env python
import unittest
import boostertest
class TestUserDelete(boostertest.BoosterTestCase):
""" Test the user-delete action
"""
def setUp(self):
""" Set the action and other commonly used fixture data """
self.params = {}
self.params['action'] = "user-delete"
... | codycollier/booster | test/test_user_delete.py | Python | apache-2.0 | 3,311 |
class AnnouncementPermissionsBackend(object):
supports_object_permissions = True
supports_anonymous_user = True
def authenticate(self, **kwargs):
# always return a None user
return None
def has_perm(self, user, perm, obj=None):
if perm == "announcements.can_manage":
... | PhilLidar-DAD/geonode | announcements/auth_backends.py | Python | gpl-3.0 | 378 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 Citrix Systems, Inc.
# Copyright 2010 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ... | yrobla/nova | nova/virt/xenapi/host.py | Python | apache-2.0 | 9,653 |
# 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/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/v2020_02_01/models/_container_service_client_enums.py | Python | mit | 10,599 |
'''
Copyright (C) 2014 Parrot SA
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 di... | 149393437/ARSDKBuildUtils | Utils/Python/Common_RemoveVersionsFromSo.py | Python | bsd-3-clause | 3,402 |
# Basic RBC model with full depreciation (Alternate 1)
#
# Jesus Fernandez-Villaverde
# Haverford, July 3, 2013
import numpy as np
import math
import time
from numba import autojit
# - Start Inner Loop - #
# - bbeta float
# - nGridCapital: int64
# - gridCapitalNextPeriod: int... | tomooinoue/Comparison-Programming-Languages-Economics | RBC_Python_Numba.py | Python | mit | 5,046 |
"""
Filters that accept a `CommandLineInterface` as argument.
"""
from __future__ import unicode_literals
from .base import Filter
__all__ = (
'HasArg',
'HasCompletions',
'HasFocus',
'HasSearch',
'HasSelection',
'HasValidationError',
'IsAborting',
'IsDone',
'IsMultiline',
'IsRet... | jaseg/python-prompt-toolkit | prompt_toolkit/filters/cli.py | Python | bsd-3-clause | 3,504 |
# coding=utf-8
__author__ = "Gareth Coles"
import shlex
from system.decorators.log import deprecated
from system.decorators.ratelimit import RateLimitExceededError
from system.enums import CommandState
from system.events import general as events
from system.events.manager import EventManager
from system.logging.logge... | UltrosBot/Ultros | system/commands/manager.py | Python | artistic-2.0 | 13,601 |
import unittest
from mapbox.polyline.codec import PolylineCodec
class PolylineCodecTestCase(unittest.TestCase):
def setUp(self):
self.codec = PolylineCodec()
def test_decode_multiple_points(self):
d = self.codec.decode('gu`wFnfys@???nKgE??gE?????oK????fE??fE')
self.assertEqual(d, [
... | perrygeo/mapbox-sdk-py | tests/test_polyline_codec.py | Python | mit | 1,999 |
class Solution(object):
def singleNumber(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
N = len(nums)
nums_sorted = sorted(nums)
#return nums_sorted
if N>1:
for i in range(0,N):
if nums_sorted[0] != nums_sorted[... | SeisSparrow/Leetcode | python/136.py | Python | mit | 698 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | majetideepak/arrow | python/pyarrow/pandas_compat.py | Python | apache-2.0 | 33,582 |
# Copyright (c) 2011-2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that handles interactions with a Validation Pool.
The validation pool is the set of commits that are ready to be validated i.e.
ready ... | windyuuy/opera | chromium/src/third_party/chromite/buildbot/validation_pool.py | Python | bsd-3-clause | 67,723 |
'''
Created on Jul 31, 2014
Implementation from:
http://craiglabenz.me/2013/06/12/how-i-made-django-admin-scale/
Used because Django admin was crazy slow
@author: u0490822
'''
from django.db import models, connections
from django.db.models.query import QuerySet
class FastCountQuerySet(QuerySet):
'''
... | jamesra/nornir-djangomodel | nornir_djangomodel/custom_query_manager.py | Python | gpl-2.0 | 1,596 |
#!/usr/bin/python
import json
import logging
import sys
from datetime import datetime
import csv
if __name__ == '__main__':
_loggingLevel = logging.DEBUG ## How much trace
logger = logging.getLogger(__name__)
logging.basicConfig(level=_loggingLevel)
a = {}
altmetricFile = sys.argv[1]
with op... | sinharrajesh/dbtools | google-plus-analysis/clarify.py | Python | apache-2.0 | 1,344 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Laudio - A webbased musicplayer
Copyright (C) 2010 Bernhard Posselt, bernhard.posselt@gmx.at
Laudio 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 ... | jgehring/Laudio | laudio/src/javascript.py | Python | gpl-3.0 | 3,237 |
#!/usr/bin/env python
import sys, os, tempfile
def main():
if len(sys.argv) != 2:
print "Please enter the listening port number of your app"
print "Usage: " + sys.argv[0] + " <port>"
return
fd, name = tempfile.mkstemp()
os.close(fd)
os.system("adb devices > " + name)
f = open(name, "r")
for... | asarraf/GroupMessenger | Test Scripts/set_redir.py | Python | mit | 905 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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... | mazaclub/electrum-nmc | gui/android.py | Python | gpl-3.0 | 31,265 |
#!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | Distrotech/scons | test/SWIG/build-dir.py | Python | mit | 3,948 |
'''
This file is part of GEAR.
GEAR is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distrib... | miquelcampos/GEAR_mc | gear/xsi/rig/component/tail_01/__init__.py | Python | lgpl-3.0 | 7,585 |
"""
Django settings for drchrono project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
i... | bajubullet/drchrono | drchrono/settings.py | Python | mit | 2,156 |
from __future__ import absolute_import
from django.test import TestCase
from .models import Person
class SaveDeleteHookTests(TestCase):
def test_basic(self):
p = Person(first_name="John", last_name="Smith")
self.assertEqual(p.data, [])
p.save()
self.assertEqual(p.data, [
... | LethusTI/supportcenter | vendor/django/tests/modeltests/save_delete_hooks/tests.py | Python | gpl-3.0 | 761 |
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation t... | clinton-hall/nzbToMedia | libs/common/beets/util/functemplate.py | Python | gpl-3.0 | 21,110 |
#!/usr/bin/python
import sys
sys.path.append('../waftools')
from genipc_server import build
build('playlist', 'xmms_playlist_t *')
| oneman/xmms2-oneman | src/xmms/playlist_ipc.py | Python | lgpl-2.1 | 133 |
'''
Use the Github API to get the most recent Gist for a list of users
Created on 5 Nov 2019
@author: si
'''
from datetime import datetime
import sys
import requests
class OctoGist:
def __init__(self):
self.base_url = 'https://api.github.com'
self.items_per_page = 100
self.gist_path = (f... | caffeinate/test-pylot | octo_gist/gogo_octogist.py | Python | mit | 3,870 |
#!/usr/bin/env python
from wsgiref.simple_server import make_server
import sys
import json
import traceback
import datetime
from multiprocessing import Process
from getopt import getopt, GetoptError
from jsonrpcbase import JSONRPCService, InvalidParamsError, KeywordError,\
JSONRPCError, ServerError, InvalidRequestE... | mdejongh/CompareGeneContent | lib/CompareGeneContent/CompareGeneContentServer.py | Python | mit | 26,989 |
# -*- coding: utf-8 -*-
u"""
==================================
Input and output (:mod:`scipy.io`)
==================================
.. currentmodule:: scipy.io
SciPy has many modules, classes, and functions available to read data
from and write data to a variety of file formats.
.. seealso:: `NumPy IO routines <ht... | jor-/scipy | scipy/io/__init__.py | Python | bsd-3-clause | 2,636 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright 2011 Piston Cloud Computing, 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
#... | nii-cloud/dodai-compute | nova/virt/xenapi/vm_utils.py | Python | apache-2.0 | 49,055 |
# pyOCD debugger
# Copyright (c) 2015-2019 Arm Limited
# SPDX-License-Identifier: Apache-2.0
#
# 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... | mbedmicro/pyOCD | test/cortex_test.py | Python | apache-2.0 | 22,820 |
# -*- coding: utf-8 -*-
'''
Created on 17.10.2014
@author: Simon Gwerder
'''
import datetime
import json
import logging
from flask import Flask, session, send_from_directory, render_template, request, redirect, jsonify, Response
from flask_bootstrap import Bootstrap
from search.graphsearch import GraphSearch
from ut... | geometalab/OSMTagFinder | OSMTagFinder/web/views.py | Python | mit | 11,951 |
import scrapy
import re
import urlparse
from restaurantScraper.items import MenuItem
class DmozSpider(scrapy.Spider):
name = "justeat"
allowed_domains = ["justeat.in"]
start_urls = [
# "http://justeat.in/noida/wah-ji-wah-sector-27-10760/menu",
"http://justeat.in/noida/restaurants/sector-25... | vishalv2050/scrapy-restaurants | restaurantScraper/spiders/foodPanda_spider.py | Python | mit | 3,155 |
"""Data template classes for discovery used to generate additional data for setup."""
from __future__ import annotations
from collections.abc import Iterable
from dataclasses import dataclass
from typing import Any
from zwave_js_server.const import CommandClass
from zwave_js_server.const.command_class.meter import (
... | Danielhiversen/home-assistant | homeassistant/components/zwave_js/discovery_data_template.py | Python | apache-2.0 | 7,990 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | dmlc/tvm | tests/python/contrib/test_ethosn/test_mean.py | Python | apache-2.0 | 2,066 |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 15 11:39:04 2016
@author: rahulmehra
"""
# Import the modules
import pandas as pd
from sklearn.preprocessing import LabelEncoder
import numpy as np
# Define a function to autoclean the pandas dataframe
def autoclean(x):
for column in x.columns:
# Replace ... | ccbrandenburg/financialanalyticsproject | iembdfa/DataCleaning.py | Python | mit | 1,698 |
"""deCONZ fan platform tests."""
from copy import deepcopy
import pytest
from homeassistant.components.deconz.gateway import get_gateway_from_config_entry
from homeassistant.components.fan import (
ATTR_SPEED,
DOMAIN as FAN_DOMAIN,
SERVICE_SET_SPEED,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
SPEED_H... | partofthething/home-assistant | tests/components/deconz/test_fan.py | Python | apache-2.0 | 5,137 |
from math import log
from random import randrange
def isPrime(n):
if n==2 or n==3: return True
if n%2==0 or n<2: return False
for i in range(3,int(n**0.5)+1,2): # only odd numbers
if n%i==0:
return False
return True
def generateLargePrime(k):
#k is the desired bit length
... | manikTharaka/al-go-rithms | math/prime_sieve/python/create_large_primes.py | Python | mit | 696 |
from sys import stdin
N, S = map(int, stdin.readline().split())
if S/N >= 2:
print("YES")
L = [2]*(N-1)
L.append(S-2*N+2)
print(" ".join(map(str, L)))
print(1)
else:
print("NO")
| zuun77/givemegoogletshirts | codeforces/643-div2/q4.py | Python | apache-2.0 | 204 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file '/home/colin/Projects/OpenCobolIDE/forms/dlg_preferences.ui'
#
# Created by: PyQt5 UI code generator 5.7
#
# WARNING! All changes made in this file will be lost!
from pyqode.qt import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
de... | OpenCobolIDE/OpenCobolIDE | open_cobol_ide/view/forms/dlg_preferences_ui.py | Python | gpl-3.0 | 72,494 |
#!/usr/bin/env python
#
# Copyright 2010 Google 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 o... | potatolondon/potato-mapreduce | test/mapreduce/handlers_test.py | Python | apache-2.0 | 102,043 |
# module pyparsing.py
#
# Copyright (c) 2003-2008 Paul T. McGuire
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to u... | eberle1080/tesserae-ng | website/graphite/thirdparty/pyparsing.py | Python | bsd-2-clause | 147,580 |
from django.core.mail import mail_admins
from django.utils.translation import ugettext as _
from django.shortcuts import get_object_or_404, render
from django.http import HttpResponseRedirect
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login
from django.contrib.auth.decorat... | Resmin/Resmin | resmin/apps/account/views.py | Python | gpl-3.0 | 11,996 |
from rest_framework import serializers
from .models import Book
class BookSerializer(serializers.ModelSerializer):
owner = serializers.ReadOnlyField(source='owner.username')
class Meta:
model = Book
fields = ( 'id', 'owner', 'ISBN', 'title', 'author', 'requested', 'active')
| Guin-/bookswap | bookswap/books/serializers.py | Python | mit | 303 |
def extractExperimentserialWordpressCom(item):
'''
Parser for 'experimentserial.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translate... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractExperimentserialWordpressCom.py | Python | bsd-3-clause | 572 |
#
# Copyright (C) 2009-2011 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it wi... | bbqlinux/pyparted | tests/test__ped_disktype.py | Python | gpl-2.0 | 4,410 |
# coding=utf-8
import sys
from collections import OrderedDict
"""
PatternCount(Text, Pattern)
count ← 0
for i ← 0 to |Text| − |Pattern|
if Text(i, |Pattern|) = Pattern
count ← count + 1
return count
"""
def count_pattern(dna, pattern):
dna = dna.upper()
p... | Bioinformanics/ucsd-bioinformatics-1 | Week1/week1_utility.py | Python | gpl-3.0 | 5,648 |
from mergeRUCBSampler import mergeRUCBSampler
from RelativeThompsonSampler import RelativeThompsonSampler
from RelativeConfidenceSampler import RelativeConfidenceSampler
from RelativeUCBSampler import RelativeUCBSampler
from SAVAGESampler import SAVAGESampler
from BeatTheMeanSampler import BeatTheMeanSampler
from Basel... | redreamality/learning-to-rank | lerot/sampler/__init__.py | Python | gpl-3.0 | 353 |
# -*- coding: ascii -*-
u"""
:Copyright:
Copyright 2014 - 2021
Andr\xe9 Malo or his licensors, as applicable
:License:
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.... | ndparker/gensaschema | tests/unit/test_config.py | Python | apache-2.0 | 2,566 |
import logging
from gettext import gettext as _
from pulp.plugins.importer import Importer
from pulp.common.config import read_json_config
from pulp.server.exceptions import PulpCodedException
from pulp_puppet.common import constants
from pulp_puppet.plugins.importers import configuration, upload, copier
from pulp_p... | ammaritiz/pulp_puppet | pulp_puppet_plugins/pulp_puppet/plugins/importers/importer.py | Python | gpl-2.0 | 3,712 |
"""
These URL patterns are included in two different ways in the main urls.py, with
an extra argument present in one case. Thus, there are two different ways for
each name to resolve and Django must distinguish the possibilities based on the
argument list.
"""
from django.conf.urls import url
from .views imp... | yephper/django | tests/urlpatterns_reverse/included_urls2.py | Python | bsd-3-clause | 489 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import getdate, cstr, flt
from frappe import _, _dict
from erpnext.accounts.utils import get_account_currency
def execu... | tfroehlich82/erpnext | erpnext/accounts/report/general_ledger/general_ledger.py | Python | gpl-3.0 | 9,442 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Scholar2Text - Python App for converting Scholarly PDFs to Text
#
# Converts a single PDF to text
#
# Author: Casey McLaughlin
# License: GPLv2 (see LICENSE.md)
#
import re, os, sys, nltk, numpy
def combineNarrative(txt):
'''Attempts to combine the narrative of text... | idiginfo/scholar2text | python/scholarlynarr.py | Python | gpl-2.0 | 3,048 |
from __future__ import unicode_literals
from django.apps import AppConfig
class CommentsConfig(AppConfig):
name = 'comments'
| bigtree6688/dockerfiles | django_demo/demo/comments/apps.py | Python | gpl-3.0 | 132 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.