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 |
|---|---|---|---|---|---|
onetonine = len("onetwothreefourfivesixseveneightnine")
onetoten = onetonine + len("ten")
eleventotwenty = len("eleventwelvethirteenfourteenfifteensixteenseventeeneighteennineteen")
twenties = len("twenty")*10 + onetonine
thirties = len("thirty")*10 + onetonine
forties = len("forty")*10 + onetonine
fifties = len("fift... | jreese/euler | python/problem17a.py | Python | mit | 1,333 |
from poliastro.twobody.thrust.change_a_inc import change_a_inc
from poliastro.twobody.thrust.change_argp import change_argp
from poliastro.twobody.thrust.change_ecc_inc import change_ecc_inc
from poliastro.twobody.thrust.change_ecc_quasioptimal import change_ecc_quasioptimal
__all__ = ["change_a_inc", "change_argp", "... | poliastro/poliastro | src/poliastro/twobody/thrust/__init__.py | Python | mit | 364 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Integration tests for tickets between 2000 and 2999.
Copyright 2010-2013 Glencoe Software, Inc. All rights reserved.
Use is subject to license terms supplied in LICENSE.txt
"""
import time
import test.integration.library as lib
import pytest
from omero.rtype... | jballanc/openmicroscopy | components/tools/OmeroPy/test/integration/test_tickets3000.py | Python | gpl-2.0 | 4,675 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 Michael Hull.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are m... | mikehulluk/morphforge | src/morphforge/morphology/exporter/export_tree_swc.py | Python | bsd-2-clause | 4,788 |
import test.support, unittest
from test.support import TESTFN, unlink
import os, sys
class CodingTest(unittest.TestCase):
def test_bad_coding(self):
module_name = 'bad_coding'
self.verify_bad_module(module_name)
def test_bad_coding2(self):
module_name = 'bad_coding2'
self.veri... | mancoast/CPythonPyc_test | fail/314_test_coding.py | Python | gpl-3.0 | 2,149 |
#stdlib
import traceback
from time import sleep
#local
from logger import Logger
from utils.http import Callback
def do(func_list, metadata_class, retry_limit=None, log_name='/var/log/do.log', callback=None, **kwargs):
'''
Logging/retry logic wrapper.
Inputs:
func_list: list of tuples [(func... | timeartist/ufyr | ufyr/do.py | Python | unlicense | 3,735 |
"""
Search indexes for Haystack.
"""
from haystack import indexes
from sphinxdoc.models import Document
class DocumentIndex(indexes.SearchIndex, indexes.Indexable):
"""Index for :class:`~sphinxdoc.models.Document`.
"""
text = indexes.CharField(document=True, use_template=True)
title = indexes.CharF... | kamni/django-sphinxdoc | sphinxdoc/search_indexes.py | Python | mit | 455 |
# -*- coding: utf-8 -*-
"""Usage:
acli account
-h, --help
"""
from __future__ import (absolute_import, print_function, unicode_literals)
from docopt import docopt
if __name__ == '__main__':
print(docopt(__doc__))
| jonhadfield/acli | lib/acli/commands/account.py | Python | mit | 227 |
from __future__ import print_function
from string import Template
# ignore these, they're in Hw++ already # TODO reset Hw++ settings instead
SMPARTICLES = {
1:'d',
2:'u',
3:'s',
4:'c',
5:'b',
6:'t', # think about this one later
11:'e-',
12:'nu_e',
13:'mu-',
14:'nu_mu',
15:'tau-',
16:'nu_tau',
21:'g',
22:'gamma',
23:... | hep-mirrors/herwig | Models/Feynrules/python/ufo2peg/particles.py | Python | gpl-3.0 | 7,132 |
#!/usr/bin/env python
"""libPoMo.main
===============
This library contains functions that are used by PoMo.
"""
import argparse
import random
from scipy.misc import comb as choose
import libPoMo as lp
import os
import pdb
import time
# define PoMo10 states
codons = ["aaa", "aac", "aag", "aat", "aca", "acc", "acg... | pomo-dev/PoMo | libPoMo/main.py | Python | gpl-2.0 | 23,843 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/modules/cfg_password_ui_.py | Python | agpl-3.0 | 2,226 |
#!/usr/bin/env python
__author__ = 'ilkin safarli'
from sklearn.pipeline import FeatureUnion
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from FrequencyTransformer import *
from sklearn.datasets import load_files
from RScore import RScore
... | kinimesi/rscore | Classifier.py | Python | apache-2.0 | 2,128 |
from collections import namedtuple
listeners = {'*': []}
SmykowskiMessage = namedtuple('SmykowskiMessage', ['topic', 'message'])
def publish(topic, message):
smykowski_message = SmykowskiMessage(topic=topic, message=message)
for listener in listeners[topic]:
listener(smykowski_message)
for liste... | mahnve/smykowski | smykowski.py | Python | mit | 589 |
from hachoir_core.field import (MissingField, BasicFieldSet, Field, ParserError,
createRawField, createNullField, createPaddingField, FakeArray)
from hachoir_core.dict import Dict, UniqKeyError
from hachoir_core.error import HACHOIR_ERRORS
from hachoir_core.tools import lowerBound
import hachoir_core.config as conf... | CouchPotato/CouchPotatoV1 | library/hachoir_core/field/generic_field_set.py | Python | gpl-3.0 | 19,175 |
'''
New Integration Test for migrate between clusters
@author: Legion
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import apibinding.inventory as inventory
import zstackwoodpecker.operations.resource_operations as res... | zstackio/zstack-woodpecker | integrationtest/vm/multiclusters/data_migration/test_cleanup_single_image_trash.py | Python | apache-2.0 | 1,084 |
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "homepage.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| Bladowicz/homepage | manage.py | Python | mit | 251 |
# Original code from Dan Bader Real Python Youtube channel
# Modified namedtuple parameters
import collections
import multiprocessing
import os
import time
from pprint import pprint
Scientist = collections.namedtuple('Scientist', [
'name',
'born',
])
scientists = (
Scientist(name='alpha', born=1991),
... | leon-lei/learning-materials | advance/multiprocessing_practice.py | Python | mit | 1,127 |
# coding: utf-8
# Copyright (c) Henniggroup.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals, print_function
"""
Utility script for making a phase diagram plot.
Usage: python plot_phase_diagram.py /path/to/run_data/file
"""
from gasp.post_processing.plotter import... | henniggroup/GASP-python | gasp/scripts/plot_phase_diagram.py | Python | mit | 402 |
from django.apps import AppConfig
class AccountsConfig(AppConfig):
name = 'accounts'
| LCOGT/valhalla | valhalla/accounts/apps.py | Python | gpl-3.0 | 91 |
#
# 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... | nathanielvarona/airflow | airflow/providers/microsoft/azure/operators/azure_batch.py | Python | apache-2.0 | 17,851 |
#!/usr/bin/env python
import Tkinter as tk
import Tkconstants as Tkc
import logging
import ttk
logging.getLogger().setLevel(logging.DEBUG)
class GuiMaxAge(object):
"""
GUI Tkinter spinbox to configure a maximum age in days.
"""
def __init__(self, parent=None):
parent = parent or tk.Tk()
... | achernet/pyscripts | mygui.py | Python | lgpl-2.1 | 6,809 |
import tensorflow as tf
import numpy as np
import pandas as pd
import time
def get_step_indexes(step, batch_size, n):
start = (step * batch_size) % n
stop = start + batch_size
if stop > n:
stop = n
return (start, stop)
ratio = 0.7
batch_size = 1000
n_features = 784
label_index = 0
feature_ind... | thoolihan/KaggleMNIST | Python/nn.py | Python | apache-2.0 | 4,805 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import logging
import logging.config
import raven
from dotenv import load_dotenv
load_dotenv('.env')
# Environment
ENV = os.environ.ge... | arthurSena/processors | processors/base/config.py | Python | mit | 4,282 |
import os
import sys
from owanimo.app.error import ERROR as e
from owanimo.util import define
from owanimo.util.log import LOG as L
class AllegoryBase(object):
def __init__(self, runner):
self.runner = runner
self.checklist = []
self.resultmap = {}
self._step = 0
def step(se... | setsulla/owanimo | app/allegory.py | Python | mit | 976 |
import re
SMART_CTL = {
'6.2':
{
'INFO':
{
'START':r'.*INFORMATION SECTION.*',
'END':'',
'REGEX':
[
r'Serial Number:\s+(?P<serial>.+)',
r'Device Model:\s+(?P<model>.+)',
r'Firmware Version:\s+(?P<firm... | amschaal/maestor | maestor/parsers.py | Python | mit | 2,897 |
from SCTerminal import SCTerminal
from otp.otpbase.OTPLocalizer import CustomSCStrings
SCCustomMsgEvent = 'SCCustomMsg'
def decodeSCCustomMsg(textId):
return CustomSCStrings.get(textId, None)
class SCCustomTerminal(SCTerminal):
def __init__(self, textId):
SCTerminal.__init__(self)
self.textI... | ksmit799/Toontown-Source | otp/speedchat/SCCustomTerminal.py | Python | mit | 522 |
from io import BytesIO
from django.core.servers.basehttp import ServerHandler
from django.utils.unittest import TestCase
from django.utils.six.moves import StringIO
#
# Tests for #9659: wsgi.file_wrapper in the builtin server.
# We need to mock a couple of of handlers and keep track of what
# gets called when using a... | vsajip/django | tests/regressiontests/builtin_server/tests.py | Python | bsd-3-clause | 1,777 |
# -*- coding: utf-8 -*-
# python-holidays
# ---------------
# A fast, efficient Python library for generating country, province and state
# specific sets of holidays on the fly. It aims to make determining whether a
# specific date is a holiday as fast and flexible as possible.
#
# Authors: dr-prodigy <maurizio.... | dr-prodigy/python-holidays | test/countries/test_china.py | Python | mit | 4,290 |
from django.conf.urls import url
from . import views
app_name = 'revisions'
urlpatterns = [
url(r'^revision/$', views.RevisionView.as_view(), name = 'revision'),
url(r'^mail/$', views.MailView.as_view(), name = 'mail'),
]
| pelgoros/kwyjibo | revisions/urls.py | Python | gpl-3.0 | 232 |
#!/usr/bin/env python
import matplotlib.pyplot as plt
import numpy as np
# Import stuff for working with dates
from datetime import datetime
from matplotlib.dates import date2num
# Hits/month, pages, and gigabytes served.
# To get the Google analytics data:
# .) Go to analytics.google.com.
# .) There should be (as o... | balborian/libmesh | doc/statistics/libmesh_pagehits.py | Python | lgpl-2.1 | 9,913 |
import pygame
pygame.init()
WIDTH=600
HEIGHT=480
SCREEN = pygame.display.set_mode((WIDTH, HEIGHT))
while True:
events = pygame.event.get()
for event in events:
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_1:
print('this DOES work! :)')
| just-kir/just-kir.github.io | game_test.py | Python | mit | 295 |
RUN_AUTO = 0 # First item of this block is cued right after last item of previous block
RUN_MANUAL = 1 # Playback stops at the end of the last item of previous block
RUN_SOFT = 2 # First item of this block is cued if previous block is running and current_time >= scheduled_time
RUN_HARD = 3 # First... | immstudios/nebula-core | nebulacore/constants/run_modes.py | Python | gpl-3.0 | 439 |
#!python -u
import os, sys
import datetime
import re
import glob
import tarfile
import subprocess
import shutil
import time
def next_build_number():
try:
file = open('.build_number', 'r')
build_number = file.read()
file.close()
except IOError:
build_number = '0'
file = ope... | xenserver/win-xennet | build.py | Python | bsd-2-clause | 10,383 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from fairseq.models import register_model, register_model_architecture
from fairseq.models.nat import NATransformerModel
def _s... | pytorch/fairseq | fairseq/models/nat/iterative_nonautoregressive_transformer.py | Python | mit | 8,647 |
def Setup(Settings, DefaultModel):
# set3_crossval-one-model-on-one-dataset/type_of_model_osm_kfold_d4.py
Settings["experiment_name"] = "TypesOfModels_monoTest_OSM_kfold_d4"
Settings["graph_histories"] = [] # ['all','together',[],[1,0],[0,0,0],[]]
n = 0
#d1 5556x_markable_640x640 ... | previtus/MGR-Project-Code | Settings/set3_crossval-one-model-on-one-dataset/type_of_model_osm_kfold_d4.py | Python | mit | 1,246 |
import click
@click.group(name='pytn')
def cli():
"""
Output a greeting to PyTennessee!
"""
@cli.command()
def prompt1():
"""
Prompt for data.
"""
data = click.prompt("Data")
click.echo("data: {0}".format(data))
@cli.command()
def prompt2():
"""
Prompt for data w/ custom text.... | tylerdave/PyTN2016-Click-Tutorial | solutions/input_prompts.py | Python | mit | 435 |
## -*- coding: utf-8 -*-
<%
import os
context.write('<hr /><div class="dev_data_dump">')
env_ks = os.environ.keys()
for ev in env_ks:
# first only 'HTTP_EVE' vars
ev_s = ev[0:8]
if ev_s == 'HTTP_EVE':
context.write('[{0}] = [{1}]<br />'.format(ev, os.environ[ev]))
# context.write('[{0}][{2}] =... | minlexx/whdbx_web | templates/dump_env.py | Python | mit | 586 |
"""
Score Module
This module defines the score class. It keeps track of the players
score and displays it on the screen.
"""
import pygame
from ..config import RESOLUTION
class Score(pygame.sprite.Sprite):
"""Score Class"""
def __init__(self, score=0):
"""Initialize player score."""
super()... | Oisota/Breakout | breakout/game/score.py | Python | gpl-3.0 | 1,020 |
#!/usr/bin/env python
#coding: utf-8
"""
https://leetcode.com/problems/spiral-matrix-ii/
Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
]
"... | caoxudong/code_practice | leetcode/59_spiral_matrix_ii.py | Python | mit | 1,960 |
from test_support import TestFailed
# A test for SF bug 422177: manifest float constants varied way too much in
# precision depending on whether Python was loading a module for the first
# time, or reloading it from a precompiled .pyc. The "expected" failure
# mode is that when test_import imports this after all .py... | neopoly/rubyfox-server | lib/rubyfox/server/data/lib/Lib/test/double_const.py | Python | mit | 1,212 |
# Copyright (c) 2012 Rackspace Hosting
# 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 req... | pombredanne/MOG | nova/cells/state.py | Python | apache-2.0 | 17,886 |
"""
This test file tests the lib.tokens.certificatetoken
"""
from .base import MyTestCase
from privacyidea.lib.tokens.certificatetoken import CertificateTokenClass
from privacyidea.models import Token
from privacyidea.lib.caconnector import save_caconnector
from privacyidea.lib.token import get_tokens
import os
from O... | woddx/privacyidea | tests/test_lib_tokens_certificate.py | Python | agpl-3.0 | 7,454 |
"""
This module implements the quicksort algorithm.
"""
from random import choice
def quick_sort(arr, key=lambda x:x):
"""
Perform a quicksort on a given list. Return the sorted list.
Example:
>>> quick_sort([1, 5, 7, 2, 3, 4, 1])
[1, 1, 2, 3, 4, 5, 7]
>>> quick_sort([
... {"name": "Fox", "... | jcotton42/libuseful | stubs/sorts/quicksort.py | Python | gpl-3.0 | 550 |
#!/usr/bin/env python
# -*- coding: ascii -*-
r"""
ConfigFile wraps a configparser file as an in-memory container with a few
more options.
such as:
mycfg['BadNews','IQ'] = 'very low'
x = mycfg['BadNews','IQ']
del mycfg['BadNews','IQ']
mycfg.save_file()
myDict = mycfg.get_dictionary()
S... | sonofeft/Qt4_GenGUI | qt4_gengui/config_file.py | Python | lgpl-3.0 | 6,187 |
import requests
import terminatorlib.plugin as plugin
from gi.repository import Gtk
from terminatorlib.config import ConfigBase
from terminatorlib.translation import _
from terminatorlib.util import get_config_dir, err, dbg, gerr
AVAILABLE = ['TerminatorThemes']
class TerminatorThemes(plugin.Plugin):
capabilitie... | tjtrabue/dotfiles | link/config/terminator/plugins/terminator-themes.py | Python | mit | 7,724 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('reviewers', '0003_auto_20150727_1017'),
]
# An incorrect constraint was added in this migration, and was removed due
# to bug 11... | ingenioustechie/zamboni | mkt/reviewers/migrations/0004_fix_unique.py | Python | bsd-3-clause | 347 |
import meta
import sage
from sage import player, triggers, aliases
from sage.signals import pre_shutdown
from sage.signals.gmcp import skills, vitals
import time
import MySQLdb as mysql
import MySQLdb.cursors
class HealthTracker(object):
def __init__(self):
self.health = 100
self.mana = 100
... | danielja/mudpy | health_tracker/health_tracker.py | Python | gpl-2.0 | 2,521 |
#!/usr/bin/env python
"""This module contains the Image class, for image processing operations.
The operations implemented in the class methods are focused to the
images obtained from the external FPGAs in the UviSpace project. Thus,
once obtained a grey scale image, this module provide functions for
getting the sh... | UviDTE-UviSpace/UviSpace | uvispace/uvisensor/imgprocessing.py | Python | gpl-3.0 | 9,235 |
import _plotly_utils.basevalidators
class ValuesValidator(_plotly_utils.basevalidators.DataArrayValidator):
def __init__(
self, plotly_name="values", parent_name="parcoords.dimension", **kwargs
):
super(ValuesValidator, self).__init__(
plotly_name=plotly_name,
parent_na... | plotly/plotly.py | packages/python/plotly/plotly/validators/parcoords/dimension/_values.py | Python | mit | 422 |
#!/usr/bin/env python
# -*- encoding: UTF-8 -*-
# This file is part of Addison Arches.
#
# Addison Arches 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 you... | tundish/addisonarches | addisonarches/console.py | Python | agpl-3.0 | 12,414 |
#!/usr/bin/python
# (c) 2017, Alberto Murillo <alberto.murillo.silva@intel.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | Tatsh-ansible/ansible | lib/ansible/modules/packaging/os/swupd.py | Python | gpl-3.0 | 9,590 |
# Copyright 2014 the Secure GAE Scaffold Project 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
#
# Unles... | google/crisis-info-hub | src/handlers.py | Python | apache-2.0 | 763 |
# -*- coding: utf-8 -*-
CRIME_DICT = {
"ASSAULT": ["ASSAULT"],
"THEFT": [
"BIKE THEFT", "BURGLARY", "CAR PROWL", "MAIL THEFT", "PICKPOCKET",
"PURSE SNATCH", "SHOPLIFTING", "THEFT OF SERVICES", "VEHICLE THEFT",
"BURGLARY-SECURE PARKING-RES"
],
"SIN": ["GAMBLE", "PORNOGRAPHY", "PR... | MurderSheWrote/MurderSheWroteSeattle | crimemapper/crimedict.py | Python | mit | 1,205 |
import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_glm, h2o_import as h2i, h2o_jobs, h2o_gbm
DO_CLASSIFICATION = True
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init(1)
... | rowhit/h2o-2 | py/testdir_single_jvm/test_GBMGrid_basic_class.py | Python | apache-2.0 | 2,962 |
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP S.A. (<http://www.openerp.com>). All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it un... | Johnzero/erp | openerp/addons/fetchmail_crm_claim/__openerp__.py | Python | agpl-3.0 | 1,461 |
#!/usr/bin/env python3
import os
import sys
import subprocess
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from lutris.util.wineregistry import WineRegistry
PREFIXES_PATH = os.path.expanduser("~/Games/wine/prefixes")
def get_registries():
registries = []
directories = os.lis... | daniel-j/lutris | tests/check_prefixes.py | Python | gpl-3.0 | 1,469 |
#
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
from django.test import TestCase
from rest_framework.test import APITestCase
from rest_framework import status
from django.core.urlresolvers import reverse
from django.core.exceptions import ValidationError
fro... | tzhaoredhat/automation | pdc/apps/package/tests.py | Python | mit | 88,111 |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | fluo-io/fluo-deploy | lib/muchos/config/ec2.py | Python | apache-2.0 | 9,189 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9c1 on 2015-11-24 13:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wiki', '0003_item_related_items'),
]
operations = [
migrations.RemoveField(
... | n2o/labbook | wiki/migrations/0004_auto_20151124_1316.py | Python | mit | 705 |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import
import functools
from argparse import ArgumentParser, _SubParsersAction
from contextlib import contextmanager
from pex.commands.command import Comm... | pantsbuild/pex | pex/cli/command.py | Python | apache-2.0 | 2,971 |
# Copyright 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | jumpstarter-io/horizon | horizon/test/tests/middleware.py | Python | apache-2.0 | 2,488 |
# flake8: noqa
try:
from deepchem.metalearning.maml import MAML, MetaLearner
except ModuleNotFoundError:
pass
| deepchem/deepchem | deepchem/metalearning/__init__.py | Python | mit | 114 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005-2010, TUBITAK/UEKAE
#
# 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.
#
#... | hknyldz/pisitools | pisilinux/pisilinux/comariface.py | Python | gpl-3.0 | 8,110 |
from __future__ import unicode_literals, division, absolute_import
import re
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
import logging
from unicodedata import normalize
from flexget import plugin
from flexget.entry import Entry
from flexget.event import event
from flexget.utils.r... | gazpachoking/Flexget | flexget/components/sites/sites/limetorrents.py | Python | mit | 4,889 |
# -*- coding: utf-8 -*-
# ============================================================================ #
# SMB2_Header.py
#
# Copyright:
# Copyright (C) 2016 by Christopher R. Hertel
#
# $Id: SMB2_Header.py; 2019-06-18 17:56:20 -0500; crh$
#
# -------------------------------------------... | ubiqx-org/Carnaval | carnaval/smb/SMB2_Header.py | Python | agpl-3.0 | 40,520 |
import numpy
import os
from PyML.utils import misc
from baseClassifiers import Classifier
from composite import CompositeClassifier
from PyML.evaluators import assess
from PyML.containers.labels import oneAgainstRest
"""classes for multi-class classification"""
__docformat__ = "restructuredtext en"
class OneAgains... | cathywu/Sentiment-Analysis | PyML-0.7.9/PyML/classifiers/multi.py | Python | gpl-2.0 | 5,608 |
# (c) 2014, James Tanner <tanner.jc@gmail.com>
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed i... | wenottingham/ansible | lib/ansible/cli/doc.py | Python | gpl-3.0 | 12,788 |
# -*- coding: utf-8 -*-
import sys
import os
from recommonmark.parser import CommonMarkParser
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as str... | nestproject/Frank | docs/conf.py | Python | bsd-2-clause | 8,306 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
# Standard library imports
from __future__ import print_function
from collections import OrderedDict
import time
# Third party imports
from qtpy.QtCore i... | bgris/ODL_bgris | lib/python3.5/site-packages/spyder/utils/introspection/manager.py | Python | gpl-3.0 | 12,359 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyrigh... | nuagenetworks/vspk-python | vspk/v5_0/nugateway.py | Python | bsd-3-clause | 45,810 |
# -*- coding: utf-8 -*-
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='torrentsearch',
version='0.0.0',
description='Torrent search library.',
long_description=readme(),
url='https://github.com/romanpitak/torrentsearch',
auth... | romanpitak/torrentsearch | setup.py | Python | mit | 761 |
## dea_bandindices.py
'''
Description: This file contains a set of python functions for computing
remote sensing band indices on Digital Earth Australia data.
License: The code in this notebook is licensed under the Apache License,
Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Digital Earth
Australia data... | ceos-seo/data_cube_utilities | dea_tools/dea_tools/bandindices.py | Python | apache-2.0 | 19,668 |
#! /usr/bin/python
# -*- coding: utf-8 -*-
# import funkcí z jiného adresáře
import os.path
path_to_script = os.path.dirname(os.path.abspath(__file__))
# sys.path.append(os.path.join(path_to_script, "../extern/pyseg_base/src/"))
import unittest
import numpy as np
import os
from imtools import qmisc
from imtools i... | mjirik/imtools | tests/qmisc_test.py | Python | mit | 3,908 |
import db_utils
db_utils.init_db(db_utils.db_info_test)
import unittest
import models.user as user
class TestUserFunctions(unittest.TestCase):
def setUp(self):
pass
def test_init(self):
code, msg = user.register_user(email="c4pt0r@126.com", password="shit")
self.assertEqual(code, user... | c4pt0r/tornado-user | tests/user_test.py | Python | mit | 1,119 |
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
import Autodesk
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
def DuplicateView(view, name, doc):
try:
newViewId = view.Du... | andydandy74/ClockworkForDynamo | nodes/2.x/python/View.DuplicateWithDetailing.py | Python | mit | 1,027 |
# -*- coding: utf-8 -*-
from datetime import datetime
from app import db
from app.models import components_tags
from app.users.models import User
from app.tags.models import Tag
from app.util import unix_time
class WebComponent(db.Model):
__tablename__ = 'web_component'
id = db.Column(db.Integer, primary_ke... | nrempel/rucksack-api | app/web_components/models.py | Python | mit | 1,563 |
#!/usr/bin/env python
# Flowtools - a suite of tools for handling and drawing flow data
# Copyright (C) 2013 Petter Johansson
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... | pjohansson/flowtools | scripts/f_spread_com.py | Python | gpl-3.0 | 6,847 |
# Legobot
# Copyright (C) 2016 Brenton Briggs, Kevin McCabe, and Drew Bronson
import logging
from Legobot.Lego import Lego
logger = logging.getLogger(__name__)
class Help(Lego):
@staticmethod
def listening_for(message):
if message['text'] is not None:
try:
return message[... | p4rsec/Legobot | Legobot/Legos/Help.py | Python | gpl-2.0 | 1,759 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2017-03-13 08:16
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | openbacchus/bacchus | manager/migrations/0001_initial.py | Python | apache-2.0 | 4,200 |
"""
Module for miscellaneous functions.
"""
import random
from collections import defaultdict
from string import letters
from lxml.builder import ElementMaker
from lxml import etree
def host_and_page(url):
""" Splits a `url` into the hostname and the rest of the url. """
url = url.split('//')[1]
parts = u... | pombredanne/yalign | yalign/utils.py | Python | bsd-3-clause | 2,689 |
"""runpy.py - locating and running Python code using the module namespace
Provides support for locating and running Python scripts using the Python
module namespace instead of the native filesystem.
This allows Python code to play nicely with non-filesystem based PEP 302
importers when locating support scripts ... | deanhiller/databus | webapp/play1.3.x/python/Lib/runpy.py | Python | mpl-2.0 | 5,404 |
from autobahn.twisted.websocket import WampWebSocketClientFactory
from autobahn.twisted.websocket import WampWebSocketClientProtocol
from autobahn.twisted.websocket import WebSocketClientProtocol
from autobahn.twisted.websocket import WebSocketClientFactory
from autobahn.twisted.websocket import connectWS
from autoba... | arduino-org/s4t-iotronic | lib/test_autobahn_wamp_client.py | Python | apache-2.0 | 4,467 |
# Copyright (C) 2010-2018 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later v... | hmenke/espresso | samples/visualization_npt.py | Python | gpl-3.0 | 2,684 |
from setuptools import setup, find_packages
def read(filename):
path = os.path.join(os.path.dirname(__file__), filename)
contents = open(path).read()
return contents
setup(
name = 'dtmc',
version = '0.0.1',
description = 'Discrete Time Markov Chain analysis and simulation',
l... | AndrewWalker/dtmc | setup.py | Python | mit | 788 |
'''
read the input data, parse to int list;
create mappings of user -> reviews, item -> reviews
The companion iterator reads thru the input file sequentially, yielding the data of the form: user word id list, item word id list, rating (float)
@author: roseck
@date Feb 28, 2017
'''
from __builtin__ import dict
import... | rosecatherinek/TransNets | src/DatasetUtils/DataMgr.py | Python | gpl-3.0 | 2,239 |
import logging
import urllib
import os
import sqlaload as sl
from offenesparlament.core import archive_path
log = logging.getLogger(__name__)
def load_document(link):
log.info("Fetching %s...", link)
destination = archive_path('documents', link.split('/dip21/')[-1])
try:
if os.path.isfile(destin... | bundestag/ablaeufe-scraper | bulk.py | Python | mit | 740 |
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import business_requirement
from . import sale_order_line
from . import sale_order
| OCA/business-requirement | business_requirement_sale/models/__init__.py | Python | agpl-3.0 | 156 |
import unittest
from django.db import connection
from django.conf import settings
from django.core.management import call_command
from django.db.models import loading
# Only perform encrypted fields tests if keyczar is present
# Resolves http://github.com/django-extensions/django-extensions/issues/#issue/17
try:
... | mzdaniel/oh-mainline | vendor/packages/django-extensions/django_extensions/tests/encrypted_fields.py | Python | agpl-3.0 | 2,728 |
# Copyright 2017 Balazs Nemeth
#
# 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, s... | 5GExchange/mapping | alg1/ServiceChains.py | Python | apache-2.0 | 9,517 |
from django.core.management.base import BaseCommand, CommandError
from first_app.models import Cell
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('wr_sz', type=int)
def handle(self, *args, **options):
wr_sz = options['wr_sz']
for x in range(wr_sz):
... | CONSOLNY/rglk | first_app/management/commands/genwr.py | Python | mit | 533 |
#!/usr/bin/env python
# Copyright (c) 2012 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.
"""Entry point for both build and try bots.
This script is invoked from XXX, usually without arguments
to package an SDK. It autom... | nwjs/chromium.src | native_client_sdk/src/build_tools/build_sdk.py | Python | bsd-3-clause | 31,155 |
GUIDE_NAME = 'plum'
class Plum(object):
def __init__(self, glyph):
self.glyph = glyph
def toggle(self):
if self.plum_guide:
self.destroy()
else:
self.create()
def create(self):
if self.glyph_exists:
self.glyph.addGuide(self.position, s... | jackjennings/Plum | Plum.roboFontExt/lib/plum/plum.py | Python | mit | 1,320 |
#!/usr/bin/env python
'''
Copyright (C) 2015, Digium, Inc.
Ashley Sanders <asanders@digium.com>
This program is free software, distributed under the terms of
the GNU General Public License Version 2.
'''
import logging
from sipp_scenario import SIPpScenarioWrapper
from twisted.internet import defer
LOGGER = logging... | asterisk/testsuite | tests/channels/SIP/tcpauthlimit/tcpauthlimit.py | Python | gpl-2.0 | 8,489 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dataset', '0040_auto_20151216_2203'),
('log_parse', '0002_auto_20160120_2149'),
]
operations = [
migrations.AddField... | poldracklab/open_fmri | open_fmri/apps/log_parse/migrations/0003_s3file_dataset.py | Python | bsd-3-clause | 470 |
from datetime import datetime
import unittest
from emma import exceptions as ex
from emma.model.account import Account
from emma.model.trigger import Trigger
from emma.model import SERIALIZED_DATETIME_FORMAT
from emma.model.mailing import Mailing
from tests.model import MockAdapter
class TriggerTest(unittest.TestCase... | myemma/EmmaPython | tests/model/trigger_test.py | Python | mit | 5,248 |
import unittest
from streamlink.plugins.gulli import Gulli
class TestPluginGulli(unittest.TestCase):
def test_can_handle_url(self):
# should match
self.assertTrue(Gulli.can_handle_url("http://replay.gulli.fr/Direct"))
self.assertTrue(Gulli.can_handle_url("http://replay.gulli.fr/dessins-an... | wlerin/streamlink | tests/plugins/test_gulli.py | Python | bsd-2-clause | 1,131 |
import psycopg2
from utils.db_connection import get_connection,close_connection
def main():
"""Creates the main polygon and
point geographies tables
"""
conn = get_connection()
cur = conn.cursor()
statements = [
"""DROP TABLE IF EXISTS polygon_geographies;""",
"""DROP TABLE IF EXISTS point_geographies;"""]... | UrbanCCD-UChicago/sustainableSystems | src/drop_geographies.py | Python | mit | 456 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-12-18 00:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0014_auto_20171218_0008'),
]
operations = [
migrations.AlterField(
... | Gimpneek/exclusive-raid-gym-tracker | app/migrations/0015_auto_20171218_0008.py | Python | gpl-3.0 | 471 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2018-12-16 12:23
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import re
class Migration(migrations.Migration):
dependencies = [
('server', '0028_auto_20181211_1333'),
]
oper... | wodo/WebTool3 | webtool/server/migrations/0029_auto_20181216_1323.py | Python | bsd-2-clause | 785 |
# pylint: disable=g-bad-file-header
# 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/LICENS... | sachinpro/sachinpro.github.io | tensorflow/contrib/learn/python/learn/io/pandas_io.py | Python | apache-2.0 | 2,295 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.