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 |
|---|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-08-09 17:56
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('osf', '0048_merge_20170804_0910'),
]
operations = [
migrations.AddField(
... | mfraezz/osf.io | osf/migrations/0049_preprintprovider_preprint_word.py | Python | apache-2.0 | 579 | 0.001727 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 OpenStack LLC.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/... | NoBodyCam/TftpPxeBootBareMetal | nova/image/glance.py | Python | apache-2.0 | 14,223 | 0.000492 |
class Solution:
def exist(self, board, word):
"""
:type board: List[List[str]]
:type word: str
:rtype: bool
"""
for i in range(0, len(board)):
if not board:
return False
for j in range(0, len(board[0])):
... | MingfeiPan/leetcode | backtracking/79.py | Python | apache-2.0 | 1,039 | 0.010587 |
# -*- coding: utf-8 -*-
"""
webapp2_extras.security
=======================
Security related helpers such as secure password hashing tools and a
random token generator.
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
:co... | ychen820/microblog | y/google-cloud-sdk/platform/google_appengine/lib/webapp2-2.5.2/webapp2_extras/security.py | Python | bsd-3-clause | 6,834 | 0 |
"""Regresssion tests for urllib"""
import urllib
import httplib
import unittest
import os
import sys
import mimetools
import tempfile
import StringIO
from test import test_support
from base64 import b64encode
def hexescape(char):
"""Escape char as RFC 2396 specifies"""
hex_repr = hex(ord(char))[2:].upper()
... | teeple/pns_server | work/install/Python-2.7.4/Lib/test/test_urllib.py | Python | gpl-2.0 | 35,463 | 0.002143 |
from Source import Source
from Components.Element import cached
class List(Source, object):
"""The datasource of a listbox. Currently, the format depends on the used converter. So
if you put a simple string list in here, you need to use a StringList converter, if you are
using a "multi content list styled"-list, you ... | Open-Plus/opgui | lib/python/Components/Sources/List.py | Python | gpl-2.0 | 3,424 | 0.033586 |
# coding:utf-8
from __future__ import absolute_import, unicode_literals
__author__ = "golden"
__date__ = '2017/10/12'
import asyncio
class EchoClientProtocol:
def __init__(self, message, loop):
self.message = message
self.loop = loop
self.transport = None
def connection_made(self, t... | goodking-bq/golden-note | source/_static/socks5_server/udp_c.py | Python | mit | 1,286 | 0.00311 |
### Paper RMSD selections ###
sel = []
sel.append(['a2_subdomain1_backbone','backbone and resid 57:68 and not name H*'])
sel.append(['motif_2_backbone','backbone and resid 117:124 and not name H*'])
sel.append(['aligned_CAs','protein and (resid 20:25 50:55 73:75 90:94 112:116 142:147 165:169 190:194 214:218 236:240 2... | rbdavid/DENV-NS3h | RMSD_analyses/sel_list.py | Python | gpl-3.0 | 529 | 0.020794 |
import sys
import click
import os
import subprocess
from packageinfo import BUILD, VERSION, NAME
if "WM_PROJECT" not in os.environ:
print("To run this command you must source edmenv.sh first")
sys.exit(1)
# The version of the buildcommon to checkout.
BUILDCOMMONS_VERSION="v0.1"
def bootstrap_devenv():
... | simphony/simphony-openfoam | edmsetup.py | Python | gpl-2.0 | 1,743 | 0.001721 |
import time
from bs4 import BeautifulSoup
import sys
if (sys.version_info > (3, 0)):
# Python 3 code in this block
import urllib.request as urllib2
else:
# Python 2 code in this block
import urllib2
import datetime, re, os
class NonNCEPModel:
'''''
Base Class for all Non-NCEP models.
'''''
def __init_... | cacraig/grib-inventory | gribinventory/models/NonNCEPModel.py | Python | mit | 1,819 | 0.018692 |
# Generated by Django 2.0.10 on 2019-01-14 11:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0008_applicationperiod'),
]
operations = [
migrations.AddField(
model_name='applicationperiod',
nam... | hackerspace-ntnu/website | applications/migrations/0009_applicationperiod_name.py | Python | mit | 471 | 0.002123 |
# -*- encoding: utf-8 -*-
from abjad.tools import durationtools
from abjad.tools.datastructuretools.TypedList import TypedList
class CompoundInequality(TypedList):
'''A compound time-relation inequality.
::
>>> compound_inequality = timespantools.CompoundInequality([
... timespantools.Com... | andrewyoung1991/abjad | abjad/tools/timespantools/CompoundInequality.py | Python | gpl-3.0 | 7,680 | 0.002214 |
from mosek.fusion import Model, Domain, Expr, ObjectiveSense
import sys
# TODO: need a way to determine if we're adding something in front of an
# existing clique, or intersecting with it, etc.
# Example 2. Column generation approach.
# Iteration 2, subproblem.
# Output:
#
# Images:
# w_1 = 1
# ... | ryanjoneil/docker-image-construction | ipynb/examples/example2-3-sub.py | Python | mit | 7,365 | 0.003802 |
# -*- coding: utf-8 -*-
'''
Management of LVS (Linux Virtual Server) Real Server
====================================================
'''
def __virtual__():
'''
Only load if the lvs module is available in __salt__
'''
return 'lvs_server' if 'lvs.get_rules' in __salt__ else False
def present(name,
... | smallyear/linuxLearn | salt/salt/states/lvs_server.py | Python | apache-2.0 | 6,440 | 0.004503 |
from ete3 import Tree, TreeStyle, Tree, TextFace, NodeStyle, add_face_to_node
import sys
from collections import OrderedDict
import os
# build list of filenames
filenames = []
for d in os.listdir('out/'):
filenames.append('out/' + d + '/')
# roman numeral thing just incase things get crowded...
def write_roman(nu... | Brightgalrs/con-lang-gen | maketree.py | Python | mit | 2,237 | 0.007599 |
"""
WSGI config for test_proj 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/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SET... | truetug/django-admin-helper | test_proj/test_proj/wsgi.py | Python | mit | 395 | 0 |
# coding: UTF-8
"""
Tests for support views.
"""
import itertools
import json
import re
from datetime import datetime, timedelta
import ddt
import pytest
from django.contrib.auth.models import User
from django.urls import reverse
from django.db.models import signals
from nose.plugins.attrib import attr
from pytz impo... | Stanford-Online/edx-platform | lms/djangoapps/support/tests/test_views.py | Python | agpl-3.0 | 17,238 | 0.002147 |
from django.db.models.query_utils import DeferredAttribute
from django.forms.models import model_to_dict
from ..backend import utils
class UpdateScriptsMixin(object):
pass
class WooeyPy2Mixin(object):
def __unicode__(self):
return unicode(self.__str__())
# from
# http://stackoverflow.com/question... | wooey/Wooey | wooey/models/mixins.py | Python | bsd-3-clause | 1,643 | 0 |
# MajorMajor - Collaborative Document Editing Library
# Copyright (C) 2013 Ritchie Wilson
#
# 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)... | ritchiewilson/majormajor | tests/document/test_document_missing_changesets.py | Python | gpl-3.0 | 3,226 | 0.00155 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
class LoCatrConfig(AppConfig):
name = 'LoCatr'
| scifiswapnil/Project-LoCatr | LoCatr/LoCatr/apps.py | Python | mit | 152 | 0 |
from validx import Dict, List, Tuple
import typing
from .protos import DataObject
from .utils.validator import UInt8
from .utils.types import Color, Remapping
class Palette(DataObject):
__slots__ = ("data",)
schema = Dict({"data": List(Tuple(UInt8, UInt8, UInt8))})
def __init__(self):
self.data... | omf2097/pyomftools | omftools/pyshadowdive/palette.py | Python | mit | 1,805 | 0 |
try:
import unittest.mock as mock
except ImportError:
import mock
import subprocess
import dags.utils.helpers as helpers
from dags.operators.postgres_to_s3_transfer import PostgresToS3Transfer
class TestPostgresToS3Transfer(object):
def test_its_created_successfully(self):
operator = PostgresToS3T... | opentrials/opentrials-airflow | tests/dags/operators/test_postgres_to_s3_transfer.py | Python | mpl-2.0 | 2,927 | 0.001367 |
"""Utility Class used to report timings """
import time
class Timings(object):
def __init__(self):
"""Key of data dictionary is the name for timings, values are a tuple which is (n,t,st) where
n is the number of calls, and t the cumulative time it took, and st the status ('finished',STARTTIME)"""
... | Juanlu001/CBC.Solve | cbc/swing/fsinewton/utils/timings.py | Python | gpl-3.0 | 3,415 | 0.016398 |
## Copyright (C) 2007-2012 Red Hat, Inc., Bryn M. Reeves <bmr@redhat.com>
### 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 option) any later ve... | portante/sosreport | sos/plugins/sysvipc.py | Python | gpl-2.0 | 1,199 | 0.010842 |
import random
def random_data(points=50, maximum=100):
return [random.random() * maximum for a in xrange(points)]
def random_colour(min=20, max=200):
func = lambda: int(random.random() * (max-min) + min)
r, g, b = func(), func(), func()
return '%02X%02X%02X' % (r, g, b)
| kongji2008/genetify | pygooglechart/examples/helper.py | Python | mit | 290 | 0.013793 |
"""This test checks that Nevergrad is functional.
It also checks that it is usable with a separate scheduler.
"""
import ray
from ray.tune import run
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.nevergrad import NevergradSearch
def easy_objective(config, reporter):
import time
... | stephanie-wang/ray | python/ray/tune/examples/nevergrad_example.py | Python | apache-2.0 | 1,858 | 0 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^list/$', views.list, name='list'),
url(r'^search/$', views.search, name='search'),
url(r'^add/$', views.add, name='add'),
url(r'^restaurant/(?P<id>[0-9]+)$', views.restaurant, name='r... | fblupi/master_informatica-SSBW | tarea6/sitio_web/restaurantes/urls.py | Python | gpl-3.0 | 408 | 0 |
__author__ = 'Joel Akeret'
__version__ = '0.1.2'
__credits__ = 'ETH Zurich, Institute for Astronomy'
| jakeret/tf_unet | tf_unet/__init__.py | Python | gpl-3.0 | 101 | 0 |
import subprocess
import os
INPUT_FILE = "/tmp/input"
ERROR_LOG = "/tmp/error.log"
RESULTS_FILE = "/tmp/results"
def get_command_from_first_line(line):
if line.startswith("#!"):
return line[2:]
return line
def get_program_output_from_buffer_contents(buffer_contents):
write_buffer_contents_to_file... | JarrodCTaylor/vim-shell-executor | autoload/vim_shell_executor.py | Python | mit | 1,433 | 0.002791 |
import lmdb
from zounds.nputil import Growable, packed_hamming_distance
import numpy as np
from multiprocessing.dummy import Pool as ThreadPool
from multiprocessing import cpu_count
import os
import binascii
class HammingDb(object):
def __init__(self, path, map_size=1000000000, code_size=8, writeonly=False):
... | JohnVinyard/zounds | zounds/index/hammingdb.py | Python | mit | 7,331 | 0.000818 |
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import pytest
from pandas.compat import product as cart_product, range
from pandas import DataFrame, MultiIndex, Period, Series, Timedelta, Timestamp
from pandas.util.testing import assert_frame_equal, assert_series_equal
class TestCo... | GuessWhoSamFoo/pandas | pandas/tests/groupby/test_counting.py | Python | bsd-3-clause | 7,838 | 0 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import
import logging
import os
import structlog
import sys
from datetime import datet... | Callek/build-relengapi | relengapi/lib/logging.py | Python | mpl-2.0 | 3,196 | 0.000313 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class Bottle(nn.Module):
def forward(self, input):
if len(input.size()) <= 2:
return super(Bottle, self).forward(input)
size = input.size()[:2]
out = super(Bottle, self).forw... | Air-Fighter/DecomposableAttModel_PyTorch | model.py | Python | gpl-2.0 | 2,524 | 0.001981 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2001-2014 Micronaet SRL (<http://www.micronaet.it>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | Micronaet/micronaet-mx8 | mx_sale_parcels/parcels.py | Python | agpl-3.0 | 3,131 | 0.006068 |
# -*- coding: utf-8 -*-
class Codes(object):
def __init__(self, **kws):
self._reverse_dict = {}
for k, v in kws.items():
self.__setattr__(k, v)
def str_value(self, value):
return self._reverse_dict[value]
def __setattr__(self, name, value):
super(Codes, self).... | RobbieClarken/channelarchiver | channelarchiver/structures.py | Python | mit | 703 | 0 |
# -*- coding: utf-8 -*-
"""
tmdbsimple.search
~~~~~~~~~~~~~~~~~
This module implements the Search functionality of tmdbsimple.
Created by Celia Oakley on 2013-10-31.
:copyright: (c) 2013-2018 by Celia Oakley
:license: GPLv3, see LICENSE for more details
"""
from .base import TMDB
class Search(TMDB):
"""
Se... | axlt2002/script.light.imdb.ratings.update | resources/support/tmdbsimple/search.py | Python | gpl-3.0 | 6,284 | 0.003342 |
# 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
# d... | steveb/heat | heat_integrationtests/common/clients.py | Python | apache-2.0 | 8,193 | 0 |
# -*- coding: utf-8 -*-
# Copyright (C) 2012 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... | junneyang/taskflow | taskflow/tests/unit/test_progress.py | Python | apache-2.0 | 5,259 | 0 |
# -*- 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 field 'Makey.derived_from'
db.add_column(u'catalog_makey', 'deri... | Makeystreet/makeystreet | woot/apps/catalog/migrations/0127_auto__add_field_makey_derived_from.py | Python | apache-2.0 | 64,380 | 0.007689 |
mcinif='mcini_gen2'
runname='gen_test2111b'
mcpick='gen_test2b.pickle'
pathdir='/beegfs/work/ka_oj4748/echoRD'
wdir='/beegfs/work/ka_oj4748/gen_tests'
update_prec=0.04
update_mf=False
update_part=500
import sys
sys.path.append(pathdir)
import run_echoRD as rE
rE.echoRD_job(mcinif=mcinif,mcpick=mcpick,runname=runname,... | cojacoo/testcases_echoRD | gen_test2111b.py | Python | gpl-3.0 | 430 | 0.044186 |
#! /usr/bin/env python3
a = [1, 3, 4, 5, 8]
a.append(23) #adding element at last position of list.
a.insert(0,23) #inserting at first position of list.
a.insert(2,21) #inserting at second position of list.
print("list : ", a)
del a[-1] #delete last element.
a.remove(3) #delete element from list.
print("deletion opear... | Skchoudhary/python_programm | list.py | Python | mit | 551 | 0.029038 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import functools
import os
import sys
import constants
sys.path.insert(0, constants.SOURCE_ROOT)
from chromite.buildbot import rep... | coreos/chromite | buildbot/repository_unittest.py | Python | bsd-3-clause | 3,059 | 0.005557 |
def generate_dispatcher(method_handler, parent_class=None):
"""
Create a dispatcher class and return an instance of it from a dispatcher
definition.
The definition is a class with the following attributes:
_ EXPORTED_METHOD: dictionary where keys are method names and values
class attribute nam... | ActiveState/code | recipes/Python/83048_Dynamic_generatidispatcher/recipe-83048.py | Python | mit | 2,283 | 0.002628 |
# should be using spacy for everything NLP from now on
from ml.document_features import en_nlp, selectContentWords
from proc.query_extraction import SentenceQueryExtractor, EXTRACTOR_LIST
class FilteredSentenceQueryExtractor(SentenceQueryExtractor):
def getQueryTextFromSentence(self, sent):
doc = en_nlp(... | danieldmm/minerva | proc/nlp_query_extraction.py | Python | gpl-3.0 | 499 | 0.006012 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-08-13 03:19
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0036_auto_20170813_0049'),
]
operations = [
migrations.AlterField... | goyal-sidd/BLT | website/migrations/0037_auto_20170813_0319.py | Python | agpl-3.0 | 510 | 0.001961 |
"""
AuthenticatedDictionary.py: Contains an authenticated dictionary data structure.
Supports O(log n) insert, find, and delete, and maintains a hash authenticating
the contents.
The data structure is set-unique; if the same data is in it, it always produces
the same hash, no matter what order it was inserted in.
The... | vesellov/bitdust.devel | blockchain/pybc/AuthenticatedDictionary.py | Python | agpl-3.0 | 57,165 | 0.000875 |
#!/usr/bin/python
import json
import parcon
import operator
import pprint
import os
import sys
import getopt
import re
import optparse
import md5
import hashlib
import version
###
def sign_data(data_to_sign):
m = hashlib.md5()
m.update(data_to_sign)
signature = m.hexdigest()
return signature
####
def source... | korovkin/WNNotifier | notifier/sign.py | Python | apache-2.0 | 2,981 | 0.015431 |
import pickle
import scipy.misc
import numpy as np
from sys import argv
def plot_25_figure(images, output_name, num_channels = 1):
HEIGHT, WIDTH = images.shape[1], images.shape[2]
if num_channels == 1:
images = images.reshape((5,5,HEIGHT,WIDTH))
# rowx, rowy, height, width -> rowy, height, rowx, width
images =... | kundan2510/pixelCNN | plot_images.py | Python | mit | 1,614 | 0.042131 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import configparser
import msvcrt
import os
import sys
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
import TradeX
TradeX.OpenTdx()
class QA_Stock():
def set_config(self, configs):
try:
self.sHost = configs['host']
... | EmmaIshta/QUANTAXIS | QUANTAXIS_Trade/QA_tradex/QA_Trade_stock_api.py | Python | mit | 10,682 | 0.001387 |
import urllib
import os
import json
import time
import datetime
import sublime
from xml.sax.saxutils import escape
from .. import requests
from .. import util
from ..libs import auth
# https://github.com/xjsender/simple-salesforce/blob/master/simple_salesforce/login.py
def soap_login(settings, session_id_expired=Fals... | xjsender/haoide | salesforce/login.py | Python | mit | 7,654 | 0.005487 |
from __future__ import absolute_import
from __future__ import print_function
from keras.datasets import mnist
from keras.models import Sequential
from keras.layers.core import Dense, Activation, Merge
from keras.utils import np_utils
import numpy as np
nb_classes = 10
batch_size = 128
nb_epoch = 1
max_train_samples =... | kfoss/keras | tests/manual/check_models.py | Python | mit | 8,592 | 0.003841 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2010 Tampere University of Technology
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the r... | tema-mbt/tema-adapterlib | adapterlib/testrunner.py | Python | mit | 15,926 | 0.013939 |
import six
import requests
from bugwarrior.config import die
from bugwarrior.services import Issue, IssueService, ServiceClient
import logging
log = logging.getLogger(__name__)
class TeamLabClient(ServiceClient):
def __init__(self, hostname, verbose=False):
self.hostname = hostname
self.verbose ... | lyarwood/bugwarrior | bugwarrior/services/teamlab.py | Python | gpl-3.0 | 4,419 | 0 |
# -*- coding: utf-8 -*-
from gluon import *
from s3 import *
# =============================================================================
class S3MainMenuOuterLayout(S3NavigationItem):
"""
Main Menu Outer Layout for a Bootstrap-based theme
"""
@staticmethod
def layout(item):
""" Cu... | gnarula/eden_deployment | private/templates/NYC/layouts.py | Python | mit | 5,177 | 0.002318 |
# -*- coding: utf-8 -*-
# Copyright 2017 GIG Technology NV
#
# 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... | threefoldfoundation/app_backend | plugins/tff_backend/api/rogerthat/documents.py | Python | bsd-3-clause | 3,285 | 0.00274 |
import logging
import sys
import xmlrpc.client as xmlrpcclient
import pytest
from cobbler.utils import local_get_cobbler_api_url, get_shared_secret
# "import xmlrpc.client" does currently not work. No explanation found anywhere.
def pytest_addoption(parser):
parser.addoption("-E", action="store", metavar="NAME... | jmaas/cobbler | tests/conftest.py | Python | gpl-2.0 | 1,465 | 0.002048 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Vispy Development Team.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from __future__ import division, print_function
import sys
import numpy as np
from time import sleep
from ..util.event import EmitterGroup, Event, WarningEmitter
from ..util... | sh4wn/vispy | vispy/app/canvas.py | Python | bsd-3-clause | 26,614 | 0.000075 |
# System imports
import itertools
import concurrent.futures
# Third party imports
import requests
class Client:
"""
Used for sending commands to one or more IDA containers over HTTP.
"""
def __init__(self, urls):
"""
>>> client = Client(['http://host-1:4001', 'http://host-2:4001'])
... | intezer/docker-ida | ida_client/ida_client.py | Python | gpl-3.0 | 2,196 | 0.002732 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.... | maltouzes/sfark-extractor | sample/setup.py | Python | gpl-3.0 | 3,698 | 0 |
#!/usr/bin/env python3
# Copyright (c) 2020-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import argparse
import io
import requests
import subprocess
import sys
DEFAULT_GLOBAL_FAUCET = 'https://... | jamesob/bitcoin | contrib/signet/getcoins.py | Python | mit | 6,271 | 0.003987 |
#!/usr/bin/python2.4
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for grit.format.policy_templates.writers.admx_writer."""
import os
import sys
import unittest
from xml.dom import ... | paul99/clank | tools/grit/grit/format/policy_templates/writers/xml_writer_base_unittest.py | Python | bsd-3-clause | 1,025 | 0.002927 |
__author__ = 'olga.ostapenko'
import pytest
from fixture.application import Application
@pytest.fixture(scope="session")
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture | oostapenko84/python_training | conftest.py | Python | apache-2.0 | 230 | 0.004348 |
import os
import threading
from cachetools import LRUCache
from customUtilities.logger import logger
class Cache():
def __init__(self,cachefilename,CACHE_SIZE,logger=logger('detoursCache.log')):
self.lock = threading.RLock()
self.cachefilename = cachefilename
self.entry = LRUCache(maxsize=... | akshah/netra | Cache/detoursCache.py | Python | apache-2.0 | 2,309 | 0.014292 |
class intersperse:
'''Generator that inserts a value before each element of an iterable
'''
def __init__(self, value, iterable):
self.value = value
self.iterable = iterable
self.return_value = True
def __iter__(self):
return self
def __next__(self):
... | orting/emphysema-estimation | Scripts/Util.py | Python | gpl-3.0 | 538 | 0.007435 |
#MenuTitle: Freeze Placeholders
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Turn placeholders in current tab into current glyphs.
"""
try:
thisFont = Glyphs.font # frontmost font
currentTab = thisFont.currentTab # current edit tab, if any
selectedGlyph = thi... | mekkablue/Glyphs-Scripts | Spacing/Freeze Placeholders.py | Python | apache-2.0 | 1,053 | 0.034188 |
from typing import Any, Callable, Tuple, Union
from packed import pack, unpack
import jj
from jj import default_app, default_handler
from jj.apps import BaseApp, create_app
from jj.http.codes import BAD_REQUEST, OK
from jj.http.methods import ANY, DELETE, GET, POST
from jj.matchers import LogicalMatcher, RequestMatch... | nikitanovosibirsk/jj | jj/mock/_mock.py | Python | apache-2.0 | 3,717 | 0.001076 |
""" Users API URI specification """
from django.conf import settings
from django.conf.urls import url
from django.db import transaction
from edx_solutions_api_integration.users import views as users_views
from rest_framework.urlpatterns import format_suffix_patterns
COURSE_ID_PATTERN = settings.COURSE_ID_PATTERN
url... | edx-solutions/api-integration | edx_solutions_api_integration/users/urls.py | Python | agpl-3.0 | 3,599 | 0.005557 |
"""The 1-Wire component."""
import asyncio
import logging
from homeassistant.config_entries import ConfigEntry
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.typing import HomeAssistantType
from .const ... | w1ll1am23/home-assistant | homeassistant/components/onewire/__init__.py | Python | apache-2.0 | 2,774 | 0.001802 |
from ajenti.api import *
from api import PackageInfo, PackageManager
@plugin
@rootcontext
@persistent
class BSDPackageManager (PackageManager):
platforms = ['freebsd']
def init(self):
self.upgradeable = []
def get_lists(self):
pass
def refresh(self):
pass
def search(sel... | lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/packages/pm_bsd.py | Python | apache-2.0 | 390 | 0 |
"""This is a really rough implementation but demonstrates the
core ideas."""
import os
import unittest
try:
import maya
ISMAYA = True
except ImportError:
maya, ISMAYA = None, False
from mayaserver.client import start_process, create_client, sendrecv
class MayaTestCase(unittest.TestCase):
def _setUp(... | rgalanakis/practicalmayapython | src/chapter6/mayatestcase.py | Python | mit | 1,966 | 0.002035 |
#!/usr/bin/env python
class CapOpen(object):
def __init__(self, fn, mode='r', buf=-1):
self.file = open(fn, mode, buf)
def __str__(self):
return str(self.file)
def __repr__(self):
return `self.file`
def write(self, line):
return self.file.write(line.upper())
def ... | opensvn/test | src/study/python/cpp/ch13/capOpen.py | Python | gpl-2.0 | 385 | 0.002597 |
from __future__ import print_function
import nose
from numpy.testing.decorators import slow
from datetime import datetime
from numpy import nan
from pandas import date_range,bdate_range, Timestamp
from pandas.core.index import Index, MultiIndex, Int64Index
from pandas.core.common import rands
from pandas.core.api im... | alephu5/Soundbyte | environment/lib/python3.3/site-packages/pandas/tests/test_groupby.py | Python | gpl-3.0 | 130,215 | 0.004807 |
import renderdoc as rd
import rdtest
class VK_Robustness2(rdtest.TestCase):
demos_test_name = 'VK_Robustness2'
def check_capture(self):
action: rd.ActionDescription = self.find_action('vkCmdDraw')
self.controller.SetFrameEvent(action.eventId, True)
self.check_triangle()
rdt... | Zorro666/renderdoc | util/test/tests/Vulkan/VK_Robustness2.py | Python | mit | 3,750 | 0.002133 |
'''Simple utility functions that should really be in a C module'''
from math import *
from OpenGLContext.arrays import *
from OpenGLContext import vectorutilities
def rotMatrix( (x,y,z,a) ):
"""Given rotation as x,y,z,a (a in radians), return rotation matrix
Returns a 4x4 rotation matrix for the given rotatio... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/OpenGLContext/utilities.py | Python | lgpl-3.0 | 2,924 | 0.031464 |
"""
sentry.client.celery.tasks
~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from celery.decorators import task
from sentry.client.base import SentryClient
from sentry.client.celery import conf
@task(routing_key=conf... | dcramer/sentry-old | sentry/client/celery/tasks.py | Python | bsd-3-clause | 396 | 0.002525 |
# Note that this is not a valid measurement of tail latency. This uses the execution times we measure because they're convenient, but this does not include queueing time inside BitFunnel nor does it include head-of-line blocking queue waiting time on the queue into BitFunnel.
import csv
filename = "/tmp/QueryPipeline... | BitFunnel/BitFunnel | src/Scripts/tail-latency.py | Python | mit | 1,033 | 0.000968 |
#!/usr/bin/env python
from agate.aggregations.has_nulls import HasNulls
from agate.computations.base import Computation
from agate.data_types import Date, DateTime, Number, TimeDelta
from agate.exceptions import DataTypeError
from agate.warns import warn_null_calculation
class Change(Computation):
"""
Calcul... | onyxfish/agate | agate/computations/change.py | Python | mit | 2,638 | 0.000758 |
# Copyright 2017 The Cobalt Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | youtube/cobalt | starboard/build/application_configuration.py | Python | bsd-3-clause | 4,981 | 0.003212 |
class Dynamics:
"""
a convenience class containing some dynamics
"""
ppppp = 10
pppp = 20
ppp = 30
pp = 40
p = 60
mp = 80
mf = 90
f = 100
ff = 110
fff = 120
ffff = 127
@classmethod
def from_string(cls, thestring):
"""
:param thestring: a ... | shimpe/expremigen | expremigen/musicalmappings/dynamics.py | Python | gpl-3.0 | 904 | 0 |
from spec import eq_, ok_
from mock import Mock
from invoke import Collection, Config, Context, Executor, Task, call, task
from invoke.parser import ParserContext
from _util import expect, IntegrationSpec
class Executor_(IntegrationSpec):
def setup(self):
s = super(Executor_, self)
s.setup()
... | pfmoore/invoke | tests/executor.py | Python | bsd-2-clause | 9,278 | 0.000216 |
__all__ = [
'null', 'Invalid', 'FieldsetErrors',
'Field', 'FieldFactory', 'Fieldset',
'field', 'fieldpreview', 'get_field_factory', 'get_field_preview',
'Term', 'Vocabulary',
'All','Function','Regex','Email','Range', 'Length','OneOf',
'CompositeField', 'CompositeError',
'InputField', 'Op... | djedproject/djed.form | djed/form/__init__.py | Python | isc | 3,170 | 0.008833 |
# -*- coding: UTF-8 -*-
from django.conf import settings
from django.contrib.auth.models import User
from django.db import models
from jsonfield import JSONField
PLACEHOLDER_IMAGE = "%simages/placeholder.png"%settings.STATIC_URL
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='_prof... | rosscdh/twimer | wastingtimer/nprofile/models.py | Python | gpl-3.0 | 820 | 0.014634 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from collections import defaultdict
from datetime import datetime
from itertools import groupby
from operator import itemgetter
from re import findall as regex_findall
from re import split as regex_split
from dateutil i... | ygol/odoo | addons/stock/models/stock_move.py | Python | agpl-3.0 | 92,248 | 0.004499 |
#!/usr/bin/env python
# Copyright (C) 2014 Ioan Dragan
# 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 option) any later version.
# This progr... | ioan-dragan/python-scripts | loadLeveler/getProblems.py | Python | gpl-2.0 | 1,175 | 0.011915 |
"""
Tests related to deprecation warnings. Also a convenient place
to document how deprecations should eventually be turned into errors.
"""
from __future__ import division, absolute_import, print_function
import datetime
import sys
import operator
import warnings
import numpy as np
from numpy.testing import (
r... | bringingheavendown/numpy | numpy/core/tests/test_deprecations.py | Python | bsd-3-clause | 17,790 | 0.00163 |
# -*- coding: utf-8 -*-
'''
Usage:
setuserpass.py [-d] username password
Set a user's username/password, creating it
if it did not already exist.
Specifying -d on the commandline removes the user and in that
case a password is not necessary
'''
import sys
from hashlib import sha1
from werkzeug.security import ge... | taimur97/Feeder | server/flaskapp/setuserpass.py | Python | gpl-2.0 | 1,570 | 0 |
import os
import tempfile
import numpy as np
from numpy.testing import assert_equal, raises, assert_allclose
from skimage import novice
from skimage.novice._novice import (array_to_xy_origin, xy_to_array_origin,
rgb_transpose)
from skimage import data_dir
from skimage._shared.utils ... | Britefury/scikit-image | skimage/novice/tests/test_novice.py | Python | bsd-3-clause | 8,113 | 0.000247 |
import bluetooth
import struct
import time
import pandas as pd
from datetime import datetime
"""
This interface library is designed to be used from very different contexts.
The general idea is that the Mindwave modules in the headset (and other devices)
talk a common binary protocol, which is entirely on... | ftuyama/TEEG | build/lib/mindwave/parser.py | Python | mit | 8,344 | 0.002996 |
from epic.utils.helper_functions import lru_cache
from numpy import log
from scipy.stats import poisson
@lru_cache()
def compute_window_score(i, poisson_parameter):
# type: (int, float) -> float
# No enrichment; poisson param also average
if i < poisson_parameter:
return 0
p_value = poisson.... | endrebak/epic | epic/statistics/compute_window_score.py | Python | mit | 501 | 0 |
# Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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 ... | tigwyk/eve-wspace | evewspace/core/models.py | Python | gpl-3.0 | 9,702 | 0.004947 |
def suma_n_numeros(n):
return (pow(n,2)+n)/2
if __name__ == '__main__':
numero_piedras = int(input())
while(numero_piedras > 0):
i = 1;
while(suma_n_numeros(i)<numero_piedras):
i += 1
i -= 1
sobran = numero_piedras - suma_n_numeros(i)
print(str... | israelem/aceptaelreto | codes/2017-05-15-triangulos_piedras.py | Python | mit | 390 | 0.010256 |
from model.group import Group
class GroupHelper:
def __init__(self, app):
self.app = app
def open_groups_page(self):
wd = self.app.wd
if not (wd.current_url.endswith("/group.php") and len(wd.find_elements_by_name("new"))>0):
wd.find_element_by_link_text("groups").click()
... | ritatsetsko/python_training | fixture/group.py | Python | apache-2.0 | 3,117 | 0.003529 |
#;+
#; NAME:
#; x_getsdssimg
#; Version 1.1
#;
#; PURPOSE:
#; Returns an Image by querying the SDSS website
#; Will use DSS2-red as a backup
#;
#; CALLING SEQUENCE:
#;
#; INPUTS:
#;
#; RETURNS:
#;
#; OUTPUTS:
#;
#; OPTIONAL KEYWORDS:
#;
#; OPTIONAL OUTPUTS:
#;
#; COMMENTS:
#;
#; EXAMPLES:
#;
#; PROCEDURES/... | astronomeara/xastropy-old | xastropy/obs/x_getsdssimg.py | Python | bsd-3-clause | 4,509 | 0.021956 |
from unittest import TestCase
from mock import patch
from railgun.engines.storage_engine import DummyEngine
class StorageEngineTestCase(TestCase):
def setUp(self):
self.config = {
'field1': 'value1',
'field2': 'value2'
}
def test_init(self):
with patch('railg... | clearcare/railgun | tests/engines/test_storage_engine.py | Python | mit | 1,295 | 0.001544 |
from selenium import webdriver
from time import sleep
driver = webdriver.Firefox()
driver.get('http://www.google.com')
sleep(2)
loginTextBox = driver.find_element_by_css_selector('.gLFyf.gsfi')
searchButton = driver.find_element_by_xpath('//input[@name="btnK"]')
loginTextBox.clear()
loginTextBox.send_keys("python")... | twiindan/selenium_lessons | 04_Selenium/03_elements_interaction/send_keys.py | Python | apache-2.0 | 365 | 0.00274 |
# Copyright 2020 by Kurt Rathjen. All Rights Reserved.
#
# 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 3 of the License, or
# (at your option) any later version. This ... | krathjen/studiolibrary | src/studiolibrary/librarywindow.py | Python | lgpl-3.0 | 80,070 | 0.000787 |
#!/usr/bin/env python
#
# Copyright 2007 Google 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 o... | mikea/appengine-mapreduce | python/src/mapreduce/mock_webapp.py | Python | apache-2.0 | 6,577 | 0.006994 |
# Copyright (c) 2012 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... | shakamunyi/neutron-vrrp | neutron/tests/unit/cisco/test_network_plugin.py | Python | apache-2.0 | 53,883 | 0.00026 |
import numpy as np
import os,sys
from scipy import optimize
import matplotlib.pyplot as plt
import matplotlib.dates as pltdates
from astropy.io import ascii
from datetime import datetime
#This script will fit a power law to the moving source synchrotron spectrum
#The new data location
#if sys.platform == 'darwin': B... | kkozarev/mwacme | src/fit_powerlaw_spectra_normalized.py | Python | gpl-2.0 | 4,350 | 0.030345 |
from django import template
register = template.Library()
@register.inclusion_tag(file_name='bootstrap_messages.html')
def bootstrap_messages(messages, icon_remove_class=None):
"""
Render django.contrib.messages messages as bootstrap alert blocks.
Display only info, success, error and warning level messa... | OlegPshenichniy/upfavor-mezzanine | bootstrap_helpers/templatetags/bootstrap_messages.py | Python | mit | 684 | 0.002924 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.