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 |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# ------------------------------------------------------... | crossroadchurch/paul | tests/utils/__init__.py | Python | gpl-2.0 | 2,109 |
from __future__ import absolute_import, division, print_function
import pytest
import numpy as np
from numpy.testing import assert_allclose
from .. import Data
from ..aggregate import Aggregate
class TestFunctions(object):
def setup_method(self, method):
self.d = Data(a=np.random.random((3, 3, 3)) - 0.... | stscieisenhamer/glue | glue/core/tests/test_aggregate.py | Python | bsd-3-clause | 4,574 |
# From SublimeGithub: https://github.com/bgreenlee/sublime-github
# Copyright (c) 2011 Brad Greenlee
# adapted from https://github.com/wbond/sublime_package_control/blob/master/Package%20Control.py
import os.path
import subprocess
class BinaryNotFoundError(Exception):
pass
class CommandExecutionError(Exception)... | NicoSantangelo/sublime-text-trello | lib/commandline.py | Python | mit | 1,090 |
import simplejson as json
import xmltodict
import requests
import os
import re
import sys
import base64
from urlparse import urlparse
from os.path import splitext, basename
from BeautifulSoup import BeautifulSoup
nb_token = os.environ.get('NB_TOKEN')
site_slug = os.environ.get('SITE_SLUG')
api_url = "https://" + site_... | thmcmahon/wp2nb | wp2nb.py | Python | mit | 6,200 |
from nowtrade.notification import SMTPNotification
import unittest
class MockSMTPNotification(SMTPNotification):
def __init__(self, username, password, recipient):
SMTPNotification.__init__(self, username, password, recipient)
self.session = MockSMTPSession()
def _get_session(self):
pa... | edouardpoitras/NowTrade | tests/test_notification.py | Python | mit | 1,227 |
from main_handler import Handler
from .. import utils
class DelPost(Handler):
"""Handler for deleting posts"""
@utils.login_required
@utils.post_exists
@utils.user_owns_post
def get(self, post_id, post):
post.delete()
self.redirect("/")
| stonescar/multi-user-blog | blogmods/handlers/del_post.py | Python | mit | 275 |
from fixture.orm import ORMFixture
from model.group import Group
db = ORMFixture(host="127.0.0.1", name="addressbook", user="root", password="")
try:
l = db.get_contacts_not_in_group(Group(id="121"))
for item in l:
print(item)
print(len(l))
finally:
pass#db.destroy() | peruana80/python_training | check_db_connection.py | Python | apache-2.0 | 293 |
from Chip import OpCodeDefinitions
from Tests.OpCodeTests.OpCodeTestBase import OpCodeTestBase
class TestStxOpCode(OpCodeTestBase):
def test_stx_absolute_command_calls_stx_method(self):
self.assert_opcode_execution(OpCodeDefinitions.stx_absolute_command, self.target.get_stx_command_executed)
def tes... | jeroanan/Nes2 | Tests/OpCodeTests/TestStxOpCode.py | Python | bsd-3-clause | 664 |
######################################################################
##
## Copyright (C) 2008-2009, Goedson Teixeira Paixao
##
## 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 So... | goedson/photogram | photogram/transitions/Scrolling.py | Python | gpl-3.0 | 7,749 |
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
from apptext import AppText
from os.path import dirname, basename, join, normpath, isdir, splitext
from os import makedirs
from screenplay import ScreenPlay
from sonification import Sonification
import libs.audiomixer as amix
from Tkinter import Tk, RIGHT, LEFT, ... | MaroGM/gendersonification | main.py | Python | gpl-2.0 | 9,323 |
import zeeguu_core
from sqlalchemy import Column, Integer, String
db = zeeguu_core.db
class Topic(db.Model):
"""
A topic is the general (English) name of a topic,
the localized_topic contains the language, translation,
and the keywords used to find the articles.
"""
__table_arg... | mircealungu/Zeeguu-Core | zeeguu_core/model/topic.py | Python | mit | 2,310 |
from __future__ import unicode_literals
import time
from moto.core import BaseBackend, BaseModel
from moto.compat import OrderedDict
from.exceptions import (
JsonRESTError,
DatabaseAlreadyExistsException,
DatabaseNotFoundException,
TableAlreadyExistsException,
TableNotFoundException,
Partition... | okomestudio/moto | moto/glue/models.py | Python | apache-2.0 | 4,795 |
#!/usr/bin/env python
#
# Copyright 2017 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
import sys
dirpath = sys.argv[1]
regex = re.compile(sys.argv[2])
print sorted(filter(regex.match, os.listdir(dirpath)))[-1]
| youtube/cobalt | third_party/skia/gn/highest_version_dir.py | Python | bsd-3-clause | 304 |
__author__ = 'jay'
from pathlib import Path
import os
import json
import requests
data_dir = Path(__file__, "../../data").resolve()
usernames_path = Path(data_dir, "github_usernames.json")
users_path = Path(data_dir, "github_users.json")
users_url_template = "https://api.github.com/users/%s"
class RateLimitExceptio... | Impactstory/depsy | scripts/github_users.py | Python | mit | 2,346 |
#!/usr/bin/env python3
#
# Tests the simple egg box toy LogPDF.
#
# This file is part of PINTS (https://github.com/pints-team/pints/) which is
# released under the BSD 3-clause license. See accompanying LICENSE.md for
# copyright notice and full license details.
#
import pints
import pints.toy
import unittest
import nu... | martinjrobins/hobo | pints/tests/test_toy_simple_egg_box_logpdf.py | Python | bsd-3-clause | 3,691 |
"""
**********
Exceptions
**********
.. autoclass:: synapseclient.exceptions.SynapseError
.. autoclass:: synapseclient.exceptions.SynapseAuthenticationError
.. autoclass:: synapseclient.exceptions.SynapseFileCacheError
.. autoclass:: synapseclient.exceptions.SynapseMalformedEntityError
.. autoclass:: synapseclient.exc... | thomasyu888/synapsePythonClient | synapseclient/core/exceptions.py | Python | apache-2.0 | 5,354 |
from setuptools import setup, find_packages
version = '0.3.4'
setup(
name="alerta-prometheus",
version=version,
description='Alerta plugin for Prometheus Alertmanager',
url='https://github.com/alerta/alerta-contrib',
license='Apache License 2.0',
author='Nick Satterly',
author_email='nick... | msupino/alerta-contrib | plugins/prometheus/setup.py | Python | mit | 645 |
# -*- coding: utf-8 -*-
"""
pygments.lexers.julia
~~~~~~~~~~~~~~~~~~~~~
Lexers for the Julia language.
:copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \... | unreal666/outwiker | plugins/source/source/pygments/lexers/julia.py | Python | gpl-3.0 | 14,179 |
import unittest
from pycoin.ecdsa.secp256k1 import secp256k1_generator
from pycoin.encoding import hash160_sec_to_bitcoin_address
from pycoin.key import Key
from pycoin.key.BIP32Node import BIP32Node
from pycoin.key.Key import InvalidPublicPairError, InvalidSecretExponentError
from pycoin.key.validate import is_addres... | shivaenigma/pycoin | tests/key_validate_test.py | Python | mit | 18,523 |
import inspect
import os
from functools import partial, wraps
from asgiref.local import Local
from django.template import Context, Template, TemplateSyntaxError
from django.test import SimpleTestCase, override_settings
from django.utils import translation
from django.utils.safestring import mark_safe
from django.util... | elena/django | tests/template_tests/syntax_tests/i18n/test_blocktranslate.py | Python | bsd-3-clause | 27,773 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
impor... | mindbody/API-Examples | SDKs/Python/swagger_client/models/update_appointment_response.py | Python | bsd-2-clause | 3,504 |
#!/usr/bin/python
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# not... | Zolertia/openthread | tests/scripts/thread-cert/Cert_5_3_04_AddressMapCache.py | Python | bsd-3-clause | 5,188 |
import sys
import logging
from metagen.helpers.auth import ApiKeyAuth
from metagen.helpers.exceptions import ValidationError, MetagenException, UploadException, NotFoundException
import metagen.utils as utils
from metagen.api.files import Files
import metagen.api.upload as upload
from metagen.api.analysis import Analy... | huaili-cid/metagen_cli | metagen/client.py | Python | mit | 4,440 |
"""Define the Tags filter."""
from hoomd.filter.filter_ import ParticleFilter
from hoomd._hoomd import ParticleFilterTags
import numpy as np
class Tags(ParticleFilter, ParticleFilterTags):
"""Select particles by tag.
Args:
tags (list[int]): List of particle tags to select.
A particle tag is a u... | joaander/hoomd-blue | hoomd/filter/tags.py | Python | bsd-3-clause | 1,362 |
'''
Copyright (C) 2013 Travis DeWolf
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 is distributed in the hope t... | studywolf/control | studywolf_control/arms/three_link/arm.py | Python | gpl-3.0 | 8,681 |
#!/usr/bin/env python
from itertools import product
import sys
SYM_NUM = 4
def sequences(length, max_value):
"""
Produces various length tuples from (0, 0, .., 0) to (n-1, n-1, .., n-1),
where n = max_value
"""
return product(range(max_value), repeat=length)
class MatrixExc(Exception):
"""
... | Valiev/contests | darkus/201410/task.py | Python | mit | 2,059 |
import cv2
import numpy as np
from RandomNodeGenerator import RandomNodeGenerator
from HammersleyNodeGenerator import HammersleyNodeGenerator
from SimpleCollisionChecker import SimpleCollisionChecker
from CircleCollisionChecker import CircleCollisionChecker
from Environment import Environment
from DilatedEnvironment... | JavierIH/platano | algorithm/algorithm.py | Python | gpl-2.0 | 5,686 |
# 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... | jbedorf/tensorflow | tensorflow/python/tpu/datasets.py | Python | apache-2.0 | 7,631 |
from itertools import groupby
def repeating_fractions(numerator, denominator):
integer, fractional = str(numerator / float(denominator)).split('.')
grouped = []
for k, g in groupby(fractional):
try:
next(g)
next(g)
grouped.append('({})'.format(k))
except... | the-zebulan/CodeWars | katas/kyu_6/group_repeating_fractions.py | Python | mit | 419 |
# -*- coding: utf-8 -*-
# AwesomeTTS text-to-speech add-on for Anki
# Copyright (C) 2010-Present Anki AwesomeTTS Development Team
#
# 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 versi... | AwesomeTTS/awesometts-anki-addon | awesometts/service/pico2wave.py | Python | gpl-3.0 | 4,570 |
# coding=utf-8
import tensorflow as tf
from gym.spaces import Discrete, Box
def observation_input(ob_space, batch_size=None, name='Ob'):
'''
Build observation input with encoding depending on the
observation space type
Params:
ob_space: observation space (should be one of gym.spaces)
batch_siz... | google-research/episodic-curiosity | third_party/baselines/common/input.py | Python | apache-2.0 | 1,090 |
#
# Copyright (c) 2014 Rafal Bolanowski
# For licensing information please see a LICENSE file.
#
# base64 encoded sample webpage from EdukacjaCL
source = """
PGh0bWw+CjxoZWFkPgo8bWV0YSBjb250ZW50PSJ0ZXh0L2h0bWw7IGNoYXJzZXQ9dXRmLTgiIGh0
dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIvPgo8dGl0bGU+UG9saXRlY2huaWthIFdyb2PFgmF3c2th
CiAgICA... | robin92/pwravg | tests/edukacjacl_consts.py | Python | mit | 47,575 |
# -*- 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
#... | CloverHealth/airflow | airflow/www/views.py | Python | apache-2.0 | 103,442 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
Topic: 二进制序列类型bytes和bytearray
bytes是不可变的二进制序列,而bytearray是可变二进制序列
"""
if __name__ == '__main__':
a = b"abc"
aa = bytearray(a)
aa.append(49)
print(aa)
pass
def test():
cafe = bytes('café', encoding='utf_8') # 各个元素是 range(256) 内的整数
print(... | yidao620c/core-python | ch04strbytes/my_bytes.py | Python | apache-2.0 | 731 |
from .rule import Rule
| aserebryakov/godville-monitor-console | monitor/status_processing/__init__.py | Python | gpl-2.0 | 23 |
# -*- Mode: Python -*-
# coding=utf-8
# GDBus - GLib D-Bus Library
#
# Copyright (C) 2008-2011 Red Hat, Inc.
# Copyright (C) 2018 Iñigo Martínez <inigomartinez@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as publishe... | johne53/MB3Glib | gio/gdbus-2.0/codegen/codegen.py | Python | lgpl-2.1 | 206,530 |
import urwid
from urwid.util import decompose_tagmarkup
class BasicWidget(urwid.WidgetWrap):
""" Basic widget for GViewer
Define the basic attr and basic behavior how GViewer widget to display or act
Attributes:
controller: a Controller instance
context: a Context instance
widget... | chhsiao90/gviewer | gviewer/basic_widget.py | Python | mit | 8,107 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | lmazuel/azure-sdk-for-python | azure-mgmt-batchai/azure/mgmt/batchai/models/batch_ai_management_client_enums.py | Python | mit | 1,894 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
SnapGeometries.py
-----------------
Date : October 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
******************... | CS-SI/QGIS | python/plugins/processing/algs/qgis/SnapGeometries.py | Python | gpl-2.0 | 5,676 |
import tornado.web
import sqlite3
import json
import logging
from config import *
from webserver.utils import *
# the read-only sqlite connection for this server
# "?mode=ro" requires the newest sqlite python3.4 wrappers to be enabled
dbcon = sqlite3.connect(DBPREFIX + 'media.db?mode=ro', uri=True)
dbcur = dbcon.curso... | BeamNG/mediashare | webserver/media_ro.py | Python | mit | 2,645 |
import unittest
import cv2
class TestOpenCV(unittest.TestCase):
def test_imread(self):
img = cv2.imread('/input/tests/data/dot.png')
self.assertEqual(1, img.shape[0])
def test_classifier(self):
face_classifier = cv2.CascadeClassifier()
# Pretrained classifier downloaded from... | Kaggle/docker-python | tests/test_opencv.py | Python | apache-2.0 | 735 |
# -*- 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-analytics-admin | samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py | Python | apache-2.0 | 1,810 |
# Copyright 2013 The Servo Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
#... | paulrouget/servoshell | python/servo/devenv_commands.py | Python | mpl-2.0 | 12,202 |
"""
Provides ValueMeta metaclass - which allows its descendants to override
__instancecheck__ and __subclasscheck__ to be used as *classmethods*
"""
from __future__ import absolute_import
__all__ = [
'ValueMeta',
'ValueABC',
'InterfaceType',
'ExistingDirectory',
'ExistingFile'
]
from .existing_dir... | OaklandPeters/pyinterfaces | pyinterfaces/valueabc/__init__.py | Python | mit | 498 |
# proxy module
from __future__ import absolute_import
from scimath.mathematics.quaternion import *
| enthought/etsproxy | enthought/mathematics/quaternion.py | Python | bsd-3-clause | 99 |
from django import forms
class ContactForm(forms.Form):
name = forms.CharField(max_length=25, label="Your Name")
email = forms.EmailField(max_length=50, label="Your Email (Optional)", required=False)
subject = forms.CharField(max_length=50, label="The Subject of Your Message")
message ... | samolds/samster | sam/forms/contact.py | Python | mit | 499 |
# Generated by Django 1.11.16 on 2018-10-24 07:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0004_add_choices_to_timezone"),
]
operations = [
migrations.AddField(
model_name="user",
name="stripe_cu... | Elchi3/kuma | kuma/users/migrations/0005_stripe_customer_id.py | Python | mpl-2.0 | 413 |
from __future__ import print_function
import numpy as np
from astropy.time import Time
from astropy.time import TimeDelta
import matplotlib.pyplot as plt
import pandas as pd
'''
Python program to calculate upcoming EB eclipse times and durations.
Useful for figuring out when to observe, or not.
Originally written by Me... | mrawls/APO-1m-phot | eclipsefinder.py | Python | mit | 11,142 |
# Generated from 'Appearance.h'
def FOUR_CHAR_CODE(x): return x
kAppearanceEventClass = FOUR_CHAR_CODE('appr')
kAEAppearanceChanged = FOUR_CHAR_CODE('thme')
kAESystemFontChanged = FOUR_CHAR_CODE('sysf')
kAESmallSystemFontChanged = FOUR_CHAR_CODE('ssfn')
kAEViewsFontChanged = FOUR_CHAR_CODE('vfnt')
kThemeDataFileType ... | MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.3/Lib/plat-mac/Carbon/Appearance.py | Python | mit | 26,525 |
from django.test import TestCase
from banana import register_module, register_class, matches
import scenarios
import os
class BananaTest(TestCase):
pass
class InlineTest(TestCase):
"""An alternative way to represent tests"""
@matches(r'^Given the user opens some weird page')
def inclassInit(self)... | bastih/banana | examples/webapp/myapp/tests.py | Python | mit | 646 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Default link factories for PID serialization into URLs.
Link factory can be speci... | tiborsimko/invenio-records-restapi | invenio_records_rest/links.py | Python | gpl-2.0 | 1,639 |
from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.state.environment import Environment
from mythril.laser.ethereum.state.account import Account
from mythril.laser.ethereum.state.machine_state import MachineState
from mythril.laser.ethereum.state.global_state import GlobalState
from my... | b-mueller/mythril | tests/instructions/extcodehash_test.py | Python | mit | 1,961 |
#!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Utility for checking and processing licensing information in third_party
directories.
Usage: licenses.py <command>
Commands:
... | lihui7115/ChromiumGStreamerBackend | tools/licenses.py | Python | bsd-3-clause | 18,192 |
# encoding: utf-8
# Copyright 2013 maker
# License
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Group'
db.create_table('core_group', (
('id'... | alejo8591/maker | core/migrations/0001_initial.py | Python | mit | 25,620 |
from django.conf.urls import patterns, url
from miembros import views
from django.contrib.auth.decorators import login_required
urlpatterns = patterns('',
url(r'^configurar/(?P<pk>\d+)$', login_required(views.IndexView.as_view()), name='miembros_listar'),
url(r'^crear/(?P<pk>\d+)/(?P<usuario>\d+)$', login_req... | alforro/sgpa2015 | miembros/urls.py | Python | gpl-2.0 | 703 |
# -*- coding: utf-8 -*-
#----------------------------------------------------------------------------
# Tsubame paths handling
#----------------------------------------------------------------------------
# Copyright 2012, Martin Kolman
#
# This program is free software: you can redistribute it and/or modify
# it under... | M4rtinK/tsubame | core/paths.py | Python | gpl-3.0 | 8,478 |
############################
## replaceLinesFull.py
############################
"""
Script for replacing special escape characters in the original yelp academic dataset files.
Special characters such as \n cause problems for the JSON to CSV conversions.
If you want to include review text in the edge file, use this scr... | Aneapiy/graph_visualization_Yelp | dataProcScripts/replaceLinesFull.py | Python | apache-2.0 | 698 |
__author__ = 'USER'
from analyzer import text_handler
from analyzer import text_analyzer
from analyzer import ngram
from analyzer import filter
from common import fileio
from common import math_util
from collections import OrderedDict
def collect_preference_from_file(file_path, filter_files=0):
"""
Collect m... | ParkJinSang/Logle | analyzer/preference_analyzer.py | Python | mit | 3,934 |
from setuptools import setup, find_packages
from valleybackups.__init__ import version
setup(
name='valleybackups',
version=version,
description='Command-line based AWS Glacier backup tool',
long_description_markdown_filename='README.md',
url='http://www.valleyworks.us',
author='Valley Works',... | valleyworks/valleybackups | setup.py | Python | mit | 1,074 |
'''
Created on Jun 3, 2011
@author: mkiyer
'''
from base import parse_string_none
from sam import get_clipped_interval
DISCORDANT_TAG_NAME = "XC"
class DiscordantTags(object):
CONCORDANT_TX = 0
DISCORDANT_STRAND_TX = 1
CONCORDANT_GENE = 2
DISCORDANT_STRAND_GENE = 3
CONCORDANT_GENOME = 4
DISCOR... | genome-vendor/chimerascan | chimerascan/lib/chimera.py | Python | gpl-3.0 | 13,725 |
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2016 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <https://weblate.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, eith... | matejcik/weblate | weblate/trans/machine/glosbe.py | Python | gpl-3.0 | 1,997 |
'''tzinfo timezone information for Asia/Istanbul.'''
from pytz.tzinfo import DstTzInfo
from pytz.tzinfo import memorized_datetime as d
from pytz.tzinfo import memorized_ttinfo as i
class Istanbul(DstTzInfo):
'''Asia/Istanbul timezone definition. See datetime.tzinfo for details'''
zone = 'Asia/Istanbul'
_... | newvem/pytz | pytz/zoneinfo/Asia/Istanbul.py | Python | mit | 7,307 |
import glob, os
dir_name = "icons"
app_name = "kaktus"
# "dir_name": size
sizes = {
"86x86": 86,
"108x108": 108,
"128x128": 128,
"150x150": 150,
"172x172": 172,
"256x256": 256
}
svg = app_name + ".svg"
if not os.path.exists(dir_name):
os.makedirs(dir_name)
for name in sizes.keys():
... | mkiol/kaktus | sailfish/res/gen_png_app.py | Python | gpl-3.0 | 785 |
import cert
import organisation as org
import tools.openssl as openssl
import tools.misc as tools
class UserError(Exception):
pass
class UserAccount():
"""
Class UserAccount: user account class, contains login, encrypted
passwords and comments (like passwordsafe).
Attributes:
... | RemiBauzac/easyPKI | backend/easypki/user.py | Python | mpl-2.0 | 7,052 |
#!/usr/bin/env python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Script to regenerate API docs using doxygen.
"""
import argparse
import collections
import json
import os
import shutil
import ... | heke123/chromium-crosswalk | native_client_sdk/src/doc/doxygen/generate_docs.py | Python | bsd-3-clause | 10,328 |
#***************************************************************************
#* *
#* Copyright (c) 2011, 2016 *
#* Jose Luis Cercos Pita <jlcercos@gmail.com> *
#* ... | bblacey/FreeCAD-MacOS-CI | src/Mod/Ship/shipHydrostatics/Tools.py | Python | lgpl-2.1 | 18,781 |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | jayceyxc/hue | apps/jobbrowser/src/jobbrowser/api2.py | Python | apache-2.0 | 3,643 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('historias', '0007_auto_20150425_1459'),
]
operations = [
migrations.AlterField(
model_name='hist... | btenaglia/hpc-historias-clinicas | hpc-historias-clinicas/historias/migrations/0008_auto_20150425_1527.py | Python | bsd-3-clause | 878 |
"""Switch implementation for Wireless Sensor Tags (wirelesstag.net)."""
import logging
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice
from homeassistant.const import CONF_MONITORED_CONDITIONS
import homeassistant.helpers.config_validation as cv
from . import DOMAIN... | jamespcole/home-assistant | homeassistant/components/wirelesstag/switch.py | Python | apache-2.0 | 2,612 |
import os
import subprocess
import requests
import json
import csv
from constants import InstallAction, get_migration_directory, ServerType
from common import can_edit_install
from common import can_install
from common import create_or_update_install_job
from common import fill_custom_command_profiles
from common imp... | smjurcak/csm | csmserver/views/asr9k_64_migrate.py | Python | apache-2.0 | 33,511 |
#from .descriptors.rootsift import RootSIFT
from ..convenience import is_cv2
import cv2
if is_cv2():
FeatureDetector_create = cv2.FeatureDetector_create
DescriptorExtractor_create = cv2.DescriptorExtractor_create
else:
try:
_DETECTOR_FACTORY = {"SIFT": cv2.xfeatures2d.SIFT_create,
... | ssaini4/RoboticLamp | main/imutils/feature/factories.py | Python | bsd-2-clause | 3,165 |
"""Affinity Propagation clustering algorithm."""
# Author: Alexandre Gramfort alexandre.gramfort@inria.fr
# Gael Varoquaux gael.varoquaux@normalesup.org
# License: BSD 3 clause
import numpy as np
from ..base import BaseEstimator, ClusterMixin
from ..utils import as_float_array, check_array
from ..utils.valid... | nhejazi/scikit-learn | sklearn/cluster/affinity_propagation_.py | Python | bsd-3-clause | 11,062 |
try:
from nltk.tag.stanford import NERTagger
except ImportError:
print ('If you want to use the Stanford tagger, '
'you need to install nltk (>= 3.0.1).')
NERTagger = None
import config
# Requires nltk library and plugins
class StanfordNER(object):
"""
Interacts with the Stanford Tagger.
... | hyperstudio/parserbot | parserbot/stanford.py | Python | gpl-2.0 | 3,418 |
from ..PulsePrimitives import *
from ..Compiler import compile_to_hardware
from ..PulseSequencePlotter import plot_pulse_files
from itertools import chain
from numpy import pi
from typing import Iterable, Union
def SPAM(qubit: Channels.LogicalChannel,
angleSweep: Iterable[Union[int, float]],
maxSpa... | BBN-Q/QGL | QGL/BasicSequences/SPAM.py | Python | apache-2.0 | 2,055 |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Copyright (c) 2017, raspberrypi.com.tw
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Author : sosorr... | raspberrypi-tw/camera-python | 08_http_video_stream/camera_pi.py | Python | bsd-3-clause | 849 |
'''
Author: Eric P. Nichols
Date: Feb 8, 2008.
Board class.
Board data:
1=white, -1=black, 0=empty
first dim is column , 2nd is row:
pieces[1][7] is the square in column 2,
at the opposite end of the board in row 8.
Squares are stored and manipulated as (x,y) tuples.
x is the column, y ... | JaimieMurdock/othello | othello/board.py | Python | mit | 7,039 |
# 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... | frreiss/tensorflow-fred | tensorflow/python/profiler/internal/run_metadata_test.py | Python | apache-2.0 | 8,923 |
# Author: Samuel Genheden samuel.genheden@gmail.com
"""
Classes to read and manipulate some Gromacs files
"""
import os
from . import geo
#
# Class to hold an AtomType record
#
class AtomType :
def __init__(self,record=None) :
self.name = ""
self.atnum = 0
self.mass = 0.0
self.charge = 0.0
se... | SGenheden/Scripts | sgenlib/gmx.py | Python | mit | 13,123 |
# Initialize App Engine and import the default settings (DB backend, etc.).
# If you want to use a different backend you have to remove all occurences
# of "djangoappengine" from this file.
from djangoappengine.settings_base import *
import os
# Activate django-dbindexer for the default database
DATABASES['native'] =... | feliperfranca/FelipeRFranca_site | settings.py | Python | bsd-3-clause | 2,443 |
"plot average NDCGs"
import cPickle as pickle
from collections import OrderedDict
from matplotlib import pyplot as plt
from os import listdir
from os.path import isfile, join
# minimum number of users we have scores for to average
min_users = 10
input_dir = 'ndcgs/'
# a list of input files
input_files = [ join( in... | zygmuntz/evaluating-recommenders | plot_ndcgs.py | Python | bsd-3-clause | 885 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | rjschwei/azure-sdk-for-python | azure-mgmt-network/azure/mgmt/network/models/application_gateway_frontend_ip_configuration.py | Python | mit | 3,023 |
from forum.models import User
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
from forms import ClassicRegisterForm
from forum.views.auth import login_and_forward
from forum.actions import UserJoinsAction
def register(reques... | CLLKazan/iCQA | qa-engine/forum_modules/localauth/views.py | Python | gpl-3.0 | 1,239 |
import os
DEBUG = os.getenv('DEBUG', True)
BASEDIR = os.path.abspath(os.path.dirname(__file__))
BOOTSTRAP_USE_MINIFIED = True
BOOTSTRAP_USE_CDN = FalseBOOTSTRAP_FONTAWESOME = True
SECRET_KEY = os.getenv('SECRET_KEY', 'devkey')
| nnja/twitter-coldshoulder | config.py | Python | mit | 231 |
## This file imports items from the wx package into the wxPython package for
## backwards compatibility. Some names will also have a 'wx' added on if
## that is how they used to be named in the old wxPython package.
import wx.lib.printout
__doc__ = wx.lib.printout.__doc__
PrintBase = wx.lib.printout.PrintBase
Prin... | 163gal/Time-Line | libs64/wxPython/lib/printout.py | Python | gpl-3.0 | 484 |
import wormtable as wt
if __name__ == "__main__":
wt.wtadmin_main()
| wormtable/wormtable | wtadmin_dev.py | Python | lgpl-3.0 | 73 |
# Copyright (C) 2013 Claudio Guarnieri.
# Copyright (C) 2014-2017 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from django.conf.urls import url
from cuckoo.web.controllers.submission.routes import SubmissionRoutes
from cu... | cuckoobox/cuckoo | cuckoo/web/submission/urls.py | Python | mit | 1,074 |
# Author: Jacob Kristhammar, 2010
#
# Updated version of websocket.py[1] that implements latest[2] stable version
# of the websocket protocol.
#
# NB. It's no longer possible to manually select which callback that should
# be invoked upon message reception. Instead you must override the
# on_message(message) me... | rwaldron/depthjs | old/backend/tornado/websocket.py | Python | agpl-3.0 | 10,030 |
from graph import Graph
graph = Graph()
graph.load()
graph.draw('me.png')
test_words = (
'set',
)
for word in test_words:
try:
print graph.partition(word)
except:
print "%s is not a word" % (word,)
| daniel-bulger/word-sense-disambiguator | disambiguator/woo.py | Python | mit | 230 |
from semisupervised.run import run
__all__ = ['run'] | mssalvador/WorkflowCleaning | semisupervised/__init__.py | Python | apache-2.0 | 53 |
# pandas and numpy for data manipulation
import pandas as pd
import numpy as np
import sqlite3
from bokeh.plotting import Figure
from bokeh.models import (
CategoricalColorMapper,
HoverTool,
ColumnDataSource,
Panel,
FuncTickFormatter,
SingleIntervalTicker,
LinearAxis,
)
from bokeh.models.wi... | murrayo/yape | yapesrv/scripts/mgstat_tab.py | Python | mit | 2,684 |
# -*- coding: utf-8 -*-
import os
import re
import shutil
keyword=['password','Password']
path=raw_input("Path")
for dirPath, dirNames, fileNames in os.walk(path):
for f in fileNames:
a=os.path.join(dirPath, f)
with open(a,'rU') as f3:
PathName=''
for c in f3.readlines():
for j in keyword:
if j in... | tomlai7866/Tool | APP scanner/Keyword search.py | Python | gpl-2.0 | 339 |
"""Low-level AMQP client for Python (fork of amqplib)"""
# Copyright (C) 2007-2008 Barry Pederson <bp@barryp.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of... | dallasmarlow/py-amqp | amqp/__init__.py | Python | lgpl-2.1 | 2,158 |
from fanstatic import Library, Resource
import js.jquery
library = Library('jquery.socialshareprivacy', 'resources')
css = Resource(library, 'socialshareprivacy/socialshareprivacy.css')
socialshareprivacy = Resource(library, 'jquery.socialshareprivacy.js',
minified='jquery.socialsharepr... | zerobuzz/js.socialshareprivacy | js/socialshareprivacy/__init__.py | Python | bsd-3-clause | 398 |
# coding: utf-8
#
# Copyright (C) 2014 Davit Samvelyan <davitsamvelyan@gmail.com>
#
# This file is part of ycmd.
#
# ycmd 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
# (... | volkhin/ycmd | ycmd/tests/filename_completer_test.py | Python | gpl-3.0 | 14,290 |
"""
Test API calls using the read replica.
"""
import copy
from django.test import TransactionTestCase
from submissions import api as sub_api
class ReadReplicaTest(TransactionTestCase):
""" Test queries that use the read replica. """
STUDENT_ITEM = {
"student_id": "test student",
"course_id":... | GbalsaC/bitnamiP | venv/src/edx-submissions/submissions/tests/test_read_replica.py | Python | agpl-3.0 | 2,871 |
"""Genetic Python Module
This module provides a very basic framework that can be used to implement
genetic algorithms.
Usage:
To use this module, import the GeneticAlgorithm class and define a subclass
with the genomeSize() and heuristic() functions declared as described
below.
For more information, consult th... | williamg/genetic | genetic.py | Python | mit | 7,159 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Unit tests for pyes. These require an es server with thrift plugin running on the default port (localhost:9500).
"""
import unittest
from pyes.tests import ESTestCase
class ClusterTestCase(ESTestCase):
def setUp(self):
super(ClusterTestCase, self).setUp()
... | dbbhattacharya/kitsune | vendor/packages/pyes/pyes/tests/cluster.py | Python | bsd-3-clause | 2,485 |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
import sys
import json
import numpy as np
from tqdm import tqdm
from collections import defaultdict
import torch
import torch.nn.functional as F
from torch.autograd import Variable
from dataset_sket... | judithfan/pix2svg | generative/tests/compare_test/sketch_only/rdm_sketch.py | Python | mit | 3,895 |
#
# Licensed to Intel Corporation under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# Intel Corporation licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this fi... | dding3/BigDL | dl/src/main/python/optim/optimizer.py | Python | apache-2.0 | 3,852 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets 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 appl... | tensorflow/datasets | tensorflow_datasets/image_classification/rock_paper_scissors_test.py | Python | apache-2.0 | 1,157 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.