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 |
|---|---|---|---|---|---|
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
1349. Farm
Time limit: 1.0 second
Memory limit: 64 MB
[Description]
Here is a farm. Here is a farmer that counts how many animal live in his farm:
a camels, b sheep, c green cockroaches. Occurs that a^n + b^n = c^n. n is given.
You are to find all the rest.
[Input]
n (0 ... | matrixjoeq/timus_solutions | 1349/slu.py | Python | mit | 1,277 |
import settings
import MySQLdb
import datetime
from datetime import date, timedelta
import sys
import os
import zipfile
from ftplib import FTP, error_reply
import logging
def db_connect(host=settings.DB_SERVER, user=settings.DB_USR, passwd=settings.DB_PWB, db=settings.DB_DB):
"""
Connects to the AWS database,... | nicholascar/saaws_wdtf_exporter | generator_wdtf.py | Python | gpl-3.0 | 15,869 |
"""
The Wavefunction object and its associated functions.
"""
import copy
import numpy as np
import scipy.linalg as sp_linalg
import nomad.core.timings as timings
import nomad.core.matrices as matrices
class Wavefunction:
"""Class constructor for the Wavefunction object."""
def __init__(self):
self.ti... | mschuurman/FMSpy | nomad/core/wavefunction.py | Python | lgpl-3.0 | 7,909 |
from rest_framework import serializers
from app_restaurantes.models import Restaurante
class RestauranteSerializer(serializers.ModelSerializer):
class Meta:
model = Restaurante
fields = ('id', 'nombre', 'direccion', 'foto', 'me_gusta', 'no_me_gusta')
| JCristobal/SSBW-gestion-restaurantes | Restaurantes/app_restaurantes/serializers.py | Python | apache-2.0 | 274 |
import os, re, sys
import read_dicts
from collections import Counter
import pandas as pd
import numpy as np
import operator
import random
sys.path.append('.')
ENABLE_WRITE = 1
INDEX_NAMES_FILES = '../../data/aaindex/list_of_indices.txt'
def getscores(d, aalist, seq):
score_list = list()
char_freq = dict()... | seokjunbing/cs75 | src/data_processing/read_data.py | Python | gpl-3.0 | 22,577 |
# Copyright 2014 - Rackspace
#
# 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,... | pravisankar/solum | solum/tests/common/test_trace_data.py | Python | apache-2.0 | 2,861 |
import win32api
import win32con
from main import KeyboardHandler
class WindowsKeyboardHandler(KeyboardHandler):
def __init__ (self, *args, **kwargs):
super(WindowsKeyboardHandler, self).__init__(*args, **kwargs)
#Setup the replacement dictionaries.
for i in dir(win32con):
if i.startswith("VK_"):
key = ... | codeofdusk/ProjectMagenta | src/keyboard_handler/windows.py | Python | gpl-2.0 | 1,384 |
# coding: utf-8
# Calculate the implementation coverage (using tests) of each kasahorow language in KWL
import kwl as g
import kwl_test as t
import kasahorow as k
import sys
def get_coverage(language, show_details=False):
coverage = []
for grade in t.COVERAGE:
total = len(t.COVERAGE[grade])
implemented = ... | kasahorow/kwl | kwl_coverage.py | Python | bsd-2-clause | 1,093 |
# coding=utf-8
from flask import current_app
from mongoengine import register_connection
from mongoengine.connection import get_connection, _connection_settings, \
_connections
from slideatlas.third_party.MongoDBProxy import MongoProxy
#############################################################################... | SlideAtlas/SlideAtlas-Server | slideatlas/models/common/connection.py | Python | apache-2.0 | 1,845 |
#-----------------------------------------------------------------------------
# Python module level constants
#-----------------------------------------------------------------------------
import ZeroMQ
_Version = ZeroMQ.lib.zmq.version()
VERSION = _Version.ToString()
VERSION_MAJOR = _Version[0]
VERSION_MINOR = _Versi... | swn1/pyzmq | zmq/backend/cli/constants.py | Python | bsd-3-clause | 6,712 |
# Copyright 2018 Flight Lab 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | google/flight-lab | controller/utils/light_test.py | Python | apache-2.0 | 1,034 |
r"""
This model provides the form factor, $P(q)$, for a multi-shell sphere where
the scattering length density (SLD) of each shell is described by an
exponential, linear, or constant function. The form factor is normalized by
the volume of the sphere where the SLD is not identical to the SLD of the
solvent. We currentl... | SasView/sasmodels | sasmodels/models/onion.py | Python | bsd-3-clause | 12,373 |
#!/usr/bin/python2.4
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://w... | marcellodesales/svnedge-console | ext/windows/pkg-toolkit/pkg/vendor-packages/pkg/client/progress.py | Python | agpl-3.0 | 30,842 |
from utils import CanadianJurisdiction
class Mississauga(CanadianJurisdiction):
classification = 'legislature'
division_id = 'ocd-division/country:ca/csd:3521005'
division_name = 'Mississauga'
name = 'Mississauga City Council'
url = 'http://www.city.mississauga.on.ca'
| opencivicdata/scrapers-ca | ca_on_mississauga/__init__.py | Python | mit | 291 |
import numpy
from tensorflow.keras.callbacks import History
from matplotlib import pyplot
class TrainingHistoryPlotter:
@staticmethod
def plot_history(history: History, file_name: str, show_plot: bool = False):
epoch_list = numpy.add(history.epoch, 1) # Add 1 so it starts with epoch 1 instead of 0
... | apacha/MusicSymbolClassifier | ModelTrainer/reporting/TrainingHistoryPlotter.py | Python | mit | 3,064 |
import time
import lsm9ds1
from machine import Pin, I2C
bus = I2C(1, scl=Pin(15), sda=Pin(14))
lsm = lsm9ds1.LSM9DS1(bus)
while (True):
#for g,a in lsm.iter_accel_gyro(): print(g,a) # using fifo
print('Accelerometer: x:{:>8.3f} y:{:>8.3f} z:{:>8.3f}'.format(*lsm.read_accel()))
print('Magnetometer: x:{... | openmv/openmv | scripts/examples/Arduino/Nano-33-BLE-Sense/01-Sensors/lsm9ds1.py | Python | mit | 502 |
#!/usr/bin/python -tt
import time
import sys
import os
DOCUMENTATION='''
Module: add-firewall-rules
author: Rui Moreira
Version: Beta1
Requirements: [protocol] [port]
Optional : [source]
'''
from distutils.version import LooseVersion
from ansible.module_utils.basic import *
class Rule(object):
'''
main c... | ruimoreira/add-firewall-rules | add_firewall_rules.py | Python | gpl-2.0 | 1,684 |
# Copyright 2017 Google 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.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | GoogleCloudPlatform/training-data-analyst | courses/developingapps/demos/dep_man/dep_man_py/vm_config.py | Python | apache-2.0 | 2,426 |
# coding = utf-8
import random
def randRGB(min=0, max=255):
if min < 0:
min = 0
if min > 255:
min = 255
if max < 0:
max = 0
if max > 255:
max = 255
if max < min:
tmp = min
min = max
max = tmp
return (random.randint(min, max),
... | Show-Me-the-Code/python | xyjxyf/tools/colorer.py | Python | mit | 386 |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | google-research/google-research | dialogue_ope/airdialogue_ope/data/convai2/stats.py | Python | apache-2.0 | 2,237 |
#############################################################################
## ##
## This file is part of Owade : www.owade.org ##
## Offline Windows Analyzer and Data Extractor ##
## ... | CarlosLannister/OwadeReborn | owade/fileExtraction/newHardDrive.py | Python | gpl-3.0 | 4,208 |
# Generated by Django 1.11.15 on 2018-09-28 13:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('transport', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='transport',
name='pattern',
... | modoboa/modoboa | modoboa/transport/migrations/0002_auto_20180928_1520.py | Python | isc | 435 |
""" SummarizeLogsAgent module
This agents scans all the log tables (SiteLog, ResourceLog and NodeLog) on the
ResourceStatusDB and summarizes them. The results are stored on the History
tables (SiteHistory, ResourceHistory and NodeHistory) and the Log tables
cleared.
In order to summarize the logs, all entri... | yujikato/DIRAC | src/DIRAC/ResourceStatusSystem/Agent/SummarizeLogsAgent.py | Python | gpl-3.0 | 8,713 |
# The MIT License
#
# Copyright 2014, 2015 Piotr Dabkowski
#
# 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, modif... | maxive/erp | doc/_extensions/pyjsparser/parser.py | Python | agpl-3.0 | 107,859 |
# utils for interfacing with Scikit-Learn
import logging
import numpy as np
import copy
from multiprocessing import Pool
from sklearn.metrics import f1_score
from marmot.learning.pystruct_sequence_learner import PystructSequenceLearner
from marmot.experiment.import_utils import call_for_each_element
from marmot.experi... | qe-team/marmot | marmot/experiment/learning_utils.py | Python | isc | 9,015 |
# -*- encoding: utf-8 -*-
###############################################################################
# #
# Copyright (C) 2013 Renato Lima - Akretion #
# ... | christiandev/l10n-brazil | __unported__/l10n_br_account_service/l10n_br_account.py | Python | agpl-3.0 | 1,821 |
# 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 (t... | apache/allura | Allura/allura/tests/functional/test_static.py | Python | apache-2.0 | 1,849 |
# -*- coding: utf-8 -*-
from core import httptools
from core import jsontools
from core import scrapertools
from platformcode import logger
def test_video_exists(page_url):
logger.info("(page_url='%s')" % page_url)
if "kbagi.com" in page_url:
from channels import kbagi
logueado, error_message... | pitunti/alfaPitunti | plugin.video.alfa/servers/kbagi.py | Python | gpl-3.0 | 1,896 |
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility and open public tr... | stifoon/navitia | source/jormungandr/tests/routing_tests_destineo.py | Python | agpl-3.0 | 3,475 |
import datetime
import numpy as np
import tensorflow as tf
def mylog(s):
print('{:%Y-%m-%d %H:%M:%S}: {}'.format(datetime.datetime.now(), s))
#%% tensorflow features
def _byteslist_feature(value):
return tf.train.Feature(bytes_list=tf.train.BytesList(value=value))
def _int64list_feature(value):
return tf.... | mpekalski/Y8M | bstnet/my_utils.py | Python | apache-2.0 | 1,983 |
# 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... | nathanbjenx/cairis | cairis/gui/RolesDialog.py | Python | apache-2.0 | 2,882 |
#!/usr/bin/python
from limesurvey import Api
import base64 # para encodear la subida de surveys
# demo de limesurvey
usuario = 'admin'
clave = 'test'
url = 'http://demo.limesurvey.org/index.php?r=admin/remotecontrol'
lime = Api(url, usuario, clave)
for e in lime.list_surveys():
propiedades = lime.get_survey_p... | dvinazza/lime-py-api | ejemplo.py | Python | gpl-2.0 | 865 |
from django.db import transaction
from django.core.exceptions import ObjectDoesNotExist
from rest_framework import validators, decorators, status
from rest_framework.authentication import TokenAuthentication
from rest_framework.response import Response
from rest_framework.serializers import ModelSerializer, Field, Char... | ul-fmf/projekt-tomo | web/attempts/rest.py | Python | agpl-3.0 | 5,652 |
import logging
log = logging.getLogger(__name__)
class FieldDesc(object):
def __init__(self, name, field_type):
self.name = name
self.field_type = field_type
def sql(self, pkey):
return "%s %s%s" % (
self.name,
self.field_type,
self.name == pkey an... | nuxgu/magic_db | sqldb/dao.py | Python | gpl-3.0 | 2,565 |
#! /usr/bin/env python
# Copyright (C) 2009-2010 Raul Jimenez
# Released under GNU LGPL 2.1
# See LICENSE.txt for more information
import SocketServer
import random
import sys, os
from optparse import OptionParser
import core.ptime as time
import logging
import core.logging_conf as logging_conf
#default_logs_level ... | egbertbouman/tribler-g | Tribler/Core/DecentralizedTracking/pymdht/pymdht_daemon.py | Python | lgpl-2.1 | 9,025 |
import time
def cmd_time(ensoapi):
"Shows the current time"
ensoapi.display_message(time.asctime())
| curaloucura/Enso-Ubuntu | ensocommands/time.py | Python | bsd-3-clause | 106 |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/bootstrap.py | Python | agpl-3.0 | 9,974 |
import py
from rpython.jit.metainterp.test.test_virtualizable import ImplicitVirtualizableTests
from rpython.jit.backend.zarch.test.support import JitZARCHMixin
class TestVirtualizable(JitZARCHMixin, ImplicitVirtualizableTests):
def test_blackhole_should_not_reenter(self):
py.test.skip("Assertion error & ... | oblique-labs/pyVM | rpython/jit/backend/zarch/test/test_virtualizable.py | Python | mit | 336 |
import os
import sys
import unittest
from logilab.common import testlib
from pylint.testutils import make_tests, LintTestUsingFile, cb_test_gen, linter
import ConfigParser
HERE = os.path.dirname(os.path.abspath(__file__))
PLUGINPATH = os.path.join(HERE, "..")
linter.prepare_import_path(PLUGINPATH)
linter.load_plugin_... | ancho85/pylint-playero-plugin | tests/fulltest.py | Python | gpl-2.0 | 2,139 |
import flask
from flask import url_for, redirect, render_template
def twiml(resp):
resp = flask.Response(str(resp))
resp.headers['Content-Type'] = 'text/xml'
return resp
def view(view_name, form=None):
if form is None:
return render_template("{0}.html".format(view_name))
return render_te... | TwilioDevEd/marketing-notifications-python | marketing_notifications_python/view_helpers.py | Python | mit | 530 |
# -*- coding: utf-8 -*-
# Copyright 2010-2013 Kolab Systems AG (http://www.kolabsys.com)
#
# Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen a kolabsys.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 ... | tpokorra/pykolab | pykolab/cli/sieve/cmd_list.py | Python | gpl-3.0 | 2,887 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | nathanielvarona/airflow | airflow/contrib/operators/sagemaker_transform_operator.py | Python | apache-2.0 | 1,221 |
from django.contrib import admin
from .models import Feed
admin.site.register(Feed)
| herrfeder/FEEDO | rsscore/admin.py | Python | gpl-3.0 | 86 |
# python
# This file is generated by a program (mib2py).
import HC_ALARM_MIB
OIDMAP = {
'1.3.6.1.2.1.16.29': HC_ALARM_MIB.hcAlarmMIB,
'1.3.6.1.2.1.16.29.1': HC_ALARM_MIB.hcAlarmObjects,
'1.3.6.1.2.1.16.29.1.1': HC_ALARM_MIB.hcAlarmControlObjects,
'1.3.6.1.2.1.16.29.1.2': HC_ALARM_MIB.hcAlarmCapabilitiesObjects,
'1.3... | xiangke/pycopia | mibs/pycopia/mibs/HC_ALARM_MIB_OID.py | Python | lgpl-2.1 | 2,259 |
#!/usr/bin/env python
import sys
from collections import namedtuple
import poppler
import cairo
from os.path import abspath
Point = namedtuple('Point', ['x', 'y'])
Line = namedtuple('Line', ['start', 'end'])
Polygon = namedtuple('Polygon', 'points')
Rectangle = namedtuple('Rectangle', ['top_left', 'bottom_right'])
A... | drj11/pdftables | pdftables/diagnostics.py | Python | bsd-2-clause | 11,691 |
# 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 unde... | Alzon/senlin | senlin/drivers/openstack/keystone_v3.py | Python | apache-2.0 | 5,821 |
# -*- coding: utf-8 -*-
"""
Module implementing VI_TEST.
"""
import os
import sys
import time
import xlwt
from math import *
script_path = os.getcwd()
root_path = os.path.dirname(script_path)
sys.path.insert(0,root_path)
from PyQt4 import QtGui
from PyQt4.QtGui import QDialog,QApplication
from PyQt4.QtCore import py... | cygnushan/measurement | VI_spectrum/VI_main.py | Python | mit | 19,563 |
__all__ = ['statusSum', 'utiltools', 'nettools', 'fAnalysis', 'highlight', 'pdfParse'] | jefflai0101/Stock-Analysis | hkextools/__init__.py | Python | mit | 86 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('app', '0034_auto_20151102_1210'),
]
operations = [
migrations.CreateModel(
name... | flipjack/misrutas | project/app/migrations/0035_auto_20151102_1328.py | Python | mit | 914 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'pioo'
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='libncore',
version='0.1',
description='ncore library for python',
url='http://github.com/piooca/libncore',
author='pio... | piooca/libncore | setup.py | Python | bsd-2-clause | 752 |
# (c) 2015, Jonathan Davila <jdavila(at)ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | bobobox/ansible | lib/ansible/plugins/lookup/hashi_vault.py | Python | gpl-3.0 | 5,894 |
import os
import time
import carta.cartavis as cartavis
import pyautogui
import ImageUtil
def test_layout_analysis(cartavisInstance, cleanSlate):
"""
Test that the default layout is the analysis layout.
Check that there is one animator, one histogram, one
colormap and one image viewer window.
"""
... | CARTAvis/carta | carta/scriptedClient/tests/test_layout.py | Python | gpl-3.0 | 2,110 |
# Copyright 2013, Big Switch Networks, 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 applic... | wangxiangyu/horizon | openstack_dashboard/dashboards/project/firewalls/tables.py | Python | apache-2.0 | 13,672 |
from haystack import indexes
from mozillians.users.models import UserProfile
class UserProfileIndex(indexes.SearchIndex, indexes.Indexable):
"""User Profile Search Index."""
# Primary field of the index
text = indexes.CharField(document=True, use_template=True)
# Add the fields to index along with th... | fxa90id/mozillians | mozillians/users/search_indexes.py | Python | bsd-3-clause | 1,120 |
##########################################################################
#
# Copyright (c) 2007, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | AlanZatarain/cortex-vfx | test/IECoreGL/ImmediateRenderer.py | Python | bsd-3-clause | 4,021 |
import ipaddress
def func_exclude_port(super_list,sub_list):
print(sub_list)
print(super_list)
if len(super_list) == 0 or len(sub_list) == 0:
return [super_list]
if len(super_list) == len(sub_list):
return [super_list+[(super_list[-1]+1)]]
else:
if sub_list[0] == super_list[0]:
f_index = super_list.ind... | VRaviTheja/SDN-policy | testing/copy_excluding_port.py | Python | apache-2.0 | 784 |
from django.db import models
from tinymce import models as tinymce_models
from datetime import date
from os.path import exists
from django.contrib.auth.models import User
from django.conf import settings
from decimal import Decimal
def get_filename(instance, filename):
split = filename.split('.')
ext = ''.join... | mybluevan/gospel-preaching | gospel_preaching/simple_orders/models.py | Python | gpl-3.0 | 4,607 |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
from os import path
class BeastTracer(Package):
"""Tracer is a graphical tool for visualization ... | iulian787/spack | var/spack/repos/builtin/packages/beast-tracer/package.py | Python | lgpl-2.1 | 904 |
from StringIO import StringIO
import unittest
from mock import patch
from hellosphinx.greeter import Greeter
class TestHelloSphinx(unittest.TestCase):
def setUp(self):
self.sut = Greeter("Hello Sphinx!")
@patch('sys.stdout', new_callable=StringIO)
def test_hello_sphinx(self, mock_stdout):
... | tjpnz/sphinx-example | src/unittest/python/greeter_tests.py | Python | mit | 408 |
import re
from binascii import unhexlify
from collections import namedtuple
from itertools import starmap
from streamlink.compat import urljoin, urlparse
__all__ = ["load", "M3U8Parser"]
# EXT-X-BYTERANGE
ByteRange = namedtuple("ByteRange", "range offset")
# EXT-X-KEY
Key = namedtuple("Key", "method uri iv key_fo... | wlerin/streamlink | src/streamlink/stream/hls_playlist.py | Python | bsd-2-clause | 10,297 |
# -*- coding: utf-8 -*-
# Copyright (c) 2006-2008, 2010, 2013 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr>
# Copyright (c) 2012 FELD Boris <lothiraldan@gmail.com>
# Copyright (c) 2014-2016 Claudiu Popa <pcmanticore@gmail.com>
# Copyright (c) 2014 Google, Inc.
# Copyright (c) 2015 Ionel Cristian Maries <contact@ion... | axbaretto/beam | sdks/python/.tox/lint/lib/python2.7/site-packages/pylint/test/test_import_graph.py | Python | apache-2.0 | 2,559 |
import numpy as np
from numpy.testing import assert_allclose, assert_array_less
from .helpers import SeededTest
from ..model import Model
from ..step_methods import Slice, Metropolis, NUTS
from ..distributions import Normal
from ..tuning import find_MAP
from ..sampling import sample
from ..diagnostics import effective... | wanderer2/pymc3 | pymc3/tests/test_diagnostics.py | Python | apache-2.0 | 7,950 |
from pandac.PandaModules import loadPrcFileData
loadPrcFileData('', 'frame-rate-meter-scale 0.035')
loadPrcFileData('', 'frame-rate-meter-side-margin 0.1')
loadPrcFileData('', 'show-frame-rate-meter 1')
loadPrcFileData('', 'window-title ' + "Planet Prototype")
loadPrcFileData('', "sync-video 0")
loadPrcFileData('', 'ba... | croxis/Panda-Core-Technology | NotAsOldPlanet/precompute.py | Python | mit | 2,583 |
# -*- coding: utf-8 -*-
# File: enemy.py
# Author: Casey Jones
#
# Created on July 20, 2009, 4:48 PM
#
# This file is part of Alpha Beta Gamma (abg).
#
# ABG 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, ... | jcnix/abg | enemies.py | Python | gpl-3.0 | 2,843 |
# Copyright 2013 Cloudbase Solutions Srl
# Copyright 2013 Pedro Navarro Perez
# 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... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/virt/hyperv/vif.py | Python | gpl-2.0 | 2,464 |
#!/usr/bin/env python
from __future__ import with_statement
import re
import os
sid = "ed59a5733d2c1c1c69a83a28"
def twilio_clean(contents):
contents = re.sub(r"([A-Z]{2}\w{8})\w{24}", r"\1%s" % sid, contents)
contents = re.sub(r"\"[a-z0-9]{32}\"", "\"AUTHTOKEN\"", contents)
contents = re.sub(r"\+\d{10}"... | clearcare/twilio-python | tests/resources/process.py | Python | mit | 852 |
#!/usr/bin/env python
#
# Copyright (c) 2016 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list o... | teamfx/openjfx-8u-dev-rt | modules/web/src/main/native/Source/JavaScriptCore/Scripts/builtins/builtins_generate_wrapper_implementation.py | Python | gpl-2.0 | 2,485 |
"""
Cifar10 classification process functions.
"""
from __future__ import print_function, division
import os
import numpy as np
from dbcollection.datasets import BaseTask, BaseField
from dbcollection.utils.decorators import display_message_processing
from dbcollection.utils.file_load import load_pickle
from dbcollect... | dbcollection/dbcollection | dbcollection/datasets/cifar/cifar10/classification.py | Python | mit | 9,924 |
""" Routes for main page """
from flask import render_template, jsonify
from catalog.infra.flask_factory import app
from catalog.services.utils import config
from catalog.services.game_service import GameService
@app.route('/')
@app.route('/catalog')
def index():
game_service = GameService()
latest_games = ... | diogosilverio/udacity-fswd-game-catalog | catalog/routes/main.py | Python | gpl-3.0 | 1,068 |
# -*- coding: utf-8 -*-
# Copyright (c) 2015-2018, Exa Analytics Development Team
# Distributed under the terms of the Apache License 2.0
"""
Two Body Properties Computations
#####################################
"""
import numpy as np
import numba as nb
from exatomic.base import nbtgt, nbpll
@nb.vectorize(["float64(... | alexvmarch/atomic | exatomic/algorithms/distance.py | Python | apache-2.0 | 9,009 |
import numpy as np
import gym
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.optimizers import Adam
from rl.agents.dqn import DQNAgent
from rl.policy import EpsGreedyQPolicy, BoltzmannQPolicy, LinearAnnealedPolicy
from rl.memory import SequentialMemory
from gamelog... | codetiger/MachineLearning-2048 | train.py | Python | mit | 2,654 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2016 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of ... | kannon92/psi4 | psi4/driver/p4util/python_helpers.py | Python | gpl-2.0 | 5,000 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license (see the COPYING file).
""" Find a target given its name. """
from __future__ import absolute_import
from __future__ import unicode_literals
from _... | aldebaran/qibuild | python/qibuild/find.py | Python | bsd-3-clause | 6,233 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bulk_email', '0002_data__load_course_email_template'),
]
operations = [
migrations.AddField(
model_name='coursee... | BeDjango/intef-openedx | lms/djangoapps/bulk_email/migrations/0003_courseemailtemplate_default_selected.py | Python | agpl-3.0 | 443 |
from django.template import Library
from subdomains.utils import reverse
register = Library()
UNSET = object()
@register.simple_tag(takes_context=True)
def url(context, view, subdomain=UNSET, *args, **kwargs):
"""
Resolves a URL in a template, using subdomain-based URL resolution.
If no subdomain is ... | adi-li/django-subdomains | subdomains/templatetags/subdomainurls.py | Python | mit | 1,443 |
#/usr/bin/env python
import commands
import os
from subprocess import call
import fnmatch
finished_cells =[]
def write_file(filename, contents):
"""Write the given contents to a text file.
ARGUMENTS
filename (string) - name of the file to write to, creating if it doesn't exist
contents (string) ... | idbedead/RNA-sequence-tools | Tophat_Cluster_submission/tophat_qsub2.py | Python | mit | 4,973 |
import numpy
from sas.qtgui.Plotting.Slicers.BaseInteractor import BaseInteractor
from sas.qtgui.Plotting.PlotterData import Data1D
import sas.qtgui.Utilities.GuiUtils as GuiUtils
from sas.qtgui.Plotting.SlicerModel import SlicerModel
class BoxInteractor(BaseInteractor, SlicerModel):
"""
BoxInteractor define... | SasView/sasview | src/sas/qtgui/Plotting/Slicers/BoxSlicer.py | Python | bsd-3-clause | 17,340 |
# Copyright (C) 2019 Mark Clarkstone <mpmc@disroot.org>
#
# This file is part of hs602.
#
# hs602 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 late... | mpmc/HS602 | hs602/controller.py | Python | gpl-3.0 | 26,909 |
#!/usr/bin/env python
class Parent(object):
def override(self):
print "PARENT override()"
def implicit(self):
print "PARENT implicit()"
def altered(self):
print "PARENT altered()"
class Child(Parent):
def override(self):
print "CHILD override()"
def altered(self):
print "CHILD, BEFORE PARENT alte... | moralesjason/learnpythonthehardway | ex44inheritanceversuscomposition/ex44d.py | Python | gpl-3.0 | 519 |
from . import partner
from . import resource_activity
from . import resource_activity_registration
from . import sale
from . import resource
| houssine78/addons | resource_activity/models/__init__.py | Python | agpl-3.0 | 146 |
#!/usr/bin/env python
"""
Convert asdf files to sac
"""
import argparse
from pypaw import convert_adjsrcs_from_asdf
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-o', action='store', dest='outputdir', default='.',
help="output directory")
parser.add_argument(... | wjlei1990/pypaw | pypaw/bins/convert_adjsrcs_from_asdf.py | Python | lgpl-3.0 | 632 |
def extractDreamstlTumblrCom(item):
'''
Parser for 'dreamstl.tumblr.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the s ranks that i raised', 'The S-Ranks that I Raised', ... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractDreamstlTumblrCom.py | Python | bsd-3-clause | 761 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | adrianpaesani/odoo-argentina | l10n_ar_aeroo_einvoice/__openerp__.py | Python | agpl-3.0 | 1,839 |
class Solution:
def __init__(self):
self.memo = [-1] * 47
self.memo[1] = 1
self.memo[2] = 2
def climbStairsRecursive(self, n: int) -> int:
if self.memo[n] != -1:
return self.memo[n]
ans = self.climbStairsRecursive(n - 1) + self.climbStairsRecursive(n - 2)
... | civilian/competitive_programing | leetcode/0/70/70.py | Python | mit | 683 |
# Copyright (C) 2015 Jan Blechta
#
# This file is part of dolfin-tape.
#
# dolfin-tape is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ve... | blechta/dolfin-tape | dolfintape/demo_problems/StokesVortices.py | Python | gpl-3.0 | 2,060 |
"""
A version of chronometer where we step through each parameter separately.
This version uses only the isochronal information.
"""
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import corner
import time
import h5py
import sys
from utils import pars_and_mods, get_n_things, estimate... | RuthAngus/chronometer | chronometer/iso_only_chronometer.py | Python | mit | 11,058 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
kvmBackup - a software for snapshotting KVM images and backing them up
Copyright (C) 2015-2022 Paolo Cozzi
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 Fou... | bioinformatics-ptp/kvmBackup | kvmBackup.py | Python | gpl-3.0 | 10,485 |
print 'filters.vocoder'
| topliceanu/learn | python/python_a_byte_of/package/sound/filters/vocoder.py | Python | mit | 24 |
#coding: utf-8
try:
from django.conf.urls.defaults import patterns, url
except ImportError:
from django.conf.urls import patterns, url
urlpatterns = patterns('robokassa.views',
url(
r'^result/$',
'receive_result',
name='robokassa_result'
),
url(
r'^succe... | kmike/django-robokassa | robokassa/urls.py | Python | mit | 480 |
#!/usr/bin/env python
archivo = open('nuevos_usuarios.txt', 'a')
usuario = input('Ingrese nombre de nuevo usuario [ENTER para salir]: ')
while usuario != '':
archivo.write(usuario)
archivo.write('\n')
usuario = input('Ingrese nombre de nuevo usuario [ENTER para salir]: ')
archivo.close()
archivo = open(... | lecovi/lecovi.github.io | listings/par/archivo5.py | Python | lgpl-3.0 | 407 |
# -*- coding: utf-8 -*-
#***************************************************************************
#* *
#* Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
#* ... | timthelion/FreeCAD | src/Mod/Path/PathScripts/PathCopy.py | Python | lgpl-2.1 | 4,667 |
from distutils.core import Command
import json
import re
import time
# Note, the last time I coded python daily was at Google, so it's entirely
# possible some of my techniques below are outdated or bad.
# If you have fixes, let me know.
class get_metadata(Command):
description = "get package metadata"
user_optio... | jedisct1/fpm | lib/fpm/package/pyfpm/get_metadata.py | Python | mit | 3,112 |
#!/usr/bin/env python
#
# Copyright 2009 Facebook
#
# 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 a... | nabsboss/CouchPotatoServer | libs/tornado/web.py | Python | gpl-3.0 | 86,577 |
import os
import json
import errno
import pickle
import tempfile
from datetime import timedelta, datetime
class UncacheableObjectError(Exception):
pass
class Cache(object):
DEFAULT_CACHE_DIR = "~/.cache/artefact/connectors"
CACHE_INDEX = "index.json"
CACHE_ENTRIES = "entries"
DATE_FORMAT = ... | artefactory/artefact.connectors | artefact/utils/cache.py | Python | apache-2.0 | 4,681 |
from django.apps import AppConfig
class MovieclueConfig(AppConfig):
name = 'movieclue'
| rish4bhn/movieclue | movieclue/apps.py | Python | mit | 93 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:/Users/Zeke/Google Drive/dev/python/zeex/zeex/core/ui/sql/query_editor.ui'
#
# Created: Mon Nov 13 22:57:19 2017
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide imp... | zbarge/zeex | zeex/core/ui/sql/query_editor_ui.py | Python | mit | 5,290 |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# 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 ... | github-borat/cinder | cinder/volume/drivers/lvm.py | Python | apache-2.0 | 25,925 |
'''The object file of "table.c" contains most kernel data. Variables that are
declared in the *.h files appear with EXTERN in front of them, as in
EXTERN int x;
Normally EXTERN is defined as extern, so when they are included in
another file, no storage is allocated. If EXTERN were not present,
but just say,
int x;
... | vhpanisa/pythonix | kernel/table.py | Python | mit | 2,502 |
from collections import defaultdict
from distutils.version import StrictVersion
from django_bulk_update.helper import bulk_update
from django.conf import settings as django_settings
from django.db import transaction
from django.http import JsonResponse
from django.contrib.contenttypes.models import ContentType
from re... | erinspace/osf.io | api/base/views.py | Python | apache-2.0 | 26,592 |
# -*- coding: utf-8 -*-
"""
This provides a wrapper to the 2016 version of Andy Casey's Cannon.
The code for this Cannon is in the master branch of this repository: https://github.com/dcf21/AnniesLasso
This is the version of the Cannon used in all technical reports issued by Dominic Ford.
"""
import logging
from mu... | dcf21/4most-4gp | src/pythonModules/fourgp_cannon/fourgp_cannon/cannon_wrapper_casey_old.py | Python | mit | 24,965 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.