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 |
|---|---|---|---|---|---|---|
from setuptools import setup
setup(
name='geovalidation.server',
version='0.5',
long_description="Flask-based server to validate GIS datasets (with prepair and val3dity).",
packages=['geovalidation'],
include_package_data=True,
zip_safe=False,
install_requires=[ 'Flask>=1.1'
,'Jinja2>... | tudelft3d/geovalidation.server | setup.py | Python | gpl-3.0 | 590 | 0.064407 |
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
"""Interactive widgets for the Jupyter notebook.
Provide simple interactive controls in the notebook.
Each Widget corresponds to an object in Python and Javascript,
with controls on the page.
To put a Widget on the p... | sserrot/champion_relationships | venv/Lib/site-packages/ipywidgets/__init__.py | Python | mit | 1,536 | 0.003906 |
import warnings
class DeprecatedCallableStr(str):
do_no_call_in_templates = True
def __new__(cls, value, *args, **kwargs):
return super(DeprecatedCallableStr, cls).__new__(cls, value)
def __init__(self, value, warning, warning_cls):
self.warning, self.warning_cls = warning, warning_cls
... | takeflight/wagtailnews | wagtailnews/deprecation.py | Python | bsd-2-clause | 609 | 0 |
import subprocess, os, sys
from reverseZone_naming import reverseZone_name
from netaddr import *
zone_files_path="/etc/bind/zones"
def remove_reverse_record():
host_name_to_be_removed= sys.argv[1]
reverse_zone_file_name,reverse_zone_name=reverseZone_name()
os.chdir(zone_files_path)
readFiles = open(reverse_zone_f... | anilveeramalli/cloudify-azure-plugin | blueprints/clustered-dns/dns/dns_remove_reverse_record.py | Python | apache-2.0 | 927 | 0.036677 |
#!/usr/bin/env python
###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License... | Ecogenomics/GTDBNCBI | scripts_dev/ncbi_assembly_file_metadata.py | Python | gpl-3.0 | 7,410 | 0.001484 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..compat import compat_urllib_parse_urlparse
from ..utils import (
determine_ext,
int_or_none,
xpath_attr,
xpath_text,
)
class RuutuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ruutu\.fi/video/(... | maleficarium/youtube-dl | youtube_dl/extractor/ruutu.py | Python | unlicense | 4,297 | 0.003495 |
'''
logger_setup.py customizes the app's logging module. Each time an event is
logged the logger checks the level of the event (eg. debug, warning, info...).
If the event is above the approved threshold then it goes through. The handlers
do the same thing; they output to a file/shell if the event level is above their
t... | Kbman99/NetSecShare | app/logger_setup.py | Python | mit | 2,739 | 0.004381 |
# Sample script for use by test_gdb.py
def foo(a, b, c):
bar(a, b, c)
def bar(a, b, c):
baz(a, b, c)
def baz(*args):
id(42)
foo(1, 2, 3)
| firmlyjin/brython | www/tests/unittests/test/gdb_sample.py | Python | bsd-3-clause | 153 | 0.019608 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
import random
import json
from odoo import api, models, fields, _
from odoo.addons.http_routing.models.ir_http import slug
from odoo.tools.translate import html_translate
from odoo.tools im... | ddico/odoo | addons/website_blog/models/website_blog.py | Python | agpl-3.0 | 11,694 | 0.002993 |
import asyncio
import datetime
import discord
from discord.ext import commands
import utils
import checks
class Moderation:
"""Moderation commands."""
def __init__(self, bot: commands.Bot):
self.bot = bot
if 'jails' not in self.bot.status:
self.bot.status['jails'] = {}
... | Drowrin/Weeabot | cogs/moderation.py | Python | mit | 5,452 | 0.002018 |
import numpy as np
import cPickle
import math
import string
import re
import subprocess
from datetime import datetime
from cwsm.performance import Performance
def cafferun(params):
# load general and optimization parameters
with open('../tmp/optparams.pkl', 'rb') as f:
paramdescr = cPickle.load(f)
... | mylxiaoyi/caffe-with-spearmint | cwsm/cafferun.py | Python | mit | 3,964 | 0.00555 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-10 04:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0002_auto_20160810_0134'),
]
operations = [
migrations.RemoveField... | zhangvs1988/zhangyl-Djangodemo | article/migrations/0003_auto_20160810_1219.py | Python | gpl-3.0 | 806 | 0.001253 |
#!/usr/bin/env python2.7
#
# ProFTPD versions - create proftpd versions and dump them into versions.h
#
# Copyright (c) 2015 by Hypsurus
#
#
import sys
# The proftpd versions cycle:
# proftpd-1.3.2rc1
# proftpd-1.3.2rc2
# proftpd-1.3.2rc3
# proftpd-1.3.2rc4
# proftpd-1.3.2
# proftpd-1.3.2a
# proftpd-1.3.2b
# p... | KorayAgaya/ftpmap | tools/proftpd_versions.py | Python | gpl-3.0 | 1,228 | 0.012215 |
# importing anything from analysis segfaults java with netlogo on a mac
# for now no clue why
#
from . import pairs_plotting
from .b_and_w_plotting import set_fig_to_bw
from .cart import setup_cart, CART
from .feature_scoring import (get_ex_feature_scores, get_feature_scores_all,
get_rf_f... | quaquel/EMAworkbench | ema_workbench/analysis/__init__.py | Python | bsd-3-clause | 682 | 0 |
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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 version 3 of the License, or
# (at your option) an... | thaim/ansible | lib/ansible/utils/path.py | Python | mit | 5,225 | 0.002679 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## ... | NikolaYolov/invenio_backup | modules/bibformat/lib/elements/bfe_editors.py | Python | gpl-2.0 | 2,179 | 0.010555 |
# -*- coding: utf-8 -*-
from django import VERSION
from django.db.models import F
from django.db.models.fields import FieldDoesNotExist
from django.db.models.query_utils import Q
from django.db.models.sql.constants import QUERY_TERMS
from django.db.models.sql.query import Query
from moneyed import Money
from .._compa... | rescale/django-money | djmoney/models/managers.py | Python | bsd-3-clause | 9,316 | 0.001073 |
# 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-mgmt-devtestlabs/azure/mgmt/devtestlabs/models/shared_public_ip_address_configuration_fragment.py | Python | mit | 1,084 | 0.000923 |
#!/usr/bin/python
"""
Copyright 2012 Paul Willworth <ioscode@gmail.com>
This file is part of Galaxy Harvester.
Galaxy Harvester is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of th... | clreinki/GalaxyHarvester | waypointMaps.py | Python | agpl-3.0 | 2,719 | 0.013608 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from django.core.urlresolvers import reverse
from s... | suutari/shoop | shuup_tests/admin/test_home.py | Python | agpl-3.0 | 3,871 | 0.001033 |
#! /usr/bin/python
try:
import requirements
except ImportError:
pass
import time
import random
import logging
import sys
import os
import inspect
from optparse import OptionParser
import tp.client.threads
from tp.netlib.client import url2bits
from tp.netlib import Connection
from tp.netlib import failed, constant... | thousandparsec/daneel-ai | daneel-ai.py | Python | gpl-2.0 | 9,338 | 0.019383 |
import ldap
def extruct_group(fqdn):
return fqdn.split(',')[0].replace('CN=', '')
def extruct_group_list(data):
groups = []
for fqdn in data:
groups.append(extruct_group(fqdn).lower())
return groups
def get_user_info(
ldap_domain,
ldap_tree_scoupe,
user_name,
... | lexsos/heligate | dj-server/apps/accounts_web/auth_ldap.py | Python | gpl-3.0 | 2,203 | 0.00227 |
from __future__ import (
absolute_import,
division,
print_function,
unicode_literals,
)
import os
import socket
import subprocess
import sys
import core
from core import logger, version_check, APP_FILENAME, SYS_ARGV
if os.name == 'nt':
from win32event import CreateMutex
from win32api import C... | clinton-hall/nzbToMedia | core/utils/processes.py | Python | gpl-3.0 | 3,534 | 0.001132 |
from mws.parsers.base import first_element, BaseElementWrapper, BaseResponseMixin
from mws._mws import InboundShipments
namespaces = {
'a': 'http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/'
}
class Member(BaseElementWrapper):
def __init__(self, element):
BaseElementWrapper.__init__(... | ziplokk1/python-amazon-mws | mws/parsers/fulfillment/listinboundshipmentitems.py | Python | unlicense | 2,481 | 0.006046 |
#!/usr/bin/env vpython
# Copyright 2020 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
import logging
import sys
import unittest
import test_env
test_env.setup_test_env()
from proto import realms_config_pb2
f... | luci/luci-py | appengine/auth_service/realms/permissions_test.py | Python | apache-2.0 | 3,254 | 0.008297 |
"""List A users permissions."""
import click
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.CLI import helpers
@click.command()
@click.argument('identifier')
@environment.pass_env
def cli(env, identifier):
"""User Permissions. TODO change to list all pe... | kyubifire/softlayer-python | SoftLayer/CLI/user/permissions.py | Python | mit | 1,893 | 0.001585 |
from . import models
from . import lroe
| factorlibre/l10n-spain | l10n_es_ticketbai_api_batuz/__init__.py | Python | agpl-3.0 | 40 | 0 |
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | DataDog/sensei | clients/python/sensei/sensei_components.py | Python | apache-2.0 | 35,124 | 0.017082 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-07-05 21:26
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('legislative', '0001_initial'),
]
operations = [
migrations.AlterField(
... | access-missouri/am-django-project | am/legislative/migrations/0002_auto_20170705_2126.py | Python | bsd-2-clause | 1,234 | 0.003241 |
# -*- coding: UTF-8 -*-
from datetime import datetime
from threading import Timer
from queue import Queue
import uuid
import logging
#Fallbacl for python < 3.3
try:
from time import perf_counter
except ImportError:
from time import clock as perf_counter
log = logging.getLogger(__name__)
class _Task:
_proc... | weddige/moneypenny | pywcl/scheduler/__init__.py | Python | mit | 3,088 | 0.003886 |
# -*- 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):
db.rename_column('django_mailbox_message', 'from_address', 'address')
db.rename_column('django_mailbox_messa... | leifurhauks/django-mailbox | django_mailbox/south_migrations/0005_rename_fields.py | Python | mit | 1,958 | 0.005618 |
"""Thorlabs DCx series cameras
Drivers for Windows and Linux can be downloaded from Thorlabs__.
__ http://www.thorlabs.de/software_pages/viewsoftwarepage.cfm?code=DCx
Python implementation of ueye interface: https://github.com/bernardokyotoku/pydcu
"""
from __future__ import print_function
import sys
import ctypes... | mivade/qCamera | qcamera/thorlabs_dcx.py | Python | bsd-2-clause | 8,844 | 0.004636 |
# Copyright 2013 NTT Data
# 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 appl... | sebrandon1/tempest | tempest/api/compute/admin/test_security_groups.py | Python | apache-2.0 | 3,588 | 0 |
# pylint: disable=no-init
# pylint: disable=old-style-class
# pylint: disable=too-few-public-methods
"""
Database ORM models managed by this Django app
Please do not integrate directly with these models!!! This app currently
offers two APIs -- api.py for direct Python integration and receivers.py,
which leverages Djan... | GbalsaC/bitnamiP | venv/src/edx-milestones/milestones/models.py | Python | agpl-3.0 | 5,901 | 0.000508 |
import numpy as np
import pytoolkit as tk
def test_print_classification_multi():
y_true = np.array([0, 1, 1, 1, 2])
prob_pred = np.array(
[
[0.75, 0.00, 0.25],
[0.25, 0.75, 0.00],
[0.25, 0.75, 0.00],
[0.25, 0.00, 0.75],
[0.25, 0.75, 0.00],
... | ak110/pytoolkit | pytoolkit/evaluations/classification_test.py | Python | mit | 808 | 0.001238 |
import json
import os
import unittest
class ParserTest(unittest.TestCase):
def build_mock_report(self, report):
path = os.path.join(os.path.dirname(__file__), 'test_data', report) + '.json'
path = os.path.abspath(path)
with open(path) as f:
return json.load(f)
| cghall/salesforce-reporting | test/common.py | Python | mit | 304 | 0.003289 |
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-
'''
Copyright 2014-2015 Teppo Perä
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
Un... | justanr/py3traits | src/pytraits/core/singleton.py | Python | apache-2.0 | 2,036 | 0.000491 |
from collections import defaultdict
from six import iteritems
def invert_mapping(mapping):
""" Invert a mapping dictionary
Parameters
----------
mapping: dict
Returns
-------
"""
inverted_mapping = defaultdict(list)
for key, value in mapping.items():
if isinstance(value,... | JuBra/GEMEditor | GEMEditor/base/functions.py | Python | gpl-3.0 | 8,494 | 0.000706 |
import _plotly_utils.basevalidators
class LowsrcValidator(_plotly_utils.basevalidators.SrcValidator):
def __init__(self, plotly_name="lowsrc", parent_name="ohlc", **kwargs):
super(LowsrcValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_ty... | plotly/python-api | packages/python/plotly/plotly/validators/ohlc/_lowsrc.py | Python | mit | 432 | 0 |
import os
from chainer import serializers
from chainer import utils
def save_and_load(src, dst, filename, saver, loader):
"""Saves ``src`` and loads it to ``dst`` using a de/serializer.
This function simply runs a serialization and deserialization to check if
the serialization code is correctly implemen... | rezoo/chainer | chainer/testing/serializer.py | Python | mit | 1,562 | 0 |
# -*- coding: utf-8 -*-
# Copyright 2017 Chris Meyers <cmeyers@ansible.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 version 3 of the License, or
# (... | tedelhourani/ansible | test/units/plugins/inventory/test_script.py | Python | gpl-3.0 | 4,169 | 0.002883 |
# Copyright 2014 OpenStack Foundation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | paramite/blazar | climate/db/migration/alembic_migrations/versions/23d6240b51b2_add_status_to_leases.py | Python | apache-2.0 | 1,737 | 0.001151 |
#!/usr/bin/env python
#
# Examples from the talk:
# Sameer Ajmani - Advanced Go Concurrency Patterns - Google I/O 2013
# https://www.youtube.com/watch?v=QDDwwePbDtw
# https://code.google.com/p/go/source/browse/2013/advconc?repo=talks
import argparse
import collections
import random
import threading
import time
f... | stuglaser/pychan | examples/ajmani-adv-patt.py | Python | bsd-3-clause | 4,939 | 0.00081 |
# Parts of this file were derived from the setup.py file of scikit-image
# scikit-image license can be found at
# https://github.com/scikit-image/scikit-image/blob/master/LICENSE.txt
from setuptools import setup, find_packages
with open('requirements.txt') as f:
INSTALL_REQUIRES = [l.strip() for l in f.readlines(... | fredo-editor/FreDo | setup.py | Python | bsd-3-clause | 684 | 0.001462 |
"""
Tests for the Certificate REST APIs.
"""
from django.core.urlresolvers import reverse
from rest_framework import status
from rest_framework.test import APITestCase
from certificates.models import CertificateStatuses
from certificates.tests.factories import GeneratedCertificateFactory
from course_modes.models impor... | 10clouds/edx-platform | lms/djangoapps/certificates/apis/v0/tests/test_views.py | Python | agpl-3.0 | 4,367 | 0.000687 |
# -*- coding: utf-8 -*-
"""
Dual Relay Plugin
Copyright (C) 2011-2012 Olaf Lüke <olaf@tinkerforge.com>
Copyright (C) 2014 Matthias Bolte <matthias@tinkerforge.com>
dual_relay.py: Dual Relay Plugin Implementation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General... | Tinkerforge/brickv | src/brickv/plugin_system/plugins/dual_relay/dual_relay.py | Python | gpl-2.0 | 5,730 | 0.001396 |
# img
# trigger = attributes[12]
# http://ws-tcg.com/en/cardlist
# edit
import os
import requests
import sqlite3
def get_card(browser):
attributes = browser.find_elements_by_xpath('//table[@class="status"]/tbody/tr/td')
image = attributes[0].find_element_by_xpath('./img').get_attribute('src')
if attri... | electronicdaisy/WeissSchwarzTCGDatabase | card.py | Python | mit | 3,176 | 0.004094 |
"""
# TODO
"""
import os
import sys
from time import sleep
from subprocess import Popen
from random import choice, randrange
PRETTY = '--pretty' in sys.argv
class Tiqqun:
words = {
"things_we_like": [
"rupture", "insurrection", "crisis", "social war",
"zones of indistinction which ... | tehpwny/insurrection_bot | insurrection_bot.py | Python | gpl-3.0 | 9,673 | 0.002791 |
"""
Since the NOAAPort feed of HRRR data does not have radiation, we should
download this manually from NCEP
Run at 40 AFTER for the previous hour
"""
import subprocess
import sys
import datetime
import tempfile
import os
import requests
import pygrib
from pyiem.util import exponential_backoff, logger, utc
LOG = ... | akrherz/iem | scripts/dl/download_hrrr.py | Python | mit | 3,606 | 0 |
#! /usr/bin/python
#Copyright 2010, Meka Robotics
#All rights reserved.
#http://mekabot.com
#Redistribution and use in source and binary forms, with or without
#modification, are permitted.
#THIS SOFTWARE IS PROVIDED BY THE Copyright HOLDERS AND CONTRIBUTORS
#"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDI... | CentralLabFacilities/m3meka | python/scripts/demo/m3_demo_behaviors.py | Python | mit | 2,341 | 0.026057 |
# -*- coding: utf-8 -*-
"""
brickv (Brick Viewer)
Copyright (C) 2019 Matthias Bolte <matthias@tinkerforge.com>
mac_pasteboard_mime_fixed.py: Don't add UTF BOM when copying text to the clipboard
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as... | Tinkerforge/brickv | src/brickv/mac_pasteboard_mime_fixed.py | Python | gpl-2.0 | 2,660 | 0.001128 |
'''
StringUtils.py
Provides methods that ease complex python string operations
Copyright (C) 2013 Timothy Edmund Crosley
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; eit... | timothycrosley/WebBot | instant_templates/update_webbot_appengine/WebElements/StringUtils.py | Python | gpl-2.0 | 7,945 | 0.00365 |
from settings.common import Common
class Dev(Common):
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'ffrpg.sql', # Or path to database file if using sqlite3.
#... | Critical-Impact/ffrpg-gen | django/settings/dev.py | Python | mit | 650 | 0.013846 |
# Copyright (c) 2009,2016 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""A collection of general purpose tools for reading files."""
from __future__ import print_function
import bz2
from collections import namedtuple
import gzip
import logging
f... | jrleeman/MetPy | metpy/io/_tools.py | Python | bsd-3-clause | 13,290 | 0.001204 |
import tests.perf.test_cycles_full_long_long as gen
gen.test_nbrows_cycle(11000 , 440)
| antoinecarme/pyaf | tests/perf/test_long_cycles_nbrows_cycle_length_11000_440.py | Python | bsd-3-clause | 89 | 0.022472 |
"""
Server Technology Power Strips
"""
from basicpowerstrip import BasicPowerStrip
from clusto.drivers.devices.common import IPMixin, SNMPMixin
from clusto.drivers.resourcemanagers import IPManager
from clusto.exceptions import DriverException
import re
class PowerTowerXM(BasicPowerStrip, IPMixin, SNMPMixin):
... | rongoro/clusto | src/clusto/drivers/devices/powerstrips/servertech.py | Python | bsd-3-clause | 4,454 | 0.021105 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... | GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/astroid/tests/unittest_inference.py | Python | agpl-3.0 | 59,256 | 0.002582 |
"""
File: base.py
Author: Me
Email: yourname@email.com
Github: https://github.com/yourname
Description:
"""
from datetime import timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from django.utils.crypto import get_... | elastic7327/django-tdd-restful-api | src/posts/tests/base.py | Python | mit | 1,621 | 0 |
from collections import deque
class onetimequeue(object):
def __init__ (self):
self._q = deque()
self._seen = set()
def push(self, obj):
if obj in self._seen:
return
self._seen.add(obj)
self._q.append(obj)
def pop(self):
return self._q.popleft()
def __len__(self):
return ... | bniemczyk/symbolic | symath/datastructures/onetimequeue.py | Python | bsd-2-clause | 333 | 0.021021 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 1024 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 7, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 12); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingMedian/cycle_7/ar_12/test_artificial_1024_Logit_MovingMedian_7_12_100.py | Python | bsd-3-clause | 266 | 0.086466 |
# Copyright (C) 2011-2012 CRS4.
#
# This file is part of Seal.
#
# Seal 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.
#
# Seal is dis... | crs4/seal | tests/tseal/seqal/test_reducer.py | Python | gpl-3.0 | 23,258 | 0.008814 |
from django.test import TestCase
from django.contrib.auth.models import User
from dixit import settings
from dixit.game.models.game import Game
from dixit.game.models.player import Player
from dixit.game.models.round import Round, RoundStatus, Play
from dixit.game.models.card import Card
from dixit.game.exceptions im... | jminuscula/dixit-online | server/src/dixit/game/test/round.py | Python | mit | 13,429 | 0.003053 |
#!/usr/bin/python
"""a simple test script"""
from mininet.util import ensureRoot, dumpNodeConnections
from mininet.topo import MinimalTopo, Topo
from mininet.net import Mininet
from time import sleep
#from subprocess import Popen
import subprocess
from time import sleep
class SingleSwitchTopo(Topo):
"Single sw... | kenwith/cs561 | cs561-as1-kenwith/.scratch/foo7.py | Python | gpl-3.0 | 929 | 0.018299 |
#
# Look at a .h5 file from the Palomar 2011 run
#
# Set the environment variable MKID_RAW_PATH to point to the data location
#
# Example use:
#
# $ export MKID_RAW_PATH=/Volumes/data/Palomar2011/Pal20110728
# python palomar-2011.py obs_20110729-151443.h5
import sys, os
import tables
print sys.argv
if (len(sys.argv) ... | bmazin/ARCONS-pipeline | examples/palomar-2011/palomar-2011.py | Python | gpl-2.0 | 1,501 | 0.009327 |
"""empty message
Revision ID: f719fe7c700a
Revises: b8fa640ec739
Create Date: 2017-02-15 19:55:55.163798
"""
# revision identifiers, used by Alembic.
revision = 'f719fe7c700a'
down_revision = 'b8fa640ec739'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | indonoso/small-Inventory | migrations/versions/f719fe7c700a_.py | Python | mit | 1,179 | 0.005937 |
from django.http import HttpResponse
from django.template import Template, RequestContext
breadcrumb_template_html = Template("""
{% load breadcrumbs %}
{% breadcrumbs %}
""")
def render(request):
"""
Renders a simple template that calls the breadcrumbs templatetag.
"""
context = RequestContext(reques... | sjkingo/django-breadcrumbs3 | breadcrumbs3/tests/views.py | Python | bsd-2-clause | 660 | 0.004545 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | stormi/tsunami | src/primaires/interpreteur/masque/fonctions.py | Python | bsd-3-clause | 2,032 | 0.003457 |
"""
run quality assurance measures on functional data
"""
import sys,glob
sys.path.append('/corral-repl/utexas/poldracklab/software_lonestar/quality-assessment-protocol')
import os
import numpy
from run_shell_cmd import run_shell_cmd
from compute_fd import compute_fd
from qap import load_func,load_image, load_mask, s... | vsoch/myconnectome | myconnectome/qa/run_qap_func.py | Python | mit | 2,129 | 0.053546 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-26 08:11
from __future__ import unicode_literals
from django.db import migrations
import jsonfield.fields
def set_parameter(store, parameter):
"""Add parameter to the specified store."""
app, name = parameter.name.split(".")
if app not in sto... | tonioo/modoboa | modoboa/core/migrations/0010_auto_20161026_1011.py | Python | isc | 1,939 | 0 |
#
# Copyright (C) 2006 Larne Pekowsky
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed... | spxiwh/pycbc-glue | glue/segmentdb/__init__.py | Python | gpl-3.0 | 1,209 | 0.000827 |
# build RF extension
# run in RF
import os
from mojo.extensions import ExtensionBundle
from mojo.UI import createModifier
print("did you update the names?")
#modifier = createModifier(command=True, shift=True)
#print(f"({modifier}, ']')")
# get current folder
basePath = os.path.dirname(__file__)
# folder with pytho... | LettError/glyphBrowser | buildExtension.py | Python | bsd-3-clause | 2,493 | 0.003209 |
"""
Problem Statement
=================
0/1 Knapsack Problem - Given items of certain weights/values and maximum allowed weight how to pick items to pick items
from this set to maximize sum of value of items such that sum of weights is less than or equal to maximum allowed
weight.
Runtime Analysis
----------------
Ti... | mission-peace/interview | python/dynamic/knapsack_01.py | Python | apache-2.0 | 2,542 | 0.003541 |
# File timesqrt.py
import sys, timer2
reps = 10000
repslist = range(reps) # Pull out range list time for 2.6
from math import sqrt # Not math.sqrt: adds attr fetch time
def mathMod():
for i in repslist:
res = sqrt(i)
return res
def powCall():
for i in repslist:
r... | dreadrel/UWF_2014_spring_COP3990C-2507 | notebooks/scripts/book_code/code/timesqrt.py | Python | apache-2.0 | 621 | 0.011272 |
from frappe import _
def get_data():
return {
'heatmap': True,
'heatmap_message': _('This is based on transactions against this Customer. See timeline below for details'),
'fieldname': 'customer',
'transactions': [
{
'label': _('Pre Sales'),
'items': ['Opportunity', 'Quotation']
},
{
'lab... | patilsangram/erpnext | erpnext/selling/doctype/customer/customer_dashboard.py | Python | gpl-3.0 | 679 | 0.050074 |
# Copyright 2013 OpenStack Foundation
# Copyright 2019 Aptira Pty Ltd
# 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/license... | rahulunair/nova | nova/tests/unit/privsep/test_fs.py | Python | apache-2.0 | 15,685 | 0.000191 |
def foo():
for arg in sys.argv[1:]:
try:
f = open(arg, 'r')
except IOError:
print('cannot open', arg)
else:
<selection>length = len(f.readlines()) #<---extract something from here
print("hi from else")</selection>
#anything else you... | smmribeiro/intellij-community | python/testData/refactoring/extractmethod/ElseBody.before.py | Python | apache-2.0 | 325 | 0.024615 |
#!/usr/bin/env python
import json
import dateutil.parser
import datetime
import numpy as np
import calendar
import itertools
from flask import Flask, request, Response, render_template, redirect, url_for
import Uber
app = Flask(__name__)
'''
The index page has links to the from_file API and the from_stream API.
'''... | mksachs/UberCC | uber_API.py | Python | mit | 3,244 | 0.014797 |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | sbc100/yapf | yapf/yapflib/style.py | Python | apache-2.0 | 23,126 | 0.004886 |
# 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 ... | samaitra/kafka | tests/kafkatest/tests/connect_test.py | Python | apache-2.0 | 4,906 | 0.005911 |
# (c) Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
from __future__ import absolute_import, division, print_function
import argparse
from collections impo... | dan-blanchard/conda-build | conda_build/main_metapackage.py | Python | bsd-3-clause | 4,053 | 0.001727 |
import logging
import subprocess
import time
import urllib
import sys
import glob
import os
from multiprocessing import Process
from signal import SIGKILL
try:
from volta.analysis import grab, uploader
except Exception:
raise RuntimeError("Please install volta. https://github.com/yandex-load/volta")
from pkg_... | nnugumanov/yandex-tank | yandextank/plugins/Android/plugin.py | Python | lgpl-2.1 | 7,170 | 0.001534 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-05-03 02:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('commtrack', '0005_populate_config_models'),
]
operations = [
migrations.RemoveFiel... | dimagi/commcare-hq | corehq/apps/commtrack/migrations/0006_remove_sqlcommtrackconfig_couch_id.py | Python | bsd-3-clause | 414 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.11 on 2017-04-07 09:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization_network', '0098_producerdata'),
]
operations = [
migrations.Ad... | Ircam-Web/mezzanine-organization | organization/network/migrations/0099_organization_validation_status.py | Python | agpl-3.0 | 585 | 0.001709 |
# encoding: 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 model 'StoryRelation'
db.create_table('storybase_story_storyrelation', (
('id', self.... | denverfoundation/storybase | apps/storybase_story/migrations/0030_auto__add_storyrelation__add_field_storytranslation_connected_prompt__.py | Python | mit | 29,792 | 0.007452 |
# -*- coding: utf-8 -*-
'''
Phoenix Add-on
Copyright (C) 2015 Blazetamer
Copyright (C) 2015 lambda
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 Lic... | dr4g0nsr/phoenix-kodi-addon | plugin.video.phstreams/default.py | Python | gpl-2.0 | 5,936 | 0.003706 |
# Copyright (c) 2020, Manfred Moitzi
# License: MIT License
import pytest
from ezdxf.entities import factory
from ezdxf.render.forms import square, translate
from ezdxf.lldxf import const
from ezdxf.addons import geo
shapely_geometry = pytest.importorskip("shapely.geometry")
def test_shapely_geo_interface():
p... | mozman/ezdxf | integration_tests/test_geo.py | Python | mit | 1,836 | 0 |
import unittest
import random
import sys
import os
ETEPATH = os.path.abspath(os.path.split(os.path.realpath(__file__))[0]+'/../')
sys.path.insert(0, ETEPATH)
from ete2 import Tree, TreeStyle, NodeStyle, PhyloTree, faces, random_color
from ete2.treeview.faces import *
from ete2.treeview.main import _NODE_TYPE_CHECKER,... | fw1121/ete | test/test_treeview.py | Python | gpl-3.0 | 5,124 | 0.003708 |
from .parseStateProtoFile import *
from .StateTreeModel import *
| poobalan-arumugam/stateproto | src/extensions/lang/python/reader/__init__.py | Python | bsd-2-clause | 65 | 0 |
import numpy as np
from parakeet import jit, testing_helpers
@jit
def true_divided(x):
return True / x
def test_true_divided_bool():
testing_helpers.expect(true_divided, [True], True)
def test_true_divided_int():
testing_helpers.expect(true_divided, [1], 1)
testing_helpers.expect(true_divided, [2]... | pombredanne/parakeet | test/core_language/test_div_bool.py | Python | bsd-3-clause | 679 | 0.013255 |
from django.db import models
class ProductionDatasetsExec(models.Model):
name = models.CharField(max_length=200, db_column='NAME', primary_key=True)
taskid = models.DecimalField(decimal_places=0, max_digits=10, db_column='TASK_ID', null=False, default=0)
status = models.CharField(max_length=12, db_column='... | PanDAWMS/panda-bigmon-atlas | atlas/getdatasets/models.py | Python | apache-2.0 | 1,240 | 0.007258 |
import os, os.path
import subprocess
import shutil
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-m", "--make", help="run make clean && make on all files",
action="store_true")
parser.add_argument("-c", "--check", help="run ./check.sh on all files",
... | dikujepsen/OpenTran | v3.0/test/C/run.py | Python | mit | 4,191 | 0.019327 |
import six
#==============================================================================
# https://docs.python.org/2/library/csv.html
#==============================================================================
if six.PY2:
import csv
import codecs
import cStringIO
class UTF8Recoder:
"""... | memee/py-tons | pytons/files.py | Python | mit | 2,232 | 0.000896 |
""" implement internet free/busy vcal extension
very basic just to get something like this running:
BEGIN:VCALENDAR
PRODID:Zimbra-Calendar-Provider
VERSION:2.0
METHOD:PUBLISH
BEGIN:VFREEBUSY
ORGANIZER:mailto:ber201@mozilla.com
DTSTAMP:20140811T130952Z
DTSTART:20140811T130952Z
DTEND:20140812T130952Z
URL:http://zmmbo... | mozfreddyb/room-availability | ifb.py | Python | mpl-2.0 | 882 | 0.013605 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-08-01 07:59
from __future__ import unicode_literals
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import proso.django.models
class Migration(migrations.Migration):
initial = T... | adaptive-learning/proso-apps | proso_models/migrations/0001_initial.py | Python | mit | 11,335 | 0.003882 |
# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | frossigneux/python-kwstandbyclient | kwstandbyclient/client.py | Python | apache-2.0 | 1,371 | 0 |
#
# 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... | spektom/incubator-airflow | tests/providers/qubole/operators/test_qubole_check.py | Python | apache-2.0 | 4,944 | 0.001416 |
"""
A ribbon gallery is like a :class:`ListBox`, but for bitmaps rather than strings.
Description
===========
It displays a collection of bitmaps arranged in a grid and allows the user to
choose one. As there are typically more bitmaps in a gallery than can be displayed
in the space used for a ribbon, a gallery alwa... | garrettcap/Bulletproof-Backup | wx/lib/agw/ribbon/gallery.py | Python | gpl-2.0 | 32,914 | 0.007717 |
#Copyright (c) 2011-2012 Litle & Co.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without
#restriction, including without limitation the rights to use,
#copy, modify, merge, publish, distri... | Rediker-Software/litle-sdk-for-python | litleSdkPythonTest/certification/TestCert4.py | Python | mit | 11,409 | 0.007976 |
"""
Ax_Metrics - MQL Metrics Query Language Parser
------------------------------------------------------------------------------
Author: Dan Kamins <dos at axonchisel dot net>
Copyright (c) 2014 Dan Kamins, AxonChisel.net
"""
# ----------------------------------------------------------------------------
import co... | axonchisel/ax_metrics | py/axonchisel/metrics/foundation/query/mql.py | Python | mit | 11,429 | 0.002362 |
import pytest
def raising_checker(value, system):
from snovault.auditor import AuditFailure
if not value.get('checker1'):
raise AuditFailure('testchecker', 'Missing checker1')
def returning_checker(value, system):
from snovault.auditor import AuditFailure
if not value.get('checker1'):
... | T2DREAM/t2dream-portal | src/encoded/tests/test_auditor.py | Python | mit | 4,492 | 0.002004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.