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 |
|---|---|---|---|---|---|
import json
from time import sleep
from logger import logger
from perfrunner.helpers.cbmonitor import with_stats
from perfrunner.tests import PerfTest
class ViewTest(PerfTest):
"""
The test measures time it takes to build views. This is just a base
class, actual measurements happen in initial and increm... | mikewied/perfrunner | perfrunner/tests/view.py | Python | apache-2.0 | 5,397 |
#!/usr/bin/python2
#
# Copyright (C) 2014 FreeIPA Contributors see COPYING for license
#
from distutils.core import setup, Extension
from distutils.sysconfig import get_python_inc
import sys
import os
python_header = os.path.join(get_python_inc(plat_specific=0), 'Python.h')
if not os.path.exists(python_header):
... | cluck/freeipa | ipapython/ipap11helper/setup.py | Python | gpl-3.0 | 1,429 |
# Copyright 2014 Cisco Systems, 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 requir... | shakamunyi/neutron-vrrp | neutron/services/vpn/service_drivers/cisco_validator.py | Python | apache-2.0 | 4,893 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2010-2016 Eurotechnia (support@webcampak.com)
# This file is part of the Webcampak project.
# Webcampak 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, eit... | Webcampak/cli | webcampak/core/capture/drivers/wpakCaptureRtsp.py | Python | gpl-3.0 | 5,185 |
import random
import requests
import plugin
SPOOK_URL = "https://github.com/emacs-mirror/emacs/raw/master/etc/spook.lines"
class Nsa(plugin.Plugin):
"""Shows words from the spook file.
"""
def __init__(self, bot):
super(Nsa, self).__init__(bot)
self.words = self.init_words()
self... | nukeop/RelayBot2.0 | relaybot/plugins/nsa.py | Python | gpl-3.0 | 1,698 |
# XBMC modules
import xbmc
import xbmcaddon
import xbmcgui
# STANDARD library modules
import ast
import datetime
import imp
import json
import os
import pickle
import Queue
import select
import socket
import sys
import threading
import time
import traceback
from CompLogger import comprehensive_logger as clog
path ... | gezb/osmc | package/mediacenter-addon-osmc/src/service.osmc.settings/resources/lib/osmc_settingsGUI.py | Python | gpl-2.0 | 14,371 |
from channels.routing import route, include
from . import consumers
routing = [
route("websocket.connect", consumers.ws_home_c, path=r'^/home/'),
route("websocket.receive", consumers.ws_home, path=r'^/home/'),
route("websocket.disconnect", consumers.ws_home_d, path=r'^/home/'),
] | ryanrain2016/FreeEye | FreeEye/MainFrame/routings.py | Python | gpl-3.0 | 293 |
_base_ = './faster_rcnn_r50_caffe_fpn_mstrain_1x_coco.py'
# learning policy
lr_config = dict(step=[16, 23])
runner = dict(type='EpochBasedRunner', max_epochs=24)
| open-mmlab/mmdetection | configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_mstrain_2x_coco.py | Python | apache-2.0 | 162 |
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | StackStorm/st2 | contrib/runners/remote_runner/remote_runner/remote_command_runner.py | Python | apache-2.0 | 3,344 |
def rob(nums):
"""
problem: House Robber
source: https://leetcode.com/problems/house-robber/
"""
p1 = p2 = max_money = 0
for num in nums:
max_money = p2 if p2 > p1 + num else p1 + num
p1, p2 = p2, max_money
return max_money
def rob2(nums):
"""
problem: House Robber... | xq5he/leetcodepy | algorithms/house_robber.py | Python | mit | 1,642 |
#!/usr/bin/env python
"""
@author: Andrey Masiero
"""
import cv2
import numpy as np
import matplotlib.pyplot as plt
from os import listdir
from os.path import exists
from skimage import io
from PIL import Image
class Utils(object):
def __init__(self):
self.face_cascade = cv2.CascadeClassifier('/usr/local/share/... | amasiero/approach_control | approach_control_people/nodes/approach_control_people/faces/Utils.py | Python | gpl-2.0 | 1,374 |
def wrapper(dictinput, verbose=False):
"""Tpo level function to call either jwst, hst, wfirst
Top level function which calls either jwst, hst or wfirst noise simulation.
Parameters
----------
dictinput :
dictionary containing instrument parameters and exoplanet
specific ... | natashabatalha/PandExo | pandexo/engine/pandexo.py | Python | gpl-3.0 | 1,496 |
#!/usr/bin/env python
'''Outputs attachment point information and notes as XML file for TTFBuilder'''
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2015 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__... | moyogo/pysilfont | examples/FLWriteXml.py | Python | mit | 4,364 |
import time
import logging
from pathlib import Path
from typing import Tuple, cast
import wkw
from argparse import ArgumentParser, Namespace
from .utils import (
add_verbose_flag,
open_wkw,
open_knossos,
WkwDatasetInfo,
KnossosDatasetInfo,
ensure_wkw,
add_distribution_flags,
get_execut... | scalableminds/webknossos-cuber | wkcuber/convert_knossos.py | Python | agpl-3.0 | 3,503 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint: disable=no-self-use, pointless-statement, missing-docstring
| Toilal/rebulk | rebulk/test/__init__.py | Python | mit | 116 |
# Copyright 2019 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... | alexgorban/models | official/vision/detection/modeling/architecture/nn_ops.py | Python | apache-2.0 | 6,402 |
"""empty message
Revision ID: c2a7e6589552
Revises: 683ada20cd0d
Create Date: 2017-10-01 16:34:11.066121
"""
# revision identifiers, used by Alembic.
revision = 'c2a7e6589552'
down_revision = '683ada20cd0d'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | rohitdatta/pepper | migrations/versions/c2a7e6589552_.py | Python | agpl-3.0 | 720 |
"""ceda_cc
##########
Entry point for API.
USAGE
#####
c4_run.main( <argument list> )
"""
import sys
from ccinit import c4_init
testmain=False
## callout to summary.py: if this option is selected, imports of libraries are not needed.
if not testmain:
if __name__ == '__main__':
if len(sys.argv) > 1:
if sys.a... | martinjuckes/ceda_cc | ceda_cc/c4_run.py | Python | bsd-3-clause | 15,136 |
# -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks helper functions.
- Tests that CSV grade report generation works with unicode emails.
- Tests all of the existing reports.
"""
import os
import shutil
from datetime import datetime
import urllib
import ddt
from freezegun import fr... | synergeticsedx/deployment-wipro | lms/djangoapps/instructor_task/tests/test_tasks_helper.py | Python | agpl-3.0 | 99,406 |
"""Module provider for memset"""
import json
import logging
import requests
from lexicon.exceptions import AuthenticationError
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
NAMESERVER_DOMAINS = ["memset.com"]
def provider_parser(subparser):
"""Configure provi... | AnalogJ/lexicon | lexicon/providers/memset.py | Python | mit | 5,628 |
"""
This module contains the core classes of version 2.0 of SAX for Python.
This file provides only default classes with absolutely minimum
functionality, from which drivers and applications can be subclassed.
Many of these classes are empty and are included only as documentation
of the interfaces.
$Id$
"""
version ... | huran2014/huran.github.io | wot_gateway/usr/lib/python2.7/xml/sax/handler.py | Python | gpl-2.0 | 13,921 |
# Paperwork - Using OCR to grep dead trees the easy way
# Copyright (C) 2012-2014 Jerome Flesch
# Copyright (C) 2012 Sebastien Maccagnoni-Munch
#
# Paperwork 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 Soft... | mjourdan/paperwork | src/paperwork/frontend/mainwindow/__init__.py | Python | gpl-3.0 | 144,013 |
# #!/usr/bin/env python
# -*- coding: utf-8 -*-
# <lineup - python distributed pipeline framework>
# Copyright (C) <2013> Gabriel Falcão <gabriel@nacaolivre.org>
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to... | pombredanne/lineup | setup.py | Python | mit | 4,141 |
from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='base.html')),
# Examples:
#... | nehalm/NY-PY | prototype/prototype/prototype/urls.py | Python | mit | 671 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Revision.date'
db.add_column(u'parsr_revision', 'date',
... | frontendphil/analyzr | parsr/migrations/0045_auto__add_field_revision_date__add_field_revision_year__add_field_revi.py | Python | mit | 9,415 |
"""Setup system-specific platform environment for TensorFlow."""
from __future__ import absolute_import
from . import control_imports
if control_imports.USE_OSS:
from tensorflow.python.platform.default._init import *
else:
from tensorflow.python.platform.google._init import *
| liyu1990/tensorflow | tensorflow/python/platform/__init__.py | Python | apache-2.0 | 281 |
import unittest
import os
import logging
import re
import shutil
import datetime
import oeqa.utils.ftools as ftools
from oeqa.selftest.base import oeSelfTest
from oeqa.utils.commands import runCmd, bitbake, get_bb_var
from oeqa.utils.decorators import testcase
from oeqa.utils.network import get_free_port
class Bitbak... | schleichdi2/OPENNFR-6.1-CORE | opennfr-openembedded-core/meta/lib/oeqa/selftest/prservice.py | Python | gpl-2.0 | 5,821 |
# -*- coding: utf-8 -*-
# Django settings for dojopuzzles project.
DEBUG = False
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Renne Rocha', 'me@rennerocha.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
... | rennerocha/dojopuzzles | dojopuzzles/dojopuzzles/settings.py | Python | mit | 5,428 |
#-*-coding=utf-8-*-
import sys,math
reload(sys)
sys.setdefaultencoding('utf-8')
print sys.getdefaultencoding()
s="编码"
# s.decode('utf-8').encode('gb18030')
| PeoceWang/Get_topit.me_Pic | src/getPic/test2.py | Python | apache-2.0 | 162 |
from pandas import DataFrame, Series
#################
# Syntax Reminder:
#
# The following code would create a two-column pandas DataFrame
# named df with columns labeled 'name' and 'age':
#
# people = ['Sarah', 'Mike', 'Chrisna']
# ages = [28, 32, 25]
# df = DataFrame({'name' : Series(people),
# '... | yinlx/MLDN | quiz/create_df.py | Python | gpl-3.0 | 1,903 |
#!/usr/bin/env python
import requests
def match_keywords(url, topicwords):
r = requests.get(url)
matches = {}
for line in r.text.splitlines():
line = line.lower() # convert it to lowercase
for topic in topicwords:
for word in topicwords[topic]:
if word in l... | akkana/pi-zero-w-book | ch4/scrape_simple.py | Python | gpl-2.0 | 854 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.shortcuts import render
from django.http import JsonResponse, HttpResponseNotAllowed, HttpResponseBadRequest
from django.views.decorators.csrf import csrf_exempt
from django.db.models import Count
from processor.models import ProcessedCrash, ... | Liongold/crash | django/crashreport/api/views.py | Python | mpl-2.0 | 3,041 |
# CREATED:2014-03-07 by Justin Salamon <justin.salamon@nyu.edu>
'''
Melody extraction algorithms aim to produce a sequence of frequency values
corresponding to the pitch of the dominant melody from a musical
recording. For evaluation, an estimated pitch series is evaluated against a
reference based on whether the voic... | craffel/mir_eval | mir_eval/melody.py | Python | mit | 32,617 |
from setuptools import setup, find_packages
import os
version = '0.2.1'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
long_description = (
read('README.txt')
+ '\n' +
read('js', 'gridster', 'test_gridster.txt')
+ '\n' +
read('CHANGES.txt'))
setup(
... | j23d/js.gridster | setup.py | Python | bsd-3-clause | 964 |
import logging
import traceback
import warnings
from copy import deepcopy
from great_expectations.core.expectation_configuration import ExpectationConfiguration
from great_expectations.expectations.core.expect_column_kl_divergence_to_be_less_than import (
ExpectColumnKlDivergenceToBeLessThan,
)
from great_expectat... | great-expectations/great_expectations | great_expectations/render/renderer/content_block/validation_results_table_content_block.py | Python | apache-2.0 | 10,949 |
# 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/.
'''Tests for the DTD parser.
'''
import unittest
import re
from compare_locales.parser import getParser
from compare_l... | cstipkovic/spidermonkey-research | python/compare-locales/compare_locales/tests/test_dtd.py | Python | mpl-2.0 | 2,688 |
"""Generate a Python dict from input tags from a treebank, in str. As of this version, only treebanks following the Penn notation are supported.
"""
def set_path(dicts, keys, v):
"""Helper function for modifying nested dictionaries
:param dicts: dict: the given dictionary
:param keys: list str: path to a... | D-K-E/cltk | src/cltk/tag/treebanks.py | Python | mit | 1,796 |
"""Support for LED lights."""
from functools import partial
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_EFFECT,
ATTR_HS_COLOR,
ATTR_TRANSITION,
ATTR_WHITE_VALUE... | tboyce021/home-assistant | homeassistant/components/wled/light.py | Python | apache-2.0 | 14,745 |
#!/usr/bin/env python
from __future__ import division
from past.utils import old_div
import numpy
def get_n_add(temps, starting_temps, tmax):
incl_temps = []
for num, temp in enumerate(temps):
if temp <= tmax and starting_temps[num] <= tmax:
incl_temps.append(temp)
n_add = len(incl_t... | lfairchild/PmagPy | SPD/lib/lib_additivity_check_statistics.py | Python | bsd-3-clause | 3,574 |
class AbstractStrategy:
def __init__(self, game):
self._game = game
def choose(self):
raise NotImplementedError("Please Implement this method") | gtagency/tetris-python | Bot/Strategies/AbstractStrategy.py | Python | mit | 168 |
#!/usr/bin/env python
'''
'''
__docformat__ = 'restructuredtext'
__version__ = '$Id$'
import pyglet
import xinput
window = pyglet.window.Window()
class XInputEventLogger(object):
def __init__(self, device):
self.device = device
def on_button_press(self, button):
print self.device.name, 'on... | sangh/LaserShow | pyglet-hg/experimental/input/test_xinput.py | Python | bsd-3-clause | 1,056 |
import numpy as np
from copy import deepcopy
import torch
import torch.nn.functional as F
from mushroom_rl.core import Agent
from mushroom_rl.approximators import Regressor
from mushroom_rl.approximators.parametric import TorchApproximator
from mushroom_rl.utils.torch import get_gradient, zero_grad, to_float_tensor
... | carloderamo/mushroom | mushroom_rl/algorithms/actor_critic/deep_actor_critic/trpo.py | Python | mit | 8,510 |
import copy
import itertools
import operator
from functools import total_ordering, wraps
class cached_property:
"""
Decorator that converts a method with a single self argument into a
property cached on the instance.
A cached property can be made out of an existing method:
(e.g. ``url = cached_pr... | fenginx/django | django/utils/functional.py | Python | bsd-3-clause | 13,598 |
import datetime
import json
from django.conf import settings
def build_url(host, path_fragments):
"""
urljoin and os.path.join don't behave exactly as we want, so
here's a different wheel.
As per RFC 3986, authority is composed of hostname[:port] (and optionally
userinfo, but the microcosm API w... | microcosm-cc/microco.sm | sitegen/helpers.py | Python | gpl-2.0 | 1,637 |
# Copyright (c) 2015 SUSE Linux GmbH. All rights reserved.
#
# This file is part of kiwi.
#
# kiwi 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 la... | adrianschroeter/kiwi | kiwi/repository/dnf.py | Python | gpl-3.0 | 9,788 |
import os
import ycm_core
flags = [
'-Wall',
'-fexceptions',
'-std=c++0x',
'-x',
'c++',
'-I',
'../glfw/deps'
]
SOURCE_EXTENSIONS = [ '.cpp', '.h' ]
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return li... | Armen138/Zeppelin | .ycm_extra_conf.py | Python | mit | 1,369 |
#!/usr/bin/python3
#
# Combines multiple budget IR documents into one
# Copyright (C) 2013 Andrew Jeffery <andrew@aj.id.au>
#
# 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, eith... | amboar/fpos | lib/fpos/combine.py | Python | gpl-3.0 | 3,496 |
'''
Copyright (c) 2008, appengine-utilities project
All rights reserved.
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 list of conditions and the ... | kbdick/RecycleTracker | recyclecollector/scrap/gdata-2.0.18/samples/apps/marketplace_sample/appengine_utilities/interface/main.py | Python | gpl-3.0 | 3,004 |
# @author Jeff Lockhart <jwlock@umich.edu>
# Script for drawing the tripartite network underlying analysis.
# version 1.0
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import sys
#add the parent directory to the current session's path
sys.path.insert(0, '../')
from network_utils import *
#... | jwlockhart/concept-networks | examples/draw_tripartite.py | Python | gpl-3.0 | 3,581 |
from __future__ import division, absolute_import, print_function
# Code common to build tools
import sys
from os.path import join
import warnings
import copy
import binascii
from distutils.ccompiler import CompileError
#-------------------
# Versioning support
#-------------------
# How to change C_API_VERSION ?
# ... | larsmans/numpy | numpy/core/setup_common.py | Python | bsd-3-clause | 13,357 |
# http://www.geeksforgeeks.org/dynamic-programming-set-5-edit-distance/
# Given two strings str1 and str2 and below operations that can performed
# on str1. Find minimum number of edits (operations) required to convert
# ‘str1′ into ‘str2′.
# Insert
# Remove
# Replace
# All of the above operations are of equal cost.
... | bkpathak/Algorithms-collections | src/DP/edit_distance.py | Python | apache-2.0 | 3,029 |
from config import this_moment,start_training, database
from databases.db_populator.propagator import *
import datetime
import time
while True:
timer = str(datetime.datetime.now())
timer = timer[11:16] # reader beware. This is a string slice, not a time value
if timer == this_moment:
print("Here... | FRTNX/grassroot-learning | grassroot-nlu/trainer.py | Python | bsd-3-clause | 439 |
import logging
from ..block import SootBlockNode
from ..errors import AngrLoopAnalysisError
from . import register_analysis
from .analysis import Analysis
from .forward_analysis import ForwardAnalysis, LoopVisitor
l = logging.getLogger(name=__name__)
class VariableTypes:
Iterator = 'Iterator'
HasNext = 'H... | iamahuman/angr | angr/analyses/loop_analysis.py | Python | bsd-2-clause | 9,347 |
# 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)
from pants.goal.erro... | dbentley/pants | src/python/pants/goal/goal.py | Python | apache-2.0 | 8,127 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.teachers import FixedDialogTeacher
from parlai.utils.io import PathManager
from .build import build
imp... | facebookresearch/ParlAI | parlai/tasks/multiwoz_v20/agents.py | Python | mit | 4,210 |
#!/usr/bin/python
max_count = 35
# http://en.wikipedia.org/wiki/Fibonacci_number
def fib(n):
n0 = 0
n1 = 1
for i in range(0, n):
n2 = n0 + n1
n0 = n1
n1 = n2
return n0
for i in range(0, max_count):
print i, "\t", fib(i)
exit(0)
| rzel/talc | tests/fibonacci-table.py | Python | gpl-3.0 | 253 |
import unittest, subprocess, hashlib
import gurumate
import MySQLdb
class TestMySQLOps(unittest.TestCase):
def setUp(self):
#root
self.rootname = "root"
self.host = 'localhost'
self.rootpasswd = ''
#init databases
self.init_dbs = ["information_schema", "mysql", "perf... | cloud9ers/gurumate | tests/ubuntu/test_mysql.py | Python | lgpl-3.0 | 8,395 |
import logging
from nmb_constants import *
from nmb_structs import *
from utils import encode_name
class NMBSession:
log = logging.getLogger('NMB.NMBSession')
def __init__(self, my_name, remote_name, host_type = TYPE_SERVER, is_direct_tcp = False):
self.my_name = my_name.upper()
self.remote... | neno1978/pelisalacarta | python/main-classic/lib/sambatools/nmb/base.py | Python | gpl-3.0 | 5,711 |
from pyb import UART
# test we can correctly create by id or name
for bus in (-1, 0, 1, 2, 3, 4, 5, 6, 7, "XA", "XB", "YA", "YB", "Z"):
try:
UART(bus, 9600)
print("UART", bus)
except ValueError:
print("ValueError", bus)
uart = UART(1)
uart = UART(1, 9600)
uart = UART(1, 9600, bits=8, p... | rubencabrera/micropython | tests/pyb/uart.py | Python | mit | 526 |
def __bootstrap__():
global __bootstrap__, __loader__, __file__
import sys, pkg_resources, imp
__file__ = pkg_resources.resource_filename(__name__, 'json.cpython-35m-darwin.so')
__loader__ = None; del __bootstrap__, __loader__
imp.load_dynamic(__name__,__file__)
__bootstrap__()
| kaiserroll14/301finalproject | main/pandas/json.py | Python | gpl-3.0 | 299 |
import logging
from ..models import Activity
from .date import activity_stream_date_to_datetime, datetime_to_string
log = logging.getLogger(__name__)
def activity_from_dict(data):
log.debug("Converting YouTube dict to Activity Model")
activity_dict = activity_dict_from_dict(data)
return Activity.from_ac... | blitzagency/django-chatterbox | chatterbox/utils/youtube.py | Python | mit | 4,331 |
"""
Unit tests for gibbs_chronometer.py
"""
import os
import numpy as np
import gibbs_chronometer as gc
import pandas as pd
from isochrones import StarModel
from isochrones.mist import MIST_Isochrone
import priors
class TestClass:
"""
Tests for chronometer.py
"""
def test_data_file_validity(self):
... | RuthAngus/chronometer | chronometer/tests/unit/test_gibbs_chronometer.py | Python | mit | 8,088 |
"""cellprofiler.tests.__init__
CellProfiler is distributed under the GNU General Public License,
but this file is licensed under the more permissive BSD license.
See the accompanying file LICENSE for details.
Copyright (c) 2003-2009 Massachusetts Institute of Technology
Copyright (c) 2009-2015 Broad Institute
All rig... | LeeKamentsky/CellProfiler | cellprofiler/cpmath/tests/__init__.py | Python | gpl-2.0 | 419 |
#print("Hello")
from helper import greeting
greeting('hello')
greeting('changing more shit')
greeting('changing shit around')
print('does this work')
#ugh
| kvs6rj/cs3240-labdemo | hello.py | Python | mit | 158 |
#!/usr/bin/env python
# encoding: utf-8
from UltiSnips.geometry import Position
from UltiSnips.text_objects._lexer import tokenize, EscapeCharToken, VisualToken, \
TransformationToken, TabStopToken, MirrorToken, PythonCodeToken, \
VimLCodeToken, ShellCodeToken
from UltiSnips.text_objects._escaped_char import E... | wholland/env | vim/runtime/bundle/ultisnips/plugin/UltiSnips/text_objects/_parser.py | Python | mit | 3,170 |
from datetime import datetime, date
from flask import Blueprint, json, request, Response, session as flask_session
import indicomobile.db.event as db_event
import indicomobile.db.contribution as db_contribution
import indicomobile.db.session as db_session
import indicomobile.core.favorites as my_favorites
import indico... | indico/indico-mobile | indicomobile/views/favorites.py | Python | gpl-3.0 | 17,658 |
# Encoding: utf-8
import sys
from tornado import gen
from tornado.web import Application, RequestHandler
from tornado.ioloop import IOLoop
@gen.coroutine
def kitchen_work():
yield gen.sleep(5)
class FastFoodHost(RequestHandler):
@gen.coroutine
def get(self):
print 'Order sent to the kitchen, wa... | ygravrand/pyconfr2015 | breizhcamp2016/ex3_tornado/fast_food.py | Python | mit | 659 |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
#
# All Plot3D vector functions
#
# Create the RenderWindow, Renderer and both Actors
#
renWin = vtk.vtkRenderWindow()
renWin.SetMultiSamples(0)
ren1 = vtk.vtkRenderer()
... | hlzz/dotfiles | graphics/VTK-7.0.0/IO/Geometry/Testing/Python/Plot3DVectors.py | Python | bsd-3-clause | 3,828 |
# 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)
# TOOD(Eric Ayers):... | tejal29/pants | src/python/pants/backend/jvm/jvm_debug_config.py | Python | apache-2.0 | 1,016 |
import tensorflow as tf, sys
def label_iamge(image_path):
# image_path = sys.argv[1]
# Read in the image_data
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
# Loads label file, strips off carriage return
label_lines = [line.rstrip() for line
in tf.gfile.GFile("/file... | liujuan118/Antiphishing | label_image.py | Python | gpl-3.0 | 1,615 |
from twisted.internet.task import deferLater
from twisted.web import server, resource
from twisted.web.server import NOT_DONE_YET
from twisted.internet import reactor
import random
from insults import get_insult
class InsultThem(resource.Resource):
isLeaf = True
def _response_and_close(self, request, insult):... | TransactCharlie/twisted-intro | delayed_http_server/server.py | Python | gpl-2.0 | 1,044 |
from dartcms.views import (DeleteObjectView, GridView, InsertObjectView,
UpdateObjectView)
from django.conf.urls import url
app_name = 'dicts'
urlpatterns = [
url(r'^$', GridView.as_view(search=['name']), name='index'),
url(r'^insert/$', InsertObjectView.as_view(), name='insert'),
... | astrikov-d/dartcms | dartcms/apps/dicts/urls.py | Python | mit | 477 |
import unittest
from nose.tools import assert_equals, assert_true, assert_false
from robotide.robotapi import TestCaseFile
from robotide.controller import Project
from robotide.controller.macrocontrollers import KEYWORD_NAME_FIELD
from robotide.controller.commands import (
Undo, FindOccurrences, FindVariableOccurr... | fingeronthebutton/RIDE | utest/controller/test_occurrences.py | Python | apache-2.0 | 24,335 |
#coding=utf-8
from django.db import models
from django.contrib.auth.models import User
from django.utils.safestring import mark_safe
import simplejson
from umunc.settings import COMMITEE_DIR, COMMITEE_DIR2
class group(models.Model):
Name=models.CharField(max_length=255,verbose_name="名称")
School=models.Cha... | UMUNC/UMUNC | umunc_iris/models.py | Python | gpl-2.0 | 5,707 |
"""
A future place for our new installer API
"""
__author__ = 'dimd'
| dimddev/NetCatKS | NetCatKS/Installer/__init__.py | Python | bsd-2-clause | 69 |
"""
The sum of the squares of the first ten natural numbers is,
12 + 22 + ... + 102 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)2 = 552 = 3025
Hence the difference between the sum of the squares of the first ten
natural numbers and the square of the sum is 3025 - 385 = 2640.
... | doozr/euler.py | p0006_sum_square_difference_test.py | Python | gpl-3.0 | 746 |
##########################################################################
#
# Copyright (c) 2012, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | cedriclaunay/gaffer | python/GafferUI/PathFilterWidget.py | Python | bsd-3-clause | 4,592 |
def baesoo(a):
for a in range(1, 10000000000000):
if a % 3 == 0:
message = '3의 배수입니다'
print('3의 배수입니다 ')
break
for b in range(1, 10000000000000):
if b % 5 == 0:
message = '5의 배수입니다'
print('5의 배수입니다')
break
for c in rang... | saintdragon2/python-3-lecture-2015 | homework_checker/homework_01/hw_15030020.py | Python | mit | 762 |
# coding= utf-8
import yaml
def getDurationSubjective(duration):
return getSubjective(duration, 'subjectives/duration.yaml')
def getHateSubjective(hate):
return getSubjective(hate, 'subjectives/hate.yaml')
def getSubjective(value, file):
f = open(file, 'r', encoding='utf-8')
data = yaml.load(f.read()... | firefueled/pirula-time | webapp/subjectives/__init__.py | Python | mit | 529 |
import _plotly_utils.basevalidators
class TicksuffixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self, plotly_name="ticksuffix", parent_name="densitymapbox.colorbar", **kwargs
):
super(TicksuffixValidator, self).__init__(
plotly_name=plotly_name,
... | plotly/python-api | packages/python/plotly/plotly/validators/densitymapbox/colorbar/_ticksuffix.py | Python | mit | 485 |
# Implement efilter protocols for Rekall types.
from efilter.protocols import applicative
from efilter.protocols import associative
from efilter.protocols import eq
from efilter.protocols import number
from efilter.protocols import ordered
from efilter.protocols import repeated
from efilter.protocols import string
fro... | google/rekall | rekall-core/rekall/plugins/common/efilter_plugins/protocols.py | Python | gpl-2.0 | 5,600 |
from ._su2 import read, write
__all__ = ["read", "write"]
| nschloe/meshio | src/meshio/su2/__init__.py | Python | mit | 59 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2012 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... | cvandeplas/plaso | plaso/parsers/winreg_plugins/default_test.py | Python | apache-2.0 | 2,669 |
# Copyright (C) 2016 Juan Martorell
#
# 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 2.1 of the License, or (at your option) any later version.
#
# This library is distr... | jmartorell/LTlab | dict/progressbar.py | Python | gpl-2.0 | 1,957 |
# Copyright 2013 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 posixpath
from compiled_file_system import SingleFile, Unicode
from extensions_paths import API_PATHS
from file_system import FileNotFoundError
from ... | TeamEOS/external_chromium_org | chrome/common/extensions/docs/server2/api_models.py | Python | bsd-3-clause | 3,753 |
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
try:
import numpy as np
except:
exit()
from deap import benchmarks
def griewank_arg0(sol):
return benchmarks.griewank(sol)[0]
fig = plt.figure()
ax = Axes3D(fig, azim = -29, elev = 40)
# ax = Axes3D(fig)
X ... | DEAP/deap | doc/code/benchmarks/griewank.py | Python | lgpl-3.0 | 637 |
"""Test all functions related to the basic accessory implementation.
This includes tests for all mock object types.
"""
from unittest.mock import Mock, patch
import pytest
from homeassistant.components.homekit.accessories import (
HomeAccessory,
HomeBridge,
HomeDriver,
)
from homeassistant.components.hom... | turbokongen/home-assistant | tests/components/homekit/test_accessories.py | Python | apache-2.0 | 22,974 |
import unittest
from test import test_support
import zlib
import random
# print test_support.TESTFN
def getbuf():
# This was in the original. Avoid non-repeatable sources.
# Left here (unused) in case something wants to be done with it.
import imp
try:
t = imp.find_module('test_zlib')
... | xbmc/atv2 | xbmc/lib/libPython/Python/Lib/test/test_zlib.py | Python | gpl-2.0 | 14,490 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individuals,
# ... | ganeshgore/myremolab | server/src/voodoo/gen/loader/util.py | Python | bsd-2-clause | 3,862 |
# -*- coding: utf-8 -*-
from sphinx.builders.html import JSONHTMLBuilder
from sphinx.util import jsonimpl
class DeconstJSONImpl:
"""
Enhance the default JSON encoder by adding additional keys.
"""
def dump(self, obj, fp, *args, **kwargs):
self._enhance(obj)
return jsonimpl.dump(obj, ... | smashwilson/deconst-preparer-sphinx | deconstrst/builder.py | Python | apache-2.0 | 1,067 |
import acm
import ael
import FHTI_EDD_OTC_Util
import HTI_ExcelReport2
import HTI_Util
import HTI_FeedTrade_EDD_Util
import HTI_MTMValuationRpt_TRS
import FHTI_EDD_OTC_Util
import win32com.client
from shutil import copyfile
import locale
import os
import ntpath
import math
ttCSV = "Check this to export the report in C... | frederick623/pb | deltaone/HTI_CollateralMgtReport.py | Python | apache-2.0 | 92,934 |
from django.conf import settings
import requests
def send_email(sender, receiver, subject, html):
response = requests.post(
settings.MAILGUN_API_MESSAGE_URL,
auth=("api", settings.MAILGUN_API_KEY),
data={
"from": sender,
"to": [
receiver,
... | jupiny/EnglishDiary | english_diary/core/utils/email.py | Python | mit | 414 |
# -*- coding: utf-8 -*-
"""
Unit tests for LMS instructor-initiated background tasks helper functions.
Tests that CSV grade report generation works with unicode emails.
"""
import ddt
from mock import Mock, patch
import tempfile
import json
from openedx.core.djangoapps.course_groups import cohorts
import unicodecsv
... | JCBarahona/edX | lms/djangoapps/instructor_task/tests/test_tasks_helper.py | Python | agpl-3.0 | 78,339 |
import os
from bottle import Bottle, run, static_file
app = Bottle()
@app.route('/')
def index():
return static_file('index.html', root=os.getcwd())
@app.route('/<filepath:path>')
def server_static(filepath):
return static_file(filepath, root=os.getcwd())
run(app, host='0.0.0.0', port=80, debug=True)
| raspdronepi/raspnator-gui | app.py | Python | gpl-3.0 | 313 |
from functools import wraps
from flask import request
from flask.ext.restful import Api
from flask.ext.restful.reqparse import RequestParser
def patched_to_marshallable_type(obj):
"""adds __marshallable__ support; see https://github.com/twilio/flask-restful/pull/32"""
if obj is None:
return None # m... | paulvisen/flask-todo | utils/flaskutils/restful.py | Python | mit | 2,942 |
# Natural Language Toolkit: Sourced Strings
#
# Copyright (C) 2001-2009 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
X{Sourced strings} are strings that are annotated with information
about the location in a document where they wer... | tadgh/ArgoRevisit | third_party/nltk/sourcedstring.py | Python | apache-2.0 | 54,572 |
from nose.tools import * # PEP8 asserts
from cosmid.resource import Resource
class TestResource:
"""Testing a local resource object."""
def setUp(self):
self.resource = Resource("exampleFASTA")
def tearDown(self):
del self.resource
def test_load(self):
# Test (re)loading a YAML file with resou... | robinandeer/cosmid | tests/resource_tests.py | Python | mit | 446 |
import sys
import os
import collections
import re
import yaml
import pprint
from glob import glob
from keyword import iskeyword
from controllers.utils import serverprint
controllers = 'controllers'
xcontrollers = {'cons', 'info', 'review', 'common'}
modelSource = 'models/model.yaml'
tableSource = 'models/tables'
comp... | Dans-labs/dariah | server/compile.py | Python | mit | 6,872 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Windows Restore Point (rp.log) file parser."""
import unittest
from plaso.lib import definitions
from plaso.parsers import winrestore
from tests.parsers import test_lib
class RestorePointLogParserTest(test_lib.ParserTestCase):
"""Tests for the Windo... | Onager/plaso | tests/parsers/winrestore.py | Python | apache-2.0 | 1,147 |
import unittest
from database import relationship
class TestRelationship(unittest.TestCase):
def setUp(self):
self.relationship = relationship.Relationship(relationship_id=1,
start_node='(n0:Person {born:"2016",name:"Dargo Dalma Lea"})',
... | sandordargo/family-tree | tests/test_relationship.py | Python | mit | 1,117 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.