code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python3
import os
from argparse import ArgumentParser
from termcolor import cprint
from pywiface import MonitorInterface, WirelessInterface
ENABLE = ('start', 'on', 'yes')
DISABLE = ('stop', 'off', 'no')
CHANNELS_2_4GHZ = list(range(11))
CHANNELS_5GHZ = [*range(32, 64, 2), 68, 96, *range(100, 128, 2),... | keaneokelley/pywiface | pywiface/cli.py | Python | mit | 1,981 |
import logging
import pymongo
import pickle
import numpy as np
import bson
import geojson as gj
import emission.core.wrapper.common_trip as ecwct
import emission.core.get_database as edb
import emission.storage.decorations.trip_queries as esdtq
# constants
DAYS_IN_WEEK = 7
HOURS_IN_DAY = 24
########################... | yw374cornell/e-mission-server | emission/storage/decorations/common_trip_queries.py | Python | bsd-3-clause | 4,258 |
# команды
import State.ViewStates.InitState
import State.ViewStates.PredictState
from Command.PredictCommands.ConcreteClassifierCommand import ConcreteClassifierCommand
from Command.PreviousStateCommand import PreviousStateCommand
from Command.ShowHelpCommand import ShowHelpCommand
# состояния
from State.ViewSta... | SergeyStaroletov/Patterns17 | CourseWorkReports/Курсовой проект Киреков ПИ-42/Исходный код/State/ViewStates/ConcreteClassifierState.py | Python | mit | 2,110 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Interface documentation.
Maintainer: Itamar Shtull-Trauring
"""
from zope.interface import Interface, Attribute
from twisted.python.deprecate import deprecatedModuleAttribute
from twisted.python.versions import Version
class IAddress(Inter... | Varriount/Colliberation | libs/twisted/internet/interfaces.py | Python | mit | 62,907 |
from assistanthandlerwithauthcode import AssistantHandlerWithAuthCode
import json
import urllib
from abc import ABCMeta, abstractmethod
class AssistantHandlerGoogle(AssistantHandlerWithAuthCode):
__metaclass__ = ABCMeta
def __init__(self,action, apiName):
AssistantHandlerWithAuthCode.__init__(self,action,apiName... | joaomgcd/VoiceAssistantWebHook | assistanthandlers/google/__init__.py | Python | apache-2.0 | 489 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
{
'name': 'OdooBot',
'version': '1.2',
'category': 'Productivity/Discuss',
'summary': 'Add OdooBot in discussions',
'description': "",
'website': 'https://www.odoo.com/page/discuss',
'depends'... | rven/odoo | addons/mail_bot/__manifest__.py | Python | agpl-3.0 | 645 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import requests
import yajl as json
import progressbar as pb
dir = os.path.split(os.path.split(os.path.realpath(__file__))[0])[0]
sys.path.append(dir)
from termcolor import colored as color
from utilities.prompt_format import item as I
def CreateDatase... | luiscape/hdxscraper-noaa | app/hdx_register/create.py | Python | mit | 10,196 |
from ._main import main
main()
| yuanming-hu/taichi | python/taichi/__main__.py | Python | mit | 32 |
from __future__ import annotations
import re
import warnings
from typing import List
from typing import Optional
import iso3166
from pycountry import countries
from pycountry.db import Data
from schwifty import common
from schwifty import exceptions
from schwifty import registry
_bic_re = re.compile(r"[A-Z]{4}[A-Z... | figo-connect/schwifty | schwifty/bic.py | Python | mit | 9,553 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | google/cloud/aiplatform_v1beta1/types/entity_type.py | Python | apache-2.0 | 4,180 |
'''
* ***** BEGIN LICENSE BLOCK *****
* Version: GNU GPL 2.0
*
* The contents of this file are subject to the
* GNU General Public License Version 2.0; you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
* http://www.gnu.org/licenses/gpl.html
*
* Software distribut... | gubatron/blooploader | controllers/__init__.py | Python | gpl-2.0 | 992 |
from string import ascii_lowercase
from time import time
import random
class Cipher(object):
def __init__(self, key=None):
if not key:
random.seed(time())
key = ''.join(random.choice(ascii_lowercase) for i in range(100))
elif not key.isalpha() or not key.islower():
... | mweb/python | exercises/simple-cipher/example.py | Python | mit | 935 |
# This file is part of fedmsg.
# Copyright (C) 2017 Red Hat, Inc.
#
# fedmsg 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 version.
#... | fedora-infra/fedmsg_meta_fedora_infrastructure | fedmsg_meta_fedora_infrastructure/centos_ci.py | Python | lgpl-2.1 | 11,917 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.variables.variable import Variable, ln
from variable_functions import my_attribute_label
class ln_avg_val_per_unit_SSS(Variable):
"""log(avg_val_per_unit_SSS)"""
_ret... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/urbansim/zone/ln_avg_val_per_unit_SSS.py | Python | gpl-2.0 | 1,609 |
# Time: O(4^n)
# Space: O(n)
#
# Given a string that contains only digits 0-9
# and a target value, return all possibilities
# to add operators +, -, or * between the digits
# so they evaluate to the target value.
#
# Examples:
# "123", 6 -> ["1+2+3", "1*2*3"]
# "232", 8 -> ["2*3+2", "2+3*2"]
# "00", 0 -> ["0+0", "0-0... | kamyu104/LeetCode | Python/expression-add-operators.py | Python | mit | 2,055 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
import pytest
from shuup.apps.provides import override_provides
from shuup.testing.factor... | shoopio/shoop | shuup_tests/xtheme/test_extenders.py | Python | agpl-3.0 | 970 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerParameterDefinitionDialog.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
******... | myarjunar/QGIS | python/plugins/processing/modeler/ModelerParameterDefinitionDialog.py | Python | gpl-2.0 | 18,376 |
# -----------------
# lambdas
# -----------------
a = lambda: 3
#? int()
a()
x = []
a = lambda x: x
#? int()
a(0)
#? float()
(lambda x: x)(3.0)
arg_l = lambda x, y: y, x
#? float()
arg_l[0]('', 1.0)
#? list()
arg_l[1]
arg_l = lambda x, y: (y, x)
args = 1,""
result = arg_l(*args)
#? tuple()
result
#? str()
result[0]... | snakeleon/YouCompleteMe-x64 | third_party/ycmd/third_party/jedi_deps/jedi/test/completion/lambdas.py | Python | gpl-3.0 | 1,833 |
#!/usr/bin/python
import commands
import os
import subprocess
import time
import audioop
import pyaudio
import wave
class xSound(object):
def __init__(self, voicefile="sound.wav"):
self.directorycurrent = os.path.dirname(os.path.realpath(__file__))
self.voicefile = self.directorycurrent + "/file... | TheIoTLearningInitiative/CodeLabs | Caracol/xsound.py | Python | apache-2.0 | 2,961 |
"""
Visualizations for alignments of molecular sequences
"""
# rasmus libs
from rasmus import util
from rasmus.vis import genomebrowser as gb
from compbio import muscle
# summon libs
from summon.core import *
import summon
from summon import matrix
from summon import hud
class AlignViewer (object):
def... | wutron/compbio | rasmus/vis/alignvis.py | Python | mit | 2,903 |
# ccm node
from __future__ import with_statement
import common, yaml, os, errno, signal, time, subprocess, shutil, sys, glob, re, stat
import repository
from cli_session import CliSession
class Status():
UNINITIALIZED = "UNINITIALIZED"
UP = "UP"
DOWN = "DOWN"
DECOMMISIONNED = "DECOMMISIONNED"
class N... | Stratio/ccm | ccmlib/node.py | Python | apache-2.0 | 43,901 |
# Copyright (C) 2008 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in ... | Distrotech/bzr | bzrlib/tests/per_repository_vf/test_add_inventory_by_delta.py | Python | gpl-2.0 | 4,470 |
# -*- coding: utf-8 -*-
"""
Function inlining.
"""
from __future__ import print_function, division, absolute_import
from pykit.error import CompileError
from pykit.ir import Function, Builder, findallops, copy_function, verify
from pykit.transform import ret as ret_normalization
def rewrite_return(func):
"""Rew... | flypy/pykit | pykit/transform/inline.py | Python | bsd-3-clause | 3,351 |
#--
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
# This software is licensed under the BSD License, as described in
# the file LICENSE.txt, which you should have received as part of
# this distribution.
#--
from datetime import date
from peak.rules import when
from nagare.security import common
from nag... | bcroq/kansha | kansha/card_addons/due_date/comp.py | Python | bsd-3-clause | 2,732 |
# Copyright (C) Ivo Slanina <ivo.slanina@gmail.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 the License, or
# (at your option) any later version.
#
# This program i... | mqopen/mqspeak | mqspeak/data.py | Python | gpl-3.0 | 3,353 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2021-11-05 12:01
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('creation', '0019_fosscategory_available_for_jio'),
]
operations = [
migration... | Spoken-tutorial/spoken-website | creation/migrations/0020_auto_20211105_1731.py | Python | gpl-3.0 | 548 |
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# T... | hlzz/dotfiles | graphics/VTK-7.0.0/ThirdParty/ZopeInterface/zope/interface/tests/test_declarations.py | Python | bsd-3-clause | 59,897 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
def make(htmlfunc, var, current, *names):
"""Helper to spit out a struct for rendering tabs (see templates/nav-tabs.html).
"""
tabs = OrderedDict()
tabs[names... | gratipay/gratipay.com | gratipay/utils/tabs.py | Python | mit | 633 |
"""
This module manages all market related activities
"""
import gnupg
import hashlib
import json
import logging
from PIL import Image, ImageOps
import random
from StringIO import StringIO
import re
from tornado import ioloop
from node import constants
from node.data_uri import DataURI
from node.orders import Orders
f... | atsuyim/OpenBazaar | node/market.py | Python | mit | 32,502 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Core MISP expansion modules loader and web service
#
# Copyright (C) 2016 Alexandre Dulaunoy
# Copyright (C) 2016 CIRCL - Computer Incident Response Center Luxembourg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | Rafiot/misp-modules | misp_modules/__init__.py | Python | agpl-3.0 | 9,169 |
import logging
import sys
from modularodm import Q
from framework.mongo import database
from framework.transactions.context import TokuTransaction
from website.addons.box.model import BoxNodeSettings
from website.app import init_app
from scripts import utils as script_utils
logger = logging.getLogger(__name__)
def... | rdhyee/osf.io | scripts/box/migrate_folder_language.py | Python | apache-2.0 | 1,302 |
# ===============================================================================
# Copyright 2019 Jan Hendrickx and Gabriel Parrish
#
# 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:/... | NMTHydro/Recharge | utils/etrm_stochastic_grid_search/stochastic_config_generator.py | Python | apache-2.0 | 9,999 |
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from mock import Mock, patch
import sys
try:
from unittest2 import TestCase, main, skipUnless
except ImportError:
from unittest import TestCase, main, skipUnless
from ..winterm import WinColor, WinStyle, WinTerm
class WinTermTest(Tes... | Teamxrtc/webrtc-streaming-node | third_party/webrtc/src/chromium/src/third_party/colorama/src/colorama/tests/winterm_test.py | Python | mit | 3,729 |
from django.contrib import admin
from core.models import Project, Unit, Feedback
admin.site.register(Project)
admin.site.register(Unit)
admin.site.register(Feedback) | bonnieblueag/farm_log | core/admin.py | Python | gpl-3.0 | 166 |
"""
------------------------------------------------
autoradio.py
------------------------------------------------
27.05.2015
Simon Carlier
simon.carlier@heig-vd.ch
------------------------------------------------
Entry point of the python script runs the following:
-Content scrapping : ./radios-stations (plugin archi... | simkarlier/autorad.io | py/autoradio.py | Python | gpl-3.0 | 2,584 |
import torch
import numpy as np
def normalized_columns_initializer(weights, std=1.0):
out = torch.randn(weights.size())
out *= std / torch.sqrt(out.pow(2).sum(1).expand_as(out))
return out
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
weight_shape =... | wuhuikai/pytorch-a3c | utils.py | Python | mit | 1,222 |
# Copyright 2015 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 law or a... | moonboots/tensorflow | tensorflow/python/ops/array_grad.py | Python | apache-2.0 | 11,154 |
import time
from Block import Block
from ..ProtectFlags import ProtectFlags
class UserDirBlock(Block):
def __init__(self, blkdev, blk_num):
Block.__init__(self, blkdev, blk_num, is_type=Block.T_SHORT, is_sub_type=Block.ST_USERDIR)
def set(self, data):
self._set_data(data)
self._read()
def read(... | alpine9000/amiga_examples | tools/external/amitools/amitools/fs/block/UserDirBlock.py | Python | bsd-2-clause | 2,641 |
# Copyright (c) 2016 Intel, 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 l... | kevin-zhaoshuai/zun | zun/hacking/checks.py | Python | apache-2.0 | 5,055 |
import argparse
import difflib
import filecmp
import os
import subprocess
import shutil
import sys
BASE_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(BASE_DIR, 'sources')
EXPECT_DIR = os.path.join(BASE_DIR, 'expect')
OUT_DIR = os.path.join(BASE_DIR, 'test-out')
CONFIGS = [
[],
['interleaved']
]
de... | Kupoman/blendergltf | tests/integration/integration.py | Python | apache-2.0 | 2,123 |
from bokeh.plotting import *
from bokeh.objects import HoverTool, ColumnDataSource
from bokeh.sampledata import periodic_table
from collections import OrderedDict
elements = periodic_table.elements[periodic_table.elements['group'] != "-"]
group_range = [str(x) for x in range(1,19)]
period_range = [str(x) for x in rev... | jakevdp/bokeh | examples/plotting/file/periodic.py | Python | bsd-3-clause | 2,858 |
# <CustomTools>
# <Menu>
# <Item name="pIceImarisConnector: Test Hello World!" icon="Python3" tooltip="Test function for pIceImarisConnector.">
# <Command>Python3XT::HelloWorldXT(%i)</Command>
# </Item>
# </Menu>
# </CustomTools>
from pIceImarisConnector import pIceImarisConnector
import tkinter
def He... | aarpon/pIceImarisConnector | pIceImarisConnector/test/HelloWorldXT.py | Python | gpl-2.0 | 721 |
"""
Functions in the ``as*array`` family that promote array-likes into arrays.
`require` fits this category despite its name not matching this pattern.
"""
from .overrides import (
array_function_dispatch,
set_array_function_like_doc,
set_module,
)
from .multiarray import array
__all__ = [
"asarray",... | grlee77/numpy | numpy/core/_asarray.py | Python | bsd-3-clause | 12,184 |
try:
from builtins import object
except ImportError:
# python2
pass
from functools import partial
from collections import defaultdict, OrderedDict
from six import string_types
import inspect
import logging
import itertools
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
def l... | imp/transitions | transitions/core.py | Python | mit | 23,627 |
#!/usr/bin/env python
import os
import sys
import dotenv
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings.local")
dotenv.read_dotenv('project/.env')
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| chiehtu/kissaten | manage.py | Python | mit | 311 |
# -*- coding: utf-8 -*-
from Components.Language import language
from Tools.Directories import resolveFilename, SCOPE_PLUGINS
import gettext
PluginLanguageDomain = "OpenWebif"
PluginLanguagePath = "Extensions/OpenWebif/locale"
def localeInit():
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLU... | pr2git/e2openplugin-OpenWebif | plugin/__init__.py | Python | gpl-3.0 | 509 |
from django.contrib import admin
from invoice_ar import models
from reversion.admin import VersionAdmin
@admin.register(models.ContactInvoiceAR)
class ContactInvoiceARAdmin(VersionAdmin):
pass
@admin.register(models.CompanyInvoiceAR)
class CompanyInvoiceARAdmin(VersionAdmin):
pass
@admin.register(models.P... | mbaragiola/heimdalerp | invoice_ar/admin.py | Python | isc | 658 |
#!/usr/bin/env python
#
# This python file contains utility scripts to manage Django translations.
# It has to be run inside the django git root directory.
#
# The following commands are available:
#
# * update_catalogs: check for new strings in core and contrib catalogs, and
# output how much string... | Bashar/django | scripts/manage_translations.py | Python | bsd-3-clause | 7,159 |
# Copyright (c) 2016 EMC Corporation, 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 ap... | bswartz/cinder | cinder/tests/unit/volume/drivers/emc/vnx/test_driver.py | Python | apache-2.0 | 2,785 |
"""
Model resources for API.
"""
from djangorestframework.resources import ModelResource
from lizard_esf.models import ConfigurationType
from lizard_esf.models import ValueType
from lizard_esf.models import AreaConfiguration
from lizard_esf.forms import NameForm
class ConfigurationTypeResource(ModelResource):
"... | lizardsystem/lizard-esf | lizard_esf/api/resources.py | Python | gpl-3.0 | 675 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2016, Adam Števko <adam.stevko@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the L... | adityacs/ansible | lib/ansible/modules/storage/zfs/zfs_facts.py | Python | gpl-3.0 | 8,717 |
# -*- coding: utf-8 -*-
import threading
from module.plugins.internal.Plugin import Plugin
from module.plugins.internal.misc import Periodical, isiterable
def threaded(fn):
def run(*args, **kwargs):
hookManager.startThread(fn, *args, **kwargs)
return run
class Expose(object):
"""
Used for... | Guidobelix/pyload | module/plugins/internal/Addon.py | Python | gpl-3.0 | 6,941 |
import sys
import logging
verbosity_level = {'low': 1, 'medium': 2, 'high': 3}
class Logger:
def __init__(self, verbosity):
logging_level = self.get_verbosity_level_from_logging_module(verbosity)
log_format = logging.Formatter('%(message)s')
stream_handle = logging.StreamHandler(sys.stdou... | shubhamchaudhary/pulla | pulla/logger.py | Python | gpl-3.0 | 1,134 |
from Plugins.Plugin import PluginDescriptor
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.Console import Console
from Screens.Standby import TryQuitMainloop
from Components.ActionMap import ActionMap
from Components.AVSwitch import AVSwi... | postla/OpenNFR-E2 | lib/python/Plugins/Extensions/Infopanel/oscamsmartcard.py | Python | gpl-2.0 | 24,014 |
__author__ = 'M'
| TankCommander/pythonCode | game_logic/utils/__init__.py | Python | gpl-2.0 | 17 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automatic config nagios configurations.
Copyright (C) 2015 Canux CHENG
All rights reserved
Name: __init__.py
Author: Canux canuxcheng@gmail.com
Version: V1.0
Time: Wed 09 Sep 2015 09:20:51 PM EDT
Exaple:
./nagios -h
"""
__version__ = "3.1.0.0"
__description__ = "... | crazy-canux/xnagios | nagios/__init__.py | Python | apache-2.0 | 451 |
"""
This file was generated with the customdashboard management command and
contains the class for the main dashboard.
To activate your index dashboard add the following to your settings.py::
GRAPPELLI_INDEX_DASHBOARD = 'pressurenet.dashboard.PressureNETIndexDashboard'
"""
import random
from django.utils.translat... | JacobSheehy/pressureNETAnalysis | dashboard.py | Python | gpl-3.0 | 4,519 |
# 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 appli... | jacquesqiao/Paddle | tools/print_signatures.py | Python | apache-2.0 | 2,255 |
#coding=utf-8
#author: sloop
'''
ÈÎÎñ
ÈýÃûͬѧµÄ³É¼¨¿ÉÒÔÓÃÒ»¸ölist±íʾ£º
L = [95.5, 85, 59]
Çë°´ÕÕË÷Òý·Ö±ð´òÓ¡³öµÚÒ»Ãû¡¢µÚ¶þÃû¡¢µÚÈýÃû¡¢µÚËÄÃûµÄ·ÖÊý¡£
'''
#´úÂë
L = [95.5,85,59]
print L[0]
print L[1]
print L[2]
print L
'''
°´ÕÕË÷Òý·ÃÎÊlist
ÓÉÓÚlistÊÇÒ»¸öÓÐÐò¼¯ºÏ£¬ËùÒÔ£¬ÎÒÃÇ¿ÉÒÔÓÃÒ»¸ölist°´·ÖÊý´Ó¸ßµ½µÍ±íʾ³ö°àÀïµÄ3¸... | GcsSloop/PythonNote | PythonCode/Python入门/List/按照索引访问List.py | Python | apache-2.0 | 1,001 |
import gpib
class PARWriteError(Exception):
pass
class PARReadError(Exception):
pass
class PARCellWorking(Exception):
pass
class Poll:
COMMAND_DONE = 1
COMMAND_ERROR = 2
CURVE_DONE = 4
OVERLOAD = 16
SWEEP_DONE = 32
SRQ = 64
OUTPUT_READY = 128
class PAR... | leszektarkowski/PAR273 | server/server.py | Python | gpl-2.0 | 2,220 |
from django.shortcuts import render
from models import Guang, Category
def index(req):
return render(req, "index_guang.html")
def guang_home(req):
return render(req, 'base_guang.html', {})
def guang_category(req, category):
categorys = Category.objects.get(title=category)
guangs = Guang.objects.filter(categ... | lrqrun/lrqrun.org | src/apps/guang/views.py | Python | mit | 687 |
"""
This module implements classes and utility functions to manage STC port.
:author: yoram@ignissoft.com
"""
import re
import time
from trafficgenerator.tgn_utils import is_local_host, TgnError
from testcenter.stc_object import StcObject
class StcPort(StcObject):
""" Represent STC port. """
def __init__... | shmir/PyTestCenter | testcenter/stc_port.py | Python | apache-2.0 | 6,934 |
import argparse
import json
import sys
import pyems
from ..i18n import _
class BaseCommand(object):
name = None
description = None
quiet_fields = {}
def __init__(self, subparsers=None):
if subparsers is not None:
self.parser = subparsers.add_parser(self.name,
... | tomi77/ems-cli | ems_cli/commands/__init__.py | Python | mit | 1,979 |
# Copyright 2019 MLBenchmark Group. 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 l... | mlperf/training_results_v0.7 | Intel/benchmarks/resnet/1-node-8s-cpx-2-mxnet/mlperf_log.py | Python | apache-2.0 | 8,846 |
import nltk
import csv
import matplotlib.pyplot as plt
word_features = []
def get_words_in_tweets(tweets):
all_words = []
for (words, sentiment) in tweets:
all_words.extend(words)
return all_words
def get_word_features(wordlist):
wordlist = nltk.FreqDist(wordlist)
word_features = wordlist.... | steinnp/Big-Data-Final | Classification/bayes_most_informative.py | Python | mit | 3,013 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 Smile (<http://www.smile.fr>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under th... | tiexinliu/odoo_addons | smile_decimal_precision/report/report_sxw.py | Python | agpl-3.0 | 1,915 |
import unittest
if 0:
# no released version of manuel actually works with :lineno:
# settings yet
class ManuelDocsCase(unittest.TestCase):
def __new__(self, test):
return getattr(self, test)()
@classmethod
def test_docs(cls):
import os
import pkg... | danielpronych/pyramid-doxygen | pyramid/tests/test_docs.py | Python | bsd-2-clause | 1,180 |
# 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... | cg31/tensorflow | tensorflow/python/kernel_tests/shape_ops_test.py | Python | apache-2.0 | 19,895 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Support module for making a port forwarder with twistd.
"""
from twisted.protocols import portforward
from twisted.python import usage
from twisted.application import strports
class Options(usage.Options):
synopsis = "[options]"
long... | mzdaniel/oh-mainline | vendor/packages/twisted/twisted/tap/portforward.py | Python | agpl-3.0 | 733 |
# Copyright 2020 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, ... | google/telluride_decoding | telluride_decoding/csv_util.py | Python | apache-2.0 | 5,394 |
# 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... | chemelnucfin/tensorflow | tensorflow/python/framework/meta_graph.py | Python | apache-2.0 | 44,383 |
# -*- coding: utf-8 -*-
# This file as well as the whole tsfresh package are licenced under the MIT licence (see the LICENCE.txt)
# Maximilian Christ (maximilianchrist.com), Blue Yonder Gmbh, 2016
import pickle
from unittest import TestCase
import numpy as np
import pandas as pd
from pandas.testing import assert_fram... | blue-yonder/tsfresh | tests/units/feature_extraction/test_settings.py | Python | mit | 11,879 |
from cStringIO import StringIO
import os
import tarfile
import unittest
import tempfile
import shutil
import errno
import mock
from pulp.devel.unit.util import touch
from pulp.plugins.conduits.repo_publish import RepoPublishConduit
from pulp.plugins.config import PluginCallConfiguration
from pulp.plugins.model import ... | ipanova/pulp_puppet | pulp_puppet_plugins/test/unit/test_install_distributor.py | Python | gpl-2.0 | 24,167 |
"""!youtube <search term> return the first youtube search result for <search term>"""
import re
from urllib import quote
import requests
def youtube(searchterm):
searchterm = quote(searchterm)
url = "https://gdata.youtube.com/feeds/api/videos?q={0}&orderBy=relevance&alt=json"
url = url.format(searchterm)... | NUKnightLab/slask | plugins/youtube.py | Python | mit | 768 |
from datetime import timedelta
def add_gigasecond(date):
return date + timedelta(0, 10 ** 9)
| Bugfry/exercises | exercism/python/gigasecond/gigasecond.py | Python | mit | 96 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import optparse
import sys
import os
sys.path.insert(0, "bin/python")
import samba
samba.ensure_external_module("testtools", "testtools")
samba.ensure_external_module("subunit", "subunit/python")
import samba.getopt as options
from samba.auth import system_session
from ... | zarboz/XBMC-PVR-mac | tools/darwin/depends/samba/samba-3.6.6/source4/dsdb/tests/python/urgent_replication.py | Python | gpl-2.0 | 15,066 |
# -*- coding: utf-8 -*-
#
import re
from django.shortcuts import reverse as dj_reverse
from django.db.models import Subquery, QuerySet
from django.conf import settings
from django.utils import timezone
UUID_PATTERN = re.compile(r'[0-9a-zA-Z\-]{36}')
def reverse(view_name, urlconf=None, args=None, kwargs=None,
... | zsjohny/jumpserver | apps/common/utils/django.py | Python | gpl-2.0 | 1,402 |
#
# Copyright (c) 2009-2015, Jack Poulson
# All rights reserved.
#
# This file is part of Elemental and is under the BSD 2-Clause License,
# which can be found in the LICENSE file in the root directory, or at
# http://opensource.org/licenses/BSD-2-Clause
#
import El, time
m = 2000
n = 4000
numLambdas = 7
startL... | sg0/Elemental | examples/interface/BPDN.py | Python | bsd-3-clause | 2,166 |
# encoding: 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 field 'ImageMapLink.measurement'
db.delete_column('lizard_levee_imagemaplink', 'measurement_id'... | lizardsystem/lizard-levee | lizard_levee/migrations/0051_auto__del_field_imagemaplink_measurement__del_field_imagemaplink_segme.py | Python | gpl-3.0 | 21,926 |
# -*- coding: utf-8 -*-
import logging
_logger = logging.getLogger(__name__)
try:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
gc = Nominatim(timeout=3)
except ImportError:
gc = None
GeocoderTimedOut = None
_logger.warning("Please, install geopy using 'pip insta... | odoo-argentina/partner | l10n_ar_bank/wizard/cache.py | Python | agpl-3.0 | 1,604 |
# Natural Language Toolkit: Group Average Agglomerative Clusterer
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Trevor Cohn <tacohn@cs.mu.oz.au>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, unicode_literals
try:
import numpy
except Impor... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/cluster/gaac.py | Python | mit | 5,980 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import itertools
import pytest
import numpy as np
from numpy.testing import assert_allclose
from ..utils import discretize_model
from ...modelin... | kelle/astropy | astropy/convolution/tests/test_discretize.py | Python | bsd-3-clause | 6,190 |
# (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | decvalts/iris | lib/iris/tests/unit/fileformats/grib/load_convert/test_resolution_flags.py | Python | gpl-3.0 | 1,821 |
from django.contrib import admin
from django.conf.urls import patterns, include, url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf.urls.static import static
from togile.api import togile_api
from togile.settings import APP_URL, APP_PATH
admin.autodiscover()
urlpatterns = patte... | mohabusama/togile | togile/urls.py | Python | mit | 713 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | tensorflow/similarity | setup.py | Python | apache-2.0 | 3,212 |
import unittest
from whoosh import analysis, fields, formats, index, qparser, query, searching, scoring
from whoosh.filedb.filestore import RamStorage
from whoosh.query import *
from whoosh.searching import Searcher
from whoosh.scoring import FieldSorter
class TestSearching(unittest.TestCase):
def make_index(self... | soad241/whoosh | tests/test_searching.py | Python | apache-2.0 | 28,074 |
########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | pathakvaidehi2391/WorkSpace | azurecloudify/resourcegroup.py | Python | apache-2.0 | 4,763 |
#!/usr/bin/env python
# example checkbutton.py
import pygtk
pygtk.require('2.0')
import gtk
class CheckButton:
# Our callback.
# The data passed to this method is printed to stdout
def callback(self, widget, data=None):
print "%s was toggled %s" % (data, ("OFF", "ON")[widget.get_active()])
#... | spaceone/pyjs | pygtkweb/demos/checkbutton.py | Python | apache-2.0 | 2,231 |
# $Id$
import operator
from itcc.Torsionfit import cmpmol
from itcc.Tinker import tinker
from itcc.Tools import tools
__revision__ = '$Rev$'
optimize = tinker.batchoptimize
energy = tinker.batchenergy
class Meritresult(dict):
pass
def chkdeform(flist1, flist2):
numdeformstru = 0
data = cmpmol.batchc... | lidaobing/itcc | itcc/torsionfit/merit.py | Python | gpl-3.0 | 3,096 |
from kraken.core.maths import Vec3
from kraken.core.maths.xfo import Xfo
from kraken.core.objects.components.base_example_component import BaseExampleComponent
from kraken.core.objects.attributes.attribute_group import AttributeGroup
from kraken.core.objects.attributes.scalar_attribute import ScalarAttribute
from kra... | goshow-jp/Kraken | Python/kraken_components/fabrice/fabrice_clavicle.py | Python | bsd-3-clause | 7,805 |
"""Extracts nodes of interest from a pycparser parse of bindings.h run through a platform-specific preprocessor and compares it with the metadata in metadata.y.
get_all_info is a function that returns a dict with the following keys:
functions: A set of function instances. Keys are the names.
typedefs: A set of type i... | camlorn/Unspoken | libaudioverse/bindings/get_info.py | Python | gpl-2.0 | 9,991 |
import subprocess
from distutils.core import setup, Extension
from distutils import msvccompiler
import os
import sys
sources = [ \
"module.c",
"pyeventlog.c",
"pylcm.c",
"pylcm_subscription.c",
os.path.join("..", "lcm", "eventlog.c"),
os.path.join("..", "lcm", "lcm.c"),
os.path.join("..", ... | bluesquall/lcm | lcm-python/setup.py | Python | lgpl-2.1 | 3,869 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 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 yo... | jmartinm/invenio | modules/miscutil/lib/urlutils_unit_tests.py | Python | gpl-2.0 | 18,616 |
#!/usr/bin/env python
import imaplib, socket
try:
lasttry=int(open("lasttry.txt").read())
except IOError:
lasttry=0
server=imaplib.IMAP4_SSL("mail.bcp.org")
for i in range(lasttry,10000):
pw=str(i).zfill(4)
try:
server.login("nick.eyre11",pw)
print pw+" successful!"
break
exc... | ebakan/Python | crackemail.py | Python | gpl-3.0 | 513 |
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "bar.unselected"
_path_str = "bar.unselected.textfont"
_valid_props = {"color"}
# colo... | plotly/python-api | packages/python/plotly/plotly/graph_objs/bar/unselected/_textfont.py | Python | mit | 5,177 |
# deltaTime.py
#
# Parser to convert a conversational time reference such as "in a minute" or
# "noon tomorrow" and convert it to a Python datetime. The returned
# ParseResults object contains the results name "timeOffset" containing
# the timedelta, and "calculatedTime" containing the computed time relative
... | schlichtanders/pyparsing-2.0.3-OrderedDict | examples/deltaTime.py | Python | mit | 7,053 |
import core.input_constants
from screen import utils
_directions = {core.input_constants.UP: (0, -1), core.input_constants.DOWN: (0, 1),
core.input_constants.LEFT: (-1, 0), core.input_constants.RIGHT: (1, 0)}
class Snake:
nodes = []
_direction = (0, 1)
def __init__(self):
self.node... | kernelmode/Snake | core/entities.py | Python | mit | 753 |
#!/usr/bin/env python
from sys import stdout, stderr, exit
from optparse import OptionParser
from Bio import SeqIO
if __name__ == '__main__':
usage = 'usage: %prog [options] <MIN LENGTH> <FASTA FILE>'
parser = OptionParser(usage=usage)
(options, args) = parser.parse_args()
if len(args) != 2:
... | danydoerr/large_syn_workflow | extract_minlen_seq.py | Python | mit | 508 |
#
# Copyright (C) 2010 GSyC/LibreSoft
#
# This program 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 your option) any later version.
#
# This ... | kgblll/libresoft-gymkhana | apps/compareImages/urls.py | Python | gpl-2.0 | 1,072 |
# -*- coding: utf-8 -*-
"""
.. _ex-tfr-comparison:
======================================================================
Time-frequency on simulated data (Multitaper vs. Morlet vs. Stockwell)
======================================================================
This example demonstrates the different time-frequency... | mne-tools/mne-python | examples/time_frequency/time_frequency_simulated.py | Python | bsd-3-clause | 7,927 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.