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 python
# Li Xue
# 8-Aug-2017 19:58
"""
INPUT (*.rnk, the scoring methods have to start from the 4th column, the iRMSD column has to be called 'iRMSD')
#modelID model_class irmsd HaddockScore -iScore_KNN1
1ZHI_294w 0 9.758 -19.3448 0.37
1ZHI_89w 0 17.535 -11.2127 0.... | LilySnow/tools | scoring_plots/SuccessHitRate.py | Python | apache-2.0 | 9,842 |
from typing import Union, Tuple, Optional
from django.contrib.auth.decorators import login_required
from django.contrib.postgres.search import SearchQuery, SearchVector
from django.core.paginator import Paginator, PageNotAnInteger, EmptyPage
from django.db.models import Q, QuerySet
from django.http import Http404, Htt... | n2o/dpb | archive/views.py | Python | mit | 6,411 |
{
'name' : 'Instant Messaging',
'version': '1.0',
'summary': 'Instant Chat',
'author': 'Nantian',
'sequence': '18',
'category': 'Tools',
'complexity': 'easy',
'website': 'http://www.nantiansoftware.com/',
'description':
"""
Instant Messaging
=================
Allows users to... | lbk0116/NTDP | addons/im_chat/__openerp__.py | Python | apache-2.0 | 736 |
"""This module contains various tools to detect tissue.
Included functionality includes methods to detect tissue in a whole-slide image
(i.e. segment foreground from white space), as well as specific workflows
that detect artifacts, specific components (eg blood), and
highly-cellular regions within detected tissue.
"... | DigitalSlideArchive/HistomicsTK | histomicstk/saliency/__init__.py | Python | apache-2.0 | 323 |
# from crispy_forms.helper import FormHelper
# from crispy_forms.layout import Layout, Field, Submit
# from django.forms import ModelForm, CharField, Form
#
# from .models import Item
#
#
# class ItemFilterForm(Form):
# name = CharField(required=False)
#
# def __init__(self, *args, **kwargs):
# super().... | Eraldo/eraldoenergy | inventory/forms.py | Python | bsd-3-clause | 1,263 |
"""Support for WLED switches."""
from __future__ import annotations
from typing import Any, Callable
from homeassistant.components.switch import SwitchEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import HomeAssistantType
... | w1ll1am23/home-assistant | homeassistant/components/wled/switch.py | Python | apache-2.0 | 5,488 |
#!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'chéngshān'
CN=u'承山'
NAME=u'chengshan21'
CHANNEL='bladder'
CHANNEL_FULLNAME='BladderChannelofFoot-Taiyang'
SEQ='BL57'
if __name__ == '__main__':
pass
| sinotradition/meridian | meridian/acupoints/chengshan21.py | Python | apache-2.0 | 239 |
import markdown
md = u'1. this is item 1\n\n1. this is item2 2\n1. this is item 3'
html = markdown.markdown(md)
print html | crmackay/lab-notebook-builder | bin/builder/test.py | Python | mit | 125 |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
MAF format specification:
<http://genome.ucsc.edu/FAQ/FAQformat#format5>
"""
import sys
from bx import interval_index_file
from bx.align import maf
from maize.formats.base import BaseFile
from jcvi.formats.maf import Maf
from maize.apps.base import need_update
from ... | orionzhou/robin | formats/maf.py | Python | gpl-2.0 | 3,492 |
#!/usr/bin/env python
"""
Finds and prints different entities in a game file, including mobs, items, and vehicles.
"""
import locale, os, sys
# local module
try:
import nbt
except ImportError:
# nbt not in search path. Let's see if it can be found in the parent folder
extrasearchpath = os.path.realpath(os.... | macfreek/NBT | examples/mob_analysis.py | Python | mit | 2,071 |
import logging
import json
import subprocess
def send(channel=None, process=None):
"""Notify Slack channel about the ended process.
:param channel: Slack channel
:param process: information about process. (.info() inserted into body)
"""
if channel is None:
raise ValueError("'channel'key... | arlowhite/process-watcher | communicate/slack.py | Python | mit | 1,184 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='berlin-school-data-importer',
version='0.0.0',
description='Berlin school data importer',
long_description='Berlin school data importer',
author... | LubyRuffy/berlin-school-data | importer/setup.py | Python | bsd-3-clause | 1,257 |
import unicode_tex
def escape_for_tex(chars):
escaped = ''.join(list(map(lambda x : unicode_tex.unicode_to_tex_map.get(x, x), chars)))
return escaped.replace('\space', ' ')
| emrehan/daily-planner | utils.py | Python | mit | 176 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, imageio contributors
# Copyright (C) 2013, Zach Pincus, Almar Klein and others
""" This module contains generic code to find and load a dynamic library.
"""
from __future__ import absolute_import, print_function, division
import os
import sys
import ctypes
LOCALDIR = o... | arnavd96/Cinemiezer | myvenv/lib/python3.4/site-packages/imageio/core/findlib.py | Python | mit | 6,260 |
##############################################################################
# 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/cbtf-argonavis/package.py | Python | lgpl-2.1 | 3,911 |
from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
from ..utils import int_or_none
class VideoBamIE(InfoExtractor):
_VALID_URL = r'http://(?:www\.)?videobam\.com/(?:videos/download/)?(?P<id>[a-zA-Z]+)'
_TESTS = [
{
'url': 'http://videobam.com... | apllicationCOM/youtube-dl-api-server | youtube_dl_server/youtube_dl/extractor/videobam.py | Python | unlicense | 2,684 |
from django.db import models
class History(models.Model):
"""
Keeps track of the issues that have been already reported
"""
checksum = models.CharField(max_length=40, db_index=True, unique=True) # Length of a SHA-1 hex hash
project_id = models.PositiveIntegerField(db_index=True) #... | valeriansaliou/django-gitlab-logging | gitlab_logging/models.py | Python | mit | 492 |
from recipyGui import recipyGui
from os import remove
from flask.ext.testing import TestCase
from tinydb import TinyDB
from dateutil.parser import parse
import six
class TestRecipyGui(TestCase):
def create_app(self):
self.dbName = 'recipyGui/tests/test.json'
recipyGui.config['tinydb'] = self.dbNam... | github4ry/recipy | recipyGui/tests/test_recipyGui.py | Python | apache-2.0 | 5,698 |
def extractStarrydawnTranslations(item):
"""
# 'Starrydawn Translations'
"""
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol or frag) or 'preview' in item['title'].lower():
return None
return False
| fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractStarrydawnTranslations.py | Python | bsd-3-clause | 251 |
from django import template
from slick.models import *
register = template.Library()
@register.inclusion_tag('slick.html')
def gallery(name, *args, **kwargs):
return {'slick': Slick.objects.get(name=name)} | Carioca/django_slick | slick/templatetags/slick_tags.py | Python | mit | 211 |
# -*- coding: utf-8 -*-
from django.db import models, migrations, IntegrityError, transaction
from allauth.account.adapter import get_adapter
from allauth.account.models import EmailConfirmation
from badgeuser.models import CachedEmailAddress, BadgeUser, EmailConfirmation
def do_nothing(apps, schema_editor):
"... | concentricsky/badgr-server | apps/badgeuser/migrations/0006_auto_20161128_0938.py | Python | agpl-3.0 | 563 |
"""logtest, a unittest.TestCase helper for testing log output."""
import sys
import time
from uuid import UUID
from cherrypy._cpcompat import text_or_bytes
try:
# On Windows, msvcrt.getch reads a single char without output.
import msvcrt
def getchar():
return msvcrt.getch()
except ImportError:
... | Southpaw-TACTIC/TACTIC | 3rd_party/python3/site-packages/cherrypy/test/logtest.py | Python | epl-1.0 | 8,132 |
import typing
from . import locked
if typing.TYPE_CHECKING:
from . import Repo
@locked
def _set(repo: "Repo", target, frozen):
stage = repo.stage.get_target(target)
stage.frozen = frozen
stage.dvcfile.dump(stage, update_lock=False)
return stage
def freeze(repo, target):
return _set(repo, ... | dmpetrov/dataversioncontrol | dvc/repo/freeze.py | Python | apache-2.0 | 401 |
import os
import sys
import requests
from apscheduler.jobstores.base import JobLookupError
from apscheduler.schedulers.background import BackgroundScheduler
from flask import Flask, request
from flask_restful import Resource, Api
from utility import return_data, add_delta, validate_date, validate_days, validate_trigg... | elcolie/recurrence | recurrence.py | Python | mit | 9,044 |
# Copyright 2017 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... | hfp/tensorflow-xsmm | tensorflow/python/autograph/converters/call_trees_test.py | Python | apache-2.0 | 4,737 |
# SkinDesigner: A Plugin for Building Skin Design (GPL) started by Santiago Garay
# This file is part of SkinDesigner.
#
# Copyright (c) 2017, Santiago Garay <sgaray1970@gmail.com>
# SkinDesigner is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publis... | PayettePeople/SkinDesigner | src/SkinDesigner_DynamicGeometry_Sample.py | Python | gpl-3.0 | 3,682 |
"""EasyEngine GIT module"""
from sh import git, ErrorReturnCode
from ee.core.logging import Log
import os
class EEGit:
"""Intialization of core variables"""
def ___init__():
# TODO method for core variables
pass
def add(self, paths, msg="Intializating"):
"""
Initialize... | liquidia/easyengine | ee/core/git.py | Python | mit | 2,178 |
# Copyright (c) 2016-2017 Enproduktion GmbH & Laber's Lab e.U. (FN 394440i, Austria)
# 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 rig... | Make-O-Matic/MOM-Platform | platform/views/errors.py | Python | mit | 1,529 |
#!/usr/bin/python
import os
import sys
import math
FIELDS = {
'Location': (0, 'limsloc'),
'Cultivar': (1, 'cultivar'),
'Cultivar_ID': (1.1, 'sub_limsid'),
'Starch_Yield_Plant_rel': (2, 'rel_starch'),
'Plants_Parcelle': (3, 'plantspparcelle'),
'Planting_Date': (4, 'planted'),
'Weed_Reductio... | ingkebil/trost | scripts/write_table.py | Python | gpl-2.0 | 1,223 |
class ConnectionLost(Exception):
pass
| TNT-Samuel/Coding-Projects | Kulka - Sphero/kulka-master/kulka/connection/exceptions/connectionlost.py | Python | gpl-3.0 | 43 |
import configparser
def load_config_file(config_file_path):
config = configparser.ConfigParser()
config.read(config_file_path)
input_folder_path = config['DEFAULT']['InputFolderPath']
too_far_distance = int(config['DEFAULT']['TooFarDistance'])
grouping_max_distance = int(config['DEFAULT']['Groupi... | pedroeml/t1-fcg | CrowdDataAnalysis/const.py | Python | mit | 686 |
#
# Copyright 2012-2021 University of Southern California
#
# 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... | informatics-isi-edu/ermrest | ermrest/util.py | Python | apache-2.0 | 5,125 |
# Copyright (c) 2017-present, Facebook, 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... | facebookresearch/Detectron | detectron/utils/image.py | Python | apache-2.0 | 1,514 |
"""Introduce Project.is_public field
Revision ID: 1c314d48261a
Revises: 390c1805c002
Create Date: 2014-02-07 21:01:43.164197
"""
# revision identifiers, used by Alembic.
revision = '1c314d48261a'
down_revision = '390c1805c002'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('organi... | abak-press/kozmic-ci | migrations/versions/1c314d48261a_introduce_project_is_public_field.py | Python | bsd-3-clause | 740 |
# -*- coding: utf-8 -*-
################################################################################
# This file is part of IMTAphy
# _____________________________________________________________________________
#
# Copyright (C) 2010
# Institute of Communication Networks (LKN)
# Department of Electrical Engineerin... | creasyw/IMTAphy | modules/phy/imtaphy/PyConfig/imtaphy/covarianceEstimation.py | Python | gpl-2.0 | 2,413 |
from gi.repository import Gtk
from sunflower.widgets.settings_page import SettingsPage
class OperationOptions(SettingsPage):
"""Operation options extension class"""
def __init__(self, parent, application):
SettingsPage.__init__(self, parent, application, 'operation', _('Operation'))
# create frames
vbox_gen... | MeanEYE/Sunflower | sunflower/gui/preferences/operation.py | Python | gpl-3.0 | 4,218 |
import math
class Vector:
""" 3D Vector
Simple class that represents a 3D vector
"""
def __init__(self, x = 0.0, y = 0.0, z = 0.0):
"""
Creates a vector from it's coordinates
"""
self.x = x
self.y = y
self.z = z
def from_array(self, arr):
"... | tforgione/model-converter | d3/geometry.py | Python | mit | 2,683 |
"""`appengine_config` gets loaded when starting a new application instance."""
import sys
import os.path
# add `lib` subdirectory to `sys.path`, so our `main` module can load
# third-party libraries.
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib'))
sys.path.insert(0, os.path.join(os.path.dirname(__fil... | rafaelbarrelo/appengine-falcon-skeleton | backend/appengine/appengine_config.py | Python | mit | 335 |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
User Account templatetags
"""
from coffin import template
from django.template import RequestContext
from jinja2 import contextfunction, Markup
from treeio.core.rendering import render_to_string
registe... | rogeriofalcone/treeio | account/templatetags/account.py | Python | mit | 1,874 |
#!/usr/bin/env python
#coding: utf-8
class Solution:
# @param s, a string
# @return a boolean
def isNumber(self, s):
ls = len(s)
i, j = 0, ls - 1
while i < ls and s[i] == ' ':
i += 1
while j >= 0 and s[j] == ' ':
j -= 1
if i > j: return False
... | wh-acmer/minixalpha-acm | LeetCode/Python/valid_number.py | Python | mit | 1,947 |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design 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:
#
# * Redistrib... | lucienfostier/gaffer | python/GafferUI/StandardNodeToolbar.py | Python | bsd-3-clause | 2,923 |
"""Change long_description to UnicodeText
Revision ID: 4f04ded45835
Revises: 3ee23961633
Create Date: 2012-10-04 13:34:16.345403
"""
# revision identifiers, used by Alembic.
revision = '4f04ded45835'
down_revision = '3ee23961633'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.alter_column('a... | PyBossa/pybossa | alembic/versions/4f04ded45835_change_long_descript.py | Python | agpl-3.0 | 469 |
# bultin library
import datetime
# external libraries
from sanic import Sanic
from sanic.response import html, redirect, text
from jinja2 import Environment, PackageLoader
import CRUD
env = Environment(
loader=PackageLoader("app", "templates"),
)
app = Sanic(__name__)
app.static("/static", "./static")
@app.ro... | dsvalenciah/sanic-example | app.py | Python | gpl-3.0 | 2,374 |
# -*- coding: utf-8 -*-
import os
import re
from stat import S_IMODE
from enigma import eEnv
SCOPE_TRANSPONDERDATA = 0
SCOPE_SYSETC = 1
SCOPE_FONTS = 2
SCOPE_SKIN = 3
SCOPE_SKIN_IMAGE = 4
SCOPE_USERETC = 5
SCOPE_CONFIG = 6
SCOPE_LANGUAGE = 7
SCOPE_HDD = 8
SCOPE_PLUGINS = 9
SCOPE_MEDIA = 10
SCOPE_PLAYLIST = 11
SCOPE_CU... | idrogeno/IdroMips | lib/python/Tools/Directories.py | Python | gpl-2.0 | 9,462 |
from zeit.calendar.i18n import MessageFactory as _
import calendar
import datetime
import persistent
import time
import zeit.calendar.browser.interfaces
import zeit.calendar.calendar
import zeit.calendar.interfaces
import zeit.cms.browser.menu
import zeit.cms.browser.view
import zope.annotation
import zope.app.containe... | ZeitOnline/zeit.calendar | src/zeit/calendar/browser/calendar_view.py | Python | bsd-3-clause | 12,828 |
'''
New Integration Test for KVM VM ha with multiple networks, disconnect host network and then
check vm start at other host
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.... | zstackorg/zstack-woodpecker | integrationtest/vm/multihosts/ha/test_vm_ha_nets_discon_host_vm_running.py | Python | apache-2.0 | 6,046 |
# Airy function Ai(z) in the complex plane
cplot(airyai, [-8,8], [-8,8], points=50000)
| fredrik-johansson/mpmath | docs/plots/ai_c.py | Python | bsd-3-clause | 87 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tanchao'
def calc_char_gap(a, b):
return abs(ord(b) - ord(a))
def love_letter(str):
res = 0
len_ = len(str)
for i in range((len_ + 1) / 2):
res += calc_char_gap(str[i], str[len_ - 1 - i])
return res
n = int(raw_input())
for i... | tanchao/algo | archive/hackerrank/love_letter.py | Python | mit | 402 |
import logging
from pathlib import Path
from dstools.exceptions import RenderError
from numpydoc.docscrape import NumpyDocString
import jinja2
from jinja2 import (Environment, meta, Template, UndefinedError,
FileSystemLoader, PackageLoader)
class Placeholder:
"""
A jinja2 Template-like o... | edublancas/python-ds-tools | src/dstools/templates/Placeholder.py | Python | mit | 12,779 |
from __future__ import absolute_import
from wallstreet.crawler import stockapi
from wallstreet.crawler.fetcher import CurlFetcher
from datetime import datetime
from wallstreet import config
class TestYahooStockHistoryAPI:
def test_get_url_params(self):
api = stockapi.YahooHistoryDataAPI()
url, met... | breakhearts/wallstreet | wallstreet/test/test_stock_api.py | Python | apache-2.0 | 2,758 |
#!/usr/local/bin/python
import re
import sh
import sys
import os
#####################
# Comment functions #
#####################
def find_substring(substring, string):
indices = []
index = -1 # Begin at -1 so index + 1 is 0
while True:
# Find next index of substring, by starting search from ind... | berntsendavid/obj-c-static-analyzer | get_data.py | Python | mit | 10,110 |
import tsp.algorithms
import time
if __name__ == "__main__":
cities_number = 5
max_distance = 100
distances_matrix = tsp.algorithms.get_random_distances_matrix(cities_number, max_distance)
start = time.time()
optimal_path = tsp.algorithms.BruteForceTSPSolver(distances_matrix).solve()
print(... | PuchatekwSzortach/travelling_salesman_problem | main.py | Python | mit | 1,223 |
from typing import Optional
from thinc.api import Model
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .punctuation import TOKENIZER_PREFIXES, TOKENIZER_INFIXES
from .punctuation import TOKENIZER_SUFFIXES
from .lemmatizer import DutchLemm... | spacy-io/spaCy | spacy/lang/nl/__init__.py | Python | mit | 1,076 |
"""Helper for aiohttp webclient stuff."""
import sys
import asyncio
import aiohttp
from aiohttp.hdrs import USER_AGENT
from homeassistant.core import callback
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.const import __version__
DATA_CONNECTOR = 'aiohttp_connector'
DATA_CONNECTOR_NOTVER... | robjohnson189/home-assistant | homeassistant/helpers/aiohttp_client.py | Python | mit | 3,730 |
import pytest
from ethereum.tools import tester
from ethereum.tests.utils import new_db
from ethereum.db import EphemDB
from ethereum.hybrid_casper import casper_utils
from ethereum.slogging import get_logger
from ethereum.tests.hybrid_casper.testing_lang import TestLangHybrid
log = get_logger('test.chain')
logger = ... | karlfloersch/pyethereum | ethereum/tests/hybrid_casper/test_chain.py | Python | mit | 7,243 |
# Copyright: (c) 2015, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2018, 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
import os
import shutil
import st... | mattclay/ansible | lib/ansible/plugins/action/template.py | Python | gpl-3.0 | 9,710 |
#!/usr/bin/python2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM 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... | xcat2/confluent | confluent_server/bin/confluentsrv.py | Python | apache-2.0 | 1,208 |
#Text to binary converter
#The ASCII and UNICODE charts give every character a numerical value.
#We want to convert text to this number.
def encode(message):
#Python has a built-in function to see the "ordinal value" of a letter
print (ord('a'))
#we can also look at a string of letters, one letter at a ti... | DerekBabb/CyberSecurity | Classic_Cryptography/code/AsciiEncoding.py | Python | gpl-3.0 | 1,127 |
# Created by PyCharm Pro Edition
# User: Kaushik Talukdar
# Date: 27-03-17
# Time: 09:16 PM
#now lets do some sorting operations on the list using sort()
cars = ['bmw', 'audi', 'toyota', 'subaru']
print(cars)
print("\n the list is now sorted \n")
cars.... | KT26/PythonCourse | 2. Introducing Lists/9.py | Python | mit | 373 |
"""
Boolean geometry utilities.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from fabmetheus_utilities import euclidean
import math
__author__ ... | dob71/x2swn | skeinforge/fabmetheus_utilities/geometry/geometry_utilities/evaluate_fundamentals/_math.py | Python | gpl-3.0 | 2,590 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import time
import random
from Radio import Radio
from collections import Counter
from copy import copy
from threading import Timer
import pygame
class MESSAGE:
BATTERY_AVALIABLE = "Универсальная батарея Попова №{id} вставлена"
BA... | satansdeer/questroom-head | full_quest.py | Python | gpl-2.0 | 51,100 |
#!/usr/bin/env python
# Trial server program
import SocketServer
import uuid
import random
import re
HOST = '' # Symbolic name meaning all available interfaces
PORT = 4080 # Arbitrary non-privileged port
trials = [] # trial struct { "addr": addr, "uuid": uuid, "solution": solution,
... | SteffenBauer/mia_elixir | python/trial_socketserver.py | Python | mit | 2,785 |
# -*- coding: utf-8 -*-
"""Unit tests for `schema_factory.schema` module
"""
import pytest
from schema_factory.errors import SchemaError
from collections import OrderedDict
def test_schema_required_fail(mock_schema):
"""Testing `TestSchema` `__init__` method.
"""
with pytest.raises(SchemaError):
... | agile4you/SchemaFactory | test/test_schema_factory.py | Python | gpl-3.0 | 1,340 |
# coding: utf-8
import functions
def cov_group(*args):
if args[0] == "0":
raise functions.OperatorError("COVGROUP", "covgroup does not exist")
else:
return 1
cov_group.registered = True
if not ('.' in __name__):
"""
This is needed to be able to test the function, put it at the end o... | madgik/exareme | Exareme-Docker/src/exareme/exareme-tools/madis/src/functions/row/cov_group.py | Python | mit | 568 |
# Copyright 2011 OpenStack LLC
# Copyright 2015 Mirantic, 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/LICEN... | bswartz/manila | manila/tests/utils.py | Python | apache-2.0 | 4,343 |
"""Functions used for data retrieval and manipulation by the API."""
import logging
from oscar.core.loading import get_model, get_class
from ecommerce.extensions.api import exceptions
NoShippingRequired = get_class('shipping.methods', 'NoShippingRequired')
OrderTotalCalculator = get_class('checkout.calculators', 'Or... | mferenca/HMS-ecommerce | ecommerce/extensions/api/data.py | Python | agpl-3.0 | 1,458 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | chokribr/invenio | invenio/modules/search/walkers/elasticsearch.py | Python | gpl-2.0 | 5,833 |
# -*- coding: utf-8 -*-
"""
Raet Ioflo Behavior Unittests
"""
# pylint: skip-file
# pylint: disable=C0103
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from ioflo.base.consoling import getConsole
console = getConsole()
from ioflo.aid.odicting import odict
from iof... | smallyear/linuxLearn | salt/salt/daemons/test/test_presence.py | Python | apache-2.0 | 28,233 |
import os
import abc
import numpy as np
import pandas as pd
from amquery.core.distance.metrics import distances
from amquery.core.sample import Sample
from amquery.core.sample_map import SampleMap
from amquery.utils.config import get_distance_path
class PairwiseDistance:
__metaclass__ = abc.ABCMeta
@abc.abst... | arriam-lab2/amquery | amquery/core/distance/_pairwise_distance.py | Python | mit | 3,737 |
def make_resample_slices(data, win_size):
"""Return a list of resampled slices given a window size.
data - two-dimensional array to get slices from
win_size - tuple of (rows, columns) for the input window
"""
row = int(data.shape[0] / win_size[0]) * win_size[0]
col = int(data.shape[1] / win... | cgarrard/osgeopy-code | Chapter11/listing11_11.py | Python | mit | 519 |
""" fix waiting bug (c) sirmax 2014 """
#####################################################################
# MOD INFO (mandatory)
XPM_MOD_VERSION = "0.3"
XPM_MOD_URL = "http://www.koreanrandom.com/forum/topic/11630-/#entry151768"
XPM_MOD_UPDATE_URL = ""
XPM_GAME_VERSIONS = ["0.8.11","0.9.0"]
##########... | tectronics/wot-xvm | src/xpm/kwg_waiting_fix/__init__.py | Python | gpl-3.0 | 896 |
# -*- 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-dialogflow-cx | samples/generated_samples/dialogflow_v3beta1_generated_transition_route_groups_create_transition_route_group_sync.py | Python | apache-2.0 | 1,793 |
import os
import logging
from autotest.client.shared import error, utils
from virttest import virsh, utils_libvirtd
def run(test, params, env):
"""
Test command: virsh qemu-monitor-command.
"""
vm_name = params.get("main_vm")
vm = env.get_vm(vm_name)
vm_ref = params.get("vm_ref", "domname")
... | PandaWei/tp-libvirt | libvirt/tests/src/virsh_cmd/domain/virsh_qemu_monitor_command.py | Python | gpl-2.0 | 2,473 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | Fokko/incubator-airflow | tests/utils/test_tests.py | Python | apache-2.0 | 1,351 |
"""
Multiple parallel chains running at once.
This runs skip steps within each chain, looping to return samples in a roundrobin fashion,
chain1, chain2, chain3, ...
Also, steps is the *total* number of steps, not the number of steps for each chain
This is subclassed by several other inference tech... | joshrule/LOTlib | LOTlib/Inference/Samplers/MultipleChainMCMC.py | Python | gpl-3.0 | 2,988 |
from __future__ import print_function
from __future__ import unicode_literals
from inspect import getdoc
from operator import attrgetter
import logging
import re
import signal
import sys
from docker.errors import APIError
import dockerpty
from .. import __version__
from .. import legacy
from ..const import DEFAULT_TI... | jgrowl/compose | compose/cli/main.py | Python | apache-2.0 | 18,320 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | francois-vincent/navitia | source/jormungandr/jormungandr/find_extrem_datetimes.py | Python | agpl-3.0 | 2,516 |
# -*- coding: UTF-8 -*-
import os
import re
import urllib2
from xbmcaddon import Addon
# Get Game first page
def _get_game_page_url(system,search):
platform = _system_conversion(system)
game = search.replace(' ', '+').lower()
games = []
try:
req = urllib2.Request('http://www.gamefaqs.com/sear... | edwtjo/advanced-launcher | resources/scrapers/thumbs/GameFAQs/thumbs_scraper.py | Python | gpl-2.0 | 3,087 |
# proxy module
from pyface.workbench.view import *
| enthought/etsproxy | enthought/pyface/workbench/view.py | Python | bsd-3-clause | 51 |
import shapefile
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.path import Path
import matplotlib.patches as patches
import unicodedata
def elimina_tildes(s):
return ''.join((c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn'))
def dibujaMunicipiosErroresROJO(first,... | othesoluciones/TFM | static/generaMapas/mapasALTOS_Funciones.py | Python | mit | 6,456 |
from django.conf.urls import include, url
from django.views.generic import TemplateView
urlpatterns = [
url(r'^$',
TemplateView.as_view(template_name='index.html'),
name='index'),
url(r'^accounts/',
include('registration.backends.default.urls')),
url(r'^accounts/profile/',
... | yorkedork/django-registration | test_app/urls_default.py | Python | bsd-3-clause | 487 |
import matplotlib as mpl
mpl.rcParams['text.usetex'] = True
mpl.rcParams['font.size'] = 18.0
mpl.rcParams['font.weight'] = 'bold'
from astropy.io import ascii
from astropy.table import join
import glob
import os,shutil
from datetime import datetime,timedelta
import matplotlib.gridspec as gridspec
import matplotlib.pypl... | jprchlik/cms2_python_helpers | create_fit_plots.py | Python | mit | 11,153 |
"""Ipython parallel ready entry points for parallel execution
"""
import contextlib
try:
from ipyparallel import require
except ImportError:
from IPython.parallel import require
from bcbio import heterogeneity, hla, chipseq, structural, upload
from bcbio.bam import callable
from bcbio.rnaseq import sailfish
f... | lpantano/bcbio-nextgen | bcbio/distributed/ipythontasks.py | Python | mit | 13,270 |
import feedparser
from core.models import RecipeCondition
def feed_updated(feed, last_updated):
"""
Checks whether an rss feed has been updated since the last known
modification.
Args:
feed: The url to the RSS feed or the newly fetched and parsed feed
represented by a FeedParser ... | daisychainme/daisychain | daisychain/channel_rss/utils.py | Python | mit | 4,330 |
#!/usr/bin/env python3
from subprocess import getoutput
import threading
import time
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk as gtk
from gi.repository import GLib
class CheckConnection(threading.Thread):
def __init__(self, pppoedi):
super(CheckConnection,self).__init__()
... | LAR-UFES/pppoe-plugin | pppoediplugin/CheckConnection.py | Python | gpl-3.0 | 2,146 |
#opencl_include_dir = '/usr/local/stream/include'
opencl_include_dir = ''#'/usr/local/cuda/include'
#opencl_library_dir = '/usr/local/stream/lib/x86_64'
opencl_library_dir = '/usr/lib'
#opencl_library = 'atiocl64'
opencl_library = 'OpenCL'
| jmercier/CyCL | config.py | Python | mit | 240 |
#!/usr/bin/env python
# normalDate.py - version 1.0 - 20000717
#hacked by Robin Becker 10/Apr/2001
#major changes include
# using Types instead of type(0) etc
# BusinessDate class
# __radd__, __rsub__ methods
# formatMS stuff
# derived from an original version created
# by Jeff Bauer of Rubicon Research and us... | jhurt/ReportLab | src/reportlab/lib/normalDate.py | Python | bsd-3-clause | 20,906 |
#-------------------------------------------------------------------------------
# Name:Currency Conversion
# Purpose:A program that accesses google finance to do curency calculation
#
# Author: Daniel Campos
#
# Created: Monday Nov 3rd, 2014
#----------------------------------------------------------------------------... | dfcf93/RPICS | ProgrammingInPython/proj06_daniel_campos.py | Python | mit | 2,668 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Mapping from raw JSON data structures to Python objects and vice versa.
>>> from couchdb import ... | WalkingMachine/sara_commun | wm_ork/object_recognition_core/python/couchdb-python/couchdb/mapping.py | Python | apache-2.0 | 22,341 |
from collections import Counter
def bsearch(nums, target):
"""
Binary Search with duplicates.
:param nums: Given array
:param target: The element to find in the array
:return: first index of the element found
"""
idx, l, r = -1, 0, len(nums) - 1
while l <= r:
mid = l + (r - l... | Sriee/epi | data_structures/search/bsearch.py | Python | gpl-3.0 | 7,820 |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (... | apache/bloodhound | bloodhound_multiproduct/tests/resource.py | Python | apache-2.0 | 14,341 |
print str(range(-8,-4))[:5]
print len(range(-8,-4))
print range(-8,-4)[0]
print range(-8,-4)[1]
print range(-8,-4)[-1]
| ArcherSys/ArcherSys | skulpt/test/run/t153.py | Python | mit | 119 |
# Copyright 2015 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, ... | amboutin/GCP | appengine/standard/app_identity/signing/main.py | Python | apache-2.0 | 2,750 |
"""
Common utilities used by the test classes
"""
import re
import json
from flask import current_app
from flask.ext.testing import TestCase
from biblib import app
from httpretty import HTTPretty
from biblib.models import db
from biblib.utils import assert_unsorted_equal
import testing.postgresql
class HTTPrettyCont... | jonnybazookatone/biblib-service | biblib/tests/base.py | Python | mit | 12,089 |
# -*- coding: UTF-8 -*-
"""
Csv rendering of t_list output
@author: Aurélien Gâteau <mail@agateau.com>
@author: Sébastien Renard <sebastien.renard@digitalfox.org>
@license: GPL v3 or later
"""
import csv
from yokadi.ycli import tui
TASK_FIELDS = ["title", "creationDate", "dueDate", "doneDate", "description", "urgenc... | kartikm/yokadi | yokadi/ycli/csvlistrenderer.py | Python | gpl-3.0 | 923 |
# code by Razerman, thanks!
import requests
import json
import zlib
import struct
import os
# Helper function to strip out bytes
def remove_bytes(buffer, start, end):
fmt = '%ds %dx %ds' % (start, end - start, len(buffer) - end) # 3 way split
return b''.join(struct.unpack(fmt, buffer))
# Helper f... | tarnheld/ted-editor | src/upload_ted.py | Python | unlicense | 4,607 |
class InvalidTokenException(Exception):
def __init__(self, value):
super().__init__()
self.value = value
def __str__(self):
return self.value
| qateam123/eq | app/authentication/invalid_token_exception.py | Python | mit | 176 |
from astropy.io import fits
from astropy.wcs import WCS
import numpy as np
import matplotlib
import os
import glob
from findSN import *
from matplotlib.ticker import AutoMinorLocator
import sys
sys.path.insert(0, '/home/afsari/')
from SNAP2.Analysis import *
current_path=os.path.dirname(os.path.abspath(__file__))
matp... | niliafsari/KSP-SN | Lbolcorr.py | Python | bsd-3-clause | 11,518 |
import unittest
import mock
import six
import codecs
import os
import json
import logging
import shutil
import tarfile
import io
from io import BytesIO
import uuid
from docker_squash.squash import Squash
from docker_squash.errors import SquashError, SquashUnnecessaryError
from docker_squash.lib import common
if not s... | goldmann/docker-squash | tests/test_integ_squash.py | Python | mit | 48,070 |
#!/usr/bin/env python
import os
import subprocess
from distutils.cmd import Command
from distutils.core import Extension, setup
os.putenv('LC_CTYPE', 'en_US.UTF-8')
pyalpm_version = '0.8'
cflags = ['-Wall', '-Wextra',
'-Wno-unused-parameter',
'-std=c99', '-D_FILE_OFFSET_BITS=64']
alpm = Extension('pyakm.py... | pssncp142/pyakm | setup.py | Python | gpl-3.0 | 1,252 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.