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 stream_framework import exceptions as stream_framework_exceptions from stream_framework.utils import make_list_unique, datetime_to_epoch from stream_framework.utils.five import long_t import datetime import uuid import six MAX_AGGREGATED_ACTIVITIES_LENGTH = 15 class BaseActivity(object): ''' Common pa...
nikolay-saskovets/Feedly
stream_framework/activity.py
Python
bsd-3-clause
13,544
import numpy from GenOpt import GeneticOptimizer ##Booths Function but with an additional slack variable to show the constraint feature. def BoothsFnc(x): return (x[:, 0] + 2*x[:, 1] - 7)**2 + (2*x[:, 0] + x[:, 1] - 5)**2 InitialSolutions = [numpy.array([numpy.random.uniform(), numpy.random.uniform(), numpy.random....
kevinlioi/GenOpt
examples/constrained_optimization.py
Python
mit
762
# -*- encoding: utf-8; mode: python; grammar-ext: py -*- # ======================================================================== """ Copyright and other protections apply. Please see the accompanying :doc:`LICENSE <LICENSE>` and :doc:`CREDITS <CREDITS>` file(s) for rights and restrictions governing use of this soft...
posita/py-dimgx
test/__init__.py
Python
mit
2,637
from window import VimWindow import errors import base64 class StackWindow(VimWindow): '''Keeps track of the current execution stack''' name = 'STACK' dtext = '[[Execution Stack - most recent call first]]' def __init__(self, name = None): VimWindow.__init__(self, name) self.at = 0 ...
elsdrm/vim-debug
plugin/vim_debug/subwindows.py
Python
gpl-3.0
5,090
''' @author: Frank ''' import unittest from virtualrouter import virtualrouter from virtualrouter.plugins import dnsmasq from zstacklib.utils import jsonobject from zstacklib.utils import uuidhelper from zstacklib.utils import http import time class DhcpInfo(object): def __init__(self): se...
SoftwareKing/zstack-utility
virtualrouter/test/test_configure_dnsmasq.py
Python
apache-2.0
2,067
# -*- 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...
ubiar/odoo
addons/account/account.py
Python
agpl-3.0
190,836
import numpy from srxraylib.plot.gol import plot_image, plot import sys from comsyl.scripts.CompactAFReader import CompactAFReader def plot_stack(mystack,what="intensity",title0="X",title1="Y",title2="Z"): from silx.gui.plot.StackView import StackViewMainWindow from silx.gui import qt app = qt.QAppl...
srio/oasys-comsyl
orangecontrib/comsyl/scripts/load_results_from_file.py
Python
mit
2,411
#!/usr/bin/python # # Copyright (c) 2015 CenturyLink # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['previe...
hogarthj/ansible
lib/ansible/modules/cloud/centurylink/clc_firewall_policy.py
Python
gpl-3.0
21,233
# -*- coding: utf-8 -*- """ Thermodynamic analysis for Flux-Based Analysis .. moduleauthor:: pyTFA team """ from .thermo.tmodel import ThermoModel
EPFL-LCSB/pytfa
pytfa/__init__.py
Python
apache-2.0
151
# -*- coding: utf-8 -*- # Copyright (c) 2018, Ansible Project # Copyright (c) 2018, Abhijeet Kasurde <akasurde@redhat.com> # # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) import os from units.modules.utils import ModuleTestCase, set_module_args from units.compat.mock im...
alxgu/ansible
test/units/modules/system/test_java_keystore.py
Python
gpl-3.0
10,489
# -*- coding: UTF-8 -*- # Copyright 2013-2016 Rumma & Ko Ltd # License: GNU Affero General Public License v3 (see file COPYING for details) """Extends :mod:`lino_xl.lib.contacts` for :ref:`voga`. .. autosummary:: :toctree: management.commands.garble_persons fixtures.std fixtures.demo """ from lino_x...
lino-framework/voga
lino_voga/lib/contacts/__init__.py
Python
agpl-3.0
406
# -*- coding: utf-8 -*- from __future__ import unicode_literals import caching.base import datetime from django.conf import settings from django.db import migrations, models import django.db.migrations.operations.special import django.db.models.deletion import localflavor.us.models # Note: this file is a squashed me...
caktus/django-opendebates
opendebates/migrations/0001_squashed_0041_auto_20170331_1023.py
Python
apache-2.0
23,440
# # Newfies-Dialer License # http://www.newfies-dialer.org # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (C) 2011-2014 Star2Billing S.L. # # The Initia...
nishad89/newfies-dialer
newfies/context_processors.py
Python
mpl-2.0
978
# -*- encoding: utf-8 -*- ############################################################################## # # Account Payment Purchase module for OpenERP # Copyright (C) 2014 Akretion (http://www.akretion.com) # @author Alexis de Lattre <alexis.delattre@akretion.com> # # This program is free software: you ca...
rschnapka/bank-payment
account_payment_purchase/model/__init__.py
Python
agpl-3.0
1,088
# Copyright (c) 2015 Thales Services SAS # # 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 l...
wolverineav/neutron
neutron/tests/common/machine_fixtures.py
Python
apache-2.0
4,412
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
anish/buildbot
master/buildbot/test/unit/test_schedulers_basic.py
Python
gpl-2.0
24,335
import re import functools import collections import wrappers class History(object): """ Tracking of operations provenance. >>> h = History("some_op") >>> print str(h) some_op() >>> h.add_args(["w1", "w2"]) >>> print str(h) some_op( w1, w2 ) >>> h.add_kws({"a_ke...
TillArndt/CmsToolsAC3b
cmstoolsac3b/history.py
Python
gpl-3.0
2,488
#! /usr/bin/env python ############################################################################# ## ## ## inet6.py --- IPv6 support for Scapy ## ## see http://natisbad.org/IPv6/ ...
mytliulei/Scapy
scapy/layers/inet6.py
Python
apache-2.0
144,604
from pysnmp.hlapi import * from .scanner import Scanner class SNMP(Scanner): def __init__(self, cred, target, username, password, config): super(SNMP, self).__init__(cred, target, config, username, password) def fingerprint(self): # Don't fingerprint since it's UDP return True de...
ztgrace/changeme
changeme/scanners/snmp.py
Python
gpl-3.0
1,303
#! /usr/bin/env python ############################################################################### # # simulavr - A simulator for the Atmel AVR family of microcontrollers. # Copyright (C) 2001, 2002 Theodore A. Roth # # This program is free software; you can redistribute it and/or modify # it under the terms of th...
zouppen/simulavr
regress/test_opcodes/test_LD_X_decr.py
Python
gpl-2.0
3,080
# Generated by Django 2.2.1 on 2019-05-13 19:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [("peering", "0043_router_use_netbox")] operations = [ migrations.AddField( model_name="autonomoussystem", name="export_routing_poli...
respawner/peering-manager
peering/migrations/0044_auto_20190513_2153.py
Python
apache-2.0
875
# Copyright (c) 2012 OpenStack Foundation. # # 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...
shakamunyi/neutron-vrrp
neutron/plugins/linuxbridge/lb_neutron_plugin.py
Python
apache-2.0
24,565
!#/usr/bin/env python # # Script that creates (if not already present) MODEL_DATA and CORRECTED_DATA # columns in a MS # # These columns are expected to be present by the casapy imager task, and # if any of the two is missing any existing MODEL_DATA or CORRECTED_DATA # will be overwritten, thus destroying the result of...
jjdmol/LOFAR
CEP/Calibration/BBSControl/scripts/addClearcalColumns.py
Python
gpl-3.0
3,622
if 'raw_input' in dir(__builtins__): input = raw_input # para funcionar com Python 2 def ler_parcela(): parcela = input('+: ') try: parcela = float(parcela) except ValueError: return 0 return parcela # decorator def coro(func): def start(*args, **kwargs): g = func(*ar...
dcbdmb/example-code
attic/control/adder/soma_deco.py
Python
mit
1,002
import sys DEBUGGING = True def start_debug(): if DEBUGGING is True: PYDEV_SRC_DIR = "C:\pleiades\eclipse\plugins\org.python.pydev_4.5.3.201601211913\pysrc" # 環境に応じて書き換えが必要 if PYDEV_SRC_DIR not in sys.path: sys.path.append(PYDEV_SRC_DIR) import pydevd py...
natukikazemizo/sedna
Sedna/src/python/debug.py
Python
mit
419
# -*- coding: utf-8 -*- ################################################################################ # # WeatherLog: validate.py # This module validates user-entered data. # ################################################################################ # Import re for pattern matching. import re # Import os.p...
achesak/weatherlog
resources/validate.py
Python
gpl-3.0
3,008
#!/usr/bin/env python #coding: utf-8 #file : test_mget.py #author : ning #date : 2014-04-01 13:15:48 import os import re import commands ports = [ 4001, # before improve 4000, # after improve 2000 # redis ] def system(cmd): return commands.getoutput(cmd) def extra(regex, text): match = r...
kangkot/twemproxy
scripts/benchmark-mget.py
Python
apache-2.0
1,142
__author__ = 'lerker' # Dependencias externas #from scipy.io import loadmat, savemat import numpy as np text_extensions = ['.dat', '.txt', '.csv'] def parse_point(line): # TODO dar posibilidad de cambiar separador values = [float(x) for x in line.split(';')] return values[-1], values[0:-1] # Checks de...
lerker/cupydle
cupydle/dnn/viejo/fileio.py
Python
apache-2.0
3,182
from __future__ import absolute_import, division, print_function import argparse import difflib import os import sys try: from backports import configparser except Exception: import configparser from imps.core import Sorter def run(sorter, file_name, is_dry_run): # Why not send array of lines in if that...
bootandy/imps
imps/shell.py
Python
apache-2.0
3,805
############################################################################### # Copyright 2016 - Climate Research Division # Environment and Climate Change Canada # # This file is part of the "EC-CAS diags" package. # # "EC-CAS diags" is free software: you can redistribute it and/or modify # it under...
neishm/EC-CAS-diags
eccas_diags/diagnostics/movie_zonal.py
Python
lgpl-3.0
2,094
../../../../share/pyshared/PIL/EpsImagePlugin.py
Alberto-Beralix/Beralix
i386-squashfs-root/usr/lib/python2.7/dist-packages/PIL/EpsImagePlugin.py
Python
gpl-3.0
48
# # Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. # import resource import socket import fixtures import subprocess from util import retry from mockredis import mockredis from mockkafka import mockkafka import redis import urllib2 import copy import os import json import gevent import datetime from fc...
DreamLab/contrail-controller
src/opserver/test/utils/analytics_fixture.py
Python
apache-2.0
103,784
# Virtual memory analysis scripts. # Developed 2012-2014 by Peter Hornyack, pjh@cs.washington.edu # Copyright (c) 2012-2014 Peter Hornyack and University of Washington # This file contains useful methods for both running applications and # analyzing them later. from conf.system_conf import * from util.pjh_utils impor...
pjh/vm-analyze
trace/run_common.py
Python
bsd-3-clause
23,657
from ethel.runners.lintian import lintian, version def run(dfiles, package, job, firehose): if not isinstance(dfiles, list): dfiles = [dfiles] return lintian(dfiles, firehose, lintian_binary='lintian4py') def get_version(): return version(lintian_binary='lintian4py')
paultag/ethel
ethel/commands/lintian4py.py
Python
mit
291
# -*- coding: utf-8 -*- # Licensed under the MIT license # http://opensource.org/licenses/mit-license.php # <EXPERIMENTAL> # a backend to expose to the local network the content of an audio CD # inserted in a local drive # the CD data is extracted from the CDDB/FreeDB database # Warning: this backend does not dete...
sreichholf/python-coherence
coherence/backends/audiocd_storage.py
Python
mit
6,084
# 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
google/jax
jax/_src/lax/polar.py
Python
apache-2.0
12,686
# # Copyright (C) 2005 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed i...
GNOME/sabayon
lib/protosession.py
Python
gpl-2.0
17,389
from train import get_batch_for_test, load_data, load_related_train_data questions_vocab_processor, answers_vocab_processor, max_question_length = load_related_train_data() questions, answers, images_paths = load_data(questions_vocab_processor, answers_vocab_processor, True) output_len = len(answers_vocab_processor.vo...
MohammadChavosh/VQA
tensorflow_test.py
Python
apache-2.0
495
# coding: utf-8 from models import Post def count_posts(): return Post.count() def get_posts(begin): return Post.get_from_offset(begin) def delete_all_posts(): """This is a slow operation if you have many posts """ for post in Post.get_all(): delete_post(post.id) def delete_pos...
pygamebrasil/pygame-site
src/app/posts/usecase.py
Python
mit
1,006
"""ckan api key constraint Revision ID: 3da51a88205a Revises: 46c3f68e950a Create Date: 2014-04-01 11:33:01.394220 """ # revision identifiers, used by Alembic. revision = '3da51a88205a' down_revision = '46c3f68e950a' from alembic import op import sqlalchemy as sa def upgrade(): query = '''UPDATE "user" ...
PyBossa/pybossa
alembic/versions/3da51a88205a_ckan_api_key_constraint.py
Python
agpl-3.0
736
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals import pytest from indico.web.util import is_signed_url_valid, s...
mic4ael/indico
indico/web/util_test.py
Python
mit
1,914
#!/usr/bin/python import sys import fnmatch import os import shutil import argparse from argparse import RawTextHelpFormatter import time import math import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') import pylab as pl from matplotlib.ticker import MultipleLocator, FormatStrFo...
ederc/LA-BENCHER
scripts/bench-seq.py
Python
gpl-3.0
15,357
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
keras-team/keras
keras/engine/input_layer_test.py
Python
apache-2.0
13,964
import logging import json import struct _logger = logging.getLogger(__name__) IDENTIFY_COMMAND = 'IDENTIFY' class Identify(object): def __init__(self): self.__parameters = {} self.__cached = None self.__server_features = None def update(self, parameters): self.__cached = No...
dsoprea/NsqSpinner
nsq/identify.py
Python
gpl-2.0
7,713
#!/usr/bin/env python import os, sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cartoterra.settings") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
linventifatelier/cartoterra
manage.py
Python
agpl-3.0
247
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys try: from setuptools import setup except ImportError: from distutils.core import setup if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() readme = open('README.rst').read() history = open('HISTORY.rst...
eriknw/test_hof
setup.py
Python
bsd-3-clause
1,377
import sqlite3 from vee.cli import style_error, style_warning, style_note from vee.commands.main import command, argument, group from vee.environment import Environment from vee.environmentrepo import EnvironmentRepo from vee.home import PRIMARY_REPO from vee.utils import makedirs @command( help='manage environm...
westernx/vee
vee/commands/repo.py
Python
bsd-3-clause
4,356
"""Plugin for GOMeXP live streams. This plugin is using the same API as the mobile app. """ import re from streamlink.plugin import Plugin from streamlink.plugin.api import http, validate from streamlink.stream import HLSStream API_BASE = "http://gox.gomexp.com/cgi-bin" API_URL_APP = API_BASE + "/app_api.cgi" API_U...
mmetak/streamlink
src/streamlink/plugins/gomexp.py
Python
bsd-2-clause
1,400
# -*- coding: utf-8 -*- # # Copyright © 2014 Zulip, Inc. # # 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,...
calvinleenyc/zulip
api/integrations/basecamp/zulip_basecamp_config.py
Python
apache-2.0
2,131
from polybori.PyPolyBoRi import Polynomial, gauss_on_polys from polybori.nf import symmGB_F2_python from polybori.interpolate import variety_lex_leading_terms, nf_lex_points def dense_system(I): I = (Polynomial(p) for p in I) I = (p for p in I if not p.is_zero()) for p in I: d = p.deg() if...
ohanar/PolyBoRi
pyroot/polybori/heuristics.py
Python
gpl-2.0
921
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
sxjscience/tvm
tutorials/dev/bring_your_own_datatypes.py
Python
apache-2.0
17,559
from gain import Css, Item, Parser, Xpath def test_parse(): html = '<title class="username">tom</title><div class="karma">15</div>' class User(Item): username = Xpath('//title') karma = Css('.karma') parser = Parser(html, User) user = parser.parse_item(html) assert user.results...
babykick/gain
tests/test_parser.py
Python
gpl-3.0
757
# -*- coding: utf-8 -*- vim:fileencoding=utf-8: # vim: tabstop=4:shiftwidth=4:softtabstop=4:expandtab # Copyright © 2010-2012 Greek Research and Technology Network (GRNET S.A.) # # Permission to use, copy, modify, and/or distribute this software for any # purpose with or without fee is hereby granted, provided that th...
apoikos/servermon
hwdoc/admin.py
Python
isc
8,324
from uppgift1_04 import * import itertools def satisfiable(expr): keys = set(expr.variables()) possum = itertools.product([True,False], repeat=len(keys)) for outer in possum: v = {} for inner in outer: for key in keys: v[key] = inner if expr.value(v): ...
niklasnson/TDP015
inlämning_1/uppgift1_05.py
Python
mit
355
# -*- coding: utf-8 -*- # Generated by Django 1.9 on 2016-08-03 13:32 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('questions', '0003_renaming'), ] operations = [ migrations.AddField( ...
DMPwerkzeug/DMPwerkzeug
rdmo/questions/migrations/0004_full_title.py
Python
apache-2.0
1,129
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters. For example, given: S: "barfoothefoobarman" L: ["foo", "bar"] You should return the indice...
UmassJin/Leetcode
Array/Substring_with_Concatenation_of_All_Words.py
Python
mit
2,091
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2016 Canonical Ltd # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License version 3 as # published by the Free Software Foundation. # # This program is distributed in the h...
3v1n0/snapcraft
snapcraft/tests/test_options.py
Python
gpl-3.0
4,524
import unittest from unittest import mock from betfairlightweight.resources.baseresource import BaseResource from betfairlightweight.streaming.cache import ( OrderBookCache, OrderBookRunner, UnmatchedOrder, MarketBookCache, RunnerBookCache, Available, RaceCache, CricketMatchCache, ) fro...
liampauling/betfair
tests/test_cache.py
Python
mit
44,600
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import autoslug.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id...
henocdz/apichupe
app/migrations/0001_initial.py
Python
mit
614
#!/usr/bin/env python # ========================================================================= # # Copyright NumFOCUS # # 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:/...
blowekamp/SimpleITK
Examples/ImageRegistrationMethod3/ImageRegistrationMethod3.py
Python
apache-2.0
2,786
# Copyright 2012-2013 OpenStack Foundation # # 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 la...
dtroyer/osc-lib
osc_lib/command/commandmanager.py
Python
apache-2.0
2,042
import linkr # flake8: noqa: F401 import mock import util.response from test.backend.factory import UserFactory from test.backend.test_case import LinkrTestCase from uri.auth import AuthCheckURI, AuthLoginURI, AuthLogoutURI class TestAuth(LinkrTestCase): _multiprocess_can_split_ = True def test_api_auth_c...
LINKIWI/linkr
test/backend/test_api/test_auth.py
Python
mit
3,479
# Copyright 2014 Intel 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 require...
LoHChina/nova
nova/tests/unit/pci/test_device.py
Python
apache-2.0
4,380
import os import tempfile import unittest import logging from pyidf import ValidationLevel import pyidf from pyidf.idf import IDF from pyidf.natural_ventilation_and_duct_leakage import AirflowNetworkMultiZoneComponentHorizontalOpening log = logging.getLogger(__name__) class TestAirflowNetworkMultiZoneComponentHorizon...
rbuffat/pyidf
tests/test_airflownetworkmultizonecomponenthorizontalopening.py
Python
apache-2.0
2,357
import math from numpy import * def i4_bit_hi1 ( n ): #*****************************************************************************80 # ## I4_BIT_HI1 returns the position of the high 1 bit base 2 in an integer. # # Example: # # N Binary BIT # ---- -------- ---- # 0 0 0 # ...
lol/BCI-BO-old
sobol_lib.py
Python
gpl-3.0
13,482
# Load dependencies import ovito import ovito.vis # Load the native modules. import PyScriptGUI # Inject selected classes into parent module. ovito.vis.OpenGLRenderer = PyScriptGUI.OpenGLRenderer
srinath-chakravarthy/ovito
src/plugins/pyscript/gui/python/ovito/vis/gui/__init__.py
Python
gpl-3.0
197
from ctypes import * import sys import canlib.canlib as canlib def setUpChannel(channel=0, openFlags=canlib.canOPEN_ACCEPT_VIRTUAL, bitrate=canlib.canBITRATE_500K, bitrateFlags=canlib.canDRIVER_NORMAL): cl = canlib.canlib() ch = cl.openChannel(channel, openFl...
diyjac/Udacity-SDC-Radar-Driver-Micro-Challenge
tools/canESRplay.py
Python
mit
1,393
import os import subprocess import daemon import locale import config as global_config def invoke_git(command, *args): process = subprocess.Popen(["git", command] + list(args), stdout=subprocess.PIPE, stderr=None) process.wait() return process.communicate()[0].decode(locale.getpreferredencoding(False)) def git_...
LLA-Gaming/DreamDaemon-Control-Scripts
update.py
Python
gpl-2.0
1,225
# -*- coding:utf-8 -*- import datetime from koushihime.main.models import PushRecord, WaitingQueue def recent_have_pushed(title, hours=72): limit_date = datetime.datetime.utcnow() - datetime.timedelta(hours=hours) query = PushRecord.query.filter(PushRecord.title == title, PushRecord.pushed_time > limit_date)...
ethe/KoushiHime
koushihime/main/utils.py
Python
artistic-2.0
521
from django import forms from django.utils import timezone from bootstrap3_datetime.widgets import DateTimePicker from django_auth_ldap.backend import LDAPBackend from django.utils.translation import ugettext_lazy as _ from django.core.exceptions import ValidationError from django.contrib import messages from app.mode...
Compizfox/Inschrijflijst
app/forms/RegistrationsForm.py
Python
gpl-3.0
2,406
""" Downloads the necessary corpora for LocText. Usage: :: $ python -m loctext.download_data """ if __name__ == '__main__': import nltk from spacy.en import download CORPORA = ['stopwords'] for corpus in CORPORA: nltk.download(corpus) download.main(data_size='parser', force=False)
Rostlab/LocText
loctext/download_data.py
Python
apache-2.0
320
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache...
wallnerryan/quantum_migrate
quantum/plugins/cisco/extensions/_credential_view.py
Python
apache-2.0
1,925
from java.util import Map from geoscript.util import xml from geoscript.feature.feature import Feature def writeGML(f, ver=2, format=True, bounds=False, xmldecl=False, nsprefix='gsf'): """ Writes a :class:`Feature <geoscript.feature.Feature>` object as GML. *ver* specifies the gml version to encode. Supported v...
geoscript/geoscript-py
geoscript/feature/io/gml.py
Python
mit
1,392
from django.db import models from opencivicdata.models import Jurisdiction OBJECT_TYPES = ( ('jurisdiction', 'Jurisdiction'), ('person', 'Person'), ('organization', 'Organization'), ('post', 'Post'), ('membership', 'Membership'), ('bill', 'Bill'), ('vote_event', 'VoteEvent'), ('event',...
mileswwatkins/pupa
pupa/models.py
Python
bsd-3-clause
1,577
import os import unittest from mock import patch, Mock from tests.utils import ( FakedCache, ObjectWithSignals, setup_test_env, ) setup_test_env() from softwarecenter.db.database import StoreDatabase from softwarecenter.ui.gtk3.views import lobbyview from softwarecenter.ui.gtk3.widgets.exhibits import (...
sti-lyneos/shop
tests/gtk3/test_exhibits.py
Python
lgpl-3.0
6,973
import numpy import sys import time from mceditlib.test import templevel from mceditlib import relight # run me with the source checkout as the working dir so I can find the test_files folder. def natural_relight(): world = templevel.TempLevel("AnvilWorld") dim = world.getDimension() positions = [] f...
vorburger/mcedit2
src/mceditlib/bench/time_relight_natural.py
Python
bsd-3-clause
1,455
# Copyright 2018-2020 by Christopher C. Little. # This file is part of Abydos. # # Abydos 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 versio...
chrislit/abydos
tests/phonetic/test_phonetic_phonetic_spanish.py
Python
gpl-3.0
2,168
import matplotlib.pyplot as plt from sklearn import datasets, svm, metrics from sklearn.cross_validation import train_test_split digits = datasets.load_digits() # print(digits.target[2]) # plt.imshow(digits.data[2].reshape(8, 8),cmap=plt.cm.binary) # plt.show() features_train, features_test, targets_train, target...
eggie5/kaggle
digit-recognizer/digits.py
Python
mit
549
import mixedcase encoders = mixedcase.encoders for encoder in encoders: encoder["character encoding"] = "ascii"
ohio813/alpha3
x64/ascii/__init__.py
Python
bsd-3-clause
120
import os import pytest @pytest.fixture def travis(): return 'TRAVIS' in os.environ.keys() @pytest.fixture def appveyor(): return 'APPVEYOR' in os.environ.keys() @pytest.fixture def testdir(): return os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data') @pytest.fixture def testdata(testdi...
johntruckenbrodt/pyroSAR
tests/conftest.py
Python
mit
1,699
#!/usr/bin/env python """ wsonoma.py This module inherits from RecipeParser, and provides an implementation for parsing recipes from the williams-sonoma.com site. """ from urllib.parse import urlsplit from parser import RecipeParser class WilliamsSonoma(RecipeParser): def getTitle(self): """The title...
dpapathanasiou/recipebook
sites/wsonoma.py
Python
mit
2,219
# # # Copyright 2017-2019 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be), # Flemish Research Foundation (...
gppezzi/easybuild-framework
easybuild/tools/hooks.py
Python
gpl-2.0
7,004
import socket import struct, time import pprint from threading import Thread, Event import random class EcoPlug(object): CONNECTION_TIMEOUT = 60 def __init__(self, data): self.plug_data = data # Name set for outlet in phone app self.name = data[3].decode('utf-8') # 'Manufacture...
philburr/pyecoplug
pyecoplug/plug.py
Python
mit
4,103
#!/usr/bin/python ############################################################ # <bsn.cl fy=2013 v=onl> # # Copyright 2013, 2014 Big Switch Networks, Inc. # # Licensed under the Eclipse Public License, Version 1.0 (the # "License"); you may not use this file except in compliance # with the License. You ...
shengzhou/ONL
components/all/platform-config/powerpc-quanta-lb9a-r0/src/python/onlpc.py
Python
epl-1.0
2,801
"""Matrix linear algebra routines needed for GP models""" import scipy as SP import scipy.linalg as linalg import logging def solve_chol(A,B): """ Solve cholesky decomposition:: return A\(A'\B) """ # X = linalg.solve(A,linalg.solve(A.transpose(),B)) # much faster version X = ...
PMBio/pygp
pygp/linalg/linalg_matrix.py
Python
gpl-2.0
2,397
# PongAIvAI # Author: Michael Guerzhoy, 2014. # http://www.cs.toronto.edu/~guerzhoy/ # Email: guerzhoy at cs.toronto.edu # # 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 ve...
sooham/PongAI
misc/PongAIvAI_commented.py
Python
cc0-1.0
19,521
import functools import re import os from flask import Flask, render_template, request, jsonify from extensions import db, login_manager, csrf import config from sentiment_classifiers import SentimentClassifier, files, binary_dict from vk_parser import VkFeatureProvider app = Flask(__name__) ########################...
ArtemMIPT/sentiment_analysis
app.py
Python
mit
4,310
# Generate the Fibonacci sequence up to term N from sys import argv def fib(m, n = None, cache = None): if n is None: i = 2 else: i = n if cache is None: cache = (0, 1) if i > 0: i -= 2 while i > 0: cache = (cache[1], sum(cache)) i -= 1 while m >= 0: n_1 = sum(cache) p...
mykhamill/Projects-Solutions
solutions/fib.py
Python
mit
773
""" Plot function module for basic facts. """ import numpy as np import pandas as pd import seaborn as sns import matplotlib import matplotlib.pyplot as plt plt.style.use('ggplot') import matplotlib as mpl bl = '#58ACFA' def plot_attack_ferq_per_year(attacks): plt.subplots(figsize=(15,6)) sns.countplot(attacks['Ye...
mdeff/ntds_2017
projects/reports/terrorist_attacks/project/plots.py
Python
mit
4,471
import os import sys import unittest from unittest.mock import MagicMock, patch from coalib import coala from coala_utils.ContextManagers import prepare_file from tests.TestUtilities import execute_coala, bear_test_module # patch gets strangely lost when only defined in method or with context where # actually need...
karansingh1559/coala
tests/coalaDebugFlagTest.py
Python
agpl-3.0
4,978
import billboard import json import urllib from urllib.parse import quote apikey = 'APIKEY' # make the empty dictionary songs = {} # loop through the years we're interested in for x in range(1960, 2016): # another dictionary inside songs[x] = {} # get the chart for the last week of that year chart = ...
libbyh/methods-f16
final-projects/robert-carlos-countVulgar/get-data.py
Python
mit
2,465
""" The :mod:`sklearn.model_selection._split` module includes classes and functions to split the data based on a preset strategy. """ # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr>, # Gael Varoquaux <gael.varoquaux@normalesup.org>, # Olivier Grisel <olivier.grisel@ensta.org> # Ragha...
alexsavio/scikit-learn
sklearn/model_selection/_split.py
Python
bsd-3-clause
62,253
# -*- coding: utf-8 -*- """ The module contains global settings and variables for the application. """ from __future__ import absolute_import, division, print_function from .environ import ( base_dir, pod_dir, pkgs_dir, logs_dir, conf_dir, data_dir, mods_dir, )
nickchen-mitac/fork
src/ava/runtime/__init__.py
Python
apache-2.0
270
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('calls', '0001_initial'), ] operations = [ migrations.AddField( model_name='call', name='end', ...
shailr/vms
calls/migrations/0002_call_end.py
Python
gpl-2.0
385
import os import misopy import misopy.gff_utils as gff_utils def parseGene(pickle_filename, event): """ Parse a pickled gene. """ if not os.path.isfile(pickle_filename): raise Exception, "Error: no filename %s" %(pickle_filename) gff_genes = gff_utils.load_indexed_gff_file(pickle_filename)...
nsalomonis/AltAnalyze
misopy/parse_gene.py
Python
apache-2.0
1,634
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals import os import sys from cms.utils.compat import DJANGO_1_9 def noop_gettext(s): return s permission = True cms_toolbar_edit_on = 'edit' port = 8000 for arg in sys.argv: if arg == '--CMS_PERMISSION=False': permi...
FinalAngel/django-cms
testserver.py
Python
bsd-3-clause
4,450
from Products.ZenModel.ZenossSecurity import ZEN_COMMON from Products.ZenUtils.Utils import zenPath from Products.CMFCore.DirectoryView import registerDirectory from time import localtime,strftime import re import Globals import os skinsDir = os.path.join(os.path.dirname(__file__), 'skins') from Products.CMFCore.Direc...
zenoss/ZenPacks.fdeckert.reports
ZenPacks/fdeckert/reports/__init__.py
Python
gpl-2.0
1,822
''' Queries yummly's API to search for 'recipe', which according to the content of the response contains 2.1 million hits. Iterate through these results indefinitely, storing them in yummly.db. ''' import datetime import json from json import JSONDecodeError import urllib.request from urllib.error import HTTPError im...
cvcassady/RecipeBot
scrapingyummly.py
Python
mit
2,939
# PyAPNs was developed by Simon Whitaker <simon@goosoftware.co.uk> # Source available at https://github.com/simonwhitaker/PyAPNs # # PyAPNs is distributed under the terms of the MIT license. # # Copyright (c) 2011 Goo Software Ltd # # Permission is hereby granted, free of charge, to any person obtaining a copy of # thi...
sahara-ooga/objc-basic
2-5-9_ServerSide/apns/apns.py
Python
mit
24,844
from blueice.test_helpers import * from blueice.model import Model def test_mcsource(): conf = test_conf(mc=True) m = Model(conf) s = m.sources[0] bins = conf['analysis_space'][0][1] assert s.events_per_day == 1000 assert s.fraction_in_range > 0.9999 # Ten sigma events happen sometimes.. ...
JelleAalbers/blueice
tests/test_source.py
Python
bsd-3-clause
494