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 |
|---|---|---|---|---|---|
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | wscullin/spack | var/spack/repos/builtin/packages/lzma/package.py | Python | lgpl-2.1 | 1,935 |
# coding=utf-8
"""Save Scenario Dialog."""
import os
import logging
from ConfigParser import ConfigParser
# This import is to enable SIP API V2
# noinspection PyUnresolvedReferences
import qgis # pylint: disable=unused-import
# noinspection PyPackageRequirements
from PyQt4 import QtGui
# noinspection PyPackageRequi... | Gustry/inasafe | safe/gui/tools/save_scenario.py | Python | gpl-3.0 | 6,767 |
#!/usr/bin/env python
import os
import csv, sys, json
def run_rnaseq_docker(basename_I,
host_dirname_I,
organism_I,
host_indexes_dir_I,
host_dirname_O,
paired_I='paired',
threads_I=2,trim3_I=3,
library_type_I='fr-firststrand',
index_type_I = '.gtf',
... | dmccloskey/sequencing_utilities | docker_run/run_rnaseq_docker.py | Python | mit | 8,715 |
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import errno
import multiprocessing
import os
import shutil
import subprocess
import sys
import tempfile
from subprocess import CalledProcessError
f... | jsirois/pex | tests/tools/commands/test_venv.py | Python | apache-2.0 | 19,627 |
# -*- coding: utf-8 -*-
# Copyright 2022 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... | googleapis/python-dialogflow | google/cloud/dialogflow_v2beta1/services/sessions/client.py | Python | apache-2.0 | 33,606 |
"""GraphLasso: sparse inverse covariance estimation with an l1-penalized
estimator.
"""
# Author: Gael Varoquaux <gael.varoquaux@normalesup.org>
# License: BSD 3 clause
# Copyright: INRIA
import warnings
import operator
import sys
import time
import numpy as np
from scipy import linalg
from .empirical_covariance_ im... | Tong-Chen/scikit-learn | sklearn/covariance/graph_lasso_.py | Python | bsd-3-clause | 22,461 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Pycmt3d test suite.
Run with pytest.
:copyright:
Wenjie Lei (lei@princeton.edu)
:license:
GNU General Public License, Version 3
(http://www.gnu.org/copyleft/gpl.html)
"""
from __future__ import print_function, division
import inspect
import os
import numpy... | wjlei1990/pycmt3d | src/pycmt3d/tests/test_measure.py | Python | lgpl-3.0 | 5,765 |
# -*- coding:UTF-8 -*-
# !/usr/bin/env python
#########################################################################
# File Name: unet2d.py
# Author: Banggui
# mail: liubanggui92@163.com
# Created Time: 2017年04月23日 星期日 15时13分24秒
#########################################################################
import numpy... | shihuai/TCAI-2017 | models_config/segmentation_unet2d.py | Python | mit | 5,043 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page_test
from metrics import power
class Power(page_test.PageTest):
def __init__(self):
super(Power, self).__init__()
... | mou4e/zirconium | tools/perf/measurements/power.py | Python | bsd-3-clause | 669 |
# 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... | nathanielvarona/airflow | airflow/cli/commands/scheduler_command.py | Python | apache-2.0 | 2,830 |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
Created on Jan 17, 2017
@author: hegxiten
'''
import sys
import geo.haversine as haversine
from imposm.parser import OSMParser
import geo.haversine as haversine
import numpy
import time
from scipy import spatial
import csv
import codecs
import math
default_encoding='u... | hegxiten/Worldwide-Railway-Network | WorldRailNetwork_WRN_workspace/src/network_process.py | Python | apache-2.0 | 7,862 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django.core.files.storage
import mptt.fields
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Category',
... | miceno/django-categories | categories/migrations/0001_initial.py | Python | apache-2.0 | 3,406 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = (
('main', '0059_auto__del_userprofile'),
)
def forwards(self, orm):
if not db.dry_run:
db.send_cre... | archhurd/archweb | devel/migrations/0005_auto__add_userprofile.py | Python | gpl-2.0 | 8,179 |
from threadless_router.backends.base import BackendBase
from threadless_router.backends.httptester.storage import store_message
class HttpTesterCacheBackend(BackendBase):
""" Simple backend that stores messages in a cache """
def send(self, msg):
store_message('out', msg.connection.identity, msg.tex... | caktus/rapidsms-threadless-router | threadless_router/backends/httptester/backend.py | Python | bsd-3-clause | 440 |
from corehq.apps.reports.standard import MonthYearMixin
from custom.intrahealth.filters import RecapPassageLocationFilter, FRMonthFilter, FRYearFilter
from custom.intrahealth.reports.tableu_de_board_report import MultiReport
from custom.intrahealth.sqldata import RecapPassageData, DateSource
from dimagi.utils.decorator... | puttarajubr/commcare-hq | custom/intrahealth/reports/recap_passage_report.py | Python | bsd-3-clause | 1,301 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Based on http://web.maths.unsw.edu.au/~fkuo/sobol/index.html
# To understand how to use it, use
# pr_sobolgen --help
import argparse
# Get index from the right of the first zero bit
def irfz(n):
counter = 1
val = n
while val & 1:
val >>= 1
c... | PearCoding/PearRay | tools/sobol/pr_sobolgen.py | Python | mit | 4,144 |
from .vnbinance import BinanceApi | rrrrrr8/vnpy | vnpy/api/binance/__init__.py | Python | mit | 33 |
# 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... | lgp171188/fjord | vendor/packages/requests-mock-0.6.0/requests_mock/__init__.py | Python | bsd-3-clause | 1,190 |
#!/usr/bin/env python
#coding:utf-8
#接受一个包含年月日的日期,计算这天在那一年是第多少天
string = raw_input('input year-mon-day: ')
month_count = (0,31,59,90,120,151,181,212,243,273,304,334)
day_count = 0
if string:
year = int(string.split('-')[0])
mon = int(string.split('-')[1])
day = int(string.split('-')[2])
if 0 < mon <= ... | 51reboot/actual_13_homework | 03/sxq/3_check_day.py | Python | mit | 707 |
p = True
q = True
print not (p or not q)
p = True
q = False
print not (p or not q)
p = False
q = True
print not (p or not q)
p = False
q = False
print not (p or not q)
| DmitryTsybin/Study | Coursera/An_Introduction_to_Interactive_Programming_in_Python/Quiz_1_Question_2.py | Python | mit | 171 |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googleapis/python-bigquery | samples/client_query_batch.py | Python | apache-2.0 | 1,572 |
# databases/__init__.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Include imports from the sqlalchemy.dialects package for backwards
compatib... | gltn/stdm | stdm/third_party/sqlalchemy/databases/__init__.py | Python | gpl-2.0 | 819 |
# -*- coding: utf-8 -*-
# These are all basically integration tests. They require access to running services.
import io
import json # noqa: F401
import os # noqa: F401
import time
import unittest
from configparser import ConfigParser
from os import environ
from NarrativeService.NarrativeManager import NarrativeMana... | kbaseapps/NarrativeService | test/NarrativeService_server_test.py | Python | mit | 50,939 |
# -*- coding: utf-8 -*-
# © 2016 Chafique DELLI @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': 'Purchase Picking State',
'summary': 'Add the status of all the incoming picking'
' in the purchase order',
'version': '10.0.1.0.0',
'category': 'Purchase Managem... | Eficent/purchase-workflow | purchase_picking_state/__manifest__.py | Python | agpl-3.0 | 562 |
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Folding Interaction {{{#
class FoldingEnabled_SnippetWithFold_ExpectNoFolding(_VimTest):
def _extra_vim_config(self, vim_config):
vim_config.append('set foldlevel=0')
vim_config.append('set foldmethod=marker')
... | Insanityandme/dotfiles | vim/bundle/ultisnips/test/test_Folding.py | Python | unlicense | 1,594 |
# -*- coding: UTF-8 -*-
from __future__ import unicode_literals
from collections import OrderedDict
import json
import sys
from os import path as P
from jinja2 import Environment, PackageLoader
TYPE, ID = '@type', '@id'
LABELS = {
'termGroup': 'termgrupp',
'equivalentClass': 'ekvivalent typ',
'subClassOf... | Kungbib/datalab | tools/buildingblocks/mk_blocks.py | Python | cc0-1.0 | 4,229 |
import argparse
from stsci.image.numcombine import numCombine as nc
import astropy.io.fits as pf
import numpy as np
import time
import SEDMr.Version as Version
drp_ver = Version.ifu_drp_version()
def imcombine(flist, fout, listfile=None, combtype="mean",
nlow=0, nhigh=0):
"""Convenience wrapper ar... | scizen9/kpy | SEDMr/Imcombine.py | Python | gpl-2.0 | 2,782 |
# -*- coding: utf-8 -*-
"""
Deployment settings
All settings which are typically edited for a deployment should be done here
Deployers shouldn't typically need to edit any other files.
NOTE FOR DEVELOPERS:
/models/000_config.py is NOT in the Git repository, as this file will be changed
during d... | flavour/iscram | deployment-templates/models/000_config.py | Python | mit | 29,475 |
VERSION = (1, 7, 5, 'final', 0)
def get_version(*args, **kwargs):
# Don't litter django/__init__.py with all the get_version stuff.
# Only import if it's actually called.
from django.utils.version import get_version
return get_version(*args, **kwargs)
def setup():
"""
Configure the settings ... | rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/__init__.py | Python | apache-2.0 | 675 |
# -*- coding: utf-8 -*-
import irc.bot
import irc.strings
from irc.client import ip_numstr_to_quad, ip_quad_to_numstr
from threading import *
class Bot(irc.bot.SingleServerIRCBot):
def __init__(self, channel, nickname, server, port=6667):
irc.bot.SingleServerIRCBot.__init__(
self, [
... | eternnoir/PttBroadcaster | PttBroadcaster/IrcBot.py | Python | gpl-2.0 | 780 |
# This file is part of Funnel.
#
# Funnel 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.
#
# Funnel is distributed in the hope that it... | shuhaowu/Funnel | tests/test_utils.py | Python | gpl-3.0 | 4,565 |
"""Compute rates for warping events."""
from collections import defaultdict
def calc_warp_rate(warping_records, total_sampling_time):
"""Calculate the warping rates for each target in these records.
Takes a set of warping records which are named tuples that have
the fields set in the Abstract Base Class ... | ADicksonLab/wepy | src/wepy/analysis/rates.py | Python | mit | 5,055 |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Topic(Document):
def get_contents(self):
try:
topic_content_list =... | libracore/erpnext | erpnext/education/doctype/topic/topic.py | Python | gpl-3.0 | 571 |
from django.db import models
from django.contrib.auth.models import User, UserManager
class MyModelManager(models.Manager):
def get_new_queryset(self):
return super(MyModelManager, self).get_queryset().order_by('-created')
def get_best_queryset(self):
return super(MyModelManager, self).get_qu... | rytovkopat/TPWebAskBaranov | polls/models.py | Python | gpl-2.0 | 1,735 |
import string
__version__ = string.split('$Revision: 1.3 $')[1]
__date__ = string.join(string.split('$Date: 2001/09/26 16:36:36 $')[1:3], ' ')
__author__ = 'Tarn Weisner Burton <twburton@users.sourceforge.net>'
__doc__ = 'http://oss.sgi.com/projects/ogl-sample/registry/OML/interlace.txt'
__api_version__ = 0x100
... | fxia22/ASM_xf | PythonD/site_python/OpenGL/GL/OML/interlace.py | Python | gpl-2.0 | 553 |
from analysis import Analysis
from analysis_config import AnalysisConfig
from analysis_stats import AnalysisStatistics, AnalysisStatisticsBuilder
from project import Project, UnpackedProject
| plast-lab/llvm-datalog | src/main/cclyzer/__init__.py | Python | mit | 191 |
"""Tornado handlers for the notebook.
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as p... | cloud9ers/gurumate | environment/lib/python2.7/site-packages/IPython/frontend/html/notebook/handlers.py | Python | lgpl-3.0 | 25,750 |
# -*- coding: utf-8 -*-
"""Test forms."""
from taskmanager.public.forms import LoginForm
from taskmanager.user.forms import RegisterForm
class TestRegisterForm:
"""Register form."""
def test_validate_user_already_registered(self, user):
"""Enter username that is already registered."""
form =... | harshk360/summer_scholars | tests/test_forms.py | Python | bsd-3-clause | 2,480 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2013 Renato Lima - Akretion #
# ... | rodrigoasmacedo/l10n-brazil | __unported__/l10n_br_account_product/res_company.py | Python | agpl-3.0 | 5,308 |
from flask import Flask
#from flask_bootstrap import Bootstrap
from flask_material import Material
from flask_moment import Moment
from flask_login import LoginManager
from flask_sqlalchemy import SQLAlchemy
from config import config
#bootstrap = Bootstrap()
material = Material()
moment = Moment()
db = SQLAlchemy()
... | Gloomymoon/StudiousPrime | app/__init__.py | Python | apache-2.0 | 1,154 |
import logging
from ...util import none_or
from ..errors import MalformedResponse
from .collection import Collection
logger = logging.getLogger("mw.api.collections.revisions")
class Revisions(Collection):
"""
A collection of revisions indexes by title, page_id and user_text.
Note that revisions of delet... | makoshark/Mediawiki-Utilities | mw/api/collections/revisions.py | Python | mit | 8,519 |
import os
import sys
import smtplib
from email.mime.text import MIMEText
try:
from urlparse import parse_qsl
except:
from cgi import parse_qsl
from db import User, Post
import oauth2 as oauth
import twitter as identica
IdenticaError = identica.TwitterError
identica.REQUEST_TOKEN_URL = 'https://identi.ca/api/oa... | authmillenon/spline_social | apicalls.py | Python | mit | 4,719 |
# -*- coding: utf-8 -*-
from tespy.connections import Connection
from tespy.components import Source, Sink, CombustionChamber
from tespy.networks import Network
from tespy.tools import document_model
# %% network
# define full fluid list for the network's variable space
fluid_list = ['Ar', 'N2', 'O2', 'CO2', 'CH4', '... | oemof/oemof_examples | oemof_examples/tespy/combustion/combustion_chamber.py | Python | gpl-3.0 | 1,539 |
from opal.core.algorithm import Algorithm
from opal.core.parameter import Parameter
from opal.core.measure import Measure
# Define new algorithm.
coopsort = Algorithm(name='CoopSort', description='Sort Algorithm')
# Register executable.
coopsort.set_executable_command('python coopsort_run.py')
# Define parameters.
... | dpo/opal | examples/coopsort/coopsort_declaration.py | Python | lgpl-3.0 | 1,139 |
from fabric import api as fab
class Php(object):
def install(self):
fab.sudo('apt-get install php5-fpm')
# limit worker count
# You should have "cgi.fix_pathinfo = 0;" in php.ini
class PhpMyAdmin(object):
def install(self):
fab.sudo('apt-get install php5-mysql phpmyadmin -y... | suvit/speedydeploy | speedydeploy/project/php.py | Python | mit | 421 |
"""Class to format the raw package_list to prune it for Gnosis consumption."""
from analytics_platform.kronos.src import config
from analytics_platform.kronos.apollo.src.apollo_constants import (
APOLLO_ECOSYSTEM,
APOLLO_INPUT_RAW_PATH,
APOLLO_PACKAGE_LIST,
PACKAGE_LIST_INPUT_CURATED_FILEPATH,
MAX_... | sara-02/fabric8-analytics-stack-analysis | analytics_platform/kronos/apollo/src/apollo_tag_prune.py | Python | gpl-3.0 | 6,420 |
"""The tests for the Google Wifi platform."""
from datetime import datetime, timedelta
import unittest
from unittest.mock import Mock, patch
import requests_mock
from homeassistant import core as ha
import homeassistant.components.google_wifi.sensor as google_wifi
from homeassistant.const import STATE_UNKNOWN
from ho... | leppa/home-assistant | tests/components/google_wifi/test_sensor.py | Python | apache-2.0 | 8,546 |
# stdlib
import socket
# 3rd party
import simplejson as json
# project
from checks import AgentCheck
GLOBAL_STATS = set([
'curr_connections',
])
GLOBAL_STATS_RATES = set([
'total_connections'
])
POOL_STATS = set([
'client_connections',
'server_ejects',
])
POOL_STATS_RATES = set([
'client_eof',... | varlib1/servermall | twemproxy/check.py | Python | bsd-3-clause | 5,654 |
project_slug = '{{ cookiecutter.project_slug }}'
if hasattr(project_slug, 'isidentifier'):
assert project_slug.isidentifier(), 'Project slug should be valid Python identifier!'
elasticbeanstalk = '{{ cookiecutter.use_elasticbeanstalk_experimental }}'.lower()
heroku = '{{ cookiecutter.use_heroku }}'.lower()
docker... | schacki/cookiecutter-django | hooks/pre_gen_project.py | Python | bsd-3-clause | 560 |
#!/usr/bin/env python
'''
This software was created by United States Government employees at
The Center for the Information Systems Studies and Research (CISR)
at the Naval Postgraduate School NPS. Please note that within the
United States, copyright protection is not available for any works
created by United Sta... | cliffe/SecGen | modules/utilities/unix/labtainers/files/Labtainers-master/scripts/labtainer-student/lab_bin/Student.py | Python | gpl-3.0 | 7,943 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.conf import settings
from django.test import TestCase, override_settings
from unittest import skip
from zerver.lib.avatar import avatar_url, get_avatar_url
from zerver.lib.bugdown import url_filename
from zerver.lib.realm_icon import realm_icon... | christi3k/zulip | zerver/tests/test_upload.py | Python | apache-2.0 | 45,442 |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['Logit'] , ['MovingMedian'] , ['BestCycle'] , ['MLP'] ); | antoinecarme/pyaf | tests/model_control/detailed/transf_Logit/model_control_one_enabled_Logit_MovingMedian_BestCycle_MLP.py | Python | bsd-3-clause | 151 |
#!/usr/bin/python2
from __future__ import print_function
import argparse
import datetime
from lxml import etree
import sys
import os
import uuid
import django
django.setup()
# dashboard
from main import models
from fpr import models as fpr_models
# archivematicaCommon
import namespaces as ns
import fileOperations
im... | sevein/archivematica | src/MCPClient/lib/clientScripts/parse_mets_to_db.py | Python | agpl-3.0 | 21,479 |
import math
import mpi4py.MPI
import numpy as np
import warnings
import chainer.cuda
from chainermn.communicators import _communication_utility
from chainermn.communicators import _memory_utility
from chainermn.communicators import mpi_communicator_base
from chainermn import nccl
class TwoDimensionalCommunicator(mpi... | keisuke-umezawa/chainer | chainermn/communicators/two_dimensional_communicator.py | Python | mit | 3,998 |
import numpy as np
import matplotlib
#matplotlib.use('KtAgg')
import matplotlib.pylab as plt
import matplotlib.gridspec as gridspec
from matplotlib import colors
from matplotlib.patches import Circle
from matplotlib.figure import *
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from ma... | AmurG/tardis | tardis/gui.py | Python | bsd-3-clause | 31,607 |
#!/usr/bin/python
import logging
import os
import argparse
import MySQLdb
import MySQLdb.cursors
import time
from ConfigParser import RawConfigParser
from influxdb import InfluxDBClient
from time_utils import get_epoch_from_datetime
from datetime import datetime
logger = logging.getLogger(__name__)
class Mysql2Infl... | GreatLakesEnergy/Mysql-to-influxdb | mysql2influx.py | Python | mit | 6,277 |
'''
Created on Aug 11, 2012
:author: Sana Development Team
:version: 2.0
'''
try:
import json as simplejson
except ImportError, e:
import simplejson
import logging
import urllib
from django.conf import settings
def send_clickatell_notification(message_body, phoneId,formatter=None):
return Clickatell... | SanaMobile/sana.mds | src/mds/api/contrib/smslib/clickatell.py | Python | bsd-3-clause | 2,108 |
"""
Transactional version control for Django models.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
from __future__ import unicode_literals
__version__ = VERSION = (1, 10, 0)
| MikeAmy/django-reversion | src/reversion/__init__.py | Python | bsd-3-clause | 187 |
# -*- coding: utf-8 -*-
"""
sphinxcontrib.recentpages
~~~~~~~~~~~~~~~~~~~~~~~~~
Build recent update pages list.
:copyright: Copyright 2012 by Sho Shimauchi.
:license: BSD, see LICENSE for details.
"""
from sphinx.util.compat import Directive
from docutils import nodes
import os
import datetime
i... | shiumachi/sphinx.recentpages | sphinxcontrib/recentpages.py | Python | bsd-2-clause | 2,222 |
from datetime import date
from kitsune.customercare.badges import AOA_BADGE
from kitsune.customercare.tests import ReplyFactory
from kitsune.kbadge.tests import BadgeFactory
from kitsune.sumo.tests import TestCase
from kitsune.users.tests import UserFactory
from kitsune.customercare.badges import register_signals
cl... | mythmon/kitsune | kitsune/customercare/tests/test_badges.py | Python | bsd-3-clause | 1,176 |
"""
Socket server forwarding request to internal server
"""
import logging
try:
# we prefer to use bundles asyncio version, otherwise fallback to trollius
import asyncio
except ImportError:
import trollius as asyncio
from opcua import ua
from opcua.server.uaprocessor import UaProcessor
logger = logging.g... | bitkeeper/python-opcua | opcua/server/binary_server_asyncio.py | Python | lgpl-3.0 | 4,546 |
from session import SessionManager, Session, SessionConnectionError, NotEnoughCreditError, RollbackError, CashTimeoutError, SessionError
from token_client import TokenClient
| muccc/upay | upay/client/__init__.py | Python | gpl-3.0 | 174 |
#!/usr/bin/env python
# encoding: utf-8
import sys
reload(sys)
sys.setdefaultencoding("utf-8") | dianping/cat | lib/python/test/__init__.py | Python | apache-2.0 | 96 |
import time
import urllib3
from Queue import Queue
from urllib import urlencode
from threading import Lock, current_thread
from django.conf import settings
from django.core.cache import cache
from graphite.intervals import Interval, IntervalSet
from graphite.node import LeafNode, BranchNode
from graphite.readers import... | krux/graphite-web | webapp/graphite/remote_storage.py | Python | apache-2.0 | 11,120 |
# maintained by rajivak@utexas.edu
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
from data import Data
from mmd import select_criticism_regularized, greedy_select_protos
import matplotlib.pyplot as plt
from pylab import *
from matp... | BeenKim/MMD-critic | run_digits.py | Python | mit | 8,714 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
QtSvg.py
---------------------
Date : March 2016
Copyright : (C) 2016 by Juergen E. Fischer
Email : jef at norbit dot de
********************************... | dwadler/QGIS | python/PyQt/PyQt5/QtSvg.py | Python | gpl-2.0 | 1,129 |
# implementation of a standard undirected weighted graph
class graph():
def __init__(self):
# graph is stored as vertex:{neighbors:weight} pairs
# eg. {foo: {bar:2, baz:1}, bar:{foo:2, baz:4}, baz:{foo:1,bar:4}}
self.neighbors = {}
# add vertex
def add_vertex(self, vertex):
... | baolinhtb/NLP | graph.py | Python | gpl-2.0 | 827 |
# -*- 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 field 'Website.location_description'
db.add_column(u'event_website', 'location_description',
... | Makerland/makethings.io | event/migrations/0002_auto__add_field_website_location_description__add_field_website_twitte.py | Python | gpl-3.0 | 15,825 |
# -*- encoding: utf-8 -*-
from . import userinfo
import unittest
import shutil
import os
from yamlns import namespace as ns
useryaml = """\
name: de los Palotes, Perico
nif: 12345678Z
lang: ca
"""
class UserInfo_Test(unittest.TestCase):
def setUp(self):
self.datadir = 'userinfotestdir'
self.cl... | Som-Energia/intercoop | python/intercoop/userinfo_test.py | Python | agpl-3.0 | 2,434 |
from . import db
class Gist(db.Model):
id = db.Column(db.Integer, primary_key=True)
title = db.Column(db.String(120))
body = db.Column(db.Text)
lang = db.Column(db.String(30))
def __init__(self, title, body, lang):
self.title = title
self.body = body
self.lang = lang
... | danielSbastos/gistified | gistified/models.py | Python | mit | 457 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2014-2017 Vincent Noel (vincent.noel@butantan.gov.br)
#
# This file is part of libSigNetSim.
#
# libSigNetSim 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 Fou... | msreis/SigNetSim | signetsim/views/edit/ModelMiscForm.py | Python | agpl-3.0 | 5,576 |
import setuptools
setuptools.setup(
name="tailchart",
description="A CLI utility for charting data on the web.",
long_description="",
version="0.0.13",
url="https://github.com/usbuild/tailchart",
author="Qichao Zhang",
author_email="njuzhangqichao@gmail.com",
entry_points={"console_scr... | usbuild/tailchart | setup.py | Python | mit | 582 |
from builtins import range
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
from h2o.estimators.isolation_forest import H2OIsolationForestEstimator
from h2o.estimators.random_forest import H2ORandomForestEstimator
from h2o.es... | h2oai/h2o-3 | h2o-py/tests/testdir_algos/sharedtree/pyunit_PUBDEV-6754_ntrees_actual_for_tree_algos.py | Python | apache-2.0 | 3,584 |
# Copyright 2018 - Nokia, ZTE
#
# 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... | openstack/vitrage | vitrage/tests/mocks/mock_graph_datasource/transformer.py | Python | apache-2.0 | 1,112 |
from django.contrib import messages
from django.core.exceptions import PermissionDenied
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.utils import translation
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import get_language
from auth... | ttsirkia/a-plus | course/viewbase.py | Python | gpl-3.0 | 5,108 |
def foo():
return {field.key: field for key, field in inspect.getmembers(instance)
if isinstance(field, QueryableAttribute)
and isinstance(field.property, ColumnProperty)
or field.foreign_keys} | caot/intellij-community | python/testData/formatter/alignListComprehensionInDict.py | Python | apache-2.0 | 244 |
# -*- coding: utf-8 -*-
# Copyright 2013 Dev in Cachu authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
from django.conf import settings
from django.template import response
from django.views.generic import base
from . import models
... | devincachu/devincachu-2013 | devincachu/destaques/views.py | Python | bsd-2-clause | 1,171 |
from itertools import chain
from operator import attrgetter
__all__ = ("Contents", "contents_for_items", "contents_for_item")
class Contents:
def __init__(self, regions):
self.regions = regions
self._sorted = False
self._contents = {region.key: [] for region in self.regions}
self... | matthiask/django-content-editor | content_editor/contents.py | Python | bsd-3-clause | 2,812 |
#!/usr/bin/env python
import numpy
from numpy.linalg import solve as solve_linear_equations
from tree_space import TreeEvaluator, ancestry2tree
from util import distanceDictAndNamesTo1D, distanceDictTo1D, triangularOrder
__author__ = "Peter Maxwell"
__copyright__ = "Copyright 2007-2012, The Cogent Project"
__credits__... | sauloal/cnidaria | scripts/venv/lib/python2.7/site-packages/cogent/phylo/least_squares.py | Python | mit | 3,229 |
import logging.config
logging.config.fileConfig("config/logging.conf")
logger = logging.getLogger("temp")
logger.info("Using temperature logger")
| cubiks/rpi_thermo_py | test/test_logging.py | Python | mit | 147 |
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
GPIO.setup(5, GPIO.OUT)
GPIO.output(5, GPIO.HIGH)
GPIO.output(5, GPIO.LOW)
| phodal/iot-code | chapter2/gpio.py | Python | mit | 124 |
from cx_Freeze import setup,Executable
setup(
name = 'Test',
version = '0.1',
description = 'Test Desc',
executables = [Executable('InvestingCSVtoPivotReports.py')]
)
| dgmckenna/InvestingCSVtoPivotReports | setup.py | Python | mit | 202 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Soufiane Belharbi, Clément Chatelain,
# Romain Hérault, Sébastien Adam (LITIS - EA 4108).
# All rights reserved.
#
# This file is part of structured-output-ae.
#
# structured-output-ae is free software: you can redistribute it and/or
# modify it under the t... | sbelharbi/structured-output-ae | sop_embed/experiments/helen_4l_in2.py | Python | lgpl-3.0 | 15,723 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from pant... | pgroudas/pants | tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_java_compile_integration.py | Python | apache-2.0 | 8,550 |
from gym.spaces import discrete
import gym
from collections import defaultdict
import numpy as np
from scipy.spatial.distance import pdist, squareform
from tilecoding.representation import TileCoding
from ApproximatedSarsaLambdaAgent import ApproximatedSarsaLambdaAgent
import sys
import time
import pickle
... | SB-BISS/RLACOSarsaLambda | agents/HAApproximatedSarsaLambdaAgent.py | Python | mit | 24,232 |
# -*- coding: utf-8 -*-
import scrapy
import re
from locations.items import GeojsonPointItem
class BrightHorizonsSpider(scrapy.Spider):
name = "brighthorizons"
allowed_domains = ['brighthorizons.com']
start_urls = (
'https://www.brighthorizons.com/sitemap.xml',
)
def parse(self, response... | iandees/all-the-places | locations/spiders/brighthorizons.py | Python | mit | 2,683 |
from math import floor, ceil, sqrt
s = input().strip().replace(' ', '')
items_count = sqrt(len(s))
row_count = floor(items_count)
column_count = ceil(items_count)
if row_count * column_count < len(s):
row_count += 1
result = [''] * column_count
for i in range(row_count):
begin = i * column_count
end = ... | avenet/hackerrank | algorithms/implementation/encryption.py | Python | mit | 469 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim.configs.dplcm_estimation_config import dplcm_configuration as config
from urbansim.estimation.estimator import update_controller_by_specification_from_module
class dplcm_configura... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/psrc/config/dplcm_estimation_config.py | Python | gpl-2.0 | 591 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('recipe', '0012_auto_20160330_1659'),
]
def populate_recipe_job(apps, schema_editor):
# Go through all of the old recipe_job ... | ngageoint/scale | scale/recipe/migrations/0013_auto_20160331_1127.py | Python | apache-2.0 | 1,938 |
# 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 ... | Azure/azure-sdk-for-python | sdk/edgegateway/azure-mgmt-edgegateway/azure/mgmt/edgegateway/models/tracking_info.py | Python | mit | 1,558 |
import os
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.storage.models import StorageAccount
from kubeflow.fairing.cloud.azure import AzureFileUploader
STORAGE_ACCOUNT_NAME = os.environ.get('AZURE_STORAGE_ACCOUNT')
RESOURCE_GROUP = os.environ.get('AZURE_RESOURCE_GROUP')
REGION = os... | kubeflow/fairing | tests/integration/azure/test_azure_file_uploader.py | Python | apache-2.0 | 1,016 |
import pymysql, chardet, os, re
import threading
import time
Mfile=[[] for col in range(2)]
current=0
db = pymysql.connect("localhost","root","88329900","Bilingual" , charset="UTF8")
cursor = db.cursor()
tempdir=''
n=0
Mfile=[[] for col in range(2)]
for root, dirs, files in os.walk('D:\\cp_data\\io'):
for dir in... | ParallelCorpusWeb/Website | python/multiThread_DBinsert.py | Python | apache-2.0 | 2,639 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import recordlinkage as rl
import numpy
import pandas
FULL_INDEX = pandas.MultiIndex.from_product(
[[1, 2, 3], [1, 2, 3]], # 3x3 matrix
names=['first', 'second'])
LINKS_TRUE = pandas.MultiIndex.from_tuples(
[(1, 1), (2, 2), (... | J535D165/recordlinkage | tests/test_measures.py | Python | bsd-3-clause | 4,180 |
from bedrock.redirects.util import redirect
redirectpatterns = (
# bug 926629
redirect(r'^newsletter/about_mobile(?:/(?:index\.html)?)?$', 'newsletter.subscribe'),
redirect(r'^newsletter/about_mozilla(?:/(?:index\.html)?)?$', 'mozorg.contribute.index'),
redirect(r'^newsletter/new(?:/(?:index\.html)?)?... | sgarrity/bedrock | bedrock/newsletter/redirects.py | Python | mpl-2.0 | 432 |
################################################################################
# siegkx1.py
#
# Post Processor for the Sieg KX1 machine
# It is just an ISO machine, but I don't want the tool definition lines
#
# Dan Heeks, 5th March 2009
import nc
import iso_modal
import math
#######################################... | JohnyEngine/CNC | heekscnc/nc/siegkx1.py | Python | apache-2.0 | 625 |
import gevent.monkey; gevent.monkey.patch_socket()
import gevent
import kestrel
def action(command, server_params):
jobs = [
gevent.spawn(getattr(kestrel.Client(servers=[server]), command), *params)
for server, params in server_params
]
gevent.joinall(jobs)
return [job.value for... | matterkkila/kestrelweb | kestrelweb/kestrel_actions.py | Python | mit | 683 |
import datetime
import pandas as pd
from pandas import DataFrame
import matplotlib.pyplot as plt
from matplotlib import style
interested_range = -500
# style.use('ggplot')
sp = pd.read_csv('sp500.csv', index_col='Date', parse_dates=True)
sp_close = sp['Adj Close']
sp_close = sp_close[interested_range:]
print sp_clo... | yanfriend/pandas | sp500_draw.py | Python | bsd-2-clause | 1,056 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio
# Copyright (C) 2014, 2015 CERN.
#
# Invenio 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 ... | ludmilamarian/invenio | invenio/ext/arxiv/__init__.py | Python | gpl-2.0 | 5,794 |
# Copyright (C) 2013 by Ken Guyton. All Rights Reserved.
"""A representation of a card player.
A player can draw and hold cards.
"""
class Player(object):
"""The player class."""
def __init__(self, name):
"""Initialize the player and his name.
Args:
name: str.
"""
self.name = name
... | kmggh/cards | player.py | Python | artistic-2.0 | 1,028 |
### Aconcagua - Python API ###
# The MIT License (MIT)
# Copyright (c) 2014 Emilio Daniel Gonzalez
# 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 li... | aconcagua/aconcagua-python | aconcagua/apoll/__init__.py | Python | mit | 1,777 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.