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 |
|---|---|---|---|---|---|
"""Tests for the GogoGate2 component."""
from datetime import timedelta
from unittest.mock import MagicMock, patch
from ismartgate import GogoGate2Api, ISmartGateApi
from ismartgate.common import (
DoorMode,
DoorStatus,
GogoGate2ActivateResponse,
GogoGate2Door,
GogoGate2InfoResponse,
Network,
... | jawilson/home-assistant | tests/components/gogogate2/test_cover.py | Python | apache-2.0 | 12,506 |
from flask import render_template
from flask_cors import cross_origin
def setup(app):
@app.route('/graphs/bar_animated')
@app.route('/graphs/bar_animated/')
@app.route('/graphs/bar_animated.html')
@app.route('/graphs/bar_animated.html/')
@cross_origin()
def graphs__bar_animated():
"""
... | pwentrys/app_factory | exts/graphs.py | Python | mit | 20,337 |
# -*- coding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2016 Rooms For (Hong Kong) Limited T/A OSCG
# <https://www.odoo-asia.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# publishe... | yostashiro/awo-custom | account_invoice_cancel_purchase_line_update/__openerp__.py | Python | lgpl-3.0 | 1,466 |
#!/usr/bin/python
"""This script run the pathologic """
try:
import copy, optparse, sys, re, csv, traceback
from os import path, _exit, rename
import logging.handlers
from glob import glob
import multiprocessing
from libs.python_modules.utils.errorcodes import *
from libs.python_modules.utils.sy... | kishori82/MetaPathways_Python.3.0 | libs/python_scripts/MetaPathways_rpkm.py | Python | mit | 16,444 |
"""
Copyright 2017 Hugo Berg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writ... | Drummersbrother/rocket-snake | rocket_snake/basic_requests.py | Python | apache-2.0 | 11,338 |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
urlpatterns = patterns('',
url(r'^', include('social_auth.urls')... | YakindanEgitim/nar | nar/urls.py | Python | gpl-3.0 | 645 |
import pytz
import urllib
from datetime import datetime
from pupa.scrape import Scraper, Bill, VoteEvent
from openstates.utils import LXMLMixin
TIMEZONE = pytz.timezone("US/Central")
VOTE_TYPE_MAP = {"yes": "yes", "no": "no"}
class NEBillScraper(Scraper, LXMLMixin):
def scrape(self, session=None):
if ... | openstates/openstates | openstates/ne/bills.py | Python | gpl-3.0 | 10,305 |
# -*- coding: utf-8 -*-
import unittest
from scrapy.http import Request, FormRequest
from scrapy.spiders import Spider
from scrapy.utils.reqser import request_to_dict, request_from_dict
class RequestSerializationTest(unittest.TestCase):
def setUp(self):
self.spider = TestSpider()
def test_basic(sel... | rolando-contrib/scrapy | tests/test_utils_reqser.py | Python | bsd-3-clause | 3,161 |
"""
Бывают разные числа.
Вот по основанию 2: 100101010111110101101
Вот по основанию 8: 234543253452345233253
Вот по основанию 10: 1234567890
Вот по основанию 16: 450bad054
А я придумал числа по основанию 5000: 䉘䗵㷺䁡㹿㚴
А потом числа по основанию 20000: 乂蚌烘鎑諤靆
"""
import sys
from time import sleep
from random i... | sheerluck/andrew | chinacode/counter.py | Python | gpl-3.0 | 1,177 |
#!/usr/bin/env python
__all__ = ['magisto_download']
from ..common import *
def magisto_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
html = get_html(url)
title1 = r1(r'<meta name="twitter:title" content="([^"]*)"', html)
title2 = r1(r'<meta name="twitter:description" content="([... | betaY/crawler | you-get-master/src/you_get/extractors/magisto.py | Python | mit | 800 |
"""
SleekXMPP: The Sleek XMPP Library
Copyright (C) 2010 Nathanael C. Fritz
This file is part of SleekXMPP.
See the file LICENSE for copying permission.
"""
from __future__ import with_statement, unicode_literals
import sys
import copy
import logging
import sleekxmpp
from sleekxmpp import plugins
... | skinkie/SleekXMPP--XEP-0080- | sleekxmpp/basexmpp.py | Python | mit | 22,953 |
#!/usr/bin/env python
"""
backports git tracker
=======================
The idea here is to put the backported drivers/etc. into a git tree
that follows the input git tree, for example wireless-testing or the
Linux upstream tree. This can then be used by end users who prefer
git over downloading tarballs, or develope... | mcgrof/backports | devel/git-tracker.py | Python | gpl-2.0 | 11,154 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from babel.dates import format_date
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
import json
from odoo import api, fields, models, _
from odoo.exceptions import UserError
from od... | Aravinthu/odoo | addons/sales_team/models/crm_team.py | Python | agpl-3.0 | 14,303 |
"""
flask handler for all capacity API requests for dubweb
"""
from flask import request
from app import app
import app.raxutils as raxutils
import app.capdb as capdb
@app.route('/data/rackspace/host_check')
def cloud_host_check():
""" API for Rackspace VM overload check """
mydc = request.args.get('dc')
... | zulily/dubweb | app/cap_apis.py | Python | apache-2.0 | 1,717 |
import json
import os
import codecs
class StreamOutputError(Exception):
pass
def stream_output(output, stream):
is_terminal = hasattr(stream, 'fileno') and os.isatty(stream.fileno())
stream = codecs.getwriter('utf-8')(stream)
all_events = []
lines = {}
diff = 0
for chunk in output:
... | acaranta/fig | fig/progress_stream.py | Python | apache-2.0 | 2,264 |
import ujson
from zerver.lib.actions import do_add_alert_words, do_remove_alert_words
from zerver.lib.alert_words import alert_words_in_realm, user_alert_words
from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import most_recent_message, most_recent_usermessage
from zerver.models import Us... | timabbott/zulip | zerver/tests/test_alert_words.py | Python | apache-2.0 | 9,184 |
'''
functions for reading / writing SAM/BAM files
'''
import os
from rjv.fileio import *
newline = '\n'
#required fields
samspec = \
[
('qname',str,'query template name'),
('flag',int,'bitfield of flags'),
('rname',str,'reference sequence name'),
('pos',int,'1-based left most mapping position'),
... | robertvi/rjv | sam.py | Python | gpl-2.0 | 6,319 |
from flask import request
from .gzip import Gzip
from .deflate import Deflate
class ContentEncoder(object):
def __init__(self, app, *args, **kwargs):
if app:
self.init_app(app, *args, **kwargs)
def init_app(self, app, content_type_blacklist=None, encoders=[Gzip(), Deflate()]):
sel... | allanlei/flask-content-encoding | flask_contentencoding/__init__.py | Python | bsd-3-clause | 1,195 |
import os
import json
from django.conf import settings
from django.core.management.base import BaseCommand
from django.contrib.auth.models import Group, Permission
class Command(BaseCommand):
args = '#'
help = """Command to populate the Groups permissions (check ibc/static/jsons/groups_permissions.json),
... | sauli6692/ibc-server | core/management/commands/groups_permissions.py | Python | mit | 1,203 |
class AlarmState:
"""Helper class for alarm state functionality."""
@staticmethod
def get_initial_alarm_state(maxZones, maxPartitions):
"""Builds the proper alarm state collection."""
_alarmState = {'partition': {}, 'zone': {}}
for i in range(1, maxPartitions + 1):
_al... | jnimmo/pyenvisalink | pyenvisalink/alarm_state.py | Python | mit | 1,289 |
from __future__ import absolute_import
from mock import call, patch
from freight.config import celery, db
from freight.models import TaskStatus
from freight.notifiers import NotifierEvent, queue
from freight.notifiers.dummy import DummyNotifier
from freight.testutils import TransactionTestCase
def maybe_pop(collect... | klynton/freight | tests/tasks/test_send_pending_notifications.py | Python | apache-2.0 | 1,420 |
#!/usr/bin/env python
# This is simple script that can be used to fixup a library (dylib or so)
# Usage:
# ./fixup_plugin.py <full path to lib to fix or dir with libraries to fix> "key=val" ["key=val" ...]
# This is simply replaces any referece to 'key' with 'val' in the libraries referred to
# by the plugin lib to f... | Sprunth/RGG | superbuild/Projects/apple/fixup_plugin.py | Python | bsd-3-clause | 2,021 |
#
# This file is part of Gruvi. Gruvi is free software available under the
# terms of the MIT license. See the file "LICENSE" that was provided
# together with this source file for the licensing terms.
#
# Copyright (c) 2012-2014 the Gruvi authors. See the file "AUTHORS" for a
# complete list.
from __future__ import a... | swegener/gruvi | runtests.py | Python | mit | 2,220 |
# Copyright (c) 2011-2021, wradlib developers.
# Distributed under the MIT License. See LICENSE.txt for more info.
# flake8: noqa
"""
wradlib_tests
=============
"""
import contextlib
import io
import os
import pytest
from packaging.version import Version
from xarray import __version__ as xr_version
from wradlib imp... | wradlib/wradlib | wradlib/tests/__init__.py | Python | mit | 2,932 |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from flask import session
from indico.core import signals
from i... | mvidalgarcia/indico | indico/modules/announcement/__init__.py | Python | mit | 1,129 |
import numpy
from chainer import link
from chainer.functions.activation import sigmoid
from chainer.functions.activation import tanh
from chainer.functions.array import concat
from chainer.functions.array import split_axis
from chainer.functions.rnn import tree_lstm
from chainer.links.connection import linear
class ... | okuta/chainer | chainer/links/rnn/tree_lstm.py | Python | mit | 9,745 |
"""Utilities for asyncio-friendly file handling."""
from .threadpool import open
from . import tempfile
__all__ = ["open", "tempfile"]
| Tinche/aiofiles | src/aiofiles/__init__.py | Python | apache-2.0 | 136 |
import datetime
import os
import shutil
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.linear_model import SGDClassifier
from sklearn.pipeline import Pipeline
from django.shortcuts imp... | abhipec/pec | emailApp/emailApp/views.py | Python | mit | 8,880 |
from .FuncDef import FuncDef
class FuncTable:
"""Store a function table"""
def __init__(self, base_name, is_device=False):
self.funcs = []
self.base_name = base_name
self.bias_map = {}
self.name_map = {}
self.index_tab = []
self.max_bias = 0
self.is_device = is_device
def get_base_na... | FrodeSolheim/fs-uae-launcher | amitools/fd/FuncTable.py | Python | gpl-2.0 | 2,903 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as 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 'JellyfishSpecie'
db.create_table(u'data_jellyfishspecie',... | socib/grumers | grumers/apps/data/migrations/0001_initial.py | Python | mit | 13,350 |
#!/usr/bin/env python3
import httplib2
import os
import sys
from apiclient.discovery import build
from apiclient.errors import HttpError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
class YoutubePlaylist():
# The CL... | kevinrigney/PlaylistDatabase | youtube_playlist.py | Python | mit | 4,726 |
from __future__ import absolute_import
import six
from collections import namedtuple
from datetime import timedelta
from django.utils import timezone
from sentry.app import tsdb
from sentry.api.serializers import Serializer, register
from sentry.models import Environment
StatsPeriod = namedtuple('StatsPeriod', ('se... | jean/sentry | src/sentry/api/serializers/models/environment.py | Python | bsd-3-clause | 2,176 |
import numpy as np
import pyflux as pf
import pandas as pd
from pandas.io.data import DataReader
from datetime import datetime
jpm = DataReader('JPM', 'yahoo', datetime(2011,1,1), datetime(2016,3,10))
data = pd.DataFrame(np.diff(np.log(jpm['Adj Close'].values)))
data.index = jpm.index.values[1:jpm.index.values.shape[... | RJT1990/pyflux | pyflux/garch/tests/lmegarch_tests.py | Python | bsd-3-clause | 15,199 |
#!/usr/bin/env python
#########################################################################################
#
# msct_types
# This file contains many useful (and tiny) classes corresponding to data types.
# Large data types with many options have their own file (e.g., msct_image)
#
# --------------------------------... | 3324fr/spinalcordtoolbox | scripts/msct_types.py | Python | mit | 21,731 |
# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | sandeepdsouza93/TensorFlow-15712 | tensorflow/python/kernel_tests/zero_division_test.py | Python | apache-2.0 | 2,177 |
from .balance import AVLTree
from .bst import BinarySearchTree
from .binheap import BinHeap
| GregSilverman/cohort_rest_api | rest_api/pythonds/trees/__init__.py | Python | gpl-3.0 | 97 |
"""
A Printer for generating readable representation of most sympy classes.
"""
from __future__ import print_function, division
from sympy.core import S, Rational, Pow, Basic, Mul
from sympy.core.mul import _keep_coeff
from .printer import Printer
from sympy.printing.precedence import precedence, PRECEDENCE
import m... | postvakje/sympy | sympy/printing/str.py | Python | bsd-3-clause | 24,248 |
# Copyright 2020 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... | aldian/tensorflow | tensorflow/python/distribute/distribute_utils.py | Python | apache-2.0 | 16,547 |
# Copyright 2010 OpenStack LLC.
# 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... | scality/manila | manila/tests/api/test_common.py | Python | apache-2.0 | 10,132 |
from django.contrib.auth import get_user_model
from django.core.management.base import BaseCommand
from pinax.invitations.models import InvitationStat
class Command(BaseCommand):
help = "Sets invites_allocated to -1 to represent infinite invites."
def handle(self, *args, **kwargs):
for user in get_u... | rizumu/pinax-invitations | pinax/invitations/management/commands/infinite_invites.py | Python | mit | 481 |
import rapidsms
import json
import urllib2
from django.core.exceptions import ObjectDoesNotExist , MultipleObjectsReturned
from models import UserToken ,Message
consumer_key ="Exgy2LpTAuVCW9G61iafQ"
consumer_secret ="ZOH2MHGOfRxBYr0haX8VweAZ3bjs389LcfKE3bWhHw"
class App (rapidsms.app.App):
def handle (self, message... | genova/rapidsms-senegal | apps/smstwit/app.py | Python | bsd-3-clause | 2,684 |
import ConfigParser
import os
import hashlib
class Config_manager:
def __init__(self):
self.config = ConfigParser.ConfigParser()
self.out_folder = None
def set_current_folder(self,t):
self.cwd = t
def set_config(self,file_cfg):
self.config.read(file_cfg)
... | cltl/lexical_pattern_extractor | lib/config_manager_pattern.py | Python | gpl-3.0 | 4,973 |
from django.test import TestCase
# Create your tests here.
# Sorry. -Nick | Gnewt/bhs_sales | shirts/tests.py | Python | mit | 75 |
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.utils.translation import ugettext as _
from django.http import HttpResponseRedirect
from django.conf import settings
from form_designer import settings as app_settings
from django.contrib import mes... | guilleCoro/django-form-designer | form_designer/views.py | Python | bsd-3-clause | 4,017 |
"""
This module contains the JSON domain objects.
Domains specify the set of valid values for a field.
"""
from __future__ import absolute_import
from __future__ import print_function
import json
########################################################################
class CodedValueDomain(object):
"""
Coded v... | Esri/ArcREST | src/arcrest/common/domain.py | Python | apache-2.0 | 6,188 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 pr... | otsaloma/gaupol | aeidon/test/test_encodings.py | Python | gpl-3.0 | 6,880 |
# -*- coding: utf-8 -*-
#
# This file is part of the bliss project
#
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
'''UDP communication module (:class:`~bliss.comm.udp.Udp`, \
:class:`~bliss.comm.udp.Socket`)
'''
import re
from gevent import socket
fro... | tiagocoutinho/bliss | bliss/comm/udp.py | Python | lgpl-3.0 | 1,734 |
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy_declaritive import Base, Connectivity
engine = create_engine('sqlite:///wim_info.db')
# bind the engine to the metadata of the base
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
# dbsession establishes ... | DarioValocchi/son-sp-infrabstract | wim-adaptor/vtn-api/database/insert_info.py | Python | apache-2.0 | 1,127 |
"""Routines related to PyPI, indexes"""
import sys
import os
import re
import mimetypes
import posixpath
from pip.log import logger
from pip.util import Inf, normalize_name, splitext, is_prerelease
from pip.exceptions import (DistributionNotFound, BestVersionAlreadyInstalled,
InstallationE... | ncdesouza/bookworm | env/lib/python2.7/site-packages/pip/index.py | Python | gpl-3.0 | 40,408 |
# vim: expandtab ts=4 sw=4 sts=4 fileencoding=utf-8:
#
# Copyright (C) 2007-2010 GNS3 Development Team (http://www.gns3.net/team).
#
# This program 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;
#
#... | GNS3/gns3-legacy | src/GNS3/Link/PipeCapture.py | Python | gpl-2.0 | 3,431 |
"""
Tests for lpstat parser
======================
Note, that date time is localized (according to LC_TIME).
"""
import pytest
from insights.parsers.lpstat import LpstatPrinters
from insights.tests import context_wrap
LPSTAT_P_OUTPUT = """
printer idle_printer is idle. enabled since Fri 20 Jan 2017 09:55:50 PM ... | PaulWay/insights-core | insights/parsers/tests/test_lpstat.py | Python | apache-2.0 | 2,432 |
#!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
"""
Check_MK checks providing services for Meinberg LANTIME Timeserver refclocks.
These checks handle firmware versions from v6 on.
"""
import re
label = {
0: "",
1: "(!)",
2: "(!!)",
3: "(!!!)"
}
mbgng_scan = lambda oid: oid(".1.... | dasmarci/check_mk | meinberg_ng/checks/mbgng_refclock.py | Python | gpl-2.0 | 6,291 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import contextlib
import json
import re
import os
from os import path
from jinja2 import Environment, FileSystemLoader, nodes
import six
OPERANDS = {
'eq': '===',
'ne': '!==',
'lt': ' < ',
'gt': ' > ',
'lteq': ' <= ',
'gteq': '... | jonbretman/jinja-to-js | jinja_to_js/__init__.py | Python | apache-2.0 | 42,539 |
# ################################################################
# Caso de estudo de Lisboa - EuroHealthy
# Metodos para o calculo dos seguintes indicadores:
# -> Médicos nos cuidados de saúde primários por 1000 habitantes
# Módulos necessarios
import arcpy
import pyodbc
import xlwt
import xlrd
import unicodedata
#... | JoaquimPatriarca/senpy-for-gis | gasp/odbc/examples.py | Python | gpl-3.0 | 12,330 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | bsmr-eve/Pyfa | gui/builtinAdditionPanes/droneView.py | Python | gpl-3.0 | 9,106 |
from .handler_registry import Handlers, ConfigureHandlers
from .executor import ProcessEvents
from .args import AddArgs
| skim1420/spinnaker | spinbot/event/__init__.py | Python | apache-2.0 | 120 |
"""__init__.py: Module init."""
__author__ = "Raido Pahtma"
__license__ = "MIT"
__version__ = "0.4.0"
| proactivity-lab/subsserver-datasink | subsdatasink/__init__.py | Python | mit | 104 |
# This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | denny820909/builder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/monkeypatches/sqlalchemy2189.py | Python | mit | 4,442 |
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
import datetime
from admissions.models import College, InterviewTeam
class CollegeForm(ModelForm):
class Meta:
model = College
exclude = [ 'name', 'adss_code', 'key', ]
InterviewTeamFormset = inlineformset... | tsengj10/physics-admit | admissions/forms.py | Python | gpl-2.0 | 437 |
def migrate_up(manager):
raise Exception('migrate.py should be migrating directly to schema 51 '
'instead of running migration 1...')
def migrate_down(manager):
manager.execute_script(DROP_DB_SQL)
DROP_DB_SQL = """\
DROP TABLE IF EXISTS `acl_groups`;
DROP TABLE IF EXISTS `acl_groups_host... | nacc/autotest | frontend/migrations/001_initial_db.py | Python | gpl-2.0 | 650 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import base64
import unittest
import contextlib
import six
import json
# from werkzeug.http import parse_dict_header
# from hashlib import md5
# from six import BytesIO
import httpbin
@contextlib.contextmanager
def _setenv(key, value):
"""Context manager to... | mozillazg/bustard-httpbin | test_httpbin.py | Python | isc | 17,463 |
from . import defaults
from .historical_dict import HistoricalDict
from .revert import Revert
class Detector(HistoricalDict):
"""
Detects revert events in a stream of revisions (to the same page) based on
matching checksums. To detect reverts, construct an instance of this class
and call :func:`~mwre... | mediawiki-utilities/python-mwreverts | mwreverts/detector.py | Python | mit | 2,174 |
#! /usr/bin/env python
#
# ProjectEuler.net - problem #007
#
# Summary: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
# What is the 10001st prime number?
import sys
def main():
print "Implement me!"
sys.exit(0)
if __name__ == "__main__":
main()
| olivereggert/euler | euler007.py | Python | mit | 315 |
#!/usr/bin/env python3
# Copyright 2019 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... | kubeflow/kfp-tekton-backend | samples/core/retry/retry.py | Python | apache-2.0 | 1,414 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_simindex
----------------------------------
Tests for `simindex` module.
"""
import os
import pytest
from pprint import pprint
import tempfile
import pandas as pd
from .testprofiler import profile
from .testdata import restaurant_records
import simindex.helper... | sappo/simindex | tests/test_engine.py | Python | mpl-2.0 | 9,171 |
# Copyright (c) 2013 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | weolar/miniblink49 | third_party/WebKit/Source/core/inspector/CodeGeneratorInspectorStrings.py | Python | apache-2.0 | 28,701 |
# -*- coding: utf8 -*-
import datetime
import os
import unittest
import webapp2
from google.appengine.ext import testbed, deferred
from google.appengine.datastore import datastore_stub_util
TESTCONFIG_DIR = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "testconfig")
# this needs setting before impo... | potatolondon/deferredmanager | deferred_manager/tests.py | Python | mit | 8,145 |
__author__ = 'matt'
'''
The purpose of this script is to control Tkinter filedialog instances.
'''
from tkinter import *
from tkinter.filedialog import askopenfilename, askopenfilenames, askdirectory, asksaveasfilename
def tk_control(c):
root = Tk()
root.withdraw()
x = eval(c)
root.destroy()
return x | sonofmun/DissProject | Data_Production/TK_files.py | Python | gpl-3.0 | 308 |
import datetime
from urllib import urlencode
from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.core import urlresolvers
from django.http import HttpResponse, Http404, HttpResponsePermanentRedirect, HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.template im... | twhyte/openparliament | parliament/hansards/views.py | Python | agpl-3.0 | 11,511 |
# Copyright 2012 OpenStack Foundation
# 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 requ... | tudorvio/tempest | tempest/api/identity/admin/v2/test_tenants.py | Python | apache-2.0 | 6,985 |
# -*- coding: utf-8 -*-
__author__ = 'AminHP'
# python imports
import os
import imp
import pkgutil
from functools import wraps
from good import Schema, Invalid
import collections
# flask imports
from flask import request, abort
class Validator(object):
def __init__(self, app=None):
self.app = app
... | k04la/ijust_server | project/modules/schema_validator.py | Python | gpl-3.0 | 2,878 |
from __future__ import print_function, division
from sympy.core import C, Add, Mul, Pow, S
from sympy.core.compatibility import default_sort_key, string_types
from sympy.core.mul import _keep_coeff
from sympy.printing.str import StrPrinter
from sympy.printing.precedence import precedence
from sympy.core.sympify import... | wolfram74/numerical_methods_iserles_notes | venv/lib/python2.7/site-packages/sympy/printing/codeprinter.py | Python | mit | 19,642 |
# Copyright 2009-2010 by 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 w... | Princessgladys/googleresourcefinder | app/pubsub.py | Python | apache-2.0 | 4,205 |
__author__ = 'firatlepirate'
#import Queue
from multiprocessing import Lock, Process, Queue, current_process
alfabe = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
# Gerekli inputlari istiyoruz
alfabe_key = input("Give me a number to make new alphabet: ")
c... | FiratGundogdu/dagitik | odev03/caesar_fork.py | Python | gpl-2.0 | 2,120 |
'''Representation of a random variable used in stochastic collocation'''
__copyright__ = 'Copyright (C) 2011 Aravind Alwan'
__license__ = '''
This file is part of UnyQuE.
UnyQuE 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 Softw... | aravindalwan/unyque | unyque/rdimension.py | Python | gpl-3.0 | 3,726 |
from __future__ import division
import numpy as np
import scipy
import scipy.signal
import scipy.optimize
import scipy.special
from scipy.misc import factorial
__all__ = ['cwt', 'Morlet', 'Paul', 'DOG',
'Ricker', 'Marr', 'Mexican_hat',
'WaveletAnalysis']
def cwt(data, wavelet=None, widths=None... | kwinkunks/timefreak | wavelets.py | Python | apache-2.0 | 25,736 |
""" Implements TIFF sample plane.
"""
# Author: Pearu Peterson
# Created: Jan 2011
from __future__ import division
import numpy
import tif_lzw
__all__ = ['TiffSamplePlane']
def set_array(output_array, input_array):
dtype = numpy.uint8
numpy.frombuffer(output_array.data, dtype=dtype)[:] = numpy.frombuffer(inp... | sephalon/pylibtiff | libtiff/tiff_sample_plane.py | Python | bsd-3-clause | 11,702 |
# coding: utf-8
from time import time
from typing import Union
from .inout import InOut
from .._global import OptionalModule
try:
from ue9 import UE9
except (ModuleNotFoundError, ImportError):
UE9 = OptionalModule("ue9")
def get_channel_number(channels: list) -> None:
"""Register needs to be called with the ... | LaboratoireMecaniqueLille/crappy | crappy/inout/labjackUE9.py | Python | gpl-2.0 | 2,609 |
TICKET_TYPES = (
('1', 'Standard'),
('2', 'VIP'),
)
| jmichelsen/ticket-to-pdf | tickets/constants.py | Python | gpl-3.0 | 60 |
from django.contrib.gis.db import models
class TestTable(models.Model):
field0 = models.CharField(max_length = 50)
def __unicode__(self):
return self.field0
class TestPoint(models.Model):
field0 = models.CharField(max_length = 50)
field1 = models.IntegerField()
field2 = models.DateTimeField()
field3 = models... | gista/django-geoshortcuts | geoshortcuts/tests/test_app/models.py | Python | gpl-2.0 | 1,245 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# 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 (... | cloudera/hue | apps/useradmin/src/useradmin/test_ldap.py | Python | apache-2.0 | 44,242 |
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... | bcb/qutebrowser | tests/integration/features/test_keyinput.py | Python | gpl-3.0 | 858 |
from pluggy._hooks import varnames
from pluggy._manager import _formatdef
def test_varnames() -> None:
def f(x) -> None:
i = 3 # noqa
class A:
def f(self, y) -> None:
pass
class B:
def __call__(self, z) -> None:
pass
assert varnames(f) == (("x",), ()... | pytest-dev/pluggy | testing/test_helpers.py | Python | mit | 1,664 |
# encoding: utf-8
'''
Created on Apr 19, 2015
@author: Michael Große <mic.grosse@posteo.de>
'''
from receipteval.receipt_collection import ReceiptCollection
from receipteval.purchase import Purchase
from collections import namedtuple
def test_category_correct():
rC = ReceiptCollection()
rC.category_dict.ite... | micgro42/ReceiptEval | receipteval/tests/test_collection.py | Python | gpl-3.0 | 5,100 |
import paho.mqtt.client as mqtt
from time import sleep
import random
broker="test.mosquitto.org"
topic_pub='v1/devices/me/telemetry'
client = mqtt.Client()
client.username_pw_set("$WIND_TURBINE_3_ACCESS_TOKEN")
client.connect('127.0.0.1', 1883, 1)
while True:
x = random.randrange(30, 61)
print x
msg = '... | thingsboard/thingsboard.github.io | docs/samples/analytics/resources/send-randomized-windspeed-3.py | Python | apache-2.0 | 400 |
#
# Write the interface function
#
# https://www.tensorflow.org/versions/r0.9/tutorials/mnist/tf/index.html
# Official web-site said,
# 1.inference() - Builds the graph as far as is required for running the network forward to make predictions.
<<<<<<< HEAD
# @JP:推論するための前向き(演算)ネットワークの実行に必要とする範囲までグラフを構築します。
=... | WaterIsland/DLStudy | tensorflow/source/template/interface.py | Python | mit | 490 |
"""
Query subclasses which provide extra functionality beyond simple data retrieval.
"""
from django.core.exceptions import FieldError
from django.db import connections
from django.db.models.query_utils import Q
from django.db.models.sql.constants import (
CURSOR, GET_ITERATOR_CHUNK_SIZE, NO_RESULTS,
)
from django... | gannetson/django | django/db/models/sql/subqueries.py | Python | bsd-3-clause | 7,963 |
import json
import pyethereum
t = pyethereum.tester
pb = pyethereum.processblock
u = pyethereum.utils
import sys
import random
from rlp.utils import encode_hex, ascii_chr
def mkrndgen(seed):
state = [0, 0]
def rnd(n):
if state[0] < 2**32:
state[0] = u.big_endian_to_int(u.sha3(seed+str(stat... | harlantwood/pyethereum | tools/random_vm_test_generator.py | Python | mit | 3,198 |
# -*- coding: utf-8 -*-
#
# 337SDK-Android-V2.2 documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 17 10:39:27 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated... | dwqelex/337SDK-ANDROID-DOC-V2.2 | source/conf.py | Python | apache-2.0 | 8,242 |
from datetime import datetime
from django.core.management.base import BaseCommand
from django.core.management.commands.runserver import Command as RunServerCommand
from django.utils import autoreload
from optparse import make_option
import django.core.handlers.wsgi
import os
import socket
import sys
import tornadio2
i... | rudeb0t/tornadio2go | tornadio2go/management/commands/runtornadio2.py | Python | bsd-3-clause | 6,699 |
# Copyright 2019 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... | adit-chandra/tensorflow | tensorflow/lite/testing/op_tests/concat.py | Python | apache-2.0 | 2,824 |
#
# test_codecencodings_hk.py
# Codec encoding tests for HongKong encodings.
#
from test import support
from test import multibytecodec_support
import unittest
class Test_Big5HKSCS(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'big5hkscs'
tstring = multibytecodec_support.load_te... | Orav/kbengine | kbe/src/lib/python/Lib/test/test_codecencodings_hk.py | Python | lgpl-3.0 | 801 |
"""Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | googleinterns/via-content-understanding | videoretrieval/cache/__init__.py | Python | apache-2.0 | 1,005 |
# Imports
import pygame
import math
# Initialize game engine
pygame.init()
# Window
WIDTH = 800
HEIGHT = 600
SIZE = (WIDTH, HEIGHT)
TITLE = "Edge Detection"
screen = pygame.display.set_mode(SIZE)
pygame.display.set_caption(TITLE)
# Timer
clock = pygame.time.Clock()
refresh_rate = 60
# Color... | joncoop/py-collide | edge_detection.py | Python | mit | 2,702 |
from typing import Any, ClassVar, Dict, List, Optional, TYPE_CHECKING
from ..constants import Constants
from ..config import Config
from .irresource import IRResource
from .iripallowdeny import IRIPAllowDeny
from .irbasemapping import IRBaseMapping
from .irhttpmapping import IRHTTPMapping
from .irtls import IRAmbass... | datawire/ambassador | python/ambassador/ir/irambassador.py | Python | apache-2.0 | 20,745 |
import gettext
import socket
import sys
import logging
_ = lambda x: gettext.ldgettext("rhsm", x)
import gtk
gtk.gdk.threads_init()
import rhsm
sys.path.append("/usr/share/rhsm")
# enable logging for firstboot
from subscription_manager import logutil
logutil.init_logger()
log = logging.getLogger("rhsm-app." + _... | vritant/subscription-manager | src/subscription_manager/gui/firstboot/rhsm_login.py | Python | gpl-2.0 | 19,013 |
"""Created on Wed Sep 07 2016 12:09.
@author: Nathan Budd
"""
import unittest
import numpy as np
import matplotlib.pyplot as plt
from ..model_coe import ModelCOE
from ..perturb_zero import PerturbZero
from ..reference_coe import ReferenceCOE
from ..warm_start_constant import WarmStartConstant
from ...mcpi.mcpi import ... | lasr/orbital_mechanics | dynamics/tests/test_model_coe.py | Python | mit | 2,901 |
# 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... | nikste/tensorflow | tensorflow/contrib/slim/python/slim/data/dataset_data_provider.py | Python | apache-2.0 | 3,491 |
# -*- coding: utf-8 -*-
#
# phpMyAdmin documentation build configuration file, created by
# sphinx-quickstart on Wed Sep 26 14:04:48 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# ... | V3SUV1US/unturned | server/phpMyAdmin-4.4.12-all-languages/doc/conf.py | Python | gpl-3.0 | 9,671 |
#!/usr/bin/env python
# Plot of Numeric & numarray arrays and lists & tuples of Python floats.
import sys
from qt import *
from Qwt4.Qwt import *
def drange(start, stop, step):
start, stop, step = float(start), float(stop), float(step)
size = int(round((stop-start)/step))
result = [start]*size
for i ... | PyQwt/PyQwt4 | qt3examples/MultiDemo.py | Python | gpl-2.0 | 4,825 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.