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 |
|---|---|---|---|---|---|
# #START_LICENSE###########################################################
#
#
# This file is part of the Environment for Tree Exploration program
# (ETE). http://etetoolkit.org
#
# ETE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the... | karrtikr/ete | ete3/tools/phylobuild_lib/task/prottest2.py | Python | gpl-3.0 | 6,445 |
#!/usr/bin/env python3
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the... | FluidityStokes/fluidity | python/fluidity/diagnostics/debug.py | Python | lgpl-2.1 | 3,539 |
# Write a function that takes in a string and returns a new
# string with the letters in reverse order. Assume that the input will always be strings.
#
# Difficulty: easy.
#Below are three examples of different solutions.
def reverse(string):
# change the code below
return string[::-1]
def reverse2(string):... | djangogirlscodecamp/curriculum | lesson_1/solutions/reverse_solution.py | Python | gpl-2.0 | 1,883 |
# Uses followers.json to create dictionary disciples
# disciples is similar to users from getTweeters.py
# it maps followers from follower.json -> unique_integer
# Creates a directed graph of tweeters --> followers
import json
import os.path
import networkx as nx
from networkx import linalg
import matplotlib.pyplot as... | mac389/snappy | genFollowerGraph.py | Python | apache-2.0 | 1,379 |
"""Support for Tile device trackers."""
import logging
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_GPS
from homeassistant.config_entries import SOURCE_IMPORT
from homeassistant.const import CONF_PASSWORD, CONF_USER... | robbiet480/home-assistant | homeassistant/components/tile/device_tracker.py | Python | apache-2.0 | 3,623 |
# -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks.
Runs tasks on answers to course problems to validate that code
paths actually work.
"""
import json
from uuid import uuid4
from itertools import cycle, chain, repeat
from mock import patch, Mock
from nose.plugins.attrib import attr
... | waheedahmed/edx-platform | lms/djangoapps/bulk_email/tests/test_tasks.py | Python | agpl-3.0 | 21,355 |
#!/usr/bin/env python
# Blink the LED on and off every second.
# Based on GrovePi LED blink Example for the Grove LED Socket (http://www.seeedstudio.com/wiki/Grove_-_LED_Socket_Kit)
import time
import RPi.GPIO as GPIO
# Set the pin numbering to the BCM (same as GPIO) numbering format.
GPIO.setmode(GPIO.BCM)
# Assum... | lupyuen/RaspberryPiImage | home/pi/Simple/simple_led_blink.py | Python | apache-2.0 | 1,012 |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.test import TestCase
from nodeshot.core.base.tests import user_fixtures
from nodeshot.ui.default import settings as local_settings
class DefaultUiDjangoTest(TestCase):
fixtures = [
'initial_data.json',
... | sephiroth6/nodeshot | nodeshot/ui/default/tests/django.py | Python | gpl-3.0 | 2,526 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'Project'
db.create_table(u'projects_project', (
... | tehpug/TehPUG | wsgi/projects/migrations/0001_initial.py | Python | gpl-2.0 | 8,523 |
import mock
import unittest
def load_twister():
# Because twister has a config file, we need to pretend that we
# have passed --config as command line option.
import sys
sys.argv=['twister', '--config=/var/www/scraperwiki/uml/uml.cfg']
import twister
return twister
def ensure_can_load_twister(... | rossjones/ScraperWikiX | uml/twister/test/testbasic.py | Python | agpl-3.0 | 964 |
"""
Handler for EditPost
Manages the editing of blog posts
"""
# [START imports]
from myapp.handlers.basehandler import *
from myapp.models.blogposts import *
from myapp.models.comments import *
from myapp.models.likes import *
from myapp.models.user import *
from myapp.tools.decorators import *
from myapp.tools.hcook... | cubiio/fsnd-blog | myapp/handlers/editpost.py | Python | mit | 1,725 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.home),
url(r'^participant/register/?$', views.register),
url(r'^participant/login/?$', views.login),
url(r'participant/profile/edit/?', views.edit_participant),
url(r'^participant/profile/(?P<username>[0-9]{9})/?... | iiitv/hackathon-team-builder | teambuilder/web/urls.py | Python | mit | 409 |
from math import sqrt
def is_prime(x):
for i in xrange(2, int(sqrt(x) + 1)):
if x % i == 0:
return False
return True
def rotate(v):
res = []
u = str(v)
while True:
u = u[1:] + u[0]
w = int(u)
if w == v:
break
res.append(w)
ret... | neutronest/eulerproject-douby | e35/35.py | Python | mit | 586 |
from django.apps import AppConfig
class ViewerConfig(AppConfig):
name = 'viewer'
| denzow/newser | newser/viewer/apps.py | Python | mit | 87 |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 20 09:38:09 2018
@author: rstreet
"""
import os
import sys
cwd = os.getcwd()
sys.path.append(os.path.join(cwd,'..'))
from datetime import datetime, timedelta
import pytz
import obs_monitor
import lco_api_tools
import config_parser
import api_tools
import log_utilities
de... | ytsapras/robonet_site | scripts/update_subrequest_status.py | Python | gpl-2.0 | 3,960 |
# This tests the compilation and execution of the source code generated with
# utilities.codegen. The compilation takes place in a temporary directory that
# is removed after the test. By default the test directory is always removed,
# but this behavior can be changed by setting the environment variable
# SYMPY_TEST_CL... | kaichogami/sympy | sympy/external/tests/test_codegen.py | Python | bsd-3-clause | 11,832 |
import numpy as np
import cv2
import time
import helloworld
def countNonZero(sum, i_j, x_y = None):
if x_y is None:
i = i_j[0]
j = i_j[1]
if i<0 or j<0:
return 0
return sum[i,j]
else:
i = i_j[0]
j = i_j[1]
x = x_y[0]
y = x_y[1]
... | jwilliamn/handwritten | extraction/FormatModel/TestingCornersAlgorithms.py | Python | gpl-3.0 | 1,349 |
from thefuck.utils import for_app
@for_app('ag')
def match(command):
return command.stderr.endswith('run ag with -Q\n')
def get_new_command(command):
return command.script.replace('ag', 'ag -Q', 1)
| mlk/thefuck | thefuck/rules/ag_literal.py | Python | mit | 210 |
import click
import os
import unittest
from app import create_app, db
from app.models import UrlLink
app = create_app(os.getenv('APP_SETTINGS'))
@app.shell_context_processor
def make_shell_context():
return dict(app=app, db=db, UrlLink=UrlLink)
@app.cli.command()
def recreate_db():
click.echo('Recreating ... | Kalenai/url-shortener | manage.py | Python | mit | 672 |
import numpy as np
import pickle
from sklearn.model_selection import KFold
from keras.callbacks import LearningRateScheduler, EarlyStopping
from sklearn.metrics import confusion_matrix, roc_auc_score, roc_curve, matthews_corrcoef
from .data_provider import load_chains, process_chains
from .structure_processor import s... | eliberis/parapred | parapred/evaluation.py | Python | mit | 9,833 |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
out_path):
import os
#import shutil
from genomicode import filelib
... | jefftc/changlab | Betsy/Betsy/modules/is_fastq_folder_compressed.py | Python | mit | 2,504 |
# This file is part of cldoc. cldoc 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the ... | jessevdk/cldoc | cldoc/example.py | Python | gpl-2.0 | 991 |
"""Tests for the update coordinator."""
import asyncio
from datetime import timedelta
import logging
import urllib.error
import aiohttp
import pytest
import requests
from homeassistant.helpers import update_coordinator
from homeassistant.util.dt import utcnow
from tests.async_mock import AsyncMock, Mock
from tests.c... | titilambert/home-assistant | tests/helpers/test_update_coordinator.py | Python | apache-2.0 | 6,586 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2019, 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
DOCUMENTATION = r'''
---
module: bigip_message_routing_r... | F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/plugins/modules/bigip_message_routing_route.py | Python | gpl-3.0 | 15,578 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 Red Hat, Inc.
#
# 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
#... | gptech/ansible | lib/ansible/modules/cloud/ovirt/ovirt_groups.py | Python | gpl-3.0 | 5,352 |
def binarySearch(someList, target):
lo = 0
hi = len(someList)
while lo+1 < hi:
test = (lo + hi) / 2
if someList[test] > target:
hi = test
else:
lo = test
if someList[lo] == target:
return lo
else:
return -1
import random
def quickSort(someList):
listSize = len(someList)
... | KingSpork/sporklib | algorithms/binarySearch.py | Python | unlicense | 670 |
from keyman.interface import app
| sahabi/keyman | main.py | Python | mit | 33 |
# -*- coding: utf-8 -*-
import csv
from datetime import date
import itertools
from operator import itemgetter
import logging
import numpy as np
import allel
logger = logging.getLogger(__name__)
debug = logger.debug
VCF_FIXED_FIELDS = 'CHROM', 'POS', 'ID', 'REF', 'ALT', 'QUAL', 'FILTER', 'INFO'
def normalize_c... | cggh/scikit-allel | allel/io/vcf_write.py | Python | mit | 8,677 |
#!/usr/bin/env python
import os
import sys
import django
from django.core.management import execute_from_command_line
from django.core.wsgi import get_wsgi_application
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
... | django-leonardo/django-leonardo | contrib/django/wsgi.py | Python | bsd-3-clause | 751 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012 Moses Palmér
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any ... | moses-palmer/pubsuf | tools/test-parser.py | Python | gpl-3.0 | 2,977 |
#################
# Configuration #
#################
LISTEN_ADDRESS = '0.0.0.0' # Address where the application listens
LISTEN_PORT = 8080 # Port where the application listens
DEBUG = True # Print debut information
THREADED = True # Use multiple threads to ... | rayvace/tictactoe | config.py | Python | mit | 749 |
"""Tests for the Alexa integration."""
from uuid import uuid4
from homeassistant.core import Context
from homeassistant.components.alexa import config, smart_home
from tests.common import async_mock_service
TEST_URL = "https://api.amazonalexa.com/v3/events"
TEST_TOKEN_URL = "https://api.amazon.com/auth/o2/token"
c... | joopert/home-assistant | tests/components/alexa/__init__.py | Python | apache-2.0 | 5,912 |
from plex.lib.six.moves import urllib_parse as urlparse
from plex_activity.core.helpers import str_format
from pyemitter import Emitter
import logging
import re
log = logging.getLogger(__name__)
LOG_PATTERN = r'^.*?\[\w+\]\s\w+\s-\s{message}$'
REQUEST_HEADER_PATTERN = str_format(LOG_PATTERN, message=r"Request: (\[(?... | dantebarba/docker-media-server | plex/Sub-Zero.bundle/Contents/Libraries/Shared/plex_activity/sources/s_logging/parsers/base.py | Python | gpl-3.0 | 2,992 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s)... | gamesun/CodePorting | ui_mainwindow.py | Python | gpl-3.0 | 4,843 |
"""SCons.Tool.gcc
Tool-specific initialization for MinGW (http://www.mingw.org/)
There 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, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCo... | rwatson/chromium-capsicum | third_party/scons/scons-local/SCons/Tool/mingw.py | Python | bsd-3-clause | 5,783 |
##
# Copyright 2009-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 (htt... | valtandor/easybuild-easyblocks | easybuild/easyblocks/t/tbb.py | Python | gpl-2.0 | 6,330 |
# -*- coding: utf-8 -*-
"""
config
~~~~~~
Provides the flask config options
###########################################################################
# WARNING: if running on a a staging server, you MUST set the 'STAGE' env
# heroku config:set STAGE=true --remote staging
#################... | reubano/amzn-search-api | config.py | Python | mit | 2,039 |
# Copyright (c) 2014 VMware, 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 b... | ramineni/my_congress | congress/tests/datasources/test_ironic_driver.py | Python | apache-2.0 | 8,500 |
#!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from math import sqrt, pi, cos, sin
import random
import time
import espressopp
import logging
from mpi4py import MPI
# set the initial configuratio... | kkreis/espressopp | examples/hierarchical_strategy_for_one-component/reinsertion.py | Python | gpl-3.0 | 11,634 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-10-14 01:45
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('home', '0005_instagrampointofinterest_cached_response'),
... | qpfiffer/blackdog | home/migrations/0006_textpointofinterest.py | Python | gpl-2.0 | 745 |
"""Cloud Storage
:copyright: (c) 2018 by Scott Werner.
:license: MIT, see LICENSE for more details.
"""
import logging
from enum import Enum, unique
from cloudstorage.base import Blob, Container, Driver
from cloudstorage.exceptions import CloudStorageError
from cloudstorage.typed import Drivers
__all__ = [
"Blob... | scottwernervt/cloudstorage | src/cloudstorage/__init__.py | Python | mit | 3,311 |
'''
Created by: Pratik Narola (https://github.com/Pratiknarola)
last modified: 14-10-2019
'''
# A function to sort the given list using Gnome sort
def gnome_sort(arr):
'''
Gnome Sort also called Stupid sort is based on the concept of a Garden Gnome sorting his flower pots.
A garden gnome sorts the flow... | OmkarPathak/pygorithm | pygorithm/sorting/gnome_sort.py | Python | mit | 1,154 |
from copy import copy
from functools import reduce
import numpy as np
import tensorflow as tf
import tensorflow.contrib as tc
from baselines import logger
from baselines.common.mpi_adam import MpiAdam
import baselines.common.tf_util as U
from baselines.common.mpi_running_mean_std import RunningMeanStd
from baselines.... | pcchenxi/baseline | baselines/ddpg/ddpg.py | Python | mit | 17,098 |
import rest_framework
from django.shortcuts import get_object_or_404
from django.utils.http import urlunquote
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import authentication, status
from rest_framework.generics import (
ListAPIView, ListCreateAPIView, RetrieveUpdateDestroyAPI... | openaid-IATI/OIPA | OIPA/api/organisation/views.py | Python | agpl-3.0 | 26,799 |
import sys
from django.core.management.base import BaseCommand
from django.db import transaction
from lily.tenant.models import Tenant
from lily.tenant.utils import create_defaults_for_tenant
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument(
'--tenant',
... | HelloLily/hellolily | lily/management/commands/create_tenant.py | Python | agpl-3.0 | 1,365 |
# -*- coding: utf-8 -*-
# Copyright (C) 2013 Yahoo! Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2... | jimbobhickville/taskflow | taskflow/tests/unit/jobs/test_redis_job.py | Python | apache-2.0 | 3,882 |
import tensorflow as tf
from ocnn import *
# octree-based resnet55
def network_resnet(octree, flags, training=True, reuse=None):
depth = flags.depth
channels = [2048, 1024, 512, 256, 128, 64, 32, 16, 8]
with tf.variable_scope("ocnn_resnet", reuse=reuse):
data = octree_property(octree, property_name="feature... | microsoft/O-CNN | tensorflow/script/network_cls.py | Python | mit | 2,557 |
from collections import namedtuple
class Const(object):
class ConstError(Exception):
pass
def __init__(self, value):
self._value = value
@property
def value(self):
return self._value
if __name__ == '__main__':
c = Const(3)
#c.value = 0
... | henglinyang/Pace | Const.py | Python | bsd-2-clause | 323 |
#!/usr/bin/python3
# coding: utf-8
import os
import sys
import subprocess as sp
if __name__ == "__main__":
if(len(sys.argv) == 1):
print("usage: python", sys.argv[0], "TAGET_DIR", "[N_ARRAY]")
exit(1)
parent_dir = sys.argv[1]
print("TARGET_DIR:", parent_dir)
if(len(sys.argv) > 2):
... | istellartech/OpenTsiolkovsky | tools/mc_all_in_dir.py | Python | mit | 1,669 |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the... | cltrudeau/django-dform | extras/sample_site/sample_site/settings.py | Python | mit | 2,401 |
import sys
import types as types
from PySide import QtGui
from PySide.QtGui import *
from PySide.QtCore import *
from MMutiWidget import MMultiWidget
class MColorView(QWidget):
colorChanged = Signal(list)
def __init__(self, color = None, parent = None):
super(MColorView, self).__init__(parent... | s910324/Sloth | bokehPlotter/BokehGraphEditor/MaterialDesignList/MMuitlSelector.py | Python | lgpl-3.0 | 13,436 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/text/squad_question_generation/__init__.py | Python | apache-2.0 | 767 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2016-2021 Philippe Schmouker, schmouk (at) typee.ovh
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, includi... | schmouk/PyRandLib | PyRandLib/fastrand32.py | Python | mit | 6,798 |
import os, scratchdir
path = None
with scratchdir.ScratchDir() as sd:
tmp = sd.named(delete=False)
path = tmp.name
print('Path {} exists? {}'.format(path, os.path.exists(path)))
print('Path {} exists? {}'.format(path, os.path.exists(path)))
| ahawker/scratchdir | examples/readme/cleanup.py | Python | apache-2.0 | 256 |
from kona.linalg.matrices.hessian.basic import BaseHessian
class ReducedKKTMatrix(BaseHessian):
"""
Reduced approximation of the KKT matrix using a 2nd order adjoint
formulation.
For problems with only equality constraints, the KKT system is given as:
.. math::
\\begin{bmatrix}
\\... | OptimalDesignLab/Kona | src/kona/linalg/matrices/hessian/reduced_kkt.py | Python | lgpl-3.0 | 15,333 |
# Copyright 2019 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, ... | google/jax | jax/_src/nn/initializers.py | Python | apache-2.0 | 21,478 |
"""Miscellaneous functions."""
import os
import logging
import json
import datetime
import semantic_version as sv
import requests
from f8a_worker.utils import get_session_retry
from f8a_worker.defaults import configuration
logger = logging.getLogger(__name__)
GREMLIN_SERVER_URL_REST = "http://{host}:{port}".format(
... | jpopelka/fabric8-analytics-worker | f8a_worker/graphutils.py | Python | gpl-3.0 | 14,687 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright © 2014 deanishe@deanishe.net
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-04-06
#
"""
Run background tasks
"""
from __future__ import print_function, unicode_literals
import sys
import os
import subprocess
import pickle
from workfl... | dalimatt/Instastalk | dependencies/workflow/background.py | Python | mit | 7,361 |
""" This file contains information from sensor manual"""
# maximal and minimal temperature readings
MAX_READING = 0x7FFF
MIN_READING = 0x27AD
def reading2celsius(self, reading):
""" Converts sensor reading to celsius """
celsius = reading / 50 - 273.15
return celsius
| zidik/Thermal_Camera | PC software/mlx90614.py | Python | mit | 282 |
"""
sentry.plugins.base.v1
~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import, print_function
__all__ = ('Plugin',)
import logging
import six
from django.core.urlresolvers import r... | JackDanger/sentry | src/sentry/plugins/base/v1.py | Python | bsd-3-clause | 16,012 |
import os
import unittest
from mi.core.log import get_logger
from mi.dataset.dataset_driver import ParticleDataHandler
from mi.dataset.driver.ctdbp_p.dcl.resource import RESOURCE_PATH
from mi.dataset.driver.flord_g.ctdbp_p.dcl.flord_g_ctdbp_p_dcl_recovered_driver import parse
_author__ = 'jeff roy'
log = get_logger()... | renegelinas/mi-instrument | mi/dataset/driver/flord_g/ctdbp_p/dcl/test/test_flord_g_ctdbp_p_dcl_recovered_driver.py | Python | bsd-2-clause | 893 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-04-23 12:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('indicators', '0006_auto_20180226_0031'),
]
operations = [
migrations.Remove... | open-build/TolaActivity | indicators/migrations/0007_auto_20180423_0516.py | Python | gpl-2.0 | 809 |
# pylint: disable-msg=W0611, W0612, W0511
"""Tests suite for MaskedArray.
Adapted from the original test_ma by Pierre Gerard-Marchant
:author: Pierre Gerard-Marchant
:contact: pierregm_at_uga_dot_edu
:version: $Id: test_extras.py 3473 2007-10-29 15:18:13Z jarrod.millman $
"""
from __future__ import division, absolute... | dwillmer/numpy | numpy/ma/tests/test_extras.py | Python | bsd-3-clause | 51,679 |
import requests
import logging
import json
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
username = 'raphaeld'
url = 'https://' + username + '.cartodb.com/api/v2/sql'
sql = {'q':'SELECT process_data();'}
logger.info('Pinging {url} with query: {sql}'.format(url=url,sql=sql['q']))
res = req... | radumas/bikeways4everybody | data-analysis/process-data-call.py | Python | mit | 537 |
import random
import glob
import numpy as np
import cv2
from scipy.ndimage import imread
IMAGE_WIDTH = IMAGE_HEIGHT = 32
def visualize_image(image, name="Image", resize=False, save_image=False, path=None):
"""Helper function to visualize and save any image"""
image = image.reshape([IMAGE_WIDTH, IMAGE_HEIGHT])
ima... | pandeydivesh15/AVSR-Deep-Speech | util/image_handler.py | Python | gpl-2.0 | 2,105 |
"""
调试器,用于测试时调试执行爬虫
"""
import os
import time
import shutil
from multiprocessing import Process
from ..worker import launcher as worker
from ..scheduler import launcher as scheduler
from ..scheduler.client import HTTPError, Client
from ..common import Logger, FatalError, PickleContainer
from ..worker.common import find... | spencer404/PyLoom | pyloom/debugger/launcher.py | Python | mit | 3,372 |
import bottle
from modules.libs.WSDLWrapper import AuthWSDLWrapper
from bottle import view, static_file, auth_basic
from NaoService import check_auth
app = bottle.Bottle()
name = 'NaoAmt24Module'
path = '/amt24'
sub = []
wsdl = None
@app.route('/')
@app.route('/index.html')
@view('amt24')
@auth_basic(check_auth)
de... | max-leuthaeuser/naoservice | modules/NaoAmt24Module.py | Python | gpl-3.0 | 1,349 |
import codecs
import os
import sys
from setuptools import find_packages, setup
PROJECT_ROOT = os.path.dirname(os.path.realpath(__file__))
README_FILE = os.path.join(PROJECT_ROOT, "README.md")
VERSION_FILE = os.path.join(PROJECT_ROOT, "bambi", "version.py")
REQUIREMENTS_FILE = os.path.join(PROJECT_ROOT, "requirements.... | bambinos/bambi | setup.py | Python | mit | 1,887 |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2012 BigML
#
# 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 b... | ShaguptaS/python | bigml/tests/create_cluster_steps.py | Python | apache-2.0 | 4,240 |
#!/usr/bin/env python3
'''
A fact loader
Copyright 2012-2021 Codinuum Software Lab <https://codinuum.com>
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/li... | codinuum/cca | python/src/cca/ccautil/load_into_virtuoso.py | Python | apache-2.0 | 4,460 |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010-2018 (ita)
"""
Classes and functions enabling the command system
"""
import os, re, imp, sys
from waflib import Utils, Errors, Logs
import waflib.Node
# the following 3 constants are updated on each new release (do not touch)
HEXVERSION=0x2000b00
"""Constan... | blablack/deteriorate-lv2 | waflib/Context.py | Python | gpl-3.0 | 21,029 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
class InvalidTemplate(Exception):
"""There is no template for given extension."""
class AlreadyRegisteredError(Exception):
"""A template for given extension is already been registered."""
| mdalp/reportexport | reportexport/exceptions.py | Python | bsd-3-clause | 281 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('app', '0008_playlistitem_network'),
]
operations = [
migrations.AddField(
model_name='playlistit... | m-vdb/ourplaylists | ourplaylists/app/migrations/0009_playlistitem_created_at.py | Python | mit | 527 |
"""
Django settings for test project for YAK-server
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.j... | yeti/YAK-server | test_project/settings.py | Python | mit | 9,101 |
ROOT_URLCONF = 'tests.urls'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'tests.app',
]
STATIC_URL = '/static/'
SECRET_KEY = 'foobar'
SITE_ID = 1234 # Needed for 1.3 compatibility
| jantman/pytest_django | tests/settings_base.py | Python | bsd-3-clause | 283 |
from ioutils import load_pickle, write_pickle
DIR = "/dfs/scratch0/COHA/decade_freqs/"
word = {}
lemma = {}
lemma_pos = {}
for year in range(1810, 2010, 10):
word[year] = load_pickle(DIR + str(year) + "-word.pkl")
lemma[year] = load_pickle(DIR + str(year) + "-lemma.pkl")
lemma_pos[year] = load_pickle(DIR +... | ruhulsbu/WEAT4TwitterGroups | histwords/coha/combinefreqdicts.py | Python | mit | 475 |
#!/usr/bin/env python
"""
Copyright 2012 GroupDocs.
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... | liosha2007/temporary-groupdocs-python-sdk | groupdocs/models/QuestionnaireExecutionInfo.py | Python | apache-2.0 | 1,774 |
# -*- coding: utf-8 -*-
import datetime
import re
import logging
from scrapy.spiders import CrawlSpider
from scrapy.http import Request, FormRequest, HtmlResponse
# Python 3
import html
import shutil
import os
import json
import codecs
from pydash import strings
from reserve_america.items import ReservationItem, ParkI... | shaoke/reserveamerica | reserve_america/spiders/reserve_california.py | Python | mit | 18,832 |
from __future__ import annotations
import re
import sys
def main():
for path in sys.argv[1:] or sys.stdin.read().splitlines():
with open(path, 'r') as path_fd:
for line, text in enumerate(path_fd.readlines()):
match = re.search(r'(?<! six)\.(itervalues)', text)
... | ansible/ansible | test/lib/ansible_test/_util/controller/sanity/code-smell/no-dict-itervalues.py | Python | gpl-3.0 | 563 |
# -*- coding: utf-8 -*-
# @Author: Michael
# @Date: 2017-01-02 12:30:07
# @Last Modified by: Michael
# @Last Modified time: 2017-01-02 15:32:28
| function-x/Orange-Juice-Problem-Control | tests/test_file_walker.py | Python | mit | 148 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
#
# 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 2 of the License, or
# (at you... | beernarrd/gramps | gramps/gen/utils/test/callback_test.py | Python | gpl-2.0 | 8,780 |
import json
import logging
import inspect
from .decorators import pipeline_functions, register_pipeline
from indra.statements import get_statement_by_name, Statement
logger = logging.getLogger(__name__)
class AssemblyPipeline():
"""An assembly pipeline that runs the specified steps on a given set of
statem... | johnbachman/belpy | indra/pipeline/pipeline.py | Python | mit | 16,687 |
"""Trace file recording operations."""
from threading import Thread
import datetime
import time
from openxc.formats import JsonFormatter
from .queued import QueuedSink
class FileRecorderSink(QueuedSink):
"""A sink to record trace files based on the messages received from all data
sources.
"""
FILENAM... | openxc/openxc-python | openxc/sinks/recorder.py | Python | bsd-3-clause | 1,564 |
print 1 < 2
print 2 > 1
print 1 <= 1
print 2 >= 2
print 1 == 1
print True and True
print True or False
print False or True
print not False
print not False and not False
print not False or False
| buchuki/pyjaco | tests/operator/comparison.py | Python | mit | 195 |
#!/usr/bin/env python
__author__ = "Vivek <vivek.balasubramanian@rutgers.edu>"
__copyright__ = "Copyright 2014, http://radical.rutgers.edu"
__license__ = "MIT"
__example_name__ = "Multiple Simulations Instances, Single Analysis Instance Example (MSSA)"
import sys
import os
import json
from radical.e... | radical-cybertools/ExTASY | examples/generic/multiple_simulations_single_analysis.py | Python | mit | 3,334 |
"""Test that all docs are there."""
from os import path
from unittest import TestCase
def parse_code_headers(md_file_path):
"""Parse all settings names from the markdown."""
import re
all_settings_headers_regex = re.compile(r"###\s\*\*`(\w+)`\*\*.*")
with open(md_file_path) as f:
contents = f.... | niosus/EasyClangComplete | tests/test_docs.py | Python | mit | 1,269 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_04_01/aio/_network_management_client.py | Python | mit | 34,005 |
# 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-compute/azure/mgmt/compute/v2015_06_15/models/instance_view_status_py3.py | Python | mit | 1,758 |
# encoding: utf-8
# module PyKDE4.kdeui
# from /usr/lib/python2.7/dist-packages/PyKDE4/kdeui.so
# by generator 1.135
# no doc
# imports
import PyKDE4.kdecore as __PyKDE4_kdecore
import PyQt4.QtCore as __PyQt4_QtCore
import PyQt4.QtGui as __PyQt4_QtGui
import PyQt4.QtSvg as __PyQt4_QtSvg
class KModifierKeyInfo(__PyQt... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247972723/PyKDE4/kdeui/KModifierKeyInfo.py | Python | gpl-2.0 | 1,593 |
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'db', # Or path to databas... | nvbn/deploy_trigger | deploy_trigger/settings/local_nvbn.py | Python | mit | 1,371 |
from JumpScale9 import j
import time
import libtmux as tmuxp
import os
JSBASE = j.application.jsbase_get_class()
# from .Pane import Pane
from .Session import Session
# from .Window import Window
class Tmux(JSBASE):
def __init__(self):
self.__jslocation__ = "j.tools.tmux"
JSBASE.__init__(self)... | Jumpscale/core9 | JumpScale9/tools/tmux/Tmux.py | Python | apache-2.0 | 3,195 |
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Scapy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# any later version.
#
#... | mtury/scapy | scapy/layers/dot11.py | Python | gpl-2.0 | 44,280 |
input = """
% Reported by Marcello Balduccini <marcello.balduccini@ttu.edu> on 2006-09-18.
h(a,0).
g(c).
g(a).
% rule 1
h(c,1) :- o(2).
% rule 2
goal_f(0) :- g(Lit), not h(Lit,0).
% rule 3
goal_h(0) :- not goal_f(0).
% rule 4
o(1) | k :- not goal_h(0).
"""
output = """
% Reported by Marcello B... | veltri/DLV2 | tests/parser/bug.83.test.py | Python | apache-2.0 | 567 |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from .eGreedy import eGreedy
from .UniformRandom import UniformRandom
from .gibbs import GibbsPolicy... | rlpy/rlpy | rlpy/Policies/__init__.py | Python | bsd-3-clause | 401 |
###########################################################################
# Copyright (C) 2014 Phani Vadrevu #
# pvadrevu@uga.edu #
# #
# Distributed un... | perdisci/amico | amico_scripts/trainer.py | Python | gpl-2.0 | 8,437 |
#!/usr/bin/env python
'''
Interpolates high level financials using basic accounting identities when
those tags are not made explicit in a given xbrl filing
** Note **
This runs prospectively each day after new xbrl filings are downloaded,
parsed and ingested
'''
import argparse
import json
import... | gophronesis/ernest | enrich/modules/xbrl_rss_interpolation.py | Python | apache-2.0 | 4,847 |
# 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-compute/azure/mgmt/compute/compute/compute_management_client.py | Python | mit | 22,323 |
from theano import gof
class TypedListType(gof.Type):
def __init__(self, ttype, depth=0):
"""
:Parameters:
-'ttype' : Type of theano variable this list
will contains, can be another list.
-'depth' : Optionnal parameters, any value
above 0 will creat... | nke001/attention-lvcsr | libs/Theano/theano/typed_list/type.py | Python | mit | 3,880 |
import pika
import json
connection = pika.BlockingConnection(pika.ConnectionParameters(
host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hellos')
topic_msg = {
'topic_id':'123456',
'topic_name' : 'topicA'
}
channel.basic_publish(exchange='',
routing_key=... | FengPu/TIBS | tibs/rabbitmq_test/send.py | Python | gpl-3.0 | 424 |
# fileset.py - file set queries for mercurial
#
# Copyright 2010 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import parser, error, util, merge, re
from i18n import _
elements = {
"(": (20, (... | vmg/hg-stable | mercurial/fileset.py | Python | gpl-2.0 | 14,922 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.