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 |
|---|---|---|---|---|---|
import pytest
from func_prototypes import *
def test_dictjoin():
eng = {1:"one", 2:"two"}
esp = {1:"uno", 2:"dos", 3:"tres"}
com = {1:("one", "uno"), 2:("two", "dos")}
assert com == dictjoin(eng, esp)
with pytest.raises(KeyError):
dictjoin(esp, eng)
| andrewguy9/func_prototypes | tests/test_util.py | Python | mit | 266 |
# -*- coding: utf-8 -*-
import os
import sys
import platform
from setuptools import setup
OPTIONS = {
'iconfile':'assets/clock.icns',
'includes' : ['sqlalchemy.dialects.sqlite']
}
DATA_FILES = ['./assets/clock.png',
'./assets/clock_grey.png',
'./assets/cursor.png',
'./traces/preferences.xib',
'./tr... | activityhistory/traces | setup.py | Python | gpl-3.0 | 644 |
# -*- coding: utf-8 -*-
# Copyright(C) 2014 Romain Bignon
#
# This file is part of weboob.
#
# weboob 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 opti... | laurentb/weboob | weboob/browser/filters/html.py | Python | lgpl-3.0 | 8,039 |
from django.test import TestCase
from astrobin_apps_equipment.templatetags.astrobin_apps_equipment_tags import equipment_listing_url_with_tags
from astrobin_apps_equipment.tests.equipment_generators import EquipmentGenerators
class TestTagEquipmentListingUrlWithUtmTags(TestCase):
def test_simple_url(self):
... | astrobin/astrobin | astrobin_apps_equipment/tests/test_tag_equipment_listings_url_with_utm_tags.py | Python | agpl-3.0 | 1,650 |
import sys
if sys.version_info < (3, 7):
from ._decreasing import Decreasing
from ._font import Font
from ._increasing import Increasing
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
[],
["._decreasing.D... | plotly/python-api | packages/python/plotly/plotly/graph_objs/indicator/delta/__init__.py | Python | mit | 381 |
#!/usr/bin/env python
import os
import tempfile
import pipes
import subprocess
import time
import random
import shutil
try:
from wand.image import Image
from wand.display import display
except ImportError as e:
# cd /usr/lib/
# ln -s libMagickWand-6.Q16.so libMagickWand.so
print("Couldn't import Wand packag... | wazari972/WebAlbums | WebAlbums-FS/WebAlbums-Utils/Photowall/photowall.py | Python | gpl-3.0 | 15,846 |
#!/usr/bin/env python
# Copyright (c) LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
# See LICENSE in the project root for license information.
# -*- coding:utf-8 -*-
from iris.bin.sender import init_sender
import msgpack
def test_configure(mocker):
mocker.patch('iris.sende... | houqp/iris-api | test/test_sender.py | Python | bsd-2-clause | 9,206 |
"""
writing a wav file with numpy and scipy
"""
import numpy as np
import scipy.io.wavfile as wavfile
N = 168
x = np.arange(N)
y = 4 / np.pi*np.sin(2*np.pi*x/N)
y += 4 / (3*np.pi)*np.sin(6*np.pi*x/N)
y += 4 / (5*np.pi)*np.sin(10*np.pi*x/N)
y = np.tile(y, 1313)
y = y/max(y)
wavfile.write("sqwvfile.wav", 44100, y)
| flawcode/sound_synth | sound003.py | Python | mit | 317 |
"""
Tests for BlockCountsTransformer.
"""
# pylint: disable=protected-access
from openedx.core.djangoapps.content.block_structure.factory import BlockStructureFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.te... | eduNEXT/edx-platform | lms/djangoapps/course_api/blocks/transformers/tests/test_block_counts.py | Python | agpl-3.0 | 2,085 |
import random
from pprint import pprint
from botlistbot.custemoji import Emoji
TEST = "{} Test".format(Emoji.ANCHOR)
BACK_TO_MENU = "{} Back to Menu".format(Emoji.LEFTWARDS_BLACK_ARROW)
EXIT = "🔙 Exit"
REFRESH = "🔄 Refresh"
ADD_BOT = "➕ Add new bot"
EDIT_BOT = "🛠 Edit Bot"
SEND_BOTLIST = "☑ Update BotList"
SEND_AC... | JosXa/BotListBot | botlistbot/captions.py | Python | mit | 1,577 |
from django.core.management import call_command
from django.db import migrations
from corehq.toggles import SYNC_SEARCH_CASE_CLAIM
from corehq.util.django_migrations import skip_on_fresh_install
@skip_on_fresh_install
def _migrate_case_search_relevant(apps, schema_editor):
for domain in sorted(SYNC_SEARCH_CASE_C... | dimagi/commcare-hq | corehq/apps/app_manager/migrations/0017_migrate_case_search_relevant.py | Python | bsd-3-clause | 745 |
# 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
# d... | NaohiroTamura/ironic | ironic/drivers/modules/network/flat.py | Python | apache-2.0 | 5,278 |
import logging
import logging.handlers
development_environ = True
monitor_period_in_s = 30
clock_period_in_s = 2
app_name = 'alarmclock'
mpd_music_folder = r'/var/lib/mpd/music'
local_music_folder = r'./ressources/music/'
local_playlist_folder = r'./ressources/playlist/'
log_folder = r'./log'
syslog_facility = loggi... | musashin/alarmclock | clockconfig.py | Python | mit | 488 |
#!/usr/bin/env python2.5
#
# Copyright 2010 the Melange 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 applic... | SRabbelier/Melange | app/soc/modules/gci/logic/models/org_app_record.py | Python | apache-2.0 | 1,648 |
from Tasks import *
import Pipeline
import Scheduler
import dendropy
sched = Scheduler.Scheduler()
pl = Pipeline.Pipeline(sched)
readgenes = pl.add_task(ReadPhylip('../test/data/some-genes.phylip'))
ft = pl.add_task(RunFastTree(cachefile='/tmp/fasttree-trees')).require(readgenes)
#astrid = pl.add_task(RunASTRID(cach... | pranjalv123/TaxonDeletion | test/test.py | Python | gpl-3.0 | 1,121 |
class Person(object):
"""人的类"""
def __init__(self, name):
super(Person, self).__init__()
self.name = name
def anzhuang_zidan(self, dan_jia_temp, zi_dan_temp):
"""把子弹装到弹夹中"""
#弹夹.保存子弹(子弹)
dan_jia_temp.baocun_zidan(zi_dan_temp)
def anzhuang_danjia(self, gun_temp, dan_jia_temp):
"""把弹夹安装到枪中"""
#枪.保... | jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/加强/老王开枪/老王开枪-5-测试 弹夹、枪.py | Python | gpl-2.0 | 2,244 |
import logging
from django.http import Http404, HttpResponse
import requests
import json
from point import LocationPoint
#Logging
logger = logging.getLogger(__name__)
import os
import datetime, time
class ReittiopasAPI:
def __init__(self):
#init
self.__epsg_in='wgs84'
self.__epsg_out='wgs8... | apps8os/trip-chain-game | tripchaingame/web/reittiopasAPI.py | Python | mit | 6,013 |
# encoding.py
# Copyright (C) 2011-2014 Andrew Svetlov
# andrew.svetlov@gmail.com
#
# This module is part of BloggerTool and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from __future__ import absolute_import
import markdown
from bloggertool.engine import Meta
class Engine... | asvetlov/bloggertool | lib/bloggertool/engine/markdown.py | Python | mit | 1,490 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
# http://peak.telecommunity.com/DevCenter/setuptools#developer-s-guide
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
try:
CHANGES = open(os.path.join(here... | nandoflorestan/deform_pure | setup.py | Python | bsd-3-clause | 1,712 |
#-*- coding: UTF-8 -*-
import sys
from distutils.core import setup
setup(name='SynchroniZerD',
version='1.0.0',
description='A simple folder synchronizer application that uses rsync.',
long_description='SynchroniZeRD is a folder synchronizer application that uses rsync to synchronize and wxWidgets fo... | ROAND/filesynchronizer | setup.py | Python | gpl-3.0 | 1,865 |
#! /usr/bin/env python
from flaskext.testing import TestCase as Base
from fixture import SQLAlchemyFixture, NamedDataStyle
from cfmi import create_app, db
from cfmi.database.dicom import (DicomSubject, Series)
from cfmi.settings import TestConfig
from tests import fixtures
dbfixture = SQLAlchemyFixture(env=fixture... | nocko/cfmi | tests/__init__.py | Python | bsd-3-clause | 712 |
"""
Used as entry point for mayatest from commandline
"""
if __name__ == "__main__":
from mayatest.cli import main
main()
| arubertoson/mayatest | mayatest/__main__.py | Python | mit | 131 |
def get_events(session):
"""Return list of key events recorded in the test_keys_page fixture."""
events = session.execute_script("return allEvents.events;") or []
# `key` values in `allEvents` may be escaped (see `escapeSurrogateHalf` in
# test_keys_wdspec.html), so this converts them back into unicode ... | paulrouget/servo | tests/wpt/web-platform-tests/webdriver/tests/release_actions/support/refine.py | Python | mpl-2.0 | 1,104 |
from __future__ import absolute_import, division, print_function, unicode_literals
import re
import os
from logging import getLogger
from typing import Tuple # noqa: F401
import json
import heprefs.invenio as invenio
try:
from urllib import quote_plus # type: ignore # noqa
from urllib2 import urlop... | misho104/heprefs | heprefs/inspire_article.py | Python | mit | 6,169 |
import logging
import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import useragents
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
from streamlink.utils import parse_json
log = logging.getLogger(__name__)
class Mitele(Plugin):
_url_re = re.compile(r"ht... | repotvsupertuga/tvsupertuga.repository | script.module.streamlink.base/resources/lib/streamlink/plugins/mitele.py | Python | gpl-2.0 | 2,844 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Friends
# Retrieves a list of names and profile IDs for Facebook friends associated with a specified user.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License,... | jordanemedlock/psychtruths | temboo/core/Library/Facebook/Reading/Friends.py | Python | apache-2.0 | 5,502 |
"""
Data collectors for trajectory analysis.
"""
import logging
from . import measure
from .atoms import Selection
__all__ = ['AngleCollector', 'Collector', 'DihedralCollector', 'DistanceCollector', 'FrameCollector', 'RMSDCollector',
'XCoordCollector', 'YCoordCollector', 'ZCoordCollector']
LOGGER = loggi... | ziima/pyvmd | pyvmd/collectors.py | Python | gpl-3.0 | 7,093 |
from BaseController import BaseController
import datetime
import redis
class SlowlogController(BaseController):
def get(self):
data={}
data['data']=[]
server = self.get_argument("server").split(':')
connection = redis.Redis(host=server[0], port=(int)(server[1]), db=0,socket_timeout... | yyy1394/redis-monitor | src/api/controller/SlowlogController.py | Python | mit | 685 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute, NavigateToSibling
from widgetastic.widget import View, NoSuchElementException, Text
from widgetastic_manageiq import Accordion, ManageIQTree, PaginationPane, SummaryTable, Table
from widgetastic_patternfly import BreadCrumb, Button, Dropdown... | anurag03/integration_tests | cfme/storage/manager.py | Python | gpl-2.0 | 8,783 |
import numpy as np
import tensorflow as tf
import data_helpers as dh
from datetime import datetime, date, time, timedelta
'''
get pids for training date
get x_train for training date
get y_train for training date
get x_test for testing date
get y_test for testing date
'''
def getTrainingData(curDate, split_frac =... | ajZiiiN/honest-blackops | src/createTrainDataRNN.py | Python | mit | 4,969 |
from __future__ import absolute_import
# -*- coding: utf-8 -*-
import sunpy
def test_sysinfo():
output = sunpy.util.get_sys_dict()
assert isinstance(output, dict)
| Alex-Ian-Hamilton/sunpy | sunpy/util/tests/test_sysinfo.py | Python | bsd-2-clause | 175 |
# _*_ encoding: utf-8 _*_
"""Demonstrate doubly-linked list in python."""
from linked_list import Node
class DoublyLinked(object):
"""Implement a doubly-linked list from a singly-linked list."""
def __init__(self, val=None):
"""Initialize the list."""
self.head = object()
self._mark =... | palindromed/data-structures2 | src/doubly_linked.py | Python | mit | 4,501 |
##
## For help on setting up your machine and configuring this TestScript go to
## http://docs.bitbar.com/testing/appium/
##
import os
import time
import unittest
from time import sleep
from appium import webdriver
from device_finder import DeviceFinder
def log(msg):
print (time.strftime("%H:%M:%S") + ": " + msg... | aknackiron/testdroid-samples | appium/sample-scripts/python/testdroid_ios.py | Python | apache-2.0 | 5,790 |
import cv2
import numpy as np
def skinExtract(img):
ycbcr = cv2.cvtColor(img, cv2.COLOR_RGB2YCrCb)
[y, cb, cr] = cv2.split(ycbcr)
skin = np.zeros((img.shape[:2]), np.uint8)
for x in range(img.shape[0]):
for y in range(img.shape[1]):
# 肤色大致范围
if(138 <= cr[x, y] and cr[x, y] <=170 and 100 <= cb[x, y] and cb... | Ginkgo-Biloba/Misc-Python | opencv/009FigerTips.py | Python | gpl-3.0 | 1,994 |
from os import listdir, open as os_open, close as os_close, write as os_write, O_RDWR, O_NONBLOCK
from fcntl import ioctl
from boxbranding import getBoxType, getBrandOEM
import struct
from config import config, ConfigSubsection, ConfigInteger, ConfigYesNo, ConfigText, ConfigSlider
from Tools.Directories import pathExi... | devclone/enigma2-9f38fd6 | lib/python/Components/InputDevice.py | Python | gpl-2.0 | 9,159 |
import re
import json
from xbmcswift2 import xbmc, xbmcgui, xbmcvfs
from meta import plugin
from meta.gui import dialogs
from meta.utils.text import to_unicode
from settings import SETTING_AUTOPATCH, SETTING_AUTOPATCHES
from language import get_string as _
EXTENSION = ".metalliq.json"
HTML_TAGS_REGEX = re.compile(r'\[... | TheWardoctor/Wardoctors-repo | plugin.video.metalliq/resources/lib/meta/play/players.py | Python | apache-2.0 | 6,779 |
class Graph:
def __init__(self, data):
self.data = data
def node(self, i):
if i in self.data:
es = self.data[i]
if es :
return Node(es)
else:
pass
def nodes(self):
return Nodes(self.data)
class Nodes:
def __init__(se... | h4ck3rm1k3/gcc_py_introspector | gcc/tree/graph.py | Python | gpl-2.0 | 1,994 |
"""
Cache API class.
"""
from __future__ import print_function
import os
import shutil
from dbcollection.core.manager import CacheManager
from dbcollection.utils import nested_lookup
def cache(query=(), delete_cache=False, delete_cache_dir=False, delete_cache_file=False,
reset_cache=False, reset_path_cac... | dbcollection/dbcollection | dbcollection/core/api/cache.py | Python | mit | 10,747 |
import sys
print('Python version:')
print(sys.version)
try:
import numpy
print('Numpy: {0}'.format(numpy.__version__))
except:
print('NO Numpy')
try:
import matplotlib
print('Matplotlib: {0}'.format(matplotlib.__version__))
except:
print('NO matplotlib')
try:
import scipy
print('scip... | Morisset/PyNeb_devel | pyneb/utils/test_config.py | Python | gpl-3.0 | 1,058 |
from time import sleep
import curses
import os
def plot_border():
for a in [0,79]:
for b in range(0,22):
stdscr.addstr(b,a,"*", curses.color_pair(1))
for a in [0,22]:
for b in range(0,80):
stdscr.addstr(a,b,"*", curses.color_pair(1))
#stdscr.addstr(22,78,"*", curses.... | bmcollier/paddler | paddler.py | Python | unlicense | 3,712 |
from flask import request
from flask_restful import Resource
import json
from core.bo.clienteBo import ClienteBo
class Cliente(Resource):
def __init__(self):
self.cliente = ClienteBo()
def get(self, parameter=""):
if parameter == "":
return self.cliente.get_all(), 201
else:... | guigovedovato/python | api/clienteApi.py | Python | gpl-3.0 | 1,042 |
# -*- coding: utf-8 -*-
"""
test/integration
~~~~~~~~~~~~~~~~
This file defines integration-type tests for hyper. These are still not fully
hitting the network, so that's alright.
"""
import base64
import requests
import threading
import time
import hyper
import hyper.http11.connection
import pytest
from socket import... | Lukasa/hyper | test/test_integration.py | Python | mit | 54,512 |
#!/usr/bin/python -u
# Copyright (c) 2010-2012 OpenStack, LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | pvo/swift | test/functional/tests.py | Python | apache-2.0 | 53,723 |
'''
Created on Jun 6, 2013
@author: sean
'''
from __future__ import unicode_literals
# Standard library imports
from io import BytesIO, StringIO
import codecs
import logging
# Third party imports
import pkg_resources
from requests.packages.urllib3.filepost import choose_boundary, iter_fields
from requests.packages.u... | GiovanniConserva/TestDeploy | venv/Lib/site-packages/binstar_client/requests_ext.py | Python | bsd-3-clause | 5,894 |
# coding: utf-8
from __future__ import (absolute_import, division, print_function, unicode_literals)
import json
import logging
import boto3
from boto3.dynamodb.conditions import Key, Attr
import os
import sys
import re
# Path to modules needed to package local lambda function for upload
currentdir = os.path.dirname(... | alanwill/aws-tailor | sam/functions/talr-inquirer/handler.py | Python | gpl-3.0 | 10,395 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------
# ir_http modular http routing
#----------------------------------------------------------
import base64
import datetime
import hashlib
import logging
import mimetypes
import os
import re
import sys
import urllib2
import werkzeug
impor... | akhmadMizkat/odoo | openerp/addons/base/ir/ir_http.py | Python | gpl-3.0 | 13,358 |
#!/usr/bin/env python
# Copyright 2017-present Open Networking 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... | opencord/voltha | experiments/extensions/read_ext2.py | Python | apache-2.0 | 956 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'mr.S'
from kernel.db import Base
from sqlalchemy import Column, Integer, String, ForeignKey
class ChatUser(Base):
__tablename__ = 's_chat_user'
id = Column(Integer, primary_key=True)
user_id = Column(Integer, ForeignKey('s_user.usr_id'))
cha... | s-tar/just-a-chat | entities/s_chat_user.py | Python | mit | 367 |
'''
SASMOL: Copyright (C) 2011 Joseph E. Curtis, Ph.D.
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.
... | madscatt/sasmol | src/python/test_sasmol/test_sasmol/test_intg_sasmol_SasAtm_miscellaneous.py | Python | gpl-3.0 | 7,692 |
import bee
from bee.segments import *
import libcontext
from libcontext.socketclasses import *
from libcontext.pluginclasses import *
from .matrix import matrix
import Spyder
matrix0 = matrix(Spyder.AxisSystem(), "AxisSystem")
class spawn_actor_or_entity(bee.worker):
actorclassname = antenna("pull", "id")
... | agoose77/hivesystem | dragonfly/scene/spawn_actor_or_entity.py | Python | bsd-2-clause | 2,030 |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... | ahmedbodi/AutobahnPython | examples/twisted/wamp/basic/rpc/arguments/frontend.py | Python | apache-2.0 | 2,510 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | alexlo03/ansible | test/units/modules/network/f5/test_bigip_device_group.py | Python | gpl-3.0 | 5,779 |
# 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... | drpngx/tensorflow | tensorflow/python/kernel_tests/qr_op_test.py | Python | apache-2.0 | 8,834 |
#!/usr/bin/python
# http://stackoverflow.com/questions/4628122/how-to-construct-a-timedelta-object-from-a-simple-string
import re
line = "Run '/tmp/aggr_aql.txt'"
regex = re.compile(r'^.*Run \'(?P<filename>[^\']+?)\'.*$')
parts = regex.match(line)
print "parts = %s" % str(parts)
print "parts = %s" % str(dir(parts... | jtraver/dev | python/re/re4.py | Python | mit | 450 |
from .base import ScrollWindow
from settings_inspector.gui import keys
class VariablesWindow(ScrollWindow):
def __init__(self, settings, *args, **kwargs):
super(VariablesWindow, self).__init__(*args, **kwargs)
self.root_settings = settings
self.reset()
self.render()
return ... | fcurella/django-settings_inspector | settings_inspector/gui/windows/variables.py | Python | mit | 1,500 |
#!/usr/bin/python -tt
import pymetar
import sys
import os
if __name__ == "__main__":
if len(sys.argv) > 1:
repdir=sys.argv[1]
else:
repdir=("reports")
if len(sys.argv) > 2:
reports = sys.argv[2:]
else:
reports = os.listdir(repdir)
reports.sort()
count=0
... | theswitch/pymetar3 | testing/smoketest/testcloud.py | Python | gpl-2.0 | 819 |
# -*- coding: utf-8; -*-
#
# @file __init__.py
# @brief Application Django base url
# @authors Frédéric SCHERMA (INRA UMR1095)
# @date 2017-10-06
# @copyright Copyright (c) 2017 INRA/CIRAD
# @license MIT (see LICENSE file)
# @details
from django.conf.urls import include, url
from django.conf import settings
urlpatter... | coll-gate/collgate | messenger/urls.py | Python | mit | 330 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import fasttext as ft
import os
import regex
import sys
def get_parser():
parser = argparse.Argum... | pytorch/fairseq | examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py | Python | mit | 1,997 |
# 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, ... | datacommonsorg/data | scripts/oecd/regional_demography/life_expectancy_and_mortality/preprocess_csv.py | Python | apache-2.0 | 4,798 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Currency rate date check module for OpenERP
# Copyright (C) 2012-2013 Akretion (http://www.akretion.com).
# @author Alexis de Lattre <alexis.delattre@akretion.com>
#
# This program is free software: ... | yvaucher/account-financial-tools | __unported__/currency_rate_date_check/__openerp__.py | Python | agpl-3.0 | 2,057 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2016-12-29 06:13
from __future__ import unicode_literals
import diabetics.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('diabetics', '0001_initial'),
]
operations = [
migra... | jr55662003/Diabetic-Retinopathy-website | website/diabetics/migrations/0002_auto_20161229_0613.py | Python | mit | 682 |
import ivyrest
# [outputfolderroot] "/scripts/ivy/ivyoutput/sample_output";
a = ivyrest.IvyObj("localhost")
a.set_output_folder_root(".")
a.set_test_name("demo4_edit_rollup_DF")
a.hosts_luns(hosts = "sun159", select = "serial_number : 83011441")
## The [EditRollup] statement gives you access to the ivy Dynamic F... | Hitachi-Data-Systems/ivy | rest_api/samples/DF_demos/demo4_edit_rollup_DF.py | Python | apache-2.0 | 1,211 |
'''
Copyright (c) 2008 Georgios Giannoudovardis, <vardis.g@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,... | vardis/pano | src/pano/view/BaseRenderer.py | Python | mit | 7,689 |
from glob import glob
def load_file(filename):
with open(filename) as f:
return f.read().strip()
def load_fixtures(test_name):
path = "tests/fixtures/{test_name}/*.{direction}.html"
in_files = sorted(glob(path.format(test_name=test_name, direction="in")))
out_files = sorted(glob(path.format(... | Lukas0907/feeds | tests/utils.py | Python | agpl-3.0 | 396 |
#!/usr/bin/env python3
import sys, requests, json
from housepy import strings, util, log
from mongo import db, ObjectId
print("Sighting deduper")
results = db.features.aggregate([
{ '$match': {
'properties.Expedition': "okavango_16",
'properties.FeatureType': "sighting",
}},
{ '$group': ... | O-C-R/intotheokavango | tools/deduper.py | Python | mit | 1,949 |
class Person(object):
"""人的类"""
def __init__(self, name):
super(Person, self).__init__()
self.name = name
self.gun = None#用来保存枪对象的引用
self.hp = 100
def anzhuang_zidan(self, dan_jia_temp, zi_dan_temp):
"""把子弹装到弹夹中"""
#弹夹.保存子弹(子弹)
dan_jia_temp.baocun_zidan(zi_dan_temp)
def anzhuang_danjia(self, gun_... | jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/加强/老王开枪/老王开枪-6-老王拿枪.py | Python | gpl-2.0 | 2,658 |
from nodeconductor.cost_tracking import CostTrackingStrategy, CostTrackingRegister, ConsumableItem
from . import models
class ExchangeTenantStrategy(CostTrackingStrategy):
resource_class = models.ExchangeTenant
class Types(object):
SUPPORT = 'support'
STORAGE = 'storage'
class Keys(obje... | opennode/nodeconductor-saltstack | src/nodeconductor_saltstack/exchange/cost_tracking.py | Python | mit | 1,101 |
from mock import patch, Mock
from nefertari_guards.nefertari_sqla import ACLType
class TestACLType(object):
@patch.object(ACLType, 'stringify_acl')
@patch.object(ACLType, 'validate_acl')
def test_process_bind_param(self, mock_validate, mock_str):
mock_str.return_value = [[1, 2, [3]]]
obj... | brandicted/nefertari-guards | tests/test_nefertari_sqla.py | Python | apache-2.0 | 512 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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.... | kickstandproject/wildcard | wildcard/dashboards/admin/groups/panel.py | Python | apache-2.0 | 989 |
# Copyright 2013-2021 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 Pestpp(CMakePackage):
"""PEST++ is a software suite aimed at supporting complex numerical
... | LLNL/spack | var/spack/repos/builtin/packages/pestpp/package.py | Python | lgpl-2.1 | 996 |
# Django settings for to project.
import os
from local_setting import *
from settings import DEBUG
TEMPLATE_DEBUG = DEBUG
MANAGERS = ADMINS
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sq... | esseti/dododo-dadada | to/settings_local.py | Python | mit | 6,738 |
import unittest
from PySide2.QtWidgets import QWidget, QMainWindow
from helper import UsesQApplication
class QWidgetInherit(QMainWindow):
def __init__(self):
QWidget.__init__(self)
class QWidgetTest(UsesQApplication):
def testInheritance(self):
self.assertRaises(TypeError, QWidgetInherit)
... | BadSingleton/pyside2 | tests/QtWidgets/qwidget_test.py | Python | lgpl-2.1 | 646 |
# vim:tw=50
""""While" Loops
Recursion is powerful, but not always convenient
or efficient for processing sequences. That's why
Python has **loops**.
A _loop_ is just what it sounds like: you do
something, then you go round and do it again, like
a track: you run around, then you run around again.
Loops let you do ... | shiblon/pytour | 3/tutorials/while_loops.py | Python | apache-2.0 | 1,756 |
"""Functional tests for the Getstatus operation"""
import pytest
from pyxb import BIND
from pyxb.bundles.opengis import oseo_1_0 as oseo
from pyxb.bundles.wssplat import soap12
from pyxb.bundles.wssplat import wsse
import requests
pytestmark = pytest.mark.functional
class TestGetStatus(object):
def test_get_st... | pyoseo/pyoseo | tests/functionaltests/test_getstatus.py | Python | apache-2.0 | 445 |
# Copyright (c) 2013 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 writ... | zhangjunli177/sahara | sahara/service/api.py | Python | apache-2.0 | 9,423 |
'''
This file is part of GEAR.
GEAR 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 later version.
This program is distrib... | miquelcampos/GEAR_mc | gear/xsi/rig/component/control_02/__init__.py | Python | lgpl-3.0 | 4,103 |
from redcmd.api import subcmd, Arg
from redlib.api.colors import colorlist
from .base import SourceSubcommand
from ...source.bitmap import BitmapParams
__all__ = ['ColorSubcommand']
class ColorSubcommand(SourceSubcommand):
@subcmd
def color(self, color=Arg(choices=colorlist.keys(), default=None, opt=True)):
... | amol9/wallp | wallp/subcmd/source/color.py | Python | mit | 466 |
from core.himesis import Himesis
class HEEnum(Himesis):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HEEnum.
"""
# Flag this instance as compiled now
self.is_compiled = True
super(HEEnum, self).__init__(name='HEEnum', num_... | levilucio/SyVOLT | ECore_Copier_MM/transformation-Large/HEEnum.py | Python | mit | 6,426 |
#!/usr/bin/python3
# vim: ts=4:sw=4:expandtab
# BleachBit
# Copyright (C) 2008-2021 Andrew Ziem
# https://www.bleachbit.org
#
# 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... | bleachbit/bleachbit | windows/NsisUtilities.py | Python | gpl-3.0 | 4,903 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.core.urlresolvers import reverse
from django.test import TestCase, override_settings
from wagtail.tests.utils import WagtailTestUtils
from wagtail.wagtailcore.models import Page, Site
from wagtail.wagtailredirects import mode... | iansprice/wagtail | wagtail/wagtailredirects/tests.py | Python | bsd-3-clause | 23,927 |
def numeral(n):
numerals = (n//1000) * "M"
numerals += _numeral((n%1000)//100, "C", "D", "M")
numerals += _numeral((n%100)//10, "X", "L", "C")
numerals += _numeral(n%10, "I", "V", "X")
return numerals
def _numeral(num, i, v, x):
n, m = divmod(num, 5)
if n == 1:
return i + x if m ==... | CubicComet/exercism-python-solutions | roman-numerals/roman_numerals.py | Python | agpl-3.0 | 390 |
from xml.dom import minidom
#from lxml import objectify
import struct
import base64
import binascii
from xml.etree.ElementTree import parse
import datetime
import time
hrvlist = "1.0;2.01;3.02;4.05;3.02394"
hrvstr = hrvlist.split(';')
def getVLFp():
VLFp = ((float(hrvstr[1]) + float(hrvstr[2])) / float(hrvstr[0])) * ... | sonicyang/TIE | tools/parse.py | Python | gpl-2.0 | 2,829 |
#!/usr/bin/env python
import unittest
from lib.ll_string import String
class StringTests(unittest.TestCase):
def testExtractHelloWorld(self):
sv = String('$:+ -:-+ -|-: .. :| -*-:X -:. *-+X +. -|* |. -+-| .-: -:*X .+')
result = sv.extract_string()
self.assertEquals(result, "Hello World!"... | autowitch/llama | llama_tests.py | Python | mit | 862 |
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.contrib import messages as Msg
from django.http import HttpResponseRedirect
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.contrib.auth.models impo... | eahneahn/free | lib/python2.7/site-packages/emailmgr/views.py | Python | agpl-3.0 | 6,307 |
"""
Some shared functions
.. deprecated:: 0.6.3
Should be moved to different places and this file removed,
but it needs refactoring.
"""
from __future__ import division
# Libraries.
import hashlib
import os
import stat
import subprocess
import sys
from binascii import hexlify
# Project imports.
import highlevel... | PeterSurda/PyBitmessage | src/shared.py | Python | mit | 9,293 |
#4! = 4*3*2*1
#5! = 5*4*3*2*1
'''
i = 1
result = 1
while i<=4:
result = result * i
i+=1
print(result)
'''
#5! => 5*4!
#4! => 4*3!
'''
def xxx(num):
num * xxxx(num-1)
def xx(num):
num * xxx(num-1)
def getNums(num):
num * xx(num-1)
getNums(4)
'''
def getNums(num):
if num>1:
retur... | jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/函数-下/11-递归.py | Python | gpl-2.0 | 419 |
import socket
import struct
def expect_packet(sock, name, expected):
if len(expected) > 0:
rlen = len(expected)
else:
rlen = 1
packet_recvd = sock.recv(rlen)
return packet_matches(name, packet_recvd, expected)
def packet_matches(name, recvd, expected):
if recvd != expected:
... | lrr-tum/fast-lib | vendor/mosquitto-1.3.5/test/mosq_test.py | Python | lgpl-3.0 | 12,355 |
from flask_table import Table, Col, LinkCol
class Results(Table):
id = Col('Id', show=False)
email = Col('Email')
password = Col('Password', show=False)
registered_on = Col('Registered Date', show=False)
admin = Col('Admin Role', show=False)
confirmed = Col('Confirmed Email', show=False)
c... | VitorHugoAguiar/ProBot | ProBot_Server/ProbotProject/project/table.py | Python | agpl-3.0 | 549 |
import json,os,shelve
import asyncio,sys
DATAFILENAME="data"
def set_user_id(new_id):
_local_data["user_id"]=new_id
def set_login_token(token):
_local_data["login_token"]=token
def load_data():
global _local_data
if(os.path.exists(os.path.join(get_current_path(),DATAFILENAME))):
with open(os.pa... | dandfmd/Linfilesync | utils.py | Python | apache-2.0 | 2,486 |
# Spark BOT
access_token='prettylongstringofjibberjabber'
webhook_name = 'thehook'
webhook_url='http://someexposed.url.to.your.server.io'
# UCM AXL API
AXL_username='ucm_application_user_with_axl_rights'
AXL_password=''
# UCM EMAPI
EMAPI_username='ucm_application_user_with_em_proxy_rights'
EMAPI_password='... | jseynaev-cisco/em-login-bot | config.sample.py | Python | mit | 957 |
# -*- coding:utf-8 -*-
import sys
import os
import unittest
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
import dfcapi
amounts = [10,10,10,10,10,10,10,10,10,10,10,10]
class DfcapiTestCase(unittest.TestCase):
# CHECKKEY
def test_checkkey(self):
dfcapi.setCheckKeyUrl('http://httpbin.o... | dfcplc/dfcapi-python | dfcapi/test/test_dfcapi.py | Python | mit | 4,575 |
from django.conf.urls.defaults import *
from django.conf import settings
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^$', 'django.contrib.auth.views.login'),
(r'^admin/', include(admin.site.urls)),
(r'^files/(?P<path>.*)$'... | nesl/SensorSafeV1-DataStore | urls.py | Python | bsd-3-clause | 1,987 |
import logging
import os
import ffmpeg
from metadata import Episode
LOGGER = logging.getLogger(__name__)
logging.getLogger('requests').setLevel(logging.WARNING)
def download_episode(episode: Episode, download_dir: str, extension: str) -> None:
"""Download episode
:param download_dir: Path to download di... | TheSimoms/NRK-Downloader | src/download.py | Python | gpl-2.0 | 1,158 |
import hail as hl
def densify(sparse_mt):
"""Convert sparse matrix table to a dense VCF-like representation by expanding reference blocks.
Parameters
----------
sparse_mt : :class:`.MatrixTable`
Sparse MatrixTable to densify. The first row key field must
be named ``locus`` and have t... | danking/hail | hail/python/hail/experimental/vcf_combiner/densify.py | Python | mit | 2,369 |
import argparse
import subprocess
import os
here = os.path.abspath(os.path.dirname(__file__))
wpt_root = os.path.abspath(os.path.join(here, os.pardir, os.pardir))
def build(*args, **kwargs):
subprocess.check_call(["docker",
"build",
"--tag", "wpt:local",
... | UK992/servo | tests/wpt/web-platform-tests/tools/docker/frontend.py | Python | mpl-2.0 | 1,571 |
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
# * *
# * This program is free software; you can redistribute it a... | sanguinariojoe/FreeCAD | src/Mod/Path/PathScripts/PathDressupHoldingTags.py | Python | lgpl-2.1 | 47,030 |
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from getpaid.backends import PaymentProcessorBase
class PaymentProcessor(PaymentProcessorBase):
BACKEND = 'getpaid.backends.dummy'
BACKEND_NAME = _('Dummy backend')
BACKEND_ACCEPTED_CURRENCY = (u'PLN', u'EUR', u'USD')
... | anih/django-getpaid | getpaid/backends/dummy/__init__.py | Python | mit | 458 |
# 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... | putcn/Paddle | python/paddle/fluid/transpiler/distribute_transpiler_simple.py | Python | apache-2.0 | 10,044 |
"""Contains functions for dealing with the .pdb file format."""
from datetime import datetime
import re
from itertools import groupby, chain
import valerius
from math import ceil
from .data import CODES
from .structures import Residue, Ligand
from .mmcif import add_secondary_structure_to_polymers
def pdb_string_to_pd... | samirelanduk/molecupy | atomium/pdb.py | Python | mit | 23,845 |
# 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... | martinbede/second-sight | tensorflow/python/ops/data_flow_ops.py | Python | apache-2.0 | 23,716 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.