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 |
|---|---|---|---|---|---|
#!/usr/bin/env python
# Copyright 2015 Yelp 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 ag... | Yelp/service_configuration_lib | tests/service_configuration_lib_test.py | Python | apache-2.0 | 17,123 |
# Programar em Python #05 - Operadores de Atribuição
a = b = c = d = e = f = 2;
a += 3;
b -= 2;
c *= 2;
d /= 2;
e %= 2;
f **= 2;
print('Valor de a:', a);
print('Valor de b:', b);
print('Valor de c:', c);
print('Valor de d:', d);
print('Valor de e:', e);
print('Valor de f:', f); | caffeinealgorithm/youtube-videos-source-code | Programar em Python/05-Operadores-de-Atribuicao.py | Python | mit | 283 |
"""Utility file for building Qt ui files."""
import sys
import os
from hashlib import md5
import json
from glob import glob
if 'win' in sys.platform:
cmd = 'pyuic4.bat'
else:
cmd = 'pyuic4'
hash_file = 'hashes.json'
try:
hashes = json.load(open(hash_file, 'r'))
except:
hashes = {}
for fname in glob(... | mivade/qCamera | viewer/build_uis.py | Python | bsd-2-clause | 735 |
'''
Created on Jan 8, 2014
@author: xapharius
'''
from abc import ABCMeta, abstractmethod
class AbstractDataProcessor(object):
'''
Abstract class for a Dataprocessor.
Specifies which methods a Dataprocessor of a Data Class should implement.
The Dataprocessor is responsible of processing the data rece... | xapharius/mrEnsemble | Engine/src/datahandler/AbstractDataProcessor.py | Python | mit | 913 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | hryamzik/ansible | lib/ansible/modules/network/aci/aci_filter.py | Python | gpl-3.0 | 6,994 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Invenio user management and authentication."""
from __future__ import absolute_im... | inspirehep/invenio-accounts | invenio_accounts/ext.py | Python | mit | 10,664 |
""" __
/ _) <( ** basic_utils *** )
.-^^^-/ /
__/ /
<__.|_|-|_|
"""
from .core import * # noqa
from .date_helpers import * # noqa
from .dict_helpers import * # noqa
from .primitives import * # noqa
from .seq_helpers import * # noqa
__version__ = '1.6.0'
| Jackevansevo/basic-utils | basic_utils/__init__.py | Python | mit | 310 |
from django.conf.urls import (
patterns, url, include
)
from django.core.urlresolvers import (reverse_lazy)
from django.views.generic.base import RedirectView
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
from .views import (
PackageUpdate,
ServerCreate,
# ... | jakobadam/origo-desktops | rds/urls.py | Python | gpl-3.0 | 4,635 |
import os, sys, projects
source_suffix = '.txt'
master_doc = 'contents'
project = 'django-projects'
copyright = 'Kyle Fuller and Lithum contributors'
version = projects.__version__
release = version
today_fmt = '%B %d, %Y'
add_function_parentheses = True
add_module_names = False | kylef/django-projects | docs/conf.py | Python | bsd-2-clause | 280 |
# coding: utf-8
from application.common import BaseHandler
from ..templates import environment
class UserSettings(BaseHandler):
def get(self):
template = environment.get_template('user_settings.htm')
self.response.write(template.render())
| paulsnar/edaemon | application/admin/routes/user_settings.py | Python | bsd-3-clause | 262 |
# -*- 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/iottid/v20190411/models.py | Python | mit | 15,254 |
def update_soa(record):
"""This function will attempt to find an SOA associated with an object and
if it finds an SOA will incremente the serial.
"""
if record and record.domain and record.domain.soa:
record.domain.soa.serial += 1
record.domain.soa.dirty = True
record.domain.soa.... | akeym/cyder | cyder/cydns/soa/utils.py | Python | bsd-3-clause | 327 |
#!/usr/bin/python
# This file is part of Ansible
#
# 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... | tareqalayan/ansible | lib/ansible/modules/cloud/amazon/elb_application_lb.py | Python | gpl-3.0 | 21,179 |
#!/usr/bin/python
import argparse
import sys
import logging
import subprocess
from pdftableextract.core import process_page, output
import pdftableextract.core
#-----------------------------------------------------------------------
def procargs() :
p = argparse.ArgumentParser( description="Finds tables in a PDF p... | PiWare/kicad_library | script/extract-table.py | Python | gpl-2.0 | 5,681 |
from os.path import abspath, dirname, join
class EvidenceCode:
def __init__(self, id=None):
self.id = id
self.name = None
self.definition = None
self.synonyms = set()
self.parents = set()
self.children = set()
def __str__(self):
return "Eco: {id}\n" \
... | JuBra/GEMEditor | GEMEditor/evidence/eco_parser.py | Python | gpl-3.0 | 2,322 |
# -*- coding: utf-8 -*-
###
# (C) Copyright (2012-2017) 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... | HewlettPackard/python-hpOneView | tests/unit/resources/storage/test_drive_enclosures.py | Python | mit | 4,218 |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
from flexget.utils import json
from flexget.api import empty_response
from flexget.plugins.api.movie_list import ObjectsContainer as OC
class TestMovieListAPI(object):
co... | oxc/Flexget | flexget/tests/test_movie_list_api.py | Python | mit | 7,622 |
"""
Shared utilities
"""
import numpy as np
__all__ = ['batchify', 'holdout', 'preprocess', 'inner']
def holdout(batches, frac=0.1):
"""
Take a list and split it into train and test sets
"""
batches = list(batches)
num_holdout = int(np.round(len(batches) * frac))
test = batches[:num_holdo... | nirum/limo | limo/utils.py | Python | mit | 2,304 |
from setuptools import setup
# Dynamically calculate the version based on pyperclip.VERSION.
version = __import__('pyperclip').__version__
setup(
name='pyperclip',
version=version,
url='https://github.com/asweigart/pyperclip',
author='Al Sweigart',
author_email='al@inventwithpython.com',
de... | WarriorIng64/NCBI-FASTA-Grabber | pyperclip/setup.py | Python | gpl-3.0 | 1,212 |
# Natural Language Toolkit: Word Finder
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Steven Bird <sb@csse.unimelb.edu.au>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
# Simplified from PHP version by Robert Klein <brathna@gmail.com>
# http://fswordfinder.sourceforge.net/
from __futur... | abad623/verbalucce | verbalucce/nltk/misc/wordfinder.py | Python | apache-2.0 | 4,113 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-06-12 15:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('bb', '0016_auto_20160612_1750'),
]
... | yemmitt/bb_website | bb_django/mysite/bb/migrations/0017_auto_20160612_1752.py | Python | mit | 562 |
#!/usr/bin/env python3
'''
Created on 1-June-2016
@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.CardPayments.BillingDetails import BillingDetails
from PythonNetBanxSDK.CustomerVault.BACSBankAccount import BACSBankAccount
from PythonNetBanxSDK.CustomerVault.EFTBankAccount import EFTBankAccount
from PythonNetBanxSDK... | OptimalPayments/Python_SDK | src/sample_application/DirectDebitEFTStandaloneCreditpurchase.py | Python | mit | 1,785 |
# 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 ... | AutorestCI/azure-sdk-for-python | azure-mgmt-datafactory/azure/mgmt/datafactory/models/self_hosted_integration_runtime_node.py | Python | mit | 6,083 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 29 21:55:06 2018
@author: leandrodemarcovedelago
"""
import numpy as np
import numpy.matlib as npmatlib
import math
import Utils
class Acor:
def __init__(self, alg_variant, uses_log):
"""
* alg_variant should be one of the ... | leandrodemarcovedelago/thesis-aco | informe/ACOR.py | Python | gpl-3.0 | 7,338 |
#-*- coding:utf-8 -*-
import sys
import struct
import array, io, fcntl
import smbus
from gevent import sleep
from gsensors import AutoUpdateValue, DataSource
class I2CRaw(object):
def __init__(self, device, bus):
self.fr = io.open("/dev/i2c-"+str(bus), "rb", buffering=0)
self.fw = io.open("/dev/... | enavarro222/gsensors | gsensors/i2c_devices.py | Python | agpl-3.0 | 6,065 |
import keyedcache
import logging
log = logging.getLogger(__name__)
class CachedObjectMixin(object):
"""Provides basic object keyedcache for any objects using this as a mixin.
The class name of the object should be unambiguous.
"""
def cache_delete(self, *args, **kwargs):
key = self.cache_key... | aronysidoro/django-livesettings | live/keyedcache/models.py | Python | bsd-3-clause | 2,736 |
#!/usr/bin/env python
# Plot blue-red-purple election results for the 2016 presidential election.
# Expects the following data files:
# data/state-shapes/st99_d00* from mpl basemap examples directory
# (/usr/share/doc/python-mpltoolkits.basemap-doc/examples/ on debian
# or https://github.com/matplotlib/basemap/b... | akkana/scripts | mapping/election2016/bluered-opendatasoft.py | Python | gpl-2.0 | 5,561 |
import numpy as np
import pandas as pd
from lsst.sims.catUtils.supernovae import SNObject
from opsimsummary import summarize_opsim as oss
from astropy.table import Table
__all__ = ['SNObs']
class SNObs(oss.SummaryOpsim):
def __init__(self, t0, fieldID=None, raCol=None, decCol=None, ra=0.,
dec=0.,... | rbiswas4/Cadence | gedankenLSST/sninLSST.py | Python | mit | 4,355 |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | Multiscale-Genomics/mg-process-fastq | tool/trimgalore.py | Python | apache-2.0 | 20,679 |
from io import BytesIO
import random
#
import pytest
from pyhdb.protocol import types
# ########################## Test value unpacking #####################################
@pytest.mark.parametrize("given,expected", [
(b"\xFF", None),
(b"\x2d\x50\x4f\x49\x4e\x54\x20\x28\x31\x2e\x30\x30\x30\x30\x30\x30\x30" +... | SAP/PyHDB | tests/types/test_geometry.py | Python | apache-2.0 | 12,166 |
import mimetypes
import os.path
from django.conf import settings
from django.core import mail
from django.core.files.storage import default_storage as storage
from django.core.mail import EmailMessage
from django.template import Context as TemplateContext
from django.utils import translation
import mock
from olympia... | andymckay/addons-server | src/olympia/amo/tests/test_send_mail.py | Python | bsd-3-clause | 11,889 |
# ==============================================================================
# Copyright [2013] [Kevin Carter]
#
# 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/l... | cloudnull/transporter | imager/imaging.py | Python | apache-2.0 | 5,608 |
scalapack = True
compiler = 'gcc43'
libraries = [
'gfortran',
'scalapack', 'mpiblacsF77init', 'mpiblacs', 'scalapack',
'xc',
'goto2', 'acml', 'acml_mv',
# must not link to mpi explicitly: -export-dynamic must be used instead
]
library_dirs =[
'/opt/openmpi/1.3.3-1.el5.fys.gfortran43.4.3.2/li... | robwarm/gpaw-symm | doc/install/Linux/Niflheim/el5-opteron-gcc43-goto2-1.13-acml-4.4.0-TAU.py | Python | gpl-3.0 | 1,924 |
import vtk
from vtk.util.vtkAlgorithm import VTKPythonAlgorithmBase
from vtk.util import numpy_support
from timeit import default_timer as timer
import logging
class FilterClassifier(VTKPythonAlgorithmBase):
"""
vtkAlgorithm with 2 inputs of vtkImageData and an output of vtkImageData
Input: Depth images
... | lucasplus/MABDI | mabdi/FilterClassifier.py | Python | bsd-3-clause | 4,012 |
#!/usr/bin/python
# This file is part of Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'... | simonwydooghe/ansible | lib/ansible/modules/cloud/amazon/elasticache_parameter_group.py | Python | gpl-3.0 | 14,264 |
# coding: utf-8
"""
Onshape REST API
The Onshape REST API consumed by all clients. # noqa: E501
The version of the OpenAPI document: 1.113
Contact: api-support@onshape.zendesk.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
im... | onshape-public/onshape-clients | python/onshape_client/oas/models/bt_document_merge_info.py | Python | mit | 5,168 |
# coding=utf-8
from setuptools import setup, find_packages
setup(
name='geventhttpclient-oauthlib',
version='0.1a',
install_requires=[
'geventhttpclient>=1.0a',
'oauthlib>=0.3.0'],
url='https://github.com/jneight/geventhttpclient-oauthlib',
packages=find_packages(),
include_pac... | jneight/geventhttpclient-oauthlib | setup.py | Python | bsd-3-clause | 799 |
# # -*- coding: utf-8 -*-
#
# # ##########################################################################
# ## Python code generated with wxFormBuilder (version Feb 26 2014)
# ## http://www.wxformbuilder.org/
# ##
# ## PLEASE DO "NOT" EDIT THIS FILE!
# ##################################################################... | ODM2/ODMToolsPython | odmtools/view/clsIntro.py | Python | bsd-3-clause | 9,250 |
import os
import sys
from setuptools import setup
from io import open
from zappa import __version__
with open('README.md') as readme_file:
long_description = readme_file.read()
with open(os.path.join(os.path.dirname(__file__), 'requirements.txt')) as f:
if sys.version_info[0] == 2:
required = f.read()... | pjz/Zappa | setup.py | Python | mit | 2,143 |
import module
# unique to module
from urlparse import urlparse
import re
class Module(module.Module):
def __init__(self, params):
module.Module.__init__(self, params, query='SELECT DISTINCT domain FROM domains WHERE domain IS NOT NULL ORDER BY domain')
self.register_option('limit', 0, True, 'limit... | digistam/recon-ng | modules/recon/domains-hosts/bing_domain_api.py | Python | gpl-3.0 | 2,500 |
#!/usr/bin/python
import sys
entrez2symbol = dict()
f = open(sys.argv[1])
f.readline()
for i in f:
fields = i.rstrip().split()
entrez2symbol[fields[0]] = fields[1]
f.close()
f = open(sys.argv[2]) # entrez 2 kegg
f.readline()
for i in f:
fields = i.rstrip().split()
if fields[1] in entrez2symbol:
print entrez2sy... | TravisCG/SI_scripts | sym2kegg.py | Python | gpl-3.0 | 355 |
import logging
import subprocess
LOGGER = logging.getLogger(__name__)
def execute(command):
LOGGER.debug("Executing %s", ' '.join(command))
proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = proc.communicate(input=None)
if proc.returncode != 0:
ra... | EliRibble/mothermayi | mothermayi/process.py | Python | mit | 511 |
# -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | stroykova/luigi | test/notifications_test.py | Python | apache-2.0 | 15,542 |
# Uses python3
import sys
def binary_search(a, x):
left, right = 0, len(a)
# write your code here
while left + 1 < right:
mid = left + (right - left)/2
if x == mid:
return mid
if x > mid:
left = mid
else:
right = mid
if left == x:
... | euccas/CodingPuzzles-Python | course/ucsd_algorithm_toolbox/divide_and_conquer_starter_files/binary_search/binary_search.py | Python | mit | 815 |
import sys
from services.spawn import MobileTemplate
from services.spawn import WeaponTemplate
from resources.datatables import WeaponType
from resources.datatables import Difficulty
from resources.datatables import Options
from java.util import Vector
def addTemplate(core):
mobileTemplate = MobileTemplate()
mobil... | agry/NGECore2 | scripts/mobiles/dantooine/frenzied_graul.py | Python | lgpl-3.0 | 1,675 |
from __future__ import with_statement
import os, sys, re, pynav, time, datetime, pytz ,pyaeso, spharm, matplotlib, xml_marshaller, xmlbuilder
import numpy as np
from pynav import Pynav
from xml_marshaller import xml_marshaller
from xml_marshaller.xml_marshaller import *
from xmlbuilder import XMLBuilder
from PyNOAAGe... | priendeau/PyNOAAGeoMagIndiceHandler | PyNOAAGeoMagIndiceHandler/NOAADataCenterCollection.py | Python | bsd-3-clause | 5,441 |
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def sumNumbers(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(root, num, s):
if root is None:
... | ChuanleiGuo/AlgorithmsPlayground | LeetCodeSolutions/python/129_Sum_Root_to_Leaf_Numbers.py | Python | mit | 648 |
# -*- coding: utf-8 -*-
"""
test.t_controlbeast.t_ssh.test_CbSSHApi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: Copyright 2013 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
"""
from unittest import TestCase
from controlbeast.ssh.api import CbSSHLib
class TestC... | daemotron/controlbeast | test/t_controlbeast/t_ssh/test_CbSSHApi.py | Python | isc | 1,963 |
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ht... | naototty/vagrant-lxc-ironic | ironic/common/glance_service/service_utils.py | Python | apache-2.0 | 8,408 |
from django import template
from django.conf import settings
register = template.Library()
@register.assignment_tag
def get_language_byindex(index):
lang = ('', '')
try:
lang = settings.LANGUAGES[index]
except KeyError:
pass
except IndexError:
pass
return lang
| kimus/django-blocks | blocks/templatetags/blocks_admin.py | Python | mit | 275 |
import itertools
import math
import unittest
from collections import Counter, OrderedDict
import pytest
from boofuzz import *
@pytest.fixture(autouse=True)
def clear_requests():
yield
blocks.REQUESTS = {}
blocks.CURRENT = None
class TestString(unittest.TestCase):
def _given_string(self):
s... | jtpereyda/boofuzz | unit_tests/test_string.py | Python | gpl-2.0 | 8,751 |
__version__ = '5.6.9'
| repotvsupertuga/tvsupertuga.repository | script.premium.TVsupertuga/resources/lib/external/jsbeautifier/__version__.py | Python | gpl-2.0 | 22 |
# Кириллов Алексей, ИУ7-22
# Защита (текстовые БД)
base = open('ABC.txt','r')
s = base.read(1)
long = ''
predl = ''
n = -1
tek = 0
prev = True
thispred = False
glasn = ['a','A','e','E','y','Y','u','U','i','I','o','O']
while s != '':
if s == '\n':
s = base.read(1)
continue
if s... | aspadm/labworks | module1-2/protect_base.py | Python | mit | 854 |
"""
Test that old keys deserialize just by importing opaque keys
"""
from unittest import TestCase
from opaque_keys.edx.keys import CourseKey, LearningContextKey, UsageKey
class TestDefault(TestCase):
"""
Check that clients which merely import CourseKey can deserialize the expected keys, etc
"""
def t... | edx/opaque-keys | opaque_keys/edx/tests/test_default_deprecated.py | Python | agpl-3.0 | 1,382 |
from __future__ import absolute_import, unicode_literals
import logging
from cinnabar.cmd.util import CLI
from cinnabar.git import (
Git,
GitProcess,
InvalidConfig,
)
from cinnabar.githg import GitHgStore
from cinnabar.helper import GitHgHelper
from cinnabar.hg.bundle import (
create_bundle,
PushSto... | glandium/git-cinnabar | cinnabar/cmd/bundle.py | Python | gpl-2.0 | 3,371 |
#!/usr/bin/env python
#
# spyne - Copyright (C) Spyne contributors.
#
# 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 ve... | deevarvar/myLab | baidu_code/soap_mockserver/spyne/test/test_sqlalchemy.py | Python | mit | 25,512 |
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------------
# Name: sfp_intfiles
# Purpose: From Spidering and from searching search engines, identifies
# files of potential interest.
#
# Author: Steve Micallef <steve@binarypool.com>
#... | Reality9/spiderfoot | modules/sfp_intfiles.py | Python | gpl-2.0 | 6,481 |
# -*- coding: utf-8 -*-
from typing import Text
from six.moves import urllib
from zerver.lib.test_classes import WebhookTestCase
class SolanoHookTests(WebhookTestCase):
STREAM_NAME = 'solano labs'
URL_TEMPLATE = u"/api/v1/external/solano?api_key={api_key}"
FIXTURE_DIR_NAME = 'solano'
def test_solano_m... | sonali0901/zulip | zerver/webhooks/solano/tests.py | Python | apache-2.0 | 2,905 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import operator
from django.conf import settings
from django.utils import translation
from django.utils.translation import ugettext as _
from six.moves import urllib, zip_longest, zip, range
from typing import Any, List, Dict, Optional, Text
import os
im... | sonali0901/zulip | zerver/lib/i18n.py | Python | apache-2.0 | 2,622 |
# $Id: fi.py 6460 2010-10-29 22:18:44Z milde $
# Author: Asko Soukka <asko.soukka@iki.fi>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two files must be
# translat... | ajaxsys/dict-admin | docutils/parsers/rst/languages/fi.py | Python | bsd-3-clause | 3,642 |
#!/usr/bin/env python3
'''Test for zone semantic checks during zone commit.'''
import os
from dnstest.libknot import libknot
from dnstest.test import Test
from dnstest.utils import *
t = Test()
knot = t.server("knot")
ctl = libknot.control.KnotCtl()
ZONE_NAME = "testzone."
t.start()
ctl.connect(os.path.join(kn... | CZ-NIC/knot | tests-extra/tests/ctl/zone_semchecks/test.py | Python | gpl-3.0 | 3,480 |
import gym
from gym.envs.classic_control import PendulumEnv, CartPoleEnv
import numpy as np
# MuJoCo may not be installed.
HalfCheetahEnv = HopperEnv = None
try:
from gym.envs.mujoco import HalfCheetahEnv, HopperEnv
except (ImportError, gym.error.DependencyNotInstalled):
pass
class CartPoleWrapper(CartPoleEn... | richardliaw/ray | rllib/examples/env/mbmpo_env.py | Python | apache-2.0 | 3,383 |
#! /usr/bin/python
#from check_dependencies import CheckDependencies
#def test_default():
# CheckDependencies(None)
#def test_hydrotrend():
# CheckDependencies("hydrotrend")
#def test_cem():
# CheckDependencies("cem")
#def test_child():
# CheckDependencies("child")
#def test_child():
# CheckDepende... | csdms/packagebuilder | packager/core/test/test_check_dependencies.py | Python | mit | 337 |
"""
sentry.models.project
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
import logging
import warnings
from django.conf import settings
from django.core.urlresol... | imankulov/sentry | src/sentry/models/project.py | Python | bsd-3-clause | 7,758 |
from bs4 import BeautifulSoup
import httplib, codecs, datetime
import cPickle as pickle
import time
def stan_tag(criteria, server):
tagged = []
file_count = 47
for ix, c in enumerate(criteria[2250000:]):
# initialize list of sentences
sents = []
try:
# send text to serv... | jasonost/clinicaltrials | trial_criteria/StanfordPOStagging.py | Python | mit | 1,663 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.core.urlresolvers import reverse
from django.test import TestCase
from .user_agents import USER_AGENTS
from mob.middleware im... | caffeinehit/django-mob | tests/app/tests.py | Python | mit | 3,198 |
import _plotly_utils.basevalidators
class MaxpointsValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(
self, plotly_name="maxpoints", parent_name="choropleth.stream", **kwargs
):
super(MaxpointsValidator, self).__init__(
plotly_name=plotly_name,
paren... | plotly/plotly.py | packages/python/plotly/plotly/validators/choropleth/stream/_maxpoints.py | Python | mit | 506 |
from django.contrib import admin
from bcmon.models import *
from lib.admin.actions import export_as_csv_action
#class ChannelInline(admin.TabularInline):
# model = Channel
class PlayoutAdmin(admin.ModelAdmin):
list_display = ('title', 'time_start', 'time_end', 'channel', 'status', 'score', 'dummy_... | hzlf/openbroadcast | website/apps/bcmon/admin.py | Python | gpl-3.0 | 965 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-11 16:41
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('restaurant', '0008_auto_20170205_0020'),
('restaurant', '0011_auto_20170207_1430'),
]
... | midhun3112/restaurant_locator | Restaurant_Finder_App/restaurant_finder_app/restaurant_finder_app/restaurant/migrations/0012_merge_20170211_1641.py | Python | apache-2.0 | 344 |
from Database.Controllers.Campus import Campus
class Departamento(object):
def __init__(self,dados=None):
if dados is not None:
self.id = dados ['id']
self.nome = dados ['nome']
self.codigo = dados ['codigo']
self.sigla = dados ['sigla']
self.id_campus = dados ['id_campus']
def getId(self):
r... | AEDA-Solutions/matweb | backend/Database/Models/Departamento.py | Python | mit | 830 |
"""
DWF Python Example 1
Author: Tobias Badertscher based on work by Digilent, Inc.
Revision: 12/31/2013
Requires:
Python 2.7
"""
import sys
sys.path.append('..')
from pydwf import dwf
def Device_Enumeration():
#print DWF version
version = dwf.GetVersion()
... | tobbad/pydwf | digilent_samples/Device_Enumeration.py | Python | lgpl-3.0 | 1,233 |
import os
import json
import re
from BeautifulSoup import BeautifulSoup
from psrd.rules import write_rules
from psrd.files import char_replace
from psrd.universal import parse_universal
from psrd.sections import ability_pass, is_anonymous_section, has_subsections, entity_pass, quote_pass
def parse_attr_line(text):
at... | devonjones/PSRD-Parser | src/psrd/skills.py | Python | gpl-3.0 | 1,523 |
"""INSTEON Device Type Dimmable Lighting Control Module."""
from insteonplm.devices import Device
from insteonplm.states.dimmable import (
DimmableSwitch,
DimmableSwitch_Fan,
DimmableKeypadA,
)
from insteonplm.states.onOff import OnOffKeypad, OnOffKeypadLed
class DimmableLightingControl(Device):
"""Di... | nugget/python-insteonplm | insteonplm/devices/dimmableLightingControl.py | Python | mit | 5,358 |
# 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; specifically version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without eve... | PandaWei/avocado | avocado/core/test.py | Python | gpl-2.0 | 31,962 |
# coding=utf-8
from Framework.Controller import Controller
from Database.Controllers.Disciplina import Disciplina as BDDisciplina
from Models.Disciplina.RespostaListar import RespostaListar
from Models.Disciplina.RespostaCadastrar import RespostaCadastrar
from Models.Disciplina.RespostaEditar import RespostaEditar
from... | AEDA-Solutions/matweb | backend/Controllers/Disciplina.py | Python | mit | 2,080 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
import unittest
import mock
import lxml.html
from nikola.post import get_meta
from nikola.utils import demote_headers, TranslatableSetting
class dummy(object):
pass
class GetMetaTest(unittest.TestCase):
def test_getting_... | JohnTroony/nikola | tests/test_utils.py | Python | mit | 10,555 |
from functools import wraps
import bottle
def requires_session(fun):
@wraps(fun)
def wrapper(*args, **kwargs):
sesh = bottle.request.environ.get('beaker.session')
kwargs['sesh'] = sesh
return fun(*args, **kwargs)
return wrapper
def requires_login(fun):
@wraps(fun)
def wr... | tipsqueal/PuPPyREST | puppy/helpers.py | Python | mit | 935 |
'''
Created on 2013-10-8
@author: xsank
'''
import sys
from structure import transaction
def finish(msg,exitCode):
if exitCode!=0:
print msg
sys.exit(exitCode)
if __name__=='__main__':
repos=sys.argv[1]
txn=sys.argv[2]
trans=transaction.Transaction(repos,txn)
msg,exitCode=trans... | xsank/SVNchecker | main.py | Python | mit | 374 |
# $Id: tfont.py,v 1.2 2003/09/14 04:31:39 riq Exp $
#
# Tenes Empanadas Graciela
# Copyright 2000,2003 Ricardo Quesada (riq@coresecurity.com)
#
import pygame
if not pygame.font.get_init():
pygame.font.init()
TFont = {
'helvetica 8' : pygame.font.SysFont('helvetica',8),
'helvetica 10' : pygame.font... | JeroenDeDauw/teg | python/client/gui/tfont.py | Python | gpl-3.0 | 655 |
from bibliopixel.animation.matrix import Matrix
from bibliopixel.colors import COLORS
from bibliopixel.layout import font
class ScrollText(Matrix):
COLOR_DEFAULTS = (('bgcolor', COLORS.Off), ('color', COLORS.White))
def __init__(self, layout, text='ScrollText', xPos=0, yPos=0,
font_name=font... | ManiacalLabs/BiblioPixelAnimations | BiblioPixelAnimations/matrix/Text.py | Python | mit | 2,583 |
import unittest
from hamcrest import assert_that, equal_to
from mock import MagicMock, call
from mac_os_scripts.add_computer_to_group import ComputerToGroupAdder
from mac_os_scripts_tests.test_common import _NO_OUTPUT
_TMP_REGISTER_LDIF = """dn: CN=Developers,OU=Users,OU=Groups,OU=Some Place,DC=some,DC=domain,DC=com... | initialed85/mac_os_scripts | mac_os_scripts_tests/add_computer_to_group_test.py | Python | mit | 3,008 |
"""
Renderers are used to serialize a response into specific media types.
They give us a generic way of being able to handle various media types
on the response, such as JSON encoded data or HTML output.
REST framework also provides an HTML renderer the renders the browsable API.
"""
import copy
import string
from dj... | cloudcopy/seahub | thirdpart/rest_framework/renderers.py | Python | apache-2.0 | 17,423 |
import ast
import pkg_resources
import unittest
from rgkit.gamestate import GameState
from rgkit.settings import settings
map_data = ast.literal_eval(
open(pkg_resources.resource_filename('rgkit', 'maps/default.py')).read())
settings.init_map(map_data)
class TestStateMisc(unittest.TestCase):
def test_add_ro... | RobotGame/rgkit | test/state_misc_test.py | Python | unlicense | 2,473 |
from distutils.core import setup
import py2exe
"""
After adding py2exe to your python distribution (using eas_install with the executable to install into a specific version of python), build with:
python setup.py py2exe
The executable file is placed in /dist/route_test.exe
See more information about py2exe here:
htt... | turtlemonvh/traffic-monitor | setup.py | Python | mit | 420 |
"""add the user_policy table
Revision ID: ca69b099820
Revises: 3beeaef02651
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.schema import Column
# revision identifiers, used by Alembic.
revision = 'ca69b099820'
down_revision = '3beeaef02651'
def upgrade():
op.create_table(
'auth_use... | wazo-pbx/xivo-auth | alembic/versions/ca69b099820_add_the_user_policy_table.py | Python | gpl-3.0 | 745 |
from __future__ import unicode_literals
import copy
import datetime
import random
import re
import string
from moto.core.utils import (
camelcase_to_underscores,
iso_8601_datetime_with_milliseconds,
)
import six
def random_id(size=13):
chars = list(range(10)) + list(string.ascii_uppercase)
return "".... | william-richard/moto | moto/emr/utils.py | Python | apache-2.0 | 15,072 |
from sklearn2sql_heroku.tests.classification import generic as class_gen
class_gen.test_model("GradientBoostingClassifier" , "FourClass_100" , "sqlite")
| antoinecarme/sklearn2sql_heroku | tests/classification/FourClass_100/ws_FourClass_100_GradientBoostingClassifier_sqlite_code_gen.py | Python | bsd-3-clause | 155 |
"""artlaasya urls"""
from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.conf import settings
from artlaasya import views
admin.autodiscover()
# Dynamic page URL patterns.
urlpatterns = patterns('',
url(r'^$', views.home, name="v_home"),
url(r'^artist/(?P<artist... | davidjcox/artlaasya | artlaasya/urls.py | Python | bsd-3-clause | 2,367 |
import logging
import constants
import guid
class BucketFull(Exception):
"""Raised when the bucket is full."""
pass
class KBucket(object):
"""FILLME"""
def __init__(self, rangeMin, rangeMax, market_id):
"""
Initialize a new KBucket with a range and a market_id.
@param rang... | kordless/OpenBazaar | node/kbucket.py | Python | mit | 5,992 |
#
# o o
# 8
# .oPYo. .oPYo. odYo. o8P o8 .oPYo. odYo. .oPYo. .oPYo.
# Yb.. 8oooo8 8' `8 8 8 8oooo8 8' `8 8 ' 8oooo8
# 'Yb. 8. 8 8 8 8 8. 8 8 8 . 8.
# `YooP' `Yooo' 8 8 8 ... | yazanobeidi/sentience | src/python/conciousness/sentience.py | Python | apache-2.0 | 735 |
import os
import sys
class Module1(object):
pass
| ashishb/python_dep_generator | samples/module1.py | Python | mit | 51 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__="EIXXIE"
#将MOS文件夹添加到系统环境变量
import sys
import os
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
from sqlalchemy import orm,or_, and_, desc
from sqlalchemy import Table, Column, Integer, String... | iotate/svnmaster | mos/models/tables.py | Python | bsd-3-clause | 14,567 |
# coding: utf-8
import json
import os
import re
from xml.sax import saxutils
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.files.storage import get_storage_class
from django.urls import reverse
from django.db import m... | kobotoolbox/kobocat | onadata/apps/logger/models/xform.py | Python | bsd-2-clause | 10,599 |
"""Bosonic quantum operators."""
from warnings import warn
from sympy.core.compatibility import u
from sympy import Add, Mul, Pow, Integer, exp, sqrt, conjugate
from sympy.physics.quantum import Operator, Commutator, AntiCommutator, Dagger
from sympy.physics.quantum import HilbertSpace, FockSpace, Ket, Bra, IdentityO... | beni55/sympy | sympy/physics/quantum/boson.py | Python | bsd-3-clause | 6,207 |
import sys, random, time
from lsst.sims.catalogs.generation.db import jobDB
def howManyJobs(eM, tableId):
tableStr = str(tableId)
t0 = eM.queryState(tableStr + 'NumJobs')
if t0 == None: t0 = 0
else: t0 = int(t0)
print 'howManyJobs: Current num: ', t0
return t0
def addJob(eM, tableId):
tabl... | lsst/sims_catalogs_generation | python/lsst/sims/catalogs/generation/deprecated/jobAllocator/myThrottle.py | Python | gpl-3.0 | 1,494 |
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2016 CERN.
#
# INSPIRE 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... | jacenkow/inspire-next | inspirehep/modules/search/utils.py | Python | gpl-2.0 | 3,296 |
'''
Created on Jul 7, 2009
@author: Stou Sandalski (stou@icapsid.net)
@license: Public Domain
'''
import math
from OpenGL.GL import *
from OpenGL.GLU import *
from PyQt4 import QtGui
from PyQt4.QtOpenGL import *
class SpiralWidget(QGLWidget):
'''
Widget for drawing two spirals.
'''
def __init__(se... | JiangXL/ColorMapping | opengl.py | Python | gpl-3.0 | 2,720 |
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2012 Canonical
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
"""Tests for the TextInput Qml... | LeoTestard/qt-ubuntu-components | tests/autopilot/tavastia/tests/textfield/test_textfield.py | Python | lgpl-3.0 | 923 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Benjamin Jolivot <bjolivot@gmail.com>
# Inspired by slack module :
# # (c) 2017, Steve Pletcher <steve@steve-pletcher.com>
# # (c) 2016, René Moser <mail@renemoser.net>
# # (c) 2015, Stefan Berggren <nsg@nsg.cc>
# # (c) 2014, Ramon de la Fuente <ramon@delafuente.... | grimmjow8/ansible | lib/ansible/modules/notification/mattermost.py | Python | gpl-3.0 | 5,276 |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright (C) 2008-2015
# Christian Kohlöffel
# Vinzenz Schulz
#
# This file is part of DXF2GCODE.
#
# DXF2GCODE is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | hehongyu1995/Dxf2GCode | dxfimport/spline_convert.py | Python | gpl-3.0 | 30,731 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.