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 |
|---|---|---|---|---|---|
# Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: jernej@reciprocitylabs.com
# Maintained By: jernej@reciprocitylabs.com
from lib import base
class NewRequestModal(base.Modal):
pass
| jmakov/ggrc-core | test/selenium/src/lib/page/lhn_modal/new_request.py | Python | apache-2.0 | 309 |
from .demo import *
SITE = Site(
globals(),
use_java=True,
# is_local_project_dir=True,
hidden_languages='nl',
remote_user_header='REMOTE_USER')
DEBUG = True
# SITE.appy_params.update(raiseOnError=True)
# SITE.appy_params.update(pythonWithUnoPath='/usr/bin/python3')
SITE.default_build_method = "appy... | lino-framework/welfare | lino_welfare/projects/mathieu/settings/doctests.py | Python | agpl-3.0 | 347 |
import sys, os, csv, pprint, math
from collections import OrderedDict
import numpy as np
import random
import shutil
import math
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import scipy.stats
import itertools
from matplotlib.colors import ListedColormap, NoNorm
from matplo... | roshantha9/AbstractManycoreSim | src/analyse_results/AnalyseResults_ExecutionCosts.py | Python | gpl-3.0 | 14,740 |
from scrapy.item import Item, Field
class SapItem(Item):
uid = Field() # user id, unique and identifier for each post
type = Field() # question, answer
author = Field()
title = Field()
text = Field()
date_time = Field()
tags = Field()
views = Field()
answers = Field() # #answers
... | collab-uniba/qa-scrapers | scn/scnscraper/items.py | Python | mit | 484 |
#!/usr/bin/env python3
import kxg, vecrec, networkx, itertools
import messages, helpers, gui, arguments
class World (kxg.World):
def __init__ (self):
kxg.World.__init__(self)
self.map = None
self.players = []
self.winner = None
self.losers = []
self.families = []
... | kxgames/kingdoms-of-life | tokens.py | Python | gpl-2.0 | 8,118 |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Authors: Jussi Nurminen <jnu@iki.fi>
# License: BSD Style.
import tarfile
import os.path as op
import os
from ...utils import _fetch_file, verbose, _check_option
from ..utils import _get_path, logger, _do_path_update
@verbose
def data_path(dataset='evoked', path=None... | olafhauk/mne-python | mne/datasets/hf_sef/hf_sef.py | Python | bsd-3-clause | 3,751 |
#
# GeoCoon - GIS data analysis library based on Pandas and Shapely
#
# Copyright (C) 2014 by Artur Wroblewski <wrobell@pld-linux.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either ve... | wrobell/geocoon | geocoon/core.py | Python | gpl-3.0 | 7,707 |
import unittest
from openmdao.main.api import Assembly, set_as_top
from openmdao.test.rosen_suzuki import Simulation, ScalingPreProc, \
ScalingPostProc
from openmdao.lib.drivers.slsqpdriver import SLSQPdriver
class Replace2TestCase(unittest.TestCase):
def test_replace2(sel... | HyperloopTeam/FullOpenMDAO | lib/python2.7/site-packages/openmdao.main-0.13.0-py2.7.egg/openmdao/main/test/test_replace2.py | Python | gpl-2.0 | 618 |
#!/usr/bin/env python
import os
from settings import DATABASES
from env_settings import path_to_store_settings
for fname in os.listdir(path_to_store_settings):
full_path = os.path.join(path_to_store_settings, fname)
f = open(full_path)
content = f.read()
f.close()
exec(content) #watch out for ... | yejia/osl_notebook | settings_manager.py | Python | mit | 346 |
"""
Parses command line arguments for SonosBar
Define which Sonos player to use for controlling
-p --player Name of the Sonos Player (eg: "Living Room")
-i --ip IP address of the Sonos Player
=> IP addresses can be shortened if on the same subnet.
eg: 192.168.1.15 can be chosen entering 15 when remote i... | anergictcell/SonosBar | src/cli_arguments.py | Python | mit | 4,037 |
from nose.tools import *
from airtime_analyzer.playability_analyzer import *
def check_default_metadata(metadata):
''' Stub function for now in case we need it later.'''
pass
def test_missing_liquidsoap():
old_ls = PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE
PlayabilityAnalyzer.LIQUIDSOAP_EXECUTABLE = '... | comiconomenclaturist/libretime | python_apps/airtime_analyzer/tests/playability_analyzer_tests.py | Python | agpl-3.0 | 2,400 |
# Copyright 2016, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | fluxer/spm | nuitka/nuitka/codegen/CodeGeneration.py | Python | gpl-2.0 | 30,002 |
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | sebrandon1/neutron | neutron/tests/unit/cmd/test_netns_cleanup.py | Python | apache-2.0 | 11,272 |
print '''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10,001st prime number?
'''
def problem():
x,limit = 1,0
while limit != 10001:
x += 1
if isprime(x): limit += 1
print x
problem()
| willybh11/python | projectEuler/problems/e7.py | Python | gpl-3.0 | 287 |
#!/usr/bin/env python
#
# Copyright 2006,2010,2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
from gnuradio import gr, gr_unittest, blocks
import random
import pmt
class test_unpack(gr_unittest.TestCase):
def setUp(self):
random.... | dl1ksv/gnuradio | gr-blocks/python/blocks/qa_unpack_k_bits.py | Python | gpl-3.0 | 2,451 |
# Copyright 2015 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... | kevin-coder/tensorflow-fork | tensorflow/compiler/tests/sparse_to_dense_op_test.py | Python | apache-2.0 | 4,606 |
from datetime import date
import uuid
from flask.json import JSONEncoder
from flask._compat import text_type
from itsdangerous import json as _json
from dateutil.tz import tzutc
from stevedore import driver
class OpsyJSONEncoder(JSONEncoder):
def default(self, o): # pylint: disable=method-hidden
if isin... | derekmoyes/opsy | opsy/utils.py | Python | mit | 1,794 |
fields = ['sta', 'ondate', 'offdate', 'lat', 'lon', 'elev', 'staname', 'statype', 'refsta', 'dnorth', 'deast', 'lddate']
| cloudmesh/sp17-i524 | project/F16-EG-1002/code/migration/mysite.py | Python | apache-2.0 | 124 |
#!/usr/bin/env python3
# Copyright (c) 2015-2022 Agalmic Ventures LLC (www.agalmicventures.com)
#
# 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 limit... | AgalmicVentures/Fixie | Fixie/Tools/ViewFix.py | Python | mit | 6,353 |
"""
dsq_postgres.backend
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
| disqus/disqus-postgres | src/dsq_postgres/backend/__init__.py | Python | apache-2.0 | 145 |
# Copyright 2015 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 ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/functions/call.py | Python | apache-2.0 | 2,127 |
#!/usr/bin/env python
"""compares BSR values between two groups in a BSR matrix
Numpy and BioPython need to be installed. Python version must be at
least 2.7 to use collections"""
from optparse import OptionParser
import subprocess
from ls_bsr.util import prune_matrix
from ls_bsr.util import compare_values
from ls_b... | jasonsahl/LS-BSR | tools/compare_BSR.py | Python | gpl-3.0 | 3,059 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('layers', '24_to_26'),
]
operations = [
migrations.CreateModel(
name='QGISServerLayer',
fields=[
... | kartoza/geonode | geonode/qgis_server/migrations/0001_initial.py | Python | gpl-3.0 | 597 |
from werkzeug.middleware.proxy_fix import ProxyFix
class CustomProxyFix(object):
def __init__(self, app, forwarded_proto):
self.app = ProxyFix(app, x_for=1, x_proto=1, x_host=1, x_port=0, x_prefix=0)
self.forwarded_proto = forwarded_proto
def __call__(self, environ, start_response):
e... | alphagov/notifications-admin | app/proxy_fix.py | Python | mit | 565 |
from __future__ import print_function
import errno
import time
import socket
import struct
import traceback
import zmq.green as zmq
from zope.interface import Interface, implements
from zope.interface.verify import verifyClass
from gevent import sleep, spawn, spawn_later
from gevent.socket import gethostbyname
from g... | eallik/spinoff | spinoff/remoting/hub.py | Python | bsd-2-clause | 12,588 |
"""SCons.Tool.aixcc
Tool-specific initialization for IBM xlc / Visual Age C compiler.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any... | Distrotech/scons | src/engine/SCons/Tool/aixcc.py | Python | mit | 2,288 |
# Generated by Django 2.2.13 on 2021-03-12 10:29
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('openstack', '0022_remove_tenant_extra_configuration'),
('waldur_rancher', '0035_drop_spl'),
]
operations =... | opennode/nodeconductor-assembly-waldur | src/waldur_rancher/migrations/0036_cluster_management_security_group.py | Python | mit | 664 |
# This file is part of Pimlico
# Copyright (C) 2020 Mark Granroth-Wilding
# Licensed under the GNU LGPL v3.0 - https://www.gnu.org/licenses/lgpl-3.0.en.html
"""Extract NP chunks
Performs the full spaCy pipeline including tokenization, sentence
segmentation, POS tagging and parsing and outputs documents containing
onl... | markgw/pimlico | src/python/pimlico/modules/spacy/extract_nps/info.py | Python | gpl-3.0 | 1,980 |
# use numpy.distutils to simplify setup.py scripts involving SWIG
from numpy.distutils.core import setup, Extension
import os
name = 'hw' # name of the module
version = 1.0 # the module's version number
sources = ['hw.i', '../HelloWorld.cpp', '../HelloWorld2.cpp']
setup(name=name, version=version,
... | sniemi/SamPy | sandbox/src1/TCSE3-3rd-examples/src/py/mixed/hw/C++/class/swig-hw/setup2.py | Python | bsd-2-clause | 502 |
import multiprocessing
import os
import sys
_is_travis = os.environ.get('TRAVIS') == 'true'
workers = multiprocessing.cpu_count() * 3
if _is_travis:
workers = 2
bind = "0.0.0.0:8080"
keepalive = 120
errorlog = '-'
pidfile = 'gunicorn.pid'
pythonpath = 'web2py'
worker_class = "meinheld.gmeinheld.MeinheldWorker"
... | actframework/FrameworkBenchmarks | frameworks/Python/web2py/gunicorn_conf.py | Python | bsd-3-clause | 448 |
import abc
import json
import logging
import os
import re
import deepdiff
from configs import EnjoliverConfig
ec = EnjoliverConfig(importer=__file__)
logger = logging.getLogger(__name__)
class Generator(object):
"""
Generator ensure the coherence from group -> profile -> ignition
"""
def __init__... | kirek007/enjoliver | app/generator.py | Python | mit | 7,655 |
class GameError(Exception):
def __init__(self, msg, code=None):
self.msg = msg
self.code = code
def to_dict(self):
return {
"message": self.msg,
"code": self.code
} | SArnab/JHU-605.401.82-SupaFly | server/clue/game/error.py | Python | mit | 183 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from types import MethodType
from django.conf.urls import url
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.core.urlresolvers import reverse
from django.http import HttpResponse, HttpResponseBadRequest
from dj... | jtiki/djangocms-cascade | cmsplugin_cascade/segmentation/mixins.py | Python | mit | 6,940 |
#! /usr/bin/env python
from ppclass import pp
ff = "ref64_p20b_diagfi.nc"
ff = "ref80_p20b_diagfi.nc"
apbp = open("apbp.txt", "w")
prof = open("temp_profile.txt","w")
ap = pp(file=ff,x=0,y=0,var="ap").getf()
bp = pp(file=ff,x=0,y=0,var="bp").getf()
temp = pp(file=ff,x=0,y=0,t=1e10,var="temp").getf()
for nn in rang... | aymeric-spiga/planetoplot | examples/ppclass_additional/printapbp.py | Python | gpl-2.0 | 475 |
import re
import pytest
from spacy.attrs import IS_PUNCT, LOWER, ORTH
from spacy.errors import MatchPatternError
from spacy.lang.en import English
from spacy.lang.lex_attrs import LEX_ATTRS
from spacy.matcher import Matcher
from spacy.tokens import Doc, Span, Token
from spacy.vocab import Vocab
pattern1 = [{"ORTH": ... | explosion/spaCy | spacy/tests/matcher/test_matcher_logic.py | Python | mit | 26,593 |
import random, math, sys, time
SIZE = 9
GAMES = 200
KOMI = 7.5
EMPTY, WHITE, BLACK = 0, 1, 2
SHOW = {EMPTY: '.', WHITE: 'o', BLACK: 'x'}
PASS = -1
MAXMOVES = SIZE*SIZE*3
TIMESTAMP = 0
MOVES = 0
def to_pos(x,y):
return y * SIZE + x
def to_xy(pos):
y, x = divmod(pos, SIZE)
return x, y
class Square:
de... | kmod/icbd | icbd/compiler/benchmarks/pypy/go.py | Python | mit | 14,045 |
"""Cleanup script."""
from grr.lib import export_utils
# After you do this the UI complains a little, but creating a new hunt fixes it.
hunts = aff4.FACTORY.Open("aff4:/hunts/")
for hunt in hunts.ListChildren():
aff4.FACTORY.Delete(hunt)
# Delete clients that haven't polled in for 2hours
for fd in aff4.FACTORY.Mult... | destijl/grr-workshop-setup | cleanup.py | Python | apache-2.0 | 602 |
"""896. Monotonic Array
https://leetcode.com/problems/monotonic-array/description/
An array is monotonic if it is either monotone increasing or monotone
decreasing.
An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array
A is monotone decreasing if for all i <= j, A[i] >= A[j].
Return true if an... | isudox/leetcode-solution | python-algorithm/leetcode/problem_896.py | Python | mit | 1,155 |
from django.contrib.auth.forms import AuthenticationForm
from django.core.urlresolvers import reverse
from actstream.models import user_stream
from dnstorm.app import DNSTORM_URL
from dnstorm.app.utils import get_option
from dnstorm.app.models import Problem, Idea
from dnstorm.app.utils import get_option
def base(re... | vmassuchetto/dnstorm | dnstorm/app/context_processors.py | Python | gpl-2.0 | 1,367 |
#!/usr/bin/env python
# coding=utf-8
from __future__ import division, print_function, unicode_literals
import re
import unicodedata
h1_start = re.compile(r"^\s*=(?P<title>[^=]+)=*[ \t]*")
valid_title = re.compile(r"[^=]+")
general_heading = re.compile(r"^\s*(={2,6}(?P<title>" + valid_title.pattern +
... | Qwlouse/Findeco | node_storage/validation.py | Python | gpl-3.0 | 1,992 |
# coding=utf-8
#
# Copyright (c) 2013-2015 First Flamingo Enterprise B.V.
#
# 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 requi... | firstflamingo/treinenaapje | app/TASeries.py | Python | apache-2.0 | 23,563 |
#!/usr/bin/python3
import logging
from gi.repository import Gst, GstNet
__all__ = ['Clock', 'NetTimeProvider']
port = 9998
log = logging.getLogger('Clock')
log.debug("Obtaining System-Clock")
Clock = Gst.SystemClock.obtain()
log.info("Using System-Clock for all Pipelines: %s", Clock)
log.info("Starting NetTimeProvi... | h01ger/voctomix | voctocore/lib/clock.py | Python | mit | 407 |
#!/usr/bin/env python3
#
# linearize-data.py: Construct a linear, no-fork version of the chain.
#
# Copyright (c) 2013-2014 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from __future__ import prin... | biblepay/biblepay | contrib/linearize/linearize-data.py | Python | mit | 11,820 |
def count_units(number):
sum(int(x) for x bin(number)[2:]
if __name__ == '__main__':
# These "asserts" using only for self-checking and not necessary for auto-testing
assert count_units(4) == 1
assert count_units(15) == 4
assert count_units(1) == 1
assert count_units(1022) == 9
| tomkun/empireofcode | sentry_gun/binary_count.py | Python | mit | 304 |
#!/usr/bin/env python
#
# Copyright 2004,2005,2007,2008,2010 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, ... | pgoeser/gnuradio | gr-msdd6000/src/python-examples/new_msdd_fft.py | Python | gpl-3.0 | 11,393 |
import os
import nipype
from nipype.interfaces.utility import Function,IdentityInterface
import nipype.pipeline.engine as pe # pypeline engine
from nipype.interfaces.freesurfer import *
from nipype.interfaces.io import DataGrabber
from nipype.interfaces.utility import Merge
def create_ba_maps_wf(name="Brodmann_Area_M... | FCP-INDI/nipype | nipype/workflows/smri/freesurfer/ba_maps.py | Python | bsd-3-clause | 8,682 |
# -*- coding: utf-8 -*-
# This file is part of pygal
#
# A python svg graph plotting library
# Copyright © 2012-2015 Kozea
#
# This library 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... | supracd/pygal | pygal/test/test_stacked.py | Python | lgpl-3.0 | 2,083 |
import bottle
import uuid
import time
import threading
from naoqi import ALProxy
from threading import Thread
from bottle import auth_basic
from NaoService import check_auth
app = bottle.Bottle()
name = 'NaoProfilingModule'
path = '/profiling'
sub = []
processes = {}
# This proxy is used to gain access to all
# sens... | max-leuthaeuser/naoservice | modules/NaoProfilingModule.py | Python | gpl-3.0 | 3,380 |
#!/usr/bin/env python2
# coding=utf-8
__docformat__ = "restructuredtext"
'''
Created on 16/12/2011
@author: Jesus Becerril Navarrete (jbnkuma)
@email: jesusbn5@gmail.com
Copyright (C) 2013 Jesus Becerril Navarrete <jesusbn5@gmail.com>
capturescreen_puesto.py is free software: you can redistribute it and/or modify it... | jbnkuma/remote_screenshot | src/capturescreen_puesto.py | Python | gpl-3.0 | 5,034 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from scrapy.contrib.pipeline.images import ImagesPipeline
from scrapy.http import Request
class OopImagesPipeline(ImagesPipeli... | huangchuchuan/Spider | OopSpider/oop/oop/pipelines.py | Python | apache-2.0 | 880 |
# coding=utf-8
"""Test for GIS utilities functions."""
import unittest
import numpy
from os.path import join
# noinspection PyUnresolvedReferences
import qgis # pylint: disable=unused-import
from PyQt4.QtCore import QVariant
from os.path import join
from safe.utilities.gis import (
layer_attribute_names,
is_... | Samweli/inasafe | safe/utilities/test/test_gis.py | Python | gpl-3.0 | 13,312 |
# ------------------------------------------------------------------
import itertools
#
# Bayes Optimal Classifier
#
# In this quiz we will compute the optimal label for a second missing word
# in a row
# based on the possible words that could be in the first blank
#
# Finish the procedure, LaterWords(), bel... | ZhukovGreen/UMLND | bayes_nlp_mini_project/q6.py | Python | gpl-3.0 | 4,264 |
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | krafczyk/spack | var/spack/repos/builtin/packages/r-cubist/package.py | Python | lgpl-2.1 | 1,733 |
# ----------------------------------------------------------------------------
# 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
#
# http://www.apa... | Jokeren/neon | neon/visualizations/figure.py | Python | apache-2.0 | 7,615 |
# Copyright (C) 2007-2008 www.stani.be
#
# 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 program is distributed... | tibor95/phatch-python2.7 | phatch/lib/fonts.py | Python | gpl-3.0 | 8,731 |
"""
/***************************************************************************
Name : PythonObject
Description : provides abstract methods for creating a python class from a table name
Date : 5/March/2015
copyright : (C) 2015 by UN-Habitat and implementing part... | gltn/stdm | stdm/ui/python_object.py | Python | gpl-2.0 | 1,433 |
import ob2.config as config
from os.path import exists, join
def get_inst_account_form_path(login):
"""
Returns the path to the PDF file that contains the account form for user with login.
login -- The instructional account login without any prefix (e.g. aa)
"""
if not config.inst_account_enabl... | octobear2/ob2 | ob2/util/inst_account.py | Python | bsd-2-clause | 640 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, # You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
from mach.decorators import (
CommandProvider,
Comman... | michath/ConMonkey | python/mach/mach/commands/commandinfo.py | Python | mpl-2.0 | 1,308 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from typing import Any, Dict, List, Mapping, Optional, Sequence, Text
from django.http import HttpRequest, HttpResponse
from django.utils.translation import ugettext as _
from zerver.lib import cache
from zerver.lib.test_helpers import (
queries_cap... | isht3/zulip | zerver/tests/test_subs.py | Python | apache-2.0 | 98,466 |
# This file is part of Androguard.
#
# Copyright (C) 2012, Anthony Desnos <desnos at t0t0.fr>
# 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... | CZ-NIC/thug | src/Analysis/androguard/core/analysis/analysis.py | Python | gpl-2.0 | 58,997 |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | google/jax | jax/experimental/jax2tf/tests/jax2tf_limitations.py | Python | apache-2.0 | 40,755 |
"""Examples taken from:
https://github.com/ckan/ckanext-harvest/blob/master/ckanext/harvest/model/__init__.py
https://github.com/ckan/ckanext-spatial/blob/master/ckanext/spatial/model/package_extent.py
"""
# TODO @palcu: split this file into it's own modules
# However those global variables are fucking shit
from logg... | govro/ckanext-inventory | ckanext/inventory/model/__init__.py | Python | apache-2.0 | 3,084 |
# Generated by Django 3.1.7 on 2021-04-19 12:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("projects", "0010_project... | adfinis-sygroup/timed-backend | timed/projects/migrations/0011_auto_20210419_1459.py | Python | agpl-3.0 | 4,955 |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2022, John McNamara, jmcnamara@cpan.org
#
import unittest
from io import StringIO
from ...table import Table
class TestInitialisation(unittest.Test... | jmcnamara/XlsxWriter | xlsxwriter/test/table/test_initialisation.py | Python | bsd-2-clause | 797 |
from . import handlers
from firenado import tornadoweb
from firenado.launcher import ProcessLauncher
from tornado import gen
import os
class LauncherComponent(tornadoweb.TornadoComponent):
def __init__(self, name, application):
super(LauncherComponent, self).__init__(name, application)
self.launc... | candango/firenado | examples/launcher/app.py | Python | apache-2.0 | 902 |
import json
import urllib
import os
import sys
import threading
sys.path.append("../")
import server
from server import servicePin
from server import service
from src.model import Pin, Category
#constants
#Prends en argument l'url du fichier json concernant les donnees de velov
#ex: "https://download.data.grandlyon.... | H4213/WeLyon1.0 | test/test_perf.py | Python | mit | 1,006 |
import os
# *****************************
# Environment specific settings
# *****************************
APP_NAME = "Snowflake"
# The settings below can (and should) be over-ruled by OS environment variable settings
# Flask settings # Generated with: import os; os.urandom(24)
SECRET_KEY = os.g... | brandonium21/snowflake | app/startup/settings.py | Python | bsd-2-clause | 1,980 |
# Copyright (c) 2013-2015 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
#... | nchammas/asyncssh | asyncssh/channel.py | Python | epl-1.0 | 61,675 |
# 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 u... | ctrlaltdel/neutrinator | vendor/stevedore/tests/test_hook.py | Python | gpl-3.0 | 1,713 |
# Copyright (C) 2016 Domos Group
#
# 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 program i... | dpdani/Domos | src/peripherals/peripheral.py | Python | gpl-3.0 | 3,672 |
"""Classes for the management of current data."""
from backend.utils import compute_progress
from .base import BaseModel
class Stock(BaseModel):
"""Stock model class."""
def key(self):
"""Method that defines the pattern for the stock key."""
return '{}:{}'.format(self.time.date(), self.symbo... | akita8/scrapper | backend/models/current.py | Python | mit | 983 |
import pluggy
hookimpl = pluggy.HookimplMarker("eggsample")
"""Marker to be imported and used in plugins (and for own implementations)"""
| CYBAI/servo | tests/wpt/web-platform-tests/tools/third_party/pluggy/docs/examples/eggsample/eggsample/__init__.py | Python | mpl-2.0 | 139 |
#
# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
""" Returns information about a module """
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import click
from ..co... | jdemel/gnuradio | gr-utils/modtool/cli/info.py | Python | gpl-3.0 | 800 |
# Copyright (c) 2017 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
DOCUMENTATION = '''
inventory: ini
version_added: "2.4"
short_description: Uses an Ansibl... | sgerhart/ansible | lib/ansible/plugins/inventory/ini.py | Python | mit | 16,758 |
# -*- coding: utf-8 -*-
class Config(object):
DEBUG = False
PORT = 5000
HOST = '0.0.0.0'
# URL_PREFIX = '/api'
LOG_FILENAME = 'fstore.log' # used if DEBUG=True
LOG_ADDRESS = '/dev/log' # used for logging.handlers.SysLogHandler
LOG_FACILITY = 'local1'
LOGGER_NAME = 'fstore.api'
L... | xmm/fstore | api/config.py | Python | bsd-3-clause | 1,605 |
from tests.testing_harness import TestHarness
def test_quadric_surfaces():
harness = TestHarness('statepoint.10.h5')
harness.main()
| wbinventor/openmc | tests/regression_tests/quadric_surfaces/test.py | Python | mit | 142 |
import json
import os
import sys
import lmdb
__author__ = 'ananya.h'
def compute_recall(vertical, path_to_nn_lmdb, k_s=[1, 3, 5, 10, 20]):
env = lmdb.open(path_to_nn_lmdb)
base_dir = "/data/street2shop"
meta_dir = os.path.join(base_dir, "meta", "json")
retrieval_path = os.path.join(meta_dir, "retriev... | flipkart-incubator/fk-visual-search | scripts/compute_recall.py | Python | apache-2.0 | 2,808 |
# 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 | poem/core/tfse_input_layer.py | Python | apache-2.0 | 12,521 |
import http.client
#import pudb
#pudb.set_trace()
conn = http.client.HTTPConnection("www.python.org")
conn.request("GET","/index.html")
res = conn.getresponse()
print(res.getheaders())
print(res.getheader('server'))
print(res.getheader('space','mine'))
| shabbir005/learntosolveit | languages/python/web_httplib_example_3.py | Python | bsd-3-clause | 253 |
# test args, streams
import sys, os
print(os.getcwd()) # to Outputs
print(sys.path[0])
print('[argv]')
for arg in sys.argv: # from Args
print(arg) # to Outputs
print('[interaction]') # to Outputs
text = input('Enter text:') # from... | simontakite/sysadmin | pythonscripts/programmingpython/System/Tester/Scripts/test-basic-args.py | Python | gpl-2.0 | 430 |
#! /usr/bin/python
#
# Code generator for python ctypes bindings for VLC
# Copyright (C) 2009 the VideoLAN team
# $Id: $
#
# Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publi... | maddox/vlc | bindings/python-ctypes/test.py | Python | gpl-2.0 | 5,008 |
import os
from django.conf import settings
from django.conf.urls import url
from . import views
app_name = 'url_shortener'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^(?P<alias>[a-zA-Z0-9-_]+)$', views.redirect, name='alias'),
url(r'^(?P<alias>[a-zA-Z0-9-_]+)(?P<extra>/.*)$', views.redi... | smtchahal/url-shortener | url_shortener/urls.py | Python | mit | 655 |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|-|S|p|y|.|c|o|.|u|k|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#
# pi_camera_options.py
# Takes a sequence of photos with the Pi camera
# using a range of Exposure and White Balance
# settings.
#
# Project URL :
# http:... | autograss/autograss | camera/mult_fotos.py | Python | gpl-2.0 | 2,258 |
"""
Entrance Exams view module -- handles all requests related to entrance exam management via Studio
Intended to be utilized as an AJAX callback handler, versus a proper view/screen
"""
import logging
from functools import wraps
from django.conf import settings
from django.contrib.auth.decorators import login_require... | jolyonb/edx-platform | cms/djangoapps/contentstore/views/entrance_exam.py | Python | agpl-3.0 | 10,861 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import pypot.robot
import requests
import json
class ServiceReady(pypot.primitive.LoopPrimitive):
def setup(self):
ip = "192.168.1.102"
self._req = "http://"+ip+"/hello?state=on"
def update(self):
r = request.get(... | jerome-guichard/primitiveWS | cherry/primitives/service_ready.py | Python | gpl-3.0 | 499 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... | OpusVL/odoo | addons/purchase_requisition/purchase_requisition.py | Python | agpl-3.0 | 23,779 |
"""
From: https://raw.githubusercontent.com/nexB/scancode-toolkit/48aeaf76ce9f53d02223c41c1b2ad1d1ad73b851/etc/scripts/irc-notify.py
Copyright (C) 2015-2016 Christopher R. Wood
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... | nado/stk-code | tools/appveyor-irc-notify.py | Python | gpl-3.0 | 6,742 |
# -*- coding: utf-8 -*-
"""
sphinx.pycode.nodes
~~~~~~~~~~~~~~~~~~~
Parse tree node implementations.
:copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
class BaseNode(object):
"""
Node superclass for both terminal and nonterminal ... | havard024/prego | venv/lib/python2.7/site-packages/sphinx/pycode/nodes.py | Python | mit | 6,387 |
#!python
# -*- coding: utf-8 -*-
"""File: weka.py
Description: Link WEKA into the project
History:
0.2.0 + a group of functions to interact with WEKA
0.1.0 The first version.
"""
__version__ = '0.2.0'
__author__ = 'SpaceLis'
import re, random
from anatool.dm.db import CONN_POOL, GEOTWEET
from anat... | spacelis/anatool | anatool/dm/weka.py | Python | mit | 4,370 |
# Copyright 2013 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 ag... | GoogleCloudPlatform/Data-Pipeline | app/src/hadoop/datastore_test.py | Python | apache-2.0 | 2,601 |
class GsmException(Exception):
pass
| PMantovani/road-irregularity-detector | raspberry/src/GsmException.py | Python | apache-2.0 | 40 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
#
# Copyright (C) 2014 Bitergia
#
# 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 ve... | dicortazar/grimoirelib-metadata | setup.py | Python | gpl-3.0 | 1,262 |
import time
import silc
class EchoClient(silc.SilcClient):
def channel_message(self, sender, channel, flags, message):
print message
self.send_channel_message(channel, message)
def private_message(self, sender, flags, message):
print message
self.send_private_messa... | mnemonikk/pysilc | examples/echo.py | Python | bsd-3-clause | 1,449 |
from symbol.builder import add_anchor_to_arg
from models.FPN.builder import MSRAResNet50V1FPN as Backbone
from models.FPN.builder import FPNNeck as Neck
from models.FPN.builder import FPNRoiAlign as RoiExtractor
from models.FPN.builder import FPNBbox2fcHead as BboxHead
from mxnext.complicate import normalizer_factory
... | TuSimple/simpledet | config/ms_r50v1_fpn_1x.py | Python | apache-2.0 | 10,314 |
"""
evolang.py for exploring ideas from:
Emergence of Communication in Teams of Embodied and Situated
Agents, by Davide Marocco and Stefano Nolfi, ALife 2006.
Author: Doug Blank
Bryn Mawr College
Date: March 2008
For use with PyroRobotics.org
"""
from pyrobot.simulators.pysim import *
from pyrobot.geometry... | emilydolson/forestcat | pyrobot/examples/evolang.py | Python | agpl-3.0 | 21,807 |
from bokeh.charts import BoxPlot, output_file, show
from bokeh.sampledata.autompg import autompg as df
p = BoxPlot(df, values='mpg', label='cyl', outliers=False,
title="MPG Summary (grouped by CYL, no outliers)")
output_file("boxplot.html")
show(p)
| phobson/bokeh | sphinx/source/docs/user_guide/source_examples/charts_boxplot_outliers.py | Python | bsd-3-clause | 264 |
import numpy as np
import os
from cache import cache
########################################################################
def one_hot_encoded(class_numbers, num_classes=None):
"""
Generate the One-Hot encoded class-labels from an array of integers.
For example, if class_number=2 and num_classes=4 th... | Rauf-Kurbanov/au_dl_course | seminar_3/dataset.py | Python | gpl-3.0 | 9,038 |
from django.conf.urls import url
from django.contrib.contenttypes import views
urlpatterns = [
url(r'^shortcut/([0-9]+)/(.*)/$', views.shortcut),
]
| nesdis/djongo | tests/django_tests/tests/v21/tests/contenttypes_tests/urls.py | Python | agpl-3.0 | 153 |
__author__ = 'kyle_xiao'
import tornado.httpclient
import urllib
import json
import hashlib
class AccessTicket(object):
def __init__(self, timestamp, appId, key, nonceStr):
"""
:param timestamp:
:param appId:
:param key:
:param nonceStr:
"""
... | kylexiaox/WechatWebShareJs | apiAccess.py | Python | apache-2.0 | 1,927 |
import base64
import os
import re
from io import BytesIO
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.urls import reverse
from PIL import Image
from wiki.core.plugins import registry as plugin_registry
from wiki.models import URLPath
from wiki.plugins.images import models
from wiki.plugi... | nert-gu/Xposition | tests/plugins/images/test_views.py | Python | gpl-3.0 | 10,458 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.