text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from cargo.base import CargoBase, lowercase, make_id_dict
class Image(CargoBase):
"""Python wrapper class encapsulating the metadata for a Docker Image"""
def __init__(self, *args, **kw):
super(Image, self).__init__(*args, **kw)
@property
def config(self, *args , **kw):
image = make_id_dict(self._do... | mvanveen/cargo | cargo/image.py | Python | mit | 1,022 | 0.019569 |
"""
Constructs a planner that is good for being kinda like a car-boat thing!
"""
from __future__ import division
import numpy as np
import numpy.linalg as npl
from params import *
import lqrrt
################################################# DYNAMICS
magic_rudder = 6000
def dynamics(x, u, dt):
"""
Returns... | jnez71/lqRRT | demos/lqrrt_ros/behaviors/car.py | Python | mit | 3,231 | 0.005262 |
import copy
from nive.utils.dataPool2.mysql.tests import test_MySql
try:
from nive.utils.dataPool2.mysql.mySqlPool import *
except:
pass
from . import test_db
from nive.utils.dataPool2.sqlite.sqlite3Pool import *
mode = "mysql"
printed = [""]
def print_(*kw):
if type(kw)!=type(""):
v = ""
... | nive/nive | nive/utils/dataPool2/tests/performance_test.py | Python | gpl-3.0 | 12,761 | 0.014262 |
# -*- coding: utf-8 -*-
# Copyright (C) 2006-2010 Søren Roug, European Environment Agency
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | ashang/calibre | src/odf/opendocument.py | Python | gpl-3.0 | 26,274 | 0.004948 |
import json
from DIRAC.Core.Base.Client import Client
from DIRAC import S_OK, S_ERROR
from DIRAC.DataManagementSystem.private.FTS3Utilities import FTS3JSONDecoder
class FTS3Client(Client):
""" Client code to the FTS3 service
"""
def __init__(self, url=None, **kwargs):
""" Constructor function.
"""
... | andresailer/DIRAC | DataManagementSystem/Client/FTS3Client.py | Python | gpl-3.0 | 3,920 | 0.008673 |
"""Google config for Cloud."""
import asyncio
from http import HTTPStatus
import logging
from hass_nabucasa import Cloud, cloud_api
from hass_nabucasa.google_report_state import ErrorResponse
from homeassistant.components.google_assistant.const import DOMAIN as GOOGLE_DOMAIN
from homeassistant.components.google_assis... | aronsky/home-assistant | homeassistant/components/cloud/google_config.py | Python | apache-2.0 | 8,528 | 0.000938 |
import pathlib
import urllib.error
import urllib.request
import logging
import bs4
import parmap
import pandas as pd
from betel import utils
from betel import info_files_helpers
from betel import betel_errors
class PlayAppPageScraper:
"""A class for scraping the icons and categories from Google Play Store
app... | googleinterns/betel | betel/app_page_scraper.py | Python | apache-2.0 | 5,385 | 0.001486 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('protocoltool', '0023_auto_20161208_1723'),
]
operations = [
migrations.RenameField(
model_name='basicdataset',
... | switchonproject/sip-html5-protocol-tool | protocoltool/migrations/0024_auto_20161212_1645.py | Python | lgpl-3.0 | 399 | 0 |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from ./eqpt_equipment import EQPT_TYPES
class Paddler(models.Model):
_name = 'eqpt.paddler'
_description = "Paddler Cycle Equipment"
_description = "Cycle paddler equipment"
eqpt_type = fields.Selection(selection=EQPT_TYPES, string="")
... | RemiFr82/ck_addons | ck_equipment/models/eqpt_paddler.py | Python | gpl-3.0 | 551 | 0.005445 |
#!/homes/janeway/zhuww/bin/py
import numpy
import pyfits
from pylab import *
#from Pgplot import *
#from ppgplot import *
#import ppgplot
from numpy import *
class Cursor:
badtimestart=[]
badtimeend=[]
lines = []
def __init__(self, ax):
self.ax = ax
#self.lx = ax.axhline(color='k') #... | zhuww/planetclient | gti.py | Python | apache-2.0 | 6,453 | 0.017666 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'Participant'
db.delete_table(u'pa_participant')
# Removing M2M table for field us... | Mathew/psychoanalysis | psychoanalysis/apps/pa/migrations/0002_auto__del_participant.py | Python | mit | 7,476 | 0.007089 |
import re
thisDict = {
"path": "thisDict",
"2": "2",
"3": "3",
"5": "5",
"7": "7",
"2 x 2": "{2} x {2}",
"3 x 2": "{3} x {2}",
"4": "{2 x 2}",
"6": "{3 x 2}",
"8": "{2 x 2} x {2}",
"16": "{2 x 2} x {2 x 2}",
"96": "{16} x {6}",
"thisModel.Root": "thisModel.Root: {96}... | CommonAccord/Cmacc-Org | Doc/G/NW-NDA/99/WiP/Schedule/String.py | Python | mit | 2,950 | 0.008136 |
from packetbeat import BaseTest
"""
Tests for HTTP messages with gaps (packet loss) in them.
"""
class Test(BaseTest):
def test_gap_in_large_file(self):
"""
Should recover well from losing a packet in a large
file download.
"""
self.render_config_template(
htt... | christiangalsterer/httpbeat | vendor/github.com/elastic/beats/packetbeat/tests/system/test_0029_http_gap.py | Python | apache-2.0 | 659 | 0 |
# -*- coding: utf-8 -*-
import sys
def __if_number_get_string(number):
converted_str = number
if isinstance(number, (int, float)):
converted_str = str(number)
return converted_str
def get_string(strOrUnicode, encoding='utf-8'):
strOrUnicode = __if_number_get_string(strOrUnicode)
return ... | davidvilla/python-doublex | doublex/safeunicode.py | Python | gpl-3.0 | 333 | 0 |
# Copyright (c) 2010 by California Institute of Technology
# Copyright (c) 2012 by Delft University of Technology
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source... | murrayrm/python-control | control/frdata.py | Python | bsd-3-clause | 26,326 | 0.000076 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Xmessage(AutotoolsPackage, XorgPackage):
"""xmessage displays a message or query in a wind... | iulian787/spack | var/spack/repos/builtin/packages/xmessage/package.py | Python | lgpl-2.1 | 845 | 0.001183 |
import system
# Create the computer system and power it up.
sys = system.System()
sys.power_on()
| richgieg/RichEmu86 | main.py | Python | mit | 98 | 0 |
"""
Pairwise distance functions between time series in a RKHS
=========================================================
They all have the following prototype:
function(K, T1, T2, **kwargs)
"""
import numpy as np
from scipy.linalg import solve, eigvals, inv
from scipy.signal import correlate2d
# mean-eleme... | daien/daco | distances_rkhs.py | Python | mit | 24,666 | 0.000568 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Tuxemon
# Copyright (C) 2014, William Edwards <shadowapex@gmail.com>,
# Benjamin Bean <superman2k5@gmail.com>
#
# This file is part of Tuxemon.
#
# Tuxemon is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Pu... | nikitakurylev/TuxemonX | tuxemon/core/states/combat/combat.py | Python | gpl-3.0 | 27,084 | 0.001625 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/liblbxutil/package.py | Python | lgpl-2.1 | 2,028 | 0.000986 |
from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
self.login()
def login(self):
# do a login here
# self.client.post("/login", {"username":"ellen_key", "passw... | PyBossa/pybossa-locust | mainandprojects.py | Python | agpl-3.0 | 600 | 0.011667 |
from __future__ import absolute_import
import redisext.backend.abc
import rm.rmredis
class Client(redisext.backend.abc.IClient):
def __init__(self, database=None, role=None):
self._redis = rm.rmredis.RmRedis.get_instance(database, role)
class Connection(redisext.backend.abc.IConnection):
CLIENT = C... | mylokin/redisext | redisext/backend/rmredis.py | Python | mit | 326 | 0 |
mystring="40523116"
mystring=mystring +" test"
print(mystring)
| s40523116/2016fallcp_hw | w4.py | Python | agpl-3.0 | 66 | 0.045455 |
import pyotherside
from firebase import firebase
firebase = firebase.FirebaseApplication('https://hacker-news.firebaseio.com', None)
responses = []
getItemsCount = 0
eventCount = 0
itemIDs = []
def getCommentsForItem(itemID):
itemID = int(itemID)
itemID = str(itemID)
item = firebase.get('/v0/item/'+ite... | neversun/sailfish-hackernews | src/main.py | Python | mit | 3,028 | 0.000661 |
"""
Semiconducting Materials from Analogy and Chemical Theory
A collection of fast screening tools from elemental data
"""
# get correct path for datafiles when called from another directory
from builtins import filter
from builtins import map
from builtins import range
from builtins import object
from os ... | WMD-group/SMACT | smact/__init__.py | Python | mit | 14,679 | 0.011309 |
#!/usr/bin/env python
import sys
from os.path import normpath, join, dirname, abspath
machine_file = normpath(join(dirname(abspath(__file__)),
'../files/machine-images.csv'))
def read_machine_file():
amis = {}
with open(machine_file) as fp:
for l in fp:
type... | Cadasta/cadasta-platform | deployment/scripts/ami.py | Python | agpl-3.0 | 1,182 | 0.001692 |
# coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
compat_str,
float_or_none,
int_or_none,
smuggle_url,
str_or_none,
try_get,
)
class STVPlayerIE(InfoExtractor):
IE_NAME = 'stv:player'
_VALID_URL = r'https?://play... | rg3/youtube-dl | youtube_dl/extractor/stv.py | Python | unlicense | 3,447 | 0.002031 |
import random
from django.test import TestCase
from .models import TechType, Tech, Component
# shared data across the tests
types = [
{
"name": "framework",
"description": "to do web stuff"
},
{
"name": "database",
"description": "to store stuff"
},
{
"nam... | sharestack/sharestack-api | sharestackapi/techs/test_models.py | Python | mit | 8,113 | 0 |
"""
.. _ex-morph-surface:
=============================
Morph surface source estimate
=============================
This example demonstrates how to morph an individual subject's
:class:`mne.SourceEstimate` to a common reference space. We achieve this using
:class:`mne.SourceMorph`. Pre-computed data will be morphed ... | mne-tools/mne-tools.github.io | 0.20/_downloads/e414d894f3f4079b3e5897dd9c691af7/plot_morph_surface_stc.py | Python | bsd-3-clause | 5,938 | 0 |
# Copyright(c) 2009, Gentoo Foundation
#
# Licensed under the GNU General Public License, v2
#
# $Header: $
"""Checks timestamps and MD5 sums for files owned by a given installed package"""
from __future__ import print_function
__docformat__ = 'epytext'
# =======
# Imports
# =======
import os
import sys
from funct... | bacher09/Gentoolkit | pym/gentoolkit/equery/check.py | Python | gpl-2.0 | 7,056 | 0.029337 |
# Test the module type
from test.test_support import verify, vereq, verbose, TestFailed
from types import ModuleType as module
# An uninitialized module has no __dict__ or __name__, and __doc__ is None
foo = module.__new__(module)
verify(foo.__dict__ is None)
try:
s = foo.__name__
except AttributeError:
pass
... | adaussy/eclipse-monkey-revival | plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/test/test_module.py | Python | epl-1.0 | 1,896 | 0.004747 |
import HTMLParser
import json
from xml.etree import ElementTree
from django.conf import settings
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse, HttpResponseBadRequest, Http404
from django.shortcuts import get_object_or_404
fr... | qedsoftware/commcare-hq | corehq/apps/cloudcare/views.py | Python | bsd-3-clause | 29,447 | 0.002241 |
# -*- encoding: utf-8 -*-
from abjad.tools.durationtools import Duration
from abjad.tools.rhythmtreetools import RhythmTreeContainer, RhythmTreeLeaf
def test_rhythmtreetools_RhythmTreeNode_duration_01():
tree = RhythmTreeContainer(preprolated_duration=1, children=[
RhythmTreeLeaf(preprolated_duration=1),... | mscuthbert/abjad | abjad/tools/rhythmtreetools/test/test_rhythmtreetools_RhythmTreeNode_duration.py | Python | gpl-3.0 | 1,469 | 0.000681 |
import datetime
from dateutil.relativedelta import relativedelta
from decimal import Decimal
import factory
from factory.fuzzy import FuzzyDate, FuzzyInteger
import random
from django.contrib.auth import models as auth
from django.contrib.auth.hashers import make_password
from timepiece.contracts import models as con... | dannybrowne86/django-timepiece | timepiece/tests/factories.py | Python | mit | 6,805 | 0.000882 |
"""
Base test case for the course API views.
"""
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase
from lms.djangoapps.courseware.tests.factories import StaffFactory
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPL... | cpennington/edx-platform | cms/djangoapps/contentstore/api/tests/base.py | Python | agpl-3.0 | 2,906 | 0.001376 |
#!/usr/bin/python
#
# \file 2_build.py
# \brief Build rbank
# \date 2009-03-10-22-43-GMT
# \author Jan Boon (Kaetemi)
# Python port of game data build pipeline.
# Build rbank
#
# NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
# Copyright (C) 2010 Winch Gate Property Limited
#
# This program is free soft... | osgcc/ryzom | nel/tools/build_gamedata/processes/rbank/2_build.py | Python | agpl-3.0 | 11,551 | 0.013159 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | mbohlool/client-python | kubernetes/client/models/v1alpha1_role_list.py | Python | apache-2.0 | 6,307 | 0.001586 |
# -*- coding: utf-8 -*-
"""
priority: HTTP/2 priority implementation for Python
"""
from .priority import ( # noqa
Stream,
PriorityTree,
DeadlockError,
PriorityLoop,
PriorityError,
DuplicateStreamError,
MissingStreamError,
TooManyStreamsError,
BadWeightError,
PseudoStreamError,
... | python-hyper/priority | src/priority/__init__.py | Python | mit | 346 | 0 |
# Copyright (c) 2014-2017. Mount Sinai School of Medicine
#
# 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 applicabl... | hammerlab/mhctools | mhctools/netmhc_cons.py | Python | apache-2.0 | 1,609 | 0.000622 |
uname = ParseFunction('uname -a > {OUT}')
for group in ('disc', 'ccl', 'gh'):
batch_options = 'requirements = MachineGroup == "{0}"'.format(group)
uname(outputs='uname.{0}'.format(group), environment={'BATCH_OPTIONS': batch_options})
#for group in ('disc', 'ccl', 'gh'):
# with Options(batch='requirements =... | isanwong/cctools | weaver/src/examples/batch.py | Python | gpl-2.0 | 410 | 0.004878 |
#
# Copyright 2019 The FATE 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 appli... | FederatedAI/FATE | examples/pipeline/upload/pipeline-upload-extend-sid.py | Python | apache-2.0 | 2,416 | 0.003311 |
import _plotly_utils.basevalidators
class ColorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="color", parent_name="surface.hoverlabel.font", **kwargs
):
super(ColorValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | plotly/plotly.py | packages/python/plotly/plotly/validators/surface/hoverlabel/font/_color.py | Python | mit | 470 | 0.002128 |
import os, sys, warnings, operator
import numbers
import itertools
import string, fnmatch
import unicodedata
from collections import defaultdict
import numpy as np
import param
try:
from cyordereddict import OrderedDict
except:
from collections import OrderedDict
try:
import pandas as pd # noqa (optional... | vascotenner/holoviews | holoviews/core/util.py | Python | bsd-3-clause | 31,475 | 0.004829 |
# -*- coding: utf-8 -*-
#
# UnitX documentation build configuration file, created by
# sphinx-quickstart on Thu Mar 17 05:31:20 2016.
#
# 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... | 0ED/UnitX | doc/conf.py | Python | mit | 6,844 | 0.005552 |
# -*- coding: utf-8 -*-
from allauth.socialaccount.tests import create_oauth_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import FlickrProvider
class FlickrTests(create_oauth_tests(registry.by_id(FlickrProvider.id))):
def get_mocked_response(s... | tejesh95/Zubio.in | zubio/allauth/socialaccount/providers/flickr/tests.py | Python | mit | 1,692 | 0 |
"""
kombu.serialization
===================
Serialization utilities.
:copyright: (c) 2009 - 2011 by Ask Solem
:license: BSD, see LICENSE for more details.
"""
import codecs
import sys
import pickle as pypickle
try:
import cPickle as cpickle
except ImportError:
cpickle = None # noqa
from kombu.utils.encodi... | softak/webfaction_demo | vendor-local/lib/python/kombu/serialization.py | Python | bsd-3-clause | 11,002 | 0.000273 |
# -*- coding: utf-8 -*-
"""
BlueButtonDev.appmgmt
FILE: utils
Created: 12/2/15 8:09 PM
"""
__author__ = 'Mark Scrimshire:@ekivemark'
from django.contrib import messages
from .models import DEVELOPER_ROLE_CHOICES
from django.conf import settings
def Choice_Display(role):
"""
Receive a string of the current r... | ekivemark/BlueButtonDev | appmgmt/utils.py | Python | apache-2.0 | 1,004 | 0.002988 |
'''
Created on Jun 15, 2014
@author: geraldine
'''
import socket
import fcntl
import struct
def get_ip_address(ifname):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
return socket.inet_ntoa(fcntl.ioctl(s.fileno(),0x8915,struct.pack('256s', ifname[:15]))[20:24]) | DeeDee22/nelliepi | src/ch/fluxkompensator/nelliepi/IPAddressFinder.py | Python | gpl-2.0 | 283 | 0.021201 |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from app.openapi_server.models.base_model_ import Model
from openapi_server import util
class GithubRepositorypermissions(Model):
"""NOTE: This class is auto gene... | cliffano/swaggy-jenkins | clients/python-blueplanet/generated/app/openapi_server/models/github_repositorypermissions.py | Python | mit | 3,754 | 0.002397 |
# -*- coding: utf-8 -*-
class CrazyBoxError(Exception):
"""
The base class for custom exceptions raised by crazybox.
"""
pass
class DockerError(Exception):
"""
An error occurred with the underlying docker system.
"""
pass
| USTB-LETTers/judger | exceptions.py | Python | mit | 256 | 0 |
import datetime
from django.test import override_settings, TestCase
from django_twilio.models import Caller
from mock import Mock, patch, PropertyMock
from model_mommy import mommy
from twilio.rest.exceptions import TwilioRestException
from .mommy_recipes import caller_recipe, message_recipe, phone_number_recipe
fro... | cfc603/django-twilio-sms-models | tests/test_models.py | Python | bsd-3-clause | 25,815 | 0 |
#-*- coding: utf-8 -*-
import numpy as np
from sklearn.cluster import AgglomerativeClustering as sk_AgglomerativeClustering
from sklearn.externals.joblib import Memory
from .clustering import Clustering
class AgglomerativeClustering(Clustering):
"""docstring for AgglomerativeClustering."""
def __init__(self, d... | netoaraujjo/hal | clustering/agglomerative_clustering.py | Python | mit | 1,946 | 0.023124 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-15 15:10
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('silo', '0028_auto_20170913_0206'),
]
operations = ... | toladata/TolaTables | silo/migrations/0029_auto_20170915_0810.py | Python | gpl-2.0 | 1,233 | 0.003244 |
from os import path
rosalind_id = path.basename(__file__).split('.').pop(0)
dataset = "../datasets/rosalind_{}.txt".format(rosalind_id)
data = open(dataset, 'r').read().splitlines()
| damonmcminn/rosalind | boilerplate.py | Python | gpl-2.0 | 183 | 0 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.utils.translation import ugettext_lazy ... | shawnadelic/shuup | shuup/xtheme/plugins/category_links.py | Python | agpl-3.0 | 2,994 | 0.001002 |
import json
import os
import re
from django import http
from django.conf import settings
from django.db.transaction import non_atomic_requests
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.utils.encoding import iri_to_uri
from django.views.decorators.cache... | jpetto/olympia | src/olympia/amo/views.py | Python | bsd-3-clause | 5,726 | 0 |
# -*- coding: UTF-8 -*-
## Copyright 2009-2013 Luc Saffre
## This file is part of the Lino project.
## Lino 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 y... | MaxTyutyunnikov/lino | lino/utils/config.py | Python | gpl-3.0 | 11,277 | 0.018003 |
import unittest
from literoticapi.author import *
class testStory(unittest.TestCase):
def setUp(self):
self.author = Author(868670)
def testGetSeriesAndNonSeries(self):
assert len(self.author.get_stories()) >= 132
if __name__ == "__main__":
unittest.main()
| hrroon/literoticapi | test/author_test.py | Python | gpl-3.0 | 290 | 0.006897 |
# Copyright (c) 2008 Simplistix Ltd
# See license.txt for license details.
from mock import Mock
from testfixtures import wrap,compare
from unittest import TestCase,TestSuite,makeSuite
class TestWrap(TestCase):
def test_wrapping(self):
m = Mock()
@wrap(m.before,m.after)
def test_functio... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/testfixtures/tests/test_wrap.py | Python | agpl-3.0 | 5,995 | 0.012677 |
OperandLookupTable = b''.join([
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
b'\x81\xbd\x81\xbd\x41\x7d\x00\x00\x81\xbd\x81\xbd\x41\x7d\x00\x00'
... | arizvisa/syringe | lib/ia32/_optable.py | Python | bsd-2-clause | 2,339 | 0 |
# -*- coding: UTF-8 -*-
import requests
from bs4 import BeautifulSoup, UnicodeDammit
import time
import os
import re
import log
import tools
class Get(object):
# timeout, retry_interval -> seconds
def __init__(self, url='', timeout=5, retry=5, retry_interval=2, proxies={}, headers={}, download_file=None, sav... | BD777/WindPythonToy | comm/network.py | Python | apache-2.0 | 7,827 | 0.004999 |
from __future__ import absolute_import, division, unicode_literals
from django.utils.translation import ugettext_lazy as _
from django.utils.safestring import mark_safe
from debug_toolbar.panels import Panel
from debug_toolbar import settings as dt_settings
import cProfile
from pstats import Stats
from colorsys impor... | nirmeshk/oh-mainline | vendor/packages/django-debug-toolbar/debug_toolbar/panels/profiling.py | Python | agpl-3.0 | 4,968 | 0.000201 |
"""
For types associated with installation schemes.
For a general overview of available schemes and their context, see
https://docs.python.org/3/install/index.html#alternate-installation.
"""
SCHEME_KEYS = ['platlib', 'purelib', 'headers', 'scripts', 'data']
class Scheme:
"""A Scheme holds paths which are used... | google/material-design-icons | update/venv/lib/python3.9/site-packages/pip/_internal/models/scheme.py | Python | apache-2.0 | 770 | 0 |
# David Tsui 2.9.2016
# Human Languages and Technologies
# Dr. Rebecca Hwa
from Ngrams import *
#TRAIN
train_file = open("tokenized_train.txt","r")
train_str = train_file.read();
tri = Trigram(1)
print "Begin training vocabulary----------------------"
tri.trainVocabulary(train_str)
#tri.printVocabulary()
#Takes in q... | luckyleap/NLP_Projects | MSChallenge Ngrams/MSChallengeNGrams.py | Python | mit | 908 | 0.030837 |
# -*- coding: UTF-8 -*-
# Copyright 2009-2019 Rumma & Ko Ltd
# License: GNU Affero General Public License v3 (see file COPYING for details)
from django.conf import settings
from django.utils.encoding import force_str
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.apps... | lino-framework/lino | lino/modlib/system/models.py | Python | bsd-2-clause | 4,683 | 0.002776 |
#
# Author: Martin Sandve Alnes
# Date: 2008-10-03
#
from ufl import (Coefficient, TestFunction, TrialFunction, VectorElement, dot,
dx, grad, triangle)
element = VectorElement("Lagrange", triangle, 1)
u = TrialFunction(element)
v = TestFunction(element)
w = Coefficient(element)
a = dot(dot(w, grad(u... | FEniCS/ufl | demo/ExplicitConvection.py | Python | lgpl-3.0 | 332 | 0 |
from __future__ import unicode_literals
import logging
import os
import tornado.ioloop
import tornado.web
from .webhandler.DownloadHandler import DownloadHandler
from .webhandler.OverviewHandler import OverviewHandler
from .webhandler.GradingPreviewMailsHandler import GradingPreviewMailsHandler
from .webhandler.Grad... | hhucn/netsec-uebungssystem | netsecus/korrekturserver.py | Python | mit | 4,455 | 0.000673 |
#!/usr/local/bin/python3.5
"""
Author: Maximilian Golub
Simulate the chain parsing and replying to a http request to test
the ESP8266
"""
import serial
import socket
import re
import traceback
import sys
import subprocess
import time
PORT = '/dev/cu.usbserial-FTZ29WSV' #OSX
#PORT = 'COM3' # If on windows
BAUD = 1152... | mgolub2/Breadcrumb | ESP8266/chain_simulator.py | Python | gpl-3.0 | 4,013 | 0.005981 |
from django.core.management.base import BaseCommand
from webserver.codemanagement.models import TeamClient
import os
import re
import tempfile
import subprocess
class Command(BaseCommand):
help = 'Attempts to update all repositories by pulling from bases'
def handle(self, *args, **options):
# A lis... | siggame/webserver | webserver/codemanagement/management/commands/update_repos.py | Python | bsd-3-clause | 4,248 | 0.000235 |
from office365.sharepoint.base_entity_collection import BaseEntityCollection
from office365.sharepoint.files.checkedOutFile import CheckedOutFile
class CheckedOutFileCollection(BaseEntityCollection):
def __init__(self, context, resource_path=None):
super(CheckedOutFileCollection, self).__init__(context, C... | vgrem/Office365-REST-Python-Client | office365/sharepoint/files/checkedOutFileCollection.py | Python | mit | 350 | 0.002857 |
import csv
from meerkat_abacus.config import config
def data_types(param_config=config):
with open(param_config.config_directory + param_config.country_config["types_file"],
"r", encoding='utf-8',
errors="replace") as f:
DATA_TYPES_DICT = [_dict for _dict in csv.DictReader(f)]... | who-emro/meerkat_abacus | meerkat_abacus/util/data_types.py | Python | mit | 555 | 0.009009 |
import logging
from time import strftime
def closed():
logging.info('Headlights process stopped')
def criterr(errortext):
logging.critical('A fatal error occured :: ' + errortext)
exit()
def err(errortext):
logging.error('An error occured :: ' + errortext)
def warn(errortext):
logging.warning(er... | mashedkeyboard/Headlights | handlers.py | Python | gpl-3.0 | 429 | 0.016317 |
"""
File: <Sin2_plus_cos2>
Copyright (c) 2016 <Lauren Graziani>
License: MIT
<debugging a program>
"""
"""
# a
from math import sin, cos #need to import pi from math
x = pi/4
1_val = math.sin^2(x) + math.cos^2(x) #can't start a variable with a number, powers are written by **
print 1_VAL
"""
# a debugged
from m... | chapman-cpsc-230/hw1-grazi102 | sin2_plus_cos2.py | Python | mit | 1,198 | 0.004174 |
class A(object):
def __init__(self, bar):
self._x = 1 ; self._bar = bar
def __getX(self):
return self._x
def __setX(self, x):
self._x = x
def __delX(self):
pass
x1 = property(__getX, __setX, __delX, "doc of x1")
x2 = property(__setX) # should return
x3 = property(__getX, __getX) # shou... | caot/intellij-community | python/testData/inspections/PyPropertyDefinitionInspection25/src/prop_test.py | Python | apache-2.0 | 1,700 | 0.042941 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-25 12:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('venue', '0005_auto_20170916_0701'),
]
operations = [
migrations.CreateModel... | tornadoalert/kmcoffice | venue/migrations/0006_eventcalander.py | Python | gpl-3.0 | 725 | 0.002759 |
"""Given (x,wave,matrices, slit_profile), extract the flux from each order. For
readability, we keep this separate from the simulator.... but the simulator is
required in order to run this.
To run, create a simulated fits file (e.g. "test_blue.fits") using ghostsim then:
blue_high = pyghost.extract.Extractor('blue',... | mikeireland/pyghost | pyghost/extract.py | Python | mit | 20,005 | 0.024144 |
class IPParseError(Exception):
pass
class ZoneNotFoundError(Exception):
pass
class InvalidInputError(Exception):
pass
| crustymonkey/r53-dyndns | libr53dyndns/errors.py | Python | gpl-2.0 | 133 | 0.015038 |
# -*- coding: utf-8 -*-
# code for console Encoding difference. Dont' mind on it
import sys
import imp
imp.reload(sys)
try:
sys.setdefaultencoding('UTF8')
except Exception as E:
pass
import testValue
from popbill import CashbillService, PopbillException
cashbillService = CashbillService(testValue.LinkID, te... | linkhub-sdk/popbill.cashbill.example.py | getChargeInfo.py | Python | mit | 1,259 | 0.001747 |
# fmt: off
"""
This file holds code for a Distributed Pytorch + Tune page in the docs.
FIXME: We switched our code formatter from YAPF to Black. Check if we can enable code
formatting on this module and update the paragraph below. See issue #21318.
It ignores yapf because yapf doesn't allow comments right after code ... | ray-project/ray | python/ray/util/sgd/torch/examples/tune_example.py | Python | apache-2.0 | 5,267 | 0.00019 |
"""Test MLPerf logging.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import sys
import pytest
from tensorflow_models.mlperf.models.rough.mlp_log import mlp_log
class TestMLPerfLog(object):
"""Test mlperf log."""
def test_format(... | mlperf/training_results_v0.7 | Google/benchmarks/resnet/implementations/resnet-cloud-TF2.0-tpu-v3-32/tf2_common/utils/mlp_log/test_mlp_log.py | Python | apache-2.0 | 739 | 0.00406 |
# Copyright © 2020, Joseph Berry, Rico Tabor (opendrop.dev@gmail.com)
# OpenDrop is released under the GNU GPL License. You are free to
# modify and distribute the code, but always under the same license
# (i.e. you cannot make commercial derivatives).
#
# If you use this software in your research, please cite the foll... | ricotabor/opendrop | opendrop/app/keyboard.py | Python | gpl-2.0 | 1,940 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-06-13 03:20
from __future__ import unicode_literals
import django.contrib.postgres.fields.ranges
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('climate_data',... | qubs/data-centre | climate_data/migrations/0020_annotation.py | Python | apache-2.0 | 1,145 | 0.003493 |
#coding:utf-8
bind = 'unix:/var/run/gunicorn.sock'
workers = 4
# you should change this
user = 'root'
# maybe you like error
loglevel = 'debug'
errorlog = '-'
logfile = '/var/log/gunicorn/debug.log'
timeout = 300
secure_scheme_headers = {
'X-SCHEME': 'https',
}
x_forwarded_for_header = 'X-FORWARDED-FOR'
| chenke91/ckPermission | settings.py | Python | mit | 313 | 0.003195 |
"""Entities: things that exist in the world."""
from .gfx import GraphicsGroup
from .util import ir
class Entity (object):
"""A thing that exists in the world.
Entity()
Currently, an entity is just a container of graphics.
"""
def __init__ (self):
#: The :class:`World <engine.game.World>` this en... | ikn/o | game/engine/entity.py | Python | gpl-3.0 | 884 | 0.003394 |
# -*- encoding:utf8 -*-
from model.parser import Parser
from model.googledrive import GoogleDrive
from plugins.base.responsebase import IResponseBase
class Drive(IResponseBase):
def hear_regex(self, **kwargs):
lists = Parser().get_keyword_list(expand=True)
print("Lists : %r" % lists)
ret... | supistar/Botnyan | plugins/drive.py | Python | mit | 603 | 0 |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "MovingMedian", cycle_length = 0, transform = "Logit", sigma = 0.0, exog_count = 100, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_Logit/trend_MovingMedian/cycle_0/ar_/test_artificial_32_Logit_MovingMedian_0__100.py | Python | bsd-3-clause | 263 | 0.087452 |
from __future__ import absolute_import
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ers_backend.settings')
from django.conf import settings
app = Celery('dataset_manager', backend="redis://localhost")
# Usin... | dumoulinj/ers | ers_backend/ers_backend/celery.py | Python | mit | 607 | 0.001647 |
# -*- coding: utf-8 -*-
"""
MIT License
Copyright (c) 2017 - 2018 FrostLuma
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, c... | FrostLuma/Mousey | mousey/bot/context.py | Python | mit | 2,070 | 0 |
from django import template
from django.conf import settings
from django.core.urlresolvers import reverse
register = template.Library()
### Show an update instance ###
@register.inclusion_tag("feeds/update.html", takes_context=True)
def show_update(context, update):
feed_object = update.feed.feed_object
... | caseywstark/colab | colab/apps/object_feeds/templatetags/object_feeds_tags.py | Python | mit | 2,666 | 0.007127 |
#
# 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 us... | mrchristine/spark-examples-dbc | src/main/python/ml/max_abs_scaler_example.py | Python | apache-2.0 | 1,515 | 0.00066 |
# -*- coding: utf-8 -*-
"""The scwapi package"""
| eteamin/spell_checker_web_api | scwapi/__init__.py | Python | gpl-3.0 | 49 | 0 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2018-02-15 23:16
from __future__ import unicode_literals
from django.db import migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('gardens', '0023_auto_20180215_2314'),
]
operations = [
... | bengosney/rhgd3 | gardens/migrations/0024_auto_20180215_2316.py | Python | gpl-3.0 | 759 | 0.001318 |
# Imports operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs
# These need to be integrated first as other operators depend on them
_import_module_attrs(globals(), {
'check_operator': [
... | wxiang7/airflow | airflow/operators/__init__.py | Python | apache-2.0 | 2,497 | 0.0004 |
#!/usr/bin/python
import ldns
pkt = ldns.ldns_pkt.new_query_frm_str("www.google.com",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA)
rra = ldns.ldns_rr.new_frm_str("www.google.com. IN A 192.168.1.1",300)
rrb = ldns.ldns_rr.new_frm_str("www.google.com. IN TXT Some\ Description",300)
list =... | fangdingjun/dnsproxy | third-part/ldns-1.6.17/contrib/python/examples/python3/ldns-newpkt.py | Python | gpl-3.0 | 476 | 0.014706 |
from util import hash256, hash_pks
from copy import deepcopy
class AggregationInfo:
"""
AggregationInfo represents information of how a tree of aggregate
signatures was created. Different tress will result in different
signatures, due to exponentiations required for security.
An AggregationInfo i... | zcoinofficial/zcoin | src/bls-signatures/python-impl/aggregation_info.py | Python | mit | 6,831 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2012 OpenStack 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 r... | citrix-openstack-build/python-keystoneclient | keystoneclient/middleware/auth_token.py | Python | apache-2.0 | 50,380 | 0.000099 |
import re
from django.core.management import call_command
from django.test import TestCase
from class_fixtures.tests.models import (Band, Musician,
Membership, Roadie, Competency, JobPosting, ComprehensiveModel)
from class_fixtures.utils import string_stdout
class DumpDataTests(TestCase):
def test_encoding_de... | jklaiho/django-class-fixtures | class_fixtures/tests/tests_dumpdata.py | Python | bsd-3-clause | 11,960 | 0.008027 |
## Absolute location where all raw files are
RAWDATA_DIR = '/home/cmb-06/as/skchoudh/dna/Oct_10_2016_HuR_Human_Mouse_Liver/rna-seq/Penalva_L_08182016/human'
## Output directory
OUT_DIR = '/staging/as/skchoudh/Oct_10_2016_HuR_Human_Mouse_Liver/RNA-Seq_human'
## Absolute location to 're-ribo/scripts' directory
SRC_... | saketkc/ribo-seq-snakemake | configs/Oct_10_2016_HuR_Human_rna.py | Python | bsd-3-clause | 2,343 | 0.012804 |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: suite.py
"""TestSuite"""
import sys
from . import case
from . import util
__unittest = True
def _call_if_exists(parent, attr):
func = getattr(pa... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/Resources/Python/Core/Lib/unittest/suite.py | Python | unlicense | 10,084 | 0.00119 |
"""
This module is deprecated -- use scipy.linalg.blas instead
"""
from __future__ import division, print_function, absolute_import
try:
from ._cblas import *
except ImportError:
empty_module = True
import numpy as _np
@_np.deprecate(old_name="scipy.linalg.cblas", new_name="scipy.linalg.blas")
d... | beiko-lab/gengis | bin/Lib/site-packages/scipy/linalg/cblas.py | Python | gpl-3.0 | 362 | 0.002762 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.