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 |
|---|---|---|---|---|---|
import argparse
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
import os
from balbec.jsonhandler import JSONHandler
from balbec.xmlhandler import XmlHandler
ROOT = lambda base : os.path.join(os.path.dirname(__file__), base).replace('\\','/')
class St... | KristianOellegaard/python-nagios-frontend | balbec/balbec_twisted.py | Python | agpl-3.0 | 1,355 |
from django import forms
from django.contrib.auth.models import User
from harnas.userprofile.models import UserProfile
class UserProfileEditForm(forms.ModelForm):
class Meta:
model = UserProfile
fields = ('organization', 'personal_page', 'show_email', 'show_age')
class UserFieldsForm(forms.Model... | harnasproject/harnas | harnas/userprofile/forms.py | Python | agpl-3.0 | 409 |
"""
Calculates peak load per load area
"""
__copyright__ = "Reiner Lemoine Institut, Flensburg University of Applied Sciences, Centre for Sustainable Energy Systems"
__license__ = "GNU Affero General Public License Version 3 (AGPL-3.0)"
__url__ = "https://github.com/openego/data_processing/blob/master/LICENSE"
__a... | openego/data_processing | dataprocessing/python_scripts/ego_dp_loadarea_peakload.py | Python | agpl-3.0 | 10,383 |
# Learn Python -- level 2 logic
# Copyright (C) 2013 Cornell FB Hackathon Team.
#
# This program 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 option) an... | pniedzielski/fb-hackathon-2013-11-21 | src/py/level3.py | Python | agpl-3.0 | 1,260 |
from . import cmis_backend
from . import ir_model_fields
| acsone/alfodoo | cmis_field/models/__init__.py | Python | agpl-3.0 | 57 |
#!/usr/bin/env python3
"""
This script can be used to automatically pull translations from Transifex,
commit, push, and merge them to their respective repos.
To use, export an environment variable `GITHUB_ACCESS_TOKEN`. The token requires
GitHub's "repo" scope.
Run the script from the root of this repo.
python t... | edx/ecommerce-scripts | transifex/pull.py | Python | agpl-3.0 | 4,324 |
# -*- coding: utf-8 -*-
#
# OpenCraft -- tools to aid developing and hosting free software projects
# Copyright (C) 2015-2019 OpenCraft <contact@opencraft.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
# published by the Fre... | open-craft/opencraft | api/urls.py | Python | agpl-3.0 | 2,688 |
# Copyright (c) 2014 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
from dace.processdefinition.processdef import ProcessDefinition
from dace.processdefinition.activitydef import ActivityDefinition
from dace.processdefinition.gatewaydef ... | ecreall/lagendacommun | lac/content/processes/social_applications_management/definition.py | Python | agpl-3.0 | 3,478 |
""" Tests for utils. """
import collections
from datetime import datetime, timedelta
from pytz import UTC
from django.test import TestCase
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import Module... | romain-li/edx-platform | cms/djangoapps/contentstore/tests/test_utils.py | Python | agpl-3.0 | 26,121 |
# Copyright 2019 Tecnativa - David
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import logging
from odoo import SUPERUSER_ID, api
_logger = logging.getLogger(__name__)
def pre_init_hook(cr):
"""Speed up the installation of the module on an existing Odoo instance"""
cr.execute(
""... | OCA/stock-logistics-workflow | stock_return_request/hooks.py | Python | agpl-3.0 | 3,276 |
"""This file contains (or should), all access control logic for the courseware.
Ideally, it will be the only place that needs to know about any special settings
like DISABLE_START_DATES"""
import logging
from datetime import datetime, timedelta
import pytz
from django.conf import settings
from django.contrib.auth.mode... | UQ-UQx/edx-platform_lti | lms/djangoapps/courseware/access.py | Python | agpl-3.0 | 20,899 |
from django.db import models
import datetime
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from iati_synchroniser.dataset_syncer import DatasetSyncer
from iati_synchroniser.codelist_importer import CodeListImporter
from iati.parser import Parser
from iati_synchron... | schlos/OIPA-V2.1 | OIPA/iati_synchroniser/models.py | Python | agpl-3.0 | 5,972 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import reque... | superdesk/superdesk-aap | server/aap/macros/abs_indicators.py | Python | agpl-3.0 | 6,529 |
# -*- coding: utf-8 -*-
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2014, GEM Foundation
# OpenQuake 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 Licen... | g-weatherill/oq-risklib | openquake/calculators/calc.py | Python | agpl-3.0 | 9,525 |
# -*- coding: utf-8 -*-
# Copyright 2017 Matmoz d.o.o. (<http://www.matmoz.si>).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
| sysadminmatmoz/pmis | change_management/__init__.py | Python | agpl-3.0 | 173 |
# -*- coding: utf-8 -*-
##############################################################################
#
# This program 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 L... | odoo-arg/odoo_l10n_ar | l10n_ar_sale/tests/__init__.py | Python | agpl-3.0 | 955 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
#
# ODOO (ex OpenERP)
# Open Source Management Solution
# Copyright (C) 2001-2015 Micronaet S.r.l. (<https://micronaet.com>)
# Developer: Nicola Riolini @thebrush (<https://it.linkedin.com/in/thebr... | Micronaet/micronaet-product | inventory_status_assign_wizard/assign_wizard.py | Python | agpl-3.0 | 9,908 |
import os
import pickle
import csv
import pandas as pd
import math
from functools import lru_cache, reduce
from collections import defaultdict
USE_ROME_SLICING_DATASET = False # Rome slicing dataset is not ready yet
if USE_ROME_SLICING_DATASET:
OGR_ROME_FILE = "rome_slicing_dataset/ogr_rome_mapping.csv"
ROM... | StartupsPoleEmploi/labonneboite | labonneboite/common/load_data.py | Python | agpl-3.0 | 8,478 |
"""
Forms for the project application
"""
# Django
from django import forms
# Third Party
from dal import forward
from dal.autocomplete import TaggitSelect2
from taggit.forms import TagField
# MuckRock
from muckrock.core import autocomplete
from muckrock.project.models import Project
class ProjectCreateForm(forms.... | MuckRock/muckrock | muckrock/project/forms.py | Python | agpl-3.0 | 3,167 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have purchased from
# Numenta, Inc. a separate commercial license for this software code, the
# following terms and conditions apply:
#
# This pro... | scottpurdy/nupic | tests/unit/nupic/regions/anomaly_likelihood_region_test.py | Python | agpl-3.0 | 4,989 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of graphite
"""
def get_name(friendly=False):
"""Get name of this resource
:return: name of this resource
:rtype: str
"""
if friendly: # pragma: no cover
return 'Graphite connection'
return 'graphite'
def get_do... | Alignak-monitoring-contrib/alignak-backend | alignak_backend/models/graphite.py | Python | agpl-3.0 | 6,079 |
##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# @author: Théo Nikles <theo.nikles@gmail.com>
#
# The licence is in the file __manifest__.py
#
########################################################################... | CompassionCH/compassion-modules | mobile_app_connector/migrations/12.0.1.0.1/post-migration.py | Python | agpl-3.0 | 660 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logg... | sivakuna-aap/superdesk-core | superdesk/io/commands/update_ingest.py | Python | agpl-3.0 | 22,300 |
from . import db
from .assoc import section_professor
class Professor(db.Model):
__tablename__ = 'professors'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), unique=True)
first_name = db.Column(db.Text, nullable=False)
last_name = db.Column... | SCUEvals/scuevals-api | scuevals_api/models/professor.py | Python | agpl-3.0 | 905 |
# -*- coding: utf-8 -*-
# © 2014 Elico Corp (https://www.elico-corp.com)
# Licence AGPL-3.0 or later(http://www.gnu.org/licenses/agpl.html)
from . import product
from . import stock
from . import wizard
from . import product_price_history
from . import account_anglo_saxon_pos
from . import purchase
| Elico-Corp/openerp-7.0 | stock_landed_costs/__init__.py | Python | agpl-3.0 | 303 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import zmq
import threading
import logging
import logging.handlers
import util
class Logger(threading.Thread):
"""logger for all messages and events"""
def __init__(self, stop_logging, filename='bus.log'):
super(Logger, self).__init__()
self.filename = filename
se... | ross128/pybus | bus.py | Python | agpl-3.0 | 2,629 |
# Copyright 2015 Antiun Ingenieria S.L. - Javier Iniesta
# Copyright 2016 Tecnativa S.L. - Vicent Cubells
# Copyright 2016 Tecnativa S.L. - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo.exceptions import UserError, ValidationError
from odoo.tests import common
class T... | OCA/partner-contact | partner_industry_secondary/tests/test_res_partner_industry.py | Python | agpl-3.0 | 1,860 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-09-05 09:13
from __future__ import unicode_literals
import uuid
from django.core.exceptions import FieldDoesNotExist
from django.db import migrations
def set_uuid_field(apps, schema_editor):
"""
Set a random uuid value to all existing rows in all mod... | uclouvain/osis | base/migrations/0063_populate_uuid_values.py | Python | agpl-3.0 | 969 |
"""
Urls for idea app
"""
from django.conf.urls import url
from openedx.features.idea.api_views import FavoriteAPIView
from openedx.features.idea.views import ChallengeLandingView, IdeaCreateView, IdeaDetailView, IdeaListingView
urlpatterns = [
url(
r'^overview/$',
ChallengeLandingView.as_view(),
... | philanthropy-u/edx-platform | openedx/features/idea/urls.py | Python | agpl-3.0 | 799 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | CLVsol/odoo_addons | clv_medicament_template/wkf/__init__.py | Python | agpl-3.0 | 1,439 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.21 on 2020-04-21 06:55
from __future__ import unicode_literals
from django.db import migrations
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('idea', '0002_idea_favorites'),
]
op... | philanthropy-u/edx-platform | openedx/features/idea/migrations/0003_auto_20200421_0255.py | Python | agpl-3.0 | 804 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | skosukhin/spack | var/spack/repos/builtin/packages/numdiff/package.py | Python | lgpl-2.1 | 2,791 |
"""
httpdatehelper
==============
:Module: pyfileserver.httpdatehelper
:Author: Ho Chun Wei, fuzzybr80(at)gmail.com
:Project: PyFileServer, http://pyfilesync.berlios.de/
:Copyright: Lesser GNU Public License, see LICENSE file attached with package
HTTP dates helper - an assorted library of helpful date funct... | cwho/pyfileserver | PyFileServer/pyfileserver/httpdatehelper.py | Python | lgpl-2.1 | 2,135 |
#!/usr/bin/python
#
# Copyright (C) Citrix Systems Inc.
#
# This program 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; version 2.1 only.
#
# This program is distributed in the hope that it will be use... | pritha-srivastava/sm | drivers/LVHDoFCoESR.py | Python | lgpl-2.1 | 3,290 |
# -*- coding: utf-8 -*-
from pysignfe.xml_sped import *
from .ConsultarSituacaoLoteRps import ListaMensagemRetorno
from .Rps import IdentificacaoPrestador, IdentificacaoRps
from .Nfse import CompNfse
import os
DIRNAME = os.path.dirname(__file__)
class ConsultarLoteRpsEnvio(XMLNFe):
def _... | thiagopena/PySIGNFe | pysignfe/nfse/bhiss/v10/ConsultarLoteRps.py | Python | lgpl-2.1 | 2,448 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgarren/spack | var/spack/repos/builtin/packages/fastqvalidator/package.py | Python | lgpl-2.1 | 2,230 |
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
#
# Copyright (C) 2011-2012 Johan Dahlin <johan@gnome.org>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Founda... | ceibal-tatu/pygobject | gi/pygtkcompat.py | Python | lgpl-2.1 | 14,279 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | EmreAtes/spack | var/spack/repos/builtin/packages/py-bsddb3/package.py | Python | lgpl-2.1 | 1,821 |
from collections.abc import Sequence, Iterable
from functools import total_ordering
import fnmatch
import linecache
import os.path
import pickle
# Import types and functions implemented in C
from _tracemalloc import *
from _tracemalloc import _get_object_traceback, _get_traces
def _format_size(size, sign... | prefetchnta/questlab | bin/x64bin/python/37/Lib/tracemalloc.py | Python | lgpl-2.1 | 17,610 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# * This Program is free software; you can redistribute it and/or
# * modify it under the terms of the GNU Lesser General Public
# * License as published by the Free Software Foundation; either
# * version 2.1 of the License, or (at your option) any later version.
# *
# *... | UbiCastTeam/gst-gtklaunch-1.0 | main.py | Python | lgpl-2.1 | 941 |
import pytest
from forte.solvers import solver_factory, HF, ActiveSpaceSolver
def test_detci_4():
"""CASCI test of Forte DETCI using the SparseList algorithm to build the sigma vector"""
ref_hf_energy = -99.977636678461636
ref_fci_energy = -100.113732484560970
xyz = """
F
H 1 1.0
"""
... | evangelistalab/forte | tests/pytest-methods/detci/test_detci-4.py | Python | lgpl-3.0 | 986 |
"""Glyph-specific queries on font-files"""
from ttfquery import describe
try:
from OpenGLContext.debug.logs import text_log
except ImportError:
text_log = None
def hasGlyph( font, char, encoding=None ):
"""Check to see if font appears to have explicit glyph for char"""
glyfName = explicitGlyph( font, c... | stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/ttfquery/glyphquery.py | Python | lgpl-3.0 | 3,146 |
import attr
import struct
import math
import re
import copy
from datablock import Datablock
from record import Record
from rowid import Rowid
@attr.s
class TableDatablock(Datablock):
header = attr.ib(default=[])
records = attr.ib(default=[])
def get_data(self):
"""
Convert header and reco... | pedrovanzella/bstar-tree | table_datablock.py | Python | lgpl-3.0 | 7,201 |
"""
Created on June 10, 2012
@author: peta15
"""
from wtforms import fields
from wtforms import Form
from wtforms import validators
from lib import utils
from webapp2_extras.i18n import lazy_gettext as _
from webapp2_extras.i18n import ngettext, gettext
FIELD_MAXLENGTH = 50 # intended to stop maliciously long input
... | roninio/gae-boilerplate | boilerplate/forms.py | Python | lgpl-3.0 | 5,505 |
import pyblish.api
import maya.cmds as cmds
import pymel
class ValidateDisplaylayer(pyblish.api.Validator):
""" Ensure no construction history exists on the nodes in the instance """
families = ['scene']
optional = True
label = 'Modeling - Display Layers'
def process(self, instance):
"""... | ProgressiveFX/pyblish-pfx | pyblish_pfx/plugins/maya/modeling/_validate_displaylayer.py | Python | lgpl-3.0 | 692 |
"""
YANK, a package for alchemical free energy calculations using OpenMM
"""
__author__ = "John D. Chodera"
__license__ = "GPL"
__maintainer__ = "John D. Chodera"
__email__ = "jchodera@gmail.com"
__version__ = "1.0beta"
from yank import Yank
import analysis
__all__ = ['Yank', 'analysis']
| choderalab/brokenyank | src/yank/__init__.py | Python | lgpl-3.0 | 294 |
#Run this file after automatic conversion of the VisualStudio 2008 solution by VisualStudio 2010.
#This can be done whenever the 2008 solution changes.
#It will make the necessary cleanup and updates to the vcxproj files
#the .props files need to be maintained by hand if the .vsprops files change
from __future__ ... | Orav/kbengine | kbe/src/lib/python/PCbuild/vs9to10.py | Python | lgpl-3.0 | 2,296 |
# Copyright Vinicius Castanheira (vncastanheira@gmail.com) - 2012
# This program is a part of the Noir Game.
# This program is under the Gnu LGPL.
from pygame import *
from pyganim import *
from entity import Entity
from bullet import Bullet
class Player(Entity):
def __init__(self, x, y, images):
Entity.__init__(... | vncastanheira/noirgame | player.py | Python | lgpl-3.0 | 3,021 |
# from pytigon_js.tools import history_push_state, correct_href, remove_element, process_resize
# from pytigon_js.ajax_region import mount_html
class Page:
def __init__(self, id, page):
self.id = id
self.page = page
def set_href(self, href):
self.page.attr("_href", href)
def get_... | Splawik/pytigon | pytigon/static_src/pytigon_js/tabmenu.py | Python | lgpl-3.0 | 5,498 |
# -*- 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 ... | vasconcelosfer/odoo-odisea | odisea/models/representative.py | Python | lgpl-3.0 | 4,870 |
#===============================================================================
import re
from untwisted.magic import sign
from channel import not_quiet
from runtime import later
import message
import util
import limit
import kakasi_lib
link, install, uninstall = util.LinkSet().triple()
#=========================... | joodicator/PageBot | page/kakasi.py | Python | lgpl-3.0 | 2,024 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This exercise shows some important concepts that you should be aware about:
- using codecs module to write unicode files
- using authentication with web APIs
- using offset when accessing web APIs
To run this code locally you have to register at the NYTimes developer s... | jtorrente/openstreetmap | jtorrente/openstreetmap/problemset1/ex3_nytimes.py | Python | lgpl-3.0 | 4,470 |
from datetime import datetime, timedelta
| ourbest/sns_app | utils/scheduler.py | Python | lgpl-3.0 | 41 |
import os
import apium.frameworks
def test_basic_task_run___state_is_consistent(port_num, running_worker):
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_test_project.settings'
apium.frameworks.setup()
| cryporchild/apium | tests/test_django.py | Python | lgpl-3.0 | 213 |
default_app_config = 'jobs.apps.JobConfig'
| SeiryuZ/HemeWeb | src/jobs/__init__.py | Python | lgpl-3.0 | 43 |
from button import Button
class SellButton(Button):
def __init__(self, image, x, y, parent):
super(SellButton, self).__init__(image, x, y, parent)
def get_clicked(self):
self.parent.sell_tower() | ToBaer94/PygameTowerDefense | buttons/sell_button.py | Python | lgpl-3.0 | 221 |
#!/usr/bin/env python
#
# Read doxygen xml files to find all members of the dolfin
# name space and generate API doc files per subdirectory of
# dolfin
#
# Written by Tormod Landet, 2017
#
from __future__ import print_function
import sys, os
import parse_doxygen
DOXYGEN_XML_DIR = 'doxygen/xml'
API_GEN_DIR = 'generate... | FEniCS/dolfin | doc/generate_api_rst.py | Python | lgpl-3.0 | 8,783 |
# -*- coding: utf8 -*-
from .player import PlayerEntity
from .base import MobEntity
from .item import ItemEntity
__all__ = [
'PlayerEntity',
'MobEntity',
'ItemEntity',
] | nosix/PyCraft | src/pycraft/service/composite/entity/__init__.py | Python | lgpl-3.0 | 188 |
#!/usr/local/bin/python
import pygame
from pygame.locals import *
import time
def init():
pygame.display.set_mode((800, 600))
def test_1():
def test(pressed, i):
if i == 0:
return
if pressed[K_a]:
print "K_a"
if pressed[K_b]:
print "K_b"
test(pressed, i -1)
pressed = pygame.key.get_pressed()
f... | Hiestaa/cognitive-racer | bench.py | Python | lgpl-3.0 | 856 |
#!/usr/bin/env python
import fileinput
class NotValidIP(Exception):
pass
class NotValidIPLength(Exception):
pass
while True:
try:
ip_addr = input("Enter a network IP address: ")
ip_addr_split = ip_addr.split('.')
len1 = len(ip_addr_split)
ip_addr_split = ip_addr_split[:3]
... | Noeud/KirkByers_Course | Week2/IPaddValidity_hex_bin.py | Python | unlicense | 1,174 |
# -*- coding: utf-8 -*-
VERSION = (0, 1, 6, 'final')
if VERSION[-1] != "final": # pragma: no cover
__version__ = '.'.join(map(str, VERSION))
else: # pragma: no cover
__version__ = '.'.join(map(str, VERSION[:-1]))
| arteria/django-shop-simplenotifications | shop_simplenotifications/__init__.py | Python | unlicense | 222 |
from pippi import dsp
from pippi import tune
def ping(maxlen=44100, freqs=None):
out = ''
if freqs is None:
freqs = [ dsp.rand(20,10000) for i in range(4) ]
tlen = dsp.randint(10, maxlen)
tones = [ dsp.tone(length=tlen, freq=freq, amp=0.1, wavetype='random')
for freq in freqs ]
... | lettersonsounds/twenty | score.py | Python | unlicense | 1,251 |
import unittest
import utils
def remove_backspace(s):
result = []
for ch in s:
if ch == '#':
if result:
result.pop()
else:
result.append(ch)
return result
# O(n) time. O(n) space. Stack.
class Solution:
def backspaceCompare(self, S: str, T: str... | chrisxue815/leetcode_python | problems/test_0844_stack.py | Python | unlicense | 744 |
#!/usr/bin/env python
__description__ = \
"""
compareAncestor.py
"""
__author__ = "Michael J. Harms"
__usage__ = "comapreAncestors.py ancestor_file1 ancestor_file2"
__date__ = "100726"
import sys, phyloBase
class CompareAncestorError(Exception):
"""
General error class for this module.
"""
pass
... | harmsm/phylo_tools | compareAncestors.py | Python | unlicense | 4,269 |
import difflib
class Repository:
def __init__(self, fname=None):
if not fname:
fname = '/usr/share/dict/words'
with open(fname) as f:
self.repository = [x.rstrip('\n') for x in f.readlines()]
def find_close_matches(r, w, count=3):
return difflib.get_clo... | amitsaha/learning | python/strings/difflib_closest_match.py | Python | unlicense | 697 |
###############################################################################
# $Id$
#
# Project: Sub1 project of IRRI
# Purpose: Quality Assessment extraction from MODIS
# Author: Yann Chemin, <yann.chemin@gmail.com>
#
###############################################################################
# Copyright (c... | YannChemin/wxGIPE | proc_modis_qc.py | Python | unlicense | 23,032 |
def estriangulo(a,b,c):
print("el primer argumento es:",a)
print("el segundo argumento es:",b)
print("el tercer argumento es:",c)
return a+b>c and a+c>b and c+b>a
def espitagorico(a,b,c):
return a**2+b**2==c**2 or a**2+c**2==b**2 or b**2+c**2==a**2
def esisosceles(a,b,c):
return a==b or a==c o... | jabaier/iic1103.20152.s4 | estriangulo_prueba.py | Python | unlicense | 428 |
import sys
import collections as c
from scipy import special, stats
import numpy as n, pylab as p, networkx as x
class NetworkDrawer:
drawer_count=0
def __init__(self,metric="strength"):
self.drawer_count+=1
metric_=self.standardizeName(metric)
self.metric_=metric_
self.draw_cou... | ttm/gmaneLegacy | gmaneLegacy/networkDrawer.py | Python | unlicense | 7,293 |
#!/usr/bin/env python
"""Test the collector flows."""
import os
from grr.client import vfs
from grr.lib import action_mocks
from grr.lib import aff4
from grr.lib import artifact
from grr.lib import artifact_lib
from grr.lib import artifact_test
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib impo... | defaultnamehere/grr | lib/flows/general/collectors_test.py | Python | apache-2.0 | 21,712 |
# Copyright 2015 OpenMarket Ltd
#
# 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 writin... | iot-factory/synapse | synapse/config/appservice.py | Python | apache-2.0 | 926 |
# 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 | smurf/smurf_models/raft_update.py | Python | apache-2.0 | 8,034 |
# Copyright (C) 2015 Nippon Telegraph and Telephone 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
#
# Unless required by appli... | coreswitch/openconfigd | vendor/github.com/osrg/gobgp/test/scenario_test/bgp_router_test.py | Python | apache-2.0 | 16,381 |
from setuptools import find_packages
from setuptools import setup
setup(
name='svs',
version='1.0.0',
description='The InAcademia Simple validation Service allows for the easy validation of affiliation (Student,'
'Faculty, Staff) of a user in Academia',
license='Apache 2.0',
classif... | its-dirg/svs | setup.py | Python | apache-2.0 | 1,148 |
# -*- 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-resource-manager | samples/generated_samples/cloudresourcemanager_v3_generated_folders_update_folder_sync.py | Python | apache-2.0 | 1,634 |
"""This module implements the Lovins stemming algorithm. Use the ``stem()``
function::
stemmed_word = stem(word)
"""
from whoosh.util.collections2 import defaultdict
# Conditions
def A(base):
# A No restrictions on stem
return True
def B(base):
# B Minimum stem length = 3
return len(base) >... | archatas/whoosh | whoosh/lang/lovins.py | Python | apache-2.0 | 12,657 |
from optparse import OptionParser
import re
import os
import sys
import numpy as np
from ..util import dirs
from ..util import file_handling as fh
from ..preprocessing import data_splitting as ds
from ..feature_extractors.vocabulary_with_counts import VocabWithCounts
def main():
usage = "%prog project"
pars... | dallascard/guac | core/lda/lda_preprocessing.py | Python | apache-2.0 | 4,593 |
#
# 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
# ... | rh-s/heat | heat/common/config.py | Python | apache-2.0 | 19,187 |
import os
import tempfile
import unittest
import logging
from pyidf import ValidationLevel
import pyidf
from pyidf.idf import IDF
from pyidf.compliance_objects import ComplianceBuilding
log = logging.getLogger(__name__)
class TestComplianceBuilding(unittest.TestCase):
def setUp(self):
self.fd, self.path ... | rbuffat/pyidf | tests/test_compliancebuilding.py | Python | apache-2.0 | 1,041 |
from .SlackIntegration import slackIntegration
import logging
from aiohttp import ClientSession
import asyncio
from time import perf_counter
class LoadApp():
def __init__(self):
self.logger = logging.getLogger('reliability')
self.app_visit_succeeded = 0
self.app_visit_failed = 0
se... | mffiedler/svt | reliability/tasks/utils/LoadApp.py | Python | apache-2.0 | 1,646 |
#! /usr/bin/env python
import subprocess
import sys, threading, Queue
import os
import string
from time import gmtime, strftime
import urllib2
import urllib
import re, time
import urlparse
import os.path
import logging
#from google import search
import scan
import executemechanize
import extraction
import mechanize
f... | Masood-M/yalih | malwebsites.py | Python | apache-2.0 | 2,519 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2014 Lukas Kemmer
#
# 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 require... | lukas-ke/faint-graphics-editor | py/faint/formatsvgz.py | Python | apache-2.0 | 1,026 |
# 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 | etcmodel/models/hotpotqa/data_utils.py | Python | apache-2.0 | 12,364 |
# -*- coding: utf-8 -*-
import pairing_heap as pheap
from copy import deepcopy,copy
import threading
import Queue
import requests
from requests.auth import HTTPDigestAuth
import json
import sys
import communication
import config
import time
import L_sprit
# グローバル変数の宣言
LIMIT_SELECTION = 0
SELECTON_RATE = 0
EXCHANGE_RAT... | SP2LC/procon25-main | A-star/L-dynamic.py | Python | apache-2.0 | 17,085 |
from xml.etree import ElementTree
from os.path import dirname, realpath
directory_of_sources = dirname(realpath(__file__)) + "/sources/"
d = {}
d['AR'] = "Arabic"
d['EN'] = "English"
d['ES'] = "Spanish"
d['FR'] = "French"
d['RU'] = "Russian"
d['ZH'] = "Mandarin"
filepath = '/tmp/uncorpora_plain_20090831.tmx'
count... | DanielJDufour/language-detector | language_detector/prep/parse_un.py | Python | apache-2.0 | 986 |
# -*- coding: utf-8 -*-
"""
module that specified how we choose paramaters based on current search database
properties
"""
from __future__ import absolute_import, division, print_function
#import six
import utool as ut
#import numpy as np
#import vtool as vt
#from ibeis.algo.hots import hstypes
#from ibeis.algo.hots im... | SU-ECE-17-7/ibeis | _broken/_old_qt_hs_matcher/automated_params.py | Python | apache-2.0 | 2,697 |
#
# Created as part of the StratusLab project (http://stratuslab.eu),
# co-funded by the European Commission under the Grant Agreement
# INFSO-RI-261552."
#
# Copyright (c) 2011, SixSq Sarl
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Lice... | StratusLab/client | api/code/src/main/python/stratuslab/Creator.py | Python | apache-2.0 | 20,097 |
# Copyright 2021 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 agreed to in writing, ... | google/jax-cfd | jax_cfd/spectral/time_stepping.py | Python | apache-2.0 | 8,747 |
import logging
import pickle
from typing import Dict, Optional, Union, List, Sequence
from ray.tune.result import DEFAULT_METRIC
from ray.tune.sample import Categorical, Domain, Float, Integer, LogUniform, \
Quantized
from ray.tune.suggest.suggestion import UNRESOLVED_SEARCH_SPACE, \
UNDEFINED_METRIC_MODE, UND... | richardliaw/ray | python/ray/tune/suggest/nevergrad.py | Python | apache-2.0 | 12,589 |
"""
ou are given two integer arrays, A and B, each containing N integers. The size of the array is less than or equal to
1000. You are free to permute the order of the elements in the arrays.
Now here's the real question: Is there an permutation A', B' possible of A and B, such that, A'i+B'i >= K for all i,
where A'i ... | algorhythms/HackerRankAlgorithms | Two arrays.py | Python | apache-2.0 | 1,587 |
#!/usr/bin/python
import boto3
import shutil
import zipfile
from zipfile import ZipFile, ZipInfo
import os
import tempfile
import time
import threading
from os.path import join
from botocore.client import Config
class JobPoller:
def __init__(self, action_type_id, builder):
self._action_type_id = action_... | horiam/codebuild-emulator | codebuild_emulator/jobpoller.py | Python | apache-2.0 | 4,019 |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2008-present MagicStack Inc. and the EdgeDB 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... | edgedb/edgedb | edb/pgsql/dbops/composites.py | Python | apache-2.0 | 4,645 |
# Copyright 2017 The dm_control 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 applicable law or agreed to i... | deepmind/dm_control | dm_control/suite/reacher.py | Python | apache-2.0 | 4,233 |
# 378. Kth Smallest Element in a Sorted Matrix
#
# Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.
#
# Note that it is the kth smallest element in the sorted order, not the kth distinct element.
#
# Example:
#
# matrix = [
# [ 1, 5,... | gengwg/leetcode | 378_kth_smallest_element_in_a_sorted_matrix.py | Python | apache-2.0 | 2,958 |
# File has been renamed.
raise DeprecationWarning("This file has been renamed to `fractional_gpus.py` "
"in the same folder!")
| pcmoritz/ray-1 | rllib/examples/partial_gpus.py | Python | apache-2.0 | 152 |
# 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 agreed to in writing, ... | google/neural-light-transport | nlt/datasets/nlt.py | Python | apache-2.0 | 7,804 |
import numpy as np
from ._utils import move_axis_to_end, suppress_warnings
def brier_score(observations, forecasts):
"""
Calculate the Brier score (BS)
The Brier score (BS) scores binary forecasts $k \in \{0, 1\}$,
..math:
BS(p, k) = (p_1 - k)^2,
where $p_1$ is the forecast probability... | TheClimateCorporation/properscoring | properscoring/_brier.py | Python | apache-2.0 | 7,326 |
# -*- coding: utf-8 -*-
# Copyright 2013 Mirantis, 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 requi... | SmartInfrastructures/fuel-web-dev | nailgun/nailgun/test/integration/test_node_handler.py | Python | apache-2.0 | 12,873 |
try:
import exceptions
except ImportError: # Python 3
import builtins as exceptions
class ObjectToReturn:
def __init__(self, name):
self.name = name
def __str__(self):
return self.name
def exception(self, name, msg=""):
exception = getattr(exceptions, name)
... | userzimmermann/robotframework-python3 | atest/testresources/testlibs/objecttoreturn.py | Python | apache-2.0 | 343 |
'''
Profile Formula Validation is an example of a plug-in to GUI menu that will profile formula execution.
(c) Copyright 2012 Mark V Systems Limited, All rights reserved.
'''
import os
from tkinter import simpledialog, messagebox
def profileFormulaMenuEntender(cntlr, menu):
# Extend menu with an item for the prof... | sternshus/arelle2.7 | svr-2.7/arelle/plugin/profileFormula.py | Python | apache-2.0 | 5,608 |
__source__ = 'https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/description/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/verify-preorder-sequence-in-binary-search-tree.py
# Time: O(n)
# Space: O(1)]
# Stack
#
# Description: Leetcode # 255. Verify Preorder Sequence in Binary Se... | JulyKikuAkita/PythonPrac | cs15211/VerifyPreorderSequenceinBinarySearchTree.py | Python | apache-2.0 | 4,042 |