code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# ===============================================================================
# Copyright 2011 Jake Ross
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses... | USGSDenverPychron/pychron | pychron/hardware/actuators/ngx_gp_actuator.py | Python | apache-2.0 | 2,845 |
class ConsoleCommandFailed(Exception):
pass
class ConvergeFailed(Exception):
pass
| risuoku/wataru | wataru/exceptions.py | Python | mit | 91 |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from liljeson.models import *
class Command(BaseCommand):
help = 'Regenerate global sequence numbers for cards'
def handle(self, *args, **options):
self.stdout.write('Resequencing cards')
catalog_boxes ... | Kungbib/CIPAC | webapp/kortkatalogen/liljeson/management/commands/resequence_liljeson.py | Python | apache-2.0 | 764 |
# Copyright 2013 OpenStack Foundation
# Copyright (C) 2013 Yahoo! 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/licens... | varunarya10/python-glanceclient | tests/v2/test_shell_v2.py | Python | apache-2.0 | 39,153 |
# -*- coding: utf-8 -*-
#
# dcolumn/dcolumns/tests/test_dcolumns_choice.py
#
# WARNING: These unittests can only be run from within the original test
# framework from https://github.com/cnobile2012/dcolumn.
#
from django.core.exceptions import ObjectDoesNotExist
from django.test import TestCase
from dcolumn.... | cnobile2012/dcolumn | dcolumn/dcolumns/tests/test_dcolumns_choice.py | Python | mit | 4,126 |
# Copyright 2011 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 requ... | changsimon/trove | trove/extensions/mysql/service.py | Python | apache-2.0 | 12,809 |
import logging
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.db import models, IntegrityError
from django.dispatch import receiver
from common.utils import get_sentinel_user
log = logging.getLogger("apps")
try:
from django.contrib.contenttypes... | astrobin/astrobin | toggleproperties/models.py | Python | agpl-3.0 | 4,588 |
import pytest
from formulaic.utils.layered_mapping import LayeredMapping
def test_layered_context():
layer1 = {"a": 1, "b": 2, "c": 3}
layer2 = {"a": 2, "d": 4}
layered = LayeredMapping(layer1, layer2)
assert layered["a"] == 1
assert layered["b"] == 2
assert layered["c"] == 3
assert la... | matthewwardrop/formulaic | tests/utils/test_layered_mapping.py | Python | mit | 961 |
from yanntricks import *
def CercleImplicite():
pspict,fig = SinglePicture("CercleImplicite")
x=var('x')
R=2
C=Circle(Point(0,0),R)
P=C.get_point(45)
Pp=C.get_point(-45)
Q=C.get_point(180)
X=P.projection(pspict.axes.single_axeX)
X.put_mark(0.3,180+45,"\( x\)",pspict=pspict)
P.... | LaurentClaessens/mazhe | src_yanntricks/yanntricksCercleImplicite.py | Python | gpl-3.0 | 746 |
def test_nginx_package(Package):
package = Package('nginx')
assert package.is_installed
def test_nginx_working(Command):
response = Command('curl http://127.0.0.1/')
assert 'Automation for the People' in response.stdout
def test_nginx_service(Service, Socket):
service = Service('nginx')
sock... | dbryant4/stelligent | tests/test_default.py | Python | mit | 590 |
print "Saving plot to 'reversionPoint.png'"
figure.savefig('reversionPoint.png')
| Unofficial-Extend-Project-Mirror/openfoam-extend-swak4Foam-dev | Examples/PythonIntegration/findPointPitzDaily/endFindPoint.py | Python | gpl-2.0 | 82 |
# 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... | sebrandon1/nova | nova/db/sqlalchemy/resource_class_cache.py | Python | apache-2.0 | 4,711 |
# Copyright 2020 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... | karllessard/tensorflow | tensorflow/python/tpu/tpu_embedding_v2_utils_test.py | Python | apache-2.0 | 3,638 |
from core import *
from roles import *
from org import *
from hrm import *
from inv import *
from asset import *
from project import *
from smoke import *
from member import *
| mrGeen/eden | modules/tests/__init__.py | Python | mit | 176 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2004-2019 University of Tromsø, Norway
#
# This file is part of Cerebrum.
#
# Cerebrum 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... | unioslo/cerebrum | contrib/no/uit/process_sito.py | Python | gpl-2.0 | 27,213 |
# -*- coding: utf-8 -*-
__author__ = 'amaier1'
from temis import extract_entities
| axelspringer/semaeval | semaeval/engine/temis/__init__.py | Python | mit | 83 |
#!/usr/bin/env python
# Simple debugger
# See instructions around line 36
import sys
import readline
# Our buggy program
def remove_html_markup(s):
tag = False
quote = False
out = ""
for c in s:
if c == '<' and not quote:
tag = True
elif c == '>' and not quote:
... | juangm/Udacity | Software_Debugging/Problem_1/Debugger_Part3.py | Python | unlicense | 2,771 |
"""
byceps.services.user_badge.transfer.models
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2006-2021 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from dataclasses import dataclass
from datetime import datetime
from typing import NewType
from uuid import UUID
from ....typ... | homeworkprod/byceps | byceps/services/user_badge/transfer/models.py | Python | bsd-3-clause | 822 |
# coding: utf8
import requests
import json
import reactor
headers = {'content-type': 'application/json'}
def _request(data):
# print id(reactor), reactor.APPLICATION_ID, id(reactor.APPLICATION_ID)
data['data'].update({'application_id': reactor.APPLICATION_ID})
return requests.post(
reactor.REACTOR_URL,
heade... | Pexeso/reactor-python | reactor/common.py | Python | gpl-2.0 | 631 |
'''
forest data structure
'''
import itertools
import weakref
from p2pool.util import skiplist, variable
class TrackerSkipList(skiplist.SkipList):
def __init__(self, tracker):
skiplist.SkipList.__init__(self)
self.tracker = tracker
self_ref = weakref.ref(self, lambda _: tracker.... | goblin/p2pool | p2pool/util/forest.py | Python | gpl-3.0 | 11,137 |
from django.apps import AppConfig
class LandingConfig(AppConfig):
name = 'landing'
verbose_name = 'Django Landing'
| joshmarlow/crowdpact | crowdpact/apps/landing/app.py | Python | mit | 125 |
# -*- coding: utf-8 -*-
#
# SymPy documentation build configuration file, created by
# sphinx-quickstart.py on Sat Mar 22 19:34:32 2008.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# The contents of this file are pickled, so don't put values in the namespace
# that aren't pickle... | antepsis/anteplahmacun | doc/src/conf.py | Python | bsd-3-clause | 6,371 |
#-------------------------------------------------------------------------------
# Copyright (c) 2011 Anton Golubkov.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Lesser Public License v2.1
# which accompanies this distribution, and is available at
#... | anton-golubkov/Garland | src/test/test_image_convert.py | Python | lgpl-2.1 | 4,530 |
#!/usr/bin/env python
#
# Copyright (C) 2009-2011 Wander Lairson Costa
#
# The following terms apply to all files associated
# with the software unless explicitly disclaimed in individual files.
#
# The authors hereby grant permission to use, copy, modify, distribute,
# and license this software and its documentatio... | StephenForrest/pyUSB | setup.py | Python | bsd-3-clause | 2,062 |
# This file is part of project Sverchok. It's copyrighted by the contributors
# recorded in the version control history of the file, available from
# its original location https://github.com/nortikin/sverchok/commit/master
#
# SPDX-License-Identifier: GPL3
# License-Filename: LICENSE
import numpy as np
import bpy
fro... | DolphinDream/sverchok | nodes/solid/solid_select.py | Python | gpl-3.0 | 22,887 |
"""Support for Acmeda Roller Blind Batteries."""
from __future__ import annotations
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant, callback
from hom... | mezz64/home-assistant | homeassistant/components/acmeda/sensor.py | Python | apache-2.0 | 1,666 |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(name='grossi16',
version='0.0.2',
description='An open-source easy to use classroom clicker system',
author='Gabriel Queiroz',
author_email='gabrieljvnq@gmail.com',
license='MIT',
package_dir={'gorssi16': 'gros... | gjvnq/grossi16 | setup.py | Python | mit | 924 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2009 Edgewall Software
# Copyright (C) 2005-2006 Christian Boos <cboos@edgewall.org>
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http... | jun66j5/trac-ja | trac/wiki/interwiki.py | Python | bsd-3-clause | 6,799 |
# 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/.
import pytest
from pages.mobile.home import Home
class TestMobileLoginLogout:
@pytest.mark.nondestructive
de... | mythmon/kitsune | tests/functional/mobile/test_login_logout.py | Python | bsd-3-clause | 1,070 |
# Copyright 2011 James McCauley
# Copyright 2008 (C) Nicira, Inc.
#
# This file is part of POX.
#
# POX 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) an... | 0xdyu/RouteFlow-Exodus | pox/pox/lib/packet/mpls.py | Python | apache-2.0 | 2,901 |
"""
Django admin page for grades models
"""
from config_models.admin import ConfigurationModelAdmin, KeyedConfigurationModelAdmin
from django.contrib import admin
from lms.djangoapps.grades.config.forms import CoursePersistentGradesAdminForm
from lms.djangoapps.grades.config.models import (
ComputeGradesSetting,... | edx/edx-platform | lms/djangoapps/grades/admin.py | Python | agpl-3.0 | 1,075 |
# -*- coding: utf-8 -*-
"""Top-level package for MountainProject API."""
from .mountainproject import Api
__author__ = """Christopher J. Woodall"""
__email__ = 'chris.j.woodall@gmail.com'
__version__ = '0.3.2'
| cwoodall/mountainproject-py | mountainproject/__init__.py | Python | mit | 213 |
from irc.bot import IRCBot
import irc.events
import irc.loops
from irc.protocol import log
import time
from datetime import timedelta, datetime
import sqlite3
import nplstatus
ip = 'irc.quakenet.org'
port = 6667
nick = 'TSBot'
channel = '#teamspeak'
start_time = time.time()
db = sqlite3.connect('bar.db')
db_cursor ... | ohaz/TeamspeakIRC | ts3npl_bot.py | Python | mit | 6,279 |
# Generated by Django 2.2.7 on 2019-12-29 22:12
import os
from django.db import migrations, models
import localized_fields.fields.text_field
DIR = os.path.dirname(os.path.realpath(__file__))
WELCOME = os.path.join(DIR, 'welcome_message.html')
def create_welcome(apps, schema_editor):
with open(WELCOME, 'r') as f:... | GISAElkartea/tresna-kutxa | tk/chunks/migrations/0001_initial.py | Python | agpl-3.0 | 1,269 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Yannick Vaucher, Guewen Baconnier
# Copyright 2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public L... | rschnapka/account-closing | account_multicurrency_revaluation/account.py | Python | agpl-3.0 | 4,018 |
# encoding: utf-8
# module samba.dcerpc.srvsvc
# from /usr/lib/python2.7/dist-packages/samba/dcerpc/srvsvc.so
# by generator 1.135
""" srvsvc DCE/RPC """
# imports
import dcerpc as __dcerpc
import talloc as __talloc
class Statistics(__talloc.Object):
# no doc
def __init__(self, *args, **kwargs): # real signa... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/samba/dcerpc/srvsvc/Statistics.py | Python | gpl-2.0 | 2,286 |
from django.db import models
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
class ThirdParty(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('expense... | Humch/nxt-simplecost | simplecost/models.py | Python | mit | 1,269 |
"""Tasks for updating this site."""
import re
import os
import json
import redis
from os.path import abspath
from celery import shared_task
from celery import chain
from subprocess import call, Popen, PIPE
from django.conf import settings
from .. import now, apps, get_git_root
def updatelog(sha1, msg=None, clear=Fals... | pashinin-com/pashinin.com | src/core/tasks/update.py | Python | gpl-3.0 | 7,593 |
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
"""
This module implements classes and methods for processing LAMMPS output
files (log and dump).
"""
import glob
import re
from io import StringIO
import numpy as np
import pandas as pd
from monty.io import... | gmatteo/pymatgen | pymatgen/io/lammps/outputs.py | Python | mit | 5,960 |
# 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/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/operations/_namespaces_operations.py | Python | mit | 57,092 |
from func import *
logger = logging.getLogger('neuromodulation')
startbuild = datetime.datetime.now()
nest.ResetKernel()
nest.SetKernelStatus({'overwrite_files': True,
'local_num_threads': 4,
'resolution': 0.1})
generate_neurons(3000)
# parameters of synapse models
nest... | vitaliykomarov/NEUCOGAR | nest/visual/V4/scripts/neuromodulation.py | Python | gpl-2.0 | 15,870 |
"""
QUESTION:
Given a collection of integers that might contain duplicates, nums, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.
The solution set must not contain duplicate subsets.
For example,
If nums = [1,2,2], a solution is:
[
[2],
[1],
[1,2,2],
[2,2],
[1,2],
... | tktrungna/leetcode | Python/subsets-ii.py | Python | mit | 1,124 |
#!/usr/bin/env python3
from __future__ import print_function
import ast
import base64
import logging
from pprint import pprint
from email.mime.text import MIMEText
import httplib2
from fluent import sender, event
from googleapiclient.discovery import Resource
from googleapiclient.discovery import build
from googleapi... | jkcubeta/algernon | src/overwatch/src/overwatch/alg_tasks/gsuite_tasks.py | Python | apache-2.0 | 15,666 |
import sys
import os.path
from pyquery import PyQuery as pq
import time
import common
def getValues(url):
print("getValues()")
url = "https://{0}".format(url)
print("Get URL: " + url)
d = pq(url=url)
list = d(".logostatam")
obj = {}
obj['site_id'] = common.getSiteId(url)
if obj['site_id'] == None:
obj[... | vietdh85/vh-utility | script/stat/vertexasset_com.py | Python | gpl-3.0 | 898 |
"""Backup methods and utilities"""
import couchdb
import logging
import os
import re
import sys
import shutil
import subprocess as sp
import time
from datetime import datetime
from taca.utils.config import CONFIG
from taca.utils import filesystem, misc
logger = logging.getLogger(__name__)
class run_vars(object):
... | kate-v-stepanova/TACA | taca/backup/backup.py | Python | mit | 18,146 |
# Django Rest Framework Imports
from rest_framework import routers
# Local Imports
import messages
import participants
import misc
import visits
# Make Django Rest Framework Router
router = routers.DefaultRouter()
router.register(r'participants', participants.ParticipantViewSet,'participant')
router.register(r'messag... | tperrier/mwachx | contacts/serializers/__init__.py | Python | apache-2.0 | 550 |
import abc
import os
import six
if six.PY3:
import io
file_types = (io.TextIOWrapper,)
else:
import abc
file_types = (abc.types.FileType,)
class Patch(object):
def __init__(self, file, new_suffix=".new", backup_suffix=".old", read_mode="r", write_mode="w", auto_begin=True):
if not isinst... | csernazs/patchwork | lib/patchwork/patch.py | Python | mit | 2,846 |
# Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | BackupTheBerlios/espressopp | src/FixedTripleAngleList.py | Python | gpl-3.0 | 3,321 |
# Copyright 2018 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... | ageron/tensorflow | tensorflow/lite/experimental/examples/lstm/unidirectional_sequence_rnn_test.py | Python | apache-2.0 | 8,216 |
# -*- coding: utf-8 -*-
"""The Viper analysis plugin CLI arguments helper."""
from plaso.analysis import viper
from plaso.cli.helpers import interface
from plaso.cli.helpers import manager
from plaso.lib import errors
class ViperAnalysisArgumentsHelper(interface.ArgumentsHelper):
"""Viper analysis plugin CLI argum... | Onager/plaso | plaso/cli/helpers/viper_analysis.py | Python | apache-2.0 | 4,005 |
#!/usr/bin/env python
'''
Count frequency of each n-gram and save to Pickle file.
The n-gram frequencies are held in an in-memory dict, so this script
can only be used if the vocab is small (e.g. POS tags).
For unigrams, see also: BillionWordImputation/build/Release/count_unigrams
'''
import sys, argparse
from util ... | timpalpant/KaggleBillionWordImputation | scripts/count_ngrams.py | Python | gpl-3.0 | 744 |
# vim:set ts=8 sw=2 sts=2 et:
"""A command line interface for the wavemaker module."""
import argparse
import wavemaker
from wavemaker import signals
def parse_command_line_arguments():
"""Parse command line arguments.
Returns:
An argparse.Namespace object
"""
parser = argparse.ArgumentParser(
... | serban/wavemaker | wavemaker/cli.py | Python | mit | 1,766 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/r-agdex/package.py | Python | lgpl-2.1 | 1,775 |
# Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | cloudera/ibis | ibis/tests/expr/test_analytics.py | Python | apache-2.0 | 3,341 |
#!/usr/bin/env python3
#
# Randomize the (X,Y) position of each X-ray photon events according
# to a Gaussian distribution of given sigma.
#
# References:
# [1] G. Scheellenberger, T.H. Reiprich, L. Lovisari, J. Nevalainen & L. David
# 2015, A&A, 575, A30
#
#
# Aaron LI
# Created: 2016-03-24
# Updated: 2016-03-24
#... | liweitianux/atoolbox | astro/chandra/randomize_events.py | Python | mit | 2,207 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
int_or_none,
js_to_json,
parse_iso8601,
)
class NetzkinoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?netzkino\.de/\#!/(?P<category>[^/]+)/(?P<id>[^/]+)'
... | HyShai/youtube-dl | youtube_dl/extractor/netzkino.py | Python | unlicense | 2,975 |
"""Dependency tracking for checkpointable objects."""
# 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.o... | jendap/tensorflow | tensorflow/python/training/checkpointable/tracking.py | Python | apache-2.0 | 6,960 |
# Network Security Spring 2015 Assignment 1
# Programming problem
# Roberto Amorim - rja2139
import argparse
import socket
import os.path
# Here I take care of the command line arguments
parser = argparse.ArgumentParser(description='Server that holds encrypted data until client requests it.', add_help=True)
parser.a... | rjamorim/netsec-hw1 | server.py | Python | unlicense | 3,585 |
""" Chat service """
from smserver import event
from smserver import messaging
def send_message_token(token, message, source=None):
"""
Send a chat message to the given target
:param str token: target of the message (token of the connection)
:param str message: Message to send
:pa... | ningirsu/stepmania-server | smserver/services/chat.py | Python | mit | 1,301 |
#!/usr/bin/python
import sys, os, urllib, argparse, base64, time, threading, re
from gi.repository import Gtk, WebKit, Notify
webView = None
def refresh(widget, event):
global webView
webView.reload()
window_title = ''
def HandleTitleChanged(webview, title):
global window_title
window_title = title
... | DavidMulder/simple_browse | simple_browse.py | Python | gpl-2.0 | 8,391 |
import json, requests, time, hmac, hashlib, math, socket, os, datetime
from subprocess import Popen, PIPE
import subprocess
import socket
import sys
import time
import random
import base64
import platform
if platform.system() == "Windows":
PYTHON_PATH = "D:\Python27\Python.exe"
else:
PYTHON_PATH = "/usr/bin/python"
... | ScienceWorldCA/domelights | backend/domeplayer/domelights.py | Python | apache-2.0 | 6,424 |
#-*- coding: utf-8 -*-
from __future__ import unicode_literals
import aldryn_apphooks_config.fields
import app_data.fields
import djangocms_text_ckeditor.fields
from cms.models import Page
from cms.utils.i18n import get_language_list
from django.db import models, migrations
def forwards(apps, schema_editor):
Bl... | Venturi/oldcms | env/lib/python2.7/site-packages/djangocms_blog/migrations/0010_auto_20150923_1151.py | Python | apache-2.0 | 6,032 |
import re
import pdb
def requirement_3(input_string):
"""
Passwords must contain at least two different, non-overlapping pairs of
letters, like aa, bb, or zz.
input_string - Input value
@returns - True/False depending on pass ability
"""
return 2 <= len(re.findall('([a-z])\\1', input_strin... | hasteur/advent_of_code | 2015/puzzle11.py | Python | gpl-2.0 | 2,869 |
#!/usr/bin/env python
import json
from tests.unit import AWSMockServiceTestCase
from boto.beanstalk.layer1 import Layer1
# These tests are just checking the basic structure of
# the Elastic Beanstalk code, by picking a few calls
# and verifying we get the expected results with mocked
# responses. The integration t... | palladius/gcloud | packages/gsutil/boto/tests/unit/beanstalk/test_layer1.py | Python | gpl-3.0 | 5,946 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Train ab initio gene predictors.
"""
import os
import os.path as op
import sys
import logging
from jcvi.apps.base import OptionParser, ActionDispatcher, mkdir, sh, need_update
def main():
actions = (
("pasa", "extract pasa training models"),
("s... | tanghaibao/jcvi | jcvi/annotation/train.py | Python | bsd-2-clause | 6,793 |
from google.appengine.ext import vendor
# Add any libraries installed in the "lib" folder.
vendor.add('lib') | nelango/ViralityAnalysis | model/appengine_config.py | Python | mit | 109 |
"""
Unit tests for getting the list of courses and the course outline.
"""
import datetime
import json
import ddt
import lxml
import mock
import pytz
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.utils.translation import ugettext as _
from opaque_keys.edx.locator impo... | fintech-circle/edx-platform | cms/djangoapps/contentstore/views/tests/test_course_index.py | Python | agpl-3.0 | 38,422 |
# Copyright 2014-2016 Maurice van der Pot <griffon26@kfk4ever.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 version 3 of the License, or
# (at your option) any later version.
#
#... | Griffon26/scrumboardtracker | scrumboardtracker/board.py | Python | gpl-3.0 | 3,909 |
# -*- coding: utf-8 -*-
# Copyright (C) 2015-16 Red Hat, Inc.
# This file is part of the Infinity Note Compiler.
#
# The Infinity Note Compiler 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 ... | gbenson/i8c | tests/test_load_slot.py | Python | lgpl-2.1 | 5,461 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2004-2012 Pexego Sistemas Informáticos All Rights Reserved
# $Marta Vázquez Rodríguez$ <marta@pexego.es>
#
# This program is free software: you can redistribute it and/or modify
# it unde... | Comunitea/alimentacion | product_cost_management/product_category.py | Python | agpl-3.0 | 1,268 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansHebrew-Regular'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #null ????
chars.append(0x200C) #uni200C ZERO WIDTH NON-JOINER
chars.append(0x000D) #nonmarkingreturn ????
ch... | davelab6/pyfontaine | fontaine/charsets/noto_chars/notosanshebrew_regular.py | Python | gpl-3.0 | 9,355 |
from .fullscreentoolbox import FullScreenToolBox
from .maintoolbox import MainToolBox
| umlfri/umlfri2 | umlfri2/qtgui/toolbox/__init__.py | Python | gpl-3.0 | 86 |
# -*- encoding: utf-8 -*-
"""
Class for communication with an H2O server.
`H2OConnection` is the main class of this module, and it handles the connection itself:
hc = H2OConnection.open() : open a new connection
hc.request(endpoint, [data|json|filename]) : make a REST API request to the server
hc.info() : ... | spennihana/h2o-3 | h2o-py/h2o/backend/connection.py | Python | apache-2.0 | 41,004 |
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
from proteus import Comm, Profiling
import numpy as np
import numpy.testing as npt
import unittest
import random
from math import cos,sin,cosh,sinh,pi,tanh,log,atan2,asin,acos,radians
import s... | erdc/proteus | proteus/tests/test_bodydynamics.py | Python | mit | 32,368 |
#! /usr/bin/env/python 3.1
#
# Script that runs each bat file in each CWE directory.
# The bat files contain instructions for compiling the test cases
# in that directory.
#
# This script must be run in a visual studio command prompt.
#
import sys
# add parent directory to search path so we can use py_comm... | JianpingZeng/xcc | xcc/test/juliet/run_analysis_example_tool.py | Python | bsd-3-clause | 1,704 |
from befh.market_data import L2Depth, Trade
from befh.exchanges.gateway import ExchangeGateway
from befh.instrument import Instrument
from befh.ws_api_socket import WebSocketApiClient
from befh.util import Logger
import time
import threading
import json
from functools import partial
from datetime import datetime
clas... | Aurora-Team/BitcoinExchangeFH | befh/exchanges/bitfinex.py | Python | apache-2.0 | 11,420 |
# -*- coding: utf-8 -*-
from vilya.libs.store import mc
class MLockMeta(type):
def __getattr__(cls, name):
return MLock(name)
class MLock(object):
__metaclass__ = MLockMeta
def __init__(self, mc_prefix):
self.mc_prefix = mc_prefix
def __call__(self, **kw):
parts = [self.mc... | douban/code | vilya/libs/mlock.py | Python | bsd-3-clause | 1,347 |
# 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 ... | niteoweb/libcloud | libcloud/compute/drivers/vcloud.py | Python | apache-2.0 | 80,770 |
#pylint: disable=W0703,R0904,W0105
'''
Copyright 2014 eBay Software 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 app... | eBay/cronus-agent | agent/agent/lib/agent_thread/cancel_agentthread.py | Python | apache-2.0 | 2,779 |
from scipy.stats import entropy as kl_div
import bet.postProcess.compareP as compP
from helpers import *
"""
The ``helpers.py`` file contains functions that define
sample sets of an arbitrary dimension with probabilities
uniformly distributed in a hypercube of sidelength ``delta``.
The hypercube can be in three locati... | smattis/BET-1 | examples/compare/comparison.py | Python | gpl-3.0 | 1,659 |
import os
from collections import defaultdict
import dill
import numpy as np
import pySDC.helpers.plot_helper as plt_helper
from pySDC.helpers.stats_helper import filter_stats, sort_stats
from pySDC.implementations.collocation_classes.gauss_lobatto import CollGaussLobatto
from pySDC.implementations.controller_classes... | Parallel-in-Time/pySDC | pySDC/projects/Hamiltonian/fput.py | Python | bsd-2-clause | 8,363 |
from __future__ import absolute_import, division, unicode_literals
import string
import gettext
_ = gettext.gettext
EOF = None
E = {
"null-character":
_("Null character in input stream, replaced with U+FFFD."),
"invalid-codepoint":
_("Invalid codepoint in stream."),
"incorrectly-placed-so... | cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/pip/_vendor/html5lib/constants.py | Python | mit | 87,346 |
from pyccel.stdlib.internal.blas import dgemv
from numpy import zeros
n = 4
m = 5
a = zeros((n,m), 'double')
x = zeros(m, 'double')
y = zeros(n, 'double')
# ...
a[0,0] = 1.0
a[1,0] = 6.0
a[2,0] = 11.0
a[3,0] = 16.0
a[0,1] = 2.0
a[1,1] = 7.0
a[2,1] = 12.0
a[3,1] = 17.0
a[0,2] = 3.0
a[1,2] = 8.0
a[2,2] = 13.0
a[3,2]... | ratnania/pyccel | tests/internal/scripts/blas/ex2.py | Python | mit | 611 |
from flask import Blueprint, render_template, request
from bson import json_util
from app import mongo
mod_main = Blueprint('main', __name__)
@mod_main.route('/', methods=['GET','POST'])
def index():
''' Renders the App index page.
:return:
'''
db = mongo.db.arkep
if request.method == 'GET':
re... | lorinamorina/techstitution- | app/mod_main/views.py | Python | cc0-1.0 | 859 |
#! /usr/bin/python3
#-*- coding: UTF-8 -*-
import re
import unidecode
from goose3 import Goose
GRAB_FIRST_TWO_SENTENCES_RE = '[.!?][\s]{1,2}(?=[A-Z])'
REMOVE_SPECIAL_CHARACTERS_RE = '[^A-Za-z0-9]+'
REMOVE_SPECIAL_CHARACTERS_KEEP_DASHES_RE = '[^A-Za-z0-9-]+'
CLOSE_PAREN = ")"
COLON = ":"
COMMA = ","
DASH = "-"
EMP... | gabridome/gabridome.github.io | scripts/spreadsheet_to_resource_mds/util.py | Python | apache-2.0 | 3,226 |
# -*- coding: utf-8 -*-
#/#############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free sof... | jmesteve/medical | openerp/oemedical/oemedical/oemedical_pathology_category/oemedical_pathology_category.py | Python | agpl-3.0 | 1,851 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'ansiapp.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
)
| muranga/laughing-octo-nemesis | src/ansiapp/urls.py | Python | unlicense | 298 |
from django.db import models
class Dummy(models.Model):
parent = models.ForeignKey('self', null=True, blank=True)
country = models.ForeignKey('cities_light.country')
region = models.ForeignKey('cities_light.region')
def __unicode__(self):
return u'%s %s' % (self.country, self.region) | spookylukey/django-autocomplete-light | test_project/dependant_autocomplete/models.py | Python | mit | 311 |
import piface.pfio as piface
piface.init()
piface.digital_write(1, 0)
| SeanDS/slow-cooker | test.py | Python | gpl-2.0 | 72 |
from imports import QVBoxLayout, QPlainTextEdit, QDialog, QHBoxLayout, QLineEdit, QLabel, QPushButton
class NotesDialog(QDialog):
def __init__(self):
super().__init__()
layout = QVBoxLayout()
self.notepad = QPlainTextEdit()
layout.addWidget(self.notepad)
self.setLayout(lay... | PhonologicalCorpusTools/SLP-Annotator | slpa/gui/notes.py | Python | gpl-3.0 | 1,584 |
"""
Patterns for legalizing the `base` instruction set.
The base Cretonne instruction set is 'fat', and many instructions don't have
legal representations in a given target ISA. This module defines legalization
patterns that describe how base instructions can be transformed to other base
instructions that are legal.
"... | sunfishcode/cretonne | lib/cretonne/meta/base/legalize.py | Python | apache-2.0 | 8,302 |
from __future__ import print_function, absolute_import, division
import math
from numpy import *
class Point2D:
def __init__(self, node_list):
if(len(node_list) != 1):
raise Exception("wrong number of nodes! should be 1!!")
self.nodes = node_list
for node in self.nodes:
... | RiccardoRossi/pyKratos | pyKratos/point2d.py | Python | bsd-2-clause | 1,473 |
#!/usr/bin/env python
"""
Author : Jaganadh Gopinadhan <jaganadhg@gmail.com>
Copywright (C) : Jaganadh Gopinadhan
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.... | gsi-upm/senpy-plugins-community | sentiment-basic/sentiwn.py | Python | apache-2.0 | 2,250 |
from abc import ABCMeta, abstractmethod
class NotificationSource():
"""
Abstract class for all notification sources.
"""
__metaclass__ = ABCMeta
@abstractmethod
def poll(self):
"""
Used to get a set of changes between data retrieved in this call and the last.
"""
... | DanNixon/Sakuya | pc_client/sakuyaclient/NotificationSource.py | Python | apache-2.0 | 562 |
import numpy as np
from PyQt5.QtGui import QPainterPath, QPen
from PyQt5.QtWidgets import QGraphicsPathItem
from urh import settings
from urh.cythonext import path_creator
from urh.ui.painting.GridScene import GridScene
from urh.ui.painting.SceneManager import SceneManager
class FFTSceneManager(SceneManager):
de... | jopohl/urh | src/urh/ui/painting/FFTSceneManager.py | Python | gpl-3.0 | 1,960 |
# -*- coding: utf-8 -*-
# Copyright 2016 Daniel Campos - Avanzosc S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import preventive_operation
from . import preventive_master
from . import preventive_machine_operation
from . import mrp_repair
from . import machinery
| odoomrp/odoomrp-wip | machine_manager_preventive/models/__init__.py | Python | agpl-3.0 | 295 |
from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | shravya-ks/ECN-ns3 | src/nix-vector-routing/bindings/modulegen__gcc_LP64.py | Python | gpl-2.0 | 390,572 |
import csv
import os
from django.core.management.base import NoArgsCommand
from django.contrib.gis.geos import Point
from ... import models
class Command(NoArgsCommand):
def handle_noargs(self, *args, **kwargs):
with open(os.environ['DATA_FILE']) as f:
reader = csv.reader(f)
lege... | texastribune/tt_hospitals | tt_hospitals/management/commands/tt_hospitals_import.py | Python | apache-2.0 | 1,137 |
from macropy.core.macros import *
from macropy.core.quotes import macros, ast, u
from ast import *
def classes_transform(node, gen_sym):
@Walker
def transform(tree, **k2):
if isinstance(tree, ClassDef):
self_name = gen_sym()
attr_name = gen_sym()
value_name = gen_s... | jeanqasaur/jeeves | sourcetrans/classes.py | Python | mit | 1,471 |
from collections import namedtuple
import pytest
from dockci.models.auth import OAuthToken
from dockci.models.project import Project
class TestRepoFs(object):
""" Test utilization of the ``Project.repo_fs`` field """
@pytest.mark.parametrize(
'repo,github_repo_id,gitlab_repo_id,exp_display,exp_comma... | sprucedev/DockCI | tests/models/test_project_model.py | Python | isc | 2,383 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.