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 |
|---|---|---|---|---|---|
"""
Compute and plot statistics such as the mean in a rolling window of data.
Copyright 2016 Deepak Subburam
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 of the License, or
(at y... | Fenugreek/tamarind | moving.py | Python | gpl-3.0 | 6,793 |
import threading
import mysql.connector.pooling
import re
if __name__ == "__main__":
import catdb
else:
from lib import catdb
# Allows multithreading when creating a connection to database and executing an SQL statement.
# threadID: a number representing this unique thread.
# catalogconn: a mysql connection f... | RoryAndrews/Python-Parallel-DB | lib/ConnectionThread.py | Python | mit | 5,759 |
import os
import re
import tempfile
import synth_test
import verilator_test
# Set from external.
iroha_binary=""
with_synth_test=False
with_verilator_test=False
karuta_binary="../karuta-bin"
tmp_prefix = "/tmp"
default_tb="test_tb.v"
verilog_compiler="iverilog"
def FileBase(fn):
bn = os.path.basename(fn)
#... | nlsynth/nli | tests/karuta_test.py | Python | gpl-3.0 | 6,556 |
#!/usr/bin/env python2
from sys import stdin
n = raw_input().split(' ')
k = int(n[1])
n = int(n[0])
ans = 0
for i in range(0, n):
t = int ( stdin.readline() )
if (t%k) == 0: ans += 1
print (ans)
| jailuthra/misc | codechef/intest.py | Python | mit | 207 |
#!/usr/bin/env python
import copy
import json
import os
import os.path
import re
import sys
from collections import OrderedDict
from CTDopts.CTDopts import (
_Choices,
_FileFormat,
_InFile,
_Null,
_NumericRange,
_OutFile,
_OutPrefix,
ModelError,
ParameterGroup
)
from lxml import etr... | WorkflowConversion/CTDConverter | ctdconverter/galaxy/converter.py | Python | gpl-3.0 | 95,121 |
#-----------------------------------------------------------------------------
# Copyright (c) 2016-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | etherkit/OpenBeacon2 | client/linux-arm/venv/lib/python3.6/site-packages/PyInstaller/hooks/hook-xsge_gui.py | Python | gpl-3.0 | 674 |
from mazeexp.engine.mazeexp import MazeExplorer
| mryellow/maze_explorer | mazeexp/__init__.py | Python | mit | 48 |
#!/usr/bin/python
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import time
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)),
... | coreos/chromite | scripts/deploy_chrome_unittest.py | Python | bsd-3-clause | 8,629 |
"""
Script for building the example:
Usage:
python setup.py py2app
"""
from distutils.core import setup
import py2app
plist = dict(
CFBundleDocumentTypes = [
dict(
CFBundleTypeExtensions=[u'ToDos', u'*'],
CFBundleTypeName=u'ToDos File',
CFBundleTypeRole=u'Editor',
... | albertz/music-player | mac/pyobjc-framework-Cocoa/Examples/AppKit/CocoaBindings/ToDos/setup.py | Python | bsd-2-clause | 528 |
from oeqa.oetest import oeRuntimeTest
from oeqa.utils.decorators import tag
@tag(TestType = 'FVT', FeatureID = 'IOTOS-1546')
class Test_Intel_Graphics_lib(oeRuntimeTest):
''' Test Intel Graphics lib integrated '''
lib_info = {
"libDRM" : ["/usr/lib/libdrm.so"],
"xf86-video-inte... | daweiwu/meta-iotqa-1 | lib/oeqa/runtime/graphics/test_enable_Intel_Linux_Graphics_lib.py | Python | mit | 1,634 |
# -*- coding: utf-8 -*-
"""Microsoft Internet Explorer (MSIE) zone information collector."""
from winregrc import interface
class MSIEZoneInformation(object):
"""MSIE zone information.
Attributes:
control (str): control.
control_value (int|str): value to which the control is set.
zone (str): identif... | libyal/winreg-kb | winregrc/msie_zone_info.py | Python | apache-2.0 | 6,351 |
# =============================================================================
# Copyright (C) 2010 Diego Duclos
#
# This file is part of pyfa.
#
# pyfa 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 ... | pyfa-org/Pyfa | gui/builtinViewColumns/misc.py | Python | gpl-3.0 | 42,823 |
from . import model
from . import cv_tools
| gu-yan/mlAlgorithms | mxnet/__init__.py | Python | apache-2.0 | 43 |
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | endlessm/chromium-browser | third_party/grpc/src/examples/python/interceptors/headers/greeter_server.py | Python | bsd-3-clause | 1,679 |
from __future__ import unicode_literals
from django.utils import regex_helper
from django.utils import unittest
class NormalizeTests(unittest.TestCase):
def test_empty(self):
pattern = r""
expected = [('', [])]
result = regex_helper.normalize(pattern)
self.assertEqual(result, expe... | openhatch/new-mini-tasks | vendor/packages/Django/tests/regressiontests/utils/regex_helper.py | Python | apache-2.0 | 1,801 |
# Copyright (C) 2010-2011 Richard Lincoln
#
# 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... | rwl/PyCIM | CIM15/IEC61970/Informative/InfLocations/LocationGrant.py | Python | mit | 3,144 |
# coding=utf-8
# Copyright 2022 The TensorFlow Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | tensorflow/datasets | tensorflow_datasets/core/dataset_info.py | Python | apache-2.0 | 33,196 |
"""
https://leetcode.com/problems/uncommon-words-from-two-sentences/
https://leetcode.com/submissions/detail/182166803/
"""
class Solution:
def uncommonFromSentences(self, A, B):
"""
:type A: str
:type B: str
:rtype: List[str]
"""
apt = dict()
def traverse... | vivaxy/algorithms | python/problems/uncommon_words_from_two_sentences.py | Python | mit | 1,098 |
''' Symmetrize weights in the active group.'''
'''
*******************************************************************************
License and Copyright
Copyright 2012 Jordan Hueckstaedt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as pub... | assumptionsoup/Symmetrize-Weights | symmetrize_weights.py | Python | gpl-3.0 | 3,979 |
from bokeh.layouts import column
from bokeh.models.widgets import Div
from dashboard.bokeh.plots.descriptors.table import Table
from dashboard.bokeh.plots.descriptors.title import Title
from dashboard.bokeh.plots.patch.main import Patch
from qlf_models import QLFModels
from bokeh.resources import CDN
from bokeh.emb... | linea-it/qlf | backend/framework/qlf/dashboard/bokeh/qagetrms/main.py | Python | gpl-3.0 | 3,450 |
# -*- coding: utf-8 -*-
#
# This file is part of the jabber.at homepage (https://github.com/jabber-at/hp).
#
# This project 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 (... | jabber-at/hp | hp/bootstrap/widgets.py | Python | gpl-3.0 | 4,414 |
def suffixArray(s):
n = len(s)
rkd = {c: i for i, c in enumerate(sorted(set(s)))}
rank = [rkd[c] for c in s]
k = 1
while k <= n:
xy = [(rank[i], (rank[i+k] if i+k < n else -1)) for i in xrange(n)]
rkd = {c: i for i, c in enumerate(sorted(set(xy)))}
rank = [rkd[c] for c in xy]... | scturtle/DSpy | suffixArray.py | Python | unlicense | 781 |
"""
Django settings for paperlink_backend project.
Generated by 'django-admin startproject' using Django 1.8.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.8/ref/settings/
"""
# ... | Dawnflying/PaperFriends | paperlink_backend/paperlink_backend/settings.py | Python | apache-2.0 | 3,109 |
# coding: utf-8
#------------------------------------------------------------------------------
# Copyright 2017 Esri
# 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... | Esri/solutions-geoprocessing-toolbox | utils/test/geonames_tests/GeoNamesTestCase.py | Python | apache-2.0 | 4,726 |
"""The tests device sun light trigger component."""
# pylint: disable=protected-access
from datetime import datetime
from asynctest import patch
import pytest
from homeassistant.setup import async_setup_component
from homeassistant.const import CONF_PLATFORM, STATE_HOME, STATE_NOT_HOME
from homeassistant.components im... | jnewland/home-assistant | tests/components/device_sun_light_trigger/test_init.py | Python | apache-2.0 | 3,684 |
#!/usr/bin/env python
# A comment, this is so you can read your program later.
# Anything after the # is ignored by python.
print "I could have code like this." # and the comment after is ignored
# You can also use a comment to "disable" or comment out a piece of code:
# print "This won't run."
print "This will run... | moralesjason/learnpythonthehardway | ex2commentsandpoundcharacters.py | Python | gpl-3.0 | 323 |
import unittest
from flumine import config
class ConfigTest(unittest.TestCase):
def test_init(self):
self.assertFalse(config.simulated)
self.assertTrue(config.simulated_strategy_isolation)
self.assertIsInstance(config.customer_strategy_ref, str)
self.assertIsInstance(config.proces... | liampauling/flumine | tests/test_config.py | Python | mit | 865 |
# -*- coding: utf-8 -*-
{
'name': "Recepción",
'summary': """
Módulo de Gestión de visitantes a la recepción""",
'description': """
Módulo de Gestión de visitantes a Recepción
===========================================
Registra las visitas a FOMDES especificando la fecha y la dependencia destino... | sani-coop/tinjaca | addons/recepcion/__openerp__.py | Python | gpl-2.0 | 1,153 |
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2016
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | steve-ord/daliuge | daliuge-engine/test/test_tool.py | Python | lgpl-2.1 | 1,587 |
__author__ = 'Cedric Da Costa Faro'
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(405)
def method_not_allowed(e):
return render_template('405.html'), 405
@main.app_errorhandler(500)
de... | cdcf/time_tracker | app/main/errors.py | Python | bsd-3-clause | 392 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
s3_to_redshift.py is uses the RedshiftPostgres class (see redshift_psql.py)
to copy appropriately formatted data from s3 into a table in redshift. Note
LOAD is kept within the Python file, and create table is read from the
schema/db.sql file.
"""
import copy
import o... | Yelp/mycroft | mycroft/sherlock/batch/s3_to_redshift.py | Python | mit | 26,638 |
# -*- coding: utf-8 -*-
import hashlib
import json
import os
import shutil
import tempfile
import zipfile
from datetime import datetime
from django import forms
from django.core.files.storage import default_storage as storage
from django.conf import settings
import mock
import path
from nose.tools import eq_
import ... | wagnerand/zamboni | apps/files/tests/test_models.py | Python | bsd-3-clause | 40,312 |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016 CERN.
#
# Invenio 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... | inveniosoftware/invenio-groups | tests/test_forms.py | Python | gpl-2.0 | 1,637 |
import sublime
import sublime_plugin
from ..settings import *
from .base_window import BaseWindowCommand
PackageControl = __import__('Package Control')
class PackageBundlerManagerCommand(BaseWindowCommand):
management_options_label = ['Add ignored package', 'Remove ignored package']
def chosen_bundle(self, ... | STPackageBundler/package-bundler | package_bundler/commands/manager.py | Python | mit | 3,239 |
# 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... | airbnb/airflow | docs/exts/operators_and_hooks_ref.py | Python | apache-2.0 | 9,998 |
# -*- coding: utf-8 -*-
# Gitless - a version control system built on top of Git
# Licensed under MIT
"""End-to-end test."""
import logging
import os
import re
import time
from subprocess import CalledProcessError
import sys
from gitless.tests import utils
try:
text = unicode
except NameError:
text = str
cla... | sdg-mit/gitless | gitless/tests/test_e2e.py | Python | mit | 25,793 |
# ztreamy: a framework for publishing semantic events on the Web
# Copyright (C) 2011-2015 Jesus Arias Fisteus
#
# 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 of the License, ... | jfisteus/ztreamy | ztreamy/logger.py | Python | gpl-3.0 | 4,535 |
# helper functions to add (generate) calendar days in data set
import calendar
import graphlab as gl
import numpy as np
def add_running_year(month_sf, start_year):
year_attrib = []
for row_idx in range(len(month_sf)):
running_month = month_sf[row_idx]
if row_idx == 0:
... | tgrammat/ML-Data_Challenges | Dato-tutorials/marketing-analytics/helper_functions.py | Python | apache-2.0 | 4,111 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-07-10 18:03
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0005_auto_20170615_1524'),
('accounts', '0007_auto_20170626_1811'),
]
o... | pattisdr/lookit-api | accounts/migrations/0008_merge_20170710_1803.py | Python | mit | 340 |
from socket import *
from xml.dom.minidom import parse
import xml.dom.minidom
# Server connection
host = "10.1.0.46"
print host
port=7777
s=socket(AF_INET, SOCK_STREAM)
print "socket made"
s.connect((host,port))
print "socket connected"
# Open XML document using minidom parser
DOMTree = xml.dom.minidom.parse... | rokrapoorv/SMTS | RaspPI/client.py | Python | gpl-3.0 | 1,016 |
"""
Measure resonators, one at a time, with the readout tone centered in the filterbank bin.
"""
from __future__ import division
import time
import numpy as np
from kid_readout.roach import analog, calculate, hardware_tools
from kid_readout.measurement import acquire, basic
from kid_readout.equipment import hardware,... | ColumbiaCMB/kid_readout | apps/data_taking_scripts/cooldown/2017-02-10_hpd/r1h11_sweepstream_led.py | Python | bsd-2-clause | 5,355 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-07 02:42
from __future__ import unicode_literals
from django.db import migrations
# NOTE: The name of the constrait is generated by Django ORM.
UNIQUE_INDEX_NAME = 'rest_framework_reactive_item_observer_id_order_9b8adde6_uniq'
class Migration(migratio... | genialis/django-rest-framework-reactive | src/rest_framework_reactive/migrations/0002_defer_order_constraint.py | Python | apache-2.0 | 1,152 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.compat}.
"""
from __future__ import division, absolute_import
import socket, sys, traceback
from twisted.trial import unittest
from twisted.python.compat import set, frozenset, reduce, execfile, _PY3
from twiste... | biddisco/VTK | ThirdParty/Twisted/twisted/test/test_compat.py | Python | bsd-3-clause | 19,199 |
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-satellites
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Utilities for extracting text from generated classes.
"""
def is_string(txt):
if isinstance(... | daniestevez/gr-satellites | docs/doxygen/doxyxml/text.py | Python | gpl-3.0 | 1,276 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Savoir-faire Linux
# (<http://www.savoirfairelinux.com>).
#
# This program is free software: you can redistribute it and/or m... | gurneyalex/vertical-travel | passport_expiration/__openerp__.py | Python | agpl-3.0 | 1,802 |
from enum import Enum
class Direction(Enum):
invalid = (0.0, 0.0)
up = (0.0, -1.0)
down = (0.0, 1.0)
left = (-1.0, 0.0)
right = (1.0, 0.0)
def x(self):
return self.value[0]
def y(self):
return self.value[1]
def __str__(self):
return str(self.... | Daarknes/Gadakeco | src/util/directions.py | Python | gpl-3.0 | 328 |
# -*- coding: utf-8 -*-
# Copyright (C) 2005 Osmo Salomaa
#
# 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 of the License, or
# (at your option) any later version.
#
# This pr... | otsaloma/gaupol | gaupol/unittest.py | Python | gpl-3.0 | 2,078 |
import base64
import datetime
import json
import os
import re
import unittest2 as unittest
from stacktester import openstack
from stacktester import exceptions
from stacktester.common import ssh
from stacktester.common import utils
class ServersTest(unittest.TestCase):
@classmethod
def setUpClass(self):
... | rackspace-titan/stacktester | stacktester/tests/test_servers.py | Python | apache-2.0 | 19,355 |
#!/usr/bin/env python
import codecs
import json
import os
import time
from weibo import Client
import config
if __name__ == '__main__':
c = Client(config.WEIBO_API_KEY, config.WEIBO_API_SECRET,
config.REDIRECT_URI, token=config.TOKEN)
timeline = c.get('statuses/public_timeline', count=200)
... | gwu-libraries/ywow | fetch.py | Python | mit | 1,713 |
"""
Load WKB into pysal shapes.
Where pysal shapes support multiple parts,
"MULTI"type shapes will be converted to a single multi-part shape:
MULTIPOLYGON -> Polygon
MULTILINESTRING -> Chain
Otherwise a list of shapes will be returned:
MULTIPOINT -> [pt0, ..., ptN]
Some concepts aren't well supported by... | sjsrey/pysal_core | pysal_core/io/util/wkb.py | Python | bsd-3-clause | 7,872 |
__author__ = 'megabytephreak'
from rdl_lexer import RdlLexer, RdlToken
from ply import yacc
from ply.lex import LexToken
import rdl_ast
from rdlcompiler.colorize import colorize, RED
from rdlcompiler.logger import logger
def make_list_prod(prod, tprod):
def rule(self, p):
if len(p) == 3:
p[0... | MegabytePhreak/rdl | rdlcompiler/systemrdl/rdl_parser.py | Python | mit | 10,300 |
from enum import IntEnum
from django.contrib.auth.models import AbstractUser
from django.db import models
class Role(IntEnum):
Player = 0
Contributor = 1
Master = 2
ROLE_CHOICES = (
(0, "Player"),
(1, "Contributor"),
(2, "Master"),
)
class User(AbstractUser):
role = models.PositiveSma... | pennomi/brimstone-website | apps/accounts/models.py | Python | agpl-3.0 | 421 |
from . import define
# Internal
define("api_version",
default="0.2",
help="Service API version to return to the users in header X-API-Version",
type=str)
define("internal_restrict",
default=["127.0.0.1/24", "::1/128"],
help="An addresses considered internal (can be multiple). Requ... | anthill-services/anthill-common | anthill/common/options/default.py | Python | mit | 3,407 |
# -*- coding: utf-8 -*-
"""
babel.messages.frontend
~~~~~~~~~~~~~~~~~~~~~~~
Frontends for the message extraction functionality.
:copyright: (c) 2013 by the Babel Team.
:license: BSD, see LICENSE for more details.
"""
from __future__ import print_function
import logging
import optparse
import os
i... | iamshubh22/babel | babel/messages/frontend.py | Python | bsd-3-clause | 35,276 |
"""
Celery task management.
http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#using-celery-with-django
https://realpython.com/blog/python/asynchronous-tasks-with-django-and-celery/
"""
from __future__ import absolute_import, unicode_literals
import os
# from . import settings
from celery imp... | matthiaskoenig/tellurium-web | teweb/teweb/celery.py | Python | lgpl-3.0 | 1,083 |
#!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys
import logging
import subprocess
import shlex
logger = logging.getLogger(__name__)
def run_cmd(cmd):
logger.info("Running: " + cmd)
subprocess.... | DISCASM/DISCASM | PyLib/Pipeliner.py | Python | bsd-3-clause | 1,704 |
import glob
import json
import csv
from models.company import company
from models.policies import policies_model
from sim.train_sklearn import train_sklearn
from sim.model_sklearn import regression_sklearn
from sim.model_sklearn import classifier_sklearn
class TestGeneration:
all_risks = ["bruteforce", "stolen"]... | mapto/sprks | test/simulation/test_mainsim.py | Python | mit | 5,169 |
import logging
import sdk_cmd
from tests import auth
LOG = logging.getLogger(__name__)
def add_acls(user: str, marathon_task: str, topic: str, zookeeper_endpoint: str, env_str=None):
"""
Add Producer and Consumer ACLs for the specifed user and topic
"""
_add_role_acls(["--producer"], user, maratho... | mesosphere/dcos-kafka-service | frameworks/kafka/tests/topics.py | Python | apache-2.0 | 2,534 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import os
class Config:
def __init__(self, **kwargs):
self.config = dict()
self.config.update(kwargs)
@classmethod
def from_dict(cls, defaults):
config = Config()
config.add_from_dict(defaults)
return config
... | peletomi/zooker | src/zooker/config.py | Python | bsd-3-clause | 1,510 |
#!/bin/usr/env python
# coding:utf-8
__author__ = 'Samuel Chen <samuel.net@gmail.com>'
import sys
import time
x = ['\\', '/', '-']
for i in range(50):
j = i % 3
sys.stdout.write('File x is downloading .. %s [' % x[j])
sys.stdout.write('=' * i)
sys.stdout.write('-')
sys.stdout.... | samuelchen/code-snippets | python/cli-progress-bar.py | Python | gpl-2.0 | 487 |
#
# livef1
#
# f1item.py - Storage class for the drivers information
#
# Copyright (c) 2014 Marc Bertens <marc.bertens@pe2mbs.nl>
#
# 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; e... | livef1/Livef1-web | src/item.py | Python | gpl-2.0 | 2,348 |
__all__ = ['game_page',
'player_page',
'team_page'] | muneebalam/scrapenhl2 | scrapenhl2/plot/app/__init__.py | Python | mit | 73 |
import numpy as np
from .base import AnalyticalPropagator
from ..constants import Earth
from ..dates import timedelta
class J2(AnalyticalPropagator):
"""Analytical propagator taking only the Earth-J2 effect into account"""
@property
def orbit(self):
return self._orbit if hasattr(self, "_orbit") ... | galactics/space-api | beyond/propagators/j2.py | Python | gpl-3.0 | 1,215 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA
#
# This program is free software: you can redistribute it and/or modify
# it unde... | cgaspoz/l10n-switzerland | __unported__/l10n_ch_dta/payment.py | Python | agpl-3.0 | 1,325 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2016 Nigel Small
#
# 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 re... | nigelsmall/nige.tech | test/test_partitioner.py | Python | apache-2.0 | 1,730 |
# -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2009, 2010, 2011 CERN.
##
## Invenio 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 yo... | kaplun/Invenio-OpenAIRE | modules/bibknowledge/lib/bibknowledge.py | Python | gpl-2.0 | 16,708 |
from ..broker import Broker
class DevicePolicyBroker(Broker):
controller = "device_policies"
def show(self, **kwargs):
"""Shows the details for the specified device policy.
**Inputs**
| ``api version min:`` None
| ``api version max:`` None
| ``requ... | infobloxopen/infoblox-netmri | infoblox_netmri/api/broker/v2_4_0/device_policy_broker.py | Python | apache-2.0 | 79,094 |
"""
@author: Geir Sporsheim
@license: see LICENCE for details
"""
from twisted.internet import defer
from twisted.conch.ssh.userauth import SSHUserAuthClient
class AutomaticUserAuthClient(SSHUserAuthClient):
"""User Auth Client that automatically authenticate using stored credentials.
"""
def __init__(se... | sporsh/carnifex | carnifex/ssh/userauth.py | Python | mit | 1,372 |
def foo(*args, **kwargs):
print(args, kwargs)
foo(0,
*[1],
<warning descr="Python version 2.7 does not allow positional arguments after *expression">2</warning>,
<warning descr="Python version 2.7 does not allow duplicate *expressions">*[3]</warning>,
<warning descr="Python version 2.7 does not al... | siosio/intellij-community | python/testData/inspections/PyCompatibilityInspection/argumentsUnpackingGeneralizations.py | Python | apache-2.0 | 828 |
import time
from machine import I2C
ALTITUDE = const(0)
PRESSURE = const(1)
class MPL3115A2exception(Exception):
pass
class MPL3115A2:
MPL3115_I2CADDR = const(0x60)
MPL3115_STATUS = const(0x00)
MPL3115_PRESSURE_DATA_MSB = const(0x01)
MPL3115_PRESSURE_DATA_CSB = const(0x02)
MPL3115_PRESSURE_DA... | beia/beialand | practice/pycom-mqtt/Pysense/lib/MPL3115A2.py | Python | gpl-3.0 | 4,540 |
"""
Django settings for isrp project.
Generated by 'django-admin startproject' using Django 1.9.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bu... | marcin-pwr/isrp | isrp/settings.py | Python | mit | 4,030 |
#! /usr/bin/python2.7
#------------------------------------------------------------------------
# Copyright (c) 1997-2001 by Total Control Software
# All Rights Reserved
#------------------------------------------------------------------------
#
# Module Name: dbShelve.py
#
# Descript... | 2ndy/RaspIM | usr/lib/python2.7/bsddb/dbshelve.py | Python | gpl-2.0 | 12,204 |
import csv
class WiggleParser(object):
"""
Warning - this does not implement the full specification!
"""
def entries(self, input_fh):
track_name = None
replicon = None
span = None
pos_value_pairs = []
for line in input_fh:
row = line[:-1].split()
... | konrad/kufpybio | kufpybio/wiggle.py | Python | isc | 2,713 |
from django.db import models
import datetime
# Create your models here.
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __unicode__(self):
return self.question
def was_published_today(self):
return self.pub_dat... | JanezStupar/tastypie_demo | polls/models.py | Python | mit | 647 |
EXTERNAL_RESOURCES = {
"ensembl" : [
{
"url" : "http://plants.ensembl.org/biomart/martservice?query=",
"file" : "dosa_resources/ensembl_mapping.xml",
"output" : "ensembl_mapping.list",
... | fikipollo/paintomics3 | PaintomicsServer/src/AdminTools/scripts/dosa_resources/download_conf.py | Python | gpl-3.0 | 861 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Satpy developers
#
# This file is part of satpy.
#
# satpy 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... | pytroll/satpy | satpy/modifiers/spectral.py | Python | gpl-3.0 | 8,141 |
from TSatPy import StateOperator, Estimator, State
from TSatPy.Clock import Metronome
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
import time
print('P-Estimator With a Propagated State')
x_ic = State.State(
State.Quaternion([0,0,1],radians=190/180.0*np.pi),... | MathYourLife/TSatPy-thesis | tex/sample_scripts/Estimators_02.py | Python | mit | 3,049 |
# Copyright 2013 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.
"""Runs linker tests on a particular device."""
import logging
import os.path
import sys
import traceback
from pylib import constants
from pylib.base impor... | patrickm/chromium.src | build/android/pylib/linker/test_runner.py | Python | bsd-3-clause | 3,271 |
"""
:codeauthor: Rupesh Tare <rupesht@saltstack.com>
:codeauthor: Herbert Buurman <herbert.buurman@ogd.nl>
"""
import pytest
import salt.modules.mine as mine
import salt.utils.mine
from salt.utils.odict import OrderedDict
from tests.support.mock import MagicMock, patch
class FakeCache:
def __init__(self... | saltstack/salt | tests/pytests/unit/modules/test_mine.py | Python | apache-2.0 | 21,050 |
#!/usr/bin/env python
import os
import time
username = 'root'
defaultdb = 'postgres'
port = '5433'
backupdir='/www/backup/'
date = time.strftime('%Y-%m-%d')
#GET DB NAMES
get_db_names="psql -U%s -d%s -p%s --tuples-only -c '\l' | awk -F\| '{ print $1 }' | grep -E -v '(template0|template1|^$)'" % (username, defaultdb, ... | ActiveState/code | recipes/Python/577793_PostgreSQL_database/recipe-577793.py | Python | mit | 804 |
#!/usr/bin/python3
"""
Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2]
< nums[3]....
Example 1:
Input: nums = [1, 5, 1, 1, 6, 4]
Output: One possible answer is [1, 4, 1, 5, 1, 6].
Example 2:
Input: nums = [1, 3, 2, 2, 3, 1]
Output: One possible answer is [2, 3, 1, 3, 1, 2].
Note:
You m... | algorhythms/LeetCode | 324 Wiggle Sort II py3.py | Python | mit | 2,047 |
import time
from bsddb3 import db
import random
import os
# Make sure you run "mkdir /tmp/my_db" first!
DA_FILE_HS = "/tmp/dfagnan_db/hash_db"
DB_SIZE = 100000
SEED = 10000000
def get_random():
return random.randint(0, 63)
def get_random_char():
return chr(97 + random.randint(0, 25))
def main():
print("----------... | deric92/C291Project2 | hashdb.py | Python | mit | 4,228 |
# coding: utf8
"""
系统常量
"""
TICKETS_JSON_URL = 'https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date=%s&leftTicketDTO.from_station' \
'=%s&leftTicketDTO.to_station=%s&purpose_codes=ADULT'
STATION_NAME_JS_URL = 'https://kyfw.12306.cn/otn/resources/js/framework/station_name.js?station... | cls1991/12306-ticket-query | share/const.py | Python | apache-2.0 | 856 |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.BillingCycleListView.as_view(), name='list'),
url(r'^enact/(?P<uuid>.+)/$', views.CreateTransactionsView.as_view(), name='enact'),
url(r'^reenact/(?P<uuid>.+)/$', views.RecreateTransactionsView.as_view(), name='reenact')... | adamcharnock/swiftwind | swiftwind/billing_cycle/urls.py | Python | mit | 503 |
#/#############################################################################
#
# Stephan Neuhausen.
# Copyright (C) 20014-TODAY Stephan Neuhausen iad.de.
#
#/#############################################################################
import room
| SNeuhausen/training_management | models/room/__init__.py | Python | gpl-3.0 | 259 |
# TODO: switch this on with an environ variable or something.
# and document.
#def setup_package():
# import tests._util
# tests._util.enable_coercion_blocker()
| mmerickel/flatland | tests/__init__.py | Python | mit | 169 |
from __future__ import print_function
import os
from setuptools import setup
ROOT = os.path.dirname(__file__)
# retrieve package information
about = {}
with open(os.path.join(ROOT, 'jumpssh', '__version__.py')) as version_file:
exec(version_file.read(), about)
with open(os.path.join(ROOT, 'README.rst')) as readm... | t-cas/JumpSSH | setup.py | Python | mit | 1,992 |
# This file is part of Indico.
# Copyright (C) 2002 - 2015 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... | XeCycle/indico | indico/MaKaC/conference.py | Python | gpl-3.0 | 377,852 |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems 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
#... | Jokeren/neon | examples/fast-rcnn/train.py | Python | apache-2.0 | 5,923 |
import sqlite3
from flask_restplus import Resource, reqparse
from models.user import UserModel
class UserRegister(Resource):
# Parameter parsing
parser = reqparse.RequestParser()
parser.add_argument('username',
type = str,
required = True,
help = "Username is required!" )
parser.add_argument('p... | arcyfelix/Courses | 18-04-18-REST APIs with Flask and Python/Section 6 - Simplifying storage with Flask-SQLAlchemy/1_Improving code structure/resources/user.py | Python | apache-2.0 | 1,035 |
import logging
from os.path import (dirname, abspath, join)
import math
import numpy
import sys
import time
from binly.utils.resource import Resource
class Servo(Resource):
# Min pulse length out of 4096.
DEFAULT_SERVO_MIN = 90
# Max pulse length out of 4096.
DEFAULT_SERVO_MAX = 545
# Max number... | morgangalpin/binly | binly/platform/resources/servo.py | Python | gpl-3.0 | 3,874 |
from __future__ import unicode_literals
import json
import sys
from django.conf import settings
from django.core.exceptions import ValidationError # backwards compatibility
from django.utils import six, timezone
from django.utils.encoding import force_text, python_2_unicode_compatible
from django.utils.html import e... | mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/forms/utils.py | Python | mit | 6,149 |
import xml.etree.ElementTree as ET
import os
from Element import Element
class PythonToGMX(object):
def __init__(self, pythonTree):
self.pythonroot = pythonTree
self.root = ET.Element(eval(self.pythonroot.tag))
for child in self.pythonroot.children:
self.process(child, self.root)
def process(self, elemen... | Karuji/GMProjectImporter | PythonToGMX.py | Python | mit | 493 |
import roomai
import roomai.games.common
import roomai.games.kuhnpoker
import random
import unittest
class KuhnPokerExamplePlayer(roomai.games.common.AbstractPlayer):
def receive_info(self, info):
if info.person_state_history[-1].available_actions is not None:
self.available_actions = info.pers... | roomai/RoomAI | tests/ReadMe.py | Python | mit | 926 |
#!/usr/bin/env python
"""
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");... | alexryndin/ambari | ambari-server/src/main/resources/stacks/BigInsights/4.2/services/HBASE/package/scripts/hbase_restgatewayserver.py | Python | apache-2.0 | 2,174 |
# -*- coding: utf-8 -*-
from impl import *
| ibelikov/jimmy | jimmy/modules/throttle/__init__.py | Python | apache-2.0 | 43 |
# Copyright (C) 2011 REES Marche <http://www.reesmarche.org>
#
# This file is part of ``django-simple-accounting``.
# ``django-simple-accounting`` 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, versio... | seldon/django-simple-accounting | simple_accounting/utils.py | Python | lgpl-3.0 | 19,566 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
import frappe.defaults
from frappe.utils import cint, flt
from frappe import _, msgprint, throw
from erpnext.accounts.party impor... | adityaduggal/erpnext | erpnext/accounts/doctype/sales_invoice/sales_invoice.py | Python | gpl-3.0 | 36,088 |
import cv
import sys
import math
import curses
import signal
stdscr = curses.initscr()
def signal_handler(signal, frame):
print 'You pressed Ctrl+C!'
curses.endwin()
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
width = int(sys.argv[1]) if len(sys.argv) > 1 else 50
# cv.NamedWindow("camera", ... | voidabhi/python-scripts | CamPy/capture.py | Python | mit | 1,153 |
import json
METADATA_STEM = ".random.metadata"
STOREFILE_STEM = ".random.store"
# Not yet implemented
GROUP_STEM = ".g"
class NoMetadataException(Exception):
pass
def get_storefile_name(uid, rid):
return "{}.{}{}".format(uid, rid, STOREFILE_STEM)
def get_metadatafile_name(uid, rid):
return "{}.{}{}".fo... | mlsteele/one-time-chat | device/metadata.py | Python | mit | 1,672 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.