text stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 231 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k | score float64 0 0.34 |
|---|---|---|---|---|---|---|
from io import StringIO
from pathlib import Path
from cwltool.main import main
from .util import get_data
def test_empty_input(tmp_path: Path) -> None:
"""Affirm that an empty input works."""
empty_json = "{}"
empty_input = StringIO(empty_json)
params = [
"--outdir",
str(tmp_path),
... | common-workflow-language/cwltool | tests/test_empty_input.py | Python | apache-2.0 | 513 | 0 |
""" Extend suppliers table with new fields (to be initially populated from declaration data)
Revision ID: 940
Revises: 930
Create Date: 2017-08-16 16:39:00.000000
"""
# revision identifiers, used by Alembic.
revision = '940'
down_revision = '930'
from alembic import op
import sqlalchemy as sa
def upgrade():
o... | alphagov/digitalmarketplace-api | migrations/versions/940_more_supplier_details.py | Python | mit | 1,372 | 0.007289 |
"""
This file is for biased simulation for alanine dipeptide only, it is used as the test for
more general file biased_simulation_general.py, which could be easily extend to other new
systems.
"""
from ANN_simulation import *
from simtk.openmm.app import *
from simtk.openmm import *
from simtk.unit import *
from sys i... | weiHelloWorld/accelerated_sampling_with_autoencoder | MD_simulation_on_alanine_dipeptide/current_work/src/biased_simulation.py | Python | mit | 16,759 | 0.007101 |
import socket, re, sys
from codecs import encode, decode
from . import shared
def get_whois_raw(domain, server="", previous=None, rfc3490=True, never_cut=False, with_server_list=False, server_list=None):
previous = previous or []
server_list = server_list or []
# Sometimes IANA simply won't give us the right root W... | goocarlos/domaindiscoverer | pythonwhois/net.py | Python | apache-2.0 | 4,072 | 0.030452 |
# -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation;... | EUDAT-B2SHARE/invenio-old | modules/websearch/lib/search_engine.py | Python | gpl-2.0 | 314,285 | 0.007118 |
##############################################################################
# Copyright (c) 2013-2017, 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... | TheTimmy/spack | lib/spack/external/__init__.py | Python | lgpl-2.1 | 2,139 | 0 |
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Q
from django.template.loader import render_to_string
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext as _
from django.utils.translation import ugettex... | dimagi/commcare-hq | corehq/apps/reports/standard/users/reports.py | Python | bsd-3-clause | 10,221 | 0.00137 |
# Copyright 2014 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 agreed to in writing, s... | tseaver/google-cloud-python | datastore/tests/unit/test_client.py | Python | apache-2.0 | 44,363 | 0.000654 |
#!/usr/bin/env python
import pickle
import argparse
from pprint import pprint
description = """
print out run status from pickled Location object
"""
parser = argparse.ArgumentParser(description=description)
parser.add_argument('pickle', type=argparse.FileType('r'), help='path to location pickle')
args = parser.p... | sostenibilidad-unam/sleuth_automation | bin/status.py | Python | gpl-3.0 | 373 | 0.005362 |
# Copyright (c) 2013 Red Hat 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 writi... | tellesnobrega/storm_plugin | sahara/tests/unit/service/validation/edp/test_job_executor_java.py | Python | apache-2.0 | 2,252 | 0 |
# ####################### BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All ... | insiderr/insiderr-app | app/modules/requests/packages/chardet/mbcharsetprober.py | Python | gpl-3.0 | 3,269 | 0.000306 |
from django.conf.urls import url
from . import views
app_name = 'revisions'
urlpatterns = [
url(r'^revision/$', views.RevisionView.as_view(), name = 'revision'),
url(r'^mail/$', views.MailView.as_view(), name = 'mail'),
]
| pelgoros/kwyjibo | revisions/urls.py | Python | gpl-3.0 | 232 | 0.017241 |
# -*- coding: utf-8 -*-
"""Single-dipole functions and classes."""
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Eric Larson <larson.eric.d@gmail.com>
#
# License: Simplified BSD
from copy import deepcopy
import functools
from functools import partial
import re
import numpy as np
from .cov ... | kambysese/mne-python | mne/dipole.py | Python | bsd-3-clause | 57,802 | 0.000017 |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018, CRS4
#
# 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... | crs4/hl7apy | examples/iti_21/client.py | Python | mit | 1,870 | 0.004813 |
#
#
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Google 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... | badp/ganeti | lib/cmdlib/instance_operation.py | Python | gpl-2.0 | 17,072 | 0.007908 |
__all__ = ['ttypes', 'constants', 'PlayerStrategy']
| pezia/poker-croupier | player/py/lib/api/player_strategy/__init__.py | Python | gpl-2.0 | 52 | 0 |
##############################################################################
#
# Immobilier it's an application
# designed to manage the core business of property management, buildings,
# rental agreement and so on.
#
# Copyright (C) 2016-2018 Verpoorten Leïla
#
# This program is free software: you can... | verpoorten/immobilier | main/forms/suivi.py | Python | agpl-3.0 | 3,478 | 0.004037 |
# -*- coding: utf-8 -*-
"""
sphinx.quickstart
~~~~~~~~~~~~~~~~~
Quickly setup documentation source to work with Sphinx.
:copyright: 2008 by Georg Brandl.
:license: BSD.
"""
import sys, os, time
from os import path
from sphinx.util import make_filename
from sphinx.util.console import purple, bold... | creasyw/IMTAphy | documentation/doctools/tags/0.4.2/sphinx/quickstart.py | Python | gpl-2.0 | 15,064 | 0.001062 |
# Copyright 2015-2016 Internap.
#
# 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 writin... | internap/fake-switches | tests/cisco/test_cisco_switch_protocol.py | Python | apache-2.0 | 58,284 | 0.002316 |
# -*- coding: utf-8 -*-
import sys
import pytest
py3 = sys.version_info[0] >= 3
class DummyCollector(pytest.collect.File):
def collect(self):
return []
def pytest_pycollect_makemodule(path, parent):
bn = path.basename
if "py3" in bn and not py3 or ("py2" in bn and py3):
return DummyCol... | cloudera/hue | desktop/core/ext-py/pytest-4.6.11/doc/en/example/py2py3/conftest.py | Python | apache-2.0 | 348 | 0 |
# Copyright 2017 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... | dyoung418/tensorflow | tensorflow/python/estimator/export/export.py | Python | apache-2.0 | 14,219 | 0.005767 |
__author__ = 'thor'
import ut as ms
import pandas as pd
import ut.pcoll.order_conserving
from functools import reduce
class SquareMatrix(object):
def __init__(self, df, index_vars=None, sort=False):
if isinstance(df, SquareMatrix):
self = df.copy()
elif isinstance(df, pd.DataFrame):
... | thorwhalen/ut | daf/struct.py | Python | mit | 2,689 | 0.003719 |
from datetime import date, timedelta
INITIAL_OFFSET = timedelta(days=5)
class IntervalException(Exception):
"""
Exception to be raises when interval is behaving
weirdly - as not an interval
"""
def get_dates_for_timedelta(interval_delta, start=None, stop=None,
skip_weeke... | WebArchivCZ/Seeder | Seeder/harvests/scheduler.py | Python | mit | 1,219 | 0.00082 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import base64
import hashlib
import warnings
from io import BytesIO
from django.core.files.base import ContentFile
from django.utils import six
from easy_thumbnails import fields as easy_thumbnails_fields
from easy_thumbnails import files as easy_thumbnai... | jakob-o/django-filer | filer/fields/multistorage_file.py | Python | bsd-3-clause | 5,617 | 0.001068 |
import string
from random import choice
from django.contrib.auth.models import User
def get_random_id():
valid_id = False
test_name = 'EMPTY'
while valid_id is False:
s1 = ''.join([choice(string.ascii_uppercase) for i in range(2)])
s2 = ''.join([choice(string.digits) for i in range(8)])
... | pocketone/django-shoppy | shoppy/util/randomuserid.py | Python | bsd-3-clause | 499 | 0.012024 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | blancoamor/crm_rma_blancoamor | crm_rma_blancoamor.py | Python | agpl-3.0 | 14,539 | 0.008941 |
##############################################################################
# Copyright (c) 2017, Los Alamos National Security, LLC
# Produced at the Los Alamos National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, ... | krafczyk/spack | var/spack/repos/builtin/packages/flang/package.py | Python | lgpl-2.1 | 3,969 | 0.000756 |
"""A WSGI application that simply serves up files from the file system.
.. warning::
This is an early version of this module. It has no tests, limited
documentation, and is subject to major changes.
Configuration Options::
[wsgi_fs]
call = brim.wsgi_fs.WSGIFS
# path = <path>
# The request ... | gholt/python-brim | brim/wsgi_fs.py | Python | apache-2.0 | 9,657 | 0.000518 |
# Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2013 IBM Corp.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you... | vmthunder/nova | nova/network/api.py | Python | apache-2.0 | 23,489 | 0.000341 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013 The Plaso Project Authors.
# Please see the AUTHORS file for details on individual 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 L... | iwm911/plaso | plaso/analysis/browser_search.py | Python | apache-2.0 | 6,727 | 0.008771 |
import numpy as np
import pandas as pd
from lazy_property import LazyProperty
from . import _describe_template
from .plot import Plotter
from .. import bin_counts
from .. import numeric_datatypes, _pretty_print
from ..util import seaborn_required
class Column(object):
"""
In Pandas, a column of a DataFrame i... | jackmaney/pg-utils | pg_utils/column/base.py | Python | mit | 10,187 | 0.002945 |
import re
from calendar import monthrange
import datetime
class Card(object):
"""
A credit card that may be valid or invalid.
"""
# A regexp for matching non-digit values
non_digit_regexp = re.compile(r'\D')
# A mapping from common credit card brands to their number regexps
BRAND_VISA = '... | orokusaki/pycard | pycard/card.py | Python | mit | 7,293 | 0 |
# Copyright 2017 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... | nburn42/tensorflow | tensorflow/contrib/autograph/pyct/parser_test.py | Python | apache-2.0 | 1,514 | 0.003303 |
#!usr/bin/python
#Gmail Brute Forcer
#To use this script you need ClientCookie and Client Form.
#http://wwwsearch.sourceforge.net/ClientCookie/src/ClientCookie-1.0.3.tar.gz
#http://wwwsearch.sourceforge.net/ClientForm/src/ClientForm-0.1.17.tar.gz
#To install the package, run the following command:
#python setup.py buil... | knightmare2600/d4rkc0de | bruteforce/gmailbrute.py | Python | gpl-2.0 | 2,738 | 0.039445 |
#Aditya Joshi
#Enumerating Oriented Gene Ordering
from itertools import permutations,product
from math import fabs
n = int(raw_input())
def make_set(n):
set = []
for x in range(1,n+1):
set += [x]
return set
def plusAndMinusPermutations(items):
for p in permutations(items,len(i... | adijo/rosalind | old/gene_enumerations.py | Python | gpl-2.0 | 682 | 0.014663 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~... | bmi-forum/bmi-pyre | pythia-0.8/packages/pyre/pyre/units/force.py | Python | gpl-2.0 | 545 | 0 |
from .base import *
import dj_database_url
if os.environ.get('DEBUG') == 'False':
DEBUG = False
else:
DEBUG = True
try:
from .local import *
except ImportError:
pass
ALLOWED_HOSTS = ['*']
DATABASES = {'default': dj_database_url.config()}
SOCIAL_AUTH_YAMMER_KEY = os.environ.get('SOCIAL_AUTH_YAMMER... | kave/Face-Off | face-off/settings/production.py | Python | cc0-1.0 | 866 | 0.001155 |
import datetime
import logging
from functools import reduce
from flask_babelpkg import lazy_gettext
from .filters import Filters
log = logging.getLogger(__name__)
class BaseInterface(object):
"""
Base class for all data model interfaces.
Sub class it to implement your own interface for some data ... | rpiotti/Flask-AppBuilder | flask_appbuilder/models/base.py | Python | bsd-3-clause | 7,479 | 0.00107 |
"""
@file sumoConfigGen.py
@author Craig Rafter
@date 29/01/2016
Code to generate a config file for a SUMO model.
"""
def sumoConfigGen(modelname='simpleT', configFile='./models/simpleT.sumocfg',
exportPath='../', AVratio=0, stepSize=0.01,
run=0, port=8813):
configXML ... | cbrafter/CrowdTLL | generalCode/sumoConfigGen.py | Python | gpl-3.0 | 1,642 | 0.001827 |
from __future__ import absolute_import
from base64 import b64encode
from ..packages.six import b
ACCEPT_ENCODING = 'gzip,deflate'
def make_headers(keep_alive=None, accept_encoding=None, user_agent=None,
basic_auth=None, proxy_basic_auth=None, disable_cache=None):
"""
Shortcuts for generatin... | la0rg/Genum | GenumCore/vendor/urllib3/util/request.py | Python | mit | 2,180 | 0.000917 |
'''
Problem 2
@author: Kevin Ji
'''
def sum_even_fibonacci( max_value ):
# Initial two elements
prev_term = 1
cur_term = 2
temp_sum = 2
while cur_term < max_value:
next_term = prev_term + cur_term
prev_term = cur_term
cur_term = next_term
if cur_term ... | mc10/project-euler | problem_2.py | Python | mit | 430 | 0.025701 |
"""Test Hue setup process."""
from unittest.mock import Mock
import pytest
from homeassistant import config_entries
from homeassistant.components import hue
from homeassistant.setup import async_setup_component
from tests.async_mock import AsyncMock, patch
from tests.common import MockConfigEntry
@pytest.fixture
d... | titilambert/home-assistant | tests/components/hue/test_init.py | Python | apache-2.0 | 8,339 | 0.00024 |
from django.views.generic.detail import DetailView
from django.shortcuts import render, redirect
from django.http import Http404
from aspc.folio.models import Page
class AttachedPageMixin(object):
def get_page(self):
try:
return Page.objects.get(slug=self.page_slug)
except Page.DoesNotE... | aspc/mainsite | aspc/folio/views.py | Python | mit | 1,132 | 0.007951 |
# Copyright 2013 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 requ... | shakamunyi/nova | nova/api/openstack/compute/plugins/v3/tenant_networks.py | Python | apache-2.0 | 8,183 | 0.000122 |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | tensorflow/graphics | tensorflow_graphics/geometry/__init__.py | Python | apache-2.0 | 1,274 | 0.005495 |
#!/bin/python2
# Script that replies to username mentions.
import time
import os
import cPickle
import sys
import traceback
import numpy
import sys
from PIL import Image
from urlparse import urlparse
import gabenizer
IMG = "http://i.4cdn.org/r9k/1463377581531.jpg"
def main():
image = gabenizer.process_... | rafa1231518/CommunityBot | plugins/gabenizer/mentions.py | Python | gpl-3.0 | 499 | 0.02004 |
# 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... | eaplatanios/tensorflow | tensorflow/python/ops/sparse_ops.py | Python | apache-2.0 | 82,052 | 0.002803 |
r"""OS routines for Mac, NT, or Posix depending on what system we're on.
This exports:
- all functions from posix, nt, os2, or ce, e.g. unlink, stat, etc.
- os.path is one of the modules posixpath, or ntpath
- os.name is 'posix', 'nt', 'os2', 'ce' or 'riscos'
- os.curdir is a string representing the current di... | MicroTrustRepos/microkernel | src/l4/pkg/python/contrib/Lib/os.py | Python | gpl-2.0 | 26,337 | 0.003038 |
# Copyright 2014 Red Hat, 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 ag... | ChinaMassClouds/copenstack-server | openstack/src/nova-2014.2/nova/objects/agent.py | Python | gpl-2.0 | 2,828 | 0 |
"""Describe the language syntax."""
import re
class Symbol:
"""Describes the language symbols."""
# General pattern of formulas
pattern = '([a-z0-9&\-\|><\(\)]*)'
accepted_chars = '([a-z0-9&\-\|><\(\)]*)'
def __init__(self, value):
"""Init a propositional symbol."""
self.value =... | italopaiva/propositional-logic | lp/syntax.py | Python | mit | 7,307 | 0.002874 |
# -*- coding: utf-8 -*-
'''
Created on Apr 27, 2016
@author: Aaron Ponti
'''
from ch.systemsx.cisd.openbis.dss.etl.dto.api.impl import MaximumIntensityProjectionGenerationAlgorithm
class GenericTIFFSeriesMaximumIntensityProjectionGenerationAlgorithm(MaximumIntensityProjectionGenerationAlgorithm):
'''
Custo... | aarpon/obit_microscopy_core_technology | core-plugins/microscopy/3/dss/drop-boxes/MicroscopyDropbox/GenericTIFFSeriesMaximumIntensityProjectionGenerationAlgorithm.py | Python | apache-2.0 | 1,343 | 0.005957 |
'''
Created on 17/2/2015
@author: PC06
Primer cambio en el proyecto
'''
from include import app
if __name__ == '__main__':
app.run("127.0.0.1", 9000, debug=True) | javiteri/reposdmpdos | miltonvz/run.py | Python | gpl-2.0 | 176 | 0.005682 |
"""Translation helper functions."""
import locale
import os
import re
import sys
import gettext as gettext_module
from cStringIO import StringIO
from django.utils.importlib import import_module
from django.utils.safestring import mark_safe, SafeData
from django.utils.thread_support import currentThread
... | greggian/TapdIn | django/utils/translation/trans_real.py | Python | apache-2.0 | 20,192 | 0.00213 |
def get_file_extension(filename):
return filename.split(".")[-1]
| finiteloopsoftware/django-compressor | compress/utils.py | Python | bsd-3-clause | 69 | 0 |
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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 r... | openstack/designate | designate/schema/__init__.py | Python | apache-2.0 | 3,897 | 0 |
# -*- coding: utf-8 -*-
"""
--------------------------------------------------------------------------
cvglmnet.m: cross-validation for glmnet
--------------------------------------------------------------------------
DESCRIPTION:
Does k-fold cross-validation for glmnet, produces a plot, and returns
a value ... | hanfang/glmnet_python | glmnet_python/cvglmnet.py | Python | gpl-2.0 | 14,450 | 0.010242 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###########################################################
# WARNING: Generated code! #
# ************************** #
# Manual changes may get lost if file is generated again. #
# Only code inside the [MANUAL] ta... | WalkingMachine/sara_behaviors | sara_flexbe_behaviors/src/sara_flexbe_behaviors/init_sequence_sm.py | Python | bsd-3-clause | 2,331 | 0.023595 |
import numpy as np
import matplotlib.pyplot as plt
from math import exp
size = 9
dt = 50.0 # ms
dt_2 = 550.0
# Vectors to fit
x_fit = np.zeros(size)
V_max_fit = np.zeros(size)
V0_fit = np.zeros(size)
# Paramters of the model
tau_rec = 1000.0 # ms
tau_mem = 32.0 # ms
tau_in = 1.8 # ms
A = 144.0
u = 0.26
# First ... | h-mayorquin/g_node_data_analysis_205 | 1_day/fit_data.py | Python | bsd-2-clause | 1,957 | 0.001533 |
try:
from tornado.websocket import WebSocketHandler
import tornado.ioloop
tornadoAvailable = True
except ImportError:
class WebSocketHandler(object): pass
tornadoAvailable = False
from json import loads as fromJS, dumps as toJS
from threading import Thread
from Log import console
import Settings
from utils impor... | mrozekma/Sprint | WebSocket.py | Python | mit | 3,192 | 0.030075 |
#
# Turn off logging in extensions (too loud!)
import vb2py.extensions
vb2py.extensions.disableLogging()
from vb2py.vbparser import buildParseTree, VBParserError
#
# Set some config options which are appropriate for testing
import vb2py.config
Config = vb2py.config.VB2PYConfig()
Config.setLocalOveride("General", "Rep... | reingart/vb2py | vb2py/test/testparser.py | Python | gpl-3.0 | 41,055 | 0.003898 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | taxpon/sverchok | old_nodes/matrix_in.py | Python | gpl-3.0 | 2,720 | 0.003309 |
import html
import inflect
import titlecase
from flask import url_for
from shared.pd_exception import DoesNotExistException
from .. import APP, importing
from ..data import match
from ..view import View
@APP.route('/match/<int:match_id>/')
def show_match(match_id: int) -> str:
view = Match(match.get_match(matc... | PennyDreadfulMTG/Penny-Dreadful-Discord-Bot | logsite/views/match_view.py | Python | gpl-3.0 | 2,353 | 0.002125 |
# -*- coding: utf-8 -*
PROVINCE_CHOICES = (
('AG', 'Agrigento'),
('AL', 'Alessandria'),
('AN', 'Ancona'),
('AO', 'Aosta'),
('AR', 'Arezzo'),
('AP', 'Ascoli Piceno'),
('AT', 'Asti'),
('AV', 'Avellino'),
('BA', 'Bari'),
# ('BT', 'Barletta-Andria-Trani'), # active starting from 2009... | jonaustin/advisoryscan | django/django/contrib/localflavor/it/it_province.py | Python | mit | 2,747 | 0.001458 |
#
# 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
# ... | openstack/heat | heat/engine/resources/openstack/trove/instance.py | Python | apache-2.0 | 29,344 | 0 |
#!/usr/bin/python
import re
import csv
import os
import json
def read_csv(fn):
results = {}
with open(fn, 'rb') as csvfile:
rows = csv.reader(csvfile, delimiter=',')
for row in rows:
m = re.search('Total Transactions', row[1])
if len(row) == 7 and m:
tem... | franklingu/Cassandra-benchmarking | benchmarking/sum_up.py | Python | mit | 1,889 | 0.004764 |
# Copyright (C) 2017,2019, Yu Sheng Lin, johnjohnlys@media.ee.ntu.edu.tw
# This file is part of Nicotb.
# Nicotb 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... | johnjohnlin/nicotb | lib/event.py | Python | gpl-3.0 | 1,550 | 0.013548 |
#
# This file is part of CasADi.
#
# CasADi -- A symbolic framework for dynamic optimization.
# Copyright (C) 2010 by Joel Andersson, Moritz Diehl, K.U.Leuven. All rights reserved.
#
# CasADi is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Pub... | jgillis/casadi | experimental/joel/vdp/vdp.py | Python | lgpl-3.0 | 5,909 | 0.019293 |
"""empty message
Revision ID: 4fe34588268f
Revises: 26dba2ff3e74
Create Date: 2014-12-09 01:41:24.333058
"""
# revision identifiers, used by Alembic.
revision = '4fe34588268f'
down_revision = '26dba2ff3e74'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | sandeep6189/Pmp-Webapp | migrations/versions/4fe34588268f_.py | Python | bsd-3-clause | 506 | 0.011858 |
import os
from g import config_dir, templates_dir, DEFAULT_GID, DEFAULT_UID
from utils.misc import prepare_dir
from utils.jinja import render_jinja
registryctl_config_dir = os.path.join(config_dir, "registryctl")
registryctl_config_template_path = os.path.join(templates_dir, "registryctl", "config.yml.jinja")
registr... | wy65701436/harbor | make/photon/prepare/utils/registry_ctl.py | Python | apache-2.0 | 1,152 | 0.002604 |
import time
import test_rnd as rnd
import random
import pysos
# initialize the data
N = 1234
items = [(rnd.utf8(20), rnd.utf8(200)) for i in range(N)]
start = time.time()
db = pysos.Dict('temp/sos_dict')
#import shelve
#db = shelve.open('temp.shelve')
print("%.2fs: %d items loaded" % (time.time() - start, len(db)... | dagnelies/pysos | test_dict.py | Python | apache-2.0 | 1,567 | 0.007658 |
import sys
import argparse
import pickle
def read_index(pickleFile):
pickleFile = open(pickleFile, 'rb')
index = pickle.load(pickleFile)
return index
def main(args):
wordIndex = read_index('indice.pickle')
docIndex = read_index('indice_doc.pickle')
wordList = args.palabras
for word in wo... | chrisRubiano/TAP | indexing/buscar.py | Python | gpl-3.0 | 633 | 0.00158 |
"""
A component which allows you to send data to Dweet.io.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/dweet/
"""
import logging
from datetime import timedelta
import voluptuous as vol
from homeassistant.const import EVENT_STATE_CHANGED, STATE_UNKNO... | mikaelboman/home-assistant | homeassistant/components/dweet.py | Python | mit | 1,961 | 0 |
# Copyright (c) 2013 Che-Liang Chiou
import os
import re
from SCons.Script import Dir
class Label(object):
VALID_NAME = re.compile(r'^[A-Za-z0-9_.\-/]+$')
@classmethod
def make_label(cls, label_str):
package_str = None
target_str = None
if not isinstance(label_str, str):
... | clchiou/scons_package | label.py | Python | mit | 4,231 | 0 |
"""Tests for user-friendly public interface to polynomial functions. """
from sympy.polys.polytools import (
Poly, PurePoly, poly,
parallel_poly_from_expr,
degree, degree_list,
LC, LM, LT,
pdiv, prem, pquo, pexquo,
div, rem, quo, exquo,
half_gcdex, gcdex, invert,
subresultants,
resu... | abloomston/sympy | sympy/polys/tests/test_polytools.py | Python | bsd-3-clause | 106,107 | 0.001301 |
# Copyright 2014 PerfKitBenchmarker 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 appli... | mateusz-blaszkowski/PerfKitBenchmarker | perfkitbenchmarker/linux_benchmarks/mysql_service_benchmark.py | Python | apache-2.0 | 33,031 | 0.004874 |
# Copyright 2008-2014 Nokia Solutions and Networks
#
# 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 l... | eric-stanley/robotframework | src/robot/libraries/Screenshot.py | Python | apache-2.0 | 13,020 | 0.000998 |
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
import time
import os
import subprocess
import csv
import StringIO
import iptc
HOSTS = 3
p1_log = open('logs-example/log.p1.txt', 'w')
p2_log... | ardhipoetra/SDN-workbench | sch3.py | Python | gpl-2.0 | 3,578 | 0.044159 |
'''
Created on 31st October , 2012
@author: Don Najd
'''
import logging
from naoutil.naoenv import NaoEnvironment, make_environment
from fluentnao.core.arms import Arms
from fluentnao.core.elbows import Elbows
from fluentnao.core.feet import Feet
from fluentnao.core.hands import Hands
from fluentnao.core.head import... | davesnowdon/nao-recorder | src/main/python/fluentnao/nao.py | Python | gpl-2.0 | 10,366 | 0.006946 |
import binascii
import os
import random
from django.db import models
from django.utils.encoding import force_text, python_2_unicode_compatible
from aesfield.field import AESField
from olympia.amo.fields import PositiveAutoField
from olympia.amo.models import ModelBase
from olympia.users.models import UserProfile
#... | aviarypl/mozilla-l10n-addons-server | src/olympia/api/models.py | Python | bsd-3-clause | 3,638 | 0 |
from tests.base_test import BaseTest
from tests import config
from core import modules
from core.sessions import SessionURL
from testfixtures import log_capture
from core import messages
import logging
import os
import subprocess
class FileBzip(BaseTest):
# Create and bzip2 binary files for the test
binstring... | epinna/weevely3 | tests/test_file_bzip2.py | Python | gpl-3.0 | 5,554 | 0.009903 |
# Copyright 2010-2017, The University of Melbourne
# Copyright 2010-2017, Brian May
#
# This file is part of Karaage.
#
# Karaage 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... | Karaage-Cluster/karaage | karaage/common/__init__.py | Python | gpl-3.0 | 5,700 | 0 |
#
# 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... | mistercrunch/airflow | tests/sensors/test_external_task_sensor.py | Python | apache-2.0 | 35,537 | 0.002561 |
# -*- coding: utf-8 -*-
from ccxt.async.base.exchange import Exchange
import hashlib
class bit2c (Exchange):
def describe(self):
return self.deep_extend(super(bit2c, self).describe(), {
'id': 'bit2c',
'name': 'Bit2C',
'countries': 'IL', # Israel
'rateLimi... | tritoanst/ccxt | python/ccxt/async/bit2c.py | Python | mit | 6,650 | 0.001353 |
import numpy as np
from ray.rllib.models.modelv2 import ModelV2
from ray.rllib.models.tf.misc import normc_initializer
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.torch.misc import SlimFC, normc_initializer as \
torch_normc_initializer
from ray.rllib.models.torch.torch_modelv2 import... | richardliaw/ray | rllib/examples/models/batch_norm_model.py | Python | apache-2.0 | 7,538 | 0 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Satpy developers
#
# This file is part of satpy.
#
# satpy is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or... | pytroll/satpy | satpy/modifiers/__init__.py | Python | gpl-3.0 | 1,328 | 0 |
#!/usr/bin/env python
#
# A library that provides a Python interface to the Telegram Bot API
# Copyright (C) 2015-2016
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
#... | franciscod/python-telegram-bot | telegram/inlinequeryresultcachedvideo.py | Python | gpl-2.0 | 2,181 | 0.001376 |
#!/usr/bin/python3
'''
Calculate posting schedules in social media of events and add them to google calendar
so they can be posted using IFTTT (so dirty!)
'''
# Google Developers Console:
# project name: tdf-eventos-gcalcli
# activate gcal API
# activate OAuth 2.0 API
# instal: pip3 install --upgra... | eikiu/tdf-actividades | _admin-scripts/tdf_gcal.py | Python | cc0-1.0 | 28,476 | 0.034032 |
#!/usr/bin/python
"""nrvr.util.ipaddress - Utilities regarding IP addresses
Class provided by this module is IPAddress.
Works in Linux and Windows.
Idea and first implementation - Leo Baschy <srguiwiz12 AT nrvr DOT com>
Contributor - Nora Baschy
Public repository - https://github.com/srguiwiz/nrvr-commander
Copy... | srguiwiz/nrvr-commander | src/nrvr/util/ipaddress.py | Python | bsd-2-clause | 7,449 | 0.003088 |
from flask import Flask, url_for, redirect, render_template, request
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import superadmin, login, wtf
from flask.ext.superadmin.contrib import sqlamodel
from wtforms.fields import TextField, PasswordField
from wtforms.validators import Required, ValidationError
... | syrusakbary/Flask-SuperAdmin | examples/auth/auth.py | Python | bsd-3-clause | 3,960 | 0.000253 |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from django.utils.translation import ugettext_lazy as _
from wiki.core.plugins import registry
from wiki.core.plugins.base import BasePlugin
from wiki.plugins.attachments import views
from wiki.plugins.attachments import models
from wiki.plugi... | GbalsaC/bitnamiP | django-wiki/wiki/plugins/attachments/wiki_plugin.py | Python | agpl-3.0 | 2,509 | 0.008768 |
from __future__ import absolute_import, unicode_literals
from case import Mock, patch
from amqp.five import text_t
from amqp.utils import (NullHandler, bytes_to_str, coro, get_errno, get_logger,
str_to_bytes)
class test_get_errno:
def test_has_attr(self):
exc = KeyError('foo')
... | pexip/os-python-amqp | t/unit/test_utils.py | Python | lgpl-2.1 | 2,126 | 0 |
from __future__ import absolute_import
from django.conf import settings
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import connection
from django.db.models import Q
from zerver.decorator import authenticated_api_view, authenticated_json_post_view, \
has_requ... | JanzTam/zulip | zerver/views/messages.py | Python | apache-2.0 | 36,656 | 0.003492 |
import pygame
from pygame.colordict import THECOLORS
import data
class Platform(pygame.sprite.Sprite):
def __init__(self, width, height):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface([width, height])
self.image.fill(THECOLORS["green"])
self.rect = self.image.g... | Sveder/pyweek24 | gamelib/platforms.py | Python | apache-2.0 | 537 | 0 |
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
# Copyright (C) 2014 Jesús Espino <jespinog@gmail.com>
# Copyright (C) 2014 David Barragán <bameda@dbarragan.com>
# This program 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 F... | obimod/taiga-back | taiga/timeline/signals.py | Python | agpl-3.0 | 6,716 | 0.003873 |
# 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 absolute_import, print_function
from distutils.spawn import find_executable
from distutils.versi... | sadmansk/servo | python/servo/bootstrap.py | Python | mpl-2.0 | 13,376 | 0.00157 |
from django import forms
from django.test import TestCase
from django.core.exceptions import NON_FIELD_ERRORS
from modeltests.validation import ValidationTestCase
from modeltests.validation.models import Author, Article, ModelToValidate
# Import other tests for this package.
from modeltests.validation.validators impor... | bufferapp/buffer-django-nonrel | tests/modeltests/validation/tests.py | Python | bsd-3-clause | 5,944 | 0.003197 |
import os
import sys as sys
os.system("python bot/bot.py engage")
import bot_response as bot
import bot_learn as learner
def hasUserSwore(message):
if "fuck" in message:
return True
elif "bitch" in message:
return True
elif "Fuck" in message:
re... | indie-dev/Clarissa | bot.py | Python | apache-2.0 | 2,985 | 0.022446 |
__author__ = 'thuy'
| cfe-lab/Umberjack | test/simulations/indelible/__init__.py | Python | bsd-2-clause | 20 | 0 |
# Copyright 2012 Jose Blanca, Peio Ziarsolo, COMAV-Univ. Politecnica Valencia
# This file is part of ngs_crumbs.
# ngs_crumbs 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, ... | JoseBlanca/ngs_crumbs | crumbs/seq/sff_extract.py | Python | gpl-3.0 | 7,004 | 0.000571 |
from django.conf.urls import url
from fundraiser_app import views
urlpatterns = [
url(r'^$', views.FMItemListView.as_view(), name='fmitem_list'),
url(r'^about/$', views.AboutView.as_view(), name='about'),
url(r'^fmitem/(?P<pk>\d+)$', views.FMItemDetailView.as_view(), name='fmitem_detail'),
url(r'^fmite... | CarlGraff/fundraisermemorial | fundraiser_app/urls.py | Python | mit | 663 | 0.006033 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.