code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
#
# SpamFighter, Copyright 2008, 2009 NetStream LLC (http://netstream.ru/, we@netstream.ru)
#
# This file is part of SpamFighter.
#
# SpamFighter 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 Fou... | smira/spamfighter | spamfighter/api/message/test/test_log.py | Python | gpl-3.0 | 3,351 |
from django.conf import settings
from django.core.management.base import BaseCommand
import time
import datetime
import logging
from ballot_box.models import Contest
logger = logging.getLogger("kpcc_backroom_handshakes")
class Command(BaseCommand):
help = ""
interested = [
u'sos-statewide-president',... | SCPR/kpcc_backroom_handshakes | ballot_box/management/commands/set_featured_contests.py | Python | mit | 2,093 |
#!/usr/bin/env python
import unittest
from redis import Redis
from ..query import GeoHasher
class QueryTestCase(unittest.TestCase):
def setUp(self):
redis_client = Redis()
self.geohasher = GeoHasher(redis_client)
self.geohasher.add_coordinate(37.7833, -122.4167, 'SF')
self.geoh... | ypxu/laughing-ninja | geohash/tests/test_query.py | Python | mit | 1,863 |
from __future__ import print_function
from glyphNameFormatter.tools import camelCase
doNotProcessAsLigatureRanges = [
(0xfc5e, 0xfc63),
(0xfe70, 0xfe74),
#(0xfc5e, 0xfc61),
(0xfcf2, 0xfcf4),
(0xfe76, 0xfe80),
]
def process(self):
# Specifically: do not add suffixes to these ligatures,
... | LettError/glyphNameFormatter | Lib/glyphNameFormatter/rangeProcessors/helper_arabic_ligature_exceptions.py | Python | bsd-3-clause | 1,516 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "O365_Python_Unified_API_Connect.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| DJO3/O365-Python-Unified-API-Connect | manage.py | Python | mit | 274 |
#!/usr/bin/env python
#
# Calculate the change in the betweenness centrality of each residue over the
# course of an MD simulation
#
# Script distributed under GNU GPL 3.0
#
# Author: David Brown
# Date: 17-11-2016
import argparse, calc_delta
from lib.cli import CLI
from lib.utils import Logger
def main(args):
... | RUBi-ZA/MD-TASK | calc_delta_BC.py | Python | gpl-3.0 | 1,043 |
# 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 ... | dcorbacho/libcloud | libcloud/compute/drivers/hostvirtual.py | Python | apache-2.0 | 13,868 |
##import re
##import time
##
##from util import hook, http
##
##
##youtube_re = (r'(?:youtube.*?(?:v=|/v/)|youtu\.be/|yooouuutuuube.*?id=)'
## '([-_a-zA-Z0-9]+)', re.I)
##
##base_url = 'http://gdata.youtube.com/feeds/api/'
##api_url = base_url + 'videos/{}?v=2&alt=jsonc'
##search_api_url = base_url + 'vide... | thejordan95/Groovebot2 | plugins/youtube.py | Python | gpl-3.0 | 3,435 |
# -*- coding: utf-8 -*-
import pycurl
import re
import urllib
import urlparse
from module.plugins.internal.Hoster import Hoster
class Ftp(Hoster):
__name__ = "Ftp"
__type__ = "hoster"
__version__ = "0.55"
__status__ = "testing"
__pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-... | jansohn/pyload | module/plugins/hoster/Ftp.py | Python | gpl-3.0 | 2,771 |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
from setuptools import setup, find_packages
import opps
REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()]
if sys.argv[1] == 'develop':
REQUIREMENTS += [i.strip()
for i in open("requirements_dev.txt").readlines()]
... | laborautonomo/opps | setup.py | Python | mit | 1,975 |
'''NS Gatherer
'''
import argparse
import nscollector.gatherers as gatherers
import getpass
import requests
NATION = None
SESSION = None
def get_session(nation=None, password=None):
'''Login and return requests session object.
'''
global SESSION
global NATION
if not nation:
NATION = in... | luke-powers/NSCollector | src/nscollector/__main__.py | Python | apache-2.0 | 1,165 |
""".. Ignore pydocstyle D400.
=============
Backup models
=============
.. autoclass:: rolca.backup.models.FileBackup
:members:
"""
from django.db import models
from rolca.core.models import File
class FileBackup(models.Model):
"""Backup of files in ~`rolca.core.models.File` model."""
source = models... | dblenkus/rolca | src/rolca/backup/models.py | Python | apache-2.0 | 559 |
print "Get Ready Folks" | shiva92/Contests | Edx/GetReadyFolks/GetReadyFolks/GetReadyFolks.py | Python | apache-2.0 | 24 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009 Raymond Hettinger
#
# 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 r... | andpp/cherrymusic | backport/collections/_backported.py | Python | gpl-3.0 | 4,139 |
#!/usr/bin/env python
# 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
# "Li... | cwelton/incubator-hawq | tools/bin/gppylib/test/unit/test_unit_gparray.py | Python | apache-2.0 | 9,441 |
from __future__ import unicode_literals
import time
import random
import statistics
from autobahn.twisted.websocket import (
WebSocketClientProtocol,
WebSocketClientFactory,
)
from twisted.internet import reactor
stats = {}
class MyClientProtocol(WebSocketClientProtocol):
def __init__(self, *args, **kw... | Krukov/channels | testproject/benchmark.py | Python | bsd-3-clause | 7,725 |
#! /usr/bin/env python
#This is just a test program
#It calculates an age at days from input and prints it
#SMN
from datetime import date
import sys
try:
if (sys.argv[1] == "-h"):
print """
First Python program of SMN
Usage: year month date
-h Display this usage message
... | sniemi/SamPy | sandbox/src2/bdaycalculator.py | Python | bsd-2-clause | 1,045 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.management import setup_environ
import settings
setup_environ(settings)
import os
import sys
import time
import random
import datetime
from quizbowl.models import *
from quizbowl.views import notify_user
from django.contrib.auth.models impor... | cristilav/FLEQ | websocket-client.py | Python | agpl-3.0 | 15,128 |
#!/usr/bin/env python2
from distutils.core import setup
setup(name='python-halobitcoinrpc',
version='0.1',
description='Enhanced version of python-jsonrpc for use with Bitcoin',
long_description=open('README').read(),
author='Jeff Garzik',
author_email='<jgarzik@exmulti.com>',
main... | HaloExchange/HaloBitcoin | qa/rpc-tests/python-halobitcoinrpc/setup.py | Python | mit | 630 |
from model.contact import Contact
from random import randrange
def test_delete_some_contact(app):
if app.contact.count() == 0:
app.contact.create(Contact(firstname="Test"))
old_contacts = app.contact.get_contact_list()
index = randrange(len(old_contacts))
app.contact.delete_contact_by_index(in... | volkodav1985/volkodavpython | test 2/del_contacts.py | Python | apache-2.0 | 505 |
"""
Anything of general utility goes here.
"""
from __future__ import absolute_import
import os
import re
import shlex
import shutil
import signal
import subprocess as sub
import time
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def glob_rec(root, pattern, ignore_dirs=None):
"""
Recursi... | starcraftman/new-awesome | util/__init__.py | Python | bsd-3-clause | 3,066 |
'''
(*)~---------------------------------------------------------------------------
Pupil - eye tracking platform
Copyright (C) 2012-2017 Pupil Labs
Distributed under the terms of the GNU
Lesser General Public License (LGPL v3.0).
See COPYING and COPYING.LESSER for license details.
-----------------------------------... | fsxfreak/esys-pbi | src/pupil/pupil_src/player/vis_scan_path.py | Python | mit | 4,568 |
# -*- coding: utf-8 -*-
#
# This file is part of django-thumbnail-works.
#
# django-thumbnail-works adds thumbnail support to the default ImageField.
#
# Development Web Site:
# - http://www.codetrax.org/projects/django-thumbnail-works
# Public Source Code Repository:
# - https://source.codetrax.org/hgroot/dj... | frol/django-thumbnail-works | src/thumbnail_works/settings.py | Python | apache-2.0 | 1,509 |
#!/usr/bin/python
#----------------------------------------------------
# Program to convert VIC fluxes files to NetCDF file
# will ask the user wich variable he wants to export
# and also for wich years. Assumes there is data
# for the entire time period, from 1-jan to 31-dec
# SET UP FOR DAILY TIME STEP. FLUX FILE S... | KMarkert/servir-vic-training | scripts/flux2nc.py | Python | gpl-3.0 | 7,213 |
"""added passphrase_hash column to journalists table
Revision ID: 2d0ce3ee5bdc
Revises: fccf57ceef02
Create Date: 2018-06-08 15:08:37.718268
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2d0ce3ee5bdc'
down_revision = 'fccf57ceef02'
branch_labels = None
depe... | heartsucker/securedrop | securedrop/alembic/versions/2d0ce3ee5bdc_added_passphrase_hash_column_to_.py | Python | agpl-3.0 | 1,753 |
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typi... | Azure/azure-sdk-for-python | sdk/remoterendering/azure-mixedreality-remoterendering/azure/mixedreality/remoterendering/_shared/aio/mixedreality_account_key_credential.py | Python | mit | 2,073 |
from sqlalchemy.sql.expression import union_all
from CTFd.cache import cache
from CTFd.models import Awards, Challenges, Solves, Teams, Users, db
from CTFd.utils import get_config
from CTFd.utils.dates import unix_time_to_utc
from CTFd.utils.modes import get_model
@cache.memoize(timeout=60)
def get_standings(count=N... | LosFuzzys/CTFd | CTFd/utils/scores/__init__.py | Python | apache-2.0 | 9,020 |
# -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | gem/geonode | geonode/layers/views.py | Python | gpl-3.0 | 29,767 |
# -*- coding: utf-8 -*-
"""
lantz.drivers.aa.aotf
~~~~~~~~~~~~~~~~~~~~~
Implements the drivers for an AOTF Controller
Implementation Notes
--------------------
There are currently two (disconnected) ways of setting the power for each
line: powerdb and power.
Sources::
- MDS... | varses/awsch | lantz/drivers/aa/aotf.py | Python | bsd-3-clause | 2,531 |
import copy
import itertools
import re
import platform
if platform.python_version() < '2.7':
import unittest2 as unittest
else:
import unittest
from mongomock import Database, ObjectId, Collection
from mongomock import Connection as MongoMockConnection
from pymongo import Connection as PymongoConnection
from .m... | optimizely/mongomock | tests/test__mongomock.py | Python | bsd-3-clause | 12,722 |
from rest_framework import routers
from invite_email_api.views import InviteEmailViewSet, InviteEmailConfirmationViewSet
# Add in our routing for the person api
router = routers.DefaultRouter()
router.register(r'api/invite_email', InviteEmailViewSet, basename='invite_email')
router.register(r'api/invite_email_confirm... | JustinWingChungHui/okKindred | invite_email_api/urls.py | Python | gpl-2.0 | 424 |
# -*- coding: utf-8 -*-
import collections
import json
import re
from .types import Boolean, String
def camelize(name):
name = name.strip()
pattern = r'[-_\s]+(.)?'
name = re.sub(pattern, lambda m: m.groups()[0].upper() if m else '', name)
return name
class Declarative(type):
@classmethod
d... | concordusapps/python-scim | src/scim/schema/attributes.py | Python | mit | 12,633 |
from django.db import models, migrations
import django_tenants.postgresql_backend.base
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Client',
fields=[
('id', models.AutoField(verbose_name='ID', seria... | tomturner/django-tenants | dts_test_project/customers/migrations/0001_initial.py | Python | mit | 1,524 |
# SPDX-License-Identifier: MIT
from attr import (
NOTHING,
Attribute,
Factory,
__author__,
__copyright__,
__description__,
__doc__,
__email__,
__license__,
__title__,
__url__,
__version__,
__version_info__,
assoc,
cmp_using,
define,
evolve,
field,... | python-attrs/attrs | src/attrs/__init__.py | Python | mit | 1,109 |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import inspect
def IsDirectlyConstructable(cls):
"""Returns True if instance of |cls| can be construct without arguments."""
assert inspect.isclass(cls... | mohamed--abdel-maksoud/chromium.src | tools/telemetry/telemetry/util/classes.py | Python | bsd-3-clause | 760 |
from pyappacitive import AppacitiveObject, AppacitiveConnection, AppacitiveQuery, TagFilter, AppacitiveError
import datetime
from nose.tools import *
import nose
def create_connection_with_object_ids_test():
obj1 = AppacitiveObject('object')
obj1.create()
obj2 = AppacitiveObject('object')
obj2.create... | appacitive/pyappacitive | tests/connection_test.py | Python | mit | 7,553 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import sys
import os.path
from loguru import logger
path_to_script = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.join(path_to_script, "../experiments/"))
# sys.path.append(os.path.join(path_to_script, "../extern/sed3... | mjirik/lisa | tests/texture_features_experiments_test.py | Python | bsd-3-clause | 3,114 |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions ... | csm-aut/csm | csmserver/restful/api.py | Python | apache-2.0 | 13,251 |
"""
Core Workalendar Exceptions
"""
class CalendarError(Exception):
"""
Base Calendar Error
"""
class UnsupportedDateType(CalendarError):
"""
Raised when trying to use an unsupported date/datetime type.
"""
class ISORegistryError(CalendarError):
"""
Raised when you are trying to re... | novapost/workalendar | workalendar/exceptions.py | Python | mit | 729 |
import json
import unittest
from mock import Mock
from distributed_queue.queue import DistributedQueue, DistributedQueueError
from distributed_queue.routers import DefaultRouter
from distributed_queue.serializers import JsonSerializer
class TestQueue(unittest.TestCase):
def test_push_queue_mock(self):
ba... | ProstoKSI/distributed-queue | distributed_queue/tests/test_queue.py | Python | mit | 4,053 |
# -*- coding: utf-8 -*-
#
# Imports
import torch
import spacy
from .Transformer import Transformer
# Transform text to part-of-speech vectors
class PartOfSpeech(Transformer):
"""
Transform text to part-of-speech vectors
"""
# Constructor
def __init__(self, model="en_core_web_lg"):
"""
... | nschaetti/EchoTorch | echotorch/transforms/text/PartOfSpeech.py | Python | gpl-3.0 | 1,818 |
from __future__ import division, print_function, absolute_import
import os
from os.path import join
def configuration(parent_package='', top_path=None):
from distutils.sysconfig import get_python_inc
from scipy._build_utils.system_info import get_info, NotFoundError, numpy_info
from numpy.distutils.misc_... | lhilt/scipy | scipy/linalg/setup.py | Python | bsd-3-clause | 6,058 |
"""
Plot model coefficients.
"""
import AnniesLasso as tc
giant_model = tc.load_model("/data/gaia-eso/arc/rave/rave-tgas-v23giants.model") # giants
ms_model = tc.load_model("/data/gaia-eso/arc/rave/rave-tgas-v16b.model") # dwarfs
kwds = [
dict(color="r", alpha=0.8, label="Giant model - Combined model"),
d... | AnnieJumpCannon/RAVE | article/figures/plot_spectral_derivatives.py | Python | mit | 3,154 |
# Copyright (c) 2012 Rackspace Hosting
# All Rights Reserved.
# Copyright 2013 Red Hat, 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/license... | Snergster/virl-salt | openstack/nova/files/mitaka/nova+compute+cells_api.py | Python | gpl-2.0 | 27,331 |
"""
tcp-ipv6 protocl support class(es)
http://libvirt.org/formatnwfilter.html#nwfelemsRulesProtoTCP-ipv6
"""
from virttest.libvirt_xml import accessors, xcepts
from virttest.libvirt_xml.nwfilter_protocols import base
class Tcp_ipv6(base.TypedDeviceBase):
"""
Create new Tcp_ipv6 xml instances
Propertie... | autotest/virt-test | virttest/libvirt_xml/nwfilter_protocols/tcp_ipv6.py | Python | gpl-2.0 | 6,593 |
from base64 import b64encode
from datetime import datetime, timedelta
from django import forms
from django.template import loader
import hashlib
import hmac
import json
from dzdemo.settings import (
AWS_UPLOAD_BUCKET,
AWS_UPLOAD_REGION,
AWS_UPLOAD_PREFIX,
AWS_UPLOAD_ACL,
AWS_RED... | axelmagn/dropzone-aws-demo | dzdemo/dzcore/aws.py | Python | mit | 4,464 |
org = {
"login": "openslate",
"id": 1767240,
"url": "https://api.github.com/orgs/openslate",
"repos_url": "https://api.github.com/orgs/openslate/repos",
"events_url": "https://api.github.com/orgs/openslate/events",
"hooks_url": "https://api.github.com/orgs/openslate/hooks",
"issues_url": "ht... | rca/issuebranch | src/webhook/tests/utils.py | Python | apache-2.0 | 18,580 |
import os
from os.path import join, getsize
def extract_assets(src,dst):
os.system("xcopy \"%s\" \"%s\" /s /e"%(src,dst))
for root, dirs, files in os.walk(src):
for name in files:
full = join(root,name)
if full.endswith(".zip"):
os.system("7z x \"%s\" -aoa -o%s%s"%(full,dst,root[len(src):]))
... | zzh8829/RevOctane | revzip.py | Python | mit | 623 |
import os
import csv
import re
import glob
import json
from luigi import Parameter, IntParameter, WrapperTask
from collections import OrderedDict
from lib.timespan import get_timespan
from tasks.base_tasks import ColumnsTask, RepoFileUnzipTask, TableTask, CSV2TempTableTask, MetaWrapper
from tasks.meta import current_... | CartoDB/bigmetadata | tasks/au/data.py | Python | bsd-3-clause | 19,960 |
#!/usr/bin/env python3
from paramecio.cromosoma.webmodel import WebModel
from paramecio.cromosoma import corefields
from paramecio.cromosoma.extrafields.dictfield import DictField
from paramecio.cromosoma.extrafields.datefield import DateField
from paramecio.cromosoma.extrafields.ipfield import IpField
from paramecio.... | paramecio/pastafari | models/servers.py | Python | gpl-2.0 | 9,319 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Fekete Mihai <mihai.fekete@forbiom.eu>
# Copyright (C) 2016 FOREST AND BIOMASS SERVICES ROMANIA SA
# (http://www.forbiom.eu).
#
# This program is free software: you can redistribute it and/or... | feketemihai/l10n-romania | l10n_ro_contact_address/models/__init__.py | Python | agpl-3.0 | 1,026 |
import os, json, copy
from tqdm import *
from mpcontribs.io.core.utils import nest_dict, normalize_root_level
import mspScan as msp
from ALS_import import treat_xmcd
import xas_process as xas_process
# TODO mechanism to choose correct translate
# TODO: improve concept for the mapping of keys to compositions.
from tran... | materialsproject/MPContribs | mpcontribs-portal/mpcontribs/users/als_beamline/scripts/pre_submission.py | Python | mit | 2,169 |
import os
#os.system('git checkout develop')
#os.system('git pull origin develop')
ret = os.system('python -u tools/jenkins-scripts/job-comment-trigger.py')
if ret == 0:
exit(0)
else:
exit(1)
| dios-game/dios-cocos | src/oslibs/cocos/cocos-src/tools/jenkins-scripts/configs/cocos-2dx-pull-request-build-comment-trigger.py | Python | mit | 201 |
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2013, Steven Dossett <sdossett@panath.com>
#
# 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 versio... | CitizenB/ansible | lib/ansible/plugins/lookup/inventory_hostnames.py | Python | gpl-3.0 | 1,913 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Module.url'
db.add_column('modules_module', 'url',
self.gf('django.db.... | udbhav/eurorack-planner | source/apps/modules/migrations/0003_auto__add_field_module_url.py | Python | mit | 2,153 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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',
... | skg-net/ansible | lib/ansible/modules/network/f5/bigip_snmp_trap.py | Python | gpl-3.0 | 17,603 |
# Copyright 2018 The Cirq Developers
#
# 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 ... | quantumlib/Cirq | cirq-core/cirq/protocols/trace_distance_bound_test.py | Python | apache-2.0 | 1,939 |
# -*- coding: utf-8 -*-
"""plot_utils.py: Some utility function for plotting data in moose.
Last modified: Sun Jan 10, 2016 04:04PM
"""
__author__ = "Dilawar Singh"
__copyright__ = "Copyright 2013, NCBS Bangalore"
__credits__ = ["NCBS Bangalore", "Bhalla Lab"]
__license__ = "GPL"
... | dharmasam9/moose-core | python/moose/plot_utils.py | Python | gpl-3.0 | 9,065 |
# 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-keyvault/azure/keyvault/models/certificate_attributes.py | Python | mit | 2,405 |
# -*- coding: utf-8 -*-
"""
Display vnstat statistics.
Coloring rules.
If value is bigger that dict key, status string will turn to color, specified
in the value.
Example:
coloring = {
800: "#dddd00",
900: "#dd0000",
}
(0 - 800: white, 800-900: yellow, >900 - red)
Format of s... | Spirotot/py3status | py3status/modules/vnstat.py | Python | bsd-3-clause | 4,225 |
#!/usr/bin/python
#
# Copyright (C) 2008, 2011, 2012, 2013 Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright noti... | yiannist/ganeti | test/py/cmdlib/instance_unittest.py | Python | bsd-2-clause | 124,230 |
import logging
from django.template.response import TemplateResponse
from opaque_keys.edx.keys import CourseKey
from testfixtures import LogCapture
from core.tests.test_middleware import MiddlewareTestCase, MiddlewareAssertionMixin
from courses.exceptions import PermissionsRetrievalFailedError
from courses.middleware... | open-craft/edx-analytics-dashboard | analytics_dashboard/courses/tests/test_middleware.py | Python | agpl-3.0 | 2,492 |
# -*- coding: utf-8 -*-
from celery import Celery
from server import config
""" Celery configuration module.
"""
def make_celery(app):
""" Flask integration with celery. Taken from
http://flask.pocoo.org/docs/0.12/patterns/celery/
"""
celery = Celery(app.import_name, backend=config.CELERY_RESULT_BA... | abhishekpathak/recommendation-system | recommender/server/settings/celery_conf.py | Python | mit | 695 |
# -*- coding: utf-8 -*-
default_app_config = "shoop_pugme.apps.PugConfig"
| akx/shoop-pugme | shoop_pugme/__init__.py | Python | mit | 75 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('openfonacide', '0032_auto_20150404_2330'),
]
operations = [
migrations.RenameField(
model_name='establecimiento'... | diegocrzt/openfonacide | openfonacide/migrations/0033_auto_20150405_0152.py | Python | lgpl-3.0 | 574 |
"""Support for Tahoma devices."""
from collections import defaultdict
import logging
import voluptuous as vol
from requests.exceptions import RequestException
from homeassistant.const import CONF_USERNAME, CONF_PASSWORD, CONF_EXCLUDE
from homeassistant.helpers import discovery
from homeassistant.helpers import config_... | HydrelioxGitHub/home-assistant | homeassistant/components/tahoma/__init__.py | Python | apache-2.0 | 4,382 |
"""
pretty debug errors
(part of web.py)
portions adapted from Django <djangoproject.com>
Copyright (c) 2005, the Lawrence Journal-World
Used under the modified BSD license:
http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5
"""
__all__ = ["debugerror", "djangoerror", "emailerrors"]
import sys, urlparse, pprint, traceb... | pankajn17/intern | web/debugerror.py | Python | gpl-3.0 | 12,341 |
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import ActionMap
from Components.ConfigList import ConfigListScreen
from Components.MenuList import MenuList
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigNumber, Conf... | Taapat/enigma2-openpli-vuplus | lib/python/Plugins/SystemPlugins/AnimationSetup/plugin.py | Python | gpl-2.0 | 9,065 |
# -*- coding: utf-8 -*-
from plugins import Plugin
from PyQt4 import QtCore, QtGui
import tempfile, codecs
import os, subprocess
class rst2pdf(Plugin):
name='rst2pdf'
shortcut='Ctrl+F8'
description='Run through rst2pdf and preview'
tmpf=None
def run(self):
print "Running rst2pdf"
... | thegooglecodearchive/marave | marave/plugins/rst2pdf.py | Python | gpl-2.0 | 1,268 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apache.org/licenses/LICENSE-2.0
#
# ... | andrewsmedina/horizon | horizon/horizon/dashboards/nova/instances_and_volumes/instances/tables.py | Python | apache-2.0 | 6,173 |
# valis: valis, a lojbanic information system
# Copyright (C) 2015, Riley Martinez-Lynch
#
# 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)... | lojban/valis | valis/models/__init__.py | Python | gpl-3.0 | 1,132 |
def pymonkey_patch(module, args):
if module.__name__ != 'targetmod':
return
module.global_var = args.patch
def pymonkey_argparse(argv):
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--patch', default=2, type=int)
return parser.parse_known_args(argv)
| asottile/pymonkey | testing/pkg1/patchingmod.py | Python | mit | 310 |
# offline test for WebApplication
from WebModel import Initialize, Login, UpdateInt, ReadInt, Logout
testSuite = [
# Run 1 should succeed
[
(Initialize, (), None),
(Login, ( 'VinniPuhh', 'Correct' ), 'Success'),
(UpdateInt, ( 'VinniPuhh', 1 ), None),
(ReadInt, ( 'VinniPuhh', ), 1),
... | jon-jacky/PyModel | samples/WebApplication/TestIntTwoRuns.py | Python | bsd-3-clause | 688 |
# -*- coding: utf-8 -*-
# © 2017 Therp BV <http://therp.nl>
# © 2017 Odoo SA <https://www.odoo.com>
# © 2017 OCA <https://odoo-community.org>
# License LGPL-3 (https://www.gnu.org/licenses/lgpl-3.0.en.html).
from openerp import fields, models, api
class AccountConfigSettings(models.Model):
_inherit = 'account.con... | acsone/account-invoicing | account_outstanding_payment/models/account_config_settings.py | Python | agpl-3.0 | 1,224 |
import os
PW_TOKEN = os.environ.get('PW_TOKEN')
PW_APP_CODE = os.environ.get('PW_APP_CODE')
PW_APP_GROUP_CODE = os.environ.get('PW_APP_GROUP_CODE')
| Pushwoosh/pushwoosh-python-lib | tests/integration/__init__.py | Python | mit | 149 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
GNOME Shell integration for Chrome
Copyright (C) 2016-2019 Yuri Konotopov <ykonotopov@gnome.org>
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 Sof... | nE0sIghT/chrome-gnome-shell-mirror | connector/chrome-gnome-shell.py | Python | gpl-3.0 | 20,962 |
# Copyright (C) 2012 Statoil ASA, Norway.
#
# The file 'enkf_node.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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... | arielalmendral/ert | python/python/ert/enkf/data/enkf_node.py | Python | gpl-3.0 | 4,674 |
from pathlib import Path
from minizinc import default_driver
from minizinc.CLI import CLIDriver
import subprocess
import json
def test_multiple_type_errors():
here = Path(__file__).resolve().parent
assert isinstance(default_driver, CLIDriver)
model_file = here / "test_multiple_type_errors.mzn"
p = sub... | MiniZinc/libminizinc | tests/spec/unit/driver/test_multiple_type_errors.py | Python | mpl-2.0 | 731 |
# coding: utf-8
from collections import OrderedDict
import pytest
from formpack.constants import OR_OTHER_COLUMN
from formpack.utils.flatten_content import (
flatten_content,
flatten_tag_list,
translated_col_list,
)
from formpack.utils.json_hash import json_hash
from formpack.utils.spreadsheet_content imp... | kobotoolbox/formpack | tests/test_utils_flatten_content.py | Python | gpl-3.0 | 14,678 |
"""SCons.Tool.rpcgen
Tool-specific initialization for RPCGEN tools.
Three normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/rpcgen.py | Python | lgpl-2.1 | 2,861 |
class HostCommands(object):
def __new__(cls, host):
if host.is_ol6:
return HostCommandOL6(host)
if host.is_ol7:
return HostCommandOL7(host)
class HostBaseCommands(object):
def __init__(self, host):
self.host = host
self.infra = host.infra
self.e... | globocom/database-as-a-service | dbaas/physical/commands.py | Python | bsd-3-clause | 3,573 |
#!/usr/bin/env python
'''
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")... | sekikn/ambari | ambari-server/src/main/python/ambari_server/serverUpgrade.py | Python | apache-2.0 | 21,485 |
import sys
import os
import re
from subprocess import PIPE, Popen, call
fq1, fq2, db, prefix = sys.argv[1:]
bowtie2_logfh = open(prefix+'.bowtie2.log','w')
bamfile = prefix+'.bam'
bowtie2_cmd = ['bowtie2', '-x', db, '-1', fq1, '-2', fq2]
samtools_view = ['samtools', 'view', '-bhS', '-']
samtools_sort = ['samtools', 's... | luo-chengwei/utilitomics | utils/align.PE.py | Python | gpl-3.0 | 826 |
# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as pu... | FedoraScientific/salome-smesh | src/Tools/MacMesh/MacMesh/Cylinder.py | Python | lgpl-2.1 | 6,527 |
# Copyright 2020 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, sof... | googleinterns/e2e-convrec | test/test_metrics.py | Python | apache-2.0 | 7,871 |
#!/usr/bin/env python
"""
Populates the database with the current installations of components
This script assumes that the InstalledComponentsDB, the
ComponentMonitoring service and the Notification service are installed and running
"""
from datetime import datetime
from DIRAC import exit as DIRACexit
from DIRAC imp... | fstagni/DIRAC | FrameworkSystem/scripts/dirac-populate-component-db.py | Python | gpl-3.0 | 7,161 |
from mock_data import *
| klusta-team/kwiklib | kwiklib/dataio/tests/__init__.py | Python | bsd-3-clause | 24 |
"""Provide the RedditorListingMixin class."""
from ....const import urljoin
from ..generator import ListingGenerator
from .base import BaseListingMixin
from .gilded import GildedListingMixin
class RedditorListingMixin(BaseListingMixin, GildedListingMixin):
"""Adds additional methods pertaining to Redditor instanc... | voussoir/praw | praw/models/listing/mixins/redditor.py | Python | gpl-3.0 | 5,343 |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @return an integer
def numDistinct(self, S, T):
ls, lt = len(S), len(T)
if ls == 0 or lt == 0: return 0
distinct = [[0] * ls for i in range(lt)]
num = 0
for j in range(0, ls):
if T[0] == S[j]: num += 1
... | wh-acmer/minixalpha-acm | LeetCode/Python/distinct_subsequences.py | Python | mit | 770 |
# --- Day 4: Security Through Obscurity ---
#
# Finally, you come across an information kiosk with a list of rooms. Of course, the list is encrypted and full of decoy
# data, but the instructions to decode the list are barely hidden nearby. Better remove the decoy data first.
#
# Each room consists of an encrypted name... | pacificsky/AdventOfCode | 2016/day4_1.py | Python | apache-2.0 | 2,794 |
import unittest
from test import test_support
import textwrap
class ComplexArgsTestCase(unittest.TestCase):
def check(self, func, expected, *args):
self.assertEqual(func(*args), expected)
# These functions are tested below as lambdas too. If you add a
# function test, also add a simi... | ktan2020/legacy-automation | win/Lib/test/test_complex_args.py | Python | mit | 3,625 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
import cybox.bindings.pdf_file_object as pdf_file_binding
from cybox.objects.file_object import File
from cybox.common import (DateTime, HashList, PositiveInteg... | CybOXProject/python-cybox | cybox/objects/pdf_file_object.py | Python | bsd-3-clause | 11,630 |
# coding=utf-8
from atom.mixins import AdminTestCaseMixin
from test_plus.test import TestCase
from petycja_norweskie.users.models import User
from petycja_norweskie.users.tests.factories import UserFactory
from ..admin import MyUserCreationForm
class TestMyUserCreationForm(TestCase):
def setUp(self):
sel... | watchdogpolska/petycja-norweskie | petycja_norweskie/users/tests/test_admin.py | Python | mit | 1,699 |
from unittest import mock
from django.core import checks
from django.core.checks import Error, Warning
from django.db import models
from django.test import SimpleTestCase, TestCase, skipUnlessDBFeature
from django.test.utils import (
isolate_apps, modify_settings, override_settings, override_system_checks,
)
cla... | elena/django | tests/check_framework/test_model_checks.py | Python | bsd-3-clause | 16,037 |
""" Module to deal with FITS catalog read/access """
##@file fits_data
import sys;
import pyfits;
import string;
import numpy as np;
import re;
# ---
def sort_by_column(tbhdu,fieldname):
"""
Sort a FITS table HDU by "fieldname" column in increasing order.
Inputs:
- tbhdu: FITS table HDU
... | chbrandt/zyxw | eada/io/fits.py | Python | gpl-2.0 | 9,491 |
#!/usr/bin/env python
from datetime import datetime
from os import makedirs, path
from time import sleep
from window_title import get_window_title
NOW_TO_THE_HOUR = '%Y-%m-%d-%H'
EPOCH = '%s'
def logger(run_forever=True, stdout=False):
write_path = setup_write_dir()
run = True
while run:
now = da... | charlesthomas/introspect | introspect/introspect.py | Python | mit | 984 |
#!/usr/bin/env python
#coding: utf-8
def header(string):
"""
Display header
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print '\n', timeInfo, "****", string, "****"
def subHeader(string):
"""
Display subheader
"""
timeInfo = time.strftime("%Y-%m-%d %H:%M")
print t... | brguez/TEIBA | src/python/setGenotypes_fixedMEI.py | Python | gpl-3.0 | 3,181 |
#!/usr/bin/python
import Axon
from Kamaelia.Util.PipelineComponent import pipeline
from Kamaelia.Util.Graphline import Graphline
from Kamaelia.Util.Console import ConsoleReader, ConsoleEchoer
from Kamaelia.Visualisation.PhysicsGraph.chunks_to_lines import chunks_to_lines
from Kamaelia.Visualisation.PhysicsGraph.lines... | sparkslabs/kamaelia | Sketches/MPS/Experiments/Editor2/grapheditor.py | Python | apache-2.0 | 4,832 |
import unittest
from quickbooks.objects.employee import Employee
class EmployeeTests(unittest.TestCase):
def test_unicode(self):
employee = Employee()
employee.DisplayName = "test"
self.assertEquals(unicode(employee), "test")
| ferdiaz/python-quickbooks | tests/unit/objects/test_employee.py | Python | mit | 258 |
from kivy.uix.gridlayout import GridLayout
from kivy.uix.listview import ListView, ListItemButton
from kivy.adapters.dictadapter import DictAdapter
from fixtures import fruit_data
from fruit_detail_view import FruitDetailView
class MasterDetailView(GridLayout):
'''Implementation of an master-detail view with a ... | nuigroup/kivy | examples/widgets/lists/list_master_detail.py | Python | lgpl-3.0 | 1,869 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.