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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 University of Dundee & Open Microscopy Environment.
# All rights reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foun... | tp81/openmicroscopy | components/tools/OmeroWeb/test/unit/test_marshal.py | Python | gpl-2.0 | 3,814 |
# Copyright 2013 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.
"""Client configuration management.
This module holds the code for detecting and configuring the current client and
it's output directories.
It is responsib... | ChromiumWebApps/chromium | tools/cr/cr/base/client.py | Python | bsd-3-clause | 6,337 |
# This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | DavidAndreev/indico | indico/modules/events/paper_reviewing/forms.py | Python | gpl-3.0 | 1,063 |
#!/usr/bin/python
'''
util.py: frequently used terminal and text processing utilities
copyright (c) 2016 ~endorphant (endorphant@tilde.town)
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 withou... | modgethanc/ttbp | ttbp/util.py | Python | mit | 5,648 |
from datetime import datetime
from django.utils.translation import ugettext as _
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
from basenode import BaseNode
from node import Node
from period import Period
from... | vegarang/devilry-django | devilry/apps/core/models/assignment.py | Python | bsd-3-clause | 6,785 |
import user_fixtures as UF
from pprint import pprint
from nose.plugins.attrib import attr
from rightscale.commands import get_by_path
@UF.requires(UF.TARGET_DEPLOYMENT, UF.TARGET_SERVER)
@attr('rc_creds', 'real_conn')
def test_get_by_path():
res = get_by_path(
'deployments:%s:servers:%s:current_inst... | brantai/python-rightscale | tests/test_get_by_path.py | Python | mit | 411 |
import common
import struct
def FindRadio(zipfile):
try:
return zipfile.read("RADIO/radio.img")
except KeyError:
return None
def FullOTA_InstallEnd(info):
try:
bootloader_img = info.input_zip.read("RADIO/bootloader.img")
except KeyError:
print "no bootloader.img in target_files; skipping inst... | indashnet/InDashNet.Open.UN2000 | android/device/lge/mako/releasetools.py | Python | apache-2.0 | 6,675 |
import math
def square_root ( a ):
"""Computes squar root of a
"""
espilon = 0.1e-11
x = a
while True:
y = ( x + a / x ) / 2.0
if abs( y - x ) < espilon:
return y
x = y
def test_square_root():
"""Compares custom square and math.sqrt.
"""
a = 1.0
... | hacpai/show-me-the-code | Python/0033/main.py | Python | gpl-2.0 | 540 |
# This file is part of aoc2016.
#
# aoc2016 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.
#
# aoc2016 is distributed in the hope th... | T-R0D/JustForFun | aoc2016/aoc2016/day07/test/test_solution.py | Python | gpl-2.0 | 2,344 |
from ompclib_numpy_fast import *
def main():
import os, sys
sys.argv = sys.argv[1:]
if (len(sys.argv) > 0):
sys.path.insert(0, os.path.dirname(sys.argv[0]))
import __main__
dict = __main__.__dict__
exec 'execfile(%r)' % (sys.argv[0],) in dict, dict
# When invok... | pombredanne/ompc | examples/izhikevich/ompc_fast.py | Python | bsd-3-clause | 413 |
from __future__ import print_function
import sys
def main():
'''
A manual configuration file pusher for the crawlers. This will update
Zookeeper with the contents of the file specified in the args.
'''
import argparse
from kazoo.client import KazooClient
parser = argparse.ArgumentParser(
... | istresearch/scrapy-cluster | crawler/config/file_pusher.py | Python | mit | 1,805 |
# ICE Revision: $Id$
"""Command is run and output is analyzed"""
from PyFoam.Execution.BasicRunner import BasicRunner
from PyFoam.Execution.StepAnalyzedCommon import StepAnalyzedCommon
class AnalyzedRunner(StepAnalyzedCommon,BasicRunner):
"""The output of a command is analyzed while being run
Side effects (... | Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | PyFoam/Execution/AnalyzedRunner.py | Python | gpl-2.0 | 2,807 |
people = 20
cats = 30
dogs = 15
if people < cats:
print "Too many cats! The world is doomed!"
if people > cats:
print "Not many cats! The world is saved!"
if people < dogs:
print "The world is drooled on!"
if people > dogs:
print "The world is dry!"
dogs += 5
if people >= dogs:
print "People are greater than... | bencastan/LPTHW | ex29.py | Python | gpl-3.0 | 455 |
# Custom mapper sample for CodeMap plugin
# This script defines a mandatory `def generate(file)` and module attribute map_syntax:
# - `def generate(file)`
# The routine analyses the file content and produces the 'code map' representing the content structure.
# In this case it builds the list of sections (lines th... | oleg-shilo/sublime-codemap | custom_mappers/py.py | Python | mit | 3,804 |
import matplotlib.pyplot as plt
import numpy as np
import logging
import os
from collections import Counter
from apps.CONSTANTS import (
SET_SIZE_LIST,
INTERVAL,
AT_LIST,
GRAPH_SET_COLORS_LIST
)
from apps.evaluators.MAP.algorithm.models import MAP
logger = logging.getLogger(__name__)
def bench_gLin... | DiegoCorrea/ouvidoMusical | apps/evaluators/MAP/analyzer/benchmark.py | Python | mit | 12,055 |
# Copyright (C) 2012 Matt Hagy <hagy@gatech.edu>
#
# 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... | matthagy/PyLJFluid | pyljfluid/__init__.py | Python | apache-2.0 | 1,051 |
"""Example of a highway section network with on/off ramps."""
from flow.core.params import SumoParams, EnvParams, \
NetParams, InitialConfig, InFlows, SumoCarFollowingParams, \
SumoLaneChangeParams
from flow.core.params import VehicleParams
from flow.core.experiment import Experiment
from flow.scenarios.highwa... | cathywu/flow | examples/sumo/highway_ramps.py | Python | mit | 3,510 |
import __builtin__
# appends to line, by typing <typeWhat> after <insertAfterLine> text into <codeArea> widget
def appendToLine(codeArea, insertAfterLine, typeWhat):
if not placeCursorToLine(codeArea, insertAfterLine):
return False
type(codeArea, typeWhat)
return True
# checks if error is properly... | mornelon/QtCreator_compliments | tests/system/shared/suites_qtta.py | Python | lgpl-2.1 | 3,638 |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | Vocalocity/sippy | sippy/CCEvents.py | Python | gpl-2.0 | 2,869 |
# -*- coding: utf-8 -*-
# Copyright (c) 2010-2017 Tuukka Turto
#
# 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,... | tuturto/pyherc | src/pyherc/test/bdd/features/steps/characters.py | Python | mit | 6,208 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
def _print(msg):
print("==> {}".format(msg))
def filename_from_string(text):
"""Produces a valid (space-free) filename from some text"""
text = text.lower()
valid_chars = "-_." + string.ascii_letters + string.digits
return ''.join(c fo... | InnovativeTravel/email-processor | emailprocessor/utils.py | Python | mit | 353 |
# -*- coding: utf-8 -*-
#
# AWL simulator - instructions
#
# Copyright 2012-2014 Michael Buesch <m@bues.ch>
#
# 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
... | gion86/awlsim | awlsim/core/instructions/insn_pl_d.py | Python | gpl-2.0 | 1,807 |
""" Views related to logout. """
from urlparse import parse_qs, urlsplit, urlunsplit
import edx_oauth2_provider
from django.conf import settings
from django.contrib.auth import logout
from django.urls import reverse_lazy
from django.shortcuts import redirect
from django.utils.http import is_safe_url, urlencode
from dj... | ahmedaljazzar/edx-platform | openedx/core/djangoapps/user_authn/views/logout.py | Python | agpl-3.0 | 3,688 |
# -*- coding: UTF-8 -*-
from collections import namedtuple, OrderedDict
def get_namedtuple_choices(name, choices_tuple):
"""Factory function for quickly making a namedtuple suitable for use in a
Django model as a choices attribute on a field. It will preserve order.
Usage::
class MyModel(models.... | rosscdh/python-secupay | secupay/utils.py | Python | mit | 2,971 |
#!/usr/bin/python2.7
from oslo.config import cfg
from neutron.agent.common import config as agent_config
from neutron.agent.linux import daemon
from neutron.agent.linux import ip_lib
from neutron.agent.linux import utils as agent_utils
from neutron.common import config
from neutron.common import utils
from neutron.open... | mangelajo/ovh-ebtables-agent | ovhagent/ovh_ebtables_agent.py | Python | apache-2.0 | 4,861 |
from corehq.apps.groups.models import Group
from corehq.apps.reports.daterange import get_simple_dateranges
from dimagi.ext.couchdbkit import *
from dimagi.utils.decorators.memoized import memoized
DAILY = "daily"
WEEKLY = "weekly"
MONTHLY = "monthly"
DEFAULT_HOUR = 8
DEFAULT_WEEK_DAY = 1
DEFAULT_MONTH_DAY = 1
SCHE... | qedsoftware/commcare-hq | corehq/apps/performance_sms/models.py | Python | bsd-3-clause | 1,825 |
from matplotlib.colors import LinearSegmentedColormap
from numpy import nan, inf
cm_data = [[0., 0., 0.],
[0., 0.00392157, 0.],
[0., 0.00784314, 0.],
[0., 0.0117647, 0.],
[0., 0.0156863, 0.],
[0., 0.0196078, 0.],
[0., 0.0235294, 0.],
[0., 0.027451, 0.],
[0., 0.0313725, 0.],
[0., 0.0352941, 0.],
[0., 0.0392157, 0.],
[0.... | planetarymike/IDL-Colorbars | IDL_py_test/008_GREEN-WHITE_LINEAR.py | Python | gpl-2.0 | 6,996 |
# -*- coding: utf-8 -*-
import pyfbsdk
from anima.dcc.base import DCCBase
class ClipData(object):
"""Holds Story clip related data"""
def __init__(
self,
shot_name=None,
fbx_path=None,
movie_path=None,
cut_in=None,
cut_out=None,
fps=None,
):
... | eoyilmaz/anima | anima/dcc/motion_builder/__init__.py | Python | mit | 4,425 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@author: Joseph
@email:liseor@gmail.com
Created on 2012-6-10
'''
import MySQLdb
#------------------------------------------------------------------------------ 链接数据库
conn = MySQLdb.connect(host="127.0.0.1",user="logic",passwd="logic123",db="drupal7")
cursor = conn.cur... | ptphp/PyLib | src/dev/db/mysqldb.py | Python | apache-2.0 | 349 |
# coding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import time
import threading
import requests
class AppRouter(object):
def __init__(self, app_id, region):
self.app_id = app_id
... | leancloud/python-sdk | leancloud/app_router.py | Python | lgpl-3.0 | 2,303 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 8 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import re
from contextlib import ... | jeanlinux/calibre | src/calibre/gui2/store/stores/amazon_es_plugin.py | Python | gpl-3.0 | 7,747 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @file
# @author (C) 2015 by Roman Khassraf <rkhassraf@gmail.com>
# @section LICENSE
#
# Gr-gsm 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,... | 0x7678/gr-gsm | python/qa_burst_timeslot_filter.py | Python | gpl-3.0 | 6,722 |
>>> myTuple = (1, 2, 3)
>>> myTuple[1]
2
>>> myTuple[1:3]
(2, 3)
| schmit/intro-python-course | lectures/code/tuples_basics.py | Python | mit | 65 |
from distutils.core import setup
import py2exe, sys, os
gameConsolePath = 'Applications/GameConsole'
sys.path.insert(0, gameConsolePath)
sys.argv.append('py2exe')
logo = os.path.join('dist/images/logo.ico')
distDir = "dist/MatrixGames"
if not os.path.isdir(distDir):
os.makedirs(distDir)
class Target:
def... | MatrixGamesHub/MatrixGames | setup.py | Python | gpl-3.0 | 2,783 |
ass Solution(object):
def canCross(self, stones):
"""
:type stones: List[int]
:rtype: bool
"""
dp = [set() for _ in xrange(len(stones))]
dp[0].add(1)
for i in xrange(len(stones)-1):
for step in dp[i]:
target = stones[i] + step
... | zqfan/leetcode | algorithms/403. Frog Jump/solution3.py | Python | gpl-3.0 | 784 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2009 Hewlett-Packard Development Company, L.P.
#
# 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 Lice... | matrumz/RPi_Custom_Files | Printing/hplip-3.15.2/pqdiag.py | Python | gpl-2.0 | 2,436 |
# ===============================================================================
# Copyright 2018 ross
#
# 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/LICE... | UManPychron/pychron | launchers/launcher.py | Python | apache-2.0 | 977 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# outdated-aur-package-installer: Recompile AUR packages that rely
# on old versions of updated libraries.
#
# Copyright (C) 2017 Thomas Fischer
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public ... | tomifischer/outdated-aur-package-installer | update-foreign-packages.py | Python | gpl-3.0 | 4,778 |
import os
import sys
import codecs
import shutil
import logging
import configparser
from .exceptions import HelpfulError
LOG = logging.getLogger(__name__)
class Config:
""" TODO """
# noinspection PyUnresolvedReferences
def __init__(self, config_file):
self.config_file = config_file
self... | DiscordMusicBot/MusicBot | musicbot/config.py | Python | mit | 13,867 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | googleapis/php-grafeas | owlbot.py | Python | apache-2.0 | 2,842 |
#!/usr/bin/env python
# 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 argparse
import base64
import errno
import json
import os
import taskcluster
def write_... | mozilla-mobile/firefox-ios | taskcluster/scripts/get-secret.py | Python | mpl-2.0 | 2,636 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/btm_individual_occurrence_query626.py | Python | mit | 8,660 |
import pygame
import random
import math
import img
#player constants
PSPEED = 5
PSIZE = 32
PDIR_U = 0
PDIR_UR = 1
PDIR_R = 2
PDIR_DR = 3
PDIR_D = 4
PDIR_DL = 5
PDIR_L = 6
PDIR_UL = 7
#pickup constants
BSIZE = 5
BSPEED = 0
BDMGUP = 1
BASUP = 2
#projectile constants
KSIZE = 1
KSPEED = 15
... | clocsinjr/tank | entity.py | Python | mit | 3,607 |
import math
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk import word_tokenize
from nltk import sent_tokenize
nltk.download('punkt')
nltk.download('vader_lexicon')
def sentiment_analysis(tweet):
# Find the average sentiment for the tweet as a whole
lines_list = sent_tokenize(tw... | aamin25/Python_Practice | Custom_Sentiment.py | Python | gpl-3.0 | 1,388 |
# Copyright 2013 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... | sajuptpm/python-neutronclient-ipam | neutronclient/neutron/v2_0/agent.py | Python | apache-2.0 | 1,721 |
#!/usr/bin/env python
from abc import ABCMeta
import numpy as np
from qsrrep_hmms.hmm_abstractclass import HMMAbstractclass
class QTCHMMAbstractclass(HMMAbstractclass):
__metaclass__ = ABCMeta
def __init__(self):
super(QTCHMMAbstractclass, self).__init__()
def _create_transition_matrix(self, si... | Raziel90/strands_qsr_lib | qsr_prob_rep/src/qsrrep_hmms/qtc_hmm_abstractclass.py | Python | mit | 5,116 |
# -*- coding: utf-8 -*-
from django.db import models
from django.contrib.auth.models import User
from jsonfield import JSONField
import xmlrpclib
from django.conf import settings
import os
from email.utils import parsedate
from datetime import datetime
import time
from django.core.exceptions import ValidationError
de... | mikexine/tweetset | tweetset/collect/models.py | Python | mit | 7,130 |
# Copyright 2014 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | nash-x/hws | neutron/db/migration/alembic_migrations/versions/492a106273f8_brocade_ml2_mech_dri.py | Python | apache-2.0 | 1,925 |
# -*- coding: utf-8 -*-
# Copyright 2018-2021 University of Oslo, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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
# (... | unioslo/cerebrum | Cerebrum/modules/job_runner/queue.py | Python | gpl-2.0 | 17,092 |
# Generated by Django 2.2.4 on 2019-08-07 19:56
import awx.main.utils.polymorphic
import awx.main.fields
from django.db import migrations, models
import django.db.models.deletion
from awx.main.migrations._rbac import (
rebuild_role_parentage, rebuild_role_hierarchy,
migrate_ujt_organization, migrate_ujt_organ... | GoogleCloudPlatform/sap-deployment-automation | third_party/github.com/ansible/awx/awx/main/migrations/0109_v370_job_template_organization_field.py | Python | apache-2.0 | 3,857 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-12-20 16:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("events", "0030_auto_20171213_1321")]
operations = [
migrations.AlterField(
m... | lafranceinsoumise/api-django | agir/events/migrations/0031_auto_20171220_1737.py | Python | agpl-3.0 | 1,112 |
from PyQt4.QtCore import *
def logit(dat):
rt=open("access.log","a")
rt.write(dat+"\n")
rt.close()
class slResizer(object):
def __init__(self,ui):
self.ui=ui
self.ma=False
self.slapObjects()
def slapObjects(self):
#record all object sizes as they currently are
se... | eegroopm/pyLATTICE | resources/pyqtresizer_py2.py | Python | gpl-2.0 | 5,613 |
from unittest import main
from ... import dpo7104
from .. import mock_dpo7104
from ...tests.server.test_dpo7104 import DPO7104Test
# Don't lose the real device.
real_DPO7104 = dpo7104.DPO7104
is_mock = DPO7104Test.mock
def setup():
# Run the tests with a fake device.
dpo7104.DPO7104 = mock_dpo7104.MockDPO7104
... | 0/SpanishAcquisition | spacq/devices/tektronix/mock/tests/test_mock_dpo7104.py | Python | bsd-2-clause | 510 |
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
from ctypes import windll, Structure, b... | JT5D/Alfred-Popclip-Sublime | Sublime Text 2/SideBarEnhancements/send2trash/plat_win.py | Python | gpl-2.0 | 1,586 |
import weakref
class History:
"""Keep track of recent operations, for a status display."""
name = "history"
MAX_DOWNLOAD_STATUSES = 10
MAX_UPLOAD_STATUSES = 10
MAX_MAPUPDATE_STATUSES = 20
MAX_PUBLISH_STATUSES = 20
MAX_RETRIEVE_STATUSES = 20
def __init__(self, stats_provider=None):
... | daira/tahoe-lafs-debian | src/allmydata/history.py | Python | gpl-2.0 | 3,866 |
# #
# Copyright 2013-2021 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (... | hpcugent/easybuild-framework | easybuild/framework/easyconfig/format/one.py | Python | gpl-2.0 | 28,029 |
import stim
import stimzx
def test_repr():
e = stimzx.ExternalStabilizer(input=stim.PauliString("XX"), output=stim.PauliString("Y"))
assert eval(repr(e), {'stimzx': stimzx, 'stim': stim}) == e
| quantumlib/Stim | glue/zx/stimzx/_external_stabilizer_test.py | Python | apache-2.0 | 203 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#!//anaconda/bin/python
#!flask/bin/python
from app import app
app.run(debug=True) | Aturen/Fibonacci | run.py | Python | apache-2.0 | 128 |
import pathlib
import pytest
from numpy.testing import assert_array_equal
from functools import partial
import zarr
from zarr.core import Array
from zarr.storage import (DirectoryStore, NestedDirectoryStore, FSStore)
from zarr.tests.util import have_fsspec
needs_fsspec = pytest.mark.skipif(not have_fsspec, reason="... | zarr-developers/zarr-python | zarr/tests/test_dim_separator.py | Python | mit | 4,447 |
__all__ = ['foo', 'bar']
for i in range(5):
__all__ += 'f' + str(i)
| idea4bsd/idea4bsd | python/testData/stubs/AugAssignDunderAll.py | Python | apache-2.0 | 73 |
#!/usr/bin/python
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import django.shortcuts
import json
from wlokalu.api import presence
#-----------------------------------------------------------------------------
from wlokalu.logging import getLogger, message as log
logger... | HackerspaceWroclaw/wlokalu | wlokalu/api/v1/views.py | Python | gpl-3.0 | 4,880 |
*** xx/configure.py.orig 2005-05-11 20:01:53.719957680 +0400
--- xx/configure.py 2005-05-11 20:05:29.699123856 +0400
@@ -721,7 +721,7 @@
from distutils.sysconfig import get_confi... | amiramix/serna-free | 3rd/pyqt/4.5.4/_patches/darwin/patch-configure.py | Python | gpl-3.0 | 1,464 |
#!/usr/bin/python
#
# Copyright 2013 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 required b... | coxmediagroup/googleads-python-lib | examples/adxbuyer/v201506/error_handling/handle_partial_failures.py | Python | apache-2.0 | 3,665 |
from django.apps import AppConfig
class TSAdmUserConfig(AppConfig):
name = 'tsadmuser'
| tsadm/webapp | src/tsadmuser/apps.py | Python | bsd-3-clause | 93 |
# IVLE - Informatics Virtual Learning Environment
# Copyright (C) 2007-2008 The University of Melbourne
#
# 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
# (a... | dcoles/ivle | ivle/webapp/tutorial/test/TestFramework.py | Python | gpl-2.0 | 26,386 |
#
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2013 Star2Billing S.L.
#
# The Initia... | hardikk/newfies-dialer | newfies/dialer_contact/tests.py | Python | mpl-2.0 | 15,547 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0002_auto_20150616_2121'),
('blog', '0002_auto_20150927_0631'),
]
operations = [
mi... | tykling/blog.tyk.nu | src/blog/migrations/0003_blogpost_tags.py | Python | bsd-3-clause | 579 |
# This file is part of Buildbot. Buildbot 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 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | zozo123/buildbot | master/buildbot/test/util/www.py | Python | gpl-3.0 | 6,740 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable-msg=C0103
##***** BEGIN LICENSE BLOCK *****
##Version: MPL 1.1
##
##The contents of this file are subject to the Mozilla Public License Version
##1.1 (the "License"); you may not use this file except in compliance with
##the License. You may obtain a copy... | mpetyx/pychatbot | SemanticWebApproach/RoboWriter/allegrordf-1.0.1/franz/openrdf/util/strings.py | Python | apache-2.0 | 2,116 |
import base64
import datetime
import MySQLdb
import requests
import sqlite3
from MySQLdb import converters
def getcursor(config, dbms):
if dbms.lower() == "mysql":
dbcon = MySQLdb.connect(config['host'],config['user'],config['pass'],config['name'])
return dbcon.cursor()
if dbms.lower() == "sqlite":
dbcon =... | FikriFadzil/Bekas-Madoo | client/libs/main.py | Python | mit | 1,463 |
# encoding: utf-8
# Copyright (c) 2008, Eric Moritz <eric@themoritzfamily.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copy... | rsms/smisk | lib/smisk/wsgi.py | Python | mit | 8,466 |
# disklabel.py
# Device format classes for anaconda's storage configuration module.
#
# Copyright (C) 2009 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 ... | wgwoods/blivet | blivet/formats/disklabel.py | Python | gpl-2.0 | 16,392 |
#!/usr/bin/env python
# ==============================================================================
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with the License. A copy of th... | radlws/AWS-ElasticBeanstalk-CLI | eb/macosx/python2.7/scli/api_wrapper.py | Python | apache-2.0 | 9,914 |
# 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
# distributed under t... | flochaz/horizon | openstack_dashboard/dashboards/vledashboard/stacks/api.py | Python | apache-2.0 | 2,863 |
from rank.models import Player
from utils.api import get_watcher
import time
import json
def search(my_id):
if True:
match = get_watcher().get_match_list(my_id,'na')
match_id_list = [i['matchId'] for i in match['matches'] if i['queue'] == 'TEAM_BUILDER_DRAFT_RANKED_5x5'][:9]
match_details = ... | soileater/noobest | rank/training.py | Python | mit | 4,006 |
#python
import k3d
doc = k3d.new_document()
axes = k3d.plugin.create("Axes", doc)
k3d.property.connect(doc, axes.get_property("axes"), axes.get_property("xyplane"));
if k3d.property.connection(doc, axes.get_property("xyplane")).name() != "axes":
raise "xyplane dependency should be axes"
if k3d.property.connection... | barche/k3d | tests/python/get_dependency.py | Python | gpl-2.0 | 401 |
#!/usr/bin/python
import networkx as nx
import sqlite3
import argparse
import os.path
import psycopg2
###############################################################################
##### Helpers
###############################################################################
def write_graph(org, graph):
"""dump... | sdanzige/cmonkey-python | nwportal/export_cytoscape.py | Python | lgpl-3.0 | 8,730 |
# -*- coding:utf-8 -*-
# Copyright (c) 2011 Mounier Florian
# Copyright (c) 2011 Paul Colomiets
# Copyright (c) 2012 roger
# Copyright (c) 2012-2014 Tycho Andersen
# Copyright (c) 2013 Tao Sauvage
# Copyright (c) 2013 Arnas Udovicius
# Copyright (c) 2014 ramnes
# Copyright (c) 2014 Sean Vig
# Copyright (c) 2014 Nathan ... | andrewyoung1991/qtile | libqtile/layout/tree.py | Python | mit | 19,522 |
# Copyright: (c) 2012, Jan-Piet Mens <jpmens () gmail.com>
# 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
from ansible import constants as C
from ansible.release import __version__ as ... | s-hertel/ansible | lib/ansible/utils/plugin_docs.py | Python | gpl-3.0 | 11,266 |
from django.contrib import admin
from .models import PasswordManager
admin.site.register(PasswordManager)
| JacekKarnasiewicz/HomePage | apps/password_manager/admin.py | Python | mit | 108 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-05-09 09:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('app', '0136_letter'),
]
operations = [
migrations.AlterModelOptions(
nam... | malaonline/Server | server/app/migrations/0137_auto_20160509_1755.py | Python | mit | 399 |
# -*- coding: utf-8 -*-
from __future__ import print_function
#
# 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 version.
#
# Thi... | candlepin/virt-who | tests/test_config_section_libvirtd.py | Python | gpl-2.0 | 13,666 |
'''
examples/user.py
An small, but complete, example of creating a model.
'''
import pureodm, pureodm.codecs
import pymongo
class User(pureodm.Model):
fields = {
'name': {
'type': str,
'required': True
},
'password': {
'type': str,
'required... | nesv/pureodm | examples/create_user.py | Python | mit | 735 |
# 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/network/azure-mgmt-network/azure/mgmt/network/v2019_09_01/operations/_virtual_network_gateways_operations.py | Python | mit | 124,864 |
# pylint: disable-msg=W0613, W0602
# Copyright 2008 German Aerospace Center (DLR)
#
# 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
#
# Unles... | LevskiWeng/svnchecker-fork | handlers/Console.py | Python | apache-2.0 | 966 |
from django.core.management.base import BaseCommand
from treeherder.client.thclient import TreeherderClient
from treeherder.model.models import (BuildPlatform,
FailureClassification,
JobGroup,
JobType,
... | kapy2010/treeherder | treeherder/model/management/commands/import_reference_data.py | Python | mpl-2.0 | 5,457 |
from StrongHold import Newick
def child_prob(a,b):
'''Returns the genotype probability for a child with parents who have genotype probabilities a and b.'''
# Comes from the conditional probability of each possible Punit square.
AA = a[0]*b[0] + 0.5*(a[0]*b[1] + a[1]*b[0] + 0.5*a[1]*b[1])
Aa = a[0]*b[2] + a[2]*b[0]... | crf1111/Bio-Informatics-Learning | Bio-StrongHold/src/Inferring_Genotype_from_a_Pedigree.py | Python | mit | 1,261 |
__author__ = 'ramapriyasridharan'
import matplotlib.pyplot as plt
import numpy as np
import argparse
import pandas as pd
import scipy as sp
import scipy.stats, math
import sys
import os
import ConfigParser
import csv
warm_up = 100
cool_down = 100
def refine(df):
start_time = np.min(df['timestamp'])
#print s... | GHrama/ameowsmeowl-2015 | plotting scripts/plot_clients_requests.py | Python | mit | 4,014 |
# coding=UTF-8
# This file is part of TBParser.
#
# TBParser 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.
#
# TBParser is distribut... | ThomasBollmeier/TBParser | tbparser/lexer.py | Python | gpl-3.0 | 13,032 |
#!/usr/bin/env python
import gzip, os, time, StringIO
output = StringIO.StringIO()
data1 = '<html><body>Two lines should be visible.<br/>The second line.</body></html>'
f1 = gzip.GzipFile("/tmp/1.gz", mode = "wb", fileobj=output)
f1.write(data1)
f1.close()
cd1 = output.getvalue()
output.close()
length = len(cd1)
n... | chriskmanx/qmole | QMOLEDEV/elinks-0.12pre5/test/cgi/chunked_gzip.py | Python | gpl-3.0 | 695 |
"""
# Copyright (C) 2007 Rob King (rob@re-mu.org)
#
# 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 2.1 of the License, or (at your option) any later version.
#
#... | derivativeinc/liveapi | src/LiveOSC/LiveOSCCallbacks.py | Python | lgpl-2.1 | 15,574 |
# This test tries to use waitforconn and openconn from repy to get a real socket.
# It then manually initializes the Multiplexer, and attempts to exchange the numbers 1 to 100
# Get the Multiplexer
include Multiplexer.py
MAX_NUM = 100
# Handle a new virtual connection
def new_virtual_conn(remoteip, remoteport, virtu... | sburnett/seattle | multiplexer/tests/test_10_recv_returns_data_after_peer_close.py | Python | mit | 1,928 |
#name<=>Hydra's Tooth
#texture<=>seeds_melon
#cooldown<=>10000
#...even the hydra only had so many mouths, OK?
#target_type<=>projectile
def smartspawn(x,y,z,entity,nbt):
while(getblock(x,y,z) != AIR or getblock(x,y+1,z) != AIR):
y+=1
spawnentity(x,y,z,entity,nbt)
def hydras_tooth(x,y,z):
import random
for i in ... | sapphon/minecraftpython | src/main/resources/assets/techmage/scripts/techmage/necromancer/hydras_tooth.py | Python | gpl-3.0 | 672 |
import html.entities
import re
import unicodedata
import warnings
from gzip import GzipFile
from io import BytesIO
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.functional import SimpleLazyObject, keep_lazy_text, lazy
from django.utils.regex_helper import _lazy_re_compile
from django.... | georgemarshall/django | django/utils/text.py | Python | bsd-3-clause | 14,098 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a cut and paste of the integration tests plugin. Intended for running Selenium/Behave type
Acceptance tests
"""
import os
import sys
from pybuilder.core import init, use_plugin, task, description, depends
from pybuilder.utils import execute_command, Timer
fr... | zenweasel/pybuilder-contrib | contrib/plugins/run_acceptance_tests.py | Python | bsd-3-clause | 6,804 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'sqw.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Quote(object):
def setupUi(self, Quote):
Quote.setObjectName("Qu... | ax333l/QuoteBook | QuoteBook/sqv.py | Python | gpl-3.0 | 3,777 |
# (C) Datadog, Inc. 2013-2016
# (C) Josiah C Webb <rootkix@gmail.com> 2013
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
# stdlib
import os
# project
from checks import AgentCheck
from utils.subprocess_output import get_subprocess_output
class PostfixCheck(AgentCheck):
"""
This ... | varlib1/servermall | postfix/check.py | Python | bsd-3-clause | 8,274 |
from datetime import datetime
class Notification(object):
def __init__(self, text, link, date, keyword):
self.text = text
self.link = link
self.date = date
self.keyword = keyword
self.status_date = datetime.now()
self.status = 'W'
def __str__(self):
ret... | alex-pole/newsscrapperbot | src/notification.py | Python | apache-2.0 | 575 |
#!/user/bin/env python3
import json
import random
class leet:
def execute(self, args, user_profile):
parts = ' '.join(args[0:])
leet = json.load(open("lists/leet.json"))
str = ""
for c in parts:
if c in leet:
char = random.choice(leet[c])
... | dustin638/Mirabell | modules/leet.py | Python | gpl-3.0 | 474 |
import re
import unittest
import numpy
import pytest
import cupy
from cupy import testing
from cupy.testing import _loops
class _Exception1(Exception):
pass
class _Exception2(Exception):
pass
class TestContainsSignedAndUnsigned(unittest.TestCase):
def test_include(self):
kw = {'x': numpy.in... | cupy/cupy | tests/cupy_tests/testing_tests/test_loops.py | Python | mit | 16,752 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.