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 |
|---|---|---|---|---|---|
class Found(Exception): pass
try:
for i in range(100):
for j in range(1000):
for k in range(10000):
if i + j + k == 777:
raise Found
except Found:
print i, j, k | cookie223/startingtocode | raise.py | Python | mit | 222 |
#!/usr/bin/env python
#
# Copyright 2005,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from __future__ import print_function
from gnuradio import gr, gr_unittest, uhd
class test_uhd(gr_unittest.TestCase):
def setUp(self):
se... | jdemel/gnuradio | gr-uhd/python/uhd/qa_uhd.py | Python | gpl-3.0 | 1,530 |
import ptypes
from ptypes import ptype
from ..__base__ import stackable
class layer(ptype.definition):
cache = {}
class stackable(stackable):
def nextlayer_id(self):
raise NotImplementedError
def nextlayer(self):
id = self.nextlayer_id()
res = layer.withdefault(id, type=id)
... | arizvisa/syringe | template/osi/datalink/__base__.py | Python | bsd-2-clause | 342 |
import subprocess
import os
import fnmatch
result_file_names = ['170414_D00108_0693_AHJG57BCXY_rockj-Tcf21-Ctr', '170414_D00108_0693_AHJG57BCXY_rockj-Tcf21-Bleo']
path_to_file = '/netapp/home/idriver'
pats = []
for fname in result_file_names:
pats.append(os.path.join(path_to_file, fname))
cells_seen = []
for p i... | idbedead/RNA-sequence-tools | file_mover4.py | Python | mit | 1,574 |
"""
WSGI config for cyclesafe project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cyclesafe.settings")
from django.co... | codeforsanjose/CycleSafe | cyclesafe/wsgi.py | Python | mit | 393 |
"""
1-D and 2-D rebinning code.
changed
"""
import numpy
from . import _reduction
def rebin(x,I,xo,Io=None,dtype=numpy.float64):
"""
Rebin a vector.
x are the existing bin edges
xo are the new bin edges
I are the existing counts (one fewer than edges)
Io will be used if present, but be sure ... | reflectometry/osrefl | osrefl/loaders/reduction/rebin.py | Python | bsd-3-clause | 7,637 |
__author__ = 'Arunkumar Eli'
__email__ = "elrarun@gmail.com"
from selenium.webdriver.common.by import By
class DigitalOceanLocators(object):
ACCESS_KEY_INPUT = (By.ID, 'accessKey')
SECRET_KEY_INPUT = (By.ID, 'secretKey')
NEXT_BTN = (By.CSS_SELECTOR, "button.btn.btn-primary")
AVAILABILITY_ZONE = (By.XP... | aruneli/rancher-test | ui-selenium-tests/locators/RackspaceLocators.py | Python | apache-2.0 | 1,212 |
# Copyright (c) 2016 Uber Technologies, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | uber/tchannel-python | tchannel/thrift/server.py | Python | mit | 8,684 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | ryanss/holidays.py | test/countries/test_canada.py | Python | mit | 14,235 |
#!/usr/bin/env python3
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Copyright 2017- Martin Sinn m.sinn@gmx.de
#########################################################################
# ... | robert-budde/smarthome | lib/module.py | Python | gpl-3.0 | 15,003 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_foodbot.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| andela-kanyanwu/food-bot-review | django_foodbot/manage.py | Python | mit | 257 |
import json
import uuid
from django.conf import settings
from django.contrib.auth.models import User as AuthUser
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.urls import reverse
from djang... | Siecje/debt | api/models.py | Python | mit | 9,130 |
__all__ = ['chatcommand', 'execute_chat_command', 'save_matchsettings', '_register_chat_command']
import functools
import inspect
from .events import eventhandler, send_event
from .log import logger
from .asyncio_loop import loop
_registered_chat_commands = {} # dict of all registered chat commands
async def exe... | juergenz/pie | src/pie/chat_commands.py | Python | mit | 3,649 |
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
from .article import Article
from .book import Book
__... | brechtm/rinohtype | src/rinoh/templates/__init__.py | Python | agpl-3.0 | 348 |
#
# 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... | nathanielvarona/airflow | airflow/contrib/operators/s3_to_sftp_operator.py | Python | apache-2.0 | 1,184 |
"""Helpers to install PyPi packages."""
import logging
import os
import sys
import threading
from subprocess import Popen, PIPE
from urllib.parse import urlparse
from typing import Optional
import pkg_resources
_LOGGER = logging.getLogger(__name__)
INSTALL_LOCK = threading.Lock()
def install_package(package: str,... | alexmogavero/home-assistant | homeassistant/util/package.py | Python | apache-2.0 | 2,222 |
#
# Shared FS hauler (noop)
#
import logging
class p_haul_fs:
def __init__(self):
logging.info("Initilized shared FS hauler")
def set_options(self, opts):
pass
def set_work_dir(self, wdir):
pass
def start_migration(self):
return None
def next_iteration(self):
return None
def stop_migration(self)... | jne100/p.haul | phaul/fs_haul_shared.py | Python | lgpl-2.1 | 443 |
# coding=utf-8
#!/usr/bin/env python
import spidev
import time
import sys
import RPi.GPIO as GPIO
from MCP23S17 import MCP23S17 as SW
spi = spidev.SpiDev()
spi.open(0,0)
spi.max_speed_hz = 10000000
sw = SW(spi, 7)
if __name__ == "__main__":
sw.initialise()
try:
while True:
switches = '{0:08b}'.format(sw.read... | rmamba/gcode | switchTest.py | Python | mit | 531 |
import threading, time, Queue, os, sys, shutil, random
from util import user_dir, appdata_dir, print_error, print_msg
from bitcoin import *
import interface
from blockchain import Blockchain
DEFAULT_PORTS = {'t':'50008', 's':'50009', 'h':'8088', 'g':'8089'}
#TODO: update servers
DEFAULT_SERVERS = {
'myr.electr.u... | wozz/electrum-myr | lib/network.py | Python | gpl-3.0 | 15,888 |
# 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: shift_jisx0213.py
import _codecs_jp
import codecs
import _multibytecodec as mbc
codec = _codecs_jp.getcodec('shift_jisx0213')
class Codec(codecs.Cod... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/encodings/shift_jisx0213.py | Python | unlicense | 1,028 |
from __future__ import print_function
__author__ = 'Bill Farner'
import base64
import cookielib
import mimetools
import os
import getpass
import json
import sys
import urllib2
from urlparse import urljoin
from urlparse import urlparse
VERSION = '0.8-precommit'
class APIError(Exception):
pass
class RepositoryI... | pombredanne/commons | src/python/twitter/common/reviewboard/reviewboard.py | Python | apache-2.0 | 19,089 |
'''base class for 2D testcase'''
import numpy as np
class TestSeq2DClass(object):
def setUp(self):
self.mask_value = 1.0
self.batch_size = 100
self.x = 30
self.y = 45
self.channel_size = 7
self.data = np.random.rand(
self.batch_size,
self.x,... | Yoctol/yoctol-keras-layer-zoo | test/convolution/test_seq_base2D.py | Python | gpl-3.0 | 604 |
from pyavatax.base import Document, Line, Address, TaxOverride, AvalaraException, AvalaraTypeException, AvalaraValidationException, AvalaraServerNotReachableException
from pyavatax.api import API
import settings_local # put the below settings into this file, it is in .gitignore
import datetime
import pytest
import uui... | lionheart/pyavatax | test_avalara.py | Python | bsd-3-clause | 23,475 |
# 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, print_function, unicode_literals
import os
import re
from pants.backend.codegen.thrift.lib.thrift import Thrift
from pant... | foursquare/pants | contrib/go/src/python/pants/contrib/go/tasks/go_thrift_gen.py | Python | apache-2.0 | 7,092 |
from collections import defaultdict
from six.moves import xrange
from .binfielddecoder import BfdMsb, BfdMsbB
from .bitstring import BitString
from .errors import *
from .fieldlist import FieldList
from .outputwindow import OutputWindow
from .chrconvert import to_bin, to_printable
from .infoprint import iprint
from .si... | suutari/gitexpy | gitexpy/deflate.py | Python | gpl-2.0 | 15,060 |
#
# Copyright 2010 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... | HybridF5/jacket | jacket/tests/storage/unit/test_test_utils.py | Python | apache-2.0 | 1,642 |
from django.http import HttpResponse
from models import Contact
import json
def contacts(req):
contacts = [ '"' + contact.name.replace('"', '') + '":' + contact.json for contact in Contact.objects.all() ]
return HttpResponse('{' + ','.join(contacts) + '}', content_type='application/json') | usgin/nrrc-repository | registry/views.py | Python | bsd-3-clause | 298 |
#!/usr/bin/python2
# See also:
# https://stuffivelearned.org/doku.php?id=programming:python:python-libmilter
# https://github.com/crustymonkey/python-libmilter
# https://iomarmochtar.wordpress.com/2017/09/13/zimbra-prevent-user-customizing-from-header/
import libmilter as lm
import sys , time
import subprocess
# Crea... | Zimbra-Community/mailing-lists | milter-python2/zimbra_mailinglists_milter.py | Python | gpl-2.0 | 4,747 |
'''Resource Agents Tester
Regression scenarios for garbd RA
'''
__copyright__ = '''
Copyright (C) 2015-2016 Damien Ciabrini <dciabrin@redhat.com>
Licensed under the GNU GPL.
'''
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as publi... | dciabrin/ra-tester | ra/garbd/scenarios.py | Python | gpl-3.0 | 10,450 |
import os
import click
from urllib.parse import urlparse
import json
import urllib.request
import configparser
import subprocess
from butterknife.pool import LocalPool
from butterknife.subvol import Subvol
def pool_factory(url):
o = urlparse(url)
if o.scheme == "file":
from butterknife.pool import Loc... | artizirk/butterknife | host/butterknife/cli.py | Python | mit | 16,948 |
# -*- 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-analytics-data | samples/generated_samples/analyticsdata_v1beta_generated_beta_analytics_data_check_compatibility_async.py | Python | apache-2.0 | 1,502 |
# 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 ... | lmazuel/azure-sdk-for-python | azure-mgmt-managementpartner/azure/mgmt/managementpartner/operations/partner_operations.py | Python | mit | 10,882 |
import re
from django.test.client import RequestFactory
from django.template import RequestContext
from haystack import indexes
from cms import models as cmsmodels
rf = RequestFactory()
HTML_TAG_RE = re.compile(r'<[^>]+>')
def cleanup_content(s):
"""
Removes HTML tags from data and replaces them with sp... | EuroPython/djep | pyconde/search/search_indexes.py | Python | bsd-3-clause | 2,000 |
from unittest.mock import patch
from django.test import TestCase, Client
from django.urls import reverse
from libya_site.tests.factories import UserFactory, DEFAULT_USER_PASSWORD
@patch('vr_dashboard.views.views.retrieve_report')
class ReportsViewPostTest(TestCase):
@classmethod
def setUpTestData(cls):
... | SmartElect/SmartElect | vr_dashboard/tests/test_report_views.py | Python | apache-2.0 | 4,217 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 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 later... | lnielsen/invenio-fungenerator | invenio_fungenerator/views.py | Python | gpl-2.0 | 1,476 |
# Author: Mainak Jas
#
# License: BSD (3-clause)
import re
import copy
import time
import threading
import warnings
import numpy as np
from ..io import _empty_info
from ..io.pick import pick_info
from ..io.constants import FIFF
from ..epochs import EpochsArray
from ..utils import logger
from ..externals.FieldTrip imp... | cmoutard/mne-python | mne/realtime/fieldtrip_client.py | Python | bsd-3-clause | 11,198 |
from __future__ import absolute_import
import os
import logging
log = logging.getLogger("main")
from ..master_task import AlgTask
from ..master_job import Job
from ..utils import (SeqGroup, OrderedDict, pjoin,
GLOBALS, DATATYPES)
from .. import db
__all__ = ["TCoffee"]
class TCoffee(AlgTask):
... | karrtikr/ete | ete3/tools/phylobuild_lib/task/tcoffee.py | Python | gpl-3.0 | 1,525 |
scenario_description = (
" An 'angry' user decides to get out of the DAO and take his money with "
"him. He creates a proposal to split into an one-member DAO with himself "
"as the Curator. Then he makes a proposal to this new DAO to "
"transfer all of the money to himself. Assert that the money he get... | ashellwig/Ethereum-Mutual-Fund | tests/scenarios/singlesplit/run.py | Python | lgpl-3.0 | 1,044 |
# -*- coding: utf8 -*-
# Copyright (c) 2017-2021 THL A29 Limited, a Tencent company. 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... | tzpBingo/github-trending | codespace/python/tencentcloud/iai/v20180301/models.py | Python | mit | 171,806 |
# -*- 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-oslogin | samples/generated_samples/oslogin_v1_generated_os_login_service_delete_ssh_public_key_async.py | Python | apache-2.0 | 1,439 |
# pylint: disable=protected-access
#
# The Qubes OS Project, https://www.qubes-os.org/
#
# Copyright (C) 2014-2016 Joanna Rutkowska <joanna@invisiblethingslab.com>
# Copyright (C) 2014-2016 Wojtek Porczyk <woju@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or modify
# it unde... | kalkin/qubes-core-admin | qubes/tests/vm/mix/net.py | Python | gpl-2.0 | 3,858 |
# -*- coding: utf-8 -*-
"""
admin.py
~~~~~~~~~~~~~~
Admin pages/actions.
:copyright: (c) 2016 by fengweimin.
:date: 16/6/10
"""
from flask import Blueprint
admin = Blueprint("admin", __name__)
| okosioc/flask-boot | app/views/admin.py | Python | mit | 217 |
__all__ = ['colorscheme', 'icon_theme', 'notify', 'widget_style']
from os import popen
from plugins.kde import *
from core import path, kde
@path.register_path_prefix
def KDEWALLPAPER():
paths = []
if kde.version() == 5:
wallpaper = popen("kf5-config --path wallpaper")
wallpaper = wallpaper.rea... | nielsvm/kde4-profiles | plugins/kde/__init__.py | Python | bsd-3-clause | 1,147 |
# Author: Alexander Bokovoy <abokovoy@redhat.com>
# Tomas Babej <tbabej@redhat.com>
#
# Copyright (C) 2011-2014 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | ofayans/freeipa | ipaplatform/fedora/services.py | Python | gpl-3.0 | 2,075 |
from coalib.bearlib.abstractions.Linter import linter
from dependency_management.requirements.PipRequirement import PipRequirement
from coalib.settings.Setting import path
@linter(executable='cmakelint',
output_format='regex',
output_regex=r'.+:(?P<line>\d+): (?P<message>.*)')
class CMakeLintBear:
... | IPMITMO/statan | coala-bears/bears/cmake/CMakeLintBear.py | Python | mit | 1,070 |
import simtk.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_pair_type import AbstractPairType
class LjDefaultPairType(AbstractPairType):
__slots__ = ['scaleLJ', 'scaleQQ', 'long']
@accepts_compatible_units(None, None,
scale... | ctk3b/InterMol | intermol/forces/lj_default_pair_type.py | Python | mit | 1,015 |
'''
Dan Boneh, Xavier Boyen, and Hovav Shacham
| From: "Short Group Signatures
| Published in: CRYPTO 2004
| Available from: n/a
| Notes: An extended abstract of this paper appeared in Advances in Cryptology (2004)
* type: digital signature scheme
* setting: Pairing
:Authors: J Ayo Akinyele
:Date... | lferr/charm | charm/schemes/grpsig/groupsig_bgls04.py | Python | lgpl-3.0 | 4,106 |
from django.contrib import admin
from ltc.models import Record
admin.site.register(Record)
| yiplee/ltc-huobi | ltc/admin.py | Python | mit | 92 |
import numpy as np
import matplotlib.pyplot as plt
import itertools, functools
import operator
def load_data():
with open('./kdata.csv', 'rb') as f:
train = f.readlines()
train = [line.strip('\n') for line in train]
for i, line in enumerate(train):
train[i] = [float(n) for n in... | neale/CS-program | 534-MachineLearning2/assignment4/kmeans.py | Python | unlicense | 4,115 |
# Copyright (c) 2011, Jimmy Cao
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# Redistributions of source code must retain the above copyright notice, this list of conditions and the following dis... | jcao219/wolfbot-new | modules/wolfgame.py | Python | bsd-2-clause | 109,434 |
from django.shortcuts import render,get_object_or_404
from .models import Course,Step
# Create your views here.
def course_list(request):
courses = Course.objects.all()
return render(request,'courses/course_list.html',{'courses':courses})
def course_detail(request,pk):
course= Course.objects.get(pk=pk)... | amit-sgwn/learning_site | courses/views.py | Python | mit | 574 |
from setuptools import setup, find_packages
setup(
name='tsammalex',
version='0.0',
description='tsammalex',
long_description='',
classifiers=[
"Programming Language :: Python",
"Framework :: Pyramid",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP ... | clld/tsammalex | setup.py | Python | apache-2.0 | 1,223 |
import logging
from sys import exc_info
from socket import socket, AF_INET, SOCK_STREAM, SOCK_DGRAM, SHUT_RD, SOL_SOCKET, SO_REUSEADDR, error as socketError
from traceback import format_exception
from struct import Struct
from .common import *
from .models import *
from .exceptions import *
class ClientHost():
... | jm-/zeallect | zeallect/proxy.py | Python | apache-2.0 | 5,351 |
import re
from django.forms.widgets import Widget, SelectDateWidget, Select, MultiWidget
from django.utils.safestring import mark_safe
'''
credit to bradmontgomery
https://www.djangosnippets.org/snippets/1202/
and https://www.djangosnippets.org/snippets/1206/
for SelectTimeWidget and SplitSelectDateTimeWidget
'''
__a... | niksoc/srmconnect | app/widgets.py | Python | gpl-3.0 | 8,457 |
# vim: set ts=4 sw=4 expandtab:
import puremvc.interfaces
import puremvc.patterns.mediator
from ApplicationConstants import Notification
from pyjamas.Window import alert
class DatePickerMediator(puremvc.patterns.mediator.Mediator, puremvc.interfaces.IMediator):
NAME = 'DatePickerMediator'
def __init__(se... | andreyvit/pyjamas | examples/timesheet/view/DatePickerMediator.py | Python | apache-2.0 | 1,381 |
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(box, update=True)
start_display() | bjaraujo/ENigMA | trunk/examples/occactive/scripts/python/hello_occ.py | Python | gpl-2.0 | 281 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Openstack, LLC
# Copyright 2012 Nebula, 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.apac... | fajoy/horizon-example | openstack_dashboard/dashboards/admin/instances/tables.py | Python | apache-2.0 | 6,684 |
"""frd_test.py - test FRD class
RvP, 4 Oct 2012
"""
import sys as pysys
import numpy as np
import matplotlib.pyplot as plt
import pytest
import control as ct
from control.statesp import StateSpace
from control.xferfcn import TransferFunction
from control.frdata import FRD, _convert_to_FRD, FrequencyResponseData
fro... | python-control/python-control | control/tests/frd_test.py | Python | bsd-3-clause | 19,578 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/audio-to-tactile | extras/microphone_tests/streaming_mic_to_pc.py | Python | apache-2.0 | 2,640 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-14 05:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bookchook', '0001_initial'),
]
operations = [
migrations.AddField(
... | tombasche/BookChook | bookchook/migrations/0002_series_user.py | Python | mit | 456 |
from random import randint
def boat_placement(board):
available_ships = [['sub', 3], ['aircraft', 5], ['patrol', 2], ['patrol', 2]]
#completely random placement, this is brute force and should be rewritten for performance so that it remembers prior ship placements
while available_ships:
rand_orie... | rmotr-group-assignments/pyp-c2-a1-b4-g3-t1 | mburke_v/ai.py | Python | mit | 1,068 |
# 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 ... | apache/libcloud | demos/example_aliyun_oss.py | Python | apache-2.0 | 2,711 |
#-*- coding: latin-1 -*-
"""
Date/Time string parsing module.
This code is a slightly modified version of Parser.py found in mx.DateTime
version 3.0.0
As such, it is subject to the terms of the eGenix public license version 1.1.0.
FIXME: Add license.txt to NumPy
"""
__all__ = ['date_from_string', 'datetime_from_st... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/numpy/core/_mx_datetime_parser.py | Python | agpl-3.0 | 33,252 |
import os
import unittest
from vsg import vhdlFile
from vsg.tests import utils
sLrmUnit = 'if_generate_statement'
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(os.path.dirname(__file__), sLrmUnit,'classification_test_input.vhd'))
oFile = vhdlFile.vhdlFile(lFile)
class test_token(unittest.TestCase):
... | jeremiah-c-leary/vhdl-style-guide | vsg/tests/vhdlFile/test_if_generate_statement.py | Python | gpl-3.0 | 713 |
# -*- coding=utf -*-
from __future__ import absolute_import
from cubes.mapper import Mapper
from cubes.errors import *
__all__ = (
"GoogleAnalyticsMapper",
"ga_id_to_identifier"
)
def ga_id_to_identifier(ga_id):
"""Convert GA attribute/object ID to identifier."""
if ga_id.startswith("ga:"):
... | DataBrewery/cubes-ga | cubes-ga/mapper.py | Python | mit | 1,001 |
import logging
from apiclient import errors
from apiclient.http import MediaFileUpload
from oauth2client.client import Credentials
from wevolve.libs.drive_auth import build_service, GetCredentialsException, get_authorization_url
def connect_project_to_drive(request, project_part, userproject, drive_token):
if n... | taikoa/wevolver-server | wevolve/libs/drive_service.py | Python | agpl-3.0 | 11,147 |
# -*- coding:iso-8859-1 -*-
"""
This module offers a generic date/time string parser which is able to parse
most known formats to represent a date and/or time.
This module attempts to be forgiving with regards to unlikely input formats,
returning a datetime object even for dates which are ambiguous. If an element
of a... | morissette/devopsdays-hackathon-2016 | venv/lib/python2.7/site-packages/dateutil/parser.py | Python | gpl-3.0 | 50,020 |
# 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 ... | SUSE/azure-sdk-for-python | azure-batch/azure/batch/models/cloud_pool.py | Python | mit | 16,446 |
from lxml import etree
import unittest
import xml.sax.saxutils as saxutils
from . import test_system
from capa import customrender
# just a handy shortcut
lookup_tag = customrender.registry.get_class_for_tag
def extract_context(xml):
"""
Given an xml element corresponding to the output of test_system.render... | praveen-pal/edx-platform | common/lib/capa/capa/tests/test_customrender.py | Python | agpl-3.0 | 2,249 |
import numpy as np
from sklearn import datasets, metrics
from sklearn.model_selection import train_test_split
from neupy import algorithms
from neupy.exceptions import NotTrained
from base import BaseTestCase
class GRNNTestCase(BaseTestCase):
def test_grrn_exceptions(self):
with self.assertRaises(ValueE... | itdxer/neupy | tests/algorithms/rbfn/test_grnn.py | Python | mit | 3,058 |
from django.conf.urls import *
from kishore.views import (ProductDetail, ProductList, ProductsByTag, add_to_cart, cart, update_cart,
remove_from_cart, checkout, shipping, shipping_methods, payment,
process_payment, download, process_download, BuyNow)
urlpatterns = ... | udbhav/kishore | kishore/urls/store.py | Python | mit | 1,586 |
# -*- coding: utf-8 -*-
import fnmatch
from django.core.files.storage import FileSystemStorage
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class ResumableFile(object):
'''https://raw.githubusercontent.com/jeanphix/django-resumable/dev/resumable/files.py'''
def __ini... | bung87/moto-moe | moto/moe/files.py | Python | mit | 3,011 |
from streamlink.plugins.livestream import Livestream
from tests.plugins import PluginCanHandleUrl
class TestPluginCanHandleUrlLivestream(PluginCanHandleUrl):
__plugin__ = Livestream
should_match = [
'https://livestream.com/',
'https://www.livestream.com/',
'https://livestream.com/acco... | amurzeau/streamlink-debian | tests/plugins/test_livestream.py | Python | bsd-2-clause | 357 |
#!/usr/bin/env python
from __future__ import print_function
import os
import sys
import time
import signal
from subprocess import Popen, PIPE
# These should work on python2 after 'pip install --user future'
from http.server import BaseHTTPRequestHandler
import socketserver
# Opening browser windows
import webbrows... | mcveanlab/mccortex | scripts/python/mccortex-server.py | Python | mit | 4,963 |
# -*- coding: utf-8 -*-
#
# 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
... | adamhaney/airflow | tests/contrib/hooks/test_snowflake_hook.py | Python | apache-2.0 | 2,512 |
"""
tests desispec.fibercrosstalk
"""
import unittest
import numpy as np
from pkg_resources import resource_filename
from desispec.fibercrosstalk import correct_fiber_crosstalk
from desispec.frame import Frame
from desispec.io import empty_fibermap,read_xytraceset
from desispec.resolution import Resolution
class Te... | desihub/desispec | py/desispec/test/test_fibercrosstalk.py | Python | bsd-3-clause | 2,666 |
"""
paver commands
"""
from . import assets, bok_choy, database, docs, i18n, js_test, prereqs, quality, servers, tests
| cpennington/edx-platform | pavelib/__init__.py | Python | agpl-3.0 | 121 |
# Paul Schrum Unity ID: ptschrum
# GIS 540 Course Project
"""
This file is the Entry Point for the course project.
Call this file from the associated ArcMap custom tool:
Road Geometry Analysis.
Usage:
(code-only)
sys.argv[1] contains list of Polyline files to analyze.
sys.argv[2] contains the directory where output ... | PaulSchrum/CogoPy | BestFit/RoadGeometry.py | Python | lgpl-3.0 | 2,213 |
# Copyright 2017 The UAI-SDK 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... | ucloud/uai-sdk | uai/operation/modify_version_weight/modify_version_weight.py | Python | apache-2.0 | 3,094 |
"""
Minimal example showing the use of the AutoCompleteMode.
"""
import logging
logging.basicConfig(level=logging.DEBUG)
import sys
from pyqode.qt import QtWidgets
from pyqode.core.api import CodeEdit
from pyqode.core.backend import server
from pyqode.core.modes import AutoCompleteMode
if __name__ == '__main__':
... | zwadar/pyqode.core | examples/modes/autocomplete.py | Python | mit | 690 |
from unittest.mock import patch
from django.http import HttpRequest
from django.test import override_settings
from django.utils.timezone import now
from axes.attempts import get_cool_off_threshold
from axes.models import AccessAttempt
from axes.utils import reset, reset_request
from tests.base import AxesTestCase
c... | jazzband/django-axes | tests/test_attempts.py | Python | mit | 5,846 |
# -*- coding: utf-8 -*-
import sys
import urllib2
import datetime
import time
import hashlib
def process():
passwd='PI=3.1415926'
arg_len=len(sys.argv)
if arg_len==2:
host_name=sys.argv[1]
tm=str("%d" %(time.mktime(datetime.datetime.now().timetuple())))
src=tm+'~'+passwd
m... | stanxii/indexRiver | app_monitor/app_status.py | Python | apache-2.0 | 660 |
# coding=utf-8
from __future__ import unicode_literals
from time import mktime
from datetime import datetime
from ...pipeline.pipes.base import BasePipe
class MetaPipe(BasePipe):
def set_request(self, request):
for node in request.values():
node.meta['modified_at'] = self._utc_timestamp()
... | 5monkeys/content-io | cio/pipeline/pipes/meta.py | Python | bsd-3-clause | 548 |
from setuptools import setup
import os
long_description = 'A simple chess model in pure Python'
if os.path.exists('README.txt'):
long_description = open('README.txt').read()
# https://pythonhosted.org/setuptools/setuptools.html#id7
setup(
name='Chessnut',
version='0.3.1',
packages=['Chessnut'],
a... | cgearhart/Chessnut | setup.py | Python | unlicense | 595 |
#!/usr/bin/env python3
#
# Copyright 2011-2015 Jeff Bush
#
# 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 l... | jbush001/NyuziProcessor | tests/stress/atomic/runtest.py | Python | apache-2.0 | 1,580 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.contact, name='contact'),
]
| Adventure-Inc/chachas-adventures | contact/urls.py | Python | apache-2.0 | 127 |
# -*- coding: utf-8 -*-
"""Easy integration of DataFrame into pyqt framework
@author: Jev Kuznetsov, Matthias Ludwig - Datalyze Solutions
"""
from datetime import datetime
from pandasqt.compat import Qt, QtCore, QtGui, Slot, Signal
import pandas
import numpy
import parser
import re
from pandasqt.models.ColumnDty... | szaiser/pandas-qt | pandasqt/models/DataFrameModel.py | Python | mit | 21,416 |
'''@file listener.py
contains the listener code'''
import tensorflow as tf
from nabu.neuralnetworks.classifiers.asr.encoders import encoder
from nabu.neuralnetworks.classifiers import layer
class Unidir_Listener(encoder.Encoder):
'''a listener object that uses unidirectional LSTM's in stead of BLSTMs.
transf... | JeroenBosmans/nabu | nabu/neuralnetworks/classifiers/asr/encoders/unidir_listener.py | Python | mit | 2,211 |
# Imports
from rexploit.views.dialog.aboutview import AboutView
class AboutController(object):
"""
This class is a controller that manages the 'About View'
"""
def __init__(self):
"""Initialize the controller object and all attributes that they need it"""
self.__view = AboutView(... | DaniLabs/rexploit | rexploit/controllers/aboutcontroller.py | Python | gpl-3.0 | 442 |
#!/usr/bin/env python
#
# Copyright (c) 2011 Ricardo Martins
#
# Licensed under the MIT License.
# http://www.opensource.org/licenses/mit-license.php
import json
import os
import sys
import urllib
BASE_URL = 'https://www.mtred.com/api/user/key/'
def retrieve_data(api_key):
""" Retrieve data from the pool and co... | meqif/mtred_client | mtred.py | Python | mit | 2,525 |
import threading
from .. import irc, var
from ..tools import is_number
# Dictionary used by the message monitor.
onjoin_rem = {}
# Fill command dictionary.
def ins_command ():
var.commands["remind"] = type("command", (object,), {})()
var.commands["remind"].method = remind
var.commands["remind"].tags = ["other"]
... | skewerr/deskbot | modules/commands/remind.py | Python | bsd-3-clause | 1,856 |
from collections import namedtuple
import fauxfactory
import pytest
from cfme.fixtures.cli import do_appliance_versions_match
from cfme.fixtures.cli import provider_app_crud
from cfme.fixtures.cli import provision_vm
from cfme.fixtures.cli import update_appliance
from cfme.infrastructure.provider.virtualcenter import... | RedHatQE/cfme_tests | cfme/tests/cli/test_appliance_update.py | Python | gpl-2.0 | 13,544 |
# Copyright (c) 2009 CSIRO
# Australia Telescope National Facility (ATNF)
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# PO Box 76, Epping NSW 1710, Australia
# atnf-enquiries@csiro.au
#
# This file is part of the ASKAP software distribution.
#
# The ASKAP software distribution is free softwar... | ATNF/askapsdp | Tools/scons_tools/icebuilder.py | Python | gpl-2.0 | 2,468 |
from collections import Counter
import re
class Solution1(object):
def __init__(self):
self.COMPONENT_RE = (
r'('
r'[A-Z][a-z]?'
r'|'
r'\([^(]+\)'
r'|'
r'\[[^[]+\]'
r'|'
r'\{[^}]+\}'... | anilpai/leetcode | Codewars/Molecule2Atoms.py | Python | mit | 1,541 |
import argparse
import numpy as np
import dendropy
from collections import defaultdict
from datetime import date
from itertools import izip
from fitness_predictors import *
ymin = 2005
ymax = 2015
min_freq = 0.1
max_freq = 0.9
min_tips = 10
pc=1e-2
regularization = 1e-3
default_predictors = ['lb', 'ep', 'ne_star']
cl... | mike2151/virus-prediction | Main Package/H3N2sample/fitness_model.py | Python | mit | 9,103 |
# csvhandler - david.barkhuizen@gmail.com - 2010-09-06 -> ?-?-?
import csv
import datetime
from decimal import *
def load_csv_list_from_file(file_path):
f = open(file_path, 'r')
line = f.readline()
f.close()
splut = line.split(',')
tokens = []
for token in splut:
cleaned = token.strip()
if... | davidbarkhuizen/mart | csvhandler.py | Python | mit | 2,538 |
"""
This module contains the file system tree view.
"""
import sys
import fnmatch
import locale
import logging
import os
import platform
import shutil
import subprocess
from pyqode.qt import QtCore, QtGui, QtWidgets
from pyqode.core import icons
def _logger():
return logging.getLogger(__name__)
def debug(msg, *... | pyQode/pyqode.core | pyqode/core/widgets/filesystem_treeview.py | Python | mit | 30,766 |
from rez.package_repository import package_repository_manager
from rez.package_resources_ import PackageFamilyResource, PackageResource, \
VariantResource, package_family_schema, package_schema, variant_schema, \
package_release_keys
from rez.package_serialise import dump_package_data
from rez.utils.data_utils ... | mikrosimage/rez | src/rez/packages_.py | Python | lgpl-3.0 | 20,811 |
# -*- coding: utf-8 -*-
"""
sitespy.py
~~~~~~~~~
Created by lhuizhong@gmail.com at 2015-11-21
"""
import requests
from lxml import etree
import re
import sys
from urlparse import urljoin
user_agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36'
... | lhuaizhong/contact_scraper | sitespy.py | Python | gpl-2.0 | 7,055 |
# -*- coding: utf-8 -*-
#
# © 2014, 2015 Ian Eure.
# Author: Ian Eure <ian.eure@gmail.com>
#
"""Yar CLI."""
from itertools import chain
from optparse import OptionParser, OptionGroup
from os.path import basename
import format
import logging
import re
import sys
import serial
from serial.tools import list_ports
from... | ieure/yar | yar/cli.py | Python | bsd-3-clause | 7,469 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.