text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
"""
Logistration API View Tests
"""
from unittest.mock import patch
from urllib.parse import urlencode
import socket
import ddt
from django.conf import settings
from django.urls import reverse
from rest_framework.test import APITestCase
from common.djangoapps.student.models import Registration
from common.djangoapps.s... | edx/edx-platform | openedx/core/djangoapps/user_authn/api/tests/test_views.py | Python | agpl-3.0 | 7,808 | 0.00269 |
#!/usr/bin/env python3
import os
os.system("djtgcfg prog -d Nexys4DDR -i 0 -f ./build/gateware/top.bit")
| litex-hub/fpga_101 | lab004/load.py | Python | bsd-2-clause | 105 | 0 |
#!/usr/bin/env python3
# Combine SVG Images of Italic Practice Sheets into an OpenDocument Document
# Written in 2014 by Jordan Vaughan
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software ... | jtvaughan/calligraphy | fodtitalicsheets.py | Python | cc0-1.0 | 6,988 | 0.014024 |
# Copyright 2011 (C) Daniel Richman
#
# This file is part of habitat.
#
# habitat 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.
#
# h... | ukhas/habitat | habitat/tests/test_sensors/test_stdtelem.py | Python | gpl-3.0 | 4,262 | 0 |
# -*- coding: utf-8 -*-
"""Module to check modules existance.
This exports this booleans:
- has_reportlab -- True if reportlab is found
- has_PIL -- True if PIL is found
- has_pygtk -- True if pygtk is found
Copyright (C) 2005-2008 Xosé Otero <xoseotero@users.sourceforge.net>
"""
__all__ = ["has_reportlab",... | ternus/arcnet | cyber/pythonsudoku/check_modules.py | Python | gpl-2.0 | 644 | 0.00311 |
import math
from .fingerprint import Fingerprint
class Diff(Fingerprint):
def trans_func_(self, row):
'''
F. Dong, Y. Chen, J. Liu, Q. Ning, and S. Piao, "A Calibration-free
localiztion solution for handling signal strength variance", in
MELT (Berlin, Heidelberg), pp. 79-90, Sprin... | rloliveirajr/sklearn_transformers | trans4mers/feature_extraction/diff.py | Python | gpl-2.0 | 634 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from base import BaseHandler
import os
import sys
sys.path.append('..')
from models.user import User
class ChangeHandler(BaseHandler):
def get(self):
uname = self.get_current_user()
user = User.get_user_by_name(uname)
error=""
if len(... | oujiaqi/suiyue | routes/setting.py | Python | apache-2.0 | 2,131 | 0.013429 |
# Copyright (C) 2016 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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... | dnanexus/dx-toolkit | src/python/dxpy/ssh_tunnel_app_support.py | Python | apache-2.0 | 5,946 | 0.002691 |
from sys import argv
from os.path import exists
script, from_file, to_file = argv
print "Copying from %s to %s" % (from_file, to_file)
# we could do these two on one line too, how?
# in_file = open(from_file)
# indata = in_file.read()
indata = open(from_file).read()
print "The input file is %d bytes long" % len(in... | CodeCatz/litterbox | Pija/LearnPythontheHardWay/ex17.py | Python | mit | 570 | 0.005263 |
# 4. Median of Two Sorted Arrays My Submissions QuestionEditorial Solution
# Total Accepted: 94496 Total Submissions: 504037 Difficulty: Hard
# There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).
# ... | shawncaojob/LC | PY/4_median_of_two_sorted_arrays.py | Python | gpl-3.0 | 3,984 | 0.00753 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-18 07:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_auto_20170824_0954'),
]
operations = [
migrations.AddField(
... | hotfix-project/hotfix-api | api/migrations/0005_patch_md5sum.py | Python | mit | 456 | 0 |
def func():
value = "not-none"
if value is not None:
print("Not none")
else: # Is none
print("None") | siosio/intellij-community | python/testData/intentions/PyInvertIfConditionIntentionTest/commentsInlineIf_after.py | Python | apache-2.0 | 130 | 0.007692 |
# -*- coding: utf-8 -*-
'''
Author: Robin David
License: GNU GPLv3
Repo: https://github.com/RobinDavid
Copyright (c) 2012 Robin David
PyStack 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 ... | RobinDavid/pystack | pystack/layers/udp_application.py | Python | gpl-3.0 | 6,311 | 0.006655 |
import json
import logging
import boto3
import hashlib
import jsonpatch
from dart.context.locator import injectable
from dart.model.trigger import TriggerType, TriggerState
from dart.message.call import TriggerCall
from dart.trigger.base import TriggerProcessor, execute_trigger
from dart.model.exception import DartVa... | RetailMeNotSandbox/dart | src/python/dart/trigger/scheduled.py | Python | mit | 11,491 | 0.003568 |
"""
N-Triples RDF graph serializer for RDFLib.
See <http://www.w3.org/TR/rdf-testcases/#ntriples> for details about the
format.
"""
from typing import IO, Optional
from rdflib.graph import Graph
from rdflib.term import Literal
from rdflib.serializer import Serializer
import warnings
import codecs
__all__ = ["NTSeria... | RDFLib/rdflib | rdflib/plugins/serializers/nt.py | Python | bsd-3-clause | 2,617 | 0.001146 |
""" Multicast DNS Service Discovery for Python
Copyright (c) 2003, Paul Scott-Murphy
Copyright (c) 2008-2011, Peter V. Saveliev
This module provides a framework for the use of DNS Service Discovery
using IP multicast. It has been tested against the JRendezvous
implementation from <a href="http://s... | svinota/cxnet | cxnet/zeroconf.py | Python | gpl-3.0 | 69,198 | 0.004393 |
try:
import click
except ImportError:
print("Please install click for this example")
print(" pip install click")
exit()
from rich.traceback import install
install(suppress=[click])
@click.command()
@click.option("--count", default=1, help="Number of greetings.")
def hello(count):
"""Simple pr... | willmcgugan/rich | examples/suppress.py | Python | mit | 489 | 0 |
# 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 socorro.database.database as db
from configman import ConfigurationManager, Namespace
from configman.converters i... | bsmedberg/socorro | socorro/unittest/external/postgresql/unittestbase.py | Python | mpl-2.0 | 3,375 | 0 |
# Python imports
import cgi
import locale
import logging
import os
import os.path
import sys
import time
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
# Douglas imports
from douglas import __version__
from douglas import crashhandling
from douglas import plugin_utils
fr... | willkg/douglas | douglas/app.py | Python | mit | 37,546 | 0.000027 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.header import Header
from email import encoders
from email.mime.base import MIMEBase
from email.utils import parseaddr, formataddr
# 格式化邮件地址
def formatAddr(s):
nam... | WZQ1397/automatic-repo | python/emailOps/sendemailWithFile.py | Python | lgpl-3.0 | 1,776 | 0.003759 |
import json
import os
import sys
from unittest import TestCase
from urllib import quote_plus
from xmlrpclib import loads, dumps
data_dir = os.path.dirname(os.path.abspath(__file__))
try:
shutil.rmtree(data_dir)
except:
pass
cur_dir = os.path.dirname(os.path.abspath(__file__))
pylons_root = os.path.dirnam... | moreati/pylons | tests/test_units/__init__.py | Python | bsd-3-clause | 2,788 | 0.004663 |
# Copyright 2013 John Reese
# Licensed under the MIT license
######################
# Parsing options
######################
# the regex to parse data from irc log filenames.
# must contain two named matching groups:
# channel: the name of the channel
# date: the date of the conversation
filename_regex = r'(?P<ch... | jreese/ircstat | ircstat/defaults.py | Python | mit | 4,274 | 0.000936 |
import click
from ghutil.types import Issue
@click.command()
@Issue.argument_list("issues")
def cli(issues):
"""Lock issues/PRs"""
for i in issues:
i.lock.put()
| jwodder/ghutil | src/ghutil/cli/issue/lock.py | Python | mit | 179 | 0 |
###############################################
# RabbitMQ in Action
# Chapter 10 - RabbitMQ ping (HTTP API) check.
###############################################
#
#
# Author: Jason J. W. Williams
# (C)2011
###############################################
import sys, json, httplib, urllib, base64, socket
#(apic.0)... | rabbitinaction/sourcecode | python/chapter-10/api_ping_check.py | Python | bsd-2-clause | 1,459 | 0.00891 |
# -*- coding: utf-8 -*-
"""
General description
-------------------
This example shows how to perform a capacity optimization for
an energy system with storage. The following energy system is modeled:
input/output bgas bel
| | | |
| ... | oemof/oemof_examples | oemof_examples/oemof.solph/v0.4.x/storage_investment/v2_invest_optimize_only_gas_and_storage.py | Python | gpl-3.0 | 6,369 | 0 |
# #
# Copyright 2012-2015 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en),
# the Hercules foundation (ht... | valtandor/easybuild-framework | test/framework/variables.py | Python | gpl-2.0 | 3,243 | 0.002158 |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., University of Heidelberg, and University of
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2010 - 2016 by Pedro Mendes, Virginia Tech Intellectual
# Properties, Inc., Universit... | jonasfoe/COPASI | copasi/bindings/python/unittests/Test_CCopasiObject.py | Python | artistic-2.0 | 4,243 | 0.036295 |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants_test.pant... | cevaris/pants | contrib/node/tests/python/pants_test/contrib/node/tasks/test_node_resolve_integration.py | Python | apache-2.0 | 1,125 | 0.003556 |
import re
from binascii import unhexlify
from collections import namedtuple
from itertools import starmap
from streamlink.compat import urljoin, urlparse
__all__ = ["load", "M3U8Parser"]
# EXT-X-BYTERANGE
ByteRange = namedtuple("ByteRange", "range offset")
# EXT-X-KEY
Key = namedtuple("Key", "method uri iv key_fo... | javiercantero/streamlink | src/streamlink/stream/hls_playlist.py | Python | bsd-2-clause | 10,407 | 0.000961 |
from __future__ import division,print_function,unicode_literals,with_statement
import logging
from django.contrib.auth import get_user_model
from django.contrib.auth.backends import ModelBackend
User=get_user_model()
class EmailBackend(ModelBackend):
def authenticate(self,username=None,password=None,**kwargs):
... | hikelee/launcher | launcher/utils/common/auth_backends.py | Python | mit | 703 | 0.02276 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import optparse
import sys
import requests
import re
from bs4 import BeautifulSoup
major_version = 0
intermediary_version = 0
minor_version = 0
folder_plugins = None
folder_themes = None
plugins = {}
# Detect the version of a SPIP install
# Version is in the header (f... | PaulSec/SPIPScan | spipscan.py | Python | mit | 16,919 | 0.000473 |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
class Solution:
def distributeCoins(self, root: TreeNode) -> int:
total = 0
def dfs(node):
if not node:
return 0
L, R = dfs(node.left), dfs(node.right)
... | ccqpein/Arithmetic-Exercises | Distribute-Coins-in-Binary-Tree/DCIBT.py | Python | apache-2.0 | 433 | 0.002309 |
import subprocess
import sys
import tempfile
from textwrap import dedent
from bpython import args
from bpython.test import FixLanguageTestCase as TestCase
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
from nose.plugins.attrib import attr
except ImportError:
def attr(func,... | aktorion/bpython | bpython/test/test_args.py | Python | mit | 1,098 | 0 |
"""
A naming convention and discovery mechanism for HTTP endpoints.
Operations provide a naming convention for references between endpoints,
allowing easy construction of links or audit trails for external consumption.
"""
from collections import namedtuple
from enum import Enum, unique
# metadata for an operation
... | globality-corp/microcosm-flask | microcosm_flask/operations.py | Python | apache-2.0 | 3,019 | 0.000994 |
import logging
import logging.config
def configure_logging():
logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'brief': {
'()': 'colorlog.ColoredFormatter',
'style': '{',
'format': '{na... | mbdevpl/maildaemon | maildaemon/_logging.py | Python | apache-2.0 | 760 | 0.002632 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from django.conf.urls import patterns
from django.conf.urls import url
urlpatterns = patterns(
'userprofile.views',
# login
url(
r'^ajax-login/$',
'ajax_login',
name='ajax_login',
),
# Ajax register
url(
r'^ajax-re... | andresfcardenas/marketing-platform | userprofile/urls.py | Python | bsd-3-clause | 645 | 0 |
#! /usr/bin/env python
# $Id: setup.py,v 1.2 2002/01/08 07:13:21 jgg Exp $
from distutils.core import setup, Extension
from distutils.sysconfig import parse_makefile
from DistUtilsExtra.command import *
import glob, os, string
# The apt_pkg module
files = map(lambda source: "python/"+source,
string.split(... | zsjohny/python-apt | setup.py | Python | gpl-2.0 | 1,759 | 0.010233 |
from __future__ import unicode_literals
try:
from urlparse import urlparse
except ImportError:
from urllib.parse import urlparse
from oauthlib.common import add_params_to_uri, urldecode
from oauthlib.oauth1 import SIGNATURE_HMAC, SIGNATURE_TYPE_AUTH_HEADER
import requests
from . import OAuth1
import sys
if ... | gquirozbogner/contentbox-master | third_party/requests_oauthlib/oauth1_session.py | Python | apache-2.0 | 12,076 | 0.001822 |
# coding: utf-8
"""
DragonPy - Dragon 32 emulator in Python
=======================================
:created: 2013 by Jens Diemer - www.jensdiemer.de
:copyleft: 2013-2014 by the DragonPy team, see AUTHORS for more details.
:license: GNU GPL v3 or above, see LICENSE for more details.
"""
from __fu... | JuhaniImberg/DragonPy | dragonpy/core/configs.py | Python | gpl-3.0 | 4,067 | 0.003196 |
# coding: utf-8
from qgis.gui import QgsDualView
from qgis.utils import iface
layer = iface.activeLayer()
canvas = iface.mapCanvas()
dv = QgsDualView()
dv.init(layer, canvas) # The active layer is a vector layer
dv.setView(QgsDualView.AttributeEditor) # It could be QgsDualView.AttributeTable instead
dv.show()
| webgeodatavore/pyqgis-samples | gui/qgis-sample-QgsDualView.py | Python | gpl-2.0 | 314 | 0.003185 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/consumption/_client_factory.py | Python | mit | 1,308 | 0.000765 |
# coding=utf-8
# This file is part of SickChill.
#
# URL: https://sickchill.github.io
# Git: https://github.com/SickChill/SickChill.git
#
# SickChill is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... | coderbone/SickRage-alt | tests/sickchill_tests/show/coming_episodes_tests.py | Python | gpl-3.0 | 3,730 | 0.002413 |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 20 12:01:18 2015
@author: Eric Dodds
Abstract dictionary learner.
Includes gradient descent on MSE energy function as a default learning method.
"""
import numpy as np
import pickle
# the try/except block avoids an issue with the cluster
try:
import matp... | emdodds/DictLearner | DictLearner.py | Python | mit | 16,189 | 0.000309 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-web/azure/mgmt/web/models/proxy_only_resource.py | Python | mit | 1,493 | 0.00067 |
# Copyright 2013 IBM Corp.
# 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 app... | luzheqi1987/nova-annotation | nova/tests/unit/api/openstack/compute/contrib/test_extended_virtual_interfaces_net.py | Python | apache-2.0 | 4,516 | 0.000443 |
"""
Copyright (C) 2020 Quinn D Granfor <spootdev@gmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2, as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
... | MediaKraken/MediaKraken_Deployment | source/common/common_logging_elasticsearch_httpx.py | Python | gpl-3.0 | 2,920 | 0.000342 |
#!/usr/bin/env python
########################################################################
# $HeadURL$
########################################################################
__RCSID__ = "$Id$"
from DIRAC import exit as DIRACExit
from DIRAC.Core.Base import Script
Script.setUsageMessage( """
Get the gi... | vmendez/DIRAC | DataManagementSystem/scripts/dirac-dms-replica-metadata.py | Python | gpl-3.0 | 1,519 | 0.044766 |
import pymongo
import mongotron
conn = pymongo.Connection()
mongotron.GetConnectionManager().add_connection(conn)
class Doc(mongotron.Document):
__db__ = 'test'
structure = {
'name': unicode,
'age': int,
'events': [int]
}
d = Doc()
d.age = 103
#d.age = "dave"
d.save()
pprint((... | Narrato/mongotron | test.py | Python | bsd-2-clause | 337 | 0.002967 |
"""
Copyright (c) 2016-2017 Dell Inc. or its subsidiaries. All Rights Reserved.
"""
import logging
import os
from nose.plugins import Plugin
from stream_sources import LoggingMarker, SelfTestStreamMonitor, AMQPStreamMonitor, SSHHelper
import sys
from nose.pyversion import format_exception
from nose.plugins.xunit import... | RackHD/RackHD | test/stream-monitor/sm_plugin/stream_monitor.py | Python | apache-2.0 | 8,487 | 0.001178 |
#------------------------------------------------------------------------------
# type_converter.py (Section 6.2)
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Copyright 2017, 2018, Oracle and/or its aff... | cloudera/hue | desktop/core/ext-py/cx_Oracle-6.4.1/samples/tutorial/solutions/type_converter.py | Python | apache-2.0 | 959 | 0.009385 |
from copy import copy
import pytest
from plenum.common.stacks import nodeStackClass
from plenum.common.util import randomString
from stp_core.loop.eventually import eventually
from stp_core.network.auth_mode import AuthMode
from stp_core.network.port_dispenser import genHa
from stp_core.test.helper import Printer, pr... | evernym/zeno | stp_zmq/test/test_node_to_node_quota.py | Python | apache-2.0 | 3,525 | 0.001135 |
#
# entity_extracter/__init__.py - demo agent service adapter...
#
# Copyright (c) 2017 SingularityNET
#
# Distributed under the MIT software license, see LICENSE file.
#
import logging
from sn_agent.job.job_descriptor import JobDescriptor
from sn_agent.service_adapter import ServiceAdapterABC
logger = logging.getLo... | inflector/singnet | agent/examples/multi_agent_adapter/entity_extracter/__init__.py | Python | mit | 823 | 0 |
#!/usr/bin/python3
# coding: utf-8
import sys
import json
import requests
import pprint
import unittest
import string
import random
import os
import json
import time
import datetime
import base64
import uuid
import argparse
pp = pprint.PrettyPrinter(depth=6)
parser = argparse.ArgumentParser()
parser.add_argument('--... | hgn/hippod | tests/0303-same-object-default.py | Python | mit | 8,290 | 0.003378 |
#
# Copyright (C) 2021 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be... | M4rtinK/anaconda | tests/unit_tests/pyanaconda_tests/modules/payloads/payload/test_image_installation.py | Python | gpl-2.0 | 4,138 | 0.000242 |
"""Merge ee7bff1d660c and f6a9c7e6694b
Revision ID: 224dac8f951c
Revises: ee7bff1d660c, f6a9c7e6694b
Create Date: 2018-03-30 09:56:19.308323
"""
# revision identifiers, used by Alembic.
revision = '224dac8f951c'
down_revision = ('ee7bff1d660c', 'f6a9c7e6694b')
branch_labels = None
depends_on = None
from alembic imp... | fedspendingtransparency/data-act-broker-backend | dataactcore/migrations/versions/224dac8f951c_merge_ee7bf_f6a9c.py | Python | cc0-1.0 | 581 | 0.006885 |
from __future__ import absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement
from django.contrib import admin
class AgeGroupAdmin(admin.ModelAdmin):
list_display = ('name', 'order')
list_editable = ('order',)
| misli/django-domecek | domecek/admin/agegroup.py | Python | bsd-3-clause | 275 | 0.014545 |
from urlparse import urlparse
import logging
import urllib3
import pyramid_airbrake
log = logging.getLogger(__name__)
def create_http_pool(settings):
url = settings['notification_url']
maxsize = settings['threaded.threads'] # sort of a lie, potentially
timeout = settings['timeout']
if settings['us... | epii/pyramid_airbrake | pyramid_airbrake/airbrake/submit.py | Python | mit | 3,343 | 0.000897 |
from time import time
import unittest
from unittest.mock import patch, Mock
from urllib.error import URLError
from suds import WebFault
from ..exceptions import (
ConnectError, ServiceError, ApiLimitError, AccountFault, TableFault, ListFault)
from .. import client
class InteractClientTests(unittest.TestCase):
... | jslang/responsys | responsys/tests/test_client.py | Python | gpl-2.0 | 7,054 | 0.001701 |
#!/usr/bin/env python
import sys
import argparse
from collections import defaultdict
from collections import Counter
def run(args):
dic = set()
wcnt = 0
for i, indict in enumerate(args.dicts):
print('Processing dict# %d: %s' % (i, indict))
with open(indict) as df:
for line in df:
dic.add(l... | bin3/toynlp | script/merge_dict_files.py | Python | apache-2.0 | 922 | 0.019523 |
"""SmartFactory code generator base.
Base of code generator for SmartFactory that provides SmartSchema object in
accordance with given internal model.
"""
# pylint: disable=W0402
# pylint: disable=C0302
import codecs
import collections
import os
import string
import uuid
from generator import Model
class GenerateE... | Luxoft/SDLP2 | SDL_Core/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py | Python | lgpl-2.1 | 63,295 | 0.000063 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-08-21 07:22
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0012_auto_20170820_2355'),
]
operations = [
migrations.AddField(
... | prajnamort/LambdaOJ2 | main/migrations/0013_auto_20170821_1522.py | Python | mit | 719 | 0.001473 |
#!/usr/bin/env python3
#-
# Copyright (c) 2006 Verdens Gang AS
# Copyright (c) 2006-2015 Varnish Software AS
# All rights reserved.
#
# Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditio... | gauthier-delacroix/Varnish-Cache | lib/libvcc/generate.py | Python | bsd-2-clause | 28,397 | 0.04342 |
# run with: python3 downloadQbitTorrentScripts.py | xargs wget
# then in qbitorrent you can go view -> search engine --> search plugins -> install a new one ->
# and select the good ones this got
import requests, re
from bs4 import BeautifulSoup
r = requests.get("https://github.com/qbittorrent/search-plugins/wiki/Un... | fullmooninu/tools | downloadQbitTorrentScripts.py | Python | gpl-3.0 | 515 | 0.01165 |
import pytest
def test_sabnzbd_group_exists(host):
assert host.group("sabnzbd").exists
def test_sabnzbd_user_exists(host):
assert host.user("sabnzbd").exists
@pytest.mark.parametrize("dir", [
"/opt/sabnzbd",
"/opt/sabnzbd/.sabnzbd",
"/opt/sabnzbd/incomplete",
"/opt/sabnzbd/complete",
"... | bakie/Belphegor | roles/sabnzbd/molecule/default/tests/test_default.py | Python | mit | 860 | 0 |
#!/usr/bin/env python
#
# Provides simple functionallity to download pdb files using python.
# Returns the path to the downloaded file
import os, urllib2, gzip
def get_pdb(pdb_id):
fname = 'pdb/'+pdb_id+'.pdb'
#check if pdb is present
if os.path.exists(fname):
return fname
#check for pdb dir
if not os.path.ex... | Alicimo/codon_optimality_code | legacy_code/latest_version/get_pdb.py | Python | gpl-2.0 | 730 | 0.050685 |
'''
' configurationGui.py
' Author: Iker Pedrosa
'
' License:
' This file is part of orderedFileCopy.
'
' orderedFileCopy 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 Lice... | ikerexxe/orderedFileCopy | configurationGui.py | Python | gpl-3.0 | 5,243 | 0.051879 |
#! /usr/bin/env python
"""Example of how to send text messages using Twilio
"""
import struct
from twilio.rest import TwilioRestClient
# Find these values at https://twilio.com/user/account
account_sid = "xxxx"
auth_token = "xxxx"
client = TwilioRestClient(account_sid, auth_token)
message = client.messages.create(to=... | eugenekolo/kololib | python/twilio_example.py | Python | mit | 541 | 0.005545 |
from baby_steps import given, then, when
from district42 import represent, schema
def test_list_of_representation():
with given:
sch = schema.list(schema.bool)
with when:
res = represent(sch)
with then:
assert res == "schema.list(schema.bool)"
def test_list_of_values_represent... | nikitanovosibirsk/district42 | tests/list/test_list_of_representation.py | Python | mit | 1,650 | 0 |
from __future__ import absolute_import
from datetime import timedelta
from random import choice
from celery.schedules import crontab
from twitter import oauth_dance, Twitter, TwitterError, OAuth
from ..ext import cache, db
from .models import Status
from .signals import tweetchi_beat, tweetchi_reply
from .utils impo... | klen/tweetchi | base/tweetchi/tweetchi.py | Python | bsd-3-clause | 8,042 | 0.00087 |
# -*- coding: utf-8 -*-
import sys
import os
path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'web2py')
sys.path = [path] + [p for p in sys.path if not p == path]
from gluon.compileapp import compile_application
compile_application(os.path.join(path, 'applications', 'standard'))
compile_application(o... | saturday06/FrameworkBenchmarks | frameworks/Python/web2py/compile_apps.py | Python | bsd-3-clause | 368 | 0.002717 |
from unittest import TestCase
def device1_info(s):
cfg = s.system.config()
a = filter(lambda x: x['name'] == 'SyncthingManagerTestDevice1', cfg['devices'])
return a
def folder1_info(s):
cfg = s.system.config()
a = filter(lambda x: x['id'] == 'stmantest1', cfg['folders'])
return a
def test_de... | classicsc/syncthingmanager | syncthingmanager/tests/test_stman.py | Python | gpl-3.0 | 7,370 | 0.006106 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... | google-research/google-research | task_set/tasks/fixed/fixed_mlp_ae_test.py | Python | apache-2.0 | 1,322 | 0.003782 |
# -*- coding: utf-8 -*-
from __future__ import division
from otree.common import Currency as c, currency_range, safe_json
from . import models
from ._builtin import Page, WaitPage
from .models import Constants
class Contribute(Page):
form_model = models.Player
form_fields = ['contribution']
class ResultsWa... | bocchan/costly | public_goods_reg_noise/views.py | Python | bsd-3-clause | 793 | 0.006305 |
# Copyright 2020 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/ops/permutation_gate_test.py | Python | apache-2.0 | 2,986 | 0.001037 |
# -*- coding: utf-8 -*-
"""
=======================================
Brainstorm CTF phantom tutorial dataset
=======================================
Here we compute the evoked from raw for the Brainstorm CTF phantom
tutorial dataset. For comparison, see [1]_ and:
http://neuroimage.usc.edu/brainstorm/Tutorials/Phan... | jaeilepp/mne-python | tutorials/plot_brainstorm_phantom_ctf.py | Python | bsd-3-clause | 4,215 | 0 |
####################################################################################################
#
# PyResistorColorCode - Python Electronic Tools.
# Copyright (C) 2012 Salvaire Fabrice
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as... | FabriceSalvaire/PyResistorColorCode | PyResistorColorCode/ConfigInstall.py | Python | gpl-3.0 | 1,206 | 0.003317 |
# -*- coding: utf-8 -*-
{
'name': 'Woodwerk Customizations',
'description': '''
Odoo Customization for Woodwerk Manufacturing''',
'author': 'ERP Ukraine',
'website': 'https://erp.co.ua',
'support': 'support@erp.co.ua',
'license': 'AGPL-3',
'category': 'Specific Industry Applicatio... | lem8r/woodwerk-addons | woodwerk/__manifest__.py | Python | agpl-3.0 | 936 | 0 |
###############################################################################
##
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## "Redistribution and use in source and binary forms, with or without
## modification, ... | CMUSV-VisTrails/WorkflowRecommendation | vistrails/packages/pythonCalcQt/__init__.py | Python | bsd-3-clause | 2,396 | 0.017947 |
# -*- coding: utf-8 -*-
# Author: Leo Vidarte <http://nerdlabs.com.ar>
#
# This file is part of lai-server.
#
# lai-server 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.
#
# lai-server is distribut... | lvidarte/lai-server | laiserver/client.py | Python | gpl-3.0 | 2,247 | 0.008456 |
# Copyright the Karmabot authors and contributors.
# All rights reserved. See AUTHORS.
#
# This file is part of 'karmabot' and is distributed under the BSD license.
# See LICENSE for more details.
from karmabot.core.facets import Facet
from karmabot.core.commands import CommandSet, thing
import random
predictions = ... | chromakode/karmabot | karmabot/extensions/eightball.py | Python | bsd-3-clause | 1,155 | 0.038095 |
# encoding: utf-8
class Table(object):
def config_db(self, pkg):
tbl = pkg.table('client', name_short='Client', name_long='Client',name_plural='Clients',
pkey='id',rowcaption='company')
tbl.column('id',size='22',group='_',readOnly='y',name_long='Id')
self.sysFiel... | poppogbr/genropy | legacy_packages/develop/model/client.py | Python | lgpl-2.1 | 683 | 0.032211 |
# Copyright 2016 The Eyra Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Eyra-is/Eyra | Backend/server-interface/qc/scripts/create_wrong_prompts/createBadData.py | Python | apache-2.0 | 4,134 | 0.008224 |
#!/usr/bin/python
#
# Copyright 2018-2021 Polyaxon, 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 ... | polyaxon/polyaxon | core/polyaxon/proxies/schemas/streams/base.py | Python | apache-2.0 | 1,940 | 0 |
#Copyright ReportLab Europe Ltd. 2000-2004
#see license.txt for license details
#history http://www.reportlab.co.uk/cgi-bin/viewcvs.cgi/public/reportlab/trunk/reportlab/graphics/charts/markers.py
"""
This modules defines a collection of markers used in charts.
The make* functions return a simple shape or a widget as f... | alexissmirnov/donomo | donomo_archive/lib/reportlab/graphics/charts/markers.py | Python | bsd-3-clause | 1,801 | 0.007218 |
import inspect
import re
def _hook_add(func, add, name=''):
if not hasattr(func, '_hook'):
func._hook = []
func._hook.append(add)
if not hasattr(func, '_filename'):
func._filename = func.func_code.co_filename
if not hasattr(func, '_args'):
argspec = inspect.getargspec(func)
... | Jeebeevee/DouweBot_JJ15 | plugins_org/util/hook.py | Python | unlicense | 2,904 | 0.000344 |
import os
import json
import tempfile
import urllib, urllib2
import requests
from indra.java_vm import autoclass, JavaException
import indra.databases.pmc_client as pmc_client
from processor import ReachProcessor
def process_pmc(pmc_id):
xml_str = pmc_client.get_xml(pmc_id)
with tempfile.NamedTemporaryFile() ... | decarlin/indra | indra/reach/reach_api.py | Python | bsd-2-clause | 3,264 | 0.003064 |
from AmazonSQSMessage import AmazonSQSMessage
class ArchiveJobMessage (AmazonSQSMessage):
"""
Interface for an ArchiveJob message.
"""
def __init__ (self, name = None, bucket = None, destinationBucket = None, filePath = None, destinationPath = None):
"""
Initializes the message and val... | matthappens/taskqueue | taskqueue/ArchiveJobMessage.py | Python | mit | 716 | 0.036313 |
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.contrib import messages
try:
from django.views.decorators.csrf import csrf_e... | domguard/django-admin-tools | admin_tools/menu/views.py | Python | mit | 3,362 | 0.007733 |
#!/usr/bin/env python
# UFO-launcher - A multi-platform virtual machine launcher for the UFO OS
#
# Copyright (c) 2008-2009 Agorabox, Inc.
#
# This 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 versi... | vienin/vlaunch | src/createrawvmdk.py | Python | gpl-2.0 | 3,765 | 0.009296 |
from django_ical.views import ICalFeed
from .models import Meeting
from datetime import timedelta
class MeetingFeed(ICalFeed):
"""
A iCal feed for meetings
"""
product_id = '-//chipy.org//Meeting//EN'
timezone = 'CST'
def items(self):
return Meeting.objects.order_by('-when').all()
... | tanyaschlusser/chipy.org | chipy_org/apps/meetings/feeds.py | Python | mit | 1,268 | 0.003943 |
import _plotly_utils.basevalidators
class WidthValidator(_plotly_utils.basevalidators.NumberValidator):
def __init__(self, plotly_name="width", parent_name="scatter3d.error_x", **kwargs):
super(WidthValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/scatter3d/error_x/_width.py | Python | mit | 438 | 0.002283 |
#!/usr/bin/env python
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | georgecpr/openthread | tests/scripts/thread-cert/Cert_6_1_01_RouterAttach.py | Python | bsd-3-clause | 4,851 | 0.000825 |
# -*- coding: utf-8 -*-
import unittest
import pprint
from media.monitor.config import MMConfig
from media.monitor.exceptions import NoConfigFile, ConfigAccessViolation
pp = pprint.PrettyPrinter(indent=4)
class TestMMConfig(unittest.TestCase):
def setUp(self):
self.real_config = MMConfig("./test_config.c... | martin-craig/Airtime | python_apps/media-monitor2/tests/test_config.py | Python | gpl-3.0 | 876 | 0.01484 |
#!/usr/bin/env python
"""
Simple example for an OpenID consumer.
Once you understand this example you'll know the basics of OpenID
and using the Python OpenID library. You can then move on to more
robust examples, and integrating OpenID into your application.
"""
__copyright__ = 'Copyright 2005-2008, Janrain, Inc.'
f... | necaris/python3-openid | examples/consumer.py | Python | apache-2.0 | 19,199 | 0.000833 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | linvictor88/vse-lbaas-driver | quantum/plugins/services/agent_loadbalancer/drivers/vedge/vselb.py | Python | apache-2.0 | 7,013 | 0.006987 |
import numpy as np
import matplotlib.pyplot as plt
import spm1d
#(0) Load dataset:
dataset = spm1d.data.mv1d.cca.Dorn2012()
y,x = dataset.get_data() #A:slow, B:fast
#(1) Conduct non-parametric test:
np.random.seed(0)
alpha = 0.05
two_tailed = False
snpm = spm1d.stats.nonparam.cca(y, x)... | 0todd0000/spm1d | spm1d/examples/nonparam/1d/ex_cca.py | Python | gpl-3.0 | 860 | 0.038372 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('billing', '0003_auto_20160816_1429'),
... | topaz1874/srvup | src/billing/migrations/0004_usermerchantid.py | Python | mit | 813 | 0.00246 |
from __future__ import print_function, unicode_literals
import site,os
home_dir=os.getenv('HOME')
site.addsitedir('{}/repos/pythonlibs'.format(home_dir))
from pyutils.compat import PY2
from dateutil.parser import parse
import time
import datetime, pytz
from math import floor
def build_rfc3339_phrase(datetime_obj):
... | phaustin/timetable | test_timestamp.py | Python | mit | 3,015 | 0.018905 |
from __future__ import absolute_import, division, print_function
from glue.core import Subset
from glue.external.echo import (CallbackProperty, SelectionCallbackProperty,
delay_callback)
from glue.core.state_objects import StateAttributeLimitsHelper
from glue.core.data_combo_helper impo... | astrofrog/glue-vispy-viewers | glue_vispy_viewers/volume/layer_state.py | Python | bsd-2-clause | 1,889 | 0.001059 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | mbohlool/client-python | kubernetes/test/test_v1beta1_user_info.py | Python | apache-2.0 | 953 | 0.003148 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.