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 |
|---|---|---|---|---|---|---|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 NEC Corporation
#
# 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
#... | rackerlabs/horizon | openstack_dashboard/dashboards/project/networks/views.py | Python | apache-2.0 | 5,149 | 0.000971 |
# -*- coding: utf-8 -*-
# wpcdesk - WordPress Comment Desktop
# Copyright (C) 2012 Eka Putra - ekaputra@balitechy.com
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of ... | ekaputra07/wpcdesk | wpcdesk/comment_editor.py | Python | gpl-3.0 | 4,371 | 0.004576 |
import chainer
def main():
return chainer.datasets.get_mnist(withlabel=False)[0]
| fukatani/CW_gui | examples/mnist/get_mnist_prediction.py | Python | bsd-3-clause | 87 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#==============================================================================
# Copyright 2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Amazon Software License (the "License"). You may not use
# this file except in compliance with th... | coen-hyde/dotfiles | libs/eb/scli/constants.py | Python | mit | 21,046 | 0.013779 |
#!/usr/bin/python
#
# Copyright (c) 2018 Yuwei Zhou, <yuwzho@microsoft.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',
... | helldorado/ansible | lib/ansible/modules/cloud/azure/azure_rm_servicebus.py | Python | gpl-3.0 | 6,397 | 0.003126 |
#
# django-newsletter documentation build configuration file, created by
# sphinx-quickstart on Wed Nov 13 13:53:07 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.
#
# All configuration... | dsanders11/django-newsletter | docs/conf.py | Python | agpl-3.0 | 9,244 | 0.006274 |
#
# XendBootloader.py - Framework to run a boot loader for picking the kernel
#
# Copyright 2005-2006 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# ... | sudkannan/xen-hv | tools/python/xen/xend/XendBootloader.py | Python | gpl-2.0 | 7,323 | 0.004779 |
# Brandon Michael
# cis142
# checkForQuadrant.py
# Goal: This program will keep asking for input values to check for the quadrant postion,
# origin, x-axis and y axis postions
# Notes: I used a while loop to make testing values easier and I used the input x,y
# Display program instructions
print("####################... | bwmichael/jccc-cis142-python | old/check-quadrant.py | Python | apache-2.0 | 3,124 | 0.003201 |
# Copyright (c) 2015 Mirantis, 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 writin... | sajuptpm/murano | contrib/plugins/murano_exampleplugin/murano_exampleplugin/cfg.py | Python | apache-2.0 | 822 | 0 |
"""
Summary:
Factory class for building the AUnits from an ISIS data file.
This is used to read and build the parts of the ISIS dat file.
Author:
Duncan Runnacles
Created:
01 Apr 2016
Copyright:
Duncan Runnacles 2016
TODO:
There are a few functions in here that should be made prote... | duncan-r/SHIP | ship/utils/fileloaders/datloader.py | Python | mit | 9,666 | 0.001552 |
# Copyright 2012 IBM Corp.
# Copyright 2013 Red Hat, 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 r... | sacharya/nova | nova/tests/conductor/test_conductor.py | Python | apache-2.0 | 83,151 | 0.000457 |
"""
This state is used to create and manage ELBs.
Examples
========
.. code-block:: yaml
.webserver-elb:
elb.managed:
- name: webserver-elb
- region: us-west-1
- zones:
- us-west-1a
- us-west-1c
- listeners:
- [80, 80, 'http', 'http']
... | mathcamp/aws-formula | _states/elb.py | Python | mit | 3,106 | 0.001288 |
# Copyright (c) 2015 Fabian Kochem
| jameshy/libtree | tests/__init__.py | Python | mit | 35 | 0 |
"""."""
import numpy as np
import pyaccel
from siriuspy.namesys import SiriusPVName as _PVName
from siriuspy.devices import SOFB
from ..optimization import SimulAnneal
from ..utils import ThreadedMeasBaseClass as _BaseClass, \
ParamsBaseClass as _ParamsBaseClass
class Params(_ParamsBaseClass):
"""."""
... | lnls-fac/apsuite | apsuite/commisslib/measure_respmat_tbbo.py | Python | mit | 8,002 | 0.000125 |
import json
import mimetypes
import os
import re
import sys
from copy import copy
from functools import partial
from importlib import import_module
from io import BytesIO
from urllib.parse import unquote_to_bytes, urljoin, urlparse, urlsplit
from django.conf import settings
from django.core.handlers.base import BaseHa... | uranusjr/django | django/test/client.py | Python | bsd-3-clause | 26,876 | 0.000595 |
# Copyright (C) 2008-2010 Adam Olsen
#
# 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, or (at your option)
# any later version.
#
# This program is distributed in the hope that... | eri-trabiccolo/exaile | xlgui/devices.py | Python | gpl-2.0 | 4,732 | 0.000634 |
import nose
from nose.tools import *
from unittest import TestCase
from datetime import datetime, timedelta
from repo.date_iterator import DateIterator
class DateIteratorTests(TestCase):
def test_date_iterator_returns_self_on_iter(self):
d = DateIterator(datetime.now(), datetime.now())
eq_(d, d._... | markdrago/caboose | src/test/repo/date_iterator_tests.py | Python | mit | 1,409 | 0.002839 |
"""
dal_dht11 v1.0.0
Auteur: Bruno DELATTRE
Date : 19/09/2016
"""
from lib import com_logger
class DAL_DHT22:
def __init__(self, connection, cursor):
self.connection = connection
self.cursor = cursor
self.logger = com_logger.Logger('DHT22 DAL')
""" Select"""
def get_dht2... | delattreb/TemperatureHumidityServer | src/dal/dal_dht22.py | Python | gpl-3.0 | 1,407 | 0.004975 |
"""SCons.Tool.sgicc
Tool-specific initialization for MIPSPro cc on SGI.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtai... | timj/scons | src/engine/SCons/Tool/sgicc.py | Python | mit | 1,780 | 0.001685 |
import os
import types
import binascii
from django.db import models
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import cached_property
try:
from django.utils.encoding import smart_text
except ImportError:
from django.utils.encoding impo... | gerhc/django-encrypted-fields | encrypted_fields/fields.py | Python | mit | 9,173 | 0.000654 |
# portalocker.py - Cross-platform (posix/nt) API for flock-style file locking.
# Requires python 1.5.2 or better.
"""Cross-platform (posix/nt) API for flock-style file locking.
Synopsis:
import portalocker
file = open("somefile", "r+")
portalocker.lock(file, portalocker.LOCK_EX)
file.seek... | dsuch/ConcurrentLogHandler | src/portalocker.py | Python | apache-2.0 | 3,780 | 0.003704 |
import os
import shutil
import logging
import csv
from dateutil import parser
from django.dispatch import receiver
from hs_core.signals import pre_create_resource, pre_add_files_to_resource, \
pre_delete_file_from_resource, post_add_files_to_resource, post_create_resource, \
pre_metadata_element_create, pre_m... | hydroshare/hydroshare | hs_app_timeseries/receivers.py | Python | bsd-3-clause | 16,631 | 0.002465 |
"""Test for Remote Execution
:Requirement: Remoteexecution
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: RemoteExecution
:Assignee: pondrejk
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from nailgun import client
from nailgun.entity_mixins import TaskFailedErro... | rplevka/robottelo | tests/foreman/api/test_remoteexecution.py | Python | gpl-3.0 | 3,759 | 0.001862 |
#!/usr/bin/python
# Tool to compare MPlayer translation files against a base file. Reports
# conflicting definitions, mismatching arguments, extra definitions
# not present in the base file and (optionally) missing definitions.
# Written by Uoti Urpala
import sys
import re
def parse(filename):
r = {}
f = op... | philipl/mplayer | TOOLS/mphelp_check.py | Python | gpl-2.0 | 2,073 | 0.002412 |
# Fuck you Disyer. Stealing my fucking paypal. GET FUCKED: contextlib
import sys
from functools import wraps
from warnings import warn
__all__ = ['contextmanager', 'nested', 'closing']
class GeneratorContextManager(object):
def __init__(self, gen):
self.gen = gen
def __enter__(self):
... | DedMemez/ODS-August-2017 | contextlib.py | Python | apache-2.0 | 2,267 | 0.002647 |
""" User factory """
import factory
from smserver import models
from test.factories import base
from test.factories.room_factory import RoomFactory
class UserFactory(base.BaseFactory):
""" Classic user name """
class Meta(base.BaseMeta):
model = models.User
name = factory.Sequence(lambda n: "Us... | Nickito12/stepmania-server | test/factories/user_factory.py | Python | mit | 1,150 | 0.00087 |
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | austin987/bandit | docs/source/conf.py | Python | apache-2.0 | 2,480 | 0 |
# pylint: disable=unused-import, unused-variable, missing-docstring
def _readline():
try:
import readline
except ImportError:
print("Module readline not available.")
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
import os
histfile = os.path.join(os.environ["HOME"], 'p... | rwstauner/run_control | python/startup.py | Python | mit | 665 | 0.010526 |
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
#root of project: ...../src
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deplo... | kinglyduck/hackerspace | src/hackerspace_online/settings/production.py | Python | gpl-2.0 | 1,941 | 0.003606 |
# 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 Rocblas(CMakePackage):
"""Radeon Open Compute BLAS library"""
homepage = "https://gi... | iulian787/spack | var/spack/repos/builtin/packages/rocblas/package.py | Python | lgpl-2.1 | 4,299 | 0.002326 |
# -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# l... | stormi/tsunami | src/primaires/objet/commandes/oedit/__init__.py | Python | bsd-3-clause | 3,339 | 0.002402 |
"""
WSGI config for SimpleNote project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "SimpleNote.settings")
from django.... | MaximeRaynal/SimpleNote | src/SimpleNote/wsgi.py | Python | mit | 395 | 0.002532 |
import unittest
from gourmet.importers import importer
class TestImporter (unittest.TestCase):
def setUp (self):
self.i = importer.Importer()
def _get_last_rec_ (self):
return self.i.added_recs[-1]
def testRecImport (self):
self.i.start_rec()
attrs = [('title','Foo'),('... | kirienko/gourmet | tests/test_importer.py | Python | gpl-2.0 | 1,162 | 0.018933 |
import json
from dateutil import parser as datetime_parser
from occam.app import get_redis
from occam.runtime import OCCAM_SERVER_CONFIG_KEY
def get_servers():
redis = get_redis()
servers = json.loads(redis.get(OCCAM_SERVER_CONFIG_KEY))
return servers.items()
def iterate_servers():
redis = get_re... | Yelp/occam | occam/util.py | Python | mit | 715 | 0.004196 |
### import ####################################################################
import os
import time
import pathlib
import shutil
import collections
import appdirs
import toml
import numpy as np
from PySide2 import QtWidgets
import WrightTools as wt
import attune
import pycmds.project.project_globals as g
import... | wright-group/PyCMDS | pycmds/hardware/opas/opas.py | Python | mit | 19,921 | 0.001456 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use, pointless-statement, missing-docstring, unneeded-not
import pytest
import six
from ..match import Match, Matches
from ..pattern import StringPattern, RePattern
from ..formatters import formatters
class TestMatchClass(object):
def test_... | bbsan2k/nzbToMedia | libs/rebulk/test/test_match.py | Python | gpl-3.0 | 20,081 | 0.00239 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import os
f... | plamut/superdesk-core | tests/io/iptc7901_tests.py | Python | agpl-3.0 | 2,239 | 0.000447 |
#!/usr/bin/env python
"""
Assorted utilities for manipulating latitude and longitude values
"""
from __future__ import unicode_literals
__version__ = "1.4"
import math, struct
def signbit(value):
"""
Test whether the sign bit of the given floating-point value is
set. If it is set, this generally mean... | NOAA-ORR-ERD/hazpy.unit_conversion | hazpy/unit_conversion/lat_long.py | Python | unlicense | 11,710 | 0.004953 |
import getpass
import statsd
import logging
LOG = logging.getLogger(__name__)
def increment_as_user(*label_components):
try:
statsd.increment(assemble_label(label_components, getpass.getuser()))
statsd.increment(assemble_label(label_components, 'total'))
except:
LOG.exception('failed ... | genome/flow-core | flow/util/stats.py | Python | agpl-3.0 | 685 | 0.008759 |
# Django settings for wagtaildemo project.
import os
PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..', '..')
BASE_DIR = PROJECT_ROOT
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
# Default to dummy email backend. Configure dev/production/local backend
# ... | gasman/wagtaildemo | wagtaildemo/settings/base.py | Python | bsd-3-clause | 6,927 | 0.000866 |
"""TweetyNet model"""
import torch
from torch import nn
from torch.nn import functional as F
class Conv2dTF(nn.Conv2d):
PADDING_METHODS = ('VALID', 'SAME')
"""Conv2d with padding behavior from Tensorflow
adapted from
https://github.com/mlperf/inference/blob/16a5661eea8f0545e04c86029362e22113c2ec09/... | yardencsGitHub/tf_syllable_segmentation_annotation | src/tweetynet/network.py | Python | bsd-3-clause | 8,302 | 0.00277 |
"""import portalocker
with portalocker.Lock('text.txt', timeout=5) as fh:
fh.write("Sono in testLoxk2.py")
"""
from lockfile import LockFile
lock = LockFile('text.txt')
with lock:
print lock.path, 'is locked.'
with open('text.txt', "a") as file:
file.write("Sono in testLock2.py")
| giulioribe/car-pooling | testLock2.py | Python | gpl-3.0 | 303 | 0 |
# Copyright (c) 2013 Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""
.. module:: decorators
:platform: Unix, Windows
:synopsis: Decorators for SublimePython plugin
.. moduleauthor:: Oscar Campos <oscar.campos@member.fsf.org>
"""
import os
import functools
def debug(f):
... | leonth/private-configs | sublime-text-3/Packages/SublimePythonIDE/server/decorators.py | Python | mit | 598 | 0.001672 |
import os
import urlparse
import requests
import splinter
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from tests.common.utils import urljoin
class Browser(object):
'''Drives the browser in the... | saukrIppl/seahub | tests/ui/driver.py | Python | apache-2.0 | 2,783 | 0.001078 |
# -*- coding: utf-8 -*-
# Mathmaker Lib offers lualatex-printable mathematical objects.
# Copyright 2006-2017 Nicolas Hainaux <nh.techn@gmail.com>
# This file is part of Mathmaker Lib.
# Mathmaker Lib is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | nicolashainaux/mathmakerlib | tests/00_main/01_exceptions_test.py | Python | gpl-3.0 | 2,289 | 0 |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class ScraperItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
| cprakashagr/PythonClass | src/scraper/scraper/items.py | Python | mit | 286 | 0 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | SUSE/azure-sdk-for-python | azure-mgmt-compute/azure/mgmt/compute/compute/v2015_06_15/models/virtual_machine_image.py | Python | mit | 2,245 | 0.001782 |
# This file is part of VoltDB.
# Copyright (C) 2008-2018 VoltDB Inc.
#
# 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... | simonzhangsm/voltdb | tools/voter.d/voter.py | Python | agpl-3.0 | 2,792 | 0.013968 |
#
# AggHelp.py -- help classes for the Agg drawing
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
import aggdraw as agg
from ginga import colors
class AggContext(o... | bsipocz/ginga | ginga/aggw/AggHelp.py | Python | bsd-3-clause | 1,635 | 0.005505 |
"""
RenderPipeline
Copyright (c) 2014-2016 tobspr <tobias.springer1@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 use... | eswartz/RenderPipeline | rpcore/pynative/shadow_atlas.py | Python | mit | 3,799 | 0.001316 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
from onnx import load, checker, NodeProto
def check_model(): # type: () -> None
parser = argparse.ArgumentParser('check-model')
parser.add_arg... | mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/onnx-tensorrt/third_party/onnx/onnx/bin/checker.py | Python | apache-2.0 | 749 | 0 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ElectionSimulation.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| CSC301H-Fall2013/ElectionSimulation | Code/ElectionSimulationInstaller/ElectionSimulation/manage.py | Python | mit | 261 | 0.003831 |
##############################################################################
# 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/cppunit/package.py | Python | lgpl-2.1 | 1,545 | 0 |
# Copyright (c) 2015 bitlinker@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 use, copy, modify, merge, publish... | bitlinker/ArduWeather | Software/NarodmonDaemon/OregonSensor.py | Python | mit | 2,140 | 0.001402 |
#coding=utf8
def hello(instr):
bufstr = " helloWorld!"
return (instr + bufstr), 123
if __name__ == "__main__":
k = "yzh"
print hello(k)
| gdefias/StudyC | VS/test_CcallPY/Test_ccallpy/helloWorld.py | Python | gpl-2.0 | 153 | 0.045752 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
VERSION = (1, 5, 0)
__version__ = '.'.join([str(n) for n in VERSION])
| unnikrishnankgs/va | venv/lib/python3.5/site-packages/external/org_mozilla_bleach/bleach/version.py | Python | bsd-2-clause | 136 | 0 |
import re
from django import forms
from sell.models import ShippingData
from django.contrib.localflavor.us.forms import USStateSelect, USZipCodeField
class ShippingDataForm(forms.ModelForm):
state = forms.CharField(widget=USStateSelect)
save_shipping_info = forms.BooleanField(label="Save Shipping Information... | codepython/CollectorCity-Market-Place | stores/apps/sell/forms.py | Python | apache-2.0 | 1,696 | 0.014741 |
#!/usr/bin/env python3
from math import pi, atan
class ScanSetting(object):
"""docstring for ScanSetting"""
def __init__(self):
super(ScanSetting, self).__init__()
# for scan
self.scan_step = 400 # steps
self.theta_a = pi / 6 # radius between center and laser
self.im... | blesscat/flux_line_bot | fluxclient/scanner/scan_settings.py | Python | agpl-3.0 | 1,386 | 0 |
import logging
import hashlib
from pylons import request, response, session, tmpl_context as c
from pylons.controllers.util import abort, redirect_to, etag_cache
from pylons.decorators import jsonify
from pylons.i18n.translation import _
from wurdig.lib.base import BaseController, render
log = logging.getLogger(__nam... | leveille/blog.v1 | wurdig/controllers/js.py | Python | mit | 1,892 | 0.006342 |
#!/usr/bin/env python3.5
# -*- coding: utf-8 -*-
# Author: ChenLiang
import channel02
obj = channel02.RedisHelper()
while True:
inp = input('>> ')
if inp == '':
print("当前输入为空, 请重新输入...")
continue
else:
obj.public(inp, 'fm103.7') | smartczm/python-learn | Old-day01-10/s13-day12/pub-sub/publish02.py | Python | gpl-2.0 | 289 | 0.003745 |
"""
We have two special characters. The first character can be represented by one bit 0. The second character can be represented by two bits (10 or 11).
Now given a string represented by several bits. Return whether the last character must be a one-bit character or not. The given string will always end with a zero.
E... | franklingu/leetcode-solutions | questions/1-bit-and-2-bit-characters/Solution.py | Python | mit | 1,231 | 0.004874 |
#!/usr/bin/env python
# Shine.Configuration.FileSystem class
# Copyright (C) 2009-2017 CEA
"""Unit test for Shine.Configuration.FileSystem"""
import unittest
import textwrap
import time
from Utils import makeTempFile, setup_tempdirs, clean_tempdirs
from Shine.Configuration.FileSystem import FileSystem, ModelFileIOE... | bullxpfs/lustre-shine | tests/Configuration/ConfigFileSystemTest.py | Python | gpl-2.0 | 21,146 | 0.003168 |
# Copyright (c) 2017 Cisco Systems, 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 r... | noironetworks/networking-cisco | networking_cisco/tests/unit/ml2_drivers/nexus/test_trunk.py | Python | apache-2.0 | 6,254 | 0.00016 |
from test import test_support
import time
import unittest
class TimeTestCase(unittest.TestCase):
def setUp(self):
self.t = time.time()
def test_missing_module_attribute(self):
self.assertEqual(time.clock.__module__, 'time')
self.assertEqual(time.time.__module__, 'time')
def test... | EnviroCentre/jython-upgrade | jython/lib/test/test_time.py | Python | mit | 10,491 | 0.002288 |
import warnings
from pprint import pprint
import datajoint as dj
import pandas as pd
from djaddon import hdf5
try:
from pupil_tracking import PupilTracker
except ImportError:
warnings.warn("Failed to import pupil_tacking library. You won't be able to populate trk.EyeFrame")
schema = dj.schema('pipeline_pupi... | fabiansinz/pipeline | python/pipeline/legacy/trk.py | Python | lgpl-3.0 | 20,366 | 0.00545 |
# vim: tabstop=4 shiftwidth=4 expandtab
# Copyright (c) 2008, Aldo Cortesi. All rights reserved.
#
# 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 limit... | nxnfufunezn/qtile | libqtile/manager.py | Python | mit | 59,901 | 0.00025 |
#!/usr/bin/python
#
# Copyright (C) 2010, 2011 Google Inc.
# 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 code must retain the above copyright notice,
# this l... | apyrgio/snf-ganeti | test/py/ganeti.hypervisor.hv_kvm_unittest.py | Python | bsd-2-clause | 16,077 | 0.003981 |
from xmlrpc.client import ServerProxy
import sys
def help():
print("Usage : remote_finger [-lmsp] user..")
if __name__ == '__main__':
sys.argv = sys.argv[1:]
if len(sys.argv) == 0:
help()
sys.exit(1)
client = ServerProxy('http://localhost:8000')
print(client.finger(sys.argv))
... | NileshPS/OS-and-Networking-programs | 7_rpc/client.py | Python | gpl-3.0 | 331 | 0.006042 |
from datetime import datetime
from app import app
from app.authentication import with_login
from flask import Blueprint, jsonify, request, Response
from app.generate_csv import generate_csv_clean
from app.msol_util import get_next_update_estimation_message_aws
from app.es.awsmetric import AWSMetric
from app.es.awsstat ... | giubil/trackit | api/files/api/app/views/aws/cost/stats.py | Python | apache-2.0 | 43,920 | 0.003575 |
from StringIO import StringIO
from datetime import datetime, timedelta
from casexml.apps.case.models import CommCareCase
from casexml.apps.case.tests.util import check_xml_line_by_line
from casexml.apps.case.xml import V1
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.c... | SEL-Columbia/commcare-hq | corehq/apps/receiverwrapper/tests/test_repeater.py | Python | bsd-3-clause | 6,713 | 0.000447 |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | priya-pp/Tacker | releasenotes/source/conf.py | Python | apache-2.0 | 8,504 | 0.000118 |
#!/usr/bin/env python2
# setup.py
from setuptools import setup, find_packages
setup(name='pumptweet',
version='2.1',
description='Cross posts from Pump.io to Twitter.',
setup_requires=['setuptools-markdown'],
long_description_markdown_filename='README.md',
classifiers=[
'Development Status :: 3 - Alpha',
'In... | dper/pumptweet | setup.py | Python | mit | 1,006 | 0.036779 |
from html5lib import treewalkers
from htmlserializer import HTMLSerializer
from xhtmlserializer import XHTMLSerializer
def serialize(input, tree="simpletree", format="html", encoding=None,
**serializer_opts):
# XXX: Should we cache this?
walker = treewalkers.getTreeWalker(tree)
i... | bbondy/brianbondy.gae | libs/html5lib/serializer/__init__.py | Python | mit | 585 | 0.005128 |
#pylint: disable=C0111
from django.contrib.auth.models import User
from lettuce import world, step
from lettuce.django import django_url
from common import course_id
from student.models import CourseEnrollment
@step('I view the LTI and it is not rendered$')
def lti_is_not_rendered(_step):
# lti div has no class... | praveen-pal/edx-platform | lms/djangoapps/courseware/features/lti.py | Python | agpl-3.0 | 6,277 | 0.000956 |
"""
Functions performing URL trimming and cleaning
"""
## This file is available from https://github.com/adbar/courlan
## under GNU GPL v3 license
import logging
import re
from collections import OrderedDict
from urllib.parse import parse_qs, urlencode, urlparse, ParseResult
from .filters import validate_url
from .... | adbar/url-tools | courlan/clean.py | Python | gpl-2.0 | 5,520 | 0.002899 |
#!/usr/bin/python
import sys
sys.path.append("../../")
#import pyRay as ra
import pyRay.scene as scn
# TODO : how to pass arguments from function header?
object1 = ("obj1",(), [( "U","sdBox" ,"%s",((1.0,1.0,1.0),) ),( "S","sdSphere","%s",(1.2,) )])
object2 = ("obj1",("f","f3"),[( "U","sdBox" ,"%s",(... | ProkopHapala/SimpleSimulationEngine | python/pyRay/tests/testSceneList.py | Python | mit | 624 | 0.110577 |
#!/usr/bin/env python
"""Flows to collect file contents and metadata."""
from typing import Any, Mapping, Optional
from grr_response_core import config
from grr_response_core.lib.rdfvalues import client_fs as rdf_client_fs
from grr_response_core.lib.rdfvalues import crypto as rdf_crypto
from grr_response_core.lib.rdf... | google/grr | grr/server/grr_response_server/flows/file.py | Python | apache-2.0 | 16,923 | 0.006736 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Count
from django.http import HttpResponseRedirect, ... | caktus/rapidsms-groups | groups/views.py | Python | bsd-3-clause | 3,191 | 0 |
T = raw_input().lower()
vowels = "aeiouy"
output = ""
for i in range(0,len(T)):
if T[i] not in vowels:
output += "." + T[i]
print output
| Dawny33/Code | Code_Forces/A_string_task.py | Python | gpl-3.0 | 152 | 0.006579 |
#!python
# Copyright 2012 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | wangming28/syzygy | syzygy/scripts/test_bot/PRESUBMIT.py | Python | apache-2.0 | 1,582 | 0.005689 |
"""Remove EASFolderSyncStatus + Folder rows for folders we never sync
Revision ID: 2a748760ac63
Revises: 4af5952e8a5b
Create Date: 2014-07-19 00:28:08.258857
"""
# revision identifiers, used by Alembic.
revision = 'bb4f204f192'
down_revision = '2a748760ac63'
from inbox.ignition import engine
from inbox.models.sessi... | rmasters/inbox | migrations/versions/061_remove_easfoldersyncstatus_folder_rows_.py | Python | agpl-3.0 | 1,547 | 0.002586 |
# -*- coding: utf-8 -*-
# Copyright 2013 Julien Goret <jgoret@gmail.com>
#
# This file is part of subliminal.
#
# subliminal is free software; you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 3 of the Licen... | kikokubo/Sick-Beard-TPB | lib/subliminal/services/usub.py | Python | gpl-3.0 | 4,305 | 0.00813 |
#!/usr/bin/env python
#
# Copyright 2015 Airbus
# Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
#
# 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
#
# ... | ipa-led/airbus_coop | airbus_docgen/src/airbus_docgen/digraph/spline.py | Python | apache-2.0 | 717 | 0.001395 |
# -*- coding: utf-8 -*-
#
# Copyright (C) Pootle contributors.
#
# This file is a part of the Pootle project. It is distributed under the GPL3
# or later license. See the LICENSE file for a copy of the license and the
# AUTHORS file for copyright and authorship information.
import importlib
from django.apps import Ap... | unho/pootle | pootle/apps/accounts/apps.py | Python | gpl-3.0 | 566 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
## ##
# Author: Peter Manev #
# peter.manev@openinfosecfoundation.org #
## ##
## !!! IMPORTANT - LATEST DEV Scapy is needed !!!
# REMOVE your current scapy installation !!!
# th... | pevma/PtP | ProtoIPv4/IPv4_HTTP.py | Python | gpl-2.0 | 182,209 | 0.017381 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | AutorestCI/azure-sdk-for-python | azure-batch/azure/batch/models/start_task.py | Python | mit | 5,044 | 0.000595 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | vaygr/ansible | lib/ansible/modules/monitoring/uptimerobot.py | Python | gpl-3.0 | 3,698 | 0.001622 |
# ==========================================================================
# This script provides a number of functions that are useful for handling
# CTA observations.
#
# Copyright (C) 2011-2013 Juergen Knoedlseder
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the ... | cdeil/ctools | scripts/obsutils.py | Python | gpl-3.0 | 9,202 | 0.040535 |
import doto.model
import doto.model.task
CREATE_CMD = """
CREATE TABLE IF NOT EXISTS
timerecords (
id INTEGER NOT NULL,
task_id INTEGER,
start TIMESTAMP,
end TIMESTAMP,
PRIMARY KEY (id)... | tantSinnister/doto | doto/model/timerecord.py | Python | bsd-3-clause | 2,998 | 0.000667 |
import os
import shutil
import re
import zipfile
import xml.etree.ElementTree as ET
from tempfile import TemporaryDirectory
import psycopg2
conn = psycopg2.connect(
database='innoter', user='postgres', password='postgres', host='192.168.0.107', port='5432')
cursor = conn.cursor()
dst_dir = r"\\nas1\storage\DG_arc... | bazzile/imScrape | Scripts/v1/dev/auxiliary/move_imagery.py | Python | mit | 1,527 | 0.001972 |
"""
Tree based methods of learning (classification and regression)
"""
import abc
import numpy as np
import networkx as nx
from scipy.stats import mode
class BaseTree(object):
"""
Base Tree for classification/regression. Written for single
variable/value binary split critereon. Many methods needs to be
... | christopherjenness/ML-lib | ML/treemethods.py | Python | mit | 31,697 | 0.000126 |
#!/usr/bin/env python3
from math import floor, ceil
lines = []
with open('input.txt', 'r') as f:
lines = f.read().splitlines()
def get_val(line, start_pos, end_pos, lhalf, uhalf, uhalf_char):
for x in line[start_pos:end_pos:]:
if x == uhalf_char: # take lower half
uhalf -= ceil((uhalf - lhalf) / 2)
... | jekhokie/scriptbox | python--advent-of-code/2020/5/solve.py | Python | mit | 960 | 0.015625 |
import json
import re
from SBaaS_LIMS.lims_calibratorsAndMixes_query import lims_calibratorsAndMixes_query
from SBaaS_LIMS.lims_sample_query import lims_sample_query
from .lims_quantitationMethod_query import lims_quantitationMethod_query
from .stage01_quantification_MQResultsTable_query import stage01_quantification_... | dmccloskey/SBaaS_quantification | SBaaS_quantification/lims_quantitationMethod_io.py | Python | mit | 26,562 | 0.03569 |
# Copyright 2016 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... | chemelnucfin/tensorflow | tensorflow/contrib/distribute/python/keras_backward_compat_test.py | Python | apache-2.0 | 43,076 | 0.011213 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | ncliam/serverpos | openerp/addons/email_template/tests/test_mail.py | Python | agpl-3.0 | 14,322 | 0.004538 |
import Gears as gears
from .. import *
from .Filter import *
class CellLti7(Filter) :
def applyWithArgs(
self,
stimulus,
) :
sequence = stimulus.getSequence().getPythonObject()
stimulus.setLtiMatrix(
[
0, 0.47494, -0.0966925, 0.150786, -... | szecsi/Gears | GearsPy/Project/Components/Temporal/CellLti7.py | Python | gpl-2.0 | 1,209 | 0.033085 |
try:
from setuptools import setup
from setuptools.command.build_py import build_py
setuptools = True
except:
from distutils.core import setup
from distutils.command.build_py import build_py
setuptools = False
import os, re
# XXX: This is a hack
def patch(func):
setattr(build_py, func.__na... | kirbyfan64/hytest | setup.py | Python | mit | 1,421 | 0.004222 |
from __future__ import unicode_literals
import json
def test_get_version(app, client, current_version):
headers = [('Accept', 'application/json'),
('Content-Type', 'application/json')]
res = client.get('/api/v0/version', headers=headers)
assert res.status_code == 200
data = json.loads(... | ecolell/pfamserver | tests/api/v0/test_version.py | Python | agpl-3.0 | 394 | 0 |
# 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 | etcmodel/layers/embedding_test.py | Python | apache-2.0 | 9,033 | 0.001661 |
import re
from sublime import Region
import sublime_plugin
class BaseBlockCommand(sublime_plugin.TextCommand):
def _get_row_text(self, row):
if row < 0 or row > self.view.rowcol(self.view.size())[0]:
raise RuntimeError('Cannot find table bounds.')
point = self.view.text_point(row, ... | ericholscher/sublime-rst-completion | helpers.py | Python | bsd-3-clause | 1,480 | 0.001351 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.