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 |
|---|---|---|---|---|---|---|
"""
The function cache system allows for data to be stored on the master so it can be easily read by other minions
"""
import logging
import time
import traceback
import salt.channel.client
import salt.crypt
import salt.payload
import salt.transport
import salt.utils.args
import salt.utils.dictupdate
import salt.util... | saltstack/salt | salt/modules/mine.py | Python | apache-2.0 | 19,294 | 0.00114 |
# Copyright (c) 2015-2020 Cloudify Platform Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | cloudify-cosmo/tosca-vcloud-plugin | system_tests/vcloud_handler.py | Python | apache-2.0 | 5,843 | 0.000342 |
#!/bin/true
# -*- coding: utf-8 -*-
#
# This file is part of ypkg2
#
# Copyright 2015-2017 Ikey Doherty <ikey@solus-project.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 ver... | solus-project/ypkg | ypkg2/sources.py | Python | gpl-3.0 | 12,925 | 0 |
# Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules (http://sudoku.com.au/TheRules.aspx).
#
# The Sudoku board could be partially filled, where empty cells are filled with the character '.'.
#
# Note:
# A valid Sudoku board (partially filled) is not necessarily solvable. Only the filled cells nee... | jigarkb/CTCI | LeetCode/036-M-ValidSudoku.py | Python | mit | 1,045 | 0.004785 |
#
# timezone.py - timezone install data
#
# Copyright (C) 2001 Red Hat, Inc. All rights reserved.
#
# 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 yo... | Rogentos/rogentos-anaconda | timezone.py | Python | gpl-2.0 | 2,650 | 0.004151 |
# Partname: ATmega8535
# generated automatically, do not edit
MCUREGS = {
'ADMUX': '&39',
'ADMUX_REFS': '$C0',
'ADMUX_ADLAR': '$20',
'ADMUX_MUX': '$1F',
'ADCSRA': '&38',
'ADCSRA_ADEN': '$80',
'ADCSRA_ADSC': '$40',
'ADCSRA_ADATE': '$20',
'ADCSRA_ADIF': '$10',
'ADCSRA_ADIE': '$08',
'ADCSRA_A... | lowfatcomputing/amforth | core/devices/atmega8535/device.py | Python | gpl-2.0 | 4,349 | 0.07404 |
import numpy as np
def empirical_rmt(input_returns):
"""
Empirical RMT computes an empirical correlation matrix and then filters using Random Matrix Theory.
THIS FUNCTION TAKES AS INPUT A CLEAN NUMPY ARRAY (please remove n/a first !)
To compute a correlation matrix, and then apply Wishart RMT, it is ... | gpostelnicu/fin_data | fin_data/stat/correlation/random_matrix.py | Python | mit | 2,722 | 0.003306 |
import tangelo
import pymongo
import bson.json_util
from ArborFileManagerAPI import ArborFileManager
api = ArborFileManager()
api.initDatabaseConnection()
@tangelo.restful
def get(*pargs, **query_args):
if len(pargs) == 0:
return tangelo.HTTPStatusCode(400, "Missing resource type")
resource_type = pa... | arborworkflows/ProjectManager | tangelo/projmgr.py | Python | apache-2.0 | 7,996 | 0.009005 |
from __future__ import absolute_import
import theano
import theano.tensor as T
import numpy as np
class Constraint(object):
def __call__(self, p):
return p
def get_config(self):
return {"name":self.__class__.__name__}
class MaxNorm(Constraint):
def __init__(self, m=2):
self.m = m
... | ypkang/keras | keras/constraints.py | Python | mit | 1,069 | 0.012161 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | tft/script_hyperparam_opt.py | Python | apache-2.0 | 7,859 | 0.006489 |
#!/usr/bin/env python3
import re
import os
import os.path
import sys
def main():
already_found = []
url_matcher = re.compile(r'(https?://(www.)?)?((youtu.be|youtube.(com|de|ch|at))/watch\?v=[-_0-9A-Za-z]{11}|youtu.be/[-_0-9A-Za-z]{11})')
backup_matcher = re.compile(r'youtu')
argc = len(sys.argv)
... | sseering/ytdlWrapper | urlfind.py | Python | unlicense | 1,923 | 0.00208 |
#!/usr/bin/env python
#
# Author: Mike McKerns (mmckerns @caltech and @uqfoundation)
# Copyright (c) 1997-2015 California Institute of Technology.
# License: 3-clause BSD. The full license text is available at:
# - http://trac.mystic.cacr.caltech.edu/project/mystic/browser/mystic/LICENSE
"""
See test_rosenbrock.py.
... | jcfr/mystic | examples/cg_rosenbrock.py | Python | bsd-3-clause | 1,478 | 0.023004 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""McGill Robotics ROS Bagger.
This tool can:
1. Record the specified topics into 15 second bags to the specified
directory.
2. Merge previously recorded bags from the specified directory.
By default, all the topics defined in your project's 'topics' f... | mcgill-robotics/compsys | scripts/bag/bag/__main__.py | Python | mit | 1,110 | 0 |
"""GLX context creation and management.
Depends on the binary glxcontext module.
@todo: Include glxcontext in distribution as an optional module.
@author: Stephan Wenger
@date: 2012-08-28
"""
try:
from glxcontext import GLXContext as _GLXContext
from glitter.contexts.context import Context
from glitter... | swenger/glitter | glitter/contexts/glx.py | Python | mit | 1,256 | 0.002389 |
'''
Jan Camenisch, Markulf Kohlweiss, Alfredo Rial, and Caroline Sheedy (Pairing-based)
| From: "Blind and Anonymous Identity-Based Encryption and
Authorised Private Searches on Public Key Encrypted Data".
| Published in: PKC 2009
| Available from: http://www.iacr.org/archive/pkc2009/54430202/54430202.pdf
| Notes: s... | lferr/charm | charm/schemes/ibenc/ibenc_ckrs09.py | Python | lgpl-3.0 | 4,080 | 0.017157 |
import pytest
import transcode.conf
import transcode.render
def my_callback(source, *args, **kws):
pass
CFG_GOOD = {
'TEXT': {'transcoder': my_callback},
}
CFG_BAD = {
'MARK': {'transcoder': 42}
}
class TestConf:
def test_default_config(self):
for fmt, expected in (
(transcode... | OpenTherapeutics/transcode | tests/test_config.py | Python | mit | 1,153 | 0.005204 |
'''
Created on Mar 7, 2016
@author: mike
'''
from patgen.dictionary import parse_dictionary_word, format_dictionary_word,\
Dictionary
import unittest
from patgen.margins import Margins
class TestDictionary(unittest.TestCase):
def test_parse(self):
text, hyphens, missed, false, weights =... | pgmmpk/pypatgen | patgen/tests/test_dictionary.py | Python | mit | 1,321 | 0.009084 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... | eltonkevani/tempest_el_env | tempest/api/orchestration/stacks/test_server_cfn_init.py | Python | apache-2.0 | 6,500 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" markdown-docs markdown documentation reader
APACHE LICENSE 2.0
Copyright 2013 Sebastian Dahlgren
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
... | sebdah/markdown-docs | markdowndocs/__init__.py | Python | apache-2.0 | 4,970 | 0.004024 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.com)
# 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',... | kvar/ansible | lib/ansible/modules/storage/purestorage/_purefa_facts.py | Python | gpl-3.0 | 32,021 | 0.000999 |
from panda3d.core import *
from panda3d.direct import *
from toontown.toonbase.ToonBaseGlobal import *
from toontown.distributed.ToontownMsgTypes import *
from toontown.hood import ZoneUtil
from direct.directnotify import DirectNotifyGlobal
from toontown.hood import Place
from direct.showbase import DirectObject
from d... | silly-wacky-3-town-toon/SOURCE-COD | toontown/safezone/SafeZoneLoader.py | Python | apache-2.0 | 9,369 | 0.001814 |
"""
BinaryTree inter-engine communication class
use from bintree_script.py
Provides parallel [all]reduce functionality
"""
import cPickle as pickle
import re
import socket
import uuid
import zmq
from IPython.parallel.util import disambiguate_url
#-----------------------------------------------------------------... | cloud9ers/gurumate | environment/share/doc/ipython/examples/parallel/interengine/bintree.py | Python | lgpl-3.0 | 7,132 | 0.008833 |
# -*- coding: utf-8 -*-
#
# Progdupeupl documentation build configuration file, created by
# sphinx-quickstart on Sat Dec 07 17:25:18 2013.
#
# 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.
#
#... | progdupeupl/pdp_website | doc/conf.py | Python | agpl-3.0 | 7,983 | 0.00714 |
# -*- coding: utf-8 -*-
"""
contains definition of models names
"""
PRODUCT_TEMPLATE_TABLE = 'product.template'
PRODUCT_PRODUCT_TABLE = 'product.product'
PRODUCT_TEMPLATE_ID_FIELD = 'product_tmpl_id'
PRODUCT_VIRTUAL_AVAILABLE_FIELD = 'virtual_available'
PRODUCT_OPERATION_TABLE = 'amdeb.product.operation'
MODEL_NAME_... | amdeb/amdeb-integrator | amdeb_integrator/shared/model_names.py | Python | gpl-3.0 | 549 | 0 |
#!/usr/bin/python3
from distutils.core import setup
setup(name='PySh',
version='0.0.1',
py_modules=['pysh'],
description="A tiny interface to intuitively access shell commands.",
author="Bede Kelly",
author_email="bedekelly97@gmail.com",
url="https://github.com/bedekelly/pysh",
... | bedekelly/pysh | setup.py | Python | gpl-2.0 | 340 | 0 |
registry = {}
def register(model, fields, order='pk', filter=False, results=5):
registry[str(model)] = (model, fields, results, order, filter)
class LoopBreak(Exception): pass
def search_for_string(search_string):
search_string = search_string.lower()
matches = []
for key in registry:
model, ... | UWCS/uwcs-website | uwcs_website/search/__init__.py | Python | agpl-3.0 | 1,310 | 0.003817 |
from browser import window
from preprocess import transform
from reeborg_en import * # NOQA
src = transform(window.editor.getValue())
exec(src)
| code4futuredotorg/reeborg_tw | src/python/editor.py | Python | agpl-3.0 | 145 | 0 |
# coding=utf-8
# Author: Dennis Lutter <lad1337@gmail.com>
# Author: Jonathon Saine <thezoggy@gmail.com>
# URL: https://sickchill.github.io
#
# This file is part of SickChill.
#
# SickChill is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# t... | coderbone/SickRage-alt | sickchill/views/api/webapi.py | Python | gpl-3.0 | 118,111 | 0.002879 |
from math import sqrt
def sq_dist(p, q):
return((p[0] - q[0])**2 + (p[1] - q[1])**2)
def linear_search(points, query):
sqd = float("inf")
for point in points:
d = sq_dist(point, query)
if d < sqd:
nearest = point
sqd = d
return(nearest, sqd)
point_list = [(2,... | o-kei/design-computing-aij | ch4_1/nearest_liner.py | Python | mit | 491 | 0.002037 |
"""
Tests for manager.py
"""
from nose.plugins.attrib import attr
from unittest import TestCase
from ..block_structure import BlockStructureBlockData
from ..exceptions import UsageKeyNotInBlockStructure
from ..manager import BlockStructureManager
from ..transformers import BlockStructureTransformers
from .helpers impo... | Learningtribes/edx-platform | openedx/core/lib/block_structure/tests/test_manager.py | Python | agpl-3.0 | 6,900 | 0.002464 |
import UserDict
import copy
import grokcore.component as grok
import sys
import zeit.cms.content.sources
import zeit.content.image.interfaces
import zeit.edit.body
import zope.schema
class Variants(grok.Adapter, UserDict.DictMixin):
grok.context(zeit.content.image.interfaces.IImageGroup)
grok.implements(zeit... | cutoffthetop/zeit.content.image | src/zeit/content/image/variant.py | Python | bsd-3-clause | 6,899 | 0.00029 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
update_url_query,
)
class NaverIE(InfoExtractor):
_VALID_URL = r'https?://(?:m\.)?tv(?:cast)?\.naver\.com/v/(?P<id>\d+)'
_TESTS = [{
'url': 'http:/... | epitron/youtube-dl | youtube_dl/extractor/naver.py | Python | unlicense | 5,293 | 0.001171 |
"""
Django settings for voks project.
Generated by 'django-admin startproject' using Django 1.11.
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
# B... | ExsonumChain/ProtoServer | voks/settings.py | Python | mit | 3,423 | 0.001753 |
from PIL import Image
from PIL import ImageDraw
from PIL import ImageChops
import random
def message_transition(func):
func.is_message_transition = True
func.is_display_transition = False
def display_transition(func):
func.is_message_transition = False
func.is_display_transition = True
def FlashStars... | Kiganshee/Flip-Sign | TransitionFunctions.py | Python | cc0-1.0 | 14,898 | 0.006511 |
from tornado.options import define, options
define('mongodb', default='localhost:27017', help='mongodb host name or ip address +port', type=str)
define('mongod_name', default='project_hours', help='Project hours database name', type=str)
define('auth_db', default='project_hours', help='authentication database', type=... | miooim/project_hours | src/config.py | Python | mit | 1,076 | 0.009294 |
# -*- coding: utf-8 -*-
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-appengine-admin | samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py | Python | apache-2.0 | 1,530 | 0.000654 |
# Copyright 2015 The Meson development team
# 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 ... | evgenyz/meson | modules/gnome.py | Python | apache-2.0 | 10,923 | 0.003662 |
# -*- coding: utf-8 -*-
##
## Copyright © 2007, Matthias Urlichs <matthias@urlichs.de>
##
## 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... | smurfix/HomEvenT | modules/bool.py | Python | gpl-3.0 | 2,922 | 0.044781 |
from ga_utils import *
from random import randint, gauss, random, seed
import unittest
def generate_xover(population, midpoint_dist='uniform'):
"""
Generates a new value using crossover mutation
:param population: sorted iterable of current population
:param midpoint_dist: 'uniform' or 'normal' distr... | gioGats/GeneticText | generation_functions.py | Python | gpl-3.0 | 6,538 | 0.002906 |
field_dict={'ROME-FIELD-01':[ 267.835895375 , -30.0608178195 , '17:51:20.6149','-30:03:38.9442' ],
'ROME-FIELD-02':[ 269.636745458 , -27.9782661111 , '17:58:32.8189','-27:58:41.758' ],
'ROME-FIELD-03':[ 268.000049542 , -28.8195573333 , '17:52:00.0119','-28:49:10.4064' ],
'ROME-FIE... | ytsapras/robonet_site | scripts/rome_fields_dict.py | Python | gpl-2.0 | 1,964 | 0.071792 |
import os
TELEGRAM_TOKEN = os.environ['TELEGRAM_TOKEN']
DATABASE = {
'HOST': os.getenv('DB_PORT_3306_TCP_ADDR', 'localhost'),
'USER': os.getenv('DB_MYSQL_USER', 'root'),
'PASSWORD': os.getenv('DB_MYSQL_PASSWORD', ''),
'NAME': 'aurora',
}
| synteny/AuroraBot | sessioncontroller/settings.py | Python | mit | 256 | 0 |
import os
def root_dir():
"""
:return: root folder path
"""
return os.path.dirname(os.path.abspath(__file__))
def db_path(db_name):
if db_name == 'forecast':
return os.path.join(root_dir(), "data", "forecast.sqlite")
else:
return None
| JavierGarciaD/banking | definitions.py | Python | mit | 279 | 0 |
from core import FM
import traceback
class ReadFile(FM.BaseAction):
def __init__(self, request, path, session, **kwargs):
super(ReadFile, self).__init__(request=request, **kwargs)
self.path = path
self.session = session
def run(self):
request = self.get_rpc_request()
... | f-andrey/sprutio | app/modules/webdav/actions/files/read.py | Python | gpl-3.0 | 4,120 | 0.002205 |
from __future__ import absolute_import
from __future__ import print_function
from copy import deepcopy
from six.moves import range
def get_formulae(mass,tol=5,charge=0,tol_type='ppm',max_tests=1e7,
min_h=0,max_h=200,
min_c=0,max_c=200,
min_n=0,max_n=6,
min_o=0,max_o=20,
min_p=0,max_p=4,
min_s=0,max_s=4,
min_na=0... | metabolite-atlas/metatlas | metatlas/tools/formula_generator.py | Python | bsd-3-clause | 4,342 | 0.066099 |
# *-* coding=utf-8 *-*
from django.conf import settings
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.template.defaultfilters import slugify
from django.forms.widgets import flatatt
from django.utils.encoding import smart_unicode, force_unicode
from django.template.loader... | ninjaotoko/djblog | djblog/forms.py | Python | bsd-3-clause | 1,755 | 0.011966 |
import json
import sys
import falcon
def body_checker(required_params=(), documentation_link=None):
def hook(req, resp, resource, params):
if req.content_length in (None, 0, ):
raise falcon.HTTPBadRequest('Bad request',
'В запросе деолжны быть парамет... | sketchturnerr/WaifuSim-backend | resources/middlewares/body_checker.py | Python | cc0-1.0 | 1,251 | 0.003457 |
# flake8: noqa
from .client import Client
from .compatpatch import ClientCompatPatch
from .errors import (
ClientError, ClientLoginError, ClientCookieExpiredError,
ClientConnectionError, ClientForbiddenError,
ClientThrottledError,ClientBadRequestError,
)
from .common import ClientDeprecationWarning
__ver... | ping/instagram_private_api | instagram_web_api/__init__.py | Python | mit | 337 | 0.002967 |
import datetime
import unittest
from assertpy import assert_that
from blitzortung_server.influxdb import DataPoint
class TestAS(unittest.TestCase):
def testEmptyDataPoint(self):
timestamp = datetime.datetime.utcnow()
data_point = DataPoint("meas", time=timestamp)
json_repr = data_point.... | wuan/bo-server | tests/test_influxdb.py | Python | apache-2.0 | 989 | 0 |
import _plotly_utils.basevalidators
class ThicknessmodeValidator(_plotly_utils.basevalidators.EnumeratedValidator):
def __init__(
self, plotly_name="thicknessmode", parent_name="surface.colorbar", **kwargs
):
super(ThicknessmodeValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/plotly.py | packages/python/plotly/plotly/validators/surface/colorbar/_thicknessmode.py | Python | mit | 506 | 0.001976 |
from __future__ import print_function
from __future__ import division
from builtins import str
from past.utils import old_div
import logging
from datetime import datetime , time ,timedelta
import _strptime
import hardwaremod
import os
import subprocess
import emailmod
import interruptdbmod
import sensordbmod
import act... | Hydrosys4/Master | interruptmod.py | Python | gpl-3.0 | 29,482 | 0.054949 |
import logging
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _, ungettext
from mss.lib.xmlrpc import XmlRpc
xmlrpc = XmlRpc()
logger = logging.getLogger(__name__)
class Steps:
PREINST = "preinst"
DOWNLOAD = "download"
MEDIAS_AUTH = "medias_auth"
MEDIA... | pulse-project/mss | mss/www/wizard/transaction.py | Python | gpl-3.0 | 7,120 | 0.000702 |
import math
import os
import sys
sys.path.append(os.path.dirname(sys.argv[0])+"/../TensorFlowScripts")
import train_GED
from hyperopt import hp, fmin, rand, tpe, STATUS_OK, Trials
space = {
'lr': hp.loguniform('lr', math.log(1e-5), math.log(30)),
'wd' : hp.choice('wd', [1e-1, 1e-2, 1e-3, 1e-4, 1e-5, 1e-6, 1e... | pakozm/DNNJ | HyperoptScripts/hyperopt_mlp.py | Python | mit | 1,224 | 0.007353 |
import os
os.environ["qwiejioqwjeioqwjeioqwje"]
| supercheetah/diceroller | pyinstaller/buildtests/import/error_during_import2.py | Python | artistic-2.0 | 48 | 0 |
from subprocess import Popen, PIPE
import itertools
ITERATORS_NUM = [0, 1, 4]
UPDATERS_NUM = [1, 2, 4, 8]
DURATION = [2]
PERCENTAGES = [(25, 25)]
KEY_RANGE = [65536]
INIT_SIZE = [1024]
PARAMETER_COMBINATIONS = [ITERATORS_NUM, UPDATERS_NUM, DURATION, PERCENTAGES, KEY_RANGE, INIT_SIZE]
for param in itertools.product(*... | ezrosent/iterators-etc | hash/runTests.py | Python | mit | 722 | 0.018006 |
from src.utils import glove
import numpy as np
import string
class jester_vectorize():
def __init__(self, user_interactions, content, user_vector_type, content_vector_type, **support_files):
"""Set up the Jester Vectorizer.
Args:
user_interactions (rdd): The raw data of users interac... | tiffanyj41/hermes | src/data_prep/jester_vectorize.py | Python | apache-2.0 | 3,684 | 0.001629 |
# Copyright (C) 2008-2009 Open Society Institute
# Thomas Moroz: tmoroz@sorosny.org
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License Version 2 as published
# by the Free Software Foundation. You may not use, modify or distribu... | boothead/karl | karl/views/__init__.py | Python | gpl-2.0 | 864 | 0.001157 |
# -*- coding: utf-8 -*-
###############################################################################
#
# TollFreeList
# Returns a list of toll-free available phone numbers that match the specified filters.
#
# Python version 2.6
#
###############################################################################
from... | egetzel/wecrow | truehand2014/temboo/Library/Twilio/AvailablePhoneNumbers/TollFreeList.py | Python | apache-2.0 | 4,256 | 0.007519 |
#! /usr/bin/env python
# Hi There!
# You may be wondering what this giant blob of binary data here is, you might
# even be worried that we're up to something nefarious (good for you for being
# paranoid!). This is a base64 encoding of a zip file, this zip file contains
# a fully functional basic pytest script.
#
# Pyt... | mmolero/pyqode.python | runtests.py | Python | mit | 236,912 | 0.000038 |
import parmed.unit as units
from intermol.decorators import accepts_compatible_units
from intermol.forces.abstract_dihedral_type import AbstractDihedralType
class ProperPeriodicDihedralType(AbstractDihedralType):
__slots__ = ['phi', 'k', 'multiplicity', 'weight', 'improper']
@accepts_compatible_units(None, ... | shirtsgroup/InterMol | intermol/forces/proper_periodic_dihedral_type.py | Python | mit | 1,984 | 0.006552 |
# -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# (c) cornelius kölbel, privacyidea.org
#
# 2020-01-30 Jean-Pierre Höhmann <jean-pierre.hohemann@netknights.it>
# Add WebAuthn token
# 2018-01-22 Cornelius Kölbel <cornelius.koelbel@netknights.it>
# Add offline refill
# 2016-12-20 Cornelius Kö... | privacyidea/privacyidea | privacyidea/api/validate.py | Python | agpl-3.0 | 27,219 | 0.001397 |
from cse.util import Util
from collections import OrderedDict
from cse.pipeline import Handler
class WpApiParser(Handler):
def __init__(self):
super()
def parse(self, comments, url, assetId, parentId):
data = self.__buildDataSkeleton(url, assetId)
data["comments"] = self.__iterate... | CodeLionX/CommentSearchEngine | cse/WpApiParser.py | Python | mit | 1,919 | 0.00938 |
from django.conf.urls.defaults import *
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf import settings
admin.autodiscover()
urlpatterns = i18n_patterns(
'',
url(r'^admin/', include(admin.site.urls)),
url(r'^', include('cms.urls')),
)
if settings.DEBUG:
... | MagicSolutions/cmsplugin-carousel | example/example/urls.py | Python | mit | 582 | 0 |
def change_counter():
print("Determine the value of your pocket change.")
quarters = int(input("Enter the number of quarters: "))
dimes = int(input("Enter the number of dimes: "))
nickels = int(input("Enter the number of nickels: "))
pennies = int(input("Enter the number of pennies: "))
value... | SeattleCentral/ITC110 | examples/lecture04b.py | Python | mit | 508 | 0 |
def fact_iter(n):
"""This function will find the Factorial of the given number by iterative
method. This function is coded in Pyhton 3.5."""
# check for integer
if not isinstance(n, int):
raise TypeError("Please only enter integer")
if n <= 0:
raise ValueError("Kindly Enter posi... | rvsingh011/NitK_Assignments | Sem1/Algorithm/Factorial_iter.py | Python | mit | 1,055 | 0.001896 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from google.appengine.ext import ndb
from gaegraph.model import Node
from gaeforms.ndb import property
class Quero(Node):
item = ndb.StringProperty(required=True)
nome = ndb.StringProperty(required=True)
descricao = ndb.Strin... | gutooliveira/progScript | tekton/backend/apps/quero_app/model.py | Python | mit | 346 | 0.00289 |
"""Support for tracking which astronomical or meteorological season it is."""
from datetime import datetime
import logging
import ephem
import voluptuous as vol
from homeassistant import util
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_TYPE
import homeas... | leppa/home-assistant | homeassistant/components/season/sensor.py | Python | apache-2.0 | 4,134 | 0.000242 |
#!/usr/bin/python3
### rev: 5.0
### author: <zhq>
### features:
### errors included
### up to 63 bases (2 to 64)
### caps recognition and same output format (deprecated)
### for the function parameters, `cur` represents the current (input) base, `res` represents the result (output) base, and `num` represen... | Irides-Chromium/cipher | scale_strict.py | Python | gpl-3.0 | 1,750 | 0.013714 |
"""
Serializer for user API
"""
from rest_framework import serializers
from rest_framework.reverse import reverse
from django.template import defaultfilters
from courseware.access import has_access
from student.models import CourseEnrollment, User
from certificates.models import certificate_status_for_student, Certif... | xingyepei/edx-platform | lms/djangoapps/mobile_api/users/serializers.py | Python | agpl-3.0 | 4,342 | 0.001152 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from migrate.versioning import cfgparse
from migrate.versioning.repository import *
from migrate.versioning.template import Template
from migrate.tests import fixture
class TestConfigParser(fixture.Base):
def test_to_dict(self):
"""Correctly interpret config res... | odubno/microblog | venv/lib/python2.7/site-packages/migrate/tests/versioning/test_cfgparse.py | Python | bsd-3-clause | 1,112 | 0.004496 |
# Copyright (c) 2014 Scality
#
# 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... | saeki-masaki/cinder | cinder/volume/drivers/srb.py | Python | apache-2.0 | 33,594 | 0.000179 |
# Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2013 YAMAMOTO Takashi <yamamoto at valinux co jp>
#
# 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:... | halexan/Headquarters | src/headquarters/packet/stream_parser.py | Python | mit | 2,384 | 0 |
"""I'm a different package, but I'm in demopackage.__all__!"""
x = 42
| BurntSushi/pdoc | test/testdata/demopackage2.py | Python | unlicense | 70 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('compose', '0010_auto_20151026_1126'),
]
operations = [
migrations.RenameField(
model_name='slideshow',
... | pkimber/compose | compose/migrations/0011_auto_20151026_1203.py | Python | apache-2.0 | 401 | 0 |
# -*- coding: utf-8 -*-
"""
API for submitting background tasks by an instructor for a course.
Also includes methods for getting information about tasks that have
already been submitted, filtered either by running state or input
arguments.
"""
from ga_instructor_task.tasks import (
generate_score_detail_report,
... | nttks/edx-platform | lms/djangoapps/ga_instructor_task/api.py | Python | agpl-3.0 | 1,136 | 0.001761 |
# -*- coding: utf-8 -*-
"""
This file is part of coffeedatabase.
coffeedatabase 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 versi... | simonreich/coffeedatabase | lib/ckeyboard.py | Python | gpl-3.0 | 17,891 | 0.00218 |
# Copyright (c) 2005-2014, Enthought, Inc.
# some parts copyright 2002 by Space Telescope Science Institute
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions described in the a... | tommy-u/enable | kiva/pdf.py | Python | bsd-3-clause | 25,949 | 0.000077 |
"""
Copyright (c) 2004-Present Pivotal Software, Inc.
This program and the accompanying materials are made available under
the terms of the 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.... | Chibin/gpdb | src/test/tinc/tincrepo/mpp/gpdb/tests/storage/walrepl/load/__init__.py | Python | apache-2.0 | 1,772 | 0.005643 |
#!/bin/sh -
# Copyright 2011-2012 James McCauley
#
# 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 ... | voidcc/POXPOF | pox.py | Python | apache-2.0 | 1,289 | 0 |
"""
===============================================
Create topographic ERF maps in delayed SSP mode
===============================================
This script shows how to apply SSP projectors delayed, that is,
at the evoked stage. This is particularly useful to support decisions
related to the trade-off between deno... | trachelr/mne-python | examples/visualization/plot_evoked_topomap_delayed_ssp.py | Python | bsd-3-clause | 2,301 | 0 |
from datetime import datetime
from django.core.exceptions import ValidationError
from django.db import models
def validate_answer_to_universe(value):
if value != 42:
raise ValidationError('This is not the answer to life, universe and everything!', code='not42')
class ModelToValidate(models.Model):
n... | adrianholovaty/django | tests/modeltests/validation/models.py | Python | bsd-3-clause | 4,204 | 0.00785 |
#!/usr/bin/env python
'''
____ _ _ _ ____ _______ ____
/ ___)| | | | | |/ _ \ / _ _ \| _ \
\___ \| | | | | | (_) | | | | | | |_) )
___) | |_| |_| | ___ | | | | | | __/
(____/ \_______/|_| |_|_| |_| |_|_|
Sliding Win... | peterwharrison/SWAMP | SWAMP.py | Python | gpl-3.0 | 27,840 | 0.000647 |
from game_state import BOX, COLS, ROWS, SCREEN
import levels
from random import randint
import pygame
from time import sleep
class Level(object):
def __init__(self):
self.size = 1
self.color = 255,120,0
self.x = 0
self.y = 0
self.layout = []
self.wall = []
... | BradleyMoore/Snake | game_objects.py | Python | mit | 3,550 | 0.006761 |
# pylint: disable = C0301
from bs4 import BeautifulSoup
from urllib2 import urlopen
import pandas as pd
pos_idx_map = {
'qb': 2,
'rb': 3,
'wr': 4,
'te': 5,
}
def make_url(pos, wk):
ii = pos_idx_map[pos]
fstr = "http://fantasydata.com/nfl-stats/nfl-fantasy-football-stats.aspx?fs=1&stype=0&sn=1... | yikelu/nfl_fantasy_data | htmls2csvs.py | Python | gpl-2.0 | 2,265 | 0.004415 |
# -*- coding: utf-8 -*-
"""
Special purpose canvas including all required plotting function etc.
@newfield purpose: Purpose
@newfield sideeffect: Side effect, Side effects
@purpose: Plotting all
@author: Christian Kohl�ffel
@since: 22.04.2011
@license: GPL
"""
from copy import copy
from PyQt4 import... | workflo/dxf2gcode | source/Gui/myCanvasClass.py | Python | gpl-3.0 | 26,794 | 0.014109 |
from __future__ import with_statement
import time
from concurrence import unittest, Tasklet, Channel, TimeoutError
from concurrence.timer import Timeout
class TimerTest(unittest.TestCase):
def testPushPop(self):
self.assertEquals(-1, Timeout.current())
Timeout.push(30)
s... | concurrence/concurrence | test/testtimer.py | Python | bsd-3-clause | 2,659 | 0.015795 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; ... | proyectos-analizo-info/pyanalizo | src/app-ape/deprecated/get-propuestas-electorales-v5.py | Python | gpl-3.0 | 2,267 | 0.014116 |
from entities.base import Base
import game.constants
class Star(Base):
"""The Star objects represents a star (or a blackhole!)"""
symbol = 'O'
decoration = game.constants.STYLE_BOLD
color = game.constants.COLOR_WK
isCollider = True
def setClass(self, cl):
"""
Sets the star c... | dmalatesta/spaceterm | entities/star.py | Python | gpl-3.0 | 729 | 0 |
import sys
def solve(l):
numbers = l.split(',')
row_hash = {}
for num in numbers:
count = row_hash.setdefault(num, 0)
row_hash[num] = count + 1
if row_hash[num] > len(numbers) / 2:
return num
return None
with open(sys.argv[1], 'r') as f:
for line in f.readline... | systemsoverload/codeeval | easy/132_major_element/solution.py | Python | mit | 359 | 0.008357 |
# coding: utf-8
from django.test import SimpleTestCase
from corehq.apps.app_manager.commcare_settings import get_commcare_settings_lookup, get_custom_commcare_settings
from corehq.apps.app_manager.models import Application
from corehq.apps.app_manager.tests.util import TestXmlMixin
import xml.etree.ElementTree as ET
f... | qedsoftware/commcare-hq | corehq/apps/app_manager/tests/test_profile.py | Python | bsd-3-clause | 4,112 | 0.001217 |
from Screen import Screen
from Screens.MessageBox import MessageBox
from Components.MenuList import MenuList
from Components.ActionMap import ActionMap
from Components.Sources.StreamService import StreamServiceList
from Components.Sources.StaticText import StaticText
from Components.Label import Label
from enigma impor... | fairbird/OpenPLI-TSimage | lib/python/Screens/StreamingClientsInfo.py | Python | gpl-2.0 | 4,194 | 0.030281 |
"""
This module provides a RangeSet data structure. A range set is, as the
name implies, a set of ranges. Intuitively, you could think about a
range set as a subset of the real number line, with arbitrary gaps.
Some examples of range sets on the real number line:
1. -infinity to +infinity
2. -1 to 1
3. 1 to 4, 10 to 2... | axiak/py-rangeset | rangeset/__init__.py | Python | mit | 11,032 | 0.002085 |
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This program is distributed in... | estaban/pyload | module/plugins/accounts/StahnuTo.py | Python | gpl-3.0 | 1,610 | 0.001863 |
import json
from django.db import transaction
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
from treemap.audit import Role, FieldPermission
from treemap.udf import (UserDefinedFieldDefinition)
def udf_exists(params, instance):
"""
A little helper funct... | clever-crow-consulting/otm-core | opentreemap/treemap/lib/udf.py | Python | agpl-3.0 | 2,743 | 0 |
from lino.apps.ledger.ledger_tables import LedgerSchema
from lino.reports import Report
from lino.adamo.rowattrs import Field, Pointer, Detail
class SchemaOverview(Report):
def __init__(self,schema):
self.schema=schema
Report.__init__(self)
def getIterator(self):
return self.sc... | MaxTyutyunnikov/lino | obsolete/docs/examples/sprl2.py | Python | gpl-3.0 | 1,300 | 0.011538 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | lavjain/incubator-hawq | tools/bin/gppylib/programs/verify.py | Python | apache-2.0 | 11,749 | 0.010043 |
from django.conf import settings
from django.contrib import admin
if 'django.contrib.auth' in settings.INSTALLED_APPS:
from tastypie.models import ApiKey
class ApiKeyInline(admin.StackedInline):
model = ApiKey
extra = 0
ABSTRACT_APIKEY = getattr(settings, 'TASTYPIE_ABSTRACT_APIKEY', Fals... | rtucker-mozilla/WhistlePig | vendor-local/lib/python/tastypie/admin.py | Python | bsd-3-clause | 582 | 0.001718 |
import sys
import csv
import pickle
import numpy as np
from sklearn import svm
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import StandardScaler
training_data = []
training_classes = []
test_data = []
test_classes = []
path = '../../data/'
filename = pa... | PMantovani/road-irregularity-detector | classification_algorithm/src/svm_training.py | Python | apache-2.0 | 4,872 | 0.001437 |
# -*- coding: utf-8 -*-
from openerp import models, api, _
class account_journal(models.Model):
_inherit = "account.journal"
@api.multi
def get_journal_dashboard_datas(self):
domain_checks_to_print = [
('journal_id', '=', self.id),
('payment_method_id.code', '=', 'check_pr... | vileopratama/vitech | src/addons/account_check_printing/account_journal_dashboard.py | Python | mit | 1,200 | 0.004167 |
import json
import os
import re
import sys
import django
from django.conf import settings
from django.contrib.auth.models import AnonymousUser
from django.contrib.sitemaps.views import x_robots_tag
from django.core.exceptions import PermissionDenied, ViewDoesNotExist
from django.core.paginator import EmptyPage, PageNo... | wagnerand/addons-server | src/olympia/amo/views.py | Python | bsd-3-clause | 8,643 | 0.000694 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
... | cchurch/ansible-modules-core | cloud/openstack/_keystone_user.py | Python | gpl-3.0 | 14,116 | 0.001063 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.