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 |
|---|---|---|---|---|---|---|
import logging
log = logging.getLogger(__name__)
import enaml
from enaml.application import deferred_call
from enaml.workbench.api import Workbench
with enaml.imports():
from enaml.stdlib.message_box import critical
from . import error_style
from psi import set_config
from psi.core.enaml.api import load_mani... | bburan/psiexperiment | psi/experiment/workbench.py | Python | mit | 4,641 | 0.001077 |
import os
import os.path
import traceback
# init JS9 configuration
# js9 source directory
DIRNAME = os.path.dirname(__file__)
JS9_ERROR = os.environ.get("RADIOPADRE_JS9_ERROR") or None
def init_js9():
global radiopadre
import radiopadre
from radiopadre.render import render_status_message
global JS9... | radio-astro/radiopadre | radiopadre/js9/__init__.py | Python | mit | 2,243 | 0.004904 |
#!/usr/bin/python
from json import dumps as jdumps
from sys import stdin, argv
from itertools import count
from pprint import PrettyPrinter
from collections import OrderedDict
def order_dict(keys, d):
return OrderedDict([(k, d[k]) for k in keys])
ENTITY_ORDER = ("model", "pk", "fields")
USER_ORDER = (
"userna... | dan4ik95dv/housemanagement | tsj/fixtures/origins/export_companies.py | Python | mit | 2,898 | 0.002761 |
# Copyright 2015 Jonathan Provost.
#
# 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 wri... | JoProvost/calbum | calbum/sources/exiftool.py | Python | apache-2.0 | 3,192 | 0.000627 |
# -*- coding: utf-8 -*-
"""
carrier
"""
from decimal import Decimal
from suds import WebFault
from trytond.transaction import Transaction
from trytond.pool import PoolMeta, Pool
from trytond.model import fields, ModelView
from trytond.pyson import Eval
from trytond.wizard import Wizard, StateView, Button
from dpd_... | priyankarani/trytond-shipping-dpd | carrier.py | Python | bsd-3-clause | 4,946 | 0.000202 |
# Copyright 2013 NEC Corporation
# 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 ... | cloudbase/lis-tempest | tempest/api/compute/admin/test_simple_tenant_usage_negative.py | Python | apache-2.0 | 2,648 | 0 |
from __future__ import division
from pylab import *
from timeit import timeit
def pe1():
N = 1e6
x = arange(N)
i = argwhere((abs(x%3) < 1e-9) * (abs(x%5) < 1e-9))
def pe10():
N = 2e6
primes = arange(N)
for i in arange(2, sqrt(N)):
j = arange(2, N/i) * i
j = asarray(j, dtype=in... | stsievert/swix | swix/speed/speed.py | Python | mit | 1,179 | 0.017812 |
"""
Progress bar encapsulation
"""
# Copyright (c) Timur Iskhakov.
# Distributed under the terms of the MIT License.
import progressbar
class UIProgressBar:
__widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', progressbar.ETA()]
def __init__(self, message):
"""
:param m... | cs-hse-projects/profanity-filter | profanity_filter/ui_progress_bar.py | Python | mit | 1,153 | 0.001735 |
# Copyright (c) 2012 - 2015 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from collections import OrderedDict
from framework import api_select
def create_jobs(api_type):
g1_components = range(1)
g2_components = range(2)
g3_components = range... | lhupfeldt/jenkinsflow | demo/jobs/calculated_flow_jobs.py | Python | bsd-3-clause | 1,296 | 0.003086 |
from django.contrib import admin
from isi_mip.sciencepaper.models import Paper
admin.site.register(Paper) | bruecksen/isimip | isi_mip/sciencepaper/admin.py | Python | mit | 107 | 0.009346 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
###############################################################################
# chirribackup/storage/Local.py
#
# Local backup storage -- backup is organized in a local folder
#
# -----------------------------------------------------------------------------
# Chirri Bac... | killabytenow/chirribackup | chirribackup/storage/Local.py | Python | gpl-3.0 | 5,284 | 0.006625 |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
class ProjectTemplateTask(Document):
pass
| Zlash65/erpnext | erpnext/projects/doctype/project_template_task/project_template_task.py | Python | gpl-3.0 | 287 | 0.006969 |
#
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Toaster Implementation
#
# Copyright (C) 2014 Intel Corporation
#
# 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
# pub... | Brainbuster/openpli-buildumgebung | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | Python | gpl-2.0 | 14,870 | 0.005783 |
from .archesmixin import ArchesMixin
from .base import BaseModelClass
from .rnamixin import RNASeqMixin
from .vaemixin import VAEMixin
__all__ = ["ArchesMixin", "BaseModelClass", "RNASeqMixin", "VAEMixin"]
| YosefLab/scVI | scvi/core/models/__init__.py | Python | bsd-3-clause | 207 | 0 |
#!/usr/bin/env python3
"""
Setup for root_script.
"""
# core python libaries
import setuptools
# third party libaries
# custom libraries
setuptools.setup()
| craig5/python-samples | root_script/{{cookiecutter.proj_name}}/setup.py | Python | gpl-3.0 | 158 | 0 |
import numpy as np
def weighted_pick(weights):
t = np.cumsum(weights)
s = np.sum(weights)
return(int(np.searchsorted(t, np.random.rand(1)*s)))
def list_to_string(ascii_list):
res = u""
for a in ascii_list:
if a >= 0 and a < 256:
res += unichr(a)
return res
| litoeknee/byteNet-tensorflow | utils.py | Python | mit | 271 | 0.03321 |
"""
Exceptions raised by django-chunked-upload.
"""
class ChunkedUploadError(Exception):
"""
Exception raised if errors in the request/process.
"""
def __init__(self, status, **data):
self.status_code = status
self.data = data
| voidrank/django-chunked-upload | chunked_upload/exceptions.py | Python | mit | 262 | 0 |
# Copyright 2018 The TensorFlow 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 applica... | ghchinoy/tensorflow | tensorflow/python/compiler/tensorrt/test/reshape_transpose_test.py | Python | apache-2.0 | 5,407 | 0.002404 |
# Copyright (C) 2015 ycmd contributors
#
# This file is part of ycmd.
#
# ycmd 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.
#
# ycmd... | indianajohn/ycmd | ycmd/tests/clang/diagnostics_test.py | Python | gpl-3.0 | 7,250 | 0.026207 |
#!/usr/bin/env python
# $Id: $
"""
postgresql.conf configuration file reader
Module contents:
readfile() - Read postgresql.conf file
class gucdict - Container for postgresql.conf settings
class setting - Holds one setting
class ConfigurationError - a subclass of EnvironmentError
Example:
import li... | ysung-pivotal/incubator-hawq | tools/bin/gppylib/pgconf.py | Python | apache-2.0 | 10,433 | 0.001821 |
#!/usr/bin/env python
# encoding: utf-8
import sys
import os
import re
import time
import json
import functools
import requests
from bs4 import BeautifulSoup
import html2text
reload(sys)
sys.setdefaultencoding('utf8')
# global var
_cookies_name = 'cookies.json'
_session = None
_headers = {'Host': 'www.zhihu.com',
... | shirleyChou/zhihu_crawler | zhihu.py | Python | mit | 19,263 | 0.000537 |
'''
Graph representation of the knowledge base
'''
import networkx as nx
import math
import sys
from util import exception
MAXLOGDEG = 'maxlogdeg'
SQRTLOGDEG = 'sqrtlogdeg'
MAX_LEVEL = 5
EQUAL_WEIGHT = 'equal_weight'
LEVEL_WEIGHT = 'level_weight'
EPSILON = sys.float_info.epsilon
class Graph(object):
'''
... | deliarusu/text-annotation | knowledgebase/kbgraph.py | Python | apache-2.0 | 8,665 | 0.013964 |
#!/usr/bin/env python2
# Copyright (c) 2014-2015 The Aureus Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import AureusTestFramework
from test_framework.util import *
def chec... | hideoussquid/aureus-12-bitcore | qa/rpc-tests/getblocktemplate_longpoll.py | Python | mit | 3,620 | 0.005249 |
asd = gwdata.asd(2, 1)
plot = asd.plot(figsize=(8, 6))
plot.add_frequencyseries(rayleigh, newax=True, sharex=plot.axes[0])
asdax, rayax = plot.axes
asdax.set_xlabel('')
asdax.set_xlim(30, 1500)
asdax.set_ylim(5e-24, 1e-21)
asdax.set_ylabel(r'[strain/\rtHz]')
rayax.set_ylim(0, 2)
rayax.set_ylabel('Rayleigh statistic')
a... | gwpy/gwpy.github.io | docs/0.9.0/examples/frequencyseries/rayleigh-3.py | Python | gpl-3.0 | 409 | 0.002445 |
# Copyright 2016 Mycroft AI, Inc.
#
# This file is part of Mycroft Core.
#
# Mycroft Core 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 versio... | JarbasAI/JarbasAI | jarbas_skills/service_client_manager/__init__.py | Python | gpl-3.0 | 21,611 | 0.000555 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | alxgu/ansible | lib/ansible/modules/packaging/os/dpkg_selections.py | Python | gpl-3.0 | 2,174 | 0.00276 |
'''
Wrap a given function into a pool
'''
from multiprocessing import Pool
from itertools import izip, repeat
def pool_process(func, args=None, ncores=1):
def single_input(a):
return func(*a)
# Check for inputs which need to be repeated.
for arg in args:
try:
if len(arg) ==... | e-koch/ewky_scripts | multiprocess.py | Python | mit | 606 | 0.00165 |
#!/usr/bin/env python
import jsonschema
import json
import os
import sys
import os.path as op
import tempfile
import pytest
from argparse import ArgumentParser, RawTextHelpFormatter
from jsonschema import ValidationError
from boutiques.validator import DescriptorValidationError
from boutiques.publisher import ZenodoEr... | boutiques/schema | tools/python/boutiques/bosh.py | Python | gpl-2.0 | 26,811 | 0.000298 |
# encoding: utf-8
import datetime
import os
from pysteam import shortcuts
import paths
from logs import logger
def default_backups_directory():
return os.path.join(paths.application_data_directory(), 'Backups')
def backup_filename(user, timestamp_format):
timestamp = datetime.datetime.now().strftime('%Y%m%d%H... | scottrice/Ice | ice/backups.py | Python | mit | 1,971 | 0.014206 |
import sys
import numpy as np
# sigmoid function
def nonlin(x, deriv=False):
if(deriv==True):
return x*(1-x)
return 1/(1+np.exp(-x))
# input dataset
X = np.array([[0,0,1],
[0,1,1],
[1,0,1],
[1,1,1]])
# output dataset
y = np.array([[0,0,1,1]]).T
#... | jatinmistry13/BasicNeuralNetwork | two_layer_neural_network.py | Python | mit | 877 | 0.023945 |
import copy
from mongoengine.errors import InvalidQueryError
from mongoengine.queryset import transform
__all__ = ('Q',)
class QNodeVisitor(object):
"""Base visitor class for visiting Q-object nodes in a query tree.
"""
def visit_combination(self, combination):
"""Called by QCombination objects... | elioth010/lugama | venv/lib/python2.7/site-packages/mongoengine/queryset/visitor.py | Python | gpl-2.0 | 4,434 | 0 |
# -*- coding: utf-8 -*-
from nose.tools import *
from relshell.record import Record
def test_record_usage():
rec = Record('good evening')
eq_(len(rec), 1)
rec = Record('Hello', 'World')
eq_(len(rec), 2)
rec = Record('lucky', 777, 'number')
eq_(len(rec), 3)
# get column by index
eq_(re... | laysakura/relshell | relshell/test/test_record.py | Python | apache-2.0 | 461 | 0 |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests of directory storage adapter."""
import os
import unittest
import directory_storage
import fake_storage
import gsd_sto... | Lind-Project/native_client | build/directory_storage_test.py | Python | bsd-3-clause | 3,028 | 0.010568 |
# project
from tests.checks.common import AgentCheckTest
Win32_OperatingSystem_attr = {
'BootDevice': "\\Device\\HarddiskVolume1",
'BuildNumber': "9600",
'BuildType': "Multiprocessor Free",
'Caption': "Microsoft Windows Server 2012 R2 Standard Evaluation",
'CodeSet': "1252",
'CountryCode': "1"... | GabrielNicolasAvellaneda/dd-agent | tests/checks/mock/test_wmi_check.py | Python | bsd-3-clause | 6,955 | 0.00115 |
def list_users_in_account(request_ctx, account_id, search_term=None,
include=None, per_page=None, **request_kwargs):
"""
Retrieve the list of users associated with this account.
@example_request
curl https://<canvas>/api/v1/accounts/self/users?search_term=<search value> \
... | penzance/canvas_python_sdk | static_methods/users.py | Python | mit | 2,009 | 0.001991 |
from typing import Any
class Dataset(object):
"""A unit of entities. A dataset is a set of data, sez W3C."""
def __init__(self, name: str, title: str) -> None:
self.name = name
self.title = title
def __eq__(self, other: Any) -> bool:
try:
return not not self.name == o... | pudo/nomenklatura | nomenklatura/dataset.py | Python | mit | 662 | 0 |
import pandas as pd
import numpy as np
import pyaf.ForecastEngine as autof
import pyaf.Bench.TS_datasets as tsds
import logging
import logging.config
#logging.config.fileConfig('logging.conf')
logging.basicConfig(level=logging.INFO)
#get_ipython().magic('matplotlib inline')
b1 = tsds.load_ozone()
df = b1.mPastDa... | antoinecarme/pyaf | tests/neuralnet/test_ozone_rnn_only_LSTM.py | Python | bsd-3-clause | 1,418 | 0.019746 |
#!/usr/bin/env python
import rospy
from basics.msg import Complex
from random import random
rospy.init_node('message_publisher')
pub = rospy.Publisher('complex', Complex)
rate = rospy.Rate(2)
while not rospy.is_shutdown():
msg = Complex()
msg.real = random()
msg.imaginary = random()
pub.publish... | osrf/rosbook | code/basics/src/message_publisher.py | Python | apache-2.0 | 344 | 0.002907 |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this s... | ijat/Hotspot-PUTRA-Auto-login | PyInstaller-3.2/PyInstaller/hooks/hook-wx.lib.activex.py | Python | gpl-3.0 | 571 | 0.005254 |
class KnownUsers:
"""
This deals with both the dedicated server log AND the xml "user" file, as related to the known users.
TODO: refactor this to have a distinct class for the dedicatedLog and the users.xml
"""
def __init__(self, existing_users_filename):
"""Setup init variables parsing t... | mccorkle/seds-utils | KnownUsers.py | Python | gpl-3.0 | 4,260 | 0.004225 |
import unittest
from numericalmethods.vandermonde import *
class TestsVandermonde(unittest.TestCase):
#Test generating Vandermonde matrix
def test_matrix(self):
v = vandermonde_matrix([1,2,3,4])
self.assertEqual(v.tolist(), [[1,1,1,1],[1,2,4,8],[1,3,9,27],[1,4,16,64]])
#Test determin... | RossMeikleham/Numerical-Methods | tests/vandermonde_tests.py | Python | mit | 742 | 0.040431 |
# -*- coding: utf-8 -*-
#
# Baobab documentation build configuration file, created by
# sphinx-quickstart on Tue Dec 7 00:44:28 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | riquito/Baobab | doc/source/conf.py | Python | apache-2.0 | 7,266 | 0.006744 |
import copy
import numpy as np
from chainer import reporter
import chainer.training.extensions
from chainercv.evaluations import eval_instance_segmentation_coco
from chainercv.utils import apply_to_iterator
try:
import pycocotools.coco # NOQA
_available = True
except ImportError:
_available = False
cl... | chainer/chainercv | chainercv/extensions/evaluator/instance_segmentation_coco_evaluator.py | Python | mit | 7,737 | 0.000258 |
import cPickle as pkl
import networkx as nx
import numpy as np
import os
import scipy.spatial
from ..handler.basics import chunkify
from ..processing.general import single_conn_comp_img
from syconnmp.shared_mem import start_multiprocess_obj, start_multiprocess
from ..handler.compression import VoxelDict, AttributeDict... | StructuralNeurobiologyLab/SyConnFS | syconnfs/representations/segmentation_helper.py | Python | gpl-2.0 | 9,628 | 0.001246 |
# This file has to be run in pure Python mode!
# Imports from the CO𝘕CEPT code
from commons import *
from species import Component
from snapshot import save
# Create stationary, homogeneous matter distribution,
# perturbed with global, stationary sine wave along
# the x-direction.
w = user_params['_w']
ρ0 = user_pa... | jmd-dk/concept | test/fluid_pressure/gen_ic.py | Python | gpl-3.0 | 976 | 0.004171 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, thumbor-community
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
from pyvows import Vows, expect
from tc_shortener.generators.short_generator import Generator
from tc_core.context import Context
from thumbor.config impo... | thumbor-community/shortener | vows/generators/short_generator_vows.py | Python | mit | 1,326 | 0.002262 |
# import module from wsgifref
from wsgiref.simple_server import make_server
# import our application
from hello import application
# create a server,IP NULL, port 8000
httpd = make_server('', 8000, application)
print "Serving HTTP on port 8000..."
# start listening HTTP request
httpd.serve_forever()
| haohaibo/tutorial | python/web-dev/server.py | Python | mit | 303 | 0 |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import time
import subprocess
import sys
try:
import caffeine
except ImportError:
pass
from module.plugins.internal.Addon import Addon, Expose
from module.utils import fs_encode, save_join as fs_join
class Kernel32(object):
ES_AWA... | joberreiter/pyload | module/plugins/hooks/AntiStandby.py | Python | gpl-3.0 | 4,700 | 0.009574 |
# -*- coding: utf-8 -*-
from double_linked import DoubleLinkedList
class Deque(object):
'''Deque is a composition of Double Linked List'''
def __init__(self, input=None):
'''create doubly linked list'''
self.deque = DoubleLinkedList(input)
def append(self, val):
self.deque.appen... | paulsheridan/data-structures | src/deque.py | Python | mit | 964 | 0 |
import npyscreen
import os
import re
import sys
import time
from docker.errors import DockerException
from npyscreen import notify_confirm
from threading import Thread
from vent.api.actions import Action
from vent.api.menu_helpers import MenuHelper
from vent.helpers.meta import Containers
from vent.helpers.meta impor... | lilchurro/vent | vent/menus/main.py | Python | apache-2.0 | 30,458 | 0.000328 |
# -*- coding: utf-8 -*-
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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... | StackStorm/st2 | st2actions/setup.py | Python | apache-2.0 | 1,772 | 0.000564 |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, desc, func
from sqlalchemy.orm import backref
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
from extensions import db, cache
from utils import get_current_time
from constants import USER, USER_ROLE, ... | rtx3/deyun.io | smwds/api/models.py | Python | mit | 8,469 | 0.002634 |
import matplotlib.pyplot as plt
import random
dotList = []
xMax = 100
yMax = 100
for i in range (0,xMax):
y = random.random()*yMax
y = i * 2
bb = [y]
dotList.append(bb)
print dotList
plt.plot(dotList, 'ro')
#plt.axis([0, xMax, 0, yMax])
plt.show()
| dewtx29/python_ann | project/num/c++/testGraph.py | Python | gpl-3.0 | 277 | 0.021661 |
from pip.req import parse_requirements as pip_parse_requirements
from pip.req import InstallRequirement
def is_pypi_requirement(requirement):
return requirement.req and not requirement.link
def parse_requirements(path_to_requirements):
""" Parse requirements
:param path_to_requirements: path/to/require... | 5monkeys/reqlice | reqlice/requirement.py | Python | mit | 926 | 0 |
'''
Created on 17-Feb-2015
@author: Asawari.Vaidya
'''
from PythonNetBanxSDK.common.DomainObject import DomainObject
class Pagination(DomainObject):
'''
classdocs
'''
def __init__(self,obj):
'''
Constructor
'''
# Handler dictionary
handler = dict()
han... | OptimalPayments/Python_SDK | src/PythonNetBanxSDK/CardPayments/Pagination.py | Python | mit | 1,081 | 0.007401 |
from __future__ import absolute_import
import ast
import re
import operator as op
import pyparsing
from ..exceptions import CloudflareSolveError
from . import JavaScriptInterpreter
# ------------------------------------------------------------------------------- #
_OP_MAP = {
ast.Add: op.add,
... | alfa-addon/addon | plugin.video.alfa/lib/cloudscraper/interpreters/native.py | Python | gpl-3.0 | 8,626 | 0.004521 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2016-09-26 08:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import filer.fields.image
class Migration(migrations.Migration):
initial = True
dependencies = [
('cms', '0016_au... | rouxcode/django-cms-plugins | cmsplugins/headers/migrations/0001_initial.py | Python | mit | 2,379 | 0.005885 |
# -*- coding: utf-8 -*-
"""
abouttag.location
Standard about tags for URIs and URLs
Copyright 2010 AUTHORS (see AUTHORS file)
License: MIT, see LICENSE for more information
"""
from abouttag import about
def GEOnet(fli, fni, normalize=False, convention=u'geonet-1'):
"""Usage:
from abou... | njr0/abouttag | abouttag/location.py | Python | mit | 840 | 0 |
"""
WSGI config for keyformproject project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANG... | mostateresnet/keyformproject | keyformproject/wsgi.py | Python | mit | 405 | 0 |
import pytest
from udata import uris
from udata.settings import Defaults
PUBLIC_HOSTS = [
'http://foo.com/blah_blah',
'http://foo.com/blah_blah/',
'http://foo.com/blah_blah_(wikipedia)',
'http://foo.com/blah_blah_(wikipedia)_(again)',
'http://www.example.com/wpstyle/?p=364',
'https://www.exam... | opendatateam/udata | udata/tests/test_uris.py | Python | agpl-3.0 | 8,266 | 0.000122 |
"""
Tables for the account app
"""
from django.contrib.auth import get_user_model
import django_tables2 as tables
from fabric_bolt.core.mixins.tables import ActionsColumn, PaginateTable
class UserListTable(PaginateTable):
"""
Table for displaying users.
"""
actions = ActionsColumn([
{'title... | Xobb/fabric-bolt | src/fabric_bolt/accounts/tables.py | Python | mit | 1,653 | 0.005445 |
# This file is part of Indico.
# Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN).
#
# Indico 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 (a... | nop33/indico | indico/core/db/sqlalchemy/custom/greatest.py | Python | gpl-3.0 | 1,227 | 0.000815 |
"""Gets information about the mesh of a case. Makes no attempt to manipulate
the mesh, because this is better left to the OpenFOAM-utilities"""
from PyFoam.RunDictionary.SolutionDirectory import SolutionDirectory
from PyFoam.RunDictionary.ListFile import ListFile
from PyFoam.Error import PyFoamException
from PyFoam.Ru... | Unofficial-Extend-Project-Mirror/openfoam-extend-Breeder-other-scripting-PyFoam | PyFoam/RunDictionary/MeshInformation.py | Python | gpl-2.0 | 2,537 | 0.016161 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division
from collections import OrderedDict
from decimal import Decimal
import re
import math
import six
from nibble import util, decorators
@decorators.python_2_div_compatible
@decorators.python_2_nonzero_compatible
@six.python_2_unicode_compatible
c... | gebn/nibble | nibble/information.py | Python | mit | 13,259 | 0.000754 |
# encoding: utf8
#
# This file is part of JsQt.
#
# Copyright (C) Arskom Ltd. www.arskom.com.tr
#
# 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 your o... | arskom/JsQt | src/jsqt/il/qt/gui.py | Python | gpl-2.0 | 7,372 | 0.003798 |
import pkgutil
from collections import OrderedDict
import dedupe.variables
import dedupe.variables.base as base
from dedupe.variables.base import MissingDataType
from dedupe.variables.interaction import InteractionType
for _, module, _ in pkgutil.iter_modules(dedupe.variables.__path__,
... | nmiranda/dedupe | dedupe/datamodel.py | Python | mit | 4,180 | 0.010048 |
""" This file contains code for working on lists and dictionaries. """
def moreThanOne(dict, key):
""" Checks if a key in a dictionary has a value more than one.
Arguments:
dict -- the dictionary
key -- the key
Returns:
True if the key exists in the dictionary and the value is at least one, otherwise... | ephracis/hermes | utilities/lists.py | Python | mit | 1,117 | 0.048344 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..utils import WarpPointsToStd
def test_WarpPointsToStd_inputs():
input_map = dict(args=dict(argstr='%s',
),
coord_mm=dict(argstr='-mm',
xor=['coord_vox'],
),
coord_vox=dict(argstr='-vox',
xor=[... | iglpdc/nipype | nipype/interfaces/fsl/tests/test_auto_WarpPointsToStd.py | Python | bsd-3-clause | 1,546 | 0.021992 |
"""
Encapsulate the absence of an object by providing a substitutable
alternative that offers suitable default do nothing behavior.
"""
import abc
class AbstractObject(metaclass=abc.ABCMeta):
"""
Declare the interface for Client's collaborator.
Implement default behavior for the interface common to all c... | zitryss/Design-Patterns-in-Python | behavioral/null_object.py | Python | mit | 965 | 0 |
'''
SPDX-License-Identifier: Apache-2.0
Copyright 2017 Massachusetts Institute of Technology.
'''
from multiprocessing import Process
import threading
import functools
import time
import os
import sys
import signal
import simplejson as json
import zmq
from keylime import config
from keylime import crypto
from keylim... | mit-ll/python-keylime | keylime/revocation_notifier.py | Python | bsd-2-clause | 5,242 | 0.001145 |
#-------------------------------------------------------------------------------
# Name: modulo1
# Purpose:
#
# Author: tasora
#
# Created: 14/02/2012
# Copyright: (c) tasora 2012
# Licence: <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/... | andrewseidl/chrono | src/demos/python/demo_solidworks_irrlicht.py | Python | bsd-3-clause | 2,784 | 0.015445 |
# -*- coding: utf-8 -*-
from scrapy import Spider, Request
from sqlalchemy import create_engine, func
from sqlalchemy.orm import sessionmaker
from datetime import datetime, timedelta
from ..models import LiveTVSite, LiveTVRoom, LiveTVRoomPresent, DAILY_DATE_FORMAT
from ..items import DailyItem
import numpy
import jso... | taogeT/livetv_mining | crawler/gather/daily_spiders/douyu.py | Python | apache-2.0 | 2,933 | 0.002728 |
from model_mommy.mommy import make
from yak.projects.models import Project
def test_accessible_to(me):
my_project = make(Project, owner=me)
their_project = make(Project, team_members=[me])
foreign_project = make(Project)
qs = Project.objects.accessible_to(me)
assert set(qs) == {my_project, their... | megapctr/Yak | tests/projects/querysets.py | Python | mit | 382 | 0 |
from activedirectory import Client, Creds, activate
domain = 'freeadi.org'
creds = Creds(domain)
creds.load()
activate(creds)
client = Client(domain)
users = client.search('(objectClass=user)', scheme='gc')
for dn,attrs in users:
name = attrs['sAMAccountName'][0]
domain = client.domain_name_from_dn(dn)
p... | theatlantic/python-active-directory | tut/tutorial2.py | Python | mit | 356 | 0.002809 |
from __future__ import absolute_import, unicode_literals
from builtins import str
import os
import pytest
import io
from glob import glob
from psd_tools import PSDImage
from psd2svg import psd2svg
FIXTURES = [
p for p in glob(
os.path.join(os.path.dirname(__file__), 'fixtures', '*.psd'))
]
@pytest.ma... | kyamagu/psd2svg | tests/test_convert.py | Python | mit | 1,077 | 0.000929 |
"""Helperfunctions for pagination."""
import collections
import math
from six.moves import http_client
from six.moves.urllib import parse as urlparse
from flask import url_for, current_app
from atilla import exceptions
PageResponse = collections.namedtuple('PageResponse', 'content,count')
def parse_current_page(pa... | paylogic/atilla | atilla/pagination.py | Python | mit | 3,235 | 0.002473 |
# Copyright 2014 Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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 ... | biosustain/optlang | slow_tests/test_miplib_gurobi_interface.py | Python | apache-2.0 | 3,070 | 0.002606 |
# Copyright (c) 2020 Manfred Moitzi
# License: MIT License
from pathlib import Path
from time import perf_counter
import math
from ezdxf.addons import MengerSponge
from ezdxf.addons import r12writer
from ezdxf.render.forms import sphere, circle, translate
DIR = Path("~/Desktop/Outbox").expanduser()
def menger_sponge... | mozman/ezdxf | examples/addons/r12writer.py | Python | mit | 2,030 | 0 |
# Copyright 2015 The TensorFlow 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 applica... | aldian/tensorflow | tensorflow/python/ops/image_ops_impl.py | Python | apache-2.0 | 217,245 | 0.003701 |
'''
argparse.py - this file is part of S3QL.
Copyright © 2008 Nikolaus Rath <Nikolaus@rath.org>
This work can be distributed under the terms of the GNU GPLv3.
This module provides a customized ArgumentParser class. Differences
are:
* a --version argument is added by default
* convenience functions are availabl... | s3ql/main | src/s3ql/parse_args.py | Python | gpl-3.0 | 14,648 | 0.003687 |
STYLES = {
"side_color": "#4C9BB0",
"header_color": "#306B7B",
"header_bg_color": "#E4EEF1",
"text_color": "#272B33"
}
def get_documentation(bean_name, file_path, function_name, function_metadata):
model_doc = dict(STYLES)
model_doc["links"] = [{"href": "go_to_definition", "text": "Go to Definition"}]
model_do... | jcberquist/SublimeText-Lucee | src/modelcompletions/documentation.py | Python | mit | 1,258 | 0.023847 |
"""
VCS Link
########
Copyright (c) 2021 Nordic Semiconductor ASA
SPDX-License-Identifier: Apache-2.0
Introduction
============
This Sphinx extension can be used to obtain the VCS URL for a given Sphinx page.
This is useful, for example, when adding features like "Open on GitHub" on top
of pages. The extension insta... | zephyrproject-rtos/zephyr | doc/_extensions/zephyr/vcs_link.py | Python | apache-2.0 | 2,232 | 0.000896 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_chart_data_labels11.py | Python | bsd-2-clause | 1,503 | 0.000665 |
# Copyright 2011 OpenStack Foundation
# 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 requ... | eharney/nova | nova/tests/api/openstack/compute/test_image_metadata.py | Python | apache-2.0 | 9,569 | 0 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_pitchtools_PitchSegment___min___01():
pitch_segment = pitchtools.PitchSegment([-2, -1.5, 6, 7, -1.5, 7])
assert min(pitch_segment) == NamedPitch(-2) | mscuthbert/abjad | abjad/tools/pitchtools/test/test_pitchtools_PitchSegment___min__.py | Python | gpl-3.0 | 214 | 0.004673 |
import _plotly_utils.basevalidators
class HoverlabelValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="hoverlabel", parent_name="sankey", **kwargs):
super(HoverlabelValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/sankey/_hoverlabel.py | Python | mit | 2,055 | 0.000487 |
# Initialization for oemicroservices.common
__all__ = ('functor', 'util')
| OpenEye-Contrib/OEMicroservices | oemicroservices/common/__init__.py | Python | apache-2.0 | 74 | 0 |
# Copyright 2021 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... | PAIR-code/saliency | saliency/core/grad_cam_test.py | Python | apache-2.0 | 7,486 | 0.002939 |
import theano
import theano.tensor as T
import numpy as np
import matplotlib.pyplot as plt
from lasagne.layers import InputLayer, DenseLayer, ReshapeLayer
import lasagne.layers
import lasagne.nonlinearities
import lasagne.updates
import lasagne.objectives
import lasagne.init
from ntm.layers import NTMLayer
from ntm.m... | snipsco/ntm-lasagne | examples/associative-recall-task.py | Python | mit | 4,480 | 0.00558 |
import os
# Django settings for Storefront project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NA... | CSC301H-Fall2013/JuakStore | Storefront/Storefront/settings.py | Python | mit | 5,847 | 0.001197 |
"""
Django settings for pinned project.
Generated by 'django-admin startproject' using Django 1.11.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | LorenzSelv/pinned | pinned/settings.py | Python | mit | 5,525 | 0.001448 |
import glob
import numpy as np
import pandas as pd
from numpy import nan
import os
os.chdir("/gpfs/commons/home/biederstedte-934/evan_projects/RRBS_anno_clean")
repeats = pd.read_csv("repeats_hg19.csv")
annofiles = glob.glob("RRBS_NormalBCD19pCD27mcell23_44_GTAGAGGA.A*")
def between_range(row):
subset = repeats.... | evanbiederstedt/RRBSfun | scripts/repeat_finder_scripts/repeat_finder_RRBS_NormalBCD19pCD27mcell23_44_GTAGAGGA.A.py | Python | mit | 706 | 0.009915 |
# Chris Bugg
# 10/1/14
# NOTE: Runs on Python 2.7.6
# UPDATE:
# 10/10/14
# -> Now runs with 8 sub-processes using
# the [a-z,A-Z,0-9] alphabet
#
# 10/12/2014 UPDATE: Ubuntu 14.04, OS X, and Windows 7 have commited to this project by Chris H
# Ubuntu GUI ran 1.71 million hashe... | COCS4950G7/COSC4950 | Source/demoCrack3.py | Python | gpl-3.0 | 6,305 | 0.005234 |
try:
from django.conf.urls import patterns, url
except ImportError:
from django.conf.urls.defaults import patterns, url
from django.conf import settings
urlpatterns = patterns(
'django_facebook.views',
url(r'^connect/$', 'connect', name='facebook_connect'),
url(r'^disconnect/$',
'disconnect... | michaelBenin/Django-facebook | django_facebook/urls.py | Python | bsd-3-clause | 2,316 | 0.000864 |
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.views.generic import View
from .models import \
Course, Registration, Task, TaskSubmission, ScoreProfile
from .forms import TaskSubmissionForm
class Course... | iver56/trondheim.kodeklubben.no | backend/wsgi/courses/views.py | Python | gpl-3.0 | 4,033 | 0 |
# -*- coding: utf-8 -*-
from impl import *
| ibelikov/jimmy | jimmy/modules/throttle/__init__.py | Python | apache-2.0 | 43 | 0 |
from __future__ import unicode_literals
from django.contrib.admin.util import label_for_field
from .utils import AppTestCase
from .testapp.models import SimpleModel, ConcreteModel, AbstractModel
class AdminTests(AppTestCase):
"""
Test admin features
"""
def test_list_label(self):
# Ensure mod... | ellmetha/django-parler | parler/tests/test_admin.py | Python | apache-2.0 | 1,318 | 0.00607 |
from social.pipeline.partial import partial
import logging
logger = logging.getLogger(__name__)
@partial
def save_profile(backend, user, response, *args, **kwargs):
print 'test2'
logger(backend)
logger(user)
logger(response)
if backend.name == 'facebook':
print backend
if backend.nam... | ppeczek/Politikon | accounts/pipeline.py | Python | gpl-2.0 | 358 | 0 |
# 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
# distributed unde... | Alzon/senlin | senlin/tests/unit/engine/service/test_triggers.py | Python | apache-2.0 | 13,447 | 0 |
## pythonFlu - Python wrapping for OpenFOAM C++ API
## Copyright (C) 2010- Alexey Petrov
## Copyright (C) 2009-2010 Pebble Bed Modular Reactor (Pty) Limited (PBMR)
##
## 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 F... | alexey4petrov/pythonFlu | Foam/helper.py | Python | gpl-3.0 | 2,152 | 0.032063 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.