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 |
|---|---|---|---|---|---|
from math import *
def is_prime(num):
"""Returns True if the number is prime
else False."""
if num == 0 or num == 1:
return False
for x in range(2, num):
if num % x == 0:
return False
else:
return True
def main():
max_divisor = 20
result = 1
prime_nos = prime_nos = filter(is_prime, range(1, 20))
for ... | moghya/hacktoberfest-projecteuler | solutions/problem-5/solution.py | Python | gpl-3.0 | 465 |
import warnings
import numpy as np
from numpy import linalg as la, random as rnd
from scipy.linalg import expm
# Workaround for SciPy bug: https://github.com/scipy/scipy/pull/8082
try:
from scipy.linalg import solve_continuous_lyapunov as lyap
except ImportError:
from scipy.linalg import solve_lyapunov as lyap... | nkoep/pymanopt | pymanopt/manifolds/psd.py | Python | bsd-3-clause | 15,204 |
'''
Created on Oct 16, 2012
@author: paulm
'''
import os
import unittest
import logging
import pymel.internal.plogging as plogging
import pymel.core
class testCase_raiseLog(unittest.TestCase):
DEFAULT_LOGGER = pymel.core._logger
@classmethod
def _makeTest(cls, logLvlName, errorLvlName, logger=None):
... | shrtcww/pymel | tests/test_plogging.py | Python | bsd-3-clause | 2,053 |
#!/usr/bin/env python
#
# Copyright 2011 Facebook
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | chrisseto/tornado | tornado/process.py | Python | apache-2.0 | 10,630 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
import os
import re
from opus_core.logger import logger
from opus_core.database_management.database_server import DatabaseServer
from opus_core.database_management.configurations.database_ser... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_upgrade/changes_2006_11_16_interaction_set_changes/classes/db_sub_pattern.py | Python | gpl-2.0 | 11,789 |
from django.conf import settings
from django.conf.urls import url
from .views import get_summoner_v3, live_match, test_something, live_match_detail, FrontendAppView, ApiLiveMatch, ChampionInfoView
urlpatterns = [
url(r'^summoner/', get_summoner_v3, name='summoner_lookup'),
url(r'^live/$', live_match, name='liv... | belleandindygames/league | league/champ_chooser/urls.py | Python | mit | 756 |
#!/usr/bin/python
import argparse
import httplib2
import pprint
import base64
from apiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import run_flow, argparser
# Parse the command-line arguments (e.g. --noauth_local_... | RylanGotto/web-dash | websterton/oauth/gmail.py | Python | bsd-3-clause | 1,746 |
"""
Application urlconfig
"""
from __future__ import absolute_import
from django.conf.urls import url
from . import views
urlpatterns = [
url(
r"^(?P<uuid>[0-9a-f-]{36})/$",
views.RateView.as_view(),
name="rate"
),
url(
r"^2/(?P<uuid>[0-9a-f-]{36})/$",
views.Rate2... | RightToResearch/OpenCon-Rating-App | project/rating/urls.py | Python | mit | 365 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | chrismattmann/girder | tests/web_client_test.py | Python | apache-2.0 | 7,277 |
"""
@author ksdme
Contains Utilities
"""
from sure.exceptions import SureTypeError
def u_resolve_fail(throws=False):
"""
decides what to do when
fail signal is returned
"""
if throws is None:
throws = False
if throws:
raise SureTypeError()
else:
ret... | ksdme/sure | sure/utilities.py | Python | mit | 858 |
from src.platform.tomcat.interfaces import ManagerInterface
class FPrint(ManagerInterface):
def __init__(self):
super(FPrint, self).__init__()
self.version = "7.0"
| GHubgenius/clusterd | src/platform/tomcat/fingerprints/Tomcat7M.py | Python | mit | 187 |
import logging
import warnings
import collections
from six import add_metaclass
from functools import partial
logger = logging.getLogger(__name__)
class Param(object):
"Describes a single parameter and defines a method for cleaning inputs."
def __init__(self, default=None, allow_list=False, description=None,... | bruth/restlib2 | restlib2/params.py | Python | bsd-2-clause | 5,458 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... | marcellodesales/svnedge-console | svn-server/lib/suds/reader.py | Python | agpl-3.0 | 5,243 |
'''
Workaround for issue with Python mailbox module mis-reading Usenet
Historical Collection mbox files. Identifies all instances of "from"
that are *not* in the header, changes them to "xFrom," and writes
them to a new mailbox.
'''
batch = []
box = raw_input("What is the mailbox you want to work with? ")
n... | apdame/usenet-tools | fromedit.py | Python | mit | 992 |
from functools import partial
import six
from graphql_relay import from_global_id, to_global_id
from ..types import ID, Field, Interface, ObjectType
from ..types.interface import InterfaceMeta
def is_node(objecttype):
'''
Check if the given objecttype has Node as an interface
'''
assert issubclass(... | sjhewitt/graphene | graphene/relay/node.py | Python | mit | 3,371 |
import ujson
from socorro.unittest.testbase import TestCase
from nose.tools import eq_, ok_
from mock import Mock, patch
from configman import ConfigurationManager
from configman.dotdict import DotDict
from socorro.processor.processor_2015 import (
Processor2015,
rule_sets_from_string
)
from socorro.lib.util... | rhelmer/socorro-lib | socorro/unittest/processor/test_processor_2015.py | Python | mpl-2.0 | 5,629 |
"""Import an Irish NaPTAN XML file, obtainable from
https://data.dublinked.ie/dataset/national-public-transport-nodes/resource/6d997756-4dba-40d8-8526-7385735dc345
"""
import warnings
import zipfile
import xml.etree.cElementTree as ET
from django.contrib.gis.geos import Point
from django.core.management.base import Ba... | stev-0/bustimes.org.uk | busstops/management/commands/import_ie_naptan_xml.py | Python | mpl-2.0 | 4,087 |
# -*- 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 field 'ConceptNode.max_children'
db.add_column(u'nodemanager_con... | kevincwebb/conceptum | conceptum/nodemanager/migrations/0006_auto__add_field_conceptnode_max_children__add_field_conceptnode_child_.py | Python | bsd-3-clause | 8,168 |
# setup.py for pySerial
#
# Windows installer:
# "python setup.py bdist_wininst"
#
# Direct install (all systems):
# "python setup.py install"
#
# For Python 3.x use the corresponding Python executable,
# e.g. "python3 setup.py ..."
#
# (C) 2001-2015 Chris Liechti <cliechti@gmx.net>
#
# SPDX-License-Identifier: ... | hoihu/pyserial | setup.py | Python | bsd-3-clause | 1,969 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyFlake8Polyfill(PythonPackage):
"""flake8-polyfill is a package that provides some compat... | LLNL/spack | var/spack/repos/builtin/packages/py-flake8-polyfill/package.py | Python | lgpl-2.1 | 746 |
# Python program for implementation of heap Sort
# To heapify subtree rooted at index i.
# n is size of heap
def heapify(arr, n, i):
largest = i # Initialize largest as root
l = 2 * i + 1 # left = 2*i + 1
r = 2 * i + 2 # right = 2*i + 2
# See if left child of root exists and is
# greate... | salman-bhai/DS-Algo-Handbook | Algorithms/Sort_Algorithms/Heap_Sort/HeapSort.py | Python | mit | 1,165 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v10/resources/types/keyword_theme_constant.py | Python | apache-2.0 | 2,290 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
publishdialog.py
---------------------
Date : September 2014
Copyright : (C) 2014 by NextGIS
Email : info at nextgis dot org
****************************... | nextgis/publish2ngw | publishdialog.py | Python | gpl-2.0 | 32,789 |
# Copyright (C) 2015 by the Free Software Foundation, Inc.
#
# This file is part of GNU Mailman.
#
# GNU Mailman 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 opt... | khushboo9293/mailman3 | src/mailman/rest/tests/test_queues.py | Python | gpl-2.0 | 3,843 |
#!/usr/bin/python2
# Copyright (c) 2012 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Tests of directory storage adapter."""
import os
import unittest
import directory_storage
import fake_storage
import gsd_sto... | Lind-Project/native_client | build/directory_storage_test.py | Python | bsd-3-clause | 3,028 |
# 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... | AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/learn/python/learn/learn_io/pandas_io_test.py | Python | apache-2.0 | 5,832 |
import modelx as mx
import pytest
@pytest.fixture
def duplicate_inheritance_model():
"""
Sub <------------------- Base1
| |
Child <--------- Base2 Child
| | |
GChild <--Base3 GChild GChild
| | |
... | fumitoh/modelx | modelx/tests/core/space/inheritance/test_add_bases.py | Python | gpl-3.0 | 1,269 |
# -*- coding: utf-8 -*-
# vim: sw=4:ts=4:expandtab
"""Twisted utility functions"""
from __future__ import (
absolute_import, division, print_function, with_statement,
unicode_literals)
import itertools as it
from os import environ
from sys import executable
from functools import partial
from twisted.intern... | kazeeki/pipe2py | pipe2py/twisted/utils.py | Python | gpl-2.0 | 6,204 |
# portalocker.py - Cross-platform (posix/nt) API for flock-style file locking.
# Requires python 1.5.2 or better.
#
# sostler May 2008
# Taken from: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203
"""Cross-platform (posix/nt) API for flock-style file locking.
Synopsis:
import portal... | zepheira/exhibit | src/webapp/api/extensions/curate/files/admin/portalocker.py | Python | bsd-3-clause | 3,905 |
#!/usr/bin/env python
#
# VM Backup extension
#
# Copyright 2014 Microsoft Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | v-zhongz/azure-linux-extensions | VMBackup/main/handle.py | Python | apache-2.0 | 12,248 |
#!/usr/bin/python
# Terminator by Chris Jones <cmsj@tenshu.net>
# GPL v2 only
"""activitywatch.py - Terminator Plugin to watch a terminal for activity"""
import time
import gtk
import gobject
import terminatorlib.plugin as plugin
from terminatorlib.translation import _
from terminatorlib.util import err, dbg
from ter... | zygh0st/terminator | terminatorlib/plugins/activitywatch.py | Python | gpl-2.0 | 5,529 |
# Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
import os.path
from cStringIO import StringIO
import flask
import PIL.Image
import digits
from digits import utils
from digits.webapp import app, autodoc
import classification.views
import extraction.views
NAMESPACE = '/datasets/images'
@app.rout... | DESHRAJ/DIGITS | digits/dataset/images/views.py | Python | bsd-3-clause | 1,982 |
# coding: utf-8
from __future__ import unicode_literals
import itertools
import re
import random
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse,
compat_urllib_request,
)
from ..utils import (
ExtractorError,
parse_iso8601,
)
class TwitchBaseIE(InfoExtrac... | DucQuang1/youtube-dl | youtube_dl/extractor/twitch.py | Python | unlicense | 14,422 |
from mypkg.power import power
class TestZero:
def test_ten(self):
assert power(0, 10, 1000) == 0
def test_hundred(self):
assert power(0, 100, 1000) == 0
| vogonsoft/pytest-tutorial | test05/test_zero.py | Python | unlicense | 163 |
# 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... | brchiu/tensorflow | tensorflow/contrib/distribute/python/combinations.py | Python | apache-2.0 | 14,495 |
#!/usr/bin/python
################################################################
# .___ __ _______ .___ #
# __| _/____ _______| | __ ____ \ _ \ __| _/____ #
# / __ |\__ \\_ __ \ |/ // ___\/ /_\ \ / __ |/ __ \ #
# / /_/ | / __ \| | \/ <\ \___\... | knightmare2600/d4rkc0de | others/ftpbrute.py | Python | gpl-2.0 | 8,051 |
# -*- coding: utf-8 -*-
#
# papyon - a python client library for Msn
#
# Copyright (C) 2010 Collabora Ltd.
#
# 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 2 of the License, or
#... | billiob/papyon | tests/test_sip_client.py | Python | gpl-2.0 | 3,295 |
# coding: utf-8
#
# Copyright 2017 The Oppia 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 requi... | shaz13/oppia | core/domain/collection_jobs_one_off.py | Python | apache-2.0 | 3,258 |
"""
from: https://bitbucket.org/haypo/misc/src/tip/python/pep418.py
Implementation of the PEP 418 in pure Python using ctypes.
Functions:
- clock()
- get_clock_info(name)
- monotonic(): not always available
- perf_frequency()
- process_time()
- sleep()
- time()
Constants:
- has_monotonic (bool): True if ti... | ionelmc/pytest-benchmark | src/pytest_benchmark/pep418.py | Python | bsd-2-clause | 28,504 |
#--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | tatiana/invesalius | invesalius/data/slice_data.py | Python | gpl-2.0 | 5,655 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#######################################################################
#
# VidCutter - media cutter & joiner
#
# copyright © 2018 Pete Alexandrou
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public Licen... | ozmartian/vidcutter | vidcutter/mediastream.py | Python | gpl-3.0 | 13,866 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import print_function, division, absolute_import, unicode_literals
| mick-d/nipype | nipype/sphinxext/__init__.py | Python | bsd-3-clause | 243 |
import unittest
def main():
loader = unittest.TestLoader()
suite = loader.discover('.', pattern='*.py')
unittest.TextTestRunner().run(suite)
if __name__ == "__main__":
main()
| uozuAho/doit_helpers | test/run_all_tests.py | Python | mit | 195 |
#!/usr/bin/python
# Welcome to CLRenew, a simple python script that automates mouse clicks to
# renew craigslist postings credit to https://github.com/yuqianli for base code
import pyautogui
import os
# Set a counter to count the # of exceptions occur
counter = 0
# Start the while loop
while True:
try:
pri... | calexil/CLRenew | renew.py | Python | gpl-3.0 | 1,501 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of importer.
# https://github.com/heynemann/importer
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2016, Bernardo Heynemann <heynemann@gmail.com>
from setuptools import setup, find_packages
from imp... | heynemann/importer | setup.py | Python | mit | 1,854 |
#!/usr/bin/python
import os, string, sys
lib_path = os.path.abspath('./TL/')
sys.path.append(lib_path)
from data_handling import load_savedgzdata
basepath_15000 = sys.argv[1]
resolution_15000 = '15000'
basepath_50000 = sys.argv[2]
for nrun in range(1,21):
pathids0 = '{0:s}/{1:05d}_{2:05d}_test_ids.pkl.gz'.for... | rjgsousa/TEM | sda_log_evaluation/check_ids.py | Python | gpl-3.0 | 754 |
#!/usr/bin/env python
import json
inv = {
'_meta': {
'hostvars': {}
},
'hosts': []
}
for num in range(0, 3):
host = u"host-%0.2d" % num
inv['hosts'].append(host)
inv['_meta']['hostvars'][host] = dict(ansible_ssh_host='127.0.0.1', ansible_connection='local')
print(json.dumps(inv, inde... | ansible/tower-cli | docs/source/cli_ref/examples/inventory_script_example.py | Python | apache-2.0 | 327 |
from modules.chart_module import ChartModule
import tornado.web
import logging
class LineChartModule(ChartModule):
def render(self, raw_data, keys, chart_id="linechart"):
self.chart_id = chart_id
self.chart_data = self.overtime_linechart_data(raw_data, keys)
return self.render_string('mod... | SFII/cufcq-new | modules/linechart_module.py | Python | mit | 5,898 |
#!/usr/bin/env python
import confy
import os
import sys
# These lines are required for interoperability between local and container environments.
dot_env = os.path.join(os.getcwd(), '.env')
if os.path.exists(dot_env):
confy.read_environment_file()
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTI... | scottp-dpaw/oim-cms | manage.py | Python | apache-2.0 | 1,015 |
#
# Solution to Project Euler problem 73
# Philippe Legault
#
# https://github.com/Bathlamos/Project-Euler-Solutions
from fractions import Fraction, gcd
from math import ceil
# Not too slow, can be done directly
def compute():
lower_limit = Fraction(1, 3)
upper_limit = Fraction(1, 2)
res = 0
for i in range(1... | Bathlamos/Project-Euler-Solutions | solutions/p073.py | Python | mit | 520 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('home', '0008_auto_20160304_1108'),
]
operations = [
migrations.AlterField(
model_name='room',
name='... | CentechMTL/TableauDeBord | app/home/migrations/0009_auto_20160304_1126.py | Python | gpl-3.0 | 646 |
#
# Copyright (C) 2006-2016 Nexedi SA
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distributed... | vpelletier/neoppod | neo/tests/master/testTransactions.py | Python | gpl-2.0 | 8,633 |
#!/usr/bin/env python
# Copyright 2014-2019 Thomas Schatz, Mathieu Bernard, Roland Thiolliere
#
# This file is part of h5features.
#
# h5features 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 ... | bootphon/h5features | test/perfs.py | Python | gpl-3.0 | 3,410 |
# encoding: utf-8
import tkinter
class Painter:
def __init__(self, width=1200, height=800, bg='white'):
self.root = tkinter.Tk()
self.canvas = tkinter.Canvas(self.root, width=width, height=height, bd=5)
self.canvas.pack()
def add_point(self, x, y, color, radius):
left_top = (x... | neveralso/CompilerAssignment | gui.py | Python | gpl-2.0 | 1,173 |
import Handler, Mdb, Security, Template, Util
from bongo import MDB
def CreateAlias(req):
if not req.fields.has_key('newaliasname'):
return Handler.SendMessage(req, 'Alias CN is required')
if not req.fields.has_key('newaliasref'):
return Handler.SendMessage(req, 'Aliased object is required')
... | bongo-project/bongo | src/libs/python/bongo/admin/Alias.py | Python | gpl-2.0 | 694 |
# encoding: utf-8
import cgi
import json
import logging
import os
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import webapp2
import jinja2
JINJA_ENVIRONMENT = jinja2.Environme... | ebaumstarck/funwebdev | FlashCard/flashcards.py | Python | bsd-3-clause | 1,945 |
# article_selector.py
class ArticleSelector():
"""
This script is designed to set up an experiment by selecting
training, development and test sets out of a large corpus of
articles. The corpus in mind is the Westbury Lab Wikipedia
Corpus.
It randomly chooses n articles out of a set m >= n a... | ambimorph/recluse | recluse/article_selector.py | Python | agpl-3.0 | 2,389 |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleads/google-ads-python | google/ads/googleads/v9/errors/types/conversion_action_error.py | Python | apache-2.0 | 1,543 |
#This script runs a game using basic conditional terminology: conditional/alternative/chained executions, raw_input, type conversions, main functions, rational operators, logical operators, random.randint(), and str.format().
#This is about a game that involves a bomb, where you need to cut the right circuit in order t... | bomin2406-cmis/bomin2406-cmis-cs2 | conditionals.py | Python | cc0-1.0 | 3,685 |
#!/usr/bin/python3
import os
import sys
import datetime
import time
try:
import board
import busio
import adafruit_ccs811
except:
print("ccs811 module not installed, install using the gui")
sys.exit()
homedir = os.getenv("HOME")
sensor_log = homedir + "/Pigrow/logs/persistCCS811.txt"
'''
# Curren... | Pragmatismo/Pigrow | scripts/persistent_sensors/persistent_ccs811.py | Python | gpl-3.0 | 5,035 |
#!/usr/bin/python
# coding: UTF-8
import os
import sys
import urllib2
import partner_pb2
if len(sys.argv) != 2:
print "input url"
sys.exit(0)
url = (sys.argv[1])
all_the_text = urllib2.urlopen(url=url).read()
req = partner_pb2.PartnerData()
req.ParseFromString(all_the_text)
print "attrs"
for ite in req.a... | tsdfsetatata/xserver | Server/dump_srv/show_partner2.py | Python | gpl-3.0 | 457 |
# 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 u... | mistercrunch/panoramix | superset/migrations/versions/1f6dca87d1a2_security_converge_dashboards.py | Python | apache-2.0 | 3,258 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | ksrajkumar/openerp-6.1 | openerp/addons/l10n_tr/__openerp__.py | Python | agpl-3.0 | 2,237 |
import asyncio
import multiprocessing
import time
from indy_common.constants import POOL_RESTART, RESTART_MESSAGE
from indy_node.test.pool_restart.helper import compose_restart_message, \
send_restart_message
from stp_core.loop.eventually import eventually
from indy_node.test.upgrade.helper import NodeControlToo... | spivachuk/sovrin-node | indy_node/test/pool_restart/test_node_control_tool_for_restart.py | Python | apache-2.0 | 1,740 |
# adapted from the application skeleton in the sdk
import e32
import appuifw
import location
import struct
import socket
import threading
class gsm_location :
def __init__(self) :
self.text = u""
self.noRefresh = 0;
def gsm_location(self) :
self.noRefresh = self.noRefresh + 1;
try:
(self.mcc, self.mnc, ... | papousek/GpsMid | S60cellID_helper.py | Python | gpl-2.0 | 3,251 |
#from . import mod
from .comp1 import CONF
from .comp2 import CONF
| simone-campagna/daikon | test_zirkon/pack4/__init__.py | Python | apache-2.0 | 68 |
#!/usr/bin/env python
# encoding: utf-8
from django import template
register = template.Library()
@register.filter(name='yes_no')
def yes_no(bool_value, show_str):
if bool_value:
return show_str.partition('/')[0]
else:
return show_str.partition('/')[2]
| its-django/mysite-django18 | mysite/restaurants/templatetags/myfilters.py | Python | apache-2.0 | 281 |
#!/usr/bin/env python
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#----------------------------------------------------------------... | Azure/azure-sdk-for-python | sdk/maintenance/azure-mgmt-maintenance/setup.py | Python | mit | 2,678 |
from sys import exit, stderr, argv
from collections import defaultdict, Counter
import json
import random
def parse_mallet_topics(fname) :
tmp = []
with open(fname) as f :
for line in f :
tmp.append(line.strip().split('\t')[2:])
return tmp
def parse_mallet_topics_annotated(f... | genie9/pulp | parse_mallet.py | Python | gpl-3.0 | 4,601 |
# -*- coding: utf-8 -*-
# **********************************************************************
#
# Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# ***********************************... | ljx0305/ice | cpp/test/IceGrid/activation/test.py | Python | gpl-2.0 | 414 |
import datetime
import logging
import os
from django.conf import settings
from django.core.files.base import ContentFile
from django.core.mail import EmailMultiAlternatives
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as ... | dstegelman/django-mail-queue | mailqueue/models.py | Python | mit | 5,874 |
# coding=utf-8
# Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage 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... | Maximilian-Reuter/SickRage | sickbeard/name_parser/parser.py | Python | gpl-3.0 | 24,215 |
# Copyright 2008-2013 Nokia Siemens Networks Oyj
#
# 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... | ktan2020/legacy-automation | win/Lib/site-packages/robot/result/xmlelementhandlers.py | Python | mit | 6,002 |
# Copyright 2015 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.
from __future__ import print_function
class Cat(object):
def Run(self):
print('Meow')
| catapult-project/catapult | telemetry/telemetry/internal/testing/dependency_test_dir/other_animals/cat/cat/cat_object.py | Python | bsd-3-clause | 255 |
"""
Django settings for todolist project.
Generated by 'django-admin startproject' using Django 1.8.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# Build pat... | tingbaozhao/pythonWeb | todolist/todolist/settings.py | Python | agpl-3.0 | 2,644 |
# 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... | sarvex/tensorflow | tensorflow/tools/pip_package/pip_smoke_test.py | Python | apache-2.0 | 7,387 |
#!/usr/bin/python
# Copyright (c) 2011 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import copy
import ntpath
import os
import posixpath
import re
import subprocess
import sys
import gyp.common
import gyp.easy_xml as easy_xml
i... | dtebbs/gyp | pylib/gyp/generator/msvs.py | Python | bsd-3-clause | 110,367 |
import matplotlib
# Force matplotlib to not use any Xwindows backend.
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib.ticker as tkr
import datetime
import numpy as np
import csv
#x = np.array([datetime.datetime(2013, 9, 28, i, 0) for i in range(24)])
#y = np.r... | stefan2904/raspberry-temperature | plot.py | Python | mit | 1,307 |
from django.urls import path
from . import views
app_name = "newsletters"
urlpatterns = [
path('', views.Index.as_view(template_name='newsletters/index.html'), name='newsletters_index'),
path('create/', views.Create.as_view(template_name='newsletters/create.html'), name='newsletters_create'),
path('<int:... | ashbc/tgrsite | newsletters/urls.py | Python | isc | 1,111 |
class Gate(object):
def clear_gate(self):
self.outputGateCalculated = False
class AndGate(Gate):
def __init__(self, init_string):
values = init_string.split('->')
self.outputGateName = values[1].strip()
self.outputGate = 0
self.outputGateValue = 0
second_pass = ... | TheYachtingClam/AdventPython | Day7-Some Assembly Required/Gates.py | Python | gpl-3.0 | 8,336 |
# -*- coding: utf-8 -*-
import urwid
class FancyListBox(urwid.LineBox):
def get_listbox(self, items):
class _FancyListBox(urwid.ListBox):
def keypress(_self, size, key):
key = super(_FancyListBox, _self).keypress(size, key)
self.update_corners(_self.ends_visibl... | dustinlacewell/console | console/widgets/listbox.py | Python | mit | 2,895 |
"""ACME Identifier Validation Challenges."""
import abc
import functools
import hashlib
import logging
import socket
from cryptography.hazmat.primitives import hashes
import OpenSSL
import requests
from acme import errors
from acme import crypto_util
from acme import fields
from acme import jose
logger = logging.get... | jtl999/certbot | acme/acme/challenges.py | Python | apache-2.0 | 18,834 |
# -*- coding: utf-8 -*-
# Copyright © 2014-2018 GWHAT Project Contributors
# https://github.com/jnsebgosselin/gwhat
#
# This file is part of GWHAT (Ground-Water Hydrograph Analysis Toolbox).
# Licensed under the terms of the GNU General Public License.
# Standard library imports :
import platform
# Third party impo... | jnsebgosselin/WHAT | gwhat/common/styles.py | Python | gpl-3.0 | 1,792 |
from taichi.lang import impl
from taichi.lang.misc import get_host_arch_list
import taichi as ti
from tests import test_utils
@test_utils.test(require=ti.extension.adstack)
def test_ad_if_simple():
x = ti.field(ti.f32, shape=())
y = ti.field(ti.f32, shape=())
ti.root.lazy_grad()
@ti.kernel
def ... | yuanming-hu/taichi | tests/python/test_ad_if.py | Python | mit | 4,447 |
"""
twiki.wikipedia
~~~~~~~~~~~~~~~
Wikipedia API wrapper
"""
import wikipedia
class WikipediaError(Exception):
def __init__(self, msg, code=500):
self.msg = msg
self.code = code
super(WikipediaError, self).__init__(msg, code)
class Wikipedia(object):
"""Wraps around wik... | justanr/twiki | twiki/wiki.py | Python | mit | 2,785 |
# coding: utf-8
"""
OpenAPI spec version:
Generated by: https://github.com/swagger-api/swagger-codegen.git
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
... | detiber/lib_openshift | lib_openshift/models/v1_image_stream_import_status.py | Python | apache-2.0 | 5,152 |
import numpy as np
from AbstractClassifier import AbstractClassfier
class Svm(AbstractClassfier):
def __init__(self):
self._w = np.array([])
self._mins = np.array([])
self._maxs = np.array([])
self.false_positive_loss = 1
self.false_negative_loss = 1
self.error = 0
... | zardav/FaceDetection | FaceDetection/Svm.py | Python | gpl-3.0 | 3,493 |
#!/bin/sh
''''exec python3 -u -- "$0" ${1+"$@"} # '''
# #! /usr/bin/env python3
# Copyright 2016 Euclidean Technologies Management 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 t... | euclidjda/deep-quant | scripts/hyper_param_search_uq.py | Python | mit | 13,692 |
# -*- coding: utf-8 -*-
"""Functional tests using WebTest.
See: http://webtest.readthedocs.org/
"""
import pytest
from flask import url_for
from nostra.models.user import User
from .factories import UserFactory
class TestLoggingIn:
def test_can_log_in_returns_200(self, user, testapp):
# Goes to homepa... | jamesbbaker96/nostra | tests/test_functional.py | Python | bsd-3-clause | 3,658 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django.conf.urls import patterns, url
from . import views
urlpatterns... | hrayr-artunyan/shuup | shuup/front/apps/saved_carts/urls.py | Python | agpl-3.0 | 859 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0048_auto_20150406_1922'),
]
operations = [
migrations.AddField(
model_name='account',
name='... | SchoolIdolTomodachi/SchoolIdolAPI | api/migrations/0049_account_accept_friend_requests.py | Python | apache-2.0 | 479 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2010 Openstack, LLC.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | nii-cloud/dodai-compute | nova/scheduler/driver.py | Python | apache-2.0 | 14,688 |
class RequestOptions(object):
class Operator:
Equals = 'eq'
GreaterThan = 'gt'
GreaterThanOrEqual = 'gte'
LessThan = 'lt'
LessThanOrEqual = 'lte'
In = 'in'
class Field:
CreatedAt = 'createdAt'
LastLogin = 'lastLogin'
Name = 'name'
... | Talvalin/server-client-python | tableauserverclient/server/request_options.py | Python | mit | 1,429 |
# 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 may ... | Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2018_07_01/_network_management_client.py | Python | mit | 23,821 |
from test_unit_module import test_unit
class Usage(test_unit):
def __init__(self):
pass
def test_case_0(self):
"""
Example of a passing test case.
"""
actual = 8 # 3+5
expected = 8
self.assert_op(actual,expected,0) # Actual result, Expected result, test case id or identifier(not optional), HINT (Optio... | budhiraja/Test-Unit | usage_test_unit.py | Python | mit | 890 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import structlog
def get_saml_logger():
"""
Get a logger named `saml2idp` after the main package.
"""
return structlog.get_logger('saml2idp')
| mobify/dj-saml-idp | saml2idp/logging.py | Python | mit | 257 |
#!/usr/bin/python3
# Filename: k_means_cluster.py
"""
A Machine learning algorithm for K mean clustering.
Date: 24th March, 2015 pm
"""
__author__ = "Anthony Wanjohi"
__version__ = "1.0.0"
import random, fractions
def euclidean_distance(point, centroid):
'''Returns the euclidean distance between two points'''
asser... | TonyHinjos/Machine-Learning-Algorithms-Toolkit | k-means-clustering/k_means_cluster.py | Python | mit | 4,794 |
#!/usr/bin/env python
#
# Copyright (C) 2011 Austin Leirvik <aua at pdx.edu>
# Copyright (C) 2011 Wil Cooley <wcooley at pdx.edu>
# Copyright (C) 2011 Joanne McBride <jirab21@yahoo.com>
# Copyright (C) 2011 Danny Aley <danny.aley@gmail.com>
# Copyright (C) 2011 Erich Ulmer <blurrymadness@gmail.com>
#
# This program is ... | wcooley/usbrevue | usbrevue.py | Python | gpl-3.0 | 25,073 |
r"""JSON (JavaScript Object Notation) <http://json.org> is a subset of
JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data
interchange format.
:mod:`simplejson` exposes an API familiar to users of the standard library
:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained
version of ... | SickGear/SickGear | lib/simplejson/__init__.py | Python | gpl-3.0 | 24,480 |
# Copyright 2016 OpenMarket Ltd
# Copyright 2017 Vector Creations Ltd
# Copyright 2018-2019 New Vector Ltd
# Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 t... | matrix-org/synapse | synapse/rest/client/versions.py | Python | apache-2.0 | 4,936 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.