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 |
|---|---|---|---|---|---|
import os
import sys
from mmpe.ui import UI
def autoupdate(update_page, ui, name=""):
from esky import Esky
assert isinstance(ui, UI)
if hasattr(sys, "frozen"):
esky = Esky(sys.executable, update_page)
else:
#return
esky = Esky(os.path.dirname(__file__), update_page)
es... | madsmpedersen/MMPE | build_exe/cx/autoupdate/__init__.py | Python | gpl-3.0 | 2,812 |
#!/usr/bin/env python
import sys
import os
import argparse
import netCDF4 as nc
import numpy as np
import pandas as pd
import re
import datetime
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from lib_util import time_dim_to_pandas_periods
"""
What this script does:
Plot a full timeseries f... | CWSL/access-cm-tools | analyse/mom_plot_timeseries.py | Python | apache-2.0 | 1,854 |
# -*- coding: utf-8 -*-
import os
import os.path
import re
import requests
import testfixtures
def detect_docker_host():
try:
docker_host = os.environ['DOCKER_HOST']
except KeyError:
docker_host = '127.0.0.1'
else:
docker_host = re.match(r'^tcp://(.+):\d+$', docker_host).group(1)... | smartmob-project/smartmob-demo | features/environment.py | Python | mit | 2,114 |
'''
Create a VM with 3 additional data volumes with 2 of them using virtio-scsi
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import os
test_stub = test_lib.lib_get_test_stub()
test_obj_... | zstackorg/zstack-woodpecker | integrationtest/vm/virtualrouter/volume/test_crt_vm_2_virtio_scsi_volumes.py | Python | apache-2.0 | 1,972 |
# Replicate the original imports available here.
from ..validate.compound import Compound, Any, All, Pipe, Iterable, Mapping
| marrow/schema | marrow/schema/validation/compound.py | Python | mit | 126 |
"""The ialarm component."""
| fbradyirl/home-assistant | homeassistant/components/ialarm/__init__.py | Python | apache-2.0 | 28 |
"""
2.2.7: `then` must return a promise: `promise2 = promise1.then(onFulfilled, onRejected)`
https://github.com/promises-aplus/promises-tests/blob/2.1.1/lib/tests/2.2.7.js
"""
from sleekxmpp.test import SleekTest
from test.components.scheduler.promises.helpers import generate_fulfilled_test_case, generate_rejected_tes... | rerobins/rhobot_framework | test/components/scheduler/promises/test_2_2_7.py | Python | bsd-3-clause | 3,628 |
def sumOfCorners(n):
return 4*n*n - 6*n + 6
solution = sum(map(sumOfCorners, range(3,1002,2))) + 1
if __name__ == "__main__":
print(solution)
| drcabana/euler-fp | source/py/p28.py | Python | epl-1.0 | 152 |
#
# This is an extension to the Nautilus file manager to allow better
# integration with the Subversion source control system.
#
# Copyright (C) 2006-2008 by Jason Field <jason@jasonfield.com>
# Copyright (C) 2007-2008 by Bruce van der Kooij <brucevdkooij@gmail.com>
# Copyright (C) 2008-2010 by Adam Plumb <adamplumb@... | kuznetz/rabbitvcs | rabbitvcs/ui/relocate.py | Python | gpl-2.0 | 3,231 |
from time import sleep, time
from sound_lib import stream
from threading import Thread, Event
import wx
class Click(object):
@property
def filename(self):
return self._filename
@filename.setter
def filename(self, value):
self._sound = stream.FileStream(file = value)
self._filename = value
def __init__(s... | chrisnorman7/metroclick | click.py | Python | gpl-2.0 | 1,516 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from kokemomo.plugins.engine.utils.km_model_utils import *
from kokemomo.plugins.engine.model.km_storage.impl.km_rdb_adapter import adapter
from kokemomo.plugins.engine.model.km_validate_error import KMValidateError
__author__ = 'hiroki'
"""
It is blog category table to b... | hiroki8080/Kokemomo | kokemomo/plugins/blog/model/km_blog_category.py | Python | mit | 1,968 |
import logging
import requests
from requests.auth import HTTPBasicAuth
from redash.destinations import *
from redash.utils import json_dumps
from redash.serializers import serialize_alert
class Webhook(BaseDestination):
@classmethod
def configuration_schema(cls):
return {
"type": "object"... | chriszs/redash | redash/destinations/webhook.py | Python | bsd-2-clause | 1,566 |
# $language = "python"
# $interface = "1.0"
# SendCommandToAllTabs.py
#
# Description:
# This example script shows how to send the same command to all tabs
# that currently have an active connection.
#
# Demonstrates:
# - How to send a command to all tabs using the tab scripting capability
# of SecureCRT
# ... | tacolin/VBS_SecureCRT_Scripts | 99.Documents/SecureCRT Official Examples/SendCommandToAllTabs.py | Python | gpl-2.0 | 2,533 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
from ..bst import BST
from ...extern.six.moves import range
def get_tree(TreeType):
b = TreeType([], [])
for val in [5, 2, 9, 3, 4, 1, 6, 10, 8, 7]:
b.add(val)
return b
@pytest.fixture
def tree():
return get_tree(B... | kelle/astropy | astropy/table/tests/test_bst.py | Python | bsd-3-clause | 2,648 |
from net.grinder.script.Grinder import grinder
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest
test1 = Test(13, "Request resource")
request1 = test1.wrap(HTTPRequest())
class TestRunner:
def __call__(self):
result = request1.GET("http://finance.naver.com")
#new test | GwonGisoo/ngrinder | ngrinder-core/src/test/resources/test.py | Python | apache-2.0 | 317 |
from django.shortcuts import render
from django.http import HttpResponse
from .models import Greeting
from uuid import uuid4
# Create your views here.
def index(request):
# return HttpResponse('Hello from Python!')
return render(request, 'index.html')
def upload_file(request):
print('Uploading stuff')
... | jjas0nn/solvem | hello/views.py | Python | mit | 1,171 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | ddd/logic/learning_unit/builder/effective_class_identity_builder.py | Python | agpl-3.0 | 3,606 |
# -*- coding: utf-8 -*-
import logging
from openerp import api, fields, models, _
_logger = logging.getLogger(__name__)
class View(models.Model):
_inherit = 'ir.ui.view'
@api.model
def render_template(self, template, values=None, engine='ir.qweb'):
if template in ['web.login', 'web.webclient_bo... | luoguizhou/gooderp_addons | app_odoo_customize/models/ir_ui_view.py | Python | agpl-3.0 | 576 |
#!/usr/bin/env python
#
# Copyright 2007 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... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/google/appengine/api/blobstore/blobstore.py | Python | bsd-3-clause | 16,357 |
from __future__ import unicode_literals, division, absolute_import
from tests import FlexGetBase, build_parser_function
class BaseSeriesPremiere(FlexGetBase):
__yaml__ = """
templates:
global: # just cleans log a bit ..
disable:
- seen
tasks:
test_o... | ratoaq2/Flexget | tests/test_series_premiere.py | Python | mit | 4,365 |
"""The alloccli modules."""
__all__ = ["alloc", "work", "comment", "edit", "view", "projects",
"tasks", "timesheets", "invoices", "accounts", "browse",
"mbox", "submit", "subscriptions", "ktokens", "version" ]
| maestrano/allocpsa | bin/alloccli/__init__.py | Python | agpl-3.0 | 232 |
import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-forgive',
version='0.0.1',
packages=['forgive'],
include_package_data=True,... | amywoodehy/django-forgive | setup.py | Python | unlicense | 680 |
class Stats:
"""
Contains the stats that a character or monster may have.
The stats tied to an agent are:
* Health: The amount of damage the agent can withstand. The agent dies when their health falls to zero. This is
the only stat that will persist after a battle ends.
* Stamina: An... | MikeHoffert/caladbolg-engine | caladbolg/agents/stats.py | Python | mit | 1,898 |
"""
WSGI config for dr27app project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
def import_driver27():... | SRJ9/django-driver27 | dr27demo/dr27app/wsgi.py | Python | mit | 621 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2022 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from .keyboard import Keyboard
| psychopy/psychopy | psychopy/devices/__init__.py | Python | gpl-3.0 | 261 |
# ===============================================================================
# Copyright 2011 Jake 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... | UManPychron/pychron | pychron/core/geometry/affine.py | Python | apache-2.0 | 6,391 |
import os
import shutil
import numpy as np
import flopy
from flopy.utils.util_array import Util2d, Util3d, Transient2d
out_dir = "temp"
if os.path.exists(out_dir):
shutil.rmtree(out_dir)
os.mkdir(out_dir)
def test_transient2d():
ml = flopy.modflow.Modflow()
dis = flopy.modflow.ModflowDis(ml, nlay=10, nro... | mrustl/flopy | autotest/t004_test.py | Python | bsd-3-clause | 19,118 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# HORTON: Helpful Open-source Research TOol for N-fermion systems.
# Copyright (C) 2011-2016 The HORTON Development Team
#
# This file is part of HORTON.
#
# HORTON is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Licens... | crisely09/horton | tools/qa/trapdoor_coverage.py | Python | gpl-3.0 | 4,855 |
import os
from twilio.rest import TwilioRestClient
if __name__ == "__main__":
account_sid = os.environ.get('TWILIO_ACCOUNT_SID')
if not account_sid:
account_sid = raw_input('Master Account SID: ')
auth_token = os.environ.get('TWILIO_AUTH_TOKEN')
if not auth_token:
auth_token = raw_inpu... | 18mr/call-congress | scripts/create_subaccount.py | Python | agpl-3.0 | 719 |
'''
BarsBursty.py
Loads Mike Bryant's old bursty topics dataset.
TODO: Need to write code to generate a bursty topic dataset
'''
from bnpy.data import WordsData, AdmixMinibatchIterator
import os
data_dir = '/data/liv/liv-x/topic_models/data/bars/'
matfilepath = os.environ['BNPYDATADIR'] + 'bars_bnpy_burstyK20_train... | daeilkim/refinery | refinery/bnpy/scripts/BarsBurstyK20.py | Python | mit | 1,179 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "newrepo"
sh % "setconf... | facebookexperimental/eden | eden/hg-server/tests/test-gitignore-t.py | Python | gpl-2.0 | 1,055 |
import re
from lib import meta_line_extractor
def get():
return MetaExtractor(meta_line_extractor)
class MetaExtractor(object):
def __init__(self, line_extractor):
self.line_extractor = line_extractor
def extract(self, text_stream):
data = {}
for line in self.line_extractor.extract(text_stream):
self.pr... | elliottmina/doctor_static | lib/meta_extractor.py | Python | mit | 1,048 |
# -*- coding: utf-8 -*-
# © 2012-2016 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models
from openerp.exceptions import Warning as UserError
_template_register = ['orderpoint_template_id']
class OrderpointGenerator(models.TransientModel):
... | factorlibre/stock-logistics-warehouse | stock_orderpoint_generator/wizard/orderpoint_generator.py | Python | agpl-3.0 | 1,520 |
# Copyright 2019 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, ... | google/clusterfuzz | src/clusterfuzz/_internal/bot/untrusted_runner/remote_process.py | Python | apache-2.0 | 3,341 |
from setuptools import setup, find_packages
setup(name='mini_redis',
version='0.1.1',
description='A lib to store structured data in redis using less memory',
url='http://github.com/polvoazul/mini-redis',
author='Fred Israel',
#author_email='',
license='unlicense',
packages=find_packages(),
zip_safe=Fa... | polvoazul/mini-redis | setup.py | Python | unlicense | 465 |
#!/bin/sh
DEBUG=1 ../mr/resources/scripts/mr_kv_step_create test_workflow step6_split_argument_1 "Split the argument in half" map_test_split '' reduce_test_noop
| dsoprea/JobX | dev/step_create_6_split_argument_1.py | Python | gpl-2.0 | 162 |
from sqlalchemy import *
from migrate import *
from sqlalchemy.dialects.sqlite import \
BLOB, BOOLEAN, CHAR, DATE, DATETIME, DECIMAL, FLOAT, \
INTEGER, NUMERIC, SMALLINT, TEXT, TIME, TIMESTAMP, VARCHAR
meta = MetaData()
users = Table('users', meta,
Column('username', TEXT),
... | macterra/galton | dbrepo/versions/008_Drop_old_users.py | Python | apache-2.0 | 515 |
import simulator
from simulator.util.enum import *
class HouseRules:
decks_in_shoe = int
shuffle_mode = ShuffleMode
dealer_hit_mode = DealerHitMode
double_restrictions = DoubleRestrictions
double_after_split = DoubleAfterSplit
aces_split_limit = AcesSplitLimit
surrender_allowed = None
d... | bjhf/simulator | simulator/game/houserules.py | Python | mit | 1,187 |
"""
All fields that are attached to the models.
The core design of django-parler is to attach descriptor fields
to the shared model, which then proxies the get/set calls to the translated model.
The :class:`TranslatedField` objects are automatically added to the shared model,
but may be added explicitly as well. This... | django-parler/django-parler | parler/fields.py | Python | apache-2.0 | 7,984 |
'''SwitchAdminDownEvent
@author Rean Griffith (rean@eecs.berkeley.edu)
'''
from nox.coreapps.pyrt import *
from nox.lib.core import *
class SwitchAdminDownEvent():
NAME = "switchadmindown"
'''NOX event that indicates that a switch has been administratively
disabled. This event provides details on "who" wa... | tlodge/homehub.nox | src/nox/netapps/monitoring/switchadmindownevent.py | Python | gpl-3.0 | 822 |
# Copyright 2016 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 by applicable law or agree... | Vaan5/piecewisecrf | piecewisecrf/slim/variables_test.py | Python | mit | 16,163 |
from __future__ import unicode_literals
import itertools
import re
from .common import InfoExtractor
from ..compat import compat_urllib_parse_unquote
from ..utils import (
int_or_none,
parse_duration,
sanitized_Request,
str_to_int,
)
class XTubeIE(InfoExtractor):
_VALID_URL = r'(?:xtube:|https?:... | lzambella/Qyoutube-dl | youtube_dl/extractor/xtube.py | Python | gpl-3.0 | 4,578 |
from app.functions.piwik import track
from app.functions.score import calculate_points
from app.models import ExcludeWord, Profile
from association.forms import AssociationForm
from association.functions.words import get_next_word
from association.models import Association, Language, Word
from django.contrib import mes... | Tima-Is-My-Association/TIMA | association/views/association.py | Python | lgpl-3.0 | 3,135 |
# Copyright 2009-2015 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | aherlihy/mongo-python-driver | test/test_json_util.py | Python | apache-2.0 | 16,394 |
# 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... | frreiss/tensorflow-fred | tensorflow/python/framework/file_system_test.py | Python | apache-2.0 | 1,930 |
__author__ = 'Zander'
class Light ():
def __init__(self, position, intensity):
self.position = position
self.intensity = intensity
#other is a Vector3
def getIntensity(self, other):
return self.intensity / (other - self.position).length | blasinzw/Py3D | Light.py | Python | mit | 275 |
"""
Pylearn2 wrapper for the TIMIT dataset
"""
__authors__ = ["Vincent Dumoulin"]
__copyright__ = "Copyright 2014, Universite de Montreal"
__credits__ = ["Laurent Dinh", "Vincent Dumoulin"]
__license__ = "3-clause BSD"
__maintainer__ = "Vincent Dumoulin"
__email__ = "dumouliv@iro"
import gc
import os.path
import func... | jfsantos/ift6266h14 | old/pylearn2_timit/timit.py | Python | mit | 18,158 |
# Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... | deepmind/open_spiel | open_spiel/python/mfg/games/dynamic_routing.py | Python | apache-2.0 | 26,449 |
# coding: utf-8
# flake8: noqa
from __future__ import absolute_import
# import models into model package
from swagger_server.models.api_response import ApiResponse
from swagger_server.models.inline_image import InlineImage
from swagger_server.models.inline_response200 import InlineResponse200
from swagger_server.model... | ninoxcello/mscs710-project | src/SwaggerAPI/swagger_server/models/__init__.py | Python | mit | 341 |
from theano.compat.six.moves import cStringIO, xrange
import numpy as np
import theano.tensor as T
from theano.tests import disturb_mem
from theano.tests.record import Record, RecordMode
from theano import shared
from pylearn2.train import Train
from pylearn2.datasets.dense_design_matrix import DenseDesignMatrix
from... | fyffyt/pylearn2 | pylearn2/training_algorithms/tests/test_bgd.py | Python | bsd-3-clause | 13,368 |
########################################################
# UI map for XYZ
########################################################
from sikuli import *
########################################################
class TAP:
button_CreateApp = "button_CreateApp.png"
button_DoCreateApp = "button_DoCreateApp.png"
... | YaneYosifov/TelerikAcademy | Quality Assurance/Part II/Exam Preparation/Author's Solutions/Exam 2 Solutions/Sikuli - Problem 1/sikuli_tests/_uimap.sikuli/_uimap.py | Python | mit | 841 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# 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
# (at your o... | thaim/ansible | lib/ansible/modules/network/check_point/cp_mgmt_assign_global_assignment.py | Python | mit | 2,701 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cityhash(AutotoolsPackage):
"""CityHash, a family of hash functions for strings."""
h... | LLNL/spack | var/spack/repos/builtin/packages/cityhash/package.py | Python | lgpl-2.1 | 606 |
#!/usr/bin/env python
"""
bg_daemon.util
This module's purpose is to serve as a centralized location for
different constant and methods that don't fit anywhere else
"""
import sys
import os
import shutil
import json
import crontab
from hashlib import sha256
from pkg_resources import Requirement, resource_f... | SantiagoTorres/bg_daemon | src/bg_daemon/util.py | Python | gpl-2.0 | 6,324 |
# Copyright (C) 2011 Google Inc. 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 copyright
# notice, this list of conditions and the f... | mogoweb/webkit_for_android5.1 | webkit/Tools/Scripts/webkitpy/tool/commands/roll_unittest.py | Python | apache-2.0 | 2,446 |
# Author: Jaakko Leppakangas <jaeilepp@student.jyu.fi>
#
# License: BSD-3-Clause
import numpy as np
from os import path
import datetime
import calendar
from ...utils import logger, fill_doc
from ..utils import _read_segments_file, _find_channels, _create_chs
from ..base import BaseRaw
from ..meas_info import _empty_i... | pravsripad/mne-python | mne/io/nicolet/nicolet.py | Python | bsd-3-clause | 6,429 |
# 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 use ... | ClusterHQ/libcloud | libcloud/test/loadbalancer/test_gogrid.py | Python | apache-2.0 | 8,296 |
# shellconf.py - User interface for the TortoiseHg shell extension settings
#
# Copyright 2009 Steve Borho <steve@borho.org>
# Copyright 2010 Adrian Buehlmann <adrian@cadifra.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
fr... | seewindcn/tortoisehg | src/tortoisehg/hgqt/shellconf.py | Python | gpl-2.0 | 10,434 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import sys
from django.conf import settings
from django.template import loader, RequestContext
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils import six
from django.utils.encoding import smart_s... | halfnibble/django-wkhtmltopdf | wkhtmltopdf/tests/tests.py | Python | bsd-2-clause | 15,136 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("candidates", "0027_create_standard_complex_fields")]
operations = [
migrations.AddField(
model_name="extrafield",
name="order",
field=models.IntegerField(default=0, b... | DemocracyClub/yournextrepresentative | ynr/apps/candidates/migrations/0028_create_order_attr_of_extra.py | Python | agpl-3.0 | 348 |
try: from setuptools import setup
except: from distutils.core import setup
setup( long_description=open("README.rst").read(),
name="""PyGeoj""",
license="""MIT""",
author="""Karim Bahgat""",
author_email="""karim.bahgat.norway@gmail.com""",
py_modules=['pygeoj'],
url="""http://github.com/karimbahgat/PyGeoj""",
... | karimbahgat/PyGeoj | setup.py | Python | mit | 732 |
import os
import sys
import imp
import multiprocessing
from setuptools import setup, find_packages
version = imp.load_source('version', os.path.join('flask_appbuilder', 'version.py'))
def fpath(name):
return os.path.join(os.path.dirname(__file__), name)
def read(fname):
return open(fpath(fname)).read()
def... | rpiotti/Flask-AppBuilder | setup.py | Python | bsd-3-clause | 1,758 |
#!/usr/bin/python
#
# Copyright (c) SAS Institute 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... | sassoftware/catalog-service | catalogService_test/mockedModules/mint/config.py | Python | apache-2.0 | 1,334 |
from __future__ import division
from sklearn.feature_extraction.text import CountVectorizer
from twitterTokenizer import Tokenizer
import re, codecs, sys, subprocess, scipy, numpy as np, os, tempfile, math
from scipy.sparse import csr_matrix
from twitterTokenizer import Tokenizer
from sklearn.preprocessing import Multi... | balikasg/SemEval2016-Twitter_Sentiment_Evaluation | src/subtaskD/my_utils.py | Python | gpl-3.0 | 25,002 |
"""
The feed is an assembly of items of different content types.
For ease of querying, each different content type is housed in the FeedItem
model, which also houses metadata indicating the conditions under which it
should be included. So a feed is actually just a listing of FeedItem instances
that match the user's reg... | ingenioustechie/zamboni | mkt/feed/models.py | Python | bsd-3-clause | 17,621 |
#! /usr/bin/env python3
"""
Module extending generic MediaWiki interface with stuff specific to `ArchWiki`_.
.. _`ArchWiki`: https://wiki.archlinux.org/
"""
| kynikos/wiki-scripts | ws/ArchWiki/__init__.py | Python | gpl-3.0 | 159 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Para este módulo se han implementado dos clases:
# -La clase consumo: Describe un consumo que será agregado a la base de datos
#
# -La clase facturacion: Describe un pedido de lista de consumos que se hará en la
# base de datos. Considerando los requerimientos de Innova, s... | gres147679/IngSoftwareRectaFinal | Tarea4/consumos.py | Python | gpl-2.0 | 4,531 |
doTimingAttackMitigation = False
import base64
import errno
import math
import time
import threading
import shared
import hashlib
import os
import select
import socket
import random
import ssl
from struct import unpack, pack
import sys
import traceback
from binascii import hexlify
#import string
#from subprocess impor... | timothyparez/PyBitmessage | src/class_receiveDataThread.py | Python | mit | 46,068 |
# -*- encoding: utf -*-
from abjad import *
def test_indicatortools_Tempo__to_markup_01():
tempo = Tempo(Duration(1, 4), 60)
markup = tempo._to_markup()
assert systemtools.TestManager.compare(
markup,
r'''
\markup {
\fontsize
#-6
\gener... | mscuthbert/abjad | abjad/tools/indicatortools/test/test_indicatortools_Tempo__to_markup.py | Python | gpl-3.0 | 1,253 |
"""
Barten (1999) Contrast Sensitivity Function
===========================================
Defines the *Barten (1999)* contrast sensitivity function:
- :func:`colour.contrast.contrast_sensitivity_function_Barten1999`
References
----------
- :cite:`Barten1999` : Barten, P. G. (1999). Contrast Sensitivity of the
... | colour-science/colour | colour/contrast/barten1999.py | Python | bsd-3-clause | 16,820 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2017 CERN.
#
# INSPIRE 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 ... | rikirenz/inspire-next | inspirehep/wsgi_with_coverage.py | Python | gpl-3.0 | 13,469 |
# -*- coding: iso-8859-1 -*-
# -----------------------------------------------------------------------------
# unpack.py - media plugin for archives
# -----------------------------------------------------------------------------
# $Id$
#
# TODO: Freevo will hang when the sub process is waiting for input in stdin.
# ... | pacificIT/freevo2 | src/plugins/unpack.py | Python | gpl-2.0 | 3,470 |
"""
A TestRunner for use with the Python unit testing framework. It
generates a HTML report to show the result at a glance.
The simplest way to use this is to invoke its main method. E.g.
from taurus.external import unittest
import HTMLTestRunner
... define your tests ...
if __name__ == '__main__':
... | sagiss/sardana | test/HTMLTestRunner.py | Python | lgpl-3.0 | 23,565 |
# -*- coding: utf-8 -*-
# Copyright 2012 Loris Corazza, Sakis Christakidis
#
# 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
#
# U... | schristakidis/p2ner | p2ner/components/pipeelement/headerparserelement/headerparserelement/constructs/messageheader.py | Python | apache-2.0 | 1,519 |
#!/usr/bin/env python
############################################################################
#
# 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 A... | apurtell/phoenix | bin/end2endTest.py | Python | apache-2.0 | 1,860 |
# -*- coding: utf-8 -*-
from openerp import api
from openerp import fields
from openerp import models
class IrUiMenu(models.Model):
_inherit = 'ir.ui.menu'
iframe_pages_group = fields.Boolean('Parent menu for iframe pages', default=False)
_defaults = {
'parent_id': lambda self, cr, uid, ctx: ct... | meta-it/misc-addons | web_iframe_pages/web_iframe_pages_models.py | Python | lgpl-3.0 | 2,000 |
import threading
import time
class myThread (threading.Thread):
def __init__(self, threadID, name, counter):
threading.Thread.__init__(self)
self.threadID = threadID
self.name = name
self.counter = counter
def run(self):
print ("Starting " + self.name)
... | abhianand7/python_programs | learn-python/thread_sync.py | Python | gpl-2.0 | 1,076 |
# -*- coding:utf-8 -*-
#
# Copyright © 2015 The Spyder Development Team
# Copyright © 2014 Gonzalo Peña-Castellanos (@goanpeca)
#
# Licensed under the terms of the MIT License
| spyder-ide/conda-manager | conda_manager/data/__init__.py | Python | mit | 179 |
#!/usr/bin/env python
import argparse
import os
import sys
from lib.config import enable_verbose_mode, get_target_arch
from lib.util import execute_stdout
from bootstrap import get_libchromiumcontent_commit
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
LIBCC_DIR = os.path.join(SOURCE_RO... | Floato/electron | script/build-libchromiumcontent.py | Python | mit | 2,792 |
# seriously "is-a" and "has-a." for the milionth time, how is this the core of oop?
class Person(object):
def __init__(self, name):
self.name = name
class Employee(Person):
def __init__(self, name, salary):
super(Employee, self).__init__(name)
self.salary = salary
e1 = Employee('Mighty', 10000000)
# it se... | cohadar/learn-python-the-hard-way | ex42.py | Python | mit | 375 |
"""
Tools for different procedure estimations
"""
__author__ = "Luc Anselin luc.anselin@asu.edu, \
Pedro V. Amaral pedro.amaral@asu.edu, \
David C. Folch david.folch@asu.edu, \
Daniel Arribas-Bel darribas@asu.edu"
import numpy as np
from scipy import sparse as SP
import scipy.optimi... | chhao91/pysal | pysal/spreg/utils.py | Python | bsd-3-clause | 24,433 |
# zwei 01/03/14
# generator expression inlining
def call_generator_builtin(num, iteration):
item = 0
for t in range(iteration):
num += t % 5
ll = list(x * 2 for x in range(num))
item = ll[-1] + item % 5
return item
for i in range(1000):
result = call_generator_builtin(10, 100)... | wdv4758h/ZipPy | edu.uci.python.test/src/tests/generator-inline-genexp-builtin-test.py | Python | bsd-3-clause | 335 |
# Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
import logging
import os
import sys
from . import option_list
import digits
def load_logfile_filename():
"""
Return the configured log file or None
Throws an exception only if a manually specified... | bygreencn/DIGITS | digits/config/log_file.py | Python | bsd-3-clause | 2,184 |
#
# This file is part of the Pi Entertainment System (PES).
#
# PES provides an interactive GUI for games console emulators
# and is designed to work on the Raspberry Pi.
#
# Copyright (C) 2014-2021 Neil Munday (neil@mundayweb.com)
#
# PES is free software: you can redistribute it and/or modify
# it u... | neilmunday/pes | lib/pes/data.py | Python | gpl-3.0 | 25,797 |
#
# Copyright 2020 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... | google/fhir | py/google/fhir/json_format/wrappers/_date.py | Python | apache-2.0 | 4,263 |
"""
rate limiting strategies
"""
from abc import ABCMeta, abstractmethod
import weakref
import six
import time
@six.add_metaclass(ABCMeta)
class RateLimiter(object):
def __init__(self, storage):
self.storage = weakref.ref(storage)
@abstractmethod
def hit(self, item, *identifiers):
"""
... | duyet-website/api.duyet.net | lib/limits/strategies.py | Python | mit | 5,640 |
#!/usr/bin/env python
"""pyhdf: Python interface to the NCSA HDF4 library.
The pyhdf package wraps the functionality of the NCSA HDF version
4 library inside a Python OOP framework. The SD (scientific dataset),
VS (Vdata) and V (Vgroup) APIs are currently implemented. SD datasets
are read/written through numpy arrays... | fhs/python-hdf4 | setup.py | Python | mit | 5,088 |
from copy import deepcopy
from operator import mul
import joblib
import numpy as np
from scipy import sparse
import pandas as pd
import pytest
import anndata as ad
from anndata._core.index import _normalize_index
from anndata._core.views import ArrayView, SparseCSRView, SparseCSCView
from anndata.utils import asarray... | theislab/anndata | anndata/tests/test_views.py | Python | bsd-3-clause | 18,418 |
'''Fairly basic set of tools for real-time data augmentation on image data.
Can easily be extended to include new transformations,
new preprocessing methods, etc...
'''
from __future__ import absolute_import
from __future__ import print_function
import numpy as np
import re
from scipy import linalg
import scipy.ndimag... | dancoombs/fastai | nbs/Iterator.py | Python | mit | 9,743 |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
from django.db import migrations, models
def populate_outgoing_partner(apps, schema_editor):
Partner = apps.get_model("cases", "Partner")
Outgoing = apps.get_model("msgs", "Outgoing")
num_updated = 0
for partner in Part... | praekelt/casepro | casepro/msgs/migrations/0036_outgoing_partner.py | Python | bsd-3-clause | 1,269 |
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('192.168.3.56', 12345))
count = 0
while True:
data = s.recv(1024)
if data:
if data == 'Goodbye':
break
count += 1
msg = 'FOO'
if count >= 100:
msg = 'quit'
print "Got {}".format(data)
s.send(msg)
| Ca2Patton/PythonStuff | jnk_cli.py | Python | apache-2.0 | 297 |
"""Django signal handlers for relaydomains."""
from django.db.models import signals
from django.dispatch import receiver
from django.utils.translation import ugettext as _
from modoboa.admin import models as admin_models, signals as admin_signals
from modoboa.core import signals as core_signals
from modoboa.lib.email... | modoboa/modoboa | modoboa/relaydomains/handlers.py | Python | isc | 4,048 |
"""Common tests for metaestimators"""
import functools
from inspect import signature
import numpy as np
import pytest
from sklearn.base import BaseEstimator
from sklearn.base import is_regressor
from sklearn.datasets import make_classification
from sklearn.utils import all_estimators
from sklearn.utils.estimator_chec... | kevin-intel/scikit-learn | sklearn/tests/test_metaestimators.py | Python | bsd-3-clause | 10,402 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import rospy
import os
from os.path import join
from flask import Flask
from flask import request
from flask_cors import CORS
from rospkg import RosPack
from rospy import ServiceException
from apex_playground.user import UserServices
from threading import Thread... | ymollard/apex_playground | ros/apex_playground/src/nodes/user.py | Python | gpl-3.0 | 5,665 |
# -*- coding: 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 'Repository'
db.create_table('greta_repository', (
('id', self.gf('django.db.mode... | michaelwisely/django-greta | src/greta/migrations/0001_initial.py | Python | bsd-3-clause | 2,867 |
from __future__ import absolute_import, unicode_literals, division, print_function
from . import model_base
__all__ = ['PhotomModel']
class PhotomModel(model_base.DataModel):
"""
A base class for photometric reference file models.
"""
schema_url = "photom.schema.yaml"
def __init__(self, init=No... | mdboom/jwst_lib.models | jwst_lib/models/photom.py | Python | bsd-3-clause | 3,973 |
# A funny, but common thing you'll see in python scipts is that if __name__ ...
# block below
# To start off, just run this script and see what happens.
# Then run the test and note that it fails in a curious way!
print "I was run - maybe by a test?"
if __name__ == '__main__':
# The problem is that this variab... | marwahaha/python-fundamentals | challenges/04-Functions/B_script_conventions.py | Python | apache-2.0 | 610 |
"""
convert list of row tuples to list of row dicts with field name keys
this is not a command-line utility: hardcoded self-test if run
"""
def makedicts(cursor, query, params=()):
cursor.execute(query, params)
colnames = [desc[0] for desc in cursor.description]
rowdicts = [dict(zip(colnames, row))... | simontakite/sysadmin | pythonscripts/programmingpython/Dbase/Sql/makedicts.py | Python | gpl-2.0 | 645 |
from setuptools import setup, find_packages
setup(
name='roster',
version='1.0',
description='Roster: A library for simple service discovery using Dynamodb for Python',
long_description=open('README.md').read(),
author='Tim Rijavec',
author_email='tim@trustedhousesitters.com',
url='https:/... | trustedhousesitters/roster-python | setup.py | Python | mit | 860 |
from visdk41.items import EnumObject
from .base import Base
class EnumSpider(Base):
name = 'enum_spider'
start_urls = [
Base.SMS + "index-e_types.html",
Base.VIM + "index-e_types.html"
]
object_class = EnumObject
| xuru/vmware-scrapper | visdk41/spiders/enum_object_spider.py | Python | mit | 279 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.