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/env python
# -*- coding: utf-8
# ----------------------------------------------------------------------
# Flask web service for POS taggin
# ----------------------------------------------------------------------
# Ivan Vladimir Meza-Ruiz/ ivanvladimir at turing.iimas.unam.mx
# 2015/IIMAS/UNAM
# -------------... | jakaton/pos_flask | src/poswebservice.py | Python | gpl-2.0 | 3,506 |
#!/usr/bin/env python3
#
# db.py by Bill Weinman <http://bw.org/contact/>
# This is part of jurl - Jump to URL (a private short URL service)
# Copyright (c) 2010-2017 The BearHeart Group, LLC
# update 2017-09-29 - for Python 3 EssT
#
import sys, os
import sqlite3
from hashlib import md5
from bwCGI import bwCGI
from b... | shucommon/little-routine | python/ex_files_python_esst/exercise_files/Chap15/jurl/db.py | Python | gpl-3.0 | 8,552 |
#!/usr/bin/python
import os,sys,datetime,re
import shlex
import subprocess
from experiments import *
from helper import *
from run_config import *
import glob
now = datetime.datetime.now()
strnow=now.strftime("%Y%m%d-%H%M%S")
os.chdir('..')
PATH=os.getcwd()
result_dir = PATH + "/results/"
test_dir = PATH + "/tests-... | rharding6373/ddbms | scripts/run_experiments.py | Python | apache-2.0 | 7,751 |
# coding: utf-8
from PoliticalOrientation import Orientation
class Agent:
def __init__(self, generateInterests):
"""On class creation, randomly generate attributes if
generateInterests is True. Else all attributes are 0."""
from random import uniform
from Configuration import MAX_TOLERANCE
from H... | 0nse/PolOrSim | Agent.py | Python | gpl-3.0 | 1,102 |
# -*- coding: utf-8 -*-
# flake8: noqa
# Generated by Django 1.9.9 on 2016-09-21 18:00
from django.db import migrations, models
def copy_name(apps, schema_editor):
"""
Copies the exercise name to the original name field
"""
Excercise = apps.get_model("exercises", "Exercise")
for exercise in Excerc... | rolandgeider/wger | wger/exercises/migrations/0003_auto_20160921_2000.py | Python | agpl-3.0 | 1,569 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
bin/verticalScrolledFrame TEST
Autor: PABLO PIZARRO @ github.com/ppizarror
Fecha: AGOSTO 2016
Licencia: GPLv2
"""
__author__ = "ppizarror"
# Importación de librerías
# noinspection PyUnresolvedReferences
from _testpath import * # @UnusedWildImport
from ... | ppizarror/korektor | test/verticalscrolledframeTest.py | Python | gpl-2.0 | 2,092 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=invalid-name
# pylint: enable=invalid-name
"""
simulates running a program through a processor architecture
Usage: processorSim.py --processor PROCESSORFILE PROGRAMFILE
"""
############################################################
#
# Copyright 2017,... | MSK61/processorsim | src/processorSim.py | Python | lgpl-3.0 | 10,796 |
import json
from collections import defaultdict
from pathlib import Path
from typing import Dict, List
from unittest import mock
from unittest.mock import MagicMock
import pytest
from ereuse_utils import DeviceHubJSONEncoder
from ereuse_workbench.computer import Computer
def fixture(file_name: str):
with Path(_... | eReuse/device-inventory | tests/conftest.py | Python | agpl-3.0 | 2,261 |
import sys
sys.exit(1)
| rmbar/acceptpy | tool_files/bash_tester/tests/exit_1.py | Python | mit | 24 |
# Copyright (C) 2012 Equinor ASA, Norway.
#
# The file 'field_config.py' is part of ERT - Ensemble based Reservoir Tool.
#
# ERT 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 Li... | andreabrambilla/libres | python/res/enkf/config/summary_config.py | Python | gpl-3.0 | 1,414 |
import sys
import uuid
import stratus
PROMPT = "Method to call: "
CLI_NAME = str(uuid.uuid4())
def main():
# Create the client
client = stratus.client()
# Connect to the cluster
client.connect(host=sys.argv[1], name=CLI_NAME)
# Use other arguments for call
if len(sys.argv) > 2:
line = ... | pdxjohnny/stratus | examples/cli.py | Python | mit | 677 |
__author__ = 'keyvan'
from globals import * | rodsol/opencog | opencog/python/utility/numeric/__init__.py | Python | agpl-3.0 | 44 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010-2014 Joel Andersson, Joris Gillis, Moritz Diehl,
# K.U. Leuven. All rights reserved.
# Copyright (C) 2011-2014 Greg Horn
#
# CasADi is free software; you can... | andrescodas/casadi | misc/update_license.py | Python | lgpl-3.0 | 2,584 |
"""
mbed SDK
Copyright (c) 2011-2013 ARM Limited
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 wr... | jrjang/mbed | workspace_tools/upload_results.py | Python | apache-2.0 | 12,273 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
from corehq.form_processor.models import XFormInstanceSQL
from corehq.sql_db.operations import RawSQLMigration, HqRunSQL
migrator = RawSQLMigration(('corehq', 'sql_accessors', 'sql_templates'), {
'FORM_STATE_DELETED'... | qedsoftware/commcare-hq | corehq/sql_accessors/migrations/0014_ledger_transactions.py | Python | bsd-3-clause | 707 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Glencoe Software, Inc. All rights reserved.
#
# This software is distributed under the terms described by the LICENCE file
# you can find at the root of the distribution bundle.
# If the file is missing please request a copy by contacting
# jason@glen... | openmicroscopy/omero-marshal | omero_marshal/decode/decoders/permissions.py | Python | gpl-2.0 | 817 |
import csv
import itertools
import random
import ast
import sys
#usage
# python parseResults.py
fname = '../results/model_results/results_betabinomial.txt'
file_names = [fname]
itemfile = open("items.txt")
items = [" ".join(l.rstrip().split()) for l in itemfile.readlines()]
itemfile.close()
print items
lines = [... | thegricean/sinking-marbles | models/wonky_world/scripts/parseBetaBinomialResults.py | Python | mit | 3,898 |
import pytest
from webdriver.bidi.error import InvalidArgumentException
@pytest.mark.asyncio
async def test_params_empty(bidi_session, send_blocking_command):
with pytest.raises(InvalidArgumentException):
response = await send_blocking_command("session.subscribe", {})
@pytest.mark.asyncio
@pytest.mark.... | servo/servo | tests/wpt/web-platform-tests/webdriver/tests/bidi/session_subscribe/subscribe.py | Python | mpl-2.0 | 2,368 |
"""Database models used by django-reversion."""
from __future__ import unicode_literals
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.conf import settings
from django.core import serializers
from django.core.exceptions import ObjectDoesNotExist
... | adonm/django-reversion | src/reversion/models.py | Python | bsd-3-clause | 7,592 |
# -*- coding: utf-8 -*-
# Copyright 2022 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-aiplatform | samples/generated_samples/aiplatform_v1beta1_generated_job_service_get_hyperparameter_tuning_job_sync.py | Python | apache-2.0 | 1,556 |
#
# Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
#
import sys
import os
import time
import socket
import select
import eventlet
import json
import requests
from cStringIO import StringIO
from cfgm_common.utils import cgitb_hook
class KubeMonitor(object):
def __init__(self, args=None, logger=Non... | nischalsheth/contrail-controller | src/container/kube-manager/kube_manager/kube/kube_monitor.py | Python | apache-2.0 | 9,729 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the Apache License.
from datetime import datetime, timedelta
import zipfile
import os
import shutil
import tempfile
import azurelinuxagent.common.logger as logger
from azurelinuxagent.common.utils import fileutil
from azurelinuxagent.common.... | rjschwei/WALinuxAgent | tests/utils/test_archive.py | Python | apache-2.0 | 8,920 |
# This file is a part of MediaDrop (http://www.mediadrop.net),
# Copyright 2009-2015 MediaDrop contributors
# For the exact contribution history, see the git revision log.
# The source code contained in this file is licensed under the GPLv3 or
# (at your option) any later version.
# See LICENSE.txt in the main project ... | rbu/mediadrop | mediadrop/migrations/versions/004-280565a54124-add_custom_head_tags.py | Python | gpl-3.0 | 1,908 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | karllessard/tensorflow | tensorflow/python/kernel_tests/linalg/linear_operator_util_test.py | Python | apache-2.0 | 17,220 |
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import pandas as pd
from mousestyles import path_diversity
def test_smooth_noise():
movement = {'t': pd.Series([0., 0.02, 0.04, 0.06], index=[0, 1, 2, 3]),
'x': pd.Series([0., 0., 0.1, 0.... | changsiyao/mousestyles | mousestyles/path_diversity/tests/test_smooth_noise.py | Python | bsd-2-clause | 2,526 |
'''
Copyright 2016, 2017 Hop and Fork.
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, softwar... | hopandfork/teacup-storm | configuration.py | Python | apache-2.0 | 3,317 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from gaecookie.middleware import CSRFMiddleware, CSRFInputToDependency
from locale_app.middleware import LocaleMiddleware
from tekton.gae.middleware.json_middleware import JsonResponseMiddleware
from config.template_middleware import Templ... | elenildo/conheca-o-mundo | backend/appengine/settings.py | Python | mit | 1,611 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | Venris/crazyflie-multilink | lib/cfclient/utils/mux/takeoverselectivemux.py | Python | gpl-2.0 | 3,564 |
"""
========================================
Ammonia inversion transition TKIN fitter
========================================
Ammonia inversion transition TKIN fitter translated from Erik Rosolowsky's
http://svn.ok.ubc.ca/svn/signals/nh3fit/
.. moduleauthor:: Adam Ginsburg <adam.g.ginsburg@gmail.com>
Module API
^^^... | bsipocz/pyspeckit | pyspeckit/spectrum/models/ammonia.py | Python | mit | 34,486 |
#!/usr/bin/env python
# coding=utf-8
__author__ = 'yxryab'
import logging
import optparse
import re
import sys
import platform
import os
from collections import OrderedDict
from time import gmtime, strftime
from subprocess import Popen, PIPE, CalledProcessError, call
def checkExcept(results):
resultERROR = []
r... | YxRyaB/opflood | opflood.py | Python | mit | 13,386 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'iradio.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^', include("iradioapp.urls",namespac... | Northcode/FunkyRadio | iradio/urls.py | Python | gpl-2.0 | 339 |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobu... | egustafson/sandbox | _hybrid/grpc-error-handling/client-py/service_pb2.py | Python | apache-2.0 | 4,053 |
import unittest
import charm.schemes.abenc.abenc_maabe_yj14 as abenc_maabe_yj14
debug = False
# unit test for scheme contributed by artjomb
class MAabe_YJ14Test(unittest.TestCase):
def testMAabe_YJ14(self):
abenc_maabe_yj14.basicTest()
abenc_maabe_yj14.revokedTest()
if __name__ == "__main__":
... | JHUISI/charm | charm/test/schemes/abenc/abenc_maabe_yj14_test.py | Python | lgpl-3.0 | 340 |
import os
import urllib.request
""" Order 3: Download iamge with image url
For internet crawl spider, donwload image is necessary. So Write a function to deel it.
"""
class DownloadImageWithUrl(object):
@staticmethod
def donwload(image_url, save_path, save_name):
urllib.request.urlretrieve(image_u... | flyingSprite/spinelle | task_inventory/order_1_to_30/order_3_donwload_image_with_url.py | Python | mit | 648 |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | tensorflow/tensorflow | tensorflow/python/keras/engine/training_generator_test.py | Python | apache-2.0 | 19,479 |
import sys
import matplotlib
matplotlib.use("Agg")
from pylab import *
base = '../'
sys.path.append(base+"utils/Continuum")
sys.path.append(base+"utils/Correlation")
sys.path.append(base+"utils/GLOBALutils")
baryc_dir= base+'utils/SSEphem/'
sys.path.append(baryc_dir)
ephemeris='DEc403'
import matplotlib.pyplot as p... | rabrahm/ceres | fies/fiespipe.py | Python | mit | 63,269 |
from settings import *
import dj_database_url
import sys
import os
from json import load
DEBUG = False
print >> sys.stderr, "Using Heroku Settings"
try:
APP_INFO = load(open(BASE_DIR + "/app_info.json"))['production']
except:
print "Failed to load app_info.json"
APP_INFO = {}
print "using appinfo: ", ... | MadeInHaus/django-template | backend/settings/hosts/production.py | Python | mit | 1,678 |
<<<<<<< HEAD
<<<<<<< HEAD
#
# test_codecencodings_cn.py
# Codec encoding tests for PRC encodings.
#
from test import support
from test import multibytecodec_support
import unittest
class Test_GB2312(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb2312'
tstring = multibytecodec_support.loa... | ArcherSys/ArcherSys | Lib/test/test_codecencodings_cn.py | Python | mit | 10,529 |
# 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... | DinoCow/airflow | tests/cli/commands/test_version_command.py | Python | apache-2.0 | 1,329 |
from __future__ import with_statement
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
from mock import Mock, patch
from twilio.rest.resources import AuthorizedConnectApps
from twilio.rest.resources import AuthorizedConnectApp
class AuthorizedConnectAppTest(unittest.TestCase):
d... | clearcare/twilio-python | tests/test_authorized_connect_apps.py | Python | mit | 2,396 |
__author__ = 'sathley'
class ValidationError(Exception):
def __init__(self, value):
self.parameter = value
def __str__(self):
return repr(self.parameter)
class UserAuthError(Exception):
def __init__(self, value):
self.parameter = value
def __str__(self):
return re... | appacitive/pyappacitive | pyappacitive/error.py | Python | mit | 873 |
from __future__ import print_function
import numpy as np
import paralution_wrapper
import scipy.sparse
# Define a symmetric 8 x 8 dense upper triangular matrix first.
# This matrix is part of the examples which come with Intel's MKL library
# and is used here for historical reasons.
# A:
# 7.0, 1.0, ... | Kalle0x12/Test4 | csr_test.py | Python | gpl-3.0 | 4,420 |
import os
import re
__author__ = "Thierry Schellenbach"
__copyright__ = "Copyright 2014, Stream.io, Inc"
__credits__ = ["Thierry Schellenbach, mellowmorning.com, @tschellenbach"]
__license__ = "BSD-3-Clause"
__version__ = "5.1.1"
__maintainer__ = "Thierry Schellenbach"
__email__ = "support@getstream.io"
__status__ = "... | GetStream/stream-python | stream/__init__.py | Python | bsd-3-clause | 1,467 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.6 on 2018-01-02 16:47
from __future__ import unicode_literals
from django.db import migrations
import oscar.models.fields
class Migration(migrations.Migration):
dependencies = [
("wellsfargo", "0011_auto_20171204_1506"),
]
operations = [
... | thelabnyc/django-oscar-wfrs | src/wellsfargo/migrations/0012_auto_20180102_1147.py | Python | isc | 4,716 |
import time
import copy
import logging
from collections import defaultdict
from ..entity import entity_method
from .. import async, events, actions
log = logging.getLogger(__name__)
def setdefaultattr(obj, name, default_value):
return obj.__dict__.setdefault(name, default_value)
class AppliedAura:
def __in... | wirefish/amber | amber/systems/auras.py | Python | bsd-3-clause | 3,039 |
# -*- coding: utf-8 -*-
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2007 Donald N. Allingham
# Copyright (C) 2008-2010 Brian G. Matherly
# Copyright (C) 2007-2010 Jerome Rapinat
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Gener... | arunkgupta/gramps | gramps/plugins/rel/rel_fr.py | Python | gpl-2.0 | 28,046 |
# python standard library
import socket
# third party
import paramiko
# this package
from theape.parts.connections.clientbase import BaseClient,\
ConnectionError
PORT = 22
TIMEOUT = 10
NEWLINE = '\n'
SPACE_JOIN = "{prefix} {command}"
class SimpleClient(BaseClient):... | rsnakamura/theape | theape/parts/connections/simpleclient.py | Python | mit | 5,260 |
# Python - 3.6.0
def averages(arr):
if type(arr) != list:
return []
if len(arr) < 2:
return []
result = []
c = arr[0]
for i in arr[1:]:
result.append((c + i) / 2.0)
c = i
return result
| RevansChen/online-judge | Codewars/7kyu/averages-of-numbers/Python/solution1.py | Python | mit | 243 |
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='behave2cucumber',
version='1.0.3',
description='Behave to Cucumber json converter',
long_description='This project helps solving the incompatibilty of Behave\'s genereated json re... | behalf-oss/behave2cucumber | setup.py | Python | mit | 1,279 |
#!/usr/bin/env python
#
# Copyright 2012 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... | saltstack/salt | salt/ext/tornado/test/log_test.py | Python | apache-2.0 | 9,737 |
import geojson
import pony.orm as pny
from flask import Flask
from flask.ext.cache import Cache
from flask_restful import Resource, Api
import logging
from public_transport_analyser.database.database import Origin, Destination, init
from public_transport_analyser.visualiser.utils import get_voronoi_map
pta = Flask(_... | OlympusMonds/PTA | public_transport_analyser/rest_backend/main.py | Python | gpl-3.0 | 9,524 |
#!/usr/bin/env python
import telnetlib
import time
import sys
import socket
TEL_PORT = 23
TEL_TO = 3
def write_cmd(cmd, conn):
cmd = cmd.rstrip()
conn.write(cmd + '\n')
time.sleep(1)
return conn.read_very_eager()
def telnet_conn(ip, port, timeout):
try:
conn = telnetlib.Telnet(ip, port, ... | bluetiki/pylab | telnet.py | Python | bsd-2-clause | 1,063 |
# $Id: frontend.py 7339 2012-02-03 12:23:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Command-line and common processing for Docutils front-end tools.
Exports the following classes:
* `OptionParser`: Standard Docutils command-line process... | ddd332/presto | presto-docs/target/sphinx/docutils/frontend.py | Python | apache-2.0 | 34,078 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'SiteSettings.language_code'
db.add_column(u'begood_sites_sitesettings', 'language_code',
... | AGoodId/begood-sites | begood_sites/migrations/0005_auto__add_field_sitesettings_language_code.py | Python | mit | 7,865 |
# coding: utf-8
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impo... | mindbody/API-Examples | SDKs/Python/test/test_client_api.py | Python | bsd-2-clause | 5,280 |
from django.template.defaultfilters import escapejs_filter
from django.test import SimpleTestCase
from django.utils.functional import lazy
from ..utils import setup
class EscapejsTests(SimpleTestCase):
@setup({'escapejs01': '{{ a|escapejs }}'})
def test_escapejs01(self):
output = self.engine.render_... | mjtamlyn/django | tests/template_tests/filter_tests/test_escapejs.py | Python | bsd-3-clause | 2,409 |
import click
from docker import Client
from docker.utils import kwargs_from_env
import json
import git
from tardis.utils import ok, error, warn
import yaml
import os
import collections
POSTGRES_DATA_MOUNT = '/var/lib/postgresql/data'
POSTGRES_USER = 'postgres'
POSTGRES_PASSWORD= 'postgres'
CONFIG_FILE = './tardis2.ym... | codechimp/tardis | tardis/cli.py | Python | mit | 7,795 |
"""Different kinds of SAX Exceptions"""
import sys
if sys.platform[:4] == "java":
from java.lang import Exception
del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can contain
basic error or warning information from either the XML parser o... | trivoldus28/pulsarch-verilog | tools/local/bas-release/bas,3.9/lib/python/lib/python2.3/xml/sax/_exceptions.py | Python | gpl-2.0 | 4,662 |
def main(request, response):
headers = [(b"Content-Type", b"text/plain")]
command = request.GET.first(b"cmd").lower()
test_id = request.GET.first(b"id")
header = request.GET.first(b"header")
if command == b"put":
request.server.stash.put(test_id, request.headers.get(header, b""))
elif c... | scheib/chromium | third_party/blink/web_tests/external/wpt/beacon/resources/inspect-header.py | Python | bsd-3-clause | 628 |
# -*- coding: utf-8 -*-
import ast
import re
from collections import defaultdict
from .utils import GenericStack
from .utils import LeveledStack
from .utils import ScopeStack
from .utils import to_camel_case
from .utils import normalize
from . import ast as ecma_ast
class TranslateVisitor(ast.NodeVisitor):
def... | niwinz/cobrascript | cobra/translator.py | Python | bsd-3-clause | 26,780 |
# -*- coding: utf-8 -*-
from opus_api.util import jsonify, parse_num_tokens, minint, maxint
from opus_api.cache import jcache
import opus_api.crawler as crawler
import opus_api.settings as settings
import requests
import json
import bs4
from opus_api.exceptions import InvalidSrcException, InvalidTrgException, InvalidF... | yonkornilov/opus-api | opus_api/opus_api.py | Python | mit | 2,872 |
class Solution(object):
def firstMissingPositive(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
l = len(nums)
for i in range(0, l):
cur = nums[i]
while cur >= 1 and cur <= l and nums[cur - 1] != cur:
tmp = nums[cur - 1]
... | hawkphantomnet/leetcode | FirstMissingPositive/Solution.py | Python | mit | 495 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import collections
import pytz
from datetime import timedelta
from pytz import timezone
import os
class CityInfo():
def __init__(
self,
dayStations,
hourStations,
label,
name,
hourlyDataTimeOffset,
... | endlisnis/weather-records | stations.py | Python | gpl-3.0 | 18,155 |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def HostCnxFailedAccountFailedEvent(vim, *args, **kwargs):
'''This event records a failur... | xuru/pyvisdk | pyvisdk/do/host_cnx_failed_account_failed_event.py | Python | mit | 1,222 |
#-------------------------------------------------------------------------------
# Copyright (c) 2012 Gael Honorez.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0
# which accompanies this distribution, and is available at
# http://w... | HaraldWeber/client | src/tourneys/tourneyitem.py | Python | gpl-3.0 | 5,935 |
'''
Event Manager
=============
The :class:`EventManagerBase` is the abstract class intended for specific
implementation of dispatching motion events
(instances of :class:`~kivy.input.motionevent.MotionEvent`) to widgets through
:meth:`~kivy.uix.widget.Widget.on_motion` method of the
:class:`~kivy.uix.widget.Widget` c... | kivy/kivy | kivy/eventmanager/__init__.py | Python | mit | 7,176 |
'''
Created on April 1, 2014
@package: support testing
@copyright: 2014 Sourcefabric o.p.s.
@license: http://www.gnu.org/licenses/gpl-3.0.txt
@author: Ioan v. Pocol
Contains the service setups.
'''
from ally.container import support, ioc, bind
from __plugin__.superdesk.db_superdesk import bindSuperdeskSession,\
... | superdesk/Live-Blog | plugins/support-testing/__plugin__/support_testing/service.py | Python | agpl-3.0 | 938 |
# Copyright 2021 The TensorFlow 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 ... | tensorflow/similarity | tensorflow_similarity/distances.py | Python | apache-2.0 | 10,647 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from __future__ import division
import numpy as np
import yaml
import message_filters
import rospy
from jsk_recognition_msgs.msg import ClassificationResult
from jsk_topic_tools import ConnectionBasedTransport
class BoostObjectRecognition(ConnectionBasedTransport):
... | start-jsk/jsk_apc | jsk_2015_05_baxter_apc/node_scripts/boost_object_recognition.py | Python | bsd-3-clause | 2,781 |
# Copyright (c) 2013 Greg Lange
#
# 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... | greglange/qork | test_qork/unit/test_queue.py | Python | apache-2.0 | 30,141 |
from tests.unit.dataactcore.factories.staging import DetachedAwardFinancialAssistanceFactory
from tests.unit.dataactvalidator.utils import number_of_errors, query_columns
_FILE = 'fabs33_detached_award_financial_assistance_1'
def test_column_headers(database):
expected_subset = {'row_number', 'period_of_performa... | fedspendingtransparency/data-act-broker-backend | tests/unit/dataactvalidator/test_fabs33_detached_award_financial_assistance_1.py | Python | cc0-1.0 | 2,532 |
#!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 3 of the Lic... | kustodian/ansible | lib/ansible/modules/network/fortios/fortios_system_alias.py | Python | gpl-3.0 | 9,082 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2015: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak 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 So... | ddurieux/alignak | alignak/objects/arbiterlink.py | Python | agpl-3.0 | 4,948 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('fundraising', '0002_donation_donor_not_null'),
]
operations = [
migrations.AlterField(
model_name='payment',
... | xavierdutreilh/djangoproject.com | fundraising/migrations/0003_payment_stripe_charge_id_unique.py | Python | bsd-3-clause | 436 |
class model5(object):
def __init__(self):
self.__chain__ = None
def __getattribute__(self,x):
if x.startswith('__') or x in ('chain',):
return object.__getattribute__(self,x)
if self.__chain__:
v = self.__dict__[x] if x in self.__dict__ else getattr(self.__chain__,x)
else:
v = self.__dict__[x]
retu... | mobarski/sandbox | space/old/model5.py | Python | mit | 714 |
import re
import os
import sys
import glob
import stat
import time
import errno
#start:
import subprocess
import getpass
import pwd
import tempfile
from . import manager
#config:
from .shared import find_config, open_resource
#attach:
from . import user_client
#send/stop/kill
import json
import socket
#jar-list/ja... | SupaHam/mark2 | mk2/launcher.py | Python | mit | 17,631 |
# The MIT License (MIT)
# Copyright (c) 2015 kupiakos
# 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, me... | kupiakos/LapisMirror | plugins/drawcrowd.py | Python | mit | 4,144 |
import traceback
import sys
from compliance_checker.suite import CheckSuite
from compliance_checker.roms import DefinedROMSBaseCheck
from compliance_checker.generic import DefinedGenericBaseCheck
from compliance_checker.shoc import DefinedSHOCBaseCheck
class ComplianceCheckerCheckSuiteDefined(C... | webtrike/compliance-checker | compliance_checker/defined.py | Python | apache-2.0 | 5,415 |
from flask import Blueprint, Response
from json import dumps
import urllib
# Import module models
from app.mod_endpoints.models import State
from app.mod_endpoints.models import LGA
# Define the blueprint: 'endpoints', set its url prefix: app.url/api/v1
mod_endpoints = Blueprint('api/v1', __name__, url_prefix='/api/v1... | devcenter-square/states-cities | app/mod_endpoints/controllers.py | Python | mit | 1,245 |
import pytest
import os
import sys
from polyglotdb.io.types.parsing import (SegmentTier, OrthographyTier,
GroupingTier, TextOrthographyTier,
TranscriptionTier,
TextTranscriptionTier, TextMorphemeT... | MontrealCorpusTools/PolyglotDB | tests/conftest.py | Python | mit | 21,216 |
from django import http
from django.db import models
from django.contrib.databrowse.datastructures import EasyModel
from django.shortcuts import render_to_response
from django.utils.safestring import mark_safe
class AlreadyRegistered(Exception):
pass
class NotRegistered(Exception):
pass
class DatabrowsePlugi... | Shrews/PyGerrit | webapp/django/contrib/databrowse/sites.py | Python | apache-2.0 | 5,648 |
from phievo import __silent__,__verbose__
if __verbose__:
print("Execute palette.py")
from matplotlib import pylab,colors
default_colormap = "gist_rainbow"
def update_default_colormap(colormap):
"""
Update the color map used by the palette modules
Arg:
colormap (str): name of the matplotlib c... | phievo/phievo | phievo/AnalysisTools/palette.py | Python | lgpl-3.0 | 4,432 |
from __future__ import division, print_function, absolute_import
import inspect
import warnings
import numpy as np
import numpy.testing as npt
from scipy.lib._version import NumpyVersion
from scipy import stats
NUMPY_BELOW_1_7 = NumpyVersion(np.__version__) < '1.7.0'
def check_normalization(distfn, args, distnam... | jsilter/scipy | scipy/stats/tests/common_tests.py | Python | bsd-3-clause | 6,482 |
"""
Copyright (c) 2016, Youngmin Park, Bard Ermentrout
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 of conditions a... | youngmp/park_and_ermentrout_2016 | lambda_omega.py | Python | bsd-2-clause | 11,342 |
import numpy
class wogan_array(object):
def __init__(self, partition_dimensions, partition_size, dtype):
self.partition_size = partition_size
self.partitions = [[numpy.zeros(partition_size, partition_size) for x in partition_dimensions.x] for y in partition_dimensions.y]
def get_value(self, x... | keepitwiel/wogan | wogan/wogan_array.py | Python | mit | 339 |
from django.contrib import admin
from .models import Category, Post, Tag
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'pub_date',)
prepopulated_fields = {'slug': ('title',)}
filter_horizontal = ('tags',... | richardcornish/richardcornish | richardcornish/blog/admin.py | Python | bsd-3-clause | 524 |
from .pyalarmdotcom import Alarmdotcom
| Xorso/pyalarmdotcom | pyalarmdotcom/__init__.py | Python | bsd-3-clause | 39 |
import torch
import torch.nn as nn
import torchvision.datasets as dsets
import torchvision.transforms as transforms
from torch.autograd import Variable
# Hyper Parameters
input_size = 784
hidden_size = 256
dni_size = 1024
num_classes = 10
num_epochs = 50
batch_size = 500
learning_rate = 1e-3
use_cuda = torch.cuda.is... | DingKe/pytorch_workplace | dni/mlp.py | Python | mit | 4,728 |
from struct import unpack, pack, calcsize
from mobi_languages import LANGUAGES
from lz77 import uncompress
def LOG(*args):
pass
MOBI_HDR_FIELDS = (
("id", 16, "4s"),
("header_len", 20, "I"),
("mobi_type", 24, "I"),
("encoding", 28, "I"),
("UID", 32, "I"),
("generator_version", 36, "I"),
... | robwebset/script.ebooks | resources/lib/kiehinen/ebook.py | Python | gpl-2.0 | 8,604 |
import os
import sys
import urllib
import subprocess
def download(file_url,local_filename):
web_file = urllib.urlopen(file_url)
local_file = open(local_filename, 'w')
local_file.write(web_file.read())
web_file.close()
local_file.close()
def get_windows_pip_path():
python_dir = sys.executable
split = python_dir... | D35m0nd142/LFISuite | pipper.py | Python | gpl-3.0 | 1,908 |
#!/usr/bin/python2
# -*- coding: utf-8 -*-
#
# Copyright 2015 - 2016 Matteo Alessio Carrara <sw.matteoac@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the ... | matteoalessiocarrara/bot-virtualbrowser | src/lib/human/src/test.py | Python | gpl-3.0 | 2,336 |
from dataclasses import dataclass
import pytest
import lcs.strategies.reinforcement_learning as rl
@dataclass
class Classifier:
r: float
ir: float
class TestReinforcementLearning:
@pytest.mark.skip("Need to investigate this...")
@pytest.mark.parametrize("_r0, reward, _r1", [
(0.5, 0, 0.5)... | khozzy/pyalcs | tests/lcs/strategies/test_reinforcement_learning.py | Python | gpl-3.0 | 1,644 |
# -*- coding: utf-8 -*-
from .symlinknodemixin import SymlinkNodeMixin
from .util import _repr
class SymlinkNode(SymlinkNodeMixin):
def __init__(self, target, parent=None, children=None, **kwargs):
u"""
Tree node which references to another tree node.
Args:
target: Symbolic L... | c0fec0de/anytree | anytree/node/symlinknode.py | Python | apache-2.0 | 1,719 |
from glob import glob
from random import randint
from . import behavior
from ..util import Position
class Entity(object):
''' Base class for any game object.
'''
main_class = None
other_classes = []
starting_sprite = None
@staticmethod
def get_sprites(main_class):
sprite... | clofresh/spriteful | python/spriteful/entity/core.py | Python | bsd-3-clause | 3,057 |
# The MIT License (MIT) # Copyright (c) 2014-2017 University of Bristol
#
# 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... | IRC-SPHERE/HyperStream | hyperstream/tools/jsonify/2016-10-26_v0.0.1.py | Python | mit | 1,694 |
# ***************************************************************************
# * (c) 2019 Eliud Cabrera Castillo <e.cabrera-castillo@tum.de> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * ... | sanguinariojoe/FreeCAD | src/Mod/Draft/draftguitools/gui_polararray.py | Python | lgpl-2.1 | 6,066 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP module
# Copyright (C) 2010 Micronaet srl (<http://www.micronaet.it>)
#
# Italian OpenERP Community (<http://www.openerp-italia.com>)
#
#####################################################... | Micronaet/micronaet-accounting | account_invoice_multipartner/multipartner.py | Python | agpl-3.0 | 2,506 |
# Copyright 2022 The jax3d 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 wr... | google-research/jax3d | jax3d/projects/nesf/utils/shape_validation_test.py | Python | apache-2.0 | 5,313 |
import numpy as np
from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid
from bokeh.models.markers import DiamondCross
from bokeh.io import curdoc, show
N = 9
x = np.linspace(-2, 2, N)
y = x**2
sizes = np.linspace(10, 20, N)
source = ColumnDataSource(dict(x=x, y=y, sizes=sizes))
xdr = DataR... | percyfal/bokeh | tests/glyphs/DiamondCross.py | Python | bsd-3-clause | 905 |
#!/usr/bin/python
# Copyright: Ansible Project
# 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': ['preview'],
... | noroutine/ansible | lib/ansible/modules/cloud/amazon/aws_api_gateway.py | Python | gpl-3.0 | 11,663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.