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 nose.tools import *
from unittest import TestCase
import os
from shutil import rmtree
from tempfile import mkdtemp
from fnmatch import fnmatch
from files.file_matcher_glob import FileMatcherGlob
class FileMatcherGlobTests(TestCase):
def setUp(self):
self.directory = mkdtemp('-caboose-file-matcher-gl... | markdrago/caboose | src/test/files/file_matcher_glob_tests.py | Python | mit | 1,146 | 0.002618 |
"""Test kytos.core.buffers module."""
import asyncio
from unittest import TestCase
from unittest.mock import MagicMock, patch
from kytos.core.buffers import KytosBuffers, KytosEventBuffer
# pylint: disable=protected-access
class TestKytosEventBuffer(TestCase):
"""KytosEventBuffer tests."""
def setUp(self):
... | kytos/kytos | tests/unit/test_core/test_buffers.py | Python | mit | 3,932 | 0 |
#! /usr/bin/env python3
from .config import *
from .diff import *
from .HtmlFormatter import *
from .AnsiFormatter import *
| lahwaacz/python-wikeddiff | WikEdDiff/__init__.py | Python | gpl-3.0 | 125 | 0 |
import datetime
import nrkdownload.utils
def test_valid_filename(string=r":blah/bl:ah.ext"):
filename = nrkdownload.utils.valid_filename(string)
assert filename == "blahblah.ext"
def test_parse_duration(string="PT3H12M41.6S"):
# PT28M39S : 28m39s
# PT3H12M41.6S : 3h12m41.6s
duration = nrkdownlo... | marhoy/nrk-download | tests/test_utils.py | Python | gpl-3.0 | 721 | 0 |
#!/usr/bin/env python
import unittest
from aminer import AMinerParser
class AMinerParserTest(unittest.TestCase):
SINGLE_TEST_FILE = "./aminer_single.txt"
def setUp(self):
self.single_test = open(self.SINGLE_TEST_FILE, "r")
def test_single_parse(self):
p = AMinerParser()
if __name__ == "_... | jevinw/rec_utilities | babel_util/parsers/aminer_test.py | Python | agpl-3.0 | 350 | 0.005714 |
# encoding: utf-8
import datetime
import logging
import os
import re
import urllib
import urllib2
from HTMLParser import HTMLParseError
from urlparse import urlparse
from BeautifulSoup import BeautifulSoup, Comment, NavigableString
from django.contrib.contenttypes.models import ContentType
from django.core.files.base ... | OriHoch/Open-Knesset | simple/parsers/parse_laws.py | Python | bsd-3-clause | 21,686 | 0.003465 |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import logging, os.path
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import tornado.websocket
import tornado.gen
class Application(tornado.web.Application):
def __init__(self):
base_dir = os.path.dirname(__file__)
... | mehmetkose/react-websocket | example/server.py | Python | mit | 1,627 | 0.003688 |
#!/usr/bin/env python
# Calculate a table of pairwise energies and forces between "INT" atoms
# in the lipid membrane model described in
# Brannigan et al, Phys Rev E, 72, 011915 (2005)
# The energy of this interaction U(r) = eps*(0.4*(sigma/r)^12 - 3.0*(sigma/r)^2)
# I realized later this is not what we want becau... | jcarlson23/lammps | tools/moltemplate/examples/CG_membrane_examples/membrane_BranniganPRE2005/moltemplate_files/version_charmm_cutoff/calc_table.py | Python | gpl-2.0 | 2,403 | 0.012901 |
# -*- coding: utf-8 -*-
import unittest
import logging
from os.path import isfile
from os import popen
from os import remove
from t2db_objects import objects
from t2db_objects.utilities import formatHash
from t2db_objects.parameters import generate_config_yaml
from clean_text.cleaner import sentenceCleaner
from cle... | ptorrestr/clean_text | clean_text/tests/test_cleaner.py | Python | gpl-2.0 | 7,295 | 0.010981 |
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
#
# Flumotion - a streaming media server
# Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com).
# All rights reserved.
# This file may be distributed and/or modified under the terms of
# the GNU General Public License version 2 as published by
# the Free ... | flyapen/UgFlu | flumotion/worker/__init__.py | Python | gpl-2.0 | 962 | 0 |
import graphene
from .account.schema import AccountMutations, AccountQueries
from .checkout.schema import CheckoutMutations, CheckoutQueries
from .core.schema import CoreMutations
from .discount.schema import DiscountMutations, DiscountQueries
from .menu.schema import MenuMutations, MenuQueries
from .order.schema impo... | UITools/saleor | saleor/graphql/api.py | Python | bsd-3-clause | 1,246 | 0 |
# Copyright (c) 2018 PaddlePaddle 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 app... | Canpio/Paddle | python/paddle/fluid/tests/book/high-level-api/recognize_digits/test_recognize_digits_mlp.py | Python | apache-2.0 | 3,760 | 0.000266 |
#coding=UTF-8
from pyspark import SparkContext, SparkConf, SQLContext, Row, HiveContext
from pyspark.sql.types import *
from datetime import date, datetime, timedelta
import sys, re, os
st = datetime.now()
conf = SparkConf().setAppName('PROC_O_IBK_WSYH_ECUSRLOGINTYPE').setMaster(sys.argv[2])
sc = SparkContext(conf = c... | cysuncn/python | spark/crm/PROC_O_IBK_WSYH_ECUSRLOGINTYPE.py | Python | gpl-3.0 | 6,837 | 0.013234 |
import concurrent.futures
from itertools import islice
import xbmc
import threading
Executor = concurrent.futures.ThreadPoolExecutor
def execute(f, iterable, stop_flag=None, workers=10, timeout=30):
with Executor(max_workers=workers) as executor:
threading.Timer(timeout, stop_flag.set)
for future... | repotvsupertuga/tvsupertuga.repository | script.module.universalscrapers/lib/universalscrapers/executor.py | Python | gpl-2.0 | 842 | 0.001188 |
from src.settings import Colors
def league_color(league: str) -> Colors:
if league in [
]:
return Colors.GREEN
if league in [
'1 CFL (Montenegro)',
'A Lyga (Lithuania)',
'Bikar (Iceland)',
'Coupe de la Ligue (France)',
'EURO Qualifiers (Europe)',
'F... | vapkarian/soccer-analyzer | src/colors/v20/default.py | Python | mit | 1,079 | 0 |
# Third-party
import astropy.units as u
import numpy as np
# Project
from ....dynamics import PhaseSpacePosition, Orbit
from ....units import galactic
PSP = PhaseSpacePosition
ORB = Orbit
class _TestBase(object):
use_half_ndim = False
E_unit = u.erg/u.kg
@classmethod
def setup_class(cls):
np... | adrn/gala | gala/potential/hamiltonian/tests/helpers.py | Python | mit | 5,372 | 0.001862 |
import os
def get_html_theme_path():
theme_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
return theme_dir
| iktakahiro/sphinx_theme_pd | sphinx_theme_pd/__init__.py | Python | mit | 136 | 0 |
#!/usr/bin/env python
# encoding: utf-8
"""
Waf tool for ChibiOS build
"""
from waflib import Errors, Logs, Task, Utils
from waflib.TaskGen import after_method, before_method, feature
import os
import shutil
import sys
import re
import pickle
_dynamic_env_data = {}
def _load_dynamic_env_data(bld):
bldnode = bld... | yonahbox/ardupilot | Tools/ardupilotwaf/chibios.py | Python | gpl-3.0 | 13,403 | 0.005596 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-04-19 10:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0015_auto_20160408_1355'),
]
operations = [
migrations.AlterField(
... | hep7agon/city-feedback-hub | api/migrations/0016_service_code.py | Python | mit | 640 | 0 |
__copyright__ = """
Copyright (C) 2006, Catalin Marinas <catalin.marinas@gmail.com>
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.
This program is distributed in the hope that it will be ... | miracle2k/stgit | stgit/commands/sync.py | Python | gpl-2.0 | 5,549 | 0.007929 |
'''
modified by Chongxuan Li (chongxuanli1991@gmail.com)
'''
import sys
sys.path.append('..')
sys.path.append('../../data/')
import os, numpy as np
import scipy.io as sio
import time
import anglepy as ap
import anglepy.paramgraphics as paramgraphics
import anglepy.ndict as ndict
import theano
import theano.tensor as... | zhenxuan00/mmdgm | mlp-mmdgm/gpulearn_z_x.py | Python | mit | 50,776 | 0.015499 |
#!/usr/bin/env python3
"""
Author: Kartamyshev A.I. (Darth Feiwante)
"""
def inherit_icalc_isotropic(new_structure = '', start_new_version = None, base_calculation = (None, None, None), database = None, min_mult = 1, max_mult = 1, num_points = 2, geo_folder = '', it_folder = '', override = False):
"""
This f... | dimonaks/siman | siman/structure_functions.py | Python | gpl-2.0 | 8,328 | 0.018492 |
# Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | glove747/liberty-neutron | neutron/tests/unit/agent/linux/test_external_process.py | Python | apache-2.0 | 11,219 | 0 |
from datetime import date
import os
from django.contrib.auth.models import User
from django import forms
from django.utils import timezone
from fields import Html5CaptchaField
from html5input import *
from settings import AVAILABLE_TEMPLATES, TEMPLATE_DIRS
from accounts.models import UserProfile
class SettingsUserFor... | upTee/upTee | uptee/accounts/forms.py | Python | bsd-3-clause | 7,709 | 0.004281 |
"""
This page is in the table of contents.
Plugin to home the tool at beginning of each layer.
The home manual page is at:
http://fabmetheus.crsndoo.com/wiki/index.php/Skeinforge_Home
==Operation==
The default 'Activate Home' checkbox is on. When it is on, the functions described below will work, when it is off, not... | makerbot/ReplicatorG | skein_engines/skeinforge-47/skeinforge_application/skeinforge_plugins/craft_plugins/home.py | Python | gpl-2.0 | 8,040 | 0.023383 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014, 2015 CERN.
##
## Invenio 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 opt... | egabancho/invenio | invenio/modules/jsonalchemy/testsuite/test_parser.py | Python | gpl-2.0 | 10,487 | 0.00143 |
# 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 unicode_literals
import json
import os
import sys
import environment as env
import products
imp... | shinglyu/servo | tests/wpt/harness/wptrunner/wptrunner.py | Python | mpl-2.0 | 9,731 | 0.00185 |
# Copyright 2017 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 or agreed to in writing, ... | googleapis/google-resumable-media-python | google/resumable_media/_helpers.py | Python | apache-2.0 | 12,563 | 0.000637 |
import uuid
import logging
import threading
from sleekxmpp import Message, Iq
from sleekxmpp.exceptions import XMPPError
from sleekxmpp.xmlstream.handler import Callback
from sleekxmpp.xmlstream.matcher import StanzaPath
from sleekxmpp.xmlstream import register_stanza_plugin
from sleekxmpp.plugins import BasePlugin
fr... | tiancj/emesene | emesene/e3/xmpp/SleekXMPP/sleekxmpp/plugins/xep_0047/ibb.py | Python | gpl-3.0 | 5,190 | 0.000193 |
# -*- coding: utf-8 -*-
"""
End-to-end tests for the main LMS Dashboard (aka, Student Dashboard).
"""
import six
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPage
from common.test.acceptance.pages.lms.dashboard im... | msegado/edx-platform | common/test/acceptance/tests/lms/test_lms_dashboard.py | Python | agpl-3.0 | 5,727 | 0.002794 |
from jarbas_utils.skill_tools import LILACSstorageQuery
from mycroft.util.log import getLogger
__authors__ = ["jarbas", "heinzschmidt"]
class ConceptNode():
'''
Node:
name:
type: "informational" <- all discussed nodes so far are informational
Connections:
synonims: [] <- is... | JarbasAI/JarbasAI | jarbas_skills/LILACS_core/concept.py | Python | gpl-3.0 | 25,737 | 0.002487 |
from django.db import models
from django.utils import timezone
from pytz import common_timezones
from .validators import YoutubeValidator
class TimezoneField(models.CharField):
"""
A field for selecting a timezone from the common timezones list.
"""
def __init__(self, *args, **kwargs):
common... | gamernetwork/gn-django | gn_django/fields.py | Python | mit | 909 | 0.0011 |
from functools import partial
from .primitives import EMPTY
__all__ = ['identity', 'constantly', 'caller',
'partial', 'rpartial', 'func_partial',
'curry', 'rcurry', 'autocurry',
'iffy']
def identity(x):
return x
def constantly(x):
return lambda *a, **kw: x
# an operator.m... | musicpax/funcy | funcy/simple_funcs.py | Python | bsd-3-clause | 1,941 | 0.002576 |
from __future__ import unicode_literals
from functools import partial
from future.utils import with_metaclass
from django import VERSION
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Model, Field
from django.db.models.signals import class_prepared... | fusionbox/mezzanine | mezzanine/utils/models.py | Python | bsd-2-clause | 8,880 | 0.000113 |
import logging
import os
import re
import uuid
from io import BytesIO
import six
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import AssetKey, CourseKey
from opaque_keys.edx.locator import AssetLocator
from PIL import Image
from six.moves.urllib.parse import parse_qsl, quote_plus, urlencode, url... | cpennington/edx-platform | common/lib/xmodule/xmodule/contentstore/content.py | Python | agpl-3.0 | 19,503 | 0.00323 |
"""A collection of classes and methods to deal with collections of
rates that together make up a network."""
# Common Imports
import warnings
import functools
import math
import os
from operator import mul
from collections import OrderedDict
from ipywidgets import interact
import numpy as np
import matplotlib as mp... | pyreaclib/pyreaclib | pynucastro/networks/rate_collection.py | Python | bsd-3-clause | 34,049 | 0.002731 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Parallel workflow execution via IPython controller
"""
from __future__ import print_function, division, unicode_literals, absolute_import
from future import standard_library
stan... | carolFrohlich/nipype | nipype/pipeline/plugins/ipython.py | Python | bsd-3-clause | 4,707 | 0.002337 |
# Copyright 2013-2020 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Account Fiscal Position VAT Check",
"version": "14.0.1.0.0",
"category": "Invoices & Payments",
"license": ... | OCA/account-financial-tools | account_fiscal_position_vat_check/__manifest__.py | Python | agpl-3.0 | 637 | 0 |
# -*- coding: utf-8 -*-
# RTCP Datagram Module
from struct import unpack, pack
debug = 0
# Receiver Reports included in Sender Report
class Report:
SSRC = 0
FractionLost = 0
CumulativeNumberOfPacketsLostH = 0
CumulativeNumberOfPacketsLostL = 0
ExtendedHighestSequenceNumberReceived = 0
Interarr... | plazmer/pyrtsp | rtcp_datagram.py | Python | gpl-2.0 | 6,169 | 0.003242 |
#!/usr/bin/python
#
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | googleads/googleads-shopping-samples | python/shopping/content/datafeeds/update.py | Python | apache-2.0 | 1,688 | 0.007109 |
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glm import H2OGeneralizedLinearEstimator as glm
# Given alpha array and lambda_search=True, build two cross-validation models, one with validation dataset
# and one without for multinomial. Since they use the metri... | michalkurka/h2o-3 | h2o-py/tests/testdir_algos/glm/pyunit_PUBDEV_7481_lambda_search_alpha_array_multinomial_cv.py | Python | apache-2.0 | 2,324 | 0.012909 |
# This file is part of Androguard.
#
# Copyright (c) 2012 Geoffroy Gueguen <geoffroy.gueguen@gmail.com>
# 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://... | IOsipov/androguard | androguard/decompiler/dad/basic_blocks.py | Python | apache-2.0 | 10,681 | 0.000094 |
default_app_config = 'providers.com.dailyssrn.apps.AppConfig'
| zamattiac/SHARE | providers/com/dailyssrn/__init__.py | Python | apache-2.0 | 62 | 0 |
"""
=============================================
Effect of varying threshold for self-training
=============================================
This example illustrates the effect of a varying threshold on self-training.
The `breast_cancer` dataset is loaded, and labels are deleted such that only 50
out of 569 samples h... | manhhomienbienthuy/scikit-learn | examples/semi_supervised/plot_self_training_varying_threshold.py | Python | bsd-3-clause | 4,008 | 0.000749 |
from flask import url_for
from flask_sqlalchemy import BaseQuery
def test_create_av_scan(client, monkeypatch, malware_sample):
monkeypatch.setattr(BaseQuery, 'first_or_404', lambda x: True)
rv = client.post(url_for('api.add_av_scan'),
json={'files': [malware_sample._asdict()]})
assert... | certeu/do-portal | tests/test_av.py | Python | bsd-3-clause | 343 | 0 |
from math import isnan
from nose.tools import eq_
from js_helper import _do_real_test_raw, _do_test_raw, _do_test_scope, _get_var
def test_assignment_with_pollution():
"""
Access a bunch of identifiers, but do not write to them. Accessing
undefined globals should not create scoped objects.
"""
a... | kmaglione/amo-validator | tests/test_js_operators.py | Python | bsd-3-clause | 7,066 | 0.000849 |
import boto3
import json
import pytest
import sure # noqa # pylint: disable=unused-import
from boto3 import Session
from botocore.client import ClientError
from moto import settings, mock_s3control, mock_config
# All tests for s3-control cannot be run under the server without a modification of the
# hosts file on yo... | spulec/moto | tests/test_s3control/test_s3control_config_integration.py | Python | apache-2.0 | 11,847 | 0.001013 |
import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
from amon.apps.alerts.models import AlertsModel
from amon.apps.processes.models import process_model
from amon.apps.plugins.models import plugin_model
from amon.apps.servers.models import server_model
from amon.apps.devices.mode... | martinrusev/amonone | amon/apps/alerts/models/tests/alerts_model_test.py | Python | mit | 13,755 | 0.012432 |
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
from django.db import models
class IntegerUsernameUserManager(BaseUserManager):
def create_user(self, username, password):
user = self.model(username=username)
user.set_password(password)
user.save(using=self._db)
... | nesdis/djongo | tests/django_tests/tests/v22/tests/auth_tests/models/with_integer_username.py | Python | agpl-3.0 | 681 | 0 |
import sys
import ray
import pytest
from ray.test_utils import (
generate_system_config_map,
wait_for_condition,
wait_for_pid_to_exit,
)
@ray.remote
class Increase:
def method(self, x):
return x + 2
@ray.remote
def increase(x):
return x + 1
@pytest.mark.parametrize(
"ray_start_reg... | robertnishihara/ray | python/ray/tests/test_gcs_fault_tolerance.py | Python | apache-2.0 | 3,783 | 0.000264 |
# -*- coding: utf-8 -*-
# Copyright (C) Canux CHENG <canuxcheng@gmail.com>
#
# 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 ... | crazy-canux/xplugin_nagios | plugin/plugins/sharepoint_2013/src/plugin/base.py | Python | gpl-2.0 | 3,450 | 0 |
# coding: utf-8
from __future__ import absolute_import
from swagger_server.models.error_model import ErrorModel
from swagger_server.models.taxonomy import Taxonomy
from . import BaseTestCase
from six import BytesIO
from flask import json
class TestTaxonomyController(BaseTestCase):
""" TaxonomyController integra... | EarthLifeConsortium/elc_api | swagger_server/test/test_taxonomy_controller.py | Python | apache-2.0 | 995 | 0.001005 |
''' DowntimeCommand module
'''
import urllib2
from datetime import datetime, timedelta
from operator import itemgetter
from DIRAC import S_OK, S_ERROR
from DIRAC.Core.LCG.GOCDBClient import GOCDBClient
from DIRAC.Core.Utilities.Site... | vmendez/DIRAC | ResourceStatusSystem/Command/DowntimeCommand.py | Python | gpl-3.0 | 13,233 | 0.042167 |
from datetime import date, datetime
from unittest import TestCase
from myob.constants import DEFAULT_PAGE_SIZE
from myob.credentials import PartnerCredentials
from myob.managers import Manager
class QueryParamTests(TestCase):
def setUp(self):
cred = PartnerCredentials(
consumer_key='KeyToTheK... | ABASystems/pymyob | tests/test_managers.py | Python | bsd-3-clause | 3,511 | 0.003987 |
import os
import json
import numpy as np
from sklearn.externals import joblib
from scripts.features.post import Post
from scripts.features.post_feature import PostFeature
import scripts.features.length_extractor as lext
import scripts.features.charactor_extractor as cext
import scripts.features.structure_extractor as s... | chakki-works/elephant_sense | elephant_sense/evaluator.py | Python | apache-2.0 | 2,383 | 0.002098 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo Addon, Open Source Management Solution
# Copyright (C) 2014-now Equitania Software GmbH(<http://www.equitania.de>).
#
# This program is free software: you can redistribute it and/or modify
# it un... | equitania/myodoo-addons-v10 | eq_stock/models/eq_report_stock.py | Python | agpl-3.0 | 3,096 | 0.002913 |
from datetime import datetime
import pandas as pd
from pandas.util.testing import assert_frame_equal
import ulmo
import ulmo.usgs.eddn.parsers as parsers
import test_util
fmt = '%y%j%H%M%S'
message_test_sets = [
{
'dcp_address': 'C5149430',
'number_of_lines': 4,
'parser': 'twdb_stevens',
... | nathanhilbert/ulmo | test/usgs_eddn_test.py | Python | bsd-3-clause | 13,809 | 0.004779 |
#!/usr/bin/env python
# Fan control mod for Raspberry Pi
import RPi.GPIO as GPIO, time, datetime, subprocess, os, logging
from daemon import runner
DEBUG = 1
GPIO.setmode(GPIO.BCM)
# Respective ports on the GPIO header
FAST = 18
SLOW = 25
# Default settings for fan control
MAX_TEMP = 50
MIN_TEMP = 40
POLL_TIME =... | zainag/RPi-Test-Projects | fan_control_daemon.py | Python | mit | 2,129 | 0.034758 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | jiaphuan/models | tutorials/image/cifar10/cifar10_train.py | Python | apache-2.0 | 4,491 | 0.004899 |
from tests.compiler import compile_snippet, A_ID, LST_ID, SELF_ID, VAL1_ID, internal_call, A_INST, INNER_ID, \
CONTAINER_INNER_ID, STATIC_START
from thinglang.compiler.opcodes import OpcodePushLocal, OpcodePushMember, OpcodePushStatic, OpcodePop, \
OpcodeDereference, OpcodeCallVirtual
def test_direct_member_a... | ytanay/thinglang | tests/compiler/test_access_compilation.py | Python | mit | 1,587 | 0.00189 |
from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '0.0.1'
class Extension(ext.Extension):
dist_name = 'Mopidy-USBPlaylist'
ext_name = 'usbplaylist'
version = __version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__f... | avanc/mopidy-usbplaylist | mopidy_usbplaylist/__init__.py | Python | apache-2.0 | 668 | 0 |
import pytest
import logging
@pytest.mark.asyncio
async def test_confirmation(rpc_context):
# setup rpc
async def test_method(request):
a = await request.confirm('just say yes!', timeout=1)
logging.debug('a = %s', a)
return a
rpc_context.rpc.add_methods(('', test_method))
#... | pengutronix/aiohttp-json-rpc | tests/test_forms.py | Python | apache-2.0 | 530 | 0 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('productos', '0003_auto_20141118_2241'),
]
operations = [
migrations.AlterField(
model_name='imagenes',
... | gabrielf10/Soles-pythonanywhere | productos/migrations/0004_auto_20141119_0117.py | Python | bsd-3-clause | 496 | 0.002016 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class CabukcgcrawlerPipeline(object):
def process_item(self, item, spider):
return item
| codeforkaohsiung/CabuKcgCrawler | CabuKcgCrawler/pipelines.py | Python | mit | 294 | 0 |
"""
This file holds utility functions that have no dependencies on other console code.
Avoids import loops
"""
import webcolors
def wc(clr, factor=0.0, layercolor=(255, 255, 255)):
lc = webcolors.name_to_rgb(layercolor.lower()) if isinstance(layercolor, str) else layercolor
if isinstance(clr, str):
try:
v = we... | kevinkahn/softconsole | utils/utilfuncs.py | Python | apache-2.0 | 3,291 | 0.033728 |
# -*- coding: utf-8 -*-
"""
/***************************************************************************
IOGeopaparazzi
A QGIS plugin
A plugin to import/export geodata from/to geopaparazzi
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin :... | eachiaradia/IOGeopaparazzi | io_geopaparazzi_provider.py | Python | gpl-3.0 | 2,828 | 0.020156 |
import csv
import sys
from models import *
from datetime import datetime
import codecs
import json
# from models import Attorney, Organization
from flask_mail import Message
def load_attorneys_from_csv(filename):
with codecs.open(filename, mode='rb', encoding='utf-8') as csvfile:
attorneys = [row for row ... | mitzvotech/honorroll | app/utils.py | Python | mit | 2,178 | 0.002296 |
import pycurl
import cStringIO
import random
import HTMLParser
def generate_TAXII_header(xml, ssl=True):
headers = {
"Content-Type": "application/xml",
"Content-Length": str(len(xml)),
"User-Agent": "TAXII Client Application",
"Accept": "application/xml",
"X-TAXII-Accept": "urn:taxii... | hazmalware/sharephish | taxiigenerator.py | Python | gpl-3.0 | 3,968 | 0.024698 |
# coding=utf-8
"""
Write the collected stats to a locally stored log file. Rotate the log file
every night and remove after 7 days.
"""
from Handler import Handler
import logging
import logging.handlers
class ArchiveHandler(Handler):
"""
Implements the Handler abstract class, archiving data to a log file
... | Ormod/Diamond | src/diamond/handler/archive.py | Python | mit | 2,195 | 0 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 绘制简单的折线图
import matplotlib.pyplot as plt
input_values = list(range(1, 6))
squares = [x * x for x in input_values]
# 根据传递的参数来绘制出有意义的图形
plt.plot(input_values, squares, linewidth=3)
# 设置图表的标题及标题的字体大小
plt.title("Square Numbers", fontsize=14)
# 给坐标轴加上标签
plt.xlabel("Value... | felix9064/python | Demo/pcc/mpl_squares.py | Python | mit | 606 | 0 |
from pytest_bdd import scenario
from .contact_steps import *
@scenario("contacts.feature", "Add new contact")
def test_add_new_contact():
pass
@scenario("contacts.feature", "Delete a contact")
def test_delete_contact():
pass
@scenario("contacts.feature", "Modify a contact")
def test_modify_contact():
... | yupasik/python_training | bdd/contact_scenarios.py | Python | apache-2.0 | 325 | 0 |
from webfs import WebFSStat
import stat
def Test_Basic():
fields = ('st_mode', 'st_ino', 'st_dev', 'st_nlink', 'st_uid', 'st_gid',
'st_size', 'st_atime', 'st_mtime', 'st_ctime')
st = WebFSStat()
print st.__dict__.keys()
for field in fields:
assert field in st.__dict__.keys(), 'fi... | harun-emektar/webfs | tests/Test_WebFSStat.py | Python | apache-2.0 | 655 | 0.015267 |
from operator import attrgetter
from traits.api import Any, Int, Bool, on_trait_change, Dict, Button, Str, \
HasTraits, cached_property, Property, Event, Either, Float, Instance
from traitsui.api import View, Item, UItem, VGroup, HGroup, Spring, \
TabularEditor, HSplit, Group, ModelView
from traitsui.tabular_a... | enthought/pikos | pikos/live/ui/cprofile_view.py | Python | bsd-3-clause | 8,716 | 0.000459 |
from django.conf.urls import patterns, include, url
from django.shortcuts import redirect, render_to_response
from django.template.context import RequestContext
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
# Just redirect / to /blog for now until I can
# co... | Justasic/StackSmash | StackSmash/urls.py | Python | bsd-2-clause | 3,146 | 0.00445 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
BarPlot.py
---------------------
Date : January 2013
Copyright : (C) 2013 by Victor Olaya
Email : volayaf at gmail dot com
******************************... | drnextgis/QGIS | python/plugins/processing/algs/qgis/BarPlot.py | Python | gpl-2.0 | 3,271 | 0.000611 |
# -*- coding:utf-8 -*-
from Crypto.Cipher import AES
from Crypto.Hash import MD5
import binascii
import urllib2
import string, random
# algorithm
MODE = AES.MODE_CBC
def __getKeyObject(key):
obj = AES.new(md5Encoding(key), MODE)
return obj
def md5Encoding(msg):
'''
get md5 encrypted text
@param ... | zhyu/PasswdManager | util.py | Python | gpl-3.0 | 1,732 | 0.011547 |
#!/usr/bin/env python
quit()
for iii in range(0,6):
try:
print(iii,iii/(4-iii))
except ZeroDivisionError as e:
#print("wrong: i={} {}".format(iii,e.message))
print("wrong: i={} {}".format(iii,"nooooooo"))
#else:
# print("OK")
finally:
print("continue...")
d... | jgphpc/linux | python/0.py | Python | gpl-2.0 | 888 | 0.029279 |
# Copyright 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 a... | eharney/cinder | cinder/api/contrib/volume_image_metadata.py | Python | apache-2.0 | 6,636 | 0 |
''' Provide Jinja2 templates used by Bokeh to embed Bokeh models
(e.g. plots, widgets, layouts) in various ways.
.. bokeh-jinja:: bokeh.core.templates.AUTOLOAD_JS
.. bokeh-jinja:: bokeh.core.templates.AUTOLOAD_NB_JS
.. bokeh-jinja:: bokeh.core.templates.AUTOLOAD_TAG
.. bokeh-jinja:: bokeh.core.templates.CSS_RESOURCES
... | philippjfr/bokeh | bokeh/core/templates.py | Python | bsd-3-clause | 1,358 | 0 |
# Copyright (C) 2003-2005 Peter J. Verveer
#
# 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 code must retain the above copyright
# notice, this list of conditions and the following d... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/scipy/ndimage/filters.py | Python | mit | 52,520 | 0.00019 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
from erlport.erlterms import Atom, List
from erlport.erlang import set_encoder, set_decoder
def setup_dtype():
set_encoder(dtype_encoder)
set_decoder(dtype_decoder)
return Atom(b'ok')
def dtype_encoder(value):
if isi... | zgbjgg/jun | priv/jun_enc_dec.py | Python | mit | 1,427 | 0.005606 |
# Module to run tests on surveys
# Most of these are *not* done with Travis yet
# TEST_UNICODE_LITERALS
import pytest
import os
import shutil
import numpy as np
from astropy.table import Table
from frb.galaxies.frbgalaxy import FRBHost
from frb.galaxies import eazy as frbeazy
from frb.frb import FRB
from distutils... | FRBs/FRB | frb/tests/test_eazy.py | Python | bsd-3-clause | 2,608 | 0.003067 |
# -*- coding: utf-8 -*-
__all__ = ["cc"]
| MarieVdS/ComboCode | __init__.py | Python | gpl-3.0 | 42 | 0 |
#
#Programa Lista 4, questão 1;
#Felipe Henrique Bastos Costa - 1615310032;
#
#
#
#
lista = []#lista vazia;
cont1 = 0#contador do indice;
cont2 = 1#contador da posição do numero, se é o primeiro, segundo etc;
v = 5#representaria o len da lista;
while(cont1 < v):
x = int(input("Informe o %dº numero inteiro para c... | any1m1c/ipc20161 | lista4/ipc_lista4.01.py | Python | apache-2.0 | 675 | 0.040299 |
# -*- coding: utf-8 -*-
#############################################################
# This file was automatically generated on 2022-01-18. #
# #
# Python Bindings Version 2.1.29 #
# ... | Tinkerforge/brickv | src/brickv/bindings/bricklet_linear_poti_v2.py | Python | gpl-2.0 | 14,625 | 0.004239 |
from django import forms
from .models import Post
from django.contrib.auth import (
authenticate,
get_user_model,
login,
logout,
)
class PostForm(forms.ModelForm): # Post Thread View
class Meta:
model = Post
fields = ['title','image', 'user','country','guide']
widgets = { 'guide' : forms.Textarea(attrs = ... | lemarcudal/sha_thedivision | test/mysite/webapp/forms.py | Python | apache-2.0 | 1,935 | 0.03876 |
# -*- coding: utf-8 -*-
import sys
from warnings import warn
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
if hasattr(settings, 'MODELTRANSLATION_TRANSLATION_REGISTRY'):
TRANSLATION_REGISTRY =\
getattr(settings, 'MODELTRANSLATION_TRANSLATION_REGISTRY', None)
elif ha... | ilblackdragon/django-modeltranslation | modeltranslation/settings.py | Python | bsd-3-clause | 1,569 | 0.003187 |
#!/usr/bin/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 as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This progra... | 0vercl0k/rp | src/third_party/beaengine/tests/0f3a25.py | Python | mit | 2,835 | 0.001411 |
var1 = bool(input())
var2 = bool(input())
if var1:
print(var2)
elif v<caret> | siosio/intellij-community | python/testData/codeInsight/mlcompletion/isInConditionSimpleElif.py | Python | apache-2.0 | 78 | 0.051282 |
# -*- coding: latin-1 -*-
import re
import json
from .common import InfoExtractor
from ..utils import determine_ext
class HarkIE(InfoExtractor):
_VALID_URL = r'https?://www\.hark\.com/clips/(.+?)-.+'
_TEST = {
u'url': u'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-targ... | lebabouin/CouchPotatoServer-develop | couchpotato/core/providers/trailer/vftrailers/youtube_dl/extractor/hark.py | Python | gpl-3.0 | 1,526 | 0.003932 |
#!/usr/bin/python
# Copyright 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
# Regression test: it was possible that due to evaluation of conditional
# requirements, two different values of non-free featur... | davehorton/drachtio-server | deps/boost_1_77_0/tools/build/test/conditionals2.py | Python | mit | 960 | 0 |
# -*- coding: utf8 -*-
# This file is part of PyBossa.
#
# Copyright (C) 2013 SF Isle of Man Limited
#
# PyBossa is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at... | geotagx/geotagx-pybossa-archive | test/test_authentication.py | Python | agpl-3.0 | 1,229 | 0 |
# 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 use ... | ClusterHQ/libcloud | libcloud/compute/drivers/hostvirtual.py | Python | apache-2.0 | 10,709 | 0.000093 |
#!/usr/bin/env python
# imp general
import IMP
import IMP.core
# our project
from IMP.isd import Weight
from IMP.isd import WeightMover
# unit testing framework
import IMP.test
class TestWeightMover(IMP.test.TestCase):
"""tests weight setup"""
def setUp(self):
IMP.test.TestCase.setUp(self)
... | shanot/imp | modules/isd/test/test_mc_WeightMover.py | Python | gpl-3.0 | 1,309 | 0 |
from django.contrib import admin
# import your models
# Register your models here.
# admin.site.register(YourModel) | datamade/la-metro-councilmatic | lametro/admin.py | Python | mit | 116 | 0.008621 |
# 2016-7-1
# build by qianqians
# tools
def gentypetocsharp(typestr):
if typestr == 'int':
return 'Int64'
elif typestr == 'string':
return 'String'
elif typestr == 'array':
return 'ArrayList'
elif typestr == 'float':
return 'Double'
elif typestr == 'bool':
re... | yinchunlong/abelkhan-1 | juggle/gen/csharp/tools.py | Python | mit | 394 | 0.007614 |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from collections import defaultdict
from operator import attrgetter
from flask import render_template, se... | ThiefMaster/indico | indico/modules/events/timetable/util.py | Python | mit | 16,943 | 0.003305 |
#------------------------------------------------------------------------------
# Naam: libLog.py
# Omschrijving: Generieke functies voor logging binnen BAG Extract+
# Auteur: Matthijs van der Deijl
# Auteur: Just van den Broecke - porting naar NLExtract (2015)
#
# Versie: 1.3
# ... | sebastic/NLExtract | bag/src/loggui.py | Python | gpl-3.0 | 2,159 | 0.003705 |
#!/usr/bin/python
#
# Project Kimchi
#
# Copyright IBM, Corp. 2013
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later ver... | ssdxiao/kimchi | src/kimchi/vnc.py | Python | lgpl-2.1 | 1,961 | 0.00051 |
import logging
from datetime import date as _date, timedelta
from typing import Dict, List
from fahrplan.exception import FahrplanError
from fahrplan.xml import XmlWriter, XmlSerializable
from .conference import Conference
from .day import Day
from .event import Event
from .room import Room
log = logging.getLogger(... | zuntrax/schedule-ng | fahrplan/model/schedule.py | Python | gpl-3.0 | 3,835 | 0.001304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.