code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright (C) 2011-2012 by
# Nicholas Mancuso <nick.mancuso@gmail.com>
# All rights reserved.
# BSD license.
"""Functions for finding node and edge dominating sets.
A *`dominating set`_[1] for an undirected graph *G* with vertex set *V*
and edge set *E* is a subset *D* of *V* such tha... | goulu/networkx | networkx/algorithms/approximation/dominating_set.py | Python | bsd-3-clause | 4,402 |
# -*- coding: utf-8 -*-
# © 2016 Comunitea
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Order scheduled shipment",
"summary": "Sale order with scheduled shipment",
"version": "8.0.1.0.0",
"category": "Connector",
"author": "Nadia Ferreyra",
"license": "AGPL-3",
... | jgmanzanas/CMNT_004_15 | project-addons/scheduled_shipment/__openerp__.py | Python | agpl-3.0 | 566 |
#!/usr/bin/python
# Copyright 2012 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 applic... | pnakka/googlecrisismap | prefs_test.py | Python | apache-2.0 | 2,339 |
#!/usr/bin/env python
"""
Usage: suprabackup_receive.py
Author: Matthieu 'Korrigan' Rosinski <mro@quanta-computing.com>
This script is a wrapper to handle xtrabackup uploads for Percona server
backups
"""
import os
import sys
import datetime
from suprabackup import db
from suprabackup.logging import setup_logging
fr... | quanta-computing/suprabackup | suprabackup/scripts/receive.py | Python | mit | 2,054 |
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import datetime
from Bio.Seq import Seq
if __name__ == '__main__':
from needleman_wunsch import needleman_wunsch
else:
from .needleman_wunsch import needleman_wunsch
#-------------------------------
def plot_nw(seq_alpha_col,... | kevinah95/bmc-sequence-alignment | algorithms/needleman_wunsch/plot_nw.py | Python | mit | 3,189 |
import datetime
import itertools
import json
import logging
import os
import sys
from google.appengine.api import mail
from google.appengine.api import memcache
import stripe
import webapp2
import env
import handlers
import model
import templates
import util
import wp_import
class Error(Exception): pass
# TODO(hjf... | MayOneUS/pledgeservice | backend/main.py | Python | apache-2.0 | 8,637 |
"""
Observational constrains related to gas masses in galaxies.
:requires: NumPy
:version: 0.1
:author: Sami-Matias Niemi
:contact: niemi@stsci.edu
"""
import os
import numpy as N
#This should be global, as all observational data are in the same place
#Note however that because the data is in Dropbox the absolute p... | sniemi/SamPy | astronomy/gasmasses.py | Python | bsd-2-clause | 2,822 |
from __future__ import print_function, division
from sympy.core import S, sympify, expand
from sympy.functions import Piecewise, piecewise_fold
from sympy.functions.elementary.piecewise import ExprCondPair
from sympy.core.sets import Interval
def _add_splines(c, b1, d, b2):
"""Construct c*b1 + d*b2."""
if b1... | hrashk/sympy | sympy/functions/special/bsplines.py | Python | bsd-3-clause | 4,916 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | Axam/nsx-web | nailgun/nailgun/test/unit/test_node_assignment_handler.py | Python | apache-2.0 | 6,171 |
#!/usr/bin/env python
# -*- coding: UTF8 -*-
#
# ffmpeg library python wrapper.
# Copyright (C) 2011 Josiah Gordon <josiahg@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either v... | zepto/musio | musio/xmp/__init__.py | Python | gpl-3.0 | 833 |
"""
Flask-Testing
--------------
Flask unittest integration.
Links
`````
* `documentation <http://packages.python.org/Flask-Testing>`_
* `development version
<http://bitbucket.org/danjac/flask-testing/get/tip.gz#egg=Flask-Testing-dev>`_
"""
from setuptools import setup
setup(
name='Flask-Testing',
versio... | danjac/Flask-Testing | setup.py | Python | bsd-3-clause | 1,245 |
#!/usr/bin/env python3
import cgi
import cgitb
import os
import os.path
import sys
sys.stderr = sys.stdout
import configparser
cgitb.enable()
cfg = configparser.ConfigParser()
cfg.read(os.path.expanduser(os.environ.get('MEGACFG', '~/.megacfg')))
paths = cfg.get("System", "pythonInclude").split(":")
for path in paths... | tiagoantao/mega-analysis | web/iHS.py | Python | agpl-3.0 | 3,166 |
from corehq.apps.reports.filters.fixtures import AsyncDrillableFilter
from django.utils.translation import ugettext_noop
class DistrictField(AsyncDrillableFilter):
label = ugettext_noop("District")
slug = "location"
hierarchy = [{"type": "district", "display": "name"}]
class HealthFacilityField(AsyncDri... | qedsoftware/commcare-hq | custom/reports/mc/reports/fields.py | Python | bsd-3-clause | 568 |
# 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 PerlTextCsv(PerlPackage):
"""Comma-separated values manipulator (using XS or PurePerl)"""
... | LLNL/spack | var/spack/repos/builtin/packages/perl-text-csv/package.py | Python | lgpl-2.1 | 560 |
def _extend_class():
from tmp102._tmp102 import Tmp102
from tmp102._tmp102 import _set_bit_for_boolean, EXTENDED_MODE_BIT
def _apply_extended_mode(self, config, mode_set):
config[1] = _set_bit_for_boolean(
config[1],
EXTENDED_MODE_BIT,
mode_set
)
... | khoulihan/micropython-tmp102 | tmp102/extendedmode.py | Python | mit | 765 |
import time
import serial
import smtplib
TO = 'putyour@email.here'
GMAIL_USER = 'putyour@email.here'
GMAIL_PASS = 'putyourpasswordhere'
SUBJECT = 'Intrusion!!'
TEXT = 'Your PIR sensor detected movement'
ser = serial.Serial('/dev/ttyACM0', 9600)
def send_email():
print("Sending Email")
smtpserver = smtplib.S... | nauer/Arduino | Sketchbook/serial/pythonserial.py | Python | gpl-2.0 | 825 |
az.plot_kde(
mu_posterior, values2=tau_posterior,
contour_kwargs={"levels":3}, contourf_kwargs={"levels":3}
);
| mcmcplotlib/mcmcplotlib | api/generated/arviz-plot_kde-11.py | Python | apache-2.0 | 119 |
from twBase import * # NOQA
import numpy as np # NOQA
import pandas as pd # NOQA
from pprint import pprint # NOQA
T = 10
n = 10
def create_data(T=10, n=10, split=0.8):
x = np.zeros((n, 2, T))
idx_arr = np.arange(T)
for i in range(n):
idx = np.random.choice(idx_arr, 2, replace=False)
... | sysid/nbs | adding/create_data.py | Python | mit | 662 |
"""
This module contains general purpose URL functions not found in the standard
library.
Some of the functions that used to be imported from this module have been moved
to the w3lib.url module. Always import those from there instead.
"""
import urlparse
import urllib
import cgi
from w3lib.url import *
from scrapy.u... | mzdaniel/oh-mainline | vendor/packages/scrapy/scrapy/utils/url.py | Python | agpl-3.0 | 2,723 |
"""
"""
import copy
class QueryDesc:
"""
QueryDesc ("Query Description") represents a single query param sent to a wysteria server.
- An object must match all of the set params in order to be considered a match.
- Multiple QueryDesc sent to Wysteria will return results that match any of the individu... | voidshard/pywysteria | wysteria/domain/query_desc.py | Python | bsd-3-clause | 5,633 |
# -*- coding: utf-8 -*-
import tensorflow as tf
import numpy as np
import random
from game_state import GameState
from game_ac_network import GameACFFNetwork, GameACLSTMNetwork
from a3c_training_thread import A3CTrainingThread
from rmsprop_applier import RMSPropApplier
from constants import ACTION_SIZE
from constants... | oronanschel/deep_async_rl | a3c_display.py | Python | apache-2.0 | 1,852 |
from __future__ import print_function
# This file is part of Androguard.
#
# Copyright (C) 2013, Anthony Desnos <desnos at t0t0.fr>
# 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... | shuxin/androguard | androguard/decompiler/decompiler.py | Python | apache-2.0 | 25,474 |
# 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
# d... | jasondunsmore/heat | heat/engine/hot/template.py | Python | apache-2.0 | 15,677 |
# -*- coding: utf-8 -*-
"""
cross platform utilities
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import pipes
import six
import sys
import platform
import subprocess
import shlex
from os.path import exists, normpath, basename, dirname, join, expanduser
from utool imp... | Erotemic/utool | utool/util_cplat.py | Python | apache-2.0 | 49,052 |
from __future__ import unicode_literals
from .... import ProResource
class AccountDetailsIFRS(ProResource):
full_endpoint = True
attribute_names = [
'id',
# string Accounts ID
'last_update',
# dateTime Date of last update
'date',
# dateTime Accounting to date
... | founders4schools/duedilv3 | duedil/resources/pro/company/accounts/ifrs.py | Python | apache-2.0 | 9,205 |
import webtest
import re
from pywb.webapp.pywb_init import create_wb_router
from pywb.framework.wsgi_wrappers import init_app
from pywb.cdx.cdxobject import CDXObject
from pywb.utils.timeutils import timestamp_now
from memento_fixture import *
class TestMemento(MementoMixin):
TEST_CONFIG = 'tests/test_config_meme... | jcushman/pywb | tests/test_memento.py | Python | gpl-3.0 | 16,280 |
import numpy as np
from hyperopt import base, pyll
from sklearn.pipeline import Pipeline
from sklearn.base import BaseEstimator
from sklearn.kernel_approximation import Nystroem as _Nystroem
def trial_to_fninval(trial, space):
"""Instantiate a particular element from the pyll space
Example
-------
>>>... | rmcgibbo/hyperopt-mixtape | hpmixtape/hpmixtape.py | Python | lgpl-2.1 | 2,312 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | doduytrung/odoo-8.0 | openerp/addons/base/ir/ir_model.py | Python | agpl-3.0 | 61,894 |
from test import test_support
import unittest
nis = test_support.import_module('nis')
class NisTests(unittest.TestCase):
def test_maps(self):
try:
maps = nis.maps()
except nis.error, msg:
# NIS is probably not active, so this test isn't useful
self.sk... | j5shi/Thruster | pylibs/test/test_nis.py | Python | gpl-2.0 | 1,215 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from six.moves import xrange
def get_monthly_results(goal_doctype, goal_field, date_col, filter_str, aggregation = '... | paurosello/frappe | frappe/utils/goal.py | Python | mit | 4,291 |
#!/usr/bin/env python
from __future__ import with_statement
from StringIO import StringIO
import unittest
import os
import posixpath
import sys
from uuid import UUID
from dropbox import session, client
import datetime
from dropbox.rest import ErrorResponse
try:
import json
except ImportError:
import simplejso... | cpfair/dropbox-sdk-python | tests/test_client.py | Python | mit | 18,170 |
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2016, 2017 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in... | chipaca/snapcraft | tests/fake_servers/__init__.py | Python | gpl-3.0 | 11,169 |
""" Fucntions to make the selection matrix """
from typing import Optional, Tuple
import copy
import numpy as np
import scipy.sparse
from spins import fdfd_tools
def average_2xFarEdge(grid_size, design_bounds):
"""
Start with 2D versions of each grid and later just use repmat to
make the S-matrix for t... | stanfordnqp/spins-b | spins/gridlock/selection_matrix.py | Python | gpl-3.0 | 18,981 |
import unittest
class Vertex(object):
""" Graph vertex implementation """
def __init__(self, id):
self.__id = id
self.__neighbors = {}
def add_neighbor(self, v, cost=0):
self.__neighbors[v] = cost
def get_connections(self):
return self.__neighbors.keys()
def ge... | dezelin/pydsa | graph/graph_list.py | Python | mit | 1,352 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for edit widgets.
.. note:: 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.
"""
__au... | minorua/QGIS | tests/src/python/test_qgsrelationeditwidget.py | Python | gpl-2.0 | 14,748 |
# Copyright (c) 2013-2020 Philip Hane
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and... | secynic/ipwhois | ipwhois/scripts/ipwhois_cli.py | Python | bsd-2-clause | 51,841 |
class vEB_Tree():
import math
def __init__(self, u):
self.min = None
self.max = None
self.u = u
self.summary = None
self.ul = math.floor(math.sqrt(self.u))
self.uh = math.ceil(math.sqrt(self.u))
#self.cluster = [None] * self.uh
if not self.is_leaf(... | JasonVann/CLRS | S5_AdvancedDataStructures/C20_vanEmdeBoasTrees/vEB_Tree.py | Python | mit | 3,635 |
# coding: utf-8
# Copyright 2013 The Font Bakery 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 re... | vitalyvolkov/fontbakery | bakery/project/state.py | Python | apache-2.0 | 17,442 |
# Copyright 2020 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import functools
from odoo import api, fields, models
from odoo.tools import float_compare
class AccountMoveLine(models.Model):
_inherit = "account.move.line"
discount2 = fields.Float(
string="Discount 2 ... | OCA/account-invoicing | account_invoice_triple_discount/models/account_move_line.py | Python | agpl-3.0 | 4,038 |
# -*- coding: utf-8 -*-
# pylint: disable=missing-docstring
"""
Programmatic integration point for User API Accounts sub-application
"""
from __future__ import absolute_import
import datetime
import six
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.core.validators ... | ESOedX/edx-platform | openedx/core/djangoapps/user_api/accounts/api.py | Python | agpl-3.0 | 32,226 |
import tkinter.ttk
"""A custom combobox that provides key and item methods"""
class Combobox(tkinter.ttk.Combobox):
def __init__(self, parent, *args, **kwargs):
tkinter.ttk.Combobox.__init__(self, parent, *args, **kwargs)
self.__data_source = None
"""set the data source and use the key to re-select the previo... | bobbarnes1981/ComCat | ComCat/custom.py | Python | gpl-2.0 | 1,946 |
import sys
from collections import deque
def readFile(filename):
# Load data; format should be a single line which will be loaded as a string
with open(filename,'r') as f:
data = f.readline().strip()
return data
def removeOddChars(data):
# Remove anything that's not a letter, digit, -,... | willettk/insight | dc/cs_challenge/sortThis.py | Python | apache-2.0 | 2,728 |
import demistomock as demisto
from CommonServerPython import *
from datetime import datetime
# fix for: https://github.com/vertica/vertica-python/issues/296
# (we need this for running in non-root where getpass will fail as uid doesn't map to a user name)
import getpass
class FixGetPass():
def __init__(self):
... | VirusTotal/content | Packs/Vertica/Integrations/Vertica/Vertica.py | Python | mit | 4,860 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: types.py
from types import *
MSG_KEY_PARAMS = 65536
MSG_KEY_PARAMS_TARGET = 65537
MSG_KEY_RESULT = 131072
MSG_KEY_RESULT_UPTIME = 131073
MSG_KEY_RESU... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/status/cmd/uptime/types.py | Python | unlicense | 340 |
import time
from cloudify.decorators import operation
@operation(resumable=True)
def wait(ctx):
"""Wait for a while when creating this node."""
time.sleep(ctx.node.properties['delay'])
| cloudify-cosmo/cloudify-system-tests | cosmo_tester/resources/plugin/test_plugin/test_plugin/wait.py | Python | apache-2.0 | 195 |
"""Convenient imports"""
from pswingw2.client import send_simple_message # noqa
from pswingw2.client import send # noqa
from pswingw2.client import send_single # noqa
from pswingw2.client import send_batch # noqa
from pswingw2.client import Client # noqa
from pswingw2.config_defaults import get_simple_config as c... | ZettaIO/pswingw2py | pswingw2/__init__.py | Python | mit | 334 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# Developer: francois.schnell francois.schnell@gmail.com
# http://francois.schnell.free.fr
#
# Contributors, see: http://code.google.com/p/gpicsync/wiki/Contributi... | nalt/GPicSync | gpicsync-GUI.py | Python | gpl-2.0 | 74,951 |
import random
from tests.unit.lib.iml_unit_test_case import IMLUnitTestCase
from chroma_core.models import Volume
from chroma_core.services.job_scheduler.job_scheduler import JobScheduler
from tests.unit.chroma_core.helpers import synthetic_host, synthetic_volume_full
from tests.unit.chroma_core.helpers import load_de... | intel-hpdd/intel-manager-for-lustre | tests/unit/chroma_core/services/job_scheduler/test_create_filesystem.py | Python | mit | 3,608 |
# -*- 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-grafeas | grafeas/grafeas_v1/types/intoto_provenance.py | Python | apache-2.0 | 7,148 |
# Copyright (c) 2019 PaddlePaddle 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 appli... | luotao1/Paddle | python/paddle/fluid/tests/unittests/test_parallel_executor_drop_scope.py | Python | apache-2.0 | 2,783 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2013 thomasv@gitorious
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | vergecurrency/electrum-xvg | lib/account.py | Python | gpl-3.0 | 13,337 |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.docgen.targets.doc import Page, Wiki, WikiArtifact
from pants.backend.docgen.tasks.generate_pants_reference import GeneratePantsReference
from pants.backend.docgen.tasks... | wisechengyi/pants | src/python/pants/backend/docgen/register.py | Python | apache-2.0 | 877 |
###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | Southpaw-TACTIC/TACTIC | src/pyasm/search/upgrade/data_dumper.py | Python | epl-1.0 | 1,126 |
# Django settings for sample project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
... | nkunihiko/django-bootstrap3-datetimepicker | sample/settings.py | Python | apache-2.0 | 5,131 |
# Copyright 2019 The PlaNet 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 applicable... | google-research/planet | planet/models/ssm.py | Python | apache-2.0 | 3,921 |
# -*- coding: utf-8 -*-
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | sjperkins/tensorflow | tensorflow/tensorboard/plugins/text/text_plugin_test.py | Python | apache-2.0 | 11,311 |
class Movement:
UP = (0, -1)
DOWN = (0, 1)
LEFT = (-1, 0)
RIGHT = (1, 0)
_standardSpeed = 2.5
def __init__(self):
self.speedX = 0
self.speedY = 0
def setPuppet(self, puppet):
"""Sets the object, that is controlled by the movement object, to the given value. The pu... | eott/procgen | Movement.py | Python | mit | 1,559 |
# This file is distributed under the terms of the GNU General Public license.
# Copyright (C) 1999 Aloril (See the file COPYING for details).
import time
from mind.Goal import Goal
# goals for minds
def false(_): return False
def true(_): return True
class Delayed(Goal):
"""Will delay execution of sub goal... | worldforge/cyphesis | data/rulesets/basic/scripts/mind/goals/common/common.py | Python | gpl-2.0 | 3,486 |
from setuptools import setup, find_packages
setup(name='BIOMD0000000364',
version=20140916,
description='BIOMD0000000364 from BioModels',
url='http://www.ebi.ac.uk/biomodels-main/BIOMD0000000364',
maintainer='Stanley Gu',
maintainer_url='stanleygu@gmail.com',
packages=find_packages(... | biomodels/BIOMD0000000364 | setup.py | Python | cc0-1.0 | 377 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(ver... | normalnorway/normal.no | django/apps/links/migrations/0001_initial.py | Python | gpl-3.0 | 1,595 |
import gui
| TeamAbstract/GeneticScheduling | gui/__init__.py | Python | apache-2.0 | 11 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Utility methods used within the module
"""
from sword2_logging import logging
utils_l = logging.getLogger(__name__)
from time import time
from datetime import datetime
from base64 import b64encode
from mimetools import Message
try:
from hashlib import md5
exce... | oerpub/python-sword2 | sword2/utils.py | Python | mit | 12,498 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.threadpool}
"""
import pickle, time, weakref, gc, threading
from twisted.trial import unittest, util
from twisted.python import threadpool, threadable, failure, context
from twisted.internet import reactor
from twi... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/test/test_threadpool.py | Python | agpl-3.0 | 17,542 |
""" Calcute a new date from value of minutes
name: Ricardo Portela da Silva
date: 31/12/2016
"""
from gregtojulian import gregtojulian
from juliantogreg import juliantogreg
import datetime
import sys
def change_date(date, op, value):
""" calculate new date """
dateEnt, hourEnt = date.split(" ", 2)
dayIni,... | ricaportela/convert-data-nbf | changedate.py | Python | mit | 1,509 |
from collections import namedtuple
from Vintageous.tests import ViewTest
from Vintageous.vi.utils import modes
test_data = namedtuple('test_data', 'text startRegion findChar mode expectedRegion msg')
NORMAL_CASES = (
test_data('0a23x5', (1, 1), 'x', modes.NORMAL, (4, 4), 'Find ahead'),
test_data('0ax345', (1... | zhangtuoparis13/Vintageous | tests/commands/test__vi_f.py | Python | mit | 4,474 |
import re
from expynent import compiled
from expynent import patterns
from expynent.shortcuts import is_private
def assert_is_compiled(obj):
assert isinstance(obj, type(re.compile('')))
def test_patterns_are_compiled():
def walk(dictionary):
for value in dictionary.values():
if isinstan... | lk-geimfari/expynent | tests/test_compiled.py | Python | bsd-3-clause | 774 |
# Takes a directory that has a json files in it, and concatenate them to a single file.
#
import sys
import os
import glob
import argparse
import json
def json_concat(files_dir, output_file):
json_files = glob.glob(os.path.join(files_dir, '*'))
# In order to avoid opening all the files and creating a larg... | Rhoana/FijiBento | scripts/json_concat.py | Python | gpl-2.0 | 1,593 |
__usage__ = """
To run tests locally:
python tests/test_arpack.py [-l<int>] [-v<int>]
"""
import warnings
import numpy as np
from numpy.testing import assert_allclose, \
assert_array_almost_equal_nulp, TestCase, run_module_suite, dec, \
assert_raises, verbose, assert_equal
from numpy import array... | teoliphant/scipy | scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py | Python | bsd-3-clause | 18,489 |
# Copyright 2014-2016 The Meson development team
# 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... | rhd/meson | mesonbuild/mintro.py | Python | apache-2.0 | 9,970 |
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
execfile(path.join(here, 'mutagenwrapper/version.py')) # import __version__
def readme():
try:
with open(path.join(here, 'README'), encoding='utf-8') as f:
retur... | clee704/mutagenwrapper | setup.py | Python | mit | 1,335 |
"""
Tools for managing a federated Carbon cluster.
"""
__version_info__ = ('1', '1', '8')
__version__ = '.'.join(__version_info__)
class CarbonateException(Exception):
pass
| graphite-project/carbonate | carbonate/__init__.py | Python | mit | 180 |
# -*- coding:utf8 -*-
# Author: shizhenyu96@gamil.com
# github: https://github.com/imndszy
from openpyxl import Workbook
from openpyxl.compat import range
import pymysql
import time
while True:
try:
conn = pymysql.connect(host='localhost',port=3306,user='szy',passwd='123456',db='voluntary',charset='utf8')
... | imndszy/voluntary | excel.py | Python | mit | 1,036 |
###########################################################################
# PROJECT: IPC (Interprocess Communication) Package
#
# (c) Copyright 2011 Reid Simmons. All rights reserved.
#
# FILE: module2.py
#
# ABSTRACT: Test program for Python version of IPC.
# Publishes: MSG2
# Subscribes to: MSG... | languitar/ipc | test/module2.py | Python | bsd-3-clause | 3,534 |
import ConfigParser
import os
runner_config_path = os.path.split(os.path.realpath(__file__))[0]
template = """
- input_type: <input_type>
# Paths that should be crawled and fetched. Glob based paths.
paths:
#- <path>
document_type: <document_type>
fields.orgid: <orgid>
fields.sysid: <sysid>
fields.... | wangy1931/tcollector | deploy/filebeat_conf.py | Python | lgpl-3.0 | 3,164 |
from ferris.core import plugins
import threading
import logging
from .models.setting import Setting as SettingsModel
from ferris import events
from google.appengine.api import memcache
import datetime
plugins.register('settings')
global_cache = {}
local_cache = threading.local()
def activate(settings):
if 'ove... | markEarvin/password-tracker | plugins/settings/__init__.py | Python | mit | 1,146 |
from veros.core.operators import numpy as npx
from veros import veros_kernel, veros_routine, KernelOutput, runtime_settings
from veros.variables import allocate
from veros.core import advection, utilities
from veros.core.operators import update, update_add, at
"""
IDEMIX as in Olbers and Eden, 2013
"""
@veros_kerne... | dionhaefner/veros | veros/core/idemix.py | Python | mit | 10,739 |
# -*- coding: utf-8 -*-
"""
amqp.five
~~~~~~~~~~~
Compatibility implementations of features
only available in newer Python versions.
"""
from __future__ import absolute_import
import io
import sys
try:
from collections import Counter
except ImportError: # pragma: no cover
from collections ... | kalefranz/auxlib | auxlib/_vendor/five.py | Python | isc | 7,109 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_gridlines07.py | Python | bsd-2-clause | 2,369 |
def add_native_methods(clazz):
def setLongValue__java_lang_String__long__(a0, a1):
raise NotImplementedError()
def setBooleanValue__java_lang_String__boolean__(a0, a1):
raise NotImplementedError()
def setStringValue__java_lang_String__java_lang_String__(a0, a1):
raise NotImplemente... | laffra/pava | pava/implementation/natives/sun/management/Flag.py | Python | mit | 683 |
from .model_mixins import TimestampMixin
| Ameriks/drklauns | drklauns/core/mixins/__init__.py | Python | mit | 41 |
import os
import sys
import time
import hotshot
class ProfileMiddleware(object):
def process_request(self, request):
filename = "%s.%s.prof" % (request.path.strip("/").replace('/', '.'),
request.method.upper())
self.filename = os.path.join('profile', filename)
... | pv/pydocweb | docweb/profile_middleware.py | Python | bsd-3-clause | 1,017 |
import csv
r = csv.reader(open('Farmers_Markets_in_New_York_State.csv','r'))
fw = open('Farmers_Markets_by_zipcode.csv','w')
counts = dict()
for line in r:
zip = line[6]
if zip == 'Zip': continue
if zip in counts.keys(): counts[zip]+=1
else: counts[zip] = 1
fw.write('Zip,Num_farmersmarkets\n')
for zip in sorted... | chuck211991/data_science_2014 | farmers markets/farmermarket_count.py | Python | mit | 377 |
# Process the test results
# Test status (like passed, or failed with error code)
import argparse
import re
import TestScripts.NewParser as parse
import TestScripts.CodeGen
from collections import deque
import os.path
import numpy as np
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api a... | JonatanAntoni/CMSIS_5 | CMSIS/DSP/Testing/convertToOld.py | Python | apache-2.0 | 3,180 |
"""
Views related to the Custom Courses feature.
"""
import csv
import datetime
import functools
import json
import logging
import pytz
from contextlib import contextmanager
from copy import deepcopy
from cStringIO import StringIO
from django.core.urlresolvers import reverse
from django.http import (
HttpResponse... | rismalrv/edx-platform | lms/djangoapps/ccx/views.py | Python | agpl-3.0 | 20,949 |
from setuptools import setup, Extension
from Cython.Build import cythonize
#from Cython.Compiler.Options import directive_defaults
#------------------------------------------------------------------------
# http://stackoverflow.com/questions/8106258/cc1plus-warning-command-line-option-wstrict-prototypes-is-valid-for... | mlampros/textTinyPy | setup.py | Python | gpl-3.0 | 3,293 |
from __future__ import unicode_literals
import sys
from pre_commit.languages import helpers
from pre_commit.xargs import xargs
ENVIRONMENT_DIR = None
GREP = 'ggrep' if sys.platform == 'darwin' else 'grep'
get_default_version = helpers.basic_get_default_version
healthy = helpers.basic_healthy
install_environment = h... | Lucas-C/pre-commit | pre_commit/languages/pcre.py | Python | mit | 669 |
from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser, RawTextHelpFormatter
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ValidationError
import os
import shutil
import subprocess
... | sonali0901/zulip | zerver/management/commands/export.py | Python | apache-2.0 | 5,740 |
class PatientState:
# age: years
# weight: kilos
# height: cm
# sex: 'm' or 'f'
def __init__(self, age, weight, height, sex, params):
self.params = params
lean_body_mass = self.__lean_body_mass(weight, height, sex)
self.v1 = params['v1']
# TODO: Work out why v2 and ... | JMathiszig-Lee/Propofol | patient_state.py | Python | mit | 7,564 |
# -*- coding: utf-8 -*
#/*
import string, xbmc, xbmcgui, xbmcplugin, os, xbmcaddon
myPlayer=xbmc.PLAYER_CORE_AUTO
if 'tvshka' in xbmc.Player(myPlayer).getPlayingFile():
xbmc.Player(myPlayer).playprevious()
xbmc.log('[PageDownFixExceputed] in SHURA.TV')
else:
xbmc.executebuiltin('PlayerControl(Previous)')
xbmc.log... | Dave667/service | plugin.video.shura.tv/pagedownfix.py | Python | gpl-2.0 | 400 |
"""Generic (shallow and deep) copying operations.
Interface summary:
import copy
x = copy.copy(y) # make a shallow copy of y
x = copy.deepcopy(y) # make a deep copy of y
For module specific errors, copy.Error is raised.
The difference between shallow and deep copying is only relev... | ruamel/ordereddict | test/copy.py | Python | mit | 11,478 |
n = int(input())
count = 0
for _ in range(n):
b = list(map(int, input().split()))
if sum(b) >= 2:
count += 1
print(count)
| mathemage/CompetitiveProgramming | codeforces/div2/143/A/A.py | Python | mit | 139 |
# Задача 10. Вариант 50
# Напишите программу "Генератор персонажей" для игры.
# Пользователю должно быть предоставлено 30 пунктов,
# которые можно распределить между четырьмя характеристиками:
# Сила, Здоровье, Мудрость и Ловкость. Надо сделать так,
# чтобы пользователь мог не только брать эти пункты из общего "пу... | Mariaanisimova/pythonintask | IVTa/2014/BRONNIKOV_I_S/task_10_50.py | Python | apache-2.0 | 2,187 |
#Stranded on an island is a program that will ask the user to make many choices, their choices will determine their survival on this uninhibited island.
a = raw_input("type your name here ")
print "Welcome to, Stranded on an Island"
print "Hello " + str(a) + ", your ship have crashed and you have been stranded on isl... | deedee1886-cmis/deedee1886-cmis-cs2 | textgame.py | Python | cc0-1.0 | 1,271 |
#!/usr/bin/env python
#
# qtfmt.py v1.10
# v1.10 : Updated to use Python 2.0 Unicode type.
#
# Read a document in the quotation DTD, converting it to a list of Quotation
# objects. The list can then be output in several formats.
__doc__ = """Usage: qtfmt.py [options] file1.xml file2.xml ...
If no filenames are provid... | Pikecillo/genna | external/PyXML-0.8.4/demo/quotes/qtfmt.py | Python | gpl-2.0 | 13,896 |
# Copyright (c) 2014 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... | rdo-management/neutron | neutron/db/migration/models/head.py | Python | apache-2.0 | 3,353 |
from __future__ import unicode_literals
import re
import tempfile
from django.contrib.gis import gdal
from django.contrib.gis.db.models import Extent, MakeLine, Union
from django.contrib.gis.geos import (
GeometryCollection, GEOSGeometry, LinearRing, LineString, Point, Polygon,
fromstr,
)
from django.core.man... | BlindHunter/django | tests/gis_tests/geoapp/tests.py | Python | bsd-3-clause | 40,260 |
# Copyright 2015 Hewlett Packard Enterprise Development Company LP
#
# 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 applic... | openstack/octavia | octavia/tests/unit/amphorae/backends/agent/api_server/test_keepalived.py | Python | apache-2.0 | 1,948 |
# encoding=utf-8
# 该类定义所有用到与工厂类相关的公共工厂类
# encoding=utf-8
from twisted.internet.protocol import Factory
class BaseFactory(Factory):
def __init__(self, idName=None, protocol=None):
self.idName = idName or 'idName' #idName是一个标记
self.numProtocols = 0 #协议设备在线连接数量
self.protocol = protocol #将... | kooksee/TIOT | test/project/router/common/BaseFactory.py | Python | gpl-2.0 | 586 |
# -*- coding: utf8 -*-
# This file is part of PYBOSSA.
#
# Copyright (C) 2016 Scifabric LTD.
#
# PYBOSSA 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 Foundation, either version 3 of the License, or
# (at your op... | PyBossa/pybossa | test/test_importers/test_s3_importer.py | Python | agpl-3.0 | 6,099 |
"""distutils.command.sdist
Implements the Distutils 'sdist' command (create a source distribution)."""
__revision__ = "$Id$"
import os
import string
import sys
from glob import glob
from warnings import warn
from distutils.core import Command
from distutils import dir_util, dep_util, file_util, archive... | nmercier/linux-cross-gcc | win32/bin/Lib/distutils/command/sdist.py | Python | bsd-3-clause | 19,034 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.