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
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Remove cullers so single vertex will render
ren1 = vtk.vtkRenderer()
ren1.GetCullers().RemoveAllItems()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderW... | HopeFOAM/HopeFOAM | ThirdParty-0.1/ParaView-5.0.1/VTK/Common/DataModel/Testing/Python/TestStructuredGrid.py | Python | gpl-3.0 | 5,545 |
# $Id$
#
# Copyright (C) 2002-2008 greg Landrum and Rational Discovery LLC
#
# @@ All Rights Reserved @@
# This file is part of the RDKit.
# The contents are covered by the terms of the BSD license
# which is included in the file license.txt, found at the root
# of the RDKit source tree.
#
""" Atom-based calculat... | soerendip42/rdkit | rdkit/Chem/Crippen.py | Python | bsd-3-clause | 6,129 |
#!/usr/bin/env python
"""
Use the AppVeyor API to download Windows artifacts.
Taken from: https://bitbucket.org/ned/coveragepy/src/tip/ci/download_appveyor.py
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
"""
f... | Justin-W/clifunland | ci/appveyor-download.py | Python | bsd-2-clause | 3,815 |
# flake8: noqa
# There's no way to ignore "F401 '...' imported but unused" warnings in this
# module, but to preserve other warnings. So, don't check this module at all.
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | huggingface/transformers | src/transformers/models/speech_to_text/__init__.py | Python | apache-2.0 | 3,127 |
import collections
import operator
import numpy
import sys
from keras.layers import Dense, Embedding
from keras.layers import Dropout
from keras.layers.recurrent import GRU
from keras.models import Sequential
from keras.utils import np_utils
from keras.layers.convolutional import Convolution1D
from keras.layers.convol... | arashzamani/lstm_nlg_ver1 | test_cases/algorithm2_with_embedding.py | Python | gpl-3.0 | 5,402 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Grirrane/odoo | openerp/addons/base/res/res_currency.py | Python | agpl-3.0 | 15,990 |
from __future__ import print_function
"""
Deprecated. Use ``update-tld-names`` command instead.
"""
__title__ = 'tld.update'
__author__ = 'Artur Barseghyan'
__copyright__ = '2013-2015 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
from tld.utils import update_tld_names
_ = lambda x: x
if __name__ == '__main__'... | underdogio/tld | src/tld/update.py | Python | gpl-2.0 | 414 |
from .base import *
class List(Base, list):
def __init__(self, value=[]):
Base.__init__(self)
list.__init__(self, value)
def __getitem__(self, i):
item = list.__getitem__(self, i)
if isinstance(item, list):
item = List(item)
return item
def get_pen(s... | zlsun/VisualAlgorithm | src/structures/list.py | Python | mit | 1,031 |
from random import randint
from flask.ext.script import Manager, prompt_bool
from faker import Factory
from app.mod_school import load_school, random_school
from app.mod_user import random_user
from app.mod_proposal import random_proposal
from .services import delete_all_collections
from .models import Collection
ma... | codeforanchorage/collective-development | app/mod_collection/manage.py | Python | mit | 1,565 |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | sxjscience/tvm | python/tvm/relay/op/contrib/register.py | Python | apache-2.0 | 1,708 |
#This file is part of Tryton. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
__all__ = ['Wizard', 'StateView', 'StateTransition', 'StateAction', 'Button',
'Session']
try:
import simplejson as json
except ImportError:
import json
from tryton... | mediafactory/tryton_core_daemon | trytond/wizard/wizard.py | Python | gpl-3.0 | 12,694 |
#-*- coding:utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 One Click Software (http://oneclick.solutions)
# and Copyright (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>.
# All Rights Reserved.
#
# This program is free software: you ca... | cartertech/odoo-hr-ng | hr_policy_accrual/__openerp__.py | Python | agpl-3.0 | 2,187 |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# (C) British Crown Copyright 2012-6 Met Office.
#
# This file is part of Rose, a framework for meteorological suites.
#
# Rose is free software: you can redistribute it and/or modify
# it under the terms of the GNU ... | kaday/rose | lib/python/rose/config_editor/plugin/um/widget/stash_add.py | Python | gpl-3.0 | 31,926 |
"""Langevin dynamics class."""
import sys
import numpy as np
from numpy.random import standard_normal
from ase.md.md import MolecularDynamics
# For parallel GPAW simulations, the random forces should be distributed.
if '_gpaw' in sys.modules:
# http://wiki.fysik.dtu.dk/gpaw
from gpaw.mpi import world as gpaw... | slabanja/ase | ase/md/langevin.py | Python | gpl-2.0 | 4,307 |
#
# Copyright 2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in th... | leongold/lago | lago/prefix.py | Python | gpl-2.0 | 40,207 |
from numba import *
jitv = jit(void(), warnstyle='simple') #, nopython=True)
def simple_return():
"""
>>> result = jitv(simple_return)
Warning 14:4: Unreachable code
"""
return
print('Where am I?')
def simple_loops():
"""
>>> result = jitv(simple_loops)
Warning 28:8: Unreachabl... | shiquanwang/numba | numba/control_flow/tests/test_w_unreachable.py | Python | bsd-2-clause | 1,242 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware 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 cop... | salamb/girder | girder/api/v1/file.py | Python | apache-2.0 | 17,532 |
def restricted(func):
"""
A decorator to confirm a user is logged in or redirect as needed.
"""
def login(self, *args, **kwargs):
# Redirect to login if user not logged in, else execute func.
if not self.current_user:
self.redirect("/login")
else:
... | diegopettengill/multiuserblog | handlers/decorators.py | Python | mit | 367 |
# -*- coding: utf-8 -*-
from zenqueue import json
from zenqueue import log
class AbstractQueueClient(object):
class QueueClientError(Exception): pass
class ActionError(QueueClientError): pass
class ClosedClientError(QueueClientError): pass
class RequestError(QueueClientError): pass
class Tim... | zacharyvoase/zenqueue | zenqueue/client/common.py | Python | mit | 1,921 |
import random
import string
from collection.models import CollectionVersion, Collection
from concepts.models import Concept, ConceptVersion, LocalizedText
from oclapi.models import ACCESS_TYPE_EDIT, ACCESS_TYPE_VIEW
from orgs.models import Organization
from sources.models import Source, SourceVersion
from users.model... | snyaggarwal/oclapi | ocl/test_helper/base.py | Python | mpl-2.0 | 10,616 |
# gtcal.calendar
# Calendar keeps track of events and loads information from disk.
#
# Author: Benjamin Bengfort <bb830@georgetown.edu>
# Created: Mon Sep 14 19:17:10 2015 -0400
#
# Copyright (C) 2015 Georgetown University
# For license information, see LICENSE.txt
#
# ID: calendar.py [] benjamin@bengfort.com $
"""... | rebeccabilbro/calendar | gtcal/calendars.py | Python | mit | 3,924 |
# -*- coding: utf-8 -*-
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from .models import CrocodocDocument
import signals as crocodoc_signals
import json
import logging
from bunch import Bunch
logger = logging.getLogger('django.request')
class CrocoDocConnect... | rosscdh/django-crocodoc | dj_crocodoc/services.py | Python | gpl-2.0 | 7,767 |
import sublime, sublime_plugin
import webbrowser
class OpenInBrowserCommand(sublime_plugin.TextCommand):
def run(self, edit):
if self.view.file_name():
webbrowser.open_new_tab("file://" + self.view.file_name())
def is_visible(self):
return self.view.file_name() != None and (self.vi... | koery/win-sublime | Data/Packages/Default/open_in_browser.py | Python | mit | 509 |
#!/usr/bin/env python3
# This code is an example for a tutorial on Ubuntu Unity/Gnome AppIndicators:
# http://candidtim.github.io/appindicator/2014/09/13/ubuntu-appindicator-step-by-step.html
# source : https://gist.github.com/jmarroyave/a24bf173092a3b0943402f6554a2094d
# see also : http://www.devdungeon.com/content/... | nomad-fr/scripts-systems | myappindicator.py | Python | gpl-3.0 | 3,802 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('article', '0013_auto_20160507_1405'),
]
operations = [
migrations.AlterField(
model_name='article',
... | benjaminfs/myforum | article/migrations/0014_auto_20160508_0534.py | Python | gpl-2.0 | 457 |
# coding: utf-8
from __future__ import unicode_literals, absolute_import
try:
import requests as r
except:
r = None
class TigrisSession(object):
"""
Base session layer for Tigris.
"""
def __init__(self,
base_url,
default_headers={}):
"""
:pa... | jogral/tigris-python-sdk | tigrissdk/session/tigris_session.py | Python | apache-2.0 | 5,263 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# tests/server/server_rpc.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this ... | hdemeyer/king-phisher | tests/server/server_rpc.py | Python | bsd-3-clause | 7,130 |
"""
This module converts requested URLs to callback view functions.
URLResolver is the main class here. Its resolve() method takes a URL (as
a string) and returns a ResolverMatch object which provides access to all
attributes of the resolved URL match.
"""
import functools
import inspect
import re
import threading
fro... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/urls/resolvers.py | Python | mit | 27,298 |
import click
from ghutil.edit import edit_as_mail
from ghutil.types import PullRequest
from ghutil.util import optional
@click.command()
@optional("--base", metavar="BRANCH", help="Change branch to pull into")
@optional("-b", "--body", type=click.File(), help="File containing new PR body")
@optional(
"-M",
"-... | jwodder/ghutil | src/ghutil/cli/pr/edit.py | Python | mit | 1,523 |
import numpy
class BiomeSimulation(object):
@staticmethod
def is_applicable(world):
return world.has_humidity() and world.has_temperature() and \
(not world.has_biome())
@staticmethod
def execute(world, seed):
assert seed is not None
w = world
width = world... | esampson/worldengine | worldengine/simulations/biome.py | Python | mit | 6,058 |
import sys
if __name__ == "__main__":
# Parse command line arguments
if len(sys.argv) < 2:
sys.exit("python {} <datasetFilename> {{<maxPoints>}}".format(sys.argv[0]))
datasetFilename = sys.argv[1]
if len(sys.argv) >= 3:
maxPoints = int(sys.argv[2])
else:
maxPoints = None
# Perform initial pass through fil... | DonaldWhyte/multidimensional-search-fyp | scripts/read_multifield_dataset.py | Python | mit | 1,612 |
# This file is part of Copernicus
# http://www.copernicus-computing.org/
#
# Copyright (C) 2011, Sander Pronk, Iman Pouya, Erik Lindahl, and others.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Softwa... | soellman/copernicus | cpc/dataflow/project.py | Python | gpl-2.0 | 27,210 |
# Copyright 2014 Scality
# 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 appli... | openstack/tempest | tempest/scenario/test_shelve_instance.py | Python | apache-2.0 | 5,613 |
#=======================================================================
# TestRandomDelay
#=======================================================================
import random
from pymtl import *
from pclib.ifcs import InValRdyBundle, OutValRdyBundle
#----------------------------------------------------------... | Abhinav117/pymtl | pclib/test/TestRandomDelay.py | Python | bsd-3-clause | 2,895 |
"""
A dropbox for uncategorized utility code that doesn't belong anywhere else.
"""
import warnings
import inspect
import functools
import os
from collections import deque
from twisted.python.reflect import fullyQualifiedName
from zope.interface import alsoProvides
class DecoratorPartial(object):
def __init__(se... | lahwran/crow2 | crow2/util.py | Python | mit | 7,384 |
menuscreen_kv = '''
<ScreenMenu>:
id: screen_menu
BoxLayout:
orientation: 'vertical'
InputField:
id: text_input_field
gid: 'text_input_field_global_id'
Button:
text: 'Save'
# this is great for local widget tree:
#on_release: t... | suchyDev/Kivy-Dynamic-Screens-Template | screens/screenmenu.py | Python | mit | 2,103 |
# -*- coding: utf-8 -*-
from PyQt4 import QtGui, uic
from PyQt4.uic import loadUi
from epipy.ui.view import cwd
class SIRsimpleGroupBox(QtGui.QGroupBox):
"""This class represents the SIR Simple group box.
:returns: an instance of *SIRsimpleGroupBox*
"""
def __init__(self):
super(SIRsimpleGr... | ckaus/EpiPy | epipy/ui/view/sirgroupbox.py | Python | mit | 978 |
#!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Contact: Bhaskar Mookerji <mookerji@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other rights reserved.
#
# THIS CODE AND INFORMATION IS PROVIDED "AS IS... | paparazzi/libsbp | generator/sbpg/targets/java.py | Python | lgpl-3.0 | 6,418 |
import pytest
from pysubs2 import SSAEvent, make_time
def test_repr_dialogue():
ev = SSAEvent(start=make_time(m=1, s=30), end=make_time(m=1, s=35), text="Hello\\Nworld!")
ref = r"<SSAEvent type=Dialogue start=0:01:30 end=0:01:35 text='Hello\\Nworld!'>"
assert repr(ev) == ref
def test_repr_comment():
... | tkarabela/pysubs2 | tests/test_ssaevent.py | Python | mit | 2,177 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
from collections imp... | square/pants | src/python/pants/reporting/reporter.py | Python | apache-2.0 | 2,392 |
#!/usr/bin/python2.4
#
#
# Copyright 2008, The Android Open Source Project
#
# 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 requir... | aospx-kitkat/platform_external_chromium_org | third_party/android_testrunner/adb_interface.py | Python | bsd-3-clause | 18,939 |
# Copyright (c) 2014 Rackspace, 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 applicable law or agreed to in wr... | obulpathi/cdn1 | cdn/transport/validators/schemas/service.py | Python | apache-2.0 | 3,716 |
# pylint: disable=g-import-not-at-top
# 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/LICE... | jart/tensorflow | tensorflow/contrib/__init__.py | Python | apache-2.0 | 4,581 |
import os, sys
APP_VERSION = '1.1.1'
CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser('__file__'))))
WIN_EXE_LIB = os.path.normpath(os.path.join(CURR_DIR, 'library'))
if os.path.isdir(WIN_EXE_LIB):
sys.path.insert(0, WIN_EXE_LIB)
def client_main():
from dogepartycli im... | coinwarp/dogeparty-cli | dogepartycli/__init__.py | Python | mit | 424 |
# Copyright 2014 The Oppia 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 applicable ... | brianrodri/oppia | core/controllers/base.py | Python | apache-2.0 | 35,014 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import tex... | scode/pants | src/python/pants/backend/jvm/tasks/jvm_compile/scala/zinc_compile.py | Python | apache-2.0 | 12,212 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | littlejo/Libreosteo | libreosteoweb/migrations/0001_initial.py | Python | gpl-3.0 | 6,226 |
#-*- coding: utf-8 -*-
import os
from django.utils.text import get_valid_filename as get_valid_filename_django
from django.template.defaultfilters import slugify
from django.core.files.uploadedfile import SimpleUploadedFile
class UploadException(Exception):
pass
def handle_upload(request):
if not request.me... | MechanisM/django-filer | filer/utils/files.py | Python | bsd-3-clause | 1,749 |
# Copyright 2018 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... | tensorflow/serving | tensorflow_serving/example/resnet_client.py | Python | apache-2.0 | 3,042 |
# -*- coding: utf-8 -*-
#
# rkchunk documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 9 10:45:35 2014.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | bbengfort/rkchunk | docs/conf.py | Python | mit | 8,035 |
from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
import models
class FilerGalleryPlugin(CMSPluginBase):
model = models.FilerGallery
name = _("Gallery")
render_template = "cmsplugin_filer_gallery/gallery.html"
text... | philippbosch/cmsplugin-filer | src/cmsplugin_filer_gallery/cms_plugins.py | Python | mit | 1,299 |
import renderdoc as rd
import rdtest
class VK_Leak_Check(rdtest.TestCase):
demos_test_name = 'VK_Leak_Check'
demos_frame_cap = 50000
demos_frame_count = 10
demos_timeout = 120
def check_capture(self):
memory: int = rd.GetCurrentProcessMemoryUsage()
if memory > 500*1000*1000:
... | Zorro666/renderdoc | util/test/tests/Vulkan/VK_Leak_Check.py | Python | mit | 525 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt
from pisi.actionsapi import cmaketools
from pisi.actionsapi import get
from pisi.actionsapi import pisitools
def setup():
cmaketools.configure("-DCMAKE_BUILD_TYP... | vdemir/pisi_package | LXQT/addon/qterminal/actions.py | Python | gpl-3.0 | 607 |
blah = 33
| sjdv1982/seamless | seamless/graphs/multi_module/mytestpackage/mod4.py | Python | mit | 10 |
# stdlib
from collections import defaultdict
import sys
from typing import Any as TypeAny
from typing import Callable
from typing import Dict
from typing import KeysView
from typing import List as TypeList
from typing import Set
# third party
from cachetools import cached
from cachetools.keys import hashkey
# relativ... | OpenMined/PySyft | packages/syft/src/syft/lib/misc/__init__.py | Python | apache-2.0 | 6,217 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Gouthaman Balaraman
#
# 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... | anyman/luigi | luigi/contrib/sqla.py | Python | apache-2.0 | 15,647 |
"""Termwise semantic similarity"""
| tanghaibao/goatools | goatools/semsim/termwise/__init__.py | Python | bsd-2-clause | 35 |
import optparse
parser = optparse.OptionParser()
parser.add_option('-d', dest='default_tests',
action='store_true', default=None)
if __name__ == '__main__':
from wsgitest.run import run_tests
options, files = parser.parse_args()
if not files:
if options.default_tests is None:
... | jonashaag/WSGITest | wsgitest.py | Python | bsd-2-clause | 536 |
""" Implementaiton of a population for maintaining a GA population and
proposing structures to pair. """
from random import randrange, random
from math import tanh, sqrt, exp
from operator import itemgetter
import numpy as np
from ase.db.core import now
def count_looks_like(a, all_cand, comp):
"""Utility method ... | suttond/MODOI | ase/ga/population.py | Python | lgpl-3.0 | 15,749 |
import pytest
from os import path as os_path
from cfme.login import login
from utils import version
from utils.appliance import ApplianceException
from utils.blockers import BZ
from utils.conf import cfme_data
from utils.log import logger
def pytest_generate_tests(metafunc):
argnames, argvalues, idlist = ['db_ur... | rlbabyuk/integration_tests | cfme/tests/test_db_migrate.py | Python | gpl-2.0 | 5,344 |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
""" Authentication, Authorization, Accouting
@requires: U{B{I{gluon}} <http://web2py.com>}
@copyright: (c) 2010-2015 Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this softw... | bobrock/eden | modules/s3/s3aaa.py | Python | mit | 358,316 |
#!/usr/bin/env python
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import logging
import subprocess
import platform
import time
def ShouldStartXvfb():
return platform.system() == 'Linux'
... | mrtnrdl/.macdots | scripts/bin/platform-tools/systrace/catapult/common/py_utils/py_utils/xvfb.py | Python | unlicense | 828 |
import os
import twisted
import six
from twisted.trial import unittest
from twisted.protocols.policies import WrappingFactory
from twisted.python.filepath import FilePath
from twisted.internet import reactor, defer, error
from twisted.web import server, static, util, resource
from twisted.web.test.test_webclient impor... | agreen/scrapy | tests/test_downloader_handlers.py | Python | bsd-3-clause | 25,048 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-09-19 17:39
from __future__ import unicode_literals
import applications.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0001_initial'),
]
operations = [
... | hackerspace-ntnu/website | applications/migrations/0002_auto_20160919_1939.py | Python | mit | 826 |
# coding: utf-8
f = open("Sentiment140-Lexicon-v0.1/unigrams-pmilexicon.txt","r")
unigrams = dict()
for line in f:
word,score,poscount,negcount = line.rstrip().split("\t")
unigrams[word] = score
f.close()
# len(unigrams)
f = open("Sentiment140-Lexicon-v0.1/bigrams-pmilexicon.txt","r")
bigrams = dict()
for line... | TransientObject/labMTComparison | labMT-simple/labMTsimple/data/NRC/load_NRC.py | Python | apache-2.0 | 1,238 |
"""
Tools to read and write georeferenced pointclouds such as output from Pix4D,
based on the plyfile module.
"""
import collections
import itertools
import json
import tempfile
import warnings
import numpy as np
import plyfile
UTM_COORD = collections.namedtuple(
'UTMCoord', ['easting', 'northing', 'zone', 'nor... | Zac-HD/3D-tools | src/geoply.py | Python | gpl-3.0 | 8,980 |
class Solution(object):
def romanToInt(self, s):
"""
:type s: str
:rtype: int
"""
# the special is 1,4,5,9
roman_map={"M":1000,"CM":900,"D":500,"CD":400,"C":100,"XC":90,"L":50,"XL":40,"X":10,"IX":9,"V":5,"IV":4,"I":1}
n=len(s)
if n==0:
... | Tanych/CodeTracking | 13-Roman-to-Integer/solution.py | Python | mit | 692 |
def ans():
return sum(
x for
x in range(1000) if
x % 3 == 0 or x % 5 == 0
)
if __name__ == '__main__':
print(ans())
| mackorone/euler | src/001.py | Python | mit | 154 |
#!/usr/bin/env python3
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "serveurlibre.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| frafra/serveurlibre | manage.py | Python | lgpl-3.0 | 256 |
'''
Script to send FireEye alerts saved as json files to FireStic for testing.
Option to send a single file or to read a directory and send all .json files.
'''
import requests
import json
import sys
import getopt
import glob
import time
# parameters
# -f --file = a specific json file to send
# -d --dir = all the js... | SergeyBondarenko/FireStic | testing/fstest.py | Python | mit | 3,365 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import collections
import os
import posixpath
import six
import tarfile
from .buffer import DockerStringBuffer
from .. import DEFAULT_BASEIMAGE
def prepare_path(path, replace_space, replace_sep, expandvars, expanduser):
"""
Perform... | merll/docker-map | dockermap/build/dockerfile.py | Python | mit | 19,295 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
This figure is meant to represent an event-type with Faces presented
at times [0,4,8,12,16] and Objects presented at [2,6,10,14,18].
There are two values for Y: one for 'Face' and one for 'Object'
"""
... | bthirion/nipy | doc/users/plots/event.py | Python | bsd-3-clause | 649 |
# We can re- instantize and object using the __init__ method explicitly
class a:
def __init__(self,x,y):
self.x = x
self.y = y
if __name__=="main":
main()
# abc = a(1,2)
# abc.x returns 1
# abc.y return 2
# if we do somethig like abc.__init__(122,123)
# it works perfectly fine
# i know that ... | PankeshGupta/pynotes | reinit.py | Python | mit | 411 |
#!/usr/bin/env python
import getopt, sys, re, urllib2, urllib, BaseHTTPServer
from urllib2 import Request, urlopen, URLError, HTTPError
################## HEADER ###################################
#
# Traceroute-like HTTP scanner
# Using the "Max-Forwards" header
# RFC 2616 - HTTP/1.1 - Section 14.31
# RFC 3261 - S... | sharad1126/owtf | tools/discovery/web/traceroute/HTTP-Traceroute.py | Python | bsd-3-clause | 8,095 |
# Screen dimentions
import threading
X_MAX = 320
Y_MAX = 240
OFFSET = 30
# TFT configuration
DC = 18
RST = 23
SPI_PORT = 0
SPI_DEVICE = 0
# for PIL
import Image, ImageFont, ImageDraw, textwrap, os
# TFT libraries
import Adafruit_ILI9341 as TFT
import Adafruit_GPIO as GPIO
import Adafruit_GPIO.SPI as SPI
class Lc... | andrewderekjackson/python_lcd_menu | lcd.py | Python | mit | 3,241 |
import urllib2
import contextlib
# based on http://codereview.stackexchange.com/questions/23364/get-metadata-from-an-icecast-radio-stream
def parse_headers(response):
headers = {}
while True:
line = response.readline()
if line == '\r\n':
break # end of headers
if ':' in li... | ebu/radiodns-plugit | RadioDns-PlugIt/channels/webstreamutils.py | Python | bsd-3-clause | 1,103 |
import discord
import asyncio
import json
import logging
import sys
import commands
print(sys.version)
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname... | SpiderNight/Aeos | UniChan/unichan.py | Python | mit | 1,336 |
_DEFAULT_ALPHABET = 'acgturykmswbdhvnx-'
class _FastaEntry:
def __init__(self, position):
self.position = position
self.length = 0
def __str__(self):
return '({0},{1})'.format(self.position, self.length)
class FastaReader:
"""
Implementation of a reader of FASTA files.
"... | jade-cheng/Jocx | src/ziphmm/_fasta_reader.py | Python | gpl-2.0 | 5,277 |
from setuptools import setup, find_packages
setup(
name="workflowy.automation",
packages=find_packages(),
author="Luke Merrett",
description="Scripts for automating Workflowy tasks using Selenium",
license="MIT",
url="https://github.com/lukemerrett/Workflowy-Automation",
install_requires=['... | lukemerrett/Workflowy-Automation | setup.py | Python | mit | 333 |
import synapse.tests.utils as s_t_utils
import synapse.tools.cryo.list as s_cryolist
class CryoListTest(s_t_utils.SynTest):
async def test_cryolist(self):
async with self.getTestCryo() as cryo:
items = [(None, {'key': i}) for i in range(20)]
tank = await cryo.init('hehe')
... | vertexproject/synapse | synapse/tests/test_tools_cryo_list.py | Python | apache-2.0 | 671 |
import json
import urllib
from sqlalchemy import and_
from bottle import response, jinja2_template
from db.orm import Files, Hosts
from controllers.helpers import data_strap
from findex_common.utils import ArgValidate
from findex_common.bytes2human import bytes2human
class Documentation():
def __init__(self, cf... | iksteen/findex-gui | controllers/views/documentation.py | Python | mit | 518 |
class Register:
@property
def value(self):
raise NotImplementedError
@value.setter
def value(self, value):
raise NotImplementedError
| Hexadorsimal/pynes | nes/processors/registers/register.py | Python | mit | 166 |
#!/usr/bin/env python
"""
================================================
ABElectronics ServoPi 16-Channel PWM Servo Driver
Requires smbus2 or python smbus to be installed
================================================
"""
try:
from smbus2 import SMBus
except ImportError:
try:
from smbus import SMB... | abelectronicsuk/ABElectronics_Python_Libraries | ServoPi/ServoPi.py | Python | gpl-2.0 | 25,007 |
import json
import os
import avasdk
from zipfile import ZipFile, BadZipFile
from avasdk.plugins.manifest import validate_manifest
from avasdk.plugins.hasher import hash_plugin
from django import forms
from django.core.validators import ValidationError
from .validators import ZipArchiveValidator
class PluginArchive... | ava-project/ava-website | website/apps/plugins/forms.py | Python | mit | 2,440 |
"""
This script shows how to get all tickets for a project and write ticket
data to a CSV file. For each ticket, the CSV also includes the initial ticket note.
The username and key are saved in an INI file in ~/.codebase_secrets.ini:
[api]
username = example/alice
key = 123abc456def789ghi
Use the script ... | davidwtbuxton/pycodebase | docs/examples/export_tickets_with_notes.py | Python | mit | 1,521 |
#!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# 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
# ... | bukepo/openthread | tests/scripts/thread-cert/network_layer.py | Python | bsd-3-clause | 8,406 |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2012 Jens Hoffmann (hoffmaje)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
url(r'^$', 'layla.main.views.home'),
url(r'^login/$', 'dja... | hoffmaje/layla | layla/main/urls.py | Python | agpl-3.0 | 413 |
import pkg_resources
__version__ = pkg_resources.get_distribution("pinax-testimonials").version
| pinax/pinax-testimonials | pinax/testimonials/__init__.py | Python | mit | 97 |
# -*- encoding: utf-8 -*-
"""
Reference: https://dev.twitch.tv/docs/api/reference
Copyright (C) 2016-2019 script.module.python.twitch
This file is part of script.module.python.twitch
SPDX-License-Identifier: GPL-3.0-only
See LICENSES/GPL-3.0-only for more information.
"""
from ... import keys
fr... | MrSprigster/script.module.python.twitch | resources/lib/twitch/api/helix/streams.py | Python | gpl-3.0 | 3,132 |
"""
Responsible for rendering the main in game menu.
"""
import tcod as libtcod
import CreatureRogue.settings as settings
class GameMenuRenderer:
width = 30
height = settings.SCREEN_HEIGHT
def __init__(self, game):
self.game = game
self.console = libtcod.console_new(GameMenuRende... | DaveTCode/CreatureRogue | CreatureRogue/renderer/game_menu_renderer.py | Python | mit | 1,565 |
# 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... | alshedivat/tensorflow | tensorflow/python/kernel_tests/linalg/linear_operator_full_matrix_test.py | Python | apache-2.0 | 8,081 |
# Copyright (c) 2011 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 ... | mmasaki/trove | trove/guestagent/dbaas.py | Python | apache-2.0 | 3,294 |
import tests.periodicities.period_test as per
per.buildModel((5 , 'W' , 1600));
| antoinecarme/pyaf | tests/periodicities/Week/Cycle_Week_1600_W_5.py | Python | bsd-3-clause | 82 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# termineter/modules/get_info.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, t... | securestate/termineter | lib/termineter/modules/get_info.py | Python | bsd-3-clause | 4,124 |
#!/usr/bin/python
from django.conf import settings
from django.conf.urls import url, include
from django.conf.urls.static import static
from game import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
app_name = 'game'
router = DefaultRouter()
router.register(... | casparluc/VikingDoom | game/urls.py | Python | gpl-3.0 | 1,261 |
import numpy as np
import pandas as pd
from pyspark.sql import SparkSession
from pyspark.ml.linalg import Vectors
from pyspark.ml.regression import LinearRegression
def generate_data():
np.random.seed(1) # set the seed
x = np.arange(100)
error = np.random.normal(0, size=(100,))
y = 0.5 + 0.3 * x + er... | datitran/PySpark-App-CF | linear_regression.py | Python | mit | 1,254 |
import numpy as np
import matplotlib.pyplot as pl
import Image
import scipy.signal as sg
#some variable initializations
#resolution of gabor filter
resolution = 1.
#size of gabor filter
gsize = 30
#Number of gabor filter orientations with cosine in the gabor bank
N_Greal = 8
#Number of gabor filter orientations with ... | shiina/invariant-object-recognition | gabor.py | Python | lgpl-3.0 | 4,221 |
import os
import astrodash
directoryPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../templates/OzDES_data/')
atels = [
('ATEL_9504_Run24/DES16E1de_E1_combined_160825_v10_b00.dat', 0.292),
('ATEL_9504_Run24/DES16E2dd_E2_combined_160826_v10_b00.dat', 0.0746),
('ATEL_9504_Run24/DES16X3km_X... | daniel-muthukrishna/DASH | astrodash/classify_OzDES_ATELs.py | Python | mit | 5,978 |
from __future__ import absolute_import
from __future__ import print_function
import datetime
from boto.s3.key import Key
from boto.s3.connection import S3Connection
from django.conf import settings
from django.db import connection
from django.forms.models import model_to_dict
from django.utils.timezone import make_awar... | jrowan/zulip | zerver/lib/export.py | Python | apache-2.0 | 62,244 |
import direct.directbase.DirectStart
from pandac.PandaModules import *
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from random import random
from direct.showbase.DirectObject import DirectObject
from direct.interval.MetaInterval import Sequence
import random,math,sys,os
from direct.t... | davidnarciso/PyGorillas | Projectile.py | Python | mit | 6,696 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.