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 |
|---|---|---|---|---|---|
# Copyright 2020 The FedLearner 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... | bytedance/fedlearner | fedlearner/common/metrics.py | Python | apache-2.0 | 8,599 |
"""Create a pseudo statistics to initialize HMM/GMM operating in latent space."""
import logging
import argparse
import glob
import importlib
import ast
import pickle
import numpy as np
import amdtk
# Logger.
logger = logging.getLogger('amdtk')
# Possible log-level.
LOG_LEVELS = {
'error': logging.ERROR,
... | amdtkdev/amdtk | recipe/utils/create_stats.py | Python | mit | 1,759 |
# -*- coding: utf-8 -*-
from docutils import nodes, utils
from docutils.parsers.rst import directives, roles, Directive
from pygments.formatters import HtmlFormatter
from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
import re
INLINESTYLES = False
DEFAULT = HtmlFormatter(noclasses=... | Natim/pelican | pelican/rstdirectives.py | Python | agpl-3.0 | 3,381 |
"""
This is the single point of entry to generate the sample configuration
file for Arias.
"""
import collections
from asciipic.config import base as conf_base
from asciipic.config import factory as conf_factory
def get_options():
"""Collect all the options info from the other modules."""
options = collecti... | micumatei/asciipic | asciipic/config/options.py | Python | mit | 643 |
# Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the... | kfox1111/horizon | openstack_dashboard/dashboards/admin/flavors/urls.py | Python | apache-2.0 | 1,302 |
#!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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... | electrumalt/electrum-doge | scripts/merchant/merchant.py | Python | gpl-3.0 | 9,336 |
from graphviz import Digraph
class Node:
def __init__(self, label, weight, comp3, comp5):
self.label = label
self.weight = weight
self.comp3 = comp3
self.comp5 = comp5
def increment(self, w):
self.weight+=w
def decrement(self, w):
self.weight-=w
if ... | AlgoLab/galig | scripts/SplicingGraph.py | Python | gpl-3.0 | 10,173 |
#!/usr/bin/env python
#
# test_moderna.py
#
# unit tests for moderna interface
#
# http://iimcb.genesilico.pl/moderna/
#
__author__ = "Magdalena Rother, Tomasz Puton, Kristian Rother"
__copyright__ = "Copyright 2008, The Moderna Project"
__credits__ = ["Janusz Bujnicki"]
__license__ = "GPL"
__maintainer__ = "Magdalena ... | lenarother/moderna | tests/test_commandline.py | Python | gpl-3.0 | 2,750 |
print (("#000000 "*7)+"\n")*7
| mungojelly/7by7grid | py/black.py | Python | cc0-1.0 | 30 |
# 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 ... | Azure/azure-sdk-for-python | sdk/graphrbac/azure-graphrbac/azure/graphrbac/models/domain_paged.py | Python | mit | 907 |
import os
import math
from collections import defaultdict
G = {}
with open(os.path.join(os.path.dirname(__file__), 'input.txt')) as f:
for line in f:
mats, outcome = line.strip().split('=>')
outcome = outcome.strip().split(' ')
mats = mats.strip().split(', ')
mats = [mat.split(' ') ... | marcosfede/algorithms | adventofcode/2019/d14/d14.py | Python | gpl-3.0 | 1,643 |
import threading
import time
def worker():
print (threading.currentThread().getName() + 'Starting')
time.sleep(2)
print (threading.currentThread().getName()+'Exiting')
def my_service():
print (threading.currentThread().getName()+ 'Starting')
time.sleep(3)
print (threading.currentThread().getNa... | mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.11 Multiprocessing and Threading/code/4_threading.py | Python | gpl-3.0 | 651 |
import _plotly_utils.basevalidators
class TextValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="text", parent_name="isosurface.colorbar.title", **kwargs
):
super(TextValidator, self).__init__(
plotly_name=plotly_name,
parent_name=... | plotly/python-api | packages/python/plotly/plotly/validators/isosurface/colorbar/title/_text.py | Python | mit | 464 |
from __future__ import unicode_literals
from datetime import date
from django import forms
from django.db.models import Max, Min
import django_filters
from django.utils.translation import ugettext as _
from core.models import Personnel, Position, Program, ProgramCategory, \
ProgramReport, StockReport, StockOutRep... | system7-open-source/imamd | imam/webapp/filters.py | Python | agpl-3.0 | 6,756 |
# Copyright 2008-2010 WebDriver committers
# Copyright 2008-2010 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... | akiellor/selenium | wire.py | Python | apache-2.0 | 58,502 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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 Licen... | hjoliver/cylc | tests/unit/scripts/test_config.py | Python | gpl-3.0 | 5,439 |
"""Support for the DOODS service."""
import io
import logging
import time
import voluptuous as vol
from PIL import Image, ImageDraw
from pydoods import PyDOODS
from homeassistant.const import CONF_TIMEOUT
from homeassistant.components.image_processing import (
CONF_CONFIDENCE,
CONF_ENTITY_ID,
CONF_NAME,
... | joopert/home-assistant | homeassistant/components/doods/image_processing.py | Python | apache-2.0 | 12,565 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Helper classes for twisted.test.test_ssl.
They are in a separate module so they will not prevent test_ssl importing if
pyOpenSSL is unavailable.
"""
from __future__ import division, absolute_import
from twisted.python.compat import nativeStr... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/src/twisted/test/ssl_helpers.py | Python | mit | 1,032 |
# -*- coding: utf-8 -*-
import copy
import shutil
from datetime import timedelta
from functools import wraps
from json import loads
from textwrap import dedent
from unittest import SkipTest
from uuid import uuid4
import ddt
import lxml.html
import mock
from django.conf import settings
from django.contrib.auth.models ... | pepeportela/edx-platform | cms/djangoapps/contentstore/tests/test_contentstore.py | Python | agpl-3.0 | 96,743 |
"""
Rainbow-shooter
========
{Rainbow-shooter long description}
{Link to binaries}
Features
--------
- item 1
- item 2
Development Version
-------------------
Link to git
"""
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='Rainbow_shoot... | gnud/rainbow-shooter | setup.py | Python | gpl-3.0 | 1,045 |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
from collections import Counter
class Solution(object):
def findFrequentTreeSum(self, root):
"""
:type root: TreeNode
:rtype: List[int]
"""
... | xiaonanln/myleetcode-python | src/508. Most Frequent Subtree Sum - 2.py | Python | apache-2.0 | 776 |
# -*- coding: utf-8 -*-
from BeautifulSoup import BeautifulSoup
from BeautifulSoup import BeautifulStoneSoup
import urllib2
import requests
import os
import sys
import re
import codecs
def htmlTodev(text):
def fixup(m):
text = m.group(0)
if text[:2] == "&#":
# character ... | sanskritiitd/sanskrit | merging/inria.py | Python | gpl-3.0 | 7,253 |
import unittest
class Solution:
def __init__(self):
self.candidates = None
self.num_candidates = 0
self.combination = []
self.result = []
def combinationSum2(self, candidates, target):
"""
:type candidates: List[int]
:type target: int
:rtype: Li... | chrisxue815/leetcode_python | problems/test_0040_backtrack.py | Python | unlicense | 1,493 |
# Spawn Group file created with PSWG Planetary Spawn Tool
import sys
from java.util import Vector
from services.spawn import DynamicSpawnGroup
from services.spawn import MobileTemplate
def addDynamicGroup(core):
dynamicGroup = DynamicSpawnGroup()
mobileTemplates = Vector()
mobileTemplates.add('hidden_daggers_activi... | agry/NGECore2 | scripts/mobiles/dynamicgroups/corellia_hidden_daggers.py | Python | lgpl-3.0 | 803 |
import django.contrib.sites.managers
import django.db.models.manager
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("sites", "0002_alter_domain_unique"),
("enhydris", "0109_remove_is_automatic"),
]
operations = [
migrations.AddFi... | openmeteo/enhydris | enhydris/migrations/0110_sites.py | Python | agpl-3.0 | 723 |
import unittest
import pickle
from monty.design_patterns import singleton, cached_class
class SingletonTest(unittest.TestCase):
def test_singleton(self):
@singleton
class A:
pass
a1 = A()
a2 = A()
self.assertEqual(id(a1), id(a2))
@cached_class
class A:
... | materialsvirtuallab/monty | tests/test_design_patterns.py | Python | mit | 949 |
"""
The Fibonacci sequence is defined using the following recursive formula:
F(0) = 0
F(1) = 1
F(M) = F(M - 1) + F(M - 2) if M >= 2
A small frog wants to get to the other side of a river.
The frog is initially located at one bank of the river (position −1)
and wants to get to the other bank (position N).
T... | Dineshkarthik/codility_training | Lesson 13 - Fibonacci numbers/fib_frog.py | Python | gpl-3.0 | 3,640 |
# Copyright 2013 - Noorul Islam K M
#
# 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 w... | openstack/python-solumclient | solumclient/common/auth.py | Python | apache-2.0 | 9,330 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class SaleConfiguration(models.TransientModel):
_inherit = 'sale.config.settings'
security_lead = fields.Float(related='company_id.security_lead', string="Sales Safety Days... | chienlieu2017/it_management | odoo/addons/sale_stock/models/sale_config_settings.py | Python | gpl-3.0 | 2,165 |
__author__ = 'sarangis'
class IllegalArgumentException(ValueError):
pass
class InvalidTypeException(ValueError):
pass
class InvalidInsertionPointException(ValueError):
pass
class InvalidInstructionException(ValueError):
pass
class NoBBTerminatorException(ValueError):
pass
class InvalidUsageMo... | ssarangi/spiderjit | src/ir/exceptions.py | Python | mit | 396 |
import doctest
doctest.testfile('api_examples.txt')
| dtcooper/python-fitparse | tests/doctests.py | Python | mit | 53 |
#!/usr/env/python
from __future__ import division, print_function
## Import General Tools
import sys
import os
import argparse
import logging
import subprocess
import datetime
import pytz
import ephem
##-------------------------------------------------------------------------
## Define Camera Class
##--------------... | joshwalawender/RasPiProjects | DSLR_Control.py | Python | bsd-2-clause | 11,902 |
"""
This class interfaces with the Student Web Service, Term resource.
"""
import logging
from datetime import datetime
from restclients.sws import get_resource, QUARTER_SEQ, get_current_sws_version, parse_sws_date
from restclients.models.sws import Term as TermModel
from restclients.exceptions import DataFailureExcept... | uw-it-cte/uw-restclients | restclients/sws/v5/term.py | Python | apache-2.0 | 6,171 |
import numpy as np
from numba import cuda, float32
from numba.cuda.testing import CUDATestCase
import unittest
class TestFastMathOption(CUDATestCase):
def test_kernel(self):
def foo(arr, val):
i = cuda.grid(1)
if i < arr.size:
arr[i] = float32(i) / val
fa... | sklam/numba | numba/cuda/tests/cudapy/test_fastmath.py | Python | bsd-2-clause | 1,178 |
# -*- coding: utf-8 -*-
"""
Emotiv acquisition :
Reverse engineering and original crack code written by
Cody Brocious (http://github.com/daeken)
Kyle Machulis (http://github.com/qdot)
Many thanks for their contribution.
Need python-crypto.
"""
import multiprocessing as mp
import numpy as np
import msgpack... | Hemisphere-Project/Telemir-DatabitMe | Telemir-EEG/pyacq/pyacq/core/devices/emotiv.py | Python | gpl-2.0 | 12,623 |
#!/usr/bin/env python
# coding=utf-8
import tornado.web
class BaseHandler(tornado.web.RequestHandler):
def __init__(self, *argc, **argkw):
super(BaseHandler, self).__init__(*argc, **argkw)
self.jinja2 = self.setting.get("jinja2")
@property
def db(self):
return self.application.db
@property
def user_model... | yiyangyi/cc98-tornado | handler/base.py | Python | mit | 1,656 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('app', '0025_auto_20150923_0843'),
]
operations = [
migrations.CreateMo... | XcomConvent/xcom40k-shades | xcom40k/app/migrations/0026_auto_20120106_2212.py | Python | apache-2.0 | 1,819 |
#***************************************************************************
#* *
#* Copyright (c) 2011, 2012 *
#* Jose Luis Cercos Pita <[email protected]> *
#* ... | yantrabuddhi/FreeCAD | src/Mod/Plot/InitGui.py | Python | lgpl-2.1 | 2,920 |
# coding=utf-8
# pylint: disable-msg=E1101,W0612
from collections import OrderedDict
from datetime import datetime, timedelta
import numpy as np
from numpy import nan
import numpy.ma as ma
import pytest
from pandas._libs import lib
from pandas._libs.tslib import iNaT
from pandas.compat import PY36, long, lrange, ran... | harisbal/pandas | pandas/tests/series/test_constructors.py | Python | bsd-3-clause | 44,946 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-11-15 17:45
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ovp_projects', '0011_auto_20161115_1744'),
]
operations = [
migrations.RenameModel(... | OpenVolunteeringPlatform/django-ovp-projects | ovp_projects/migrations/0012_auto_20161115_1745.py | Python | agpl-3.0 | 405 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This file is part of XBMC Mega Pack Addon.
Copyright (C) 2014 Wolverine ([email protected])
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 Softwar... | xbmcmegapack/plugin.video.megapack.dev | resources/lib/menus/home_languages_slovenian.py | Python | gpl-3.0 | 1,115 |
# Copyright (C) 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | fedora-copr/dnf-plugins-core | tests/test_download.py | Python | gpl-2.0 | 15,115 |
try:
import pymysql
pymysql.install_as_MySQLdb()
except ImportError:
pass
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "montasola.settings")
from django.core.management import execute_from_command_line
execute_from_comm... | mlvander/montasola | manage.py | Python | mit | 339 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# --- BEGIN_HEADER ---
#
# cp - [insert a few words of module description on this line]
# Copyright (C) 2003-2009 The MiG Project lead by Brian Vinter
#
# This file is part of MiG.
#
# MiG is free software: you can redistribute it and/or modify
# it under the terms of the GN... | heromod/migrid | mig/cgi-bin/cp.py | Python | gpl-2.0 | 1,092 |
import json
from django.http import HttpResponse
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from apps.exercises.models import Attempts
from apps.maps.models import Graphs
from apps.ki.utils import performInference
from apps.research.utils import getParticipantByUID, st... | danallan/octal-application | server/apps/ki/views.py | Python | gpl-3.0 | 1,125 |
import base64
import hashlib
import heapq
import itertools
import os
import re
import string
from itertools import zip_longest
from time import sleep
from typing import Any, Callable, Iterator, List, Optional, Sequence, Set, Tuple, TypeVar
from django.conf import settings
T = TypeVar('T')
def statsd_key(val: Any, cl... | brainwane/zulip | zerver/lib/utils.py | Python | apache-2.0 | 6,519 |
#####################################################################
# -*- coding: iso-8859-1 -*- #
# #
# Frets on Fire #
# Copyright (C) 2006 Sami Kyöstilä ... | mdsitton/fofix | fofix/core/Audio.py | Python | gpl-2.0 | 7,008 |
# Copyright 2014: Mirantis 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 b... | aplanas/rally | rally/plugins/openstack/context/cleanup/resources.py | Python | apache-2.0 | 18,435 |
import os
import sublime
from sublime_plugin import WindowCommand, TextCommand
from ..git_command import GitCommand
from ...common import util
COMMIT_HELP_TEXT_EXTRA = """
## You may also reference or close a GitHub issue with this commit. To do so,
## type `#` followed by the `tab` key. You will be shown a list ... | jmanuel1/GitSavvy | core/commands/commit.py | Python | mit | 7,089 |
#!/usr/bin/env python3
# -*- coding : utf-8 -*-
def fact1(n): # equals to n * n-1 * n-2 * .....* 3 * 2 * 1
if n == 1:
return 1
return n * fact1(n - 1)
# input int could be small , because of avoiding stack overflow.
# tail-recursive func , to avoid overflowing
def fact2(n):
return fact2_iter(... | kmahyyg/learn_py3 | usage/recursive_func.py | Python | agpl-3.0 | 532 |
# -*- coding: utf-8 -*-
from util_graph import *
if __name__ == '__main__':
get_shortest_path('./data/graph/graph.dat', './data/graph/CC.csv')
| lifei96/Medium-crawler-with-data-analyzer | User_Crawler/get_shortest_path.py | Python | mit | 150 |
"""add item system lookup tables
Revision ID: 274d3d938628
Revises: 9b1f868a7343
Create Date: 2017-07-26 21:28:41.772392
Copyright (c) 2016-2017 Tony Lechner and contributors
testrattingcapitals.com is free software: you can redistribute it and/or
modify it under the terms of the GNU Affero General Public Lice... | tonymke/testrattingcapitals.com | server/migrations/versions/274d3d938628_add_item_system_lookup_tables.py | Python | agpl-3.0 | 3,264 |
"""
.. _ex-time-freq-global-field-power:
===========================================================
Explore event-related dynamics for specific frequency bands
===========================================================
The objective is to show you how to explore spectrally localized
effects. For this purpose we ada... | mne-tools/mne-tools.github.io | 0.20/_downloads/2a0dcf3becdbea26da3b5a186ec2924a/plot_time_frequency_global_field_power.py | Python | bsd-3-clause | 5,686 |
# -*- coding: utf-8 -*-
from nbx.utils.format import moneyfmt, timeago
def dateformat_filter(date, format='%d/%m/%Y'):
if date:
return date.strftime(format)
return ''
def timeago_filter(date):
if date:
return timeago(date)
return ''
def moneyfmt_filter(value, places=2, curr='', sep='... | coyotevz/nbx | nbx/jinjafilters.py | Python | gpl-3.0 | 540 |
#!/usr/bin/env python3
import asyncio
import multiprocessing
import functools
import vulners
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor
vulners_api = vulners.Vulners(api_key="YOUR_API_KEY_HERE")
loop = asyncio.get_event_loop()
# pool = ProcessPoolExecutor(max_workers=multiprocessing.cpu_... | vulnersCom/api | samples/asyncio_example.py | Python | gpl-3.0 | 1,150 |
if hasattr(context, 'portal_type') and context.portal_type == 'FormSaveData2ContentEntry':
return context.getValue('infective-larvae-1000-l3-request-limit-5-shipments-year')
else:
return None
| uwosh/uwosh.filariasis | uwosh/filariasis/skins/uwosh.filariasis/getDIInfectiveLarvae.py | Python | gpl-2.0 | 196 |
# Copyright (c) 2014 Ignacio Rodriguez <[email protected]>
# 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 ... | i5o/sugar-gdrive | extensions/webservice/sugargdrive/account.py | Python | gpl-3.0 | 13,236 |
import numpy as np
import matplotlib.pyplot as plt
import h5py
from sklearn import svm
file1='artificial_data.h5'
########### cargar datos de entrenamiento y datos de prueba###########
hf = h5py.File(file1, "r")
X1 = np.array(hf.get('X1')); Y1=np.array(hf.get('lab1'));
X2 = np.array(hf.get('X2')); Y2=np.array(hf.get(... | miltonsarria/dsp-python | examples_classify/ex1_select_classifier.py | Python | mit | 1,319 |
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
import os
from django.conf.urls.defaults import *
import rapidsms.contrib.scheduler.views as views
urlpatterns = patterns('',
url(r'^scheduler/$', views.index, name="scheduler"),
url(r'^scheduler/(?P<pk>\d+)/$', views.edit),
)
| rapidsms/rapidsms-contrib-apps-dev | scheduler/urls.py | Python | bsd-3-clause | 303 |
import fileinput
import string
import sys
import os
# BGP
#fortran_compiler = '/bgsys/drivers/ppcfloor/comm/bin/mpixlf77_r'
#fortran_opt_flags = '-O5 -qhot -qprefetch -qcache=auto -qalign=4k -qunroll=yes -qmaxmem=-1 -qalias=noaryovrlp:nopteovrlp -qnoextname -qnosmp -qreport=hotlist -c'
#src_dir = '/gpfs/home/jhammond/... | jeffhammond/spaghetty | branches/spaghetty3/python/archive/generate_source_new_unrolling.py | Python | bsd-2-clause | 5,442 |
def percDown(self,i):
while (i * 2) <= self.currentSize:
mc = self.minChild(i)
if self.heapList[i] > self.heapList[mc]:
tmp = self.heapList[i]
self.heapList[i] = self.heapList[mc]
self.heapList[mc] = tmp
i = mc
def minChild(self,i):
if i * 2 + 1 > sel... | robin1885/algorithms-exercises-using-python | source-code-from-author-book/Listings-for-Second-Edition/listing_6_20.py | Python | mit | 488 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2017
# Leandro Toledo de Souza <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | thonkify/thonkify | src/lib/telegram/version.py | Python | mit | 832 |
#
# 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
# ... | HybridF5/jacket | jacket/api/storage/contrib/volume_type_access.py | Python | apache-2.0 | 8,349 |
# encoding: utf-8
# module _dbm
# from /usr/lib/python3.4/lib-dynload/_dbm.cpython-34m-x86_64-linux-gnu.so
# by generator 1.135
# no doc
# no imports
# Variables with simple values
library = 'Berkeley DB'
# functions
def open(*args, **kwargs): # real signature unknown
"""
Return a database object.
... | ProfessorX/Config | .PyCharm30/system/python_stubs/-1247971765/_dbm.py | Python | gpl-2.0 | 998 |
# Copyright 2018 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... | kevin-coder/tensorflow-fork | tensorflow/python/distribute/cross_device_ops.py | Python | apache-2.0 | 47,651 |
"""!
@package psmap_dialogs.py
@brief Map feature objects and dialogs for ps.map
Classes:
- UnitConversion
- TCValidator
- PenStyleComboBox
- CheckListCtrl
- Instruction
- InstructionObject
- InitMap
- MapFrame
- PageSetup
- Mapinfo
- Text
- Scalebar
- RasterLegend
- VectorLegend
- Raster
- Vector
- ... | AsherBond/MondocosmOS | grass_trunk/gui/wxpython/gui_modules/psmap_dialogs.py | Python | agpl-3.0 | 275,095 |
from jsonrpc import ServiceProxy
import sys
import string
# ===== BEGIN USER SETTINGS =====
# if you do not set these you will be prompted for a password for every command
rpcuser = ""
rpcpass = ""
# ====== END USER SETTINGS ======
if rpcpass == "":
access = ServiceProxy("http://127.0.0.1:5888")
else:
access = Ser... | chrisfranko/aiden | contrib/bitrpc/bitrpc.py | Python | mit | 7,834 |
#python
import k3d
import testing
setup = testing.setup_mesh_modifier_test("PolyCube", "RotatePoints")
selection = k3d.geometry.selection.create(0)
selection.points = k3d.geometry.point_selection.create(selection, 1)
setup.modifier.mesh_selection = selection
setup.modifier.z = 1.0
testing.require_valid_mesh(setup... | barche/k3d | tests/mesh/mesh.modifier.RotatePoints.py | Python | gpl-2.0 | 498 |
#!/usr/bin/env python
import sys
import subprocess
import os
import re
import shutil
def obj_list_gen():
if os.path.exists('obj_list.map'):
os.remove('obj_list.map')
file=open('obj_list.map', 'w')
parse_file=open('image/ram_size.txt', 'r')
all_lines = parse_file.readlines()
for line in all_lines:
item = fi... | sunghan-chang/TizenRT | build/tools/amebad/gnu_utility/code_analyze.py | Python | apache-2.0 | 15,949 |
from django.apps import AppConfig
from django.contrib.admin.checks import check_admin_app
from django.core import checks
from django.utils.translation import ugettext_lazy as _
class SimpleAdminConfig(AppConfig):
"""Simple AppConfig which does not do automatic discovery."""
name = 'fact_book'
verbose_nam... | obitec/django-factbook | fact_book/apps.py | Python | apache-2.0 | 633 |
from moto.core.responses import BaseResponse
class ReservedInstances(BaseResponse):
def cancel_reserved_instances_listing(self):
if self.is_not_dryrun("CancelReservedInstances"):
raise NotImplementedError(
"ReservedInstances.cancel_reserved_instances_listing is not yet implemen... | spulec/moto | moto/ec2/responses/reserved_instances.py | Python | apache-2.0 | 1,409 |
import sys
from django.db.backends.base.creation import BaseDatabaseCreation
class DatabaseCreation(BaseDatabaseCreation):
def sql_table_creation_suffix(self):
test_settings = self.connection.settings_dict['TEST']
assert test_settings['COLLATION'] is None, (
"PostgreSQL doe... | yephper/django | django/db/backends/postgresql/creation.py | Python | bsd-3-clause | 1,912 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-03-09 19:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('drives', '0010_linking_up_new_foreignkeys'),
]
operations = [
migrations.RemoveField... | rohankapoorcom/drivetracker | drivetracker/drives/migrations/0011_rename_foreign_keys_new_models.py | Python | mit | 1,052 |
"""Provides the TotalDict class."""
class TotalDict(dict):
"""Track the total value of all dictionary keys."""
def __init__(self):
dict.__init__(self)
self.total = 0
def __setitem__(self, key, value):
prev_value = self[key] if key in self else 0
dict.__setitem__(self, key... | ConstantineLignos/constantinelignos.github.io | pybootcamp/examples/totaldict.py | Python | gpl-3.0 | 370 |
# 6.00x Problem Set 4A Template
#
# The 6.00 Word Game
# Created by: Kevin Luu <luuk> and Jenna Wiens <jwiens>
# Modified by: Sarina Canelake <sarina>
#
import random
import string
import os
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
HAND_SIZE = 13
SCRABBLE_LETTER_VALUES = {
'a': 1, 'b': 3, 'c': 3, 'd... | arielisidro/myprograms | python/6.00.1x Files/ps4/ps4a.py | Python | gpl-2.0 | 9,787 |
# This Python file uses the following encoding: utf-8
""" Subject line.
Main text.
"""
from unittest import TestCase
from classes.Index import index_for
from classes.Variable import Variable
__author__ = 'Chao Li'
class TestIndexFor(TestCase):
def setUp(self):
self.A = Variable(1, "A", ['a1', 'a2', 'a... | chaoli314/openbn | classes/test_indexFor.py | Python | apache-2.0 | 1,236 |
# Django settings for {{ project_name }} project.
import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', '[email protected]'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postg... | IlianIliev/django-for-prototyping | prototyping_template/project_name/settings.py | Python | bsd-3-clause | 5,878 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.surface_construction_elements import WindowMaterialSimpleGlazingSystem
log = logging.getLogger(__name__)
class TestWindowMaterialSimpleGlazingSystem(unittest.TestCase):
def... | rbuffat/pyidf | tests/test_windowmaterialsimpleglazingsystem.py | Python | apache-2.0 | 1,672 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 UNINETT AS
#
# This file is part of Network Administration Visualized (NAV).
#
# NAV is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# This progr... | alexanderfefelov/nav | python/nav/web/ipdevinfo/urls.py | Python | gpl-2.0 | 3,082 |
"""
sphinx.testing
~~~~~~~~~~~~~~
Sphinx test utilities
You can require sphinx.testing pytest fixtures in a test module or a conftest
file like this:
pytest_plugins = 'sphinx.testing.fixtures'
:copyright: Copyright 2007-2019 by the Sphinx team, see AUTHORS.
:license: BSD, see LICE... | lmregus/Portfolio | python/design_patterns/env/lib/python3.7/site-packages/sphinx/testing/__init__.py | Python | mit | 341 |
# Copyright 2009 Christopher Czyzewski
# This file is part of Project Mage.
#
# Project Mage 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) a... | Wopple/Mage | chapterNameScreen_v.py | Python | gpl-3.0 | 1,164 |
#!/usr/bin/env python
"""
.. module:: robotplus.py
.. moduleauthor:: Zoltan Siki
Sample application to nod by the totalstation
"""
from sys import argv, path
path.append('../pyapi/')
from angle import Angle
from leicatca1800 import LeicaTCA1800
from serialiface import SerialIface
from totalstation import TotalSta... | zsiki/ulyxes | pyapps/yesno.py | Python | gpl-2.0 | 729 |
#!/usr/bin/python3
# do pairwise essential matrix solve and back out relative poses. Then look
# at relative ned heading vs. pose/essential/match heading and estimate a
# yaw error. This can be fed back into the smart matcher to improve it's
# results (hopefully.)
# Assuming images are taking looking straight down,... | UASLab/ImageAnalysis | scripts/sandbox/match-yaw1.py | Python | mit | 4,737 |
import tensorflow as tf
import numpy as np
# Load in mnist dataset using one_hot
from tensorflow.examples.tutorials.mnist import input_data
data = input_data.read_data_sets("data/MNIST/", one_hot=True)
# Get basic information about dataset
print("Training Size:\t\t{}".format(len(data.train.labels)))
print("Test Size... | j-crowe/digit_recognizer | single_layer.py | Python | mit | 2,793 |
"""The tests for Core components."""
# pylint: disable=protected-access
import asyncio
import unittest
from unittest.mock import Mock, patch
import pytest
import voluptuous as vol
import yaml
from homeassistant import config
import homeassistant.components as comps
from homeassistant.components.homeassistant import (... | partofthething/home-assistant | tests/components/homeassistant/test_init.py | Python | apache-2.0 | 12,669 |
#!/usr/bin/python
# Copyright (C) 2014 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | Saulis/gerrit | tools/version.py | Python | apache-2.0 | 1,665 |
import sys, re
from setuptools import setup
from setuptools.command.test import test as TestCommand
PYTHON3 = (sys.version_info >= (3, 0))
if PYTHON3:
trepan_version ='trepan3k'
else:
trepan_version = 'trepan2'
class PyTest(TestCommand):
"""
Overrides setup "test" command, taken from here:
http://... | rocky/pytest-trepan | setup.py | Python | lgpl-3.0 | 2,184 |
from pylons import c
from formencode import validators as fev
from formencode import All
import formencode
from bson import ObjectId
import ew as ew_core
import ew.jinja2_ew as ew
from allura.lib.widgets import forms as ff
from allura.lib.widgets import form_fields as ffw
from allura.lib import helpers as h
from forg... | Bitergia/allura | ForgeDiscussion/forgediscussion/widgets/admin.py | Python | apache-2.0 | 2,818 |
#
# 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 "License"); you may not us... | wtanaka/beam | sdks/python/apache_beam/internal/gcp/auth.py | Python | apache-2.0 | 4,582 |
"""Tests for distutils.pypirc.pypirc."""
import sys
import os
import unittest
import tempfile
from distutils.core import PyPIRCCommand
from distutils.core import Distribution
from distutils.log import set_threshold
from distutils.log import WARN
from distutils.tests import support
from test.support import run_unittes... | invisiblek/python-for-android | python3-alpha/python3-src/Lib/distutils/tests/test_config.py | Python | apache-2.0 | 3,149 |
# 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 may not use this file ex... | vmanoria/bluemix-hue-filebrowser | hue-3.8.1-bluemix/desktop/libs/liboozie/setup.py | Python | gpl-2.0 | 1,293 |
from flask import jsonify
from app.exceptions import ValidationError
from . import api
def bad_request(message):
response = jsonify({'error': 'bad request', 'message': message})
response.status_code = 400
return response
def unauthorized(message):
response = jsonify({'error': 'unauthorized', 'message': mess... | SteveClement/IPRangeMess | app/api_1_0/errors.py | Python | gpl-3.0 | 605 |
from django.conf import settings
from django.contrib.auth.forms import AuthenticationForm
from django.core.urlresolvers import reverse
from django.db.models import Count
from django.http import Http404, HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render
from django.views... | PrincessTeruko/TsunArt | posts/views.py | Python | mit | 1,114 |
import numpy
import math
from datetime import datetime
from datetime import timedelta
from copy import copy
def load_rating_file(file_path, time_format="%Y-%m-%d"):
ratings = []
with open(file_path,"r") as f:
for line in f.readlines():
rating = line.rstrip().split(",")
rating[0] = int(rating[0])... | JalexChang/cross-media-attribution | src/mta/utility.py | Python | bsd-2-clause | 1,643 |
# -*- coding: utf-8 -*-
"""
pygments.styles.perldoc
~~~~~~~~~~~~~~~~~~~~~~~
Style similar to the style used in the `perldoc`_ code blocks.
.. _perldoc: http://perldoc.perl.org/
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from... | hacksterio/pygments.rb | vendor/pygments-main/pygments/styles/perldoc.py | Python | mit | 2,175 |
#! /usr/bin/env python
# -*- coding:utf-8 -*-
# Time-stamp: <2012-09-22 15:38 [email protected]>
import pygame, random
pygame.init()
screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
pygame.mouse.set_visible(False)
r = screen.get_rect()
W, H = r.width, r.height
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
... | chrplr/AIP2015 | resources/python-scripts/simple-detection.py | Python | gpl-2.0 | 1,355 |
# -*- coding: utf-8 -*-
# © 2016 Andrea Cometa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import distinta_qweb
| linkitspa/l10n-italy | l10n_it_ricevute_bancarie/report/__init__.py | Python | agpl-3.0 | 141 |
#!/usr/bin/env python
from fabric.api import local, require, settings, task
from fabric.state import env
from termcolor import colored
import app_config
# Other fabfiles
import assets
import data
import issues
import render
import text
import utils
if app_config.DEPLOY_TO_SERVERS:
import servers
if app_config.... | onyxfish/pixelcite | fabfile/__init__.py | Python | mit | 5,020 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Hotel.notes'
db.add_column(u'rsvp_hotel', 'notes',
self.gf('django.db.... | gboone/wedding.harmsboone.org | rsvp/migrations/0015_auto__add_field_hotel_notes.py | Python | mit | 5,269 |
# coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"update" is een SQL-expressie zoals "field1=\'newvalue\'". U kunt de resultaten van een JOIN niet updaten of wissen',
'%Y-%m-%d': '%Y-%m-%d',
'%Y-%m-%d %H:%M:%S': '%Y-%m-%d %H:%M:%S'... | danisuke0781/instant-press | languages/nl.py | Python | gpl-2.0 | 14,840 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.