code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the AGPLv3 or higher.
import sys
import os
import signal
import platform
from PyQt5.QtCore import Qt, QObject, QCoreApplication, QEvent, pyqtSlot, QLocale, QTranslator, QLibraryInfo, QT_VERSION_STR, PYQT_VERSION_STR
from PyQt5.QtQml import Q... | onitake/Uranium | UM/Qt/QtApplication.py | Python | agpl-3.0 | 13,585 |
"""Test Workbench Runtime"""
from unittest import TestCase
import mock
from django.conf import settings
from xblock.fields import Scope
from xblock.runtime import KeyValueStore
from xblock.runtime import KvsFieldData
from xblock.reference.user_service import UserService
from ..runtime import WorkbenchRuntime, Scena... | Lyla-Fischer/xblock-sdk | workbench/test/test_runtime.py | Python | agpl-3.0 | 6,112 |
"""
Asset compilation and collection.
"""
from __future__ import print_function
import argparse
from paver.easy import sh, path, task, cmdopts, needs, consume_args, call_task
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
import glob
import traceback
from .utils.envs imp... | torchingloom/edx-platform | pavelib/assets.py | Python | agpl-3.0 | 6,729 |
from . import orderpoint_generator
| Vauxoo/stock-logistics-warehouse | stock_orderpoint_generator/wizard/__init__.py | Python | agpl-3.0 | 35 |
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests of the oopsreferences core."""
__metaclass__ = type
from datetime import (
datetime,
timedelta,
)
from pytz import utc
from lp.registry.model.oopsrefe... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/registry/tests/test_oopsreferences.py | Python | agpl-3.0 | 7,128 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mozaik Mass Mailing Access Rights",
"summary": """
New group: Mass Mailing Manager. Managers can edit
and unlink mass mailings.""",
"version": "14.0.1.0.0",
"license": "AGPL-3",
... | mozaik-association/mozaik | mozaik_mass_mailing_access_rights/__manifest__.py | Python | agpl-3.0 | 625 |
# SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint
# pylint: disable=missing-module-docstring, missing-function-docstring
import typing
import math
import contextlib
from timeit import default_timer
from operator import itemgetter
from searx.engines import engines
from .models import HistogramStorage, Counte... | dalf/searx | searx/metrics/__init__.py | Python | agpl-3.0 | 8,348 |
#!/usr/bin/env python
# encoding: utf-8
import os
import geoip2.database
from geoip2.errors import AddressNotFoundError
from cortexutils.analyzer import Analyzer
class MaxMindAnalyzer(Analyzer):
def dump_city(self, city):
return {
'confidence': city.confidence,
'geoname_id': city.... | CERT-BDF/Cortex-Analyzers | analyzers/MaxMind/geo.py | Python | agpl-3.0 | 3,380 |
from contextlib import suppress
from ereuse_devicehub.resources.account.domain import AccountDomain, UserNotFound
from ereuse_devicehub.resources.device.domain import DeviceDomain
def materialize_actual_owners_remove(events: list):
for event in events:
properties = {'$pull': {'owners': event['from']}}
... | eReuse/DeviceHub | ereuse_devicehub/resources/event/device/deallocate/hooks.py | Python | agpl-3.0 | 737 |
#!/usr/bin/env python
# UPE Programming competiton 2015-11-1 "railforest" solution by Avi Weinstock
import re
import sys
INFINITY = float('inf')
line_to_ints = lambda line: [int(x, 10) for x in re.split(' *', line)]
def solver(width, height, grid):
prevs = [[0, list()] for _ in range(width)]
for (y, line) in... | aweinstock314/aweinstock-programming-competition-solutions | upe_competition_2015_11_01/railforest/railforest_weinsa.py | Python | agpl-3.0 | 1,246 |
# -*- coding: utf-8 -*- pylint: disable-msg=R0801
#
# Copyright (c) 2013 Rodolphe Quiédeville <rodolphe@quiedeville.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ver... | rodo/cotetra | cotetra/survey/api.py | Python | agpl-3.0 | 1,782 |
# These are the instance-dependent settings. Copy this file to
# secrets.py and apply the desired settings.
#
# Only one variable is required here, SECRET_KEY. Fill this using:
# http://www.miniwebtool.com/django-secret-key-generator/
SECRET_KEY = ''
# In your development setup, you can leave the following variable... | SAlkhairy/trabd | trabd/secrets.template.py | Python | agpl-3.0 | 557 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Odoo, an open source suite of business apps
# This module copyright (C) 2015 bloopark systems (<http://bloopark.de>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | blooparksystems/website | website_seo/controllers/main.py | Python | agpl-3.0 | 4,887 |
def test_imprint(app, client):
app.config["SKYLINES_IMPRINT"] = u"foobar"
res = client.get("/imprint")
assert res.status_code == 200
assert res.json == {u"content": u"foobar"}
def test_team(client):
res = client.get("/team")
assert res.status_code == 200
content = res.json["content"]
... | skylines-project/skylines | tests/api/views/about_test.py | Python | agpl-3.0 | 664 |
"""
Django settings for kore project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impor... | City-of-Helsinki/kore | kore/settings.py | Python | agpl-3.0 | 4,485 |
# Copyright 2021 ACSONE SA/NV
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Mozaik Website Event Track",
"summary": """
This module allows to see the event menu configuration
even without activated debug mode""",
"version": "14.0.1.0.0",
"license": "AGPL-3",... | mozaik-association/mozaik | mozaik_website_event_track/__manifest__.py | Python | agpl-3.0 | 525 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | zhaohuaw/connector | connector/unit/mapper.py | Python | agpl-3.0 | 32,917 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-21 11:13
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('submission', '0011_auto_20170921_0937'),
('identifi... | BirkbeckCTP/janeway | src/identifiers/migrations/0004_auto_20170921_1113.py | Python | agpl-3.0 | 750 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
import json, web
from lib.log import Log
class Env(object):
@staticmethod
def get(key):
if key and key in web.ctx.env:
return web.ctx.env[key]
else:
return web.ctx.env
@staticmethod
def set(key, value):
web.ctx.env[key] = value
@staticmethod
def setFro... | ZiTAL/zpy | private/lib/env.py | Python | agpl-3.0 | 439 |
from comics.aggregator.crawler import CrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = 'Billy'
language = 'no'
url = 'http://www.billy.no/'
start_date = '1950-01-01'
active = False
rights = 'Mort Walker'
class Crawler(CrawlerBase):
def c... | datagutten/comics | comics/comics/billy.py | Python | agpl-3.0 | 384 |
from setuptools import setup, find_packages
XMODULES = [
"abtest = xmodule.abtest_module:ABTestDescriptor",
"book = xmodule.backcompat_module:TranslateCustomTagDescriptor",
"chapter = xmodule.seq_module:SequenceDescriptor",
"combinedopenended = xmodule.combined_open_ended_module:CombinedOpenEndedDescri... | pku9104038/edx-platform | common/lib/xmodule/setup.py | Python | agpl-3.0 | 3,169 |
#!/usr/bin/env python
#
# Freesound is (c) MUSIC TECHNOLOGY GROUP, UNIVERSITAT POMPEU FABRA
#
# Freesound is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your ... | MTG/pycompmusic | compmusic/extractors/imagelib/wav2png.py | Python | agpl-3.0 | 3,050 |
# -*- coding: utf-8 -*-
#===============================================================================
# Custom res_users object
# Add an CAFAT ID for use in New Caledonia
#===============================================================================
from openerp.osv import fields, osv, orm
from openerp.tools.trans... | frouty/odoogoeen | extra-addons/oph/oph/custom/oph_res_users.py | Python | agpl-3.0 | 773 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/osis | base/forms/entity.py | Python | agpl-3.0 | 2,540 |
##############################################################################
# MDTraj: A Python Library for Loading, Saving, and Manipulating
# Molecular Dynamics Trajectories.
# Copyright 2012-2017 Stanford University and the Authors
#
# Authors: Robert McGibbon
# Contributors:
#
# MDTraj is free software: y... | leeping/mdtraj | tests/test_reporter.py | Python | lgpl-2.1 | 7,439 |
# Copyright 2013-2020 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)
import pytest
from spack.main import SpackCommand
versions = SpackCommand('versions')
def test_safe_only_versions():
... | iulian787/spack | lib/spack/spack/test/cmd/versions.py | Python | lgpl-2.1 | 1,677 |
############################################################################
#
# Copyright (C) 2015 The Qt Company Ltd.
# Contact: http://www.qt.io/licensing
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the comm... | kuba1/qtcreator | share/qtcreator/debugger/creatortypes.py | Python | lgpl-2.1 | 5,087 |
#!/usr/bin/env python
from basetest import BaseTest
import sys, tempfile, os, time
import unittest
import data
sys.path.insert(0, '..')
from zeroinstall.injector import model, gpg, trust
from zeroinstall.injector.namespaces import config_site
from zeroinstall.injector.iface_cache import PendingFeed
from zeroinstall.su... | pombredanne/zero-install | tests/testifacecache.py | Python | lgpl-2.1 | 4,642 |
#!PYRTIST:VERSION:0:0:1
from pyrtist.lib2d import Point, Tri
#!PYRTIST:REFPOINTS:BEGIN
bbox1 = Point(0.0, 50.0); bbox2 = Point(100.0, 12.5838926174)
p1 = Point(3.15540458874, 46.942241204)
p2 = Point(3.23537580547, 42.1395946309)
p4 = Point(28.5119375629, 38.1285583893)
q1 = Point(73.1545885714, 21.8120805369)
q3 = Poi... | mfnch/pyrtist | pyrtist/examples/tutorial03-curved_polys.py | Python | lgpl-2.1 | 1,984 |
# -*- coding: utf-8 -*-
# ####################################################################
# Copyright (C) 2005-2009 by the FIFE team
# http://www.fifengine.de
# This file is part of FIFE.
#
# FIFE is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General P... | mgeorgehansen/FIFE_Technomage | engine/python/fife/extensions/pychan/widgets/ext/__init__.py | Python | lgpl-2.1 | 1,492 |
#!/usr/bin/python
import sys
import requests
try:
url = sys.argv[1]
r = requests.get('http://%s' %url ,timeout=3)
except requests.exceptions.Timeout:
print 'url timeout\n%s' %url
sys.exit(2)
except:
print 'url error \n%s' %url
sys.exit(2)
url_status = r.status_code
if ... | XiaJieCom/change | document/Service/nagios/nrpe/check_url.py | Python | lgpl-2.1 | 489 |
# cerbero - a multi-platform build system for Open Source software
# Copyright (C) 2012 Andoni Morales Alastruey <ylatuya@gmail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; eit... | sdroege/cerbero | cerbero/utils/git.py | Python | lgpl-2.1 | 8,593 |
#!/usr/bin/python
"""Test of table output."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(KeyComboAction("End"))
sequence.append(KeyComboAction("Up"))
sequence.append(KeyComboAction("<Shift>Right"))
sequence.append(KeyComboAction("Down"))
sequence.append(KeyComboAction("R... | chrys87/orca-beep | test/keystrokes/gtk-demo/role_table.py | Python | lgpl-2.1 | 3,344 |
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2019 Sergey Astanin
# https://bitbucket.org/astanin/python-tabulate
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, includ... | anlambert/tulip | doc/python/tabulate.py | Python | lgpl-3.0 | 60,926 |
{
"name": "Delivery Sequence",
"vesion": "12.0.1.0.0",
"author": "IT-Projects LLC, Ivan Yelizariev",
"license": "LGPL-3",
"category": "Custom",
"website": "https://yelizariev.github.io",
"depends": ["delivery"],
"data": ["views.xml"],
"installable": False,
}
| yelizariev/addons-yelizariev | delivery_sequence/__manifest__.py | Python | lgpl-3.0 | 295 |
#!/usr/bin/python3
#from __future__ import print_function
from setuptools import setup, Extension
import sys
import os
import psutil
# monkey-patch for parallel compilation
def parallelCCompile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=No... | peter-ch/MultiNEAT | setup.py | Python | lgpl-3.0 | 5,190 |
"""A module for handling and accessing both the in-memory, and on-disk,
representation of a set of routes as a set of segments. Where each segment
specifies its start and end stop ids, and other data (see
topology_shapefile_data_model.py for more."""
import sys
import csv
import re
import operator
import itertools
i... | PatSunter/SimpleGTFSCreator | route_segs.py | Python | lgpl-3.0 | 52,470 |
# -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2019 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | nicolargo/glances | glances/outputs/glances_curses.py | Python | lgpl-3.0 | 47,546 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
import pytest
from numpy import isclose
from dolfin import (assemble, dx, Function, FunctionSpace, grad, inner, solve, TestFunction, TrialFunction,
UnitSquareMesh)
from rb... | mathLab/RBniCS | tests/performance/backends/dolfin/test_dolfin_linear_solver.py | Python | lgpl-3.0 | 3,651 |
# -*- coding: utf-8 -*-
import re
from DelogX.utils.i18n import I18n
from DelogX.utils.path import Path
from DelogX.utils.plugin import Plugin
class DelogReadMore(Plugin):
i18n = None
def run(self):
conf = self.blog.default_conf
self.i18n = I18n(
Path.format_url(s... | deluxghost/DelogX | DelogX/defaults/plugins/delog_readmore/__init__.py | Python | lgpl-3.0 | 1,320 |
# Generated by Django 2.0.8 on 2018-11-05 20:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tickets', '0008_auto_20180730_2035'),
]
operations = [
migrations.AlterModelOptions(
name='ticket',
options={'default_permis... | IntegratedAlarmSystem-Group/ias-webserver | tickets/migrations/0009_auto_20181105_2039.py | Python | lgpl-3.0 | 383 |
# -*- 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 'Category'
db.create_table(u'core_category', (
... | jplusplus/dystopia-tracker | app/core/migrations/0001_initial.py | Python | lgpl-3.0 | 9,322 |
from msaf.models import dbsession, Sample, Marker, Batch
from msaf.lib.analytics import SampleSet
from itertools import cycle
import yaml
def load_yaml(yaml_text):
d = yaml.load( yaml_text )
instances = {}
for k in d:
if k == 'selector':
instances['selector'] = Selector.from_dic... | trmznt/msaf | msaf/lib/queryutils.py | Python | lgpl-3.0 | 4,648 |
#!/usr/bin/env python
# pylint: disable=R0903
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2021
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public L... | leandrotoledo/python-telegram-bot | telegram/parsemode.py | Python | lgpl-3.0 | 1,783 |
# -*- coding: utf-8 -*-
"""
Base version of package/tasks.py, created by version 0.3.0 of
package/root/dir> dk-tasklib install
(it should reside in the root directory of your package)
This file defines tasks for the Invoke tool: http://www.pyinvoke.org
Basic usage::
inv -l # list all availabl... | datakortet/dk | tasks.py | Python | lgpl-3.0 | 4,792 |
from typing import Optional
from UM.Logger import Logger
from cura.CuraApplication import CuraApplication
from cura.PrinterOutput.Models.MaterialOutputModel import MaterialOutputModel
from .BaseCloudModel import BaseCloudModel
## Class representing a cloud cluster printer configuration
# Spec: https://api-staging.... | Patola/Cura | plugins/UM3NetworkPrinting/src/Cloud/Models/CloudClusterPrinterConfigurationMaterial.py | Python | lgpl-3.0 | 3,000 |
import weakref
import logging
logger = logging.getLogger(__name__)
import core.cons as cons
from core.api import api
from core.config import conf
from qt import signals
#Config parser
OPTION_IP_RENEW_ACTIVE = "ip_renew_active"
OPTION_RENEW_SCRIPT_ACTIVE = "renew_script_active"
class IPRenewerGUI:
""""""
de... | nitely/ochDownloader | addons/ip_renewer/ip_renewer_gui.py | Python | lgpl-3.0 | 2,017 |
# (C) British Crown Copyright 2010 - 2014, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | Jozhogg/iris | tools/generate_std_names.py | Python | lgpl-3.0 | 4,434 |
#!/usr/bin/env python3
# coding: utf-8
"""Launcher of the Mikado pick step."""
import argparse
import re
import sys
import os
from typing import Union, Dict
from ._utils import check_log_settings_and_create_logger, _set_pick_mode
import marshmallow
from ..configuration import DaijinConfiguration, MikadoConfiguration
... | lucventurini/mikado | Mikado/subprograms/pick.py | Python | lgpl-3.0 | 23,916 |
#! /usr/bin/env python3
# suff
#
# show different suffixes amongst arguments
import sys
def main():
files = sys.argv[1:]
suffixes = {}
for filename in files:
suff = getsuffix(filename)
suffixes.setdefault(suff, []).append(filename)
for suff, filenames in sorted(suffixe... | Orav/kbengine | kbe/src/lib/python/Tools/scripts/suff.py | Python | lgpl-3.0 | 536 |
#!/usr/bin/env python3
#----------------------------------------------------------------------------
#
# Copyright (C) 2015 José Flávio de Souza Dias Júnior
#
# This file is part of CXXII - http://www.joseflavio.com/cxxii/
#
# CXXII is free software: you can redistribute it and/or modify
# it under the terms of the... | joseflaviojr/cxxii | CXXII.py | Python | lgpl-3.0 | 20,202 |
# -*- coding: utf-8 -*-
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import res_country
| odoobgorg/addons | base_iso3166/models/__init__.py | Python | lgpl-3.0 | 120 |
# (C) British Crown Copyright 2010 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | Jozhogg/iris | lib/iris/tests/test_ff.py | Python | lgpl-3.0 | 13,420 |
"""
Testing for the tree module (sklearn.tree).
"""
import numpy as np
from numpy.testing import assert_array_equal
from numpy.testing import assert_array_almost_equal
from numpy.testing import assert_almost_equal
from numpy.testing import assert_equal
from nose.tools import assert_raises
from nose.tools import assert... | seckcoder/lang-learn | python/sklearn/sklearn/tree/tests/test_tree.py | Python | unlicense | 15,491 |
def bytes_to_long(foo):
return 0
def long_to_bytes(foo):
return '\0'
| jerith/fake-plastic-pycrypto | Crypto/Util/number.py | Python | unlicense | 79 |
n = int(input())
st = [(-1, -2)]
s = 0
for i, h in enumerate(map(int, input().split() + [' -1'])):
if h > st[-1][1]:
st.append((i, h))
else:
while st[-1][1] >= h:
r = st.pop()
s = max(s, (i - r[0]) * r[1])
st.append((r[0], h))
print(s)
| altg0x0/info_tasks | 18/k.py | Python | unlicense | 292 |
from django.shortcuts import render
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
from django.contrib.auth import authenticate, login, logout, update_session_auth_hash
from django.core.exceptions import ObjectDoesNotExist
from django.core.cache import cache
from django.http im... | Matoking/pastebin-django | users/views.py | Python | unlicense | 14,332 |
#!/usr/bin/python
# NOTES
# This script will count the number of tweets within an output.txt file
import re
output = open("output.txt", "r");
regex = re.compile("\n\n");
newlinenewline = regex.findall(output.read());
print len(newlinenewline); | joekneebone/Most-Common-Words-on-Twitter | TweetCounter/count.py | Python | unlicense | 250 |
import h5py # HDF5 support
import os
import glob
import numpy as n
from scipy.interpolate import interp1d
import sys
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u
cosmoMD = FlatLambdaCDM(H0=67.77*u.km/u.s/u.Mpc, Om0=0.307115, Ob0=0.048206)
#status = 'create'
status = 'update'
path_to_lc = s... | JohanComparat/pyEmerge | bin_cluster/lc_add_clusters.py | Python | unlicense | 1,223 |
import operator
def pozicijaSprite(broj, x_velicina):
#vraca pixel na kojem se sprite nalazi
pixel = broj * (x_velicina + 1) #1 je prazan red izmedu spritova
return(pixel)
#spriteSlova = ["A", "B", "C", "D", "E", "F", "G", "H", "i", "s", "e"]
spriteSlova = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "s", ",",... | bebox/lhp | source/lhpFunctions.py | Python | unlicense | 6,564 |
# python3
"""
Mastermind without kivy - by Luis
merciless edited by hans
"""
import random
import re
class G():
valid_chars = '123456'
secret_len = 5
solved = '+' * secret_len
regex_str = "^[{0}]{{{1},{1}}}$".format(valid_chars, secret_len)
valid_input = re.compile(regex_str) # regular exp... | hans-boden/pyws-fablab-lisbon | contribs/luis_mp/mm_proposal_wo_kivi.py | Python | unlicense | 1,919 |
from __future__ import print_function
import httplib2
import io
import os
import sys
import time
import dateutil.parser
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from apiclient.http import MediaIoBaseDownload
import pprint
#Ch... | smacfiggen/horus | revert_osiris.py | Python | unlicense | 6,871 |
# 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... | cshallue/models | research/differential_privacy/multiple_teachers/analysis.py | Python | apache-2.0 | 10,988 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Isaku Yamahata <yamahata at private email ne jp>
# <yamahata at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with... | sileht/deb-openstack-quantum | quantum/plugins/ryu/nova/linux_net.py | Python | apache-2.0 | 2,786 |
#!/usr/bin/env python2
# find-kam-node.py: python2 example of loading kam, resolving kam node, and
# printing out BEL terms
#
# usage: find-kam-node.py <kam name> <source_bel_term>
from random import choice
from suds import *
from ws import *
import time
def load_kam(client, kam_name):
'''
... | OpenBEL/openbel-framework-examples | web-api/python/find-kam-node.py | Python | apache-2.0 | 2,020 |
"""
Weather component that handles meteorological data for your location.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/weather/
"""
import asyncio
import logging
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.he... | persandstrom/home-assistant | homeassistant/components/weather/__init__.py | Python | apache-2.0 | 4,851 |
import argparse
import parsl
from parsl.app.app import python_app
from parsl.tests.configs.local_threads import config
@python_app(cache=True)
def random_uuid(x, cache=True):
import uuid
return str(uuid.uuid4())
def test_python_memoization(n=2):
"""Testing python memoization disable
"""
x = ran... | Parsl/parsl | parsl/tests/test_python_apps/test_memoize_1.py | Python | apache-2.0 | 976 |
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2019 Uber Technologies, 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
#
# Unles... | uber/ludwig | ludwig/collect.py | Python | apache-2.0 | 15,469 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the L... | iwm911/plaso | plaso/formatters/android_calls.py | Python | apache-2.0 | 1,199 |
# 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... | naturali/tensorflow | tensorflow/contrib/framework/python/framework/tensor_util.py | Python | apache-2.0 | 11,844 |
import os
import unittest
import synapse
import synapse.lib.datfile as s_datfile
from synapse.tests.common import *
syndir = os.path.dirname(synapse.__file__)
class DatFileTest(SynTest):
def test_datfile_basic(self):
with s_datfile.openDatFile('synapse.tests/test.dat') as fd:
self.nn(fd)
... | vivisect/synapse | synapse/tests/test_lib_datfile.py | Python | apache-2.0 | 360 |
from django.test import TestCase
from django.core.urlresolvers import reverse
from working_waterfronts.working_waterfronts_api.models import Video
from django.contrib.auth.models import User
class EditVideoTestCase(TestCase):
"""
Test that the Edit Video page works as expected.
Things tested:
UR... | osu-cass/working-waterfronts-api | working_waterfronts/working_waterfronts_api/tests/views/entry/test_edit_video.py | Python | apache-2.0 | 2,965 |
from textwrap import dedent
import pytest
import salt.modules.pdbedit as pdbedit
from tests.support.mock import MagicMock, patch
@pytest.fixture(autouse=True)
def setup_loader(request):
setup_loader_modules = {pdbedit: {}}
with pytest.helpers.loader_mock(request, setup_loader_modules) as loader_mock:
... | saltstack/salt | tests/pytests/unit/modules/test_pdbedit.py | Python | apache-2.0 | 4,278 |
#!/usr/bin/python
# -*- coding: utf-8; -*-
#
# 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
#
# Unles... | locaweb/leela-client | try/python/test_leela/test_client/test_sensors/test_linux/test_disk_usage.py | Python | apache-2.0 | 1,191 |
# The content of this file was generated using the Python profile of libCellML 0.2.0.
from enum import Enum
from math import *
__version__ = "0.3.0"
LIBCELLML_VERSION = "0.2.0"
STATE_COUNT = 4
VARIABLE_COUNT = 18
class VariableType(Enum):
VARIABLE_OF_INTEGRATION = 1
STATE = 2
CONSTANT = 3
COMPUTED... | nickerso/libcellml | tests/resources/generator/hodgkin_huxley_squid_axon_model_1952/model.computed.constant.py | Python | apache-2.0 | 5,432 |
# coding=utf-8
from setuptools import setup
from setuptools.command.test import test
class TestHook(test):
def run_tests(self):
import nose
nose.main(argv=['nosetests', 'tests/', '-v', '--logging-clear-handlers'])
setup(
name='lxml-asserts',
version='0.1.2',
description='Handy funct... | SuminAndrew/lxml-asserts | setup.py | Python | apache-2.0 | 1,329 |
"""
Initialization script for restapi for the application.
"""
from flask import Blueprint
from app.common.logging import setup_logging
api = Blueprint('api', __name__)
# Setup logger
# api_log = setup_logging(__name__, 'logs/api.log', maxFilesize=1000000,
# backup_count=5)
from . import vie... | ibbad/dna-lceb-web | app/api_v1_0/__init__.py | Python | apache-2.0 | 331 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-appengine-admin | samples/generated_samples/appengine_v1_generated_instances_delete_instance_sync.py | Python | apache-2.0 | 1,530 |
# python3
class HeapBuilder:
def __init__(self):
self._swaps = []
self._data = []
def ReadData(self):
n = int(input())
self._data = [int(s) for s in input().split()]
assert n == len(self._data)
def WriteResponse(self):
print(len(self._swaps))
for swap in self._swaps:
print(swa... | xunilrj/sandbox | courses/coursera-sandiego-algorithms/data-structures/assignment002/make_heap/build_heap.py | Python | apache-2.0 | 1,100 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | smu/geometry/smu_molecule.py | Python | apache-2.0 | 12,148 |
"""Copyright 2008 Orbitz WorldWide
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... | g76r/graphite-web | webapp/graphite/settings.py | Python | apache-2.0 | 6,812 |
import time
def current_millis():
return int(round(time.time() * 1000))
| bugy/rebuilder | utils/date_utils.py | Python | apache-2.0 | 78 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 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.apac... | JioCloud/oslo-incubator | tests/unit/middleware/test_context.py | Python | apache-2.0 | 3,034 |
import unittest
import config_test
from backupcmd.commands import backupCommands
class BackupCommandsTestCase(unittest.TestCase):
"""Test commands passed to main script"""
def test_hyphen_r_option(self):
print 'Pending BackupCommandsTestCase'
self.assertEqual(1,1)
| ChinaNetCloud/nc-backup-py | nc-backup-py/tests/backup_main_commands_test.py | Python | apache-2.0 | 293 |
#! /usr/bin/env python
"""
Simulate DSR over a network of nodes.
Revision Info
=============
* $LastChangedBy: mandke $
* $LastChangedDate: 2011-10-26 21:51:40 -0500 (Wed, 26 Oct 2011) $
* $LastChangedRevision: 5314 $
:author: Ketan Mandke <kmandke@mail.utexas.edu>
:copyright:
Copyright 2009-2011 The Universit... | reidlindsay/wins | sandbox/experiments/dsr/icc/test.py | Python | apache-2.0 | 15,846 |
class Customer:
def __init__(self, firstname, lastname, country, address, postcode, city, email, phone, password):
self.firstname = firstname
self.lastname = lastname
self.country = country
self.address = address
self.postcode = postcode
self.city= city
sel... | Dob3r/python_seleniumwebdriver | Model/Customer.py | Python | apache-2.0 | 493 |
# -*- coding: utf-8 -*-
import copy
import datetime
import json
import logging
import subprocess
import sys
import warnings
from email.mime.text import MIMEText
from email.utils import formatdate
from smtplib import SMTP
from smtplib import SMTP_SSL
from smtplib import SMTPAuthenticationError
from smtplib import SMTPEx... | jetyang2005/elastalert | elastalert/alerts.py | Python | apache-2.0 | 55,913 |
# coding=utf-8
#下面的代码是接口函数,无关
def get(ar,index):
l=len(ar);
if index<0:
return ar[l+index];
else:
return ar[index];
def find(ar,filter):
for r in ar:
if filter(r):
return r;
return None;
def execute(ar,filter,action):
for r in ar:
if filter(r):
action(r);
unabled=[户型图存储方案,户型图存储,安居客户型列表,安居客评价... | ferventdesert/Hawk-Projects | 安居客/安居客.py | Python | apache-2.0 | 2,402 |
# coding=utf-8#
# Copyright (c) 2014-2018, F5 Networks, 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 applicabl... | F5Networks/f5-openstack-agent | f5_openstack_agent/lbaasv2/drivers/bigip/icontrol_driver.py | Python | apache-2.0 | 112,266 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2012, The Honeynet Project. All rights reserved.
# Author: Kun Yang <kelwya@gmail.com>
#
# APKIL is free software: you can redistribute it and/or modify it under
# the terms of version 3 of the GNU Lesser General Public License as
# published by the Free Soft... | JulianSchuette/android-instrumentation | injector/injector/apk.py | Python | apache-2.0 | 726 |
"""
Predict labels using trained ML models. Use average probability ensemble.
"""
__author__ = 'bshang'
import numpy as np
import pandas as pd
from sklearn import preprocessing
from sklearn.externals import joblib
def convert_label_to_array(str_label):
str_label = str_label.split(' ')
return [int(x) for x ... | bzshang/yelp-photo-classification | scripts/test_ml.py | Python | apache-2.0 | 1,851 |
import re
from models.contact import Contact
def test_all_contacts_on_homepage(app, db):
if app.contact.count() == 0:
app.contact.add(Contact(first_name="Mister", last_name="Muster", mobile_phone="123", email_1="test@test.com"))
contacts_from_homepage = sorted(app.contact.get_contact_list(), key = Cont... | rgurevych/python_for_testers | tests/test_contacts_data_compliance.py | Python | apache-2.0 | 3,163 |
"""Shared class to maintain Plex server instances."""
import logging
import ssl
import time
from urllib.parse import urlparse
from plexapi.client import PlexClient
from plexapi.exceptions import BadRequest, NotFound, Unauthorized
import plexapi.myplex
import plexapi.playqueue
import plexapi.server
from requests import... | lukas-hetzenecker/home-assistant | homeassistant/components/plex/server.py | Python | apache-2.0 | 25,421 |
# Lint as: python2, python3
# 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
#
#... | googleinterns/wss | third_party/deeplab/core/dense_prediction_cell.py | Python | apache-2.0 | 12,180 |
import asyncore, socket, logging, time, asynchat, os
from hdfs_space_common import get_tree_from_cache, get_child_node, TreeNode
FORMAT = '%(asctime)-15s: %(levelname)s %(module)s - %(funcName)s: %(message)s'
logging.basicConfig(format=FORMAT, level=logging.WARNING)
class ChatHandler(asynchat.async_chat):
def __ini... | arshvin/scripts | zabbix/T_hdfs_space_checker/hdfs_space_metric_server.py | Python | apache-2.0 | 3,517 |
from nltk.tokenize import sent_tokenize,word_tokenize
from nltk.corpus import stopwords
from collections import defaultdict
from string import punctuation
from heapq import nlargest
import re
"""
Modified from http://glowingpython.blogspot.co.uk/2014/09/text-summarization-with-nltk.html
"""
class FrequencySummarizer... | rebeccamorgan/easyskim | nat_proc/FrequencySummarizer.py | Python | apache-2.0 | 2,032 |
#!/usr/bin/python
#
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
#
# 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/LICE... | nouiz/fredericbastien-ipaddr-py-speed-up | tags/2.1.0/ipaddr.py | Python | apache-2.0 | 58,769 |
# directory = 'Congressional_Bill_Corpus.v1.00/raw/'
directory = ''
text_file = directory + 'billtext_org.json'
labels_file = directory + 'train.json'
output_dir = '/Users/katya/datasets/congress_bills_2/'
import sys
#pcogennen noah's congress_bills_2 into useable format
#to dict:
def skip_ahead_n_quotes(line, char... | Noahs-ARK/ARKcat | src/scripts_and_misc/process_json.py | Python | apache-2.0 | 2,711 |
#!/usr/bin/python
# Copyright 2016 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/LICENSE-2.0
#
# Unless required by appli... | illfelder/compute-image-packages | packages/python-google-compute-engine/setup.py | Python | apache-2.0 | 3,041 |
#!/usr/bin/env python
# coding=utf-8
from webapp.web import Application
from handlers.index import IndexHandler
from handlers.register import RegisterHandler
from handlers.user import UserHandler
from handlers.signin import SigninHandler
from handlers.signout import SignoutHandler
from handlers.upload import UploadHan... | vincentpc/yagra | main.py | Python | apache-2.0 | 955 |