code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
from tests.fixtures import * import servi.config as c from servi.command import process_and_run_command_line as servi_run @pytest.fixture def mock_ansible_inventory(): inv_path = os.path.join( c.MASTER_DIR, '.vagrant/provisioners/ansible/vagrant_inventory') inv_file = os.path.join(inv_path, 'vagrant_a...
rr326/servi
tests/test_lans.py
Python
mit
756
# -*- coding: utf-8 -*- # # Copyright 2016 dpa-infocom GmbH # # 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...
dpa-newslab/livebridge
tests/test_converter.py
Python
apache-2.0
3,202
# 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 # distributed under t...
briancurtin/python-openstacksdk
openstack/network/v2/pool_member.py
Python
apache-2.0
2,199
import random import openerp from openerp import api, models, SUPERUSER_ID from openerp.http import request class ir_http(models.AbstractModel): _inherit = 'ir.http' def _auth_method_user(self): super(ir_http, self)._auth_method_user() if random.random() < 0.01: with openerp.regist...
litnimax/addons-yelizariev
web_sessions_management/ir_http.py
Python
lgpl-3.0
571
import collections import datetime def main(): puzzle_input = parse_input() print(part_one(puzzle_input)) print(part_two(puzzle_input)) def parse_input(): logs = [] with open('input.txt') as f: for line in f: timestamp_str, activity = line.split('] ') timestamp_st...
T-R0D/JustForFun
aoc2018/day04/solution.py
Python
gpl-2.0
3,801
from datetime import datetime from rx.core import Observable, AnonymousObservable from rx.disposables import CompositeDisposable from rx.internal import extensionmethod from rx.concurrency import timeout_scheduler @extensionmethod(Observable) def take_until_with_time(self, end_time, scheduler=None): """Takes elem...
Sprytile/Sprytile
rx/linq/observable/takeuntilwithtime.py
Python
mit
1,472
# This file is part of beets. # Copyright 2015, Adrian Sampson. # # 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, including # without limitation the rights to use, copy, ...
multikatt/beets
beets/autotag/hooks.py
Python
mit
20,643
__version__ = '0.0.1' default_app_config = 'formaggio.apps.FormaggioConfig'
scotu/django-formaggio
formaggio/__init__.py
Python
bsd-3-clause
76
from setuptools import setup, find_packages from codecs import open from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='sphinx-jsonschema', version='1.17.2', # don't forget: must mat...
lnoor/sphinx-jsonschema
setup.py
Python
gpl-3.0
1,275
"""Protocol extension support for YamlSettings Proposed types: * parent - Find first file, by searching up through parent directories. * each - Open each file found, and update yamldict each://defaults.yaml|settings.yaml|more.yaml """ from yamlsettings.extensions.local import LocalExtension from yamlset...
KyleJamesWalker/yamlsettings
yamlsettings/extensions/__init__.py
Python
mit
565
import dbus from saluttest import exec_test from file_transfer_helper import ReceiveFileTest import constants as cs class ReceiveFileAndSenderDisconnectWhilePendingTest(ReceiveFileTest): def accept_file(self): # The sender of the file disconnects self.outbound.transport.loseConnection() s...
freedesktop-unofficial-mirror/telepathy__telepathy-salut
tests/twisted/avahi/file-transfer/receive-file-and-sender-disconnect-while-pending.py
Python
lgpl-2.1
979
import pandas as pd import numpy as np from fremont.data import get_fremont_data def test_fremont_data(): data = get_fremont_data() assert all(data.columns == ['West', 'East', 'Total']) assert isinstance(data.index, pd.DatetimeIndex) assert len(np.unique(data.index.time) == 24)
Soil-Carbon-Coalition/atlasdata
fremont/tests/test_data.py
Python
mit
294
# 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 req...
saeki-masaki/glance
glance/tests/unit/v2/test_image_data_resource.py
Python
apache-2.0
23,360
__author__ = 'Filushin_DV' import generators import tables import profiler from faker import Factory date_start = '01/01/2015' date_end = '06/06/2015' citys = [] faker = Factory.create() for i in range(100): citys.append(faker.city()) valid_parents = (10, 2, 3) field_list = [] field_list.append(tables.GenField...
DFilyushin/pydgen
prog.py
Python
gpl-2.0
967
from django.db import models # Create your models here. class Member(models.Model): # basic information first_name = models.CharField(max_length=200, null=False, blank=False) last_name = models.CharField(max_length=200, null=False, blank=False) birthday = models.CharField(max_length=200, null=True, bl...
mooja/ssip3
app/members/models.py
Python
mit
1,211
#!/usr/bin/python # -*- coding: utf-8 -*- # kate: space-indent on; indent-width 4; mixedindent off; indent-mode python; class syncrepl(object): def __init__(self, line=None): self._data = {} self._org_line = None self.parse(line) @staticmethod def _parse_key_value_line(line): ...
aroth-arsoft/arsoft-python
python3/arsoft/ldap/slapd/syncrepl.py
Python
gpl-3.0
5,363
from gui.widgets import AbstractWidget import Tkinter class Radiobutton(AbstractWidget.WidgetWithCommand): def __init__(self, parent, name, row, column, variable, **kwargs): AbstractWidget.WidgetWithCommand.__init__(self, name, row, column, **kwargs) self.command = kwargs.get("command", None) ...
kahvel/VEP-BCI
src/gui/widgets/Radiobutton.py
Python
mit
440
#!/usr/bin/python import smbus import time ''' retrieve data from wii ir camera. x = 0-1023 y = 0-720 size = 1-15? top right of scene = [0,0] ''' def getBlob(n,list): # return x,y,size for blob n (0-3) from list if len(list)<13: return [] x = list[1+(n*3)] y = list[2+(n*3)] s = list[3+(n*3)...
roving99/robot_pi
0mq/wii_ir_test.py
Python
gpl-2.0
966
#!/usr/bin/env python # - coding: utf-8 - # Copyright (C) 2014 Toms Baugis <toms.baugis@gmail.com> """Base template""" import datetime as dt import itertools from gi.repository import Gtk as gtk from gi.repository import GObject as gobject from collections import defaultdict from lib import graphics from lib import...
projecthamster/experiments
hamster_brains2.py
Python
mit
4,710
"""pwShare URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') ...
zzrcxb/VeriShare
pwShare/urls.py
Python
gpl-3.0
849
import copy import os from importlib import import_module from importlib.util import find_spec as importlib_find def import_string(dotted_path): """ Import a dotted module path and return the attribute/class designated by the last name in the path. Raise ImportError if the import failed. """ try: ...
labcodes/django
django/utils/module_loading.py
Python
bsd-3-clause
3,303
from src.utils.DictUtils import DictUtils class ValueProvider(object): def __init__(self, dictionary): self.dictionary = dictionary def getValue(self, path): return DictUtils.get(self.dictionary, path)
purplecode/espresso
src/provider/ValueProvider.py
Python
mit
226
from django.db import models from django.conf import settings class Tweet(models.Model): """ A simple tweet model. """ user = models.ForeignKey(settings.AUTH_USER_MODEL) text = models.CharField(max_length = 140, blank = False) timestamp = models.DateTimeField(auto_now_add = True) def __unicode__(self)...
TunedMystic/normandy
tweets/models.py
Python
gpl-2.0
384
# Copyright (c) 2011 Nokia # # 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, including without limitation the rights # to use, copy, modify, merge, publish, distribute, s...
skyostil/tracy
src/generator/GeneratorTest.py
Python
mit
4,736
from django_assets import register from django_eks.assets import actualis_css, actualis_js, actualis_js_min from django.conf import settings register('core_css', actualis_css) if settings.DEBUG: register('core_js', actualis_js) else: register('core_js', actualis_js_min)
icelic/eks
py/eks/core/assets.py
Python
gpl-3.0
282
from django import forms from django.contrib import admin from django.contrib.gis import db from django.contrib.contenttypes.generic import GenericTabularInline from django.core.exceptions import ValidationError from ajax_select import make_ajax_form from ajax_select.admin import AjaxSelectAdmin from pombola.core imp...
hzj123/56th
pombola/core/admin.py
Python
agpl-3.0
8,525
binary = 'cppoh' args = ['--cfg=world.cfg'] monit = True
sirikata/sirikata-sample-deployment
templates/melville/world/config.py
Python
bsd-3-clause
57
""" koan = kickstart over a network general usage functions Copyright 2006-2008 Red Hat, Inc. Michael DeHaan <mdehaan@redhat.com> 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 ...
javiplx/cobbler-devel
koan/koan/utils.py
Python
gpl-2.0
13,560
import pytest from django.urls import reverse from config.models import SiteConfig from config.utils import get_active_event from tests.factories import TicketFactory, PaperApplicationFactory, EventFactory, CallForPaperFactory from voting.models import CommunityVote def enable_voting(): config = SiteConfig.load...
WebCampZg/conference-web
tests/test_voting.py
Python
bsd-3-clause
3,883
people = 30 cars = 40 trucks = 15 if cars > people: print ("We should take the cars.") elif cars < people: print ("We should not take the cars.") else: print ("we can't decide.") if trucks > cars: print ("That's too many trucks.") elif trucks < cars: print ("maybe we should take ca...
SunWalter/Hard
ex30.py
Python
apache-2.0
497
# Copyright (c) 2012-2014, Max Zwiessele, James Hensman # Licensed under the BSD 3-clause license (see LICENSE.txt) __doc__ = """ Inference over Gaussian process latent functions In all our GP models, the consistency propery means that we have a Gaussian prior over a finite set of points f. This prior is math:: N(...
beckdaniel/GPy
GPy/inference/latent_function_inference/__init__.py
Python
bsd-3-clause
3,440
#!/usr/bin/python # -*- coding=utf-8 -*- """ Constants for named module """ from __future__ import unicode_literals # at top of module RAFE3_LIST = set([ u'أنه', u'أنك', u'أنها', u'بأنها', u'بأنه', u'وأنها', u'فأنها', u'فأنه', u'كأنه', u'كأنها', # yahia alhadj u'كان'...
linuxscout/pyarabic
pyarabic/named_const.py
Python
gpl-3.0
3,885
#!/usr/bin/env python # '''Memo (Palm) to Notes''' import sys import optparse import csv import sqlite3 import time import random PALM_NEWLINE = '\r\r\n' NOTES_NEWLINE = '\n' def openfile(filename, mode, defname, defval): if filename == defname: f = defval else: f = open(filename, mode) ...
rtsai/Palm-Migration--Memo-to-iPhone-Notes-
memo2notes.py
Python
gpl-3.0
6,408
import sys,json,math from itertools import * from qn3 import get_model if __name__ == '__main__': training_count = int(sys.stdin.next()) training_data = [ json.loads(sys.stdin.next()) for _ in xrange(training_count) ] target = [ math.log(obj['__ans__']+0.9) for obj in training_data ] n_folds = 1...
shawntan/quora-codesprint-2013
tester.py
Python
unlicense
2,044
import sys import shutil import os import stat import re import posixpath import pkg_resources import zipfile import tarfile from pip.exceptions import InstallationError, BadCommand from pip.backwardcompat import WindowsError, string_types, raw_input from pip.locations import site_packages, running_under_virtualenv fro...
evnpr/herokupython
vendor/pip-1.2.1/pip/util.py
Python
mit
16,674
"""Test functions of array.py.""" from typing import TYPE_CHECKING import numpy as np import pytest from cobra.util import create_stoichiometric_matrix if TYPE_CHECKING: from cobra import Model def test_dense_matrix(model: "Model") -> None: """Test dense stoichiometric matrix creation.""" S = create_...
opencobra/cobrapy
src/cobra/test/test_util/test_array.py
Python
gpl-2.0
1,331
from office365.directory.identities.authentication_configuration_base import ApiAuthenticationConfigurationBase from office365.entity import Entity from office365.runtime.queries.service_operation_query import ServiceOperationQuery class IdentityApiConnector(Entity): """ Represents API connectors in an Azure ...
vgrem/Office365-REST-Python-Client
office365/directory/identities/api_connector.py
Python
mit
1,768
# -*- 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/nuegressprofile.py
Python
bsd-3-clause
16,799
# Copyright (c) 2003-2010, Berend-Jan "SkyLined" Wever <berendjanwever@gmail.com> # Project homepage: http://code.google.com/p/alpha3/ # All rights reserved. See COPYRIGHT.txt for details. import charsets, encode, io import x86, x64, test import os, re, sys #_____________________________________________________...
zachriggle/alpha3
ALPHA3.py
Python
bsd-3-clause
11,046
# Amara, universalsubtitles.org # # Copyright (C) 2013 Participatory Culture Foundation # # 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 ...
ofer43211/unisubs
apps/comments/__init__.py
Python
agpl-3.0
763
# Copyright (c) 2018-2019, NVIDIA CORPORATION. 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 a...
mlperf/training_results_v0.6
NVIDIA/benchmarks/ssd/implementations/pytorch/coco_pipeline.py
Python
apache-2.0
15,493
# Set initial value for "_" to appease PyCharm _ = lambda x: x # Standard Lib import argparse import gettext import locale import logging import logging.handlers import os import shutil import sys import uuid # 3rd-Party Libs try: from bugsnag.handlers import BugsnagHandler import bugsnag BUGSNAG_ERROR = ...
Wyn10/Cnchi
cnchi/_initial_imports.py
Python
gpl-3.0
827
# @author Avtandil Kikabidze # @copyright Copyright (c) 2008-2015, Avtandil Kikabidze aka LONGMAN (akalongman@gmail.com) # @link http://longman.me # @license The MIT License (MIT) import os import sys import sublime import sublime_plugin st_version = 2 if sublime.version() == '...
crlang/sublime-text---front-end-config
Data/Packages/CodeFormatter/CodeFormatter.py
Python
mit
6,068
# Copyright (c) 2010, 2011, 2012 Nicira, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
ejschiller/FLEX
ovs/python/ovs/daemon.py
Python
gpl-3.0
16,746
from django.core.management.base import BaseCommand from pombola.core.models import Person class Command(BaseCommand): def handle(self, **options): help = 'List the paths of primary person images relative to media root' for p in Person.objects.filter(hidden=False): image_file_field =...
mysociety/pombola
pombola/core/management/commands/core_list_person_primary_images.py
Python
agpl-3.0
441
# ============================================================================== # Copyright 2018-2020 Intel 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://ww...
tensorflow/ngraph-bridge
test/python/test_conv2dbackpropinput.py
Python
apache-2.0
4,330
#!/usr/bin/env python #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #----------------------------------------------------------------...
rjschwei/azure-sdk-for-python
azure-mgmt-eventhub/setup.py
Python
mit
2,606
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
henrytao-me/openerp.positionq
openerp/addons/hr_expense/hr_expense.py
Python
agpl-3.0
24,913
"""Tests the pilight client. Connects to a simulation of a pilight-daemon. """ import unittest import time from mock import patch, call try: from StringIO import StringIO # Python 2 except ImportError: from io import StringIO # Python 3 from pilight import pilight from pilight.test import pilight_daemon ...
DavidLP/pilight
pilight/test/test_client.py
Python
mit
4,806
import os import shutil import ctypes def makepath(*args): path = os.path.join(*args) print('makepath:', path) if not os.path.exists(path): os.makedirs(path) return path def quotes(s): return '"' + s + '"' def cleanCopyTree(src, dst, **kwargs): dirName = os.path.basename(src) ...
SilverIce/JContainers
post-build/jc_install.py
Python
mit
5,256
#coding: utf-8 a = zeros((10,10), double) for i in range(0,10): a[i,i] = 2.0 for i in range(0,9): a[i,i+1] = -1.0 for i in range(0,9): a[i,i+1] = -1.0 n = 5 for i in range(0, n): x = 1
ratnania/pyccel
src_old/tests/scripts/core/ex7.py
Python
mit
208
#!/usr/bin/env python import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "another_stories.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
Egregors/another-stories
manage.py
Python
apache-2.0
258
""" This is an RLGlue experiment designed to collect the type of data presented in: Playing Atari with Deep Reinforcement Learning Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, Martin Riedmiller (Based on the sample_experiment.py from the Rl-glue python codec example...
gogobebe2/deep_q_rl
deep_q_rl/rl_glue_ale_experiment.py
Python
bsd-3-clause
1,938
from contextlib import contextmanager from functools import partial import os import os.path as op import numpy as np from traitlets import observe, HasTraits, Unicode, Bool, Float from ..io.constants import FIFF from ..defaults import DEFAULTS from ..io import read_info, read_fiducials, read_raw from ..io.pick impor...
bloyl/mne-python
mne/gui/_coreg.py
Python
bsd-3-clause
38,825
from __future__ import print_function from cmd3.console import Console from cmd3.shell import command from cloudmesh_management.generate import generate_users, generate_projects from cloudmesh_management.user import Users from cloudmesh_management.project import Projects from cloudmesh_management.committee import Com...
cloudmesh/management
cloudmesh_management/plugins/cm_account_admin.py
Python
apache-2.0
22,424
# Author: Leonardo Pistone # Copyright 2014 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 # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any la...
mdietrichc2c/vertical-ngo
logistic_requisition/tests/test_sourcing_percentage.py
Python
agpl-3.0
1,327
"""Power Supply Signal Generator.""" import time as _t import math as _math DEFAULT_SIGGEN_CONFIG = ( 0, # sigtype [0:Sine] 100, # num_cycles 2.0, # freq [Hz] 0.0, # amplitude [A] (Maximum amplitude) 0.0, # offset [A] 0.0, # aux_param[0] # (Sine|DampedSine|D...
lnls-sirius/dev-packages
siriuspy/siriuspy/pwrsupply/siggen.py
Python
gpl-3.0
12,500
#!/usr/bin/env python from peacock.utils import Testing from PyQt5 import QtCore from peacock.Input.ParameterInfo import ParameterInfo class TestAddVariableAndBlock(Testing.PeacockAppImageTestCase): """ Tests that if variables are added that GUI maintains it selections """ def testAdd(self): ""...
backmari/moose
python/peacock/tests/peacock_app/check_add_variables_and_blocks/test_AddVariableAndBlock.py
Python
lgpl-2.1
4,029
"""Add Use log Revision ID: 17d2927a8743 Revises: 392aa82bba8f Create Date: 2017-06-09 18:34:36.239300 """ # revision identifiers, used by Alembic. revision = '17d2927a8743' down_revision = '392aa82bba8f' from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - pl...
labsland/labmanager
alembic/versions/17d2927a8743_add_use_log.py
Python
bsd-2-clause
2,478
"""Support for KNX/IP switches.""" import voluptuous as vol from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchDevice from homeassistant.const import CONF_ADDRESS, CONF_NAME from homeassistant.core import callback import homeassistant.helpers.config_validation as cv from . import ATTR_DISCOVER_DEVICES...
jamespcole/home-assistant
homeassistant/components/knx/switch.py
Python
apache-2.0
3,205
import sys sys.path.insert(1, "../../../") import h2o def bigcatRF(ip,port): # Connect to h2o h2o.init(ip,port) # Training set has 100 categories from cat001 to cat100 # Categories cat001, cat003, ... are perfect predictors of y = 1 # Categories cat002, cat004, ... are perfect predictors of y = 0 ...
ChristosChristofidis/h2o-3
h2o-py/tests/testdir_algos/rf/pyunit_bigcatRF.py
Python
apache-2.0
935
""" ======================================================== Hierarchical clustering (:mod:`scipy.cluster.hierarchy`) ======================================================== .. currentmodule:: scipy.cluster.hierarchy These functions cut hierarchical clusterings into flat clusterings or find the roots of the forest f...
sriki18/scipy
scipy/cluster/hierarchy.py
Python
bsd-3-clause
96,514
import unittest from katas.kyu_7.spoonerize_me import spoonerize class SpoonerizeTestCase(unittest.TestCase): def test_equals(self): self.assertEqual(spoonerize('nit picking'), 'pit nicking') def test_equals_2(self): self.assertEqual(spoonerize('wedding bells'), 'bedding wells') def tes...
the-zebulan/CodeWars
tests/kyu_7_tests/test_spoonerize_me.py
Python
mit
496
"""Provide the device automations for Climate.""" from __future__ import annotations import voluptuous as vol from homeassistant.const import ( ATTR_ENTITY_ID, CONF_CONDITION, CONF_DEVICE_ID, CONF_DOMAIN, CONF_ENTITY_ID, CONF_TYPE, ) from homeassistant.core import HomeAssistant, HomeAssistantE...
aronsky/home-assistant
homeassistant/components/climate/device_condition.py
Python
apache-2.0
3,806
import sys f = open("JIFX_Tweets.tsv") f.readline() print "id\tUser\tUserID\tLanguage\tTweet\tDate" i = 0 for line in f: i += 1 print str(i) + "\t" + line,
Berico-Technologies/CLAVIN-contrib
jifx/make_tweet_ids.py
Python
apache-2.0
169
from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.http import HttpResponseRedirect, HttpResponse from django.contrib.auth.decorators import login_required from django.contrib.auth.models import User from django.contrib.contenttypes.models import C...
Eksmo/django-activity-stream
actstream/views.py
Python
bsd-3-clause
4,470
""" DBGET Database Interface ======================== """ from __future__ import absolute_import import sys import re from contextlib import closing from . import entry from .entry import fields from . import api def iter_take(source_iter, n): """ Return a list of the first `n` items in `source_iter`. ...
tomazc/orange-bio
orangecontrib/bio/kegg/databases.py
Python
gpl-3.0
17,938
from __future__ import absolute_import, unicode_literals ###################### # CARTRIDGE SETTINGS # ###################### # The following settings are already defined in cartridge.shop.defaults # with default values, but are common enough to be put here, commented # out, for convenient overriding. # Sequence of ...
bva24/sm
mart/settings.py
Python
bsd-2-clause
15,838
# coding: utf-8 """ weasyprint.tests.testing_utils ------------------------------ Helpers for tests. :copyright: Copyright 2011-2014 Simon Sapin and contributors, see AUTHORS. :license: BSD, see LICENSE for details. """ from __future__ import division, unicode_literals, print_function import sy...
aESeguridad/GERE
venv/lib/python2.7/site-packages/weasyprint/tests/testing_utils.py
Python
gpl-3.0
4,088
def grep(pattern): print("Searching for", pattern) while True: line = (yield) if pattern in line: print(line) search = grep('coroutine') next(search) search.send("I love you") search.send("Don't you love me") search.send("I love coroutines")
CajetanP/code-learning
Python/Learning/Tips/coroutine.py
Python
mit
281
#! /usr/bin/python # -*- coding: utf-8 -*- ################################################################################ # Copyright 1998-2015 by authors (see AUTHORS.txt) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ...
DavidBluecame/LuxRays
pyunittests/pyluxcoreunittests/unittests.py
Python
apache-2.0
3,822
# Basic text based hangman game # Created for CCSU Tech It Out camp import random def pick_a_word(): words_file = "hangman_words.txt" try: f = open(words_file) words = f.read().splitlines() print(words) random.shuffle(words) print(words) word = words[0] ...
caw13/CCSUTechItOutPiTop
python/sample_programs/hangman_file_based.py
Python
gpl-3.0
3,034
#!/usr/bin/env python USE_SETUPTOOLS = False try: from setuptools import setup, Extension USE_SETUPTOOLS = True except ImportError: from distutils.core import setup, Extension setup_kwargs = dict( name='greendns', description='''A module for providing greened DNS access via dnspython ''', ver...
rtyler/greendns
setup.py
Python
bsd-3-clause
582
# -*- coding: utf-8 -*- from django.db import models, migrations import editorsnotes.main.fields class Migration(migrations.Migration): dependencies = [ ('main', '0008_data_20150824_move_notes_to_markup'), ] operations = [ migrations.RemoveField( model_name='citationns', ...
editorsnotes/editorsnotes
editorsnotes/main/migrations/0009_auto_20150824_1204.py
Python
agpl-3.0
2,052
# Uses python3 import sys def gcd(a, b): if(b == 0): return a a_prime = a % b return gcd(b, a_prime) if __name__ == "__main__": input = sys.stdin.read() a, b = map(int, input.split()) print(gcd(a, b))
oy-vey/algorithms-and-data-structures
1-AlgorithmicToolbox/Week2/gcd/gcd.py
Python
mit
235
"""Translation helper functions.""" # Imported from Django 1.8 # pylint: disable=invalid-name import re from django.conf import settings from django.conf.locale import LANG_INFO from django.utils import translation # Format of Accept-Language header values. From RFC 2616, section 14.4 and 3.9. # and RFC 3066, section...
ahmadiga/min_edx
common/djangoapps/django_locale/trans_real.py
Python
agpl-3.0
5,165
from __future__ import unicode_literals import sys import os import re import mimetypes from copy import copy from importlib import import_module from io import BytesIO from django.apps import apps from django.conf import settings from django.core import urlresolvers from django.core.handlers.base import BaseHandler ...
andyzsf/django
django/test/client.py
Python
bsd-3-clause
26,069
''' 3D Rotating Monkey Head ======================== This example demonstrates using OpenGL to display a rotating monkey head. This includes loading a Blender OBJ file, shaders written in OpenGL's Shading Language (GLSL), and using scheduled callbacks. The monkey.obj file is an OBJ file output from the Blender free 3...
Cheaterman/kivy
examples/3Drendering/main.py
Python
mit
2,405
#Written by Timothy Seabrook #timothy.seabrook@cs.ox.ac.uk #This script is really slow for large images, so should only be executed on those resampled. #This is a first baseline circle detector to identify the limitations of convential techniques for crater detection. import numpy as np import matplotlib.pyplot as pl...
Arcanewinds/FDL-LunarResources
CraterDetection/Hough/houghDetector.py
Python
gpl-3.0
2,080
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('curation', '0023_remove_video_url'), ] operations = [ migrations.RemoveField( model_name='video', na...
webisteme/instavision
instavision/curation/migrations/0024_remove_video_file_name.py
Python
mit
353
#!/usr/bin/python3 # coreposlib - library for replay of core node positions # Written by Lars Baumgaertner (c) 2017-2021 import sys import subprocess import time import getopt import string import glob import re def get_session(): sessions = [] (ret, val) = subprocess.getstatusoutput( "coresendmsg -...
gh0st42/core-automator
coreposlib.py
Python
gpl-3.0
3,962
# 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 # distributed under t...
jay-lau/magnum
magnum/tests/unit/common/x509/test_validator.py
Python
apache-2.0
4,894
# encoding: utf-8 # module __builtin__ # from (built-in) # by generator 1.145 from __future__ import print_function """ Built-in functions, exceptions, and other objects. Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices. """ # imports from exceptions import (ArithmeticError, AssertionError, A...
asedunov/intellij-community
python/testData/MockSdk2.7/python_stubs/__builtin__.py
Python
apache-2.0
174,731
""" All code from Tim Coojimans """ import sys, cPickle as pkl import theano, itertools, pprint, copy, numpy as np, theano.tensor as T from collections import OrderedDict from theano.gof.op import ops_with_inner_function from theano.scan_module.scan_op import Scan from theano.scan_module import scan_utils #from blo...
olimastro/DeepMonster
deepmonster/nnet/frameworks/popstats.py
Python
mit
10,437
import logging from airflow.hooks import MsSqlHook from airflow.models import BaseOperator from airflow.utils import apply_defaults class MsSqlOperator(BaseOperator): """ Executes sql code in a specific Microsoft SQL database :param mssql_conn_id: reference to a specific mssql database :type mssql_co...
mtustin-handy/airflow
airflow/operators/mssql_operator.py
Python
apache-2.0
1,076
class Solution(object): def findMinDifference(self, timePoints): """ :type timePoints: List[str] :rtype: int """ def convert(time): return int(time[:2]) * 60 + int(time[3:]) minutes = map(convert, timePoints) minutes.sort() return min( (y ...
sadad111/leetcodebox
Minimum Time Difference.py
Python
gpl-3.0
1,137
#!/usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2006-2010 (ita) """ C/C++ preprocessor for finding dependencies Reasons for using the Waf preprocessor by default #. Some c/c++ extensions (Qt) require a custom preprocessor for obtaining the dependencies (.moc files) #. Not all compilers provide .d files for ob...
RoyalTS/econ-python-environment
.mywaflib/waflib/Tools/c_preproc.py
Python
bsd-3-clause
27,412
#!/usr/bin/python # -*- coding: utf_8 -*- # Autopsy Forensic Browser # # Copyright 2013 Basis Technology Corp. # # 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/l...
eugene7646/autopsy
test/script/regression.py
Python
apache-2.0
93,572
#!/usr/bin/env python3 # Copyright 2021 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from collections import defaultdict import argparse import csv import logging import os import sys """This module contains the utilit...
nwjs/chromium.src
tools/mac/power/collapse_profile.py
Python
bsd-3-clause
9,423
# This file is part of Indico. # Copyright (C) 2002 - 2017 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
nop33/indico
indico/modules/events/contributions/operations.py
Python
gpl-3.0
9,065
import re from model.contact import Contact def test_phones_on_home_page(app): contact_from_home_page = app.contact.get_contact_list()[0] contact_info_from_edit_page = app.contact.get_contact_info_from_edit_page(0) assert contact_from_home_page.all_phone_from_home_page == merge_phones_like_on_home_page(con...
alobatse/python_training
test/test_check_contact_info.py
Python
apache-2.0
3,350
from django.shortcuts import get_object_or_404, render_to_response from django.template import RequestContext from django.http import HttpResponse, HttpResponseRedirect from django.core.urlresolvers import reverse from jaam.projects.models import Project from jaam.act.models import Act def information(request): s...
CoJMC/jaam
jaam/act/views.py
Python
gpl-3.0
814
from .error import AMFError from .packet import Packet from .types import AMF0String, AMF0Value, U8, U16BE, U32BE class AMFHeader(Packet): exception = AMFError def __init__(self, name, value, must_understand=False): self.name = name self.value = value self.must_understand = must_under...
fishscene/streamlink
src/streamlink/packages/flashmedia/amf.py
Python
bsd-2-clause
3,315
"""List of supported formats """ from collections import namedtuple _FORMAT = namedtuple('FormatDefinition', 'mime_type,' 'extension, schema') _FORMATS = namedtuple('FORMATS', 'GEOJSON, JSON, SHP, GML, GEOTIFF, WCS,' 'WCS100, WCS110, WCS20, WFS, WFS100,' ...
ricardogsilva/PyWPS
pywps/inout/formats/lists.py
Python
mit
1,471
# -*- coding: utf-8 -*- import os import fixtures import testtools _TRUE_VALUES = ('True', 'true', '1', 'yes') class TestCase(testtools.TestCase): """Test case base class for all unit tests.""" def setUp(self): """Run before each test method to initialize test environment.""" super(TestC...
ariddell/splitter
splitter/tests/base.py
Python
gpl-3.0
1,273
""" <name>Linear Projection (Qt)</name> <description>Create a linear projection.</description> <contact>Gregor Leban (gregor.leban@fri.uni-lj.si)</contact> <icon>icons/LinearProjection.svg</icon> <priority>140</priority> """ # LinProj.py # # Show a linear projection of the data # from OWVisWidget import * from OWLinPro...
jlegendary/orange
Orange/OrangeWidgets/VisualizeQt/OWLinProjQt.py
Python
gpl-3.0
24,231
# import sys from StringIO import StringIO import parsing from query_lexer import * import query_parser as qp import selector_parser as sp if len( sys.argv ) > 1: stream = StringIO( sys.argv[1] ) else: stream = StringIO( "//Host[name=\\tx a,gtype=\"MDB\\\"\"]/../abc//Nid/[_type=Host]/...[foo=xx]" ) parser =...
efocht/aggmon
src/qe/queryengine/parser_test.py
Python
gpl-2.0
754
from pybbix.api import API class User(API): pass
modulus-sa/pybbix
pybbix/api/user/__init__.py
Python
mit
55
from flask import Blueprint, current_app, request, render_template, url_for from flask.ext.login import LoginManager, login_user, logout_user, \ current_user, login_required from flask_mail import Message from reactgur.forms import RegistrationForm, LoginForm, \ TokenRegistrationForm, RegistrationRequestForm f...
spectralsun/reactgur
reactgur/api/user.py
Python
mit
5,238
def test_peanoclaw(): import runPeanoClawTests runPeanoClawTests.runTests()
unterweg/peanoclaw
testscenarios/peanoclaw_nose_test.py
Python
bsd-3-clause
79