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 |
|---|---|---|---|---|---|
# Webhooks for external integrations.
from typing import Optional
from django.http import HttpRequest, HttpResponse
from zerver.decorator import api_key_only_webhook_view
from zerver.lib.actions import check_send_private_message
from zerver.lib.request import REQ, has_request_variables
from zerver.lib.response import... | brainwane/zulip | zerver/webhooks/yo/view.py | Python | apache-2.0 | 1,015 |
"""
This file is part of GASATaD.
GASATaD 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.
GASATaD is distributed in the hope that it will b... | milegroup/gasatad | AddColumnInterface.py | Python | gpl-3.0 | 18,784 |
"""
calculate a p-value of a region using the Stouffer-Liptak method or the
z-score method.
"""
from __future__ import print_function
import argparse
import sys
import numpy as np
import toolshed as ts
from collections import defaultdict
from interlap import InterLap
from _common import bediter, get_col_num
fro... | brentp/combined-pvalues | cpv/region_p.py | Python | mit | 8,973 |
""" @package antlr3.dottreegenerator
@brief ANTLR3 runtime package, tree module
This module contains all support classes for AST construction and tree parsers.
"""
# begin[licence]
#
# [The "BSD licence"]
# Copyright (c) 2005-2008 Terence Parr
# All rights reserved.
#
# Redistribution and use in source and binary fo... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/antlr3/antlr3/extras.py | Python | bsd-3-clause | 1,913 |
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | dhootha/bazel | tools/android/incremental_install.py | Python | apache-2.0 | 27,838 |
from django.contrib.gis.db import models
from django.contrib import admin
# Create your models here.
class Position(models.Model):
point = models.PointField()
created_date = models.DateTimeField(auto_now=False)
class Location(models.Model):
current_position = models.ForeignKey(to=Position)
last_cha... | JuloWaks/pyar_map | members_map/django_located/models.py | Python | mit | 436 |
from runtests.mpi import MPITest
from nbodykit.lab import *
from nbodykit import setup_logging
from numpy.testing import assert_allclose, assert_array_equal
import os
setup_logging("debug")
# The test result data (threeptcf_sim_result.dat) is computed with
# Daniel Eisenstein's
# C++ implementation on the same input ... | bccp/nbodykit | nbodykit/algorithms/tests/test_threeptcf.py | Python | gpl-3.0 | 5,475 |
#!/usr/bin/env python
# A small Python utility for synchronizing a local folder with a remote web
# repository.
# The MIT License (MIT)
#
# Copyright (c) 2014-8 Roberto Reale
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "... | roberto-reale/wsync | wsync/wsync.py | Python | mit | 7,836 |
__all__ = ['bob','fpmatch','utils']
from bob import Rule | robochat/buildbit | buildbit/__init__.py | Python | gpl-3.0 | 58 |
#!/usr/bin/env python
"""Trivial example program from the Spyse tutorial"""
from spyse.app.app import App
App()
| davidko/evolspyse | tut/trivial.py | Python | lgpl-2.1 | 116 |
# Test AXScripting the best we can in an automated fashion...
import win32api, os, sys
import win32com.axscript
import win32com.axscript.client
import unittest
import win32com.test.util
verbose = "-v" in sys.argv
class AXScript(win32com.test.util.TestCase):
def setUp(self):
file = win32api.GetFullPathNa... | sserrot/champion_relationships | venv/Lib/site-packages/win32com/test/testAXScript.py | Python | mit | 1,268 |
import socket
import threading
import time
import struct
import Queue
queue = Queue.Queue()
def udp_sender(ip,port):
'''
send udp package
'''
try:
ADDR = (ip,port)
sock_udp = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
sock_udp.sendto("abcd...",ADDR)
... | spunkzwy/learn_python | monit/monit_port.py | Python | gpl-3.0 | 2,261 |
from .Drive import Drive
from .Item import Item | stanionascu/py1drive | py1drive/OneDrive/resources/__init__.py | Python | mit | 47 |
# Lint as: python2, python3
# Copyright 2020 Google LLC. 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 req... | GoogleCloudPlatform/mlops-on-gcp | immersion/guided_projects/guided_project_2_solution/models/keras/model_test.py | Python | apache-2.0 | 1,262 |
# -*- coding: utf8 -*-
SQL = (
('list_fonds_report1', """
select
F.FKOD,F.FNAME, (F.A16+if(F.A22,A22,0)) as A16
FROM
`af3_fond` F
WHERE
FNAME like ('%%%(qr)s%%') or A1 like ('%%%(qr)s%%')
ORDER BY FKOD;"""),
)
FOUND_ROWS = True
ROOT = "fonds"
ROOT_PREFIX = None
ROOT_POSTFIX= ... | ffsdmad/af-web | cgi-bin/plugins2/report/fond_search_report1.py | Python | gpl-3.0 | 547 |
import sys, inspect
import os
import unittest
from pytest import raises
import numpy as np
from cs207rbtree import RedBlackTree #import RBTree
from TimeseriesDB.generate_SMTimeseries import generate_time_series #script to generate time series
from Similarity.pick_vantage_points import pick_vantage_points #script to pic... | slac207/cs207project | tests/test_database.py | Python | mit | 4,014 |
"""add_modified_at_to_users_and_kernels
Revision ID: e35332f8d23d
Revises: da24ff520049
Create Date: 2020-07-01 14:02:11.022032
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.sql.expression import bindparam
from ai.backend.manager.models.base import conv... | lablup/backend.ai-manager | src/ai/backend/manager/models/alembic/versions/e35332f8d23d_add_modified_at_to_users_and_kernels.py | Python | lgpl-3.0 | 3,049 |
#!/usr/bin/env python
import jsk_arc2017_common
graspability = jsk_arc2017_common.get_object_graspability()
for obj_id, obj in enumerate(graspability):
print('{:02}: {}'.format(obj_id+1, obj))
for style in graspability[obj]:
print(' {}: {}'.format(style, graspability[obj][style]))
| start-jsk/jsk_apc | jsk_arc2017_common/scripts/list_graspability.py | Python | bsd-3-clause | 303 |
# pattern seems to be multiplying every pair of digits from different numbers and adding them up
from itertools import product
def test_it(a, b):
return sum(int(d1)*int(d2) for d1,d2 in product(str(a), str(b)))
| SelvorWhim/competitive | Codewars/ThinkingTestingAB.py | Python | unlicense | 217 |
# Volatility
# Copyright (C) 2007-2013 Volatility Foundation
#
# This file is part of Volatility.
#
# Volatility 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 o... | andante20/volatility | volatility/plugins/linux/common.py | Python | gpl-2.0 | 5,223 |
# -*- encoding: utf-8 -*-
#
# Copyright 2014-2015 Openstack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | idegtiarov/gnocchi-rep | gnocchi/aggregates/moving_stats.py | Python | apache-2.0 | 6,068 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | shishaochen/TensorFlow-0.8-Win | tensorflow/contrib/framework/python/framework/tensor_util.py | Python | apache-2.0 | 12,161 |
#encoding=utf8
import re
import zipfile
import HTMLParser
class GetContent(HTMLParser.HTMLParser):
def __init__(self):
HTMLParser.HTMLParser.__init__(self)
self.content = ""
def handle_data(self, data):
self.content += data
re_digits = re.compile(r'(\d+)')
def embedded_numbers(s):... | tshirtman/kpritz | epub2txt.py | Python | gpl-3.0 | 966 |
#!/usr/bin/python
# Copyright (C) 2010, Nokia (ivan.frade@nokia.com)
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ... | Pelagicore/tracker-ivi | tests/functional-tests/common/utils/writebacktest.py | Python | gpl-2.0 | 3,490 |
import os
import subprocess
import shlex
def get_ctags_version(executable=None):
"""
Return the text output from the --version option to ctags or None if ctags
executable cannot be found. Use executable for custom ctags builds and/or
path.
"""
args = shlex.split("ctags --version")
try:
... | Bruno-sm/fguess | training_files/Python/ctags.py | Python | gpl-3.0 | 4,738 |
# REQUIRES: lit-max-individual-test-time
# Check that the per test timeout is enforced when running GTest tests.
#
# RUN: not %{lit} -j 1 -v %{inputs}/googletest-timeout --timeout=1 > %t.cmd.out
# RUN: FileCheck < %t.cmd.out %s
# Check that the per test timeout is enforced when running GTest tests via
# the configura... | GPUOpen-Drivers/llvm | utils/lit/tests/googletest-timeout.py | Python | apache-2.0 | 1,304 |
#!/usr/bin/env python
# Analyse texture
#
# Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca>
# Author: Charley
# Modified: 2017-06-22
#
# About the license: see the file LICENSE.TXT
import os
import sys
import itertools
import numpy as np
from skimage.feature import greycomatrix, greycoprops
from sp... | neuropoly/spinalcordtoolbox | spinalcordtoolbox/scripts/sct_analyze_texture.py | Python | mit | 14,764 |
"""
This file implements the lowering for `dict()`
"""
from numba.targets.imputils import lower_builtin
@lower_builtin(dict)
def impl_dict(context, builder, sig, args):
"""
The `dict()` implementation simply forwards the work to `Dict.empty()`.
"""
from numba.typed import Dict
dicttype = sig.retu... | jriehl/numba | numba/targets/dictimpl.py | Python | bsd-2-clause | 504 |
from Tkinter import *
from minimop.conf import Mop
import math
import paho.mqtt.client as mqtt
import json
master = Tk()
width = 1000
height = 500
radar_values = [181]
step = 0
stepsize = 5
w = Canvas(master ,width=width, height=height)
w.pack()
botmid_x = width/2
botmid_y = 500
def on_connect(self, client, us... | eXpire163/minimop | minimop/run/runRadarUI.py | Python | mit | 1,222 |
#!/usr/bin/env python
#
# 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 option) any later version.
#
# Ansible is distributed in the hope that it will b... | tsdmgz/ansible | test/integration/targets/vault/password-script.py | Python | gpl-3.0 | 1,024 |
from __future__ import (absolute_import, division, print_function)
from mantid.api import FileProperty, WorkspaceProperty, PythonAlgorithm, AlgorithmFactory, FileAction
from mantid.kernel import Direction
from mantid.simpleapi import CreateWorkspace, AddSampleLogMultiple
import numpy
import h5py
class LoadLamp(Pytho... | ScreamingUdder/mantid | Framework/PythonInterface/plugins/algorithms/LoadLamp.py | Python | gpl-3.0 | 2,688 |
import logging
log = logging.getLogger(__name__)
version = __version__ = "1.0"
| kurgm/gwv | gwv/__init__.py | Python | mit | 81 |
'''
New Integration Test for Ceph Pool Capacity.
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.test_state as test_state
import time
test_stub = test_lib.lib_get_test_stub()
test_obj_dict = test_state.TestStateDict()
pool_cap = ... | zstackorg/zstack-woodpecker | integrationtest/vm/virtualrouter/ceph_pool_capacity/test_ceph_root_pool_cap.py | Python | apache-2.0 | 1,147 |
from twisted.internet import threads
from config import config
from enigma import eDBoxLCD, eTimer, iPlayableService, pNavigation
import NavigationInstance
from Tools.Directories import fileExists
from Components.ParentalControl import parentalControl
from Components.ServiceEventTracker import ServiceEventTracker
from ... | popazerty/openhdf-enigma2 | lib/python/Components/VfdSymbols.py | Python | gpl-2.0 | 6,706 |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = 'datelikeus.users'
verbose_name = "Users"
def ready(self):
"""Override this to put in:
Users system checks
Users signal registration
"""
pass
| jeffminsungkim/datelikeus | src/datelikeus/users/apps.py | Python | mit | 276 |
class GNIRS_SPECT(DataClassification):
name="GNIRS_SPECT"
usage = "Applies to any SPECT dataset from the GNIRS instrument."
parent = "GNIRS"
requirement = ISCLASS('GNIRS') & PHU(ACQMIR='Out')
newtypes.append(GNIRS_SPECT())
| pyrrho314/recipesystem | trunk/dontload-astrodata_Gemini/ADCONFIG_Gemini/classifications/types/GNIRS/gemdtype.GNIRS_SPECT.py | Python | mpl-2.0 | 241 |
#!/usr/bin/env python
"""
8. Optional bonus question--use a queue to get the output data back from the child processes
in question #7. Print this output data to the screen in the main process.
(applied_python)[chudgins@ip-172-30-0-251 class8]$ ./class8_ex8.py
...
Final elapsed time: 0:00:13.378109
"""
__... | mudzi42/pynet_class | class8/class8_ex8.py | Python | apache-2.0 | 1,799 |
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# 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 in the top-level directory
# of this distribution and at:
#
# http:... | hirokihamasaki/irma | common/tests/test_nosqldatabase.py | Python | apache-2.0 | 6,422 |
from django.db.models import Q
from django.db.utils import IntegrityError
from django.test import TestCase, skipIfDBFeature
from django.forms.models import modelform_factory
from .models import (
Address, Place, Restaurant, Link, CharLink, TextLink,
Person, Contact, Note, Organization, OddRelation1, OddRelatio... | dex4er/django | tests/generic_relations_regress/tests.py | Python | bsd-3-clause | 9,000 |
# coding=utf-8
# This file is part of SickRage.
#
# URL: https://sickrage.github.io
# Git: https://github.com/SickRage/SickRage.git
#
# SickRage 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... | Maximilian-Reuter/SickRage-1 | sickrage/providers/torrent/TorrentProvider.py | Python | gpl-3.0 | 5,136 |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from scipy import *
from scipy.signal import *
import cStringIO
from PIL import Image
import os
import sys
import util.tools
# Represents a dummy network for testing.
class DummyNetwork:
# Network distortion types.
OneToOne = 1
HFlip = 2
VFlip ... | anthonytw/neat-deform | src/gui/PopulationModel.py | Python | gpl-3.0 | 7,546 |
import hashlib
from shiftmedia import exceptions as x
from shiftmedia import utils
class PathBuilder:
def __init__(self, secret_key):
"""
Path builder constructor
Initializes path builder service.
:param secret_key: string - secret key from config
"""
self.secret_ke... | projectshift/shift-media | shiftmedia/paths.py | Python | mit | 9,544 |
# Copyright 2014 The Oppia 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 ... | amgowano/oppia | core/domain/rights_manager_test.py | Python | apache-2.0 | 36,355 |
from smtplib import SMTPException
import logging
from django.core.mail import send_mail
from django.conf import settings
logger = logging.getLogger(__name__)
def send_email(user_objects_to_send_to, subject, message):
if not settings.DEVILRY_SEND_EMAIL_TO_USERS:
return
message += "\n\n--\n"
mess... | vegarang/devilry-django | devilry/utils/devilry_email.py | Python | bsd-3-clause | 1,476 |
import datetime
import pytest
from pretix.base.models import Event, EventPermission, Organizer, User
@pytest.fixture
def env(client):
orga = Organizer.objects.create(name='CCC', slug='ccc')
event = Event.objects.create(
organizer=orga, name='30C3', slug='30c3',
date_from=datetime.datetime(20... | Flamacue/pretix | src/tests/plugins/stripe/test_settings.py | Python | apache-2.0 | 1,030 |
# -*- 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 'Event.in_menus'
db.add_column(u'calendar_event', 'in_menus',
self.gf('... | orlenko/sfpirg | mezzanine/calendar/migrations/0005_auto__add_field_event_in_menus.py | Python | bsd-2-clause | 11,513 |
# Copyright (c) 2013 Nicolas Dandrimont <nicolas.dandrimont@crans.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use,... | zackmdavis/hy | hy/lex/parser.py | Python | mit | 8,013 |
# 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 ... | Scalr/libcloud | libcloud/test/dns/test_zerigo.py | Python | apache-2.0 | 14,732 |
# -*- coding: utf-8 -*-
"""
Dashboard stuff for admin_tools
"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
from admin_tools.utils import get_admin_site_name
class CustomIndexDashboard(Dash... | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/django_buildout/project/mods_available/admin_tools/dashboard.py | Python | mit | 3,336 |
from setuptools import setup, find_packages
import os
DESCRIPTION = """
MEANS: python package for Moment Expansion Approximation, iNference and Simulation
A free, user-friendly tool implementing an efficient moment expansion approximation with parametric closures
that integrates well with the IPython interactive envi... | lukauskas/means | src/setup.py | Python | mit | 2,401 |
##########################################################################
#
# Copyright (c) 2008-2013, Image Engine Design 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:
#
# * Redis... | dneg/cortex | test/IECoreGL/Selection.py | Python | bsd-3-clause | 13,164 |
# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in root directory
##############################################################################
from . import stock
from . import stock_quant
| slevenhagen/odoomrp-wip-npg | stock_picking_wave_package_info/models/__init__.py | Python | agpl-3.0 | 307 |
import unittest
from funcytaskengine.event_fulfillment.return_values import EmptyValues, ValuesContainer, ValuesContainer
from funcytaskengine.transition_conditions.transformations import DictExtractFields
class DictExtractFieldsTestCase(unittest.TestCase):
def test_no_values(self):
extractor = DictExtr... | dm03514/func-y-task-engine | tests/unit/transition_conditions/transformations/test_dict_extract_fields.py | Python | gpl-3.0 | 1,539 |
#!/usr/bin/env python
import os, random, glob, shutil, itertools
from PIL import Image
from joblib import Parallel, delayed
IN_SUFFIX = '_in.png'
OUT_SUFFIX = '_out.png'
TRAIN_SIZE = 0.7
VAL_SIZE = 0.2
RESIZE_TO_X = 500
RESIZE_TO_Y_FACTOR = 1.32
RESIZE_TO = (RESIZE_TO_X, int(RESIZE_TO_X * RESIZE_TO_Y_FACTOR))
WINDOW... | windj007/tablex-dataset | train_test_augment.py | Python | apache-2.0 | 4,822 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | Benoss/EazyReport | libs/bottle.py | Python | gpl-3.0 | 142,001 |
import os
import os.path
import shutil
import socket
import subprocess
import sys
import tempfile
import threading
import time
import random
try:
import pytest
except ImportError:
print >> sys.stderr, "Integ tests require pytests!"
sys.exit(1)
def pytest_funcarg__servers(request):
"Returns a new APIH... | armon/hlld | integ/test_integ.py | Python | bsd-3-clause | 12,915 |
from django.conf.urls.defaults import *
urlpatterns = patterns('',
url(r'^static/(?P<path>.*)$', 'staticfiles.views.serve'),
)
| zodman/django-staticfiles | staticfiles/tests/urls/default.py | Python | bsd-3-clause | 132 |
"""Constants for the Risco integration."""
from homeassistant.const import (
CONF_SCAN_INTERVAL,
STATE_ALARM_ARMED_AWAY,
STATE_ALARM_ARMED_HOME,
)
DOMAIN = "risco"
RISCO_EVENT = "risco_event"
DATA_COORDINATOR = "risco"
EVENTS_COORDINATOR = "risco_events"
DEFAULT_SCAN_INTERVAL = 30
CONF_CODE_ARM_REQUIR... | lukas-hetzenecker/home-assistant | homeassistant/components/risco/const.py | Python | apache-2.0 | 1,258 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 vers... | EUDAT-B2SHARE/invenio-old | modules/websearch/lib/websearch_templates.py | Python | gpl-2.0 | 194,109 |
# supaxoaxonic.py ---
#
# Filename: supaxoaxonic.py
# Description: Superficial Layer 2/3 axoaxonic cells
# Author: subhasis ray
# Maintainer:
# Created: Tue Oct 6 16:52:28 2009 (+0530)
# Version:
# Last-Updated: Fri Oct 21 17:06:19 2011 (+0530)
# By: Subhasis Ray
# Update #: 29
# URL:
# Keywords:
#... | BhallaLab/moose-thalamocortical | DEMOS/pymoose/traub2005/py/supaxoaxonic.py | Python | lgpl-2.1 | 4,383 |
# -*- coding: utf-8 -*-
from crispy_forms.compatibility import integer_types, string_types
from crispy_forms.exceptions import DynamicError
from crispy_forms.layout import Fieldset, MultiField
from crispy_forms.bootstrap import Container
class LayoutSlice(object):
# List of layout objects that need args passed fi... | rootAir/rootAir | static/crispy_forms/layout_slice.py | Python | gpl-2.0 | 6,173 |
CMDNAME_ATTR = '__cmdname__'
ALIASES_ATTR = '__aliases__'
def command(name=None, aliases=()):
""" Decorator to register a command handler in a Plugin. """
fn = None
if callable(name):
fn = name
name = None
def _command(fn):
setattr(fn, CMDNAME_ATTR, fn.__name__ if name is None... | theY4Kman/yakbot | yakbot/ext.py | Python | mit | 1,531 |
import sys
def read_input():
ings = []
for s in sys.stdin.readlines():
s = s.replace(',', '')
[ing, _, capacity, _, durability, _, flavor, _, texture, _, calories] = s.split()
ings += [list(map(int, [capacity, durability, flavor, texture, calories]))]
return ings
def solve(ings, ... | plilja/adventofcode | 2015/day15/day15.py | Python | gpl-3.0 | 1,207 |
# -*- encoding: utf-8 -*-
"""
@author: miko
"""
from numpy import *
class cluster_node:
def __init__(self,vec,left=None,right=None,distance=0.0,id=None):
self.left=left
self.right=right
self.vec=vec
self.id=id
self.distance=distance
def L2dist(v1,v2):
return sqrt(sum(v1... | sinomiko/project | IdeaProjects/MachineLearning/HierarchicalClustering.py | Python | bsd-3-clause | 1,710 |
# Copyright (C) 2013,2017 Ian Harry, Duncan Brown
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is ... | hagabbar/pycbc_copy | pycbc/workflow/configuration.py | Python | gpl-3.0 | 38,216 |
import img_scale
import pyfits as pyf
import pylab as pyl
from mpl_toolkits.axes_grid1 import axes_grid
import cPickle as pickle
import os
from scipy.stats import scoreatpercentile
def mk_image(galaxy):
base = './../../images_v5/GS_2.5as_matched/gs_all_'
i_img = pyf.getdata(base+str(galaxy)+'_I.fits')
j_i... | boada/ICD | sandbox/plot_icd_mass_montage.py | Python | mit | 3,643 |
# (c) Nelen & Schuurmans. GPL licensed, see LICENSE.rst.
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.gis.admin import GeoModelAdmin
from django.utils.translation import ugettext_lazy as _
from controlnext.models import Basin
from controlnext.models import GrowerInfo
f... | lizardsystem/controlnext | controlnext/admin.py | Python | gpl-3.0 | 1,860 |
"""
Various tools for detecting specific signals in a radargram
"""
import numpy as np
def surface(rdg, method='maxvec', loc=None, ywinwidth=None):
"""Detect surface echo in a radargram
Arguments
---------
rdg : Array
Radargram
Keywords
--------
method : string
Method to ... | cgrima/rsr | rsr/detect.py | Python | mit | 2,198 |
# test construction of array.array from different objects
from array import array
# tuple, list
print(array('b', (1, 2)))
print(array('h', [1, 2]))
# raw copy from bytes, bytearray
print(array('h', b'22')) # should be byteorder-neutral
print(array('h', bytearray(2)))
print(array('i', bytearray(4)))
# convert from ... | martinribelotta/micropython | tests/basics/array_construct.py | Python | mit | 409 |
import pytest
import raccoon as rc
from raccoon.utils import assert_series_equal
def test_set_cell():
actual = rc.Series([4, 5, 6], index=[10, 11, 12], sort=False)
# change existing value
actual.set(11, 55)
assert actual.get(11) == 55
actual.set(10, 11)
assert actual.get(10) == 11
actual... | rsheftel/raccoon | tests/test_series/test_set.py | Python | mit | 9,949 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2016) Hewlett Packard Enterprise Development LP
#
# 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 limi... | andreadean5/python-hpOneView | tests/unit/resources/storage/test_storage_pools.py | Python | mit | 4,191 |
# 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
#
# Unless required by applica... | hfp/tensorflow-xsmm | tensorflow/contrib/distributions/python/ops/sinh_arcsinh.py | Python | apache-2.0 | 9,206 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-21 22:03
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('showings', '0003_remove_showing_additional_details'),
]
operations = [
migr... | WarwickAnimeSoc/aniMango | showings/migrations/0004_auto_20161021_2203.py | Python | mit | 503 |
__version__ = "0.1.0"
if __name__ == '__main__':
pass
| tomersk/ambhas_python | ambhas/__init__.py | Python | gpl-2.0 | 59 |
from .models import codepipeline_backends
from ..core.models import base_decorator
mock_codepipeline = base_decorator(codepipeline_backends)
| spulec/moto | moto/codepipeline/__init__.py | Python | apache-2.0 | 142 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... | Micronaet/micronaet-trip | account_trip_edi_c5/status_report.py | Python | agpl-3.0 | 2,670 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingAverage", cycle_length = 30, transform = "RelativeDifference", sigma = 0.0, exog_count = 20, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_30/ar_/test_artificial_32_RelativeDifference_MovingAverage_30__20.py | Python | bsd-3-clause | 277 |
from PythonQt.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QLabel,
QLineEdit, QDialogButtonBox)
class MultiInputDialog(QDialog):
def __init__(self, title, label1, label2, parent=None):
super().__init__(parent)
self.setWindowTitle(title)
self.lay = QVBoxLayou... | pathmann/pyTSon | ressources/python/pytsonui/dialogs.py | Python | gpl-3.0 | 1,674 |
# Copyright 2013,2014 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Dunya
#
# Dunya 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 (FSF), either version 3 of the License, or... | MTG/dunya | account/forms.py | Python | agpl-3.0 | 2,827 |
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
""" The GUI """
import os, sys, Queue, threading, glob
from contextlib import contextmanager
from threading import RLock, Lock, Thread
from urllib import unquote
from PyQt5.QtWidgets import QStyle # Gives a nicer error message than ... | hojel/calibre | src/calibre/gui2/__init__.py | Python | gpl-3.0 | 51,805 |
from bing_search_api import BingSearchAPI
my_key = "MEL5FOrb1H5G1E78YY8N5mkfcvUK2hNBYsZl1aAEEbE"
def query(query_string):
bing = BingSearchAPI(my_key)
params = {'ImageFilters':'"Face:Face"',
'$format': 'json',
'$top': 10,
'$skip': 0}
results = bing.search('web',qu... | mzweilin/HashTag-Understanding | test/test_bing_search.py | Python | apache-2.0 | 529 |
# Copyright (c) 2013 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | citrix-openstack-build/neutron | neutron/tests/unit/ryu/test_ryu_agent.py | Python | apache-2.0 | 23,803 |
#!/usr/bin/env python
# encoding: utf-8
"""
@version: python 2.7
@author: Sober.JChen
@license: Apache Licence
@contact: jzcjedu@foxmail.com
@software: PyCharm
@file: crop_save_and_view_nodules_in_3d.py
@time: 2017/3/14 13:15
"""
# ToDo ---这个脚本运行时请先根据预定义建好文件夹,并将candidates.csv文件的class头改成nodule_class并存为candidates_clas... | shihuai/TCAI-2017 | preprocess/crop_save_and_view_nodules_in_3d.py | Python | mit | 13,121 |
"""
Input/Output tools for working with binary data.
The Stata input tools were originally written by Joe Presbrey as part of PyDTA.
You can find more information here http://presbrey.mit.edu/PyDTA
See also
---------
numpy.lib.io
"""
from statsmodels.compat.python import (zip, lzip, lmap, lrange, string_types, long,... | DonBeo/statsmodels | statsmodels/iolib/foreign.py | Python | bsd-3-clause | 43,125 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# complexity documentation build configuration file, created by
# sphinx-quickstart on Tue Jul 9 22:26:36 2013.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# au... | testsuite/testdoubles | docs/conf.py | Python | bsd-3-clause | 8,235 |
import socket
import neovim
from threading import Thread
@neovim.plugin
class Snipper(object):
def __init__(self, vim):
# TODO: start the snipper program
# TODO: make SURE the snipper program starts
self.vim = vim
HOST = 'localhost'
PORT_IN = 53706
PORT_OUT = 53707
... | Daphron/vim-snipper | rplugin/python/snipper.py | Python | gpl-3.0 | 1,591 |
"""Defines utility methods for testing nodes"""
from __future__ import unicode_literals
from node.models import Node
HOSTNAME_COUNTER = 1
SLAVEID_COUNTER = 1
def create_node(hostname=None, slave_id=None):
"""Creates a node model for unit testing
:returns: The node model
:rtype: :class:`node.models.Node... | ngageoint/scale | scale/node/test/utils.py | Python | apache-2.0 | 689 |
import numpy as np
from poliastro.core.util import circular_velocity
from .._jit import jit
@jit
def extra_quantities(k, a_0, a_f, inc_0, inc_f, f):
"""Extra quantities given by the Edelbaum (a, i) model.
"""
V_0, beta_0_, _ = compute_parameters(k, a_0, a_f, inc_0, inc_f)
delta_V_ = delta_V(V_0, bet... | Juanlu001/poliastro | src/poliastro/core/thrust/change_a_inc.py | Python | mit | 1,408 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('trackbuild', '0002_auto_20150718_1936'),
]
operations = [
migrations.CreateModel(
name='BuildCounter',
... | miraculixx/trackbuild | trackbuild/migrations/0003_buildcounter.py | Python | mit | 640 |
#!/usr/bin/env python
'''
' Author: Mitchell Steed
' Contributing Author: Douglas Kelly
' This file opens up a socket on the Host machine and allows the standard in from the Victim to be piped to it.
'''
'Import argument Parser, a library used for generating easy documentation based on expected parameter flags'... | MitchSteed/ForensicHasher | workstation.py | Python | gpl-3.0 | 3,842 |
"""Copyright 2008 Orbitz WorldWide
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, softw... | cgvarela/graphite-web | webapp/graphite/browser/urls.py | Python | apache-2.0 | 987 |
#!/usr/bin/env python
import i3
import re
import subprocess
import getopt
import sys
import os
def find_parent(window_id):
"""
Find the parent of a given window id
"""
root_window = i3.get_tree()
result = [None]
def finder(n, p=None):
if result[0] is not None:
return
... | suchacoder/Dotfiles | .config/i3/alternating_layouts.py | Python | gpl-3.0 | 2,518 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/appservice/azure-mgmt-web/azure/mgmt/web/v2015_04_01/operations/_domains_operations.py | Python | mit | 65,265 |
"""Invocation: python manage.py award_badge <badge-slug> <user>
Awards the badge (identified by its slug) to the user (identified by user name)."""
from django.core import management
from django.contrib.auth.models import User
import sys
from apps.widgets.badges import badges
def award_badge(slug, username):
"... | yongwen/makahiki | makahiki/apps/widgets/badges/management/commands/award_badge.py | Python | mit | 1,207 |
"""PCSCPart10: PC/SC Part 10 (pinpad)
__author__ = "Ludovic Rousseau"
Copyright 2009-2010 Ludovic Rosseau
Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr
This file is part of pyscard.
pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public Licens... | moreati/pyscard | smartcard/pcsc/PCSCPart10.py | Python | lgpl-2.1 | 8,728 |
# 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... | Huyuwei/tvm | tutorials/language/tuple_inputs.py | Python | apache-2.0 | 4,628 |
"""
http://community.topcoder.com/stat?c=problem_statement&pm=1667
Single Round Match 147 Round 1 - Division II, Level One
"""
class CCipher:
def decode(self, cipherText, shift):
a = ord('A')
decoder = [a + (c - shift if c >= shift else c - shift + 26) for c in range(26)]
plain = [chr(dec... | warmsea/tc-srm | srm147/CCipher.py | Python | mit | 389 |
#! /usr/bin/python3
# Module importieren
import socket # TCP Sockets
import string, base64 # Stringbearbeitung und Base64-En- und Decoding
import rsa # RSA-Modul
# Host-IP und Port festlegen
host = "127.0.0.1"
#host = "10.32.100.1"
port = 10000
# Socket oeffnen
s = s... | MikroMakroFDS/SecuMod | Scripts/py/client3_demo.py | Python | gpl-2.0 | 2,815 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from django import forms
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy ... | tessie/oneanddone | oneanddone/tasks/filters.py | Python | mpl-2.0 | 3,399 |
# Copyright (c) 2018 NEC, Corp.
#
# 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... | openstack/dragonflow | dragonflow/tests/unit/cmd/test_status.py | Python | apache-2.0 | 1,058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.