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 |
|---|---|---|---|---|---|
## Messages for challenge scoring script.
import string
import sys
import warnings
## Module level state. You'll need to set a synapse object at least
## before using this module.
syn = None
send_messages = True
send_notifications = True
acknowledge_receipt = False
dry_run = False
## Edit these URLs to point to yo... | Sage-Bionetworks/U4CChallenge | python/messages.py | Python | apache-2.0 | 5,891 |
from __future__ import unicode_literals
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.utils.unittest import TestCase
class PaginatorTests(TestCase):
"""
Tests for the Paginator and Page classes.
"""
def check_paginator(self, params, output):
"""
... | pygeek/django | tests/regressiontests/pagination_regress/tests.py | Python | bsd-3-clause | 8,540 |
# -*- coding: utf-8 -*-
#
# Copyright 2014 - Intel
#
# 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 app... | sjcazzol/python-healingclient | healingclient/tests/base.py | Python | apache-2.0 | 2,820 |
# Copyright 2013 NetApp
# 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 applic... | redhat-openstack/manila | manila/api/v1/share_snapshots.py | Python | apache-2.0 | 6,346 |
def checkio(teleports_string):
queue, paths = ['1'], []
while queue:
result = queue.pop()
path = paths.pop() if paths else []
if set('12345678') <= set(result) and result[-1] == '1':
return result
for v in teleports_string.split(','):
if v not in path and ... | Pouf/CodingCompetition | CiO/disposable-teleports.py | Python | mit | 437 |
import sublime
class Settings:
def __init__(self):
self.__settings_key = 'Format.sublime-settings'
def add_observer(self, key, observer):
self.__load().add_on_change(self.__observer_id(key), observer)
def remove_observer(self, key):
self.__load().clear_on_change(self.__observer_i... | Rypac/sublime-format | plugin/settings.py | Python | mit | 2,344 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | briancurtin/python-openstacksdk | openstack/compute/v2/server_group.py | Python | apache-2.0 | 1,373 |
#!/usr/bin/env python
import argparse
import greg.config
def main():
parser = argparse.ArgumentParser(description='Integrate your build server and source control')
parser.add_argument('--config', default='config.yaml', help='Path to config file')
parser.add_argument('--fix-hooks', action='store_const', con... | BackSlasher/greg | greg/__main__.py | Python | gpl-3.0 | 2,640 |
#!/usr/bin/env python
'''
ZCR Shellcoder
ZeroDay Cyber Research
Z3r0D4y.Com
Ali Razmjoo
'''
def start(type,shellcode,job):
if 'chmod(' in job:
shellcode = 'N' + shellcode
if 'dir_create(' in job:
shellcode = 'N' + shellcode
if 'download_execute(' in job:
shellcode = 'N' + shellcode
if 'download(' in job:
... | firebitsbr/ZCR-Shellcoder | lib/encoder/windows_x86/xor_yourvalue.py | Python | gpl-3.0 | 637 |
import unittest
import code_helper
class Test0037(unittest.TestCase):
def test_problem(self):
primes = list(code_helper.range_prime(1000000))
s = 0
def trim_right_prime(n):
n /= 10
while n != 0:
if code_helper.binary_search(primes, n) == -1:
... | mccxj/leetcode | projecteuler/p0037_test.py | Python | apache-2.0 | 953 |
# Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: [email protected]
# Maintained By: [email protected]
import datetime
import factory
import random
from factory.base import BaseFact... | vladan-m/ggrc-core | src/tests/ggrc/behave/factories.py | Python | apache-2.0 | 12,159 |
"""
Colour Matching Functions Transformations
=========================================
Defines various educational objects for colour matching functions
transformations:
- :func:`colour.colorimetry.RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs`
- :func:`colour.colorimetry.RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs`
- :... | colour-science/colour | colour/colorimetry/transformations.py | Python | bsd-3-clause | 9,677 |
#!/usr/bin/env python3
# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
#
# Copyright (c) 2015, Colorado State University.
#
# This file is part of ndn-atmos.
#
# ndn-atmos is free software: you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as publish... | named-data/ndn-atmos | lib/ndn_cmmap_translators/atmos2ndn_parser/conf_file_parser.py | Python | gpl-3.0 | 4,328 |
from django import template
register = template.Library()
from blog.models import Article, Category, ArticleTranslation
from blog.utils import Year, Month
from blog import settings as blog_settings
try:
from tagging.models import Tag
except:
Tag = None
@register.inclusion_tag('blog/includes/_nav.html')
def b... | Cotidia/cotidia-blog | blog/templatetags/blog_tags.py | Python | mit | 3,067 |
# Miro - an RSS based video player application
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Participatory Culture Foundation
#
# 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; eithe... | debugger06/MiroX | tv/osx/plat/frontends/widgets/window.py | Python | gpl-2.0 | 30,683 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('thedirectory', '0015_entry_creation_user'),
]
operations = [
migration... | owatte/thecaribfos | apps/thedirectory/migrations/0016_auto_20150728_1457.py | Python | gpl-3.0 | 914 |
#!/usr/bin/env python
# import os, sys
# sys.path.append(os.path.abspath('infomap'))
# from __future__ import print_function # Python 3 print function in Python 2
from infomap import infomap
conf = infomap.init("--two-level -v -N2")
# Add output directory (and output name) to automatically write result to file
# conf... | GraphProcessor/CommunityDetectionCodes | NonOverlappingCodes/2009-Community-Infomap-MapEquation/examples/python/Infomap.py | Python | gpl-2.0 | 1,445 |
# Copyright (c) 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 ... | beagles/neutron_hacking | neutron/plugins/ml2/drivers/type_tunnel.py | Python | apache-2.0 | 5,052 |
import os
import sys
from distutils.sysconfig import get_python_lib
from setuptools import find_packages, setup, Command
# Dynamically calculate the version based on VERSION.
version = __import__('oneway').get_version()
class PyTest(Command):
user_options = []
def initialize_options(self):
pass
... | green-latte/oneway | setup.py | Python | mit | 1,413 |
# -*- coding: utf-8 -*-
from django import template
from django.utils.safestring import mark_safe
from django_js_reverse.core import generate_js
try:
from django.urls import get_resolver
except ImportError:
from django.core.urlresolvers import get_resolver
register = template.Library()
urlconf = template.V... | ierror/django-js-reverse | django_js_reverse/templatetags/js_reverse.py | Python | mit | 838 |
from mkidreadout.channelizer.Roach2Controls import Roach2Controls
import sys, time, os, datetime, calendar
import numpy as np
if __name__=='__main__':
paramFile='/mnt/data0/neelay/MkidDigitalReadout/DataReadout/ChannelizerControls/DarknessFpga_V2.param'
timeInterval = sys.argv[1]
timeReg = 'timekeeper_sec_... | bmazin/SDR | Projects/FirmwareTests/darkDebug/tsChecker.py | Python | gpl-2.0 | 1,311 |
# _*_ coding:utf-8 _*_
import logging
from collections import defaultdict
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.authentication import SessionAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework import status
from ... | miurahr/seahub | seahub/api2/endpoints/repo_tags.py | Python | apache-2.0 | 6,920 |
#
# This file is part of Bluepass. Bluepass is Copyright (c) 2012-2013
# Geert Jansen.
#
# Bluepass is free software available under the GNU General Public License,
# version 3. See the file LICENSE distributed with this file for the exact
# licensing terms.
from __future__ import absolute_import, print_function
impo... | geertj/bluepass | tests/test_platform.py | Python | gpl-3.0 | 4,626 |
import urllib2
import urllib
import os
from core import directorio
def descargar(items, direct=None):
agent = "Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1"
if not direct:
#Creamos un directorio temporal
direct = directorio.crear()
for url in items:
... | GrampusTeam/Grampus | core/descargas.py | Python | bsd-3-clause | 1,002 |
# coding=utf-8
# Copyright 2016 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 collections
i... | UnrememberMe/pants | src/python/pants/backend/jvm/tasks/reports/junit_html_report.py | Python | apache-2.0 | 11,048 |
from Tools.Profile import profile
profile("LOAD:GUISkin")
from Components.GUISkin import GUISkin
profile("LOAD:Source")
from Components.Sources.Source import Source
profile("LOAD:GUIComponent")
from Components.GUIComponent import GUIComponent
class Screen(dict, GUISkin):
False, SUSPEND_STOPS, SUSPEND_PAUSES = range... | kakunbsc/enigma2.1 | lib/python/Screens/Screen.py | Python | gpl-2.0 | 3,934 |
"""This modules is used to capture the screen
"""
import pyautogui
import time
import Globals
PATH = './Captures/'
def capture_area(area):
"""
Captures area of the screen
Args:
area (Tuple (x,y,width,height)): Area to capture
Returns:
Image : Image of the area captured
"""
... | DavidBarishev/DDtankFarmingBot | Ddtank_farm_bot/Framework/Capture.py | Python | gpl-3.0 | 1,336 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import base.models
import django.utils.timezone
from django.conf import settings
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(sett... | pmeier82/spike_gnode | base/migrations/0001_initial.py | Python | bsd-3-clause | 2,046 |
"""Legacy URLs."""
# This module reflects the URLs and behavior of the former Django
# application.
import logging
import os
import time
from google.appengine.api import memcache
from flask import Blueprint, make_response, render_template, Response, request
from pygments import highlight
from pygments.formatters i... | sriniiyer/codenn | src/sqlparse/extras/appengine/sqlformat/legacy.py | Python | mit | 5,743 |
#!/bin/env python3
"""
Convert a Material Design Icons Codepoints file to QML.
This script creates a QML component which defines
constants for all icons listed in the file
`MaterialIcons-Regular.codepoints` in the FontAwesome package.
"""
import fire
from typing import Optional, NamedTuple, List
from pathlib import ... | mhoeher/opentodolist | bin/material_design_icons_codepoints2qml.py | Python | gpl-3.0 | 3,970 |
#
#
# This source file is part of ELINA (ETH LIbrary for Numerical Analysis).
# ELINA is Copyright © 2019 Department of Computer Science, ETH Zurich
# This software is distributed under GNU Lesser General Public License Version 3.0.
# For more information, see the ELINA project website at:
# http://elina.ethz.ch
#... | eth-srl/OptOctagon | python_interface/tests/linexpr0_test.py | Python | apache-2.0 | 12,187 |
# -*- 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... | diogocs1/comps | web/openerp/report/render/rml2txt/utils.py | Python | apache-2.0 | 4,710 |
# ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <[email protected]> *
# * Copyright (c) 2020 Sudhanshu Dubey <[email protected] *
# * *
# * Th... | Fat-Zer/FreeCAD_sf_master | src/Mod/Fem/femexamples/constraint_contact_solid_solid.py | Python | lgpl-2.1 | 7,624 |
# Copyright 2002, 2004 John T. Reese.
# email: jtr at ofb.net
#
# This file is part of Yammer.
#
# Yammer 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... | nandub/yammer | lib/KeyStore.py | Python | gpl-2.0 | 2,728 |
from tendrl.commons.utils import ini2json
PATH = "tendrl/node_agent/tests/samples/gluster_state_sample.yaml"
class TendrlGlusterfsMonitoringBase(object):
def __init__(self):
self.CONFIG = dict(
{
"integration_id": "7bccda8c-8c85-45a8-8be0-3f71f4db7db7",
"graphi... | r0h4n/node-agent | tendrl/node_agent/tests/mock_gluster_state.py | Python | lgpl-2.1 | 515 |
import unittest
import numpy as np
import os
import EXOSIMS
from EXOSIMS.Prototypes import PostProcessing
import numpy as np
r"""PostProcessing module unit tests
Paul Nunez, JPL, Aug. 2016
"""
# need a dummy BackgroundSources
specs = {'modules':{'BackgroundSources':' '}}
class Test_PostProcessing_prototype(unittes... | dsavransky/EXOSIMS | tests/Prototypes/test_PostProcessing.py | Python | bsd-3-clause | 976 |
import os
import unittest
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
import pytest
import itertools as itt
DIRECTORY = os.path.dirname(os.path.realpath(__file__))
# CHECK THIS http://stackoverflow.com/questions/1676269/writing-a-re-usable-parametrized-unittest-testcase-method
def get_a... | pybel/pybel-notebooks | test.py | Python | apache-2.0 | 849 |
# -*- coding: utf-8
"""Clustering operations and helper functions"""
import os
import hcluster
import numpy as np
from sklearn import manifold
from sklearn import preprocessing
import anvio
import anvio.utils as utils
import anvio.terminal as terminal
import anvio.filesnpaths as filesnpaths
from anvio.errors import ... | caglar10ur/anvio | anvio/clustering.py | Python | gpl-3.0 | 15,883 |
import datetime
import os
SCHEDULER_TASKS = [
{
"path": "tests.tasks.general.MongoInsert",
"params": {
"a": 1
},
"dailytime": datetime.datetime.fromtimestamp(float(os.environ.get("MRQ_TEST_SCHEDULER_TIME"))).time()
},
{
"path": "tests.tasks.general.MongoI... | IAlwaysBeCoding/mrq | tests/fixtures/config-scheduler3.py | Python | mit | 561 |
from django.conf import settings
import boto3
import os
def upload_file_to_s3(filename_and_path):
'''
Uploads a file to S3
'''
file = str(filename_and_path)
if file:
client = boto3.client('s3')
client.upload_file(settings.MEDIA_ROOT + file, settings.AWS_STORAGE_BUCKET_NAME, file)
... | JustinWingChungHui/MyFamilyRoot | common/s3_synch.py | Python | gpl-2.0 | 1,056 |
# - coding: utf-8 -
# Copyright (C) 2008-2010 Toms Bauģis <toms.baugis at gmail.com>
# This file is part of Project Hamster.
# Project Hamster 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 ... | omaciel/billreminder | src/gui/widgets/charting.py | Python | gpl-3.0 | 12,341 |
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2002-2006 Donald N. Allingham
#
# 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 you... | SNoiraud/gramps | gramps/gen/filters/rules/family/_hasattribute.py | Python | gpl-2.0 | 1,789 |
# -*- encoding: utf-8 -*-
"""
Rapids expressions. These are helper classes for H2OFrame.
:copyright: (c) 2016 H2O.ai
:license: Apache License Version 2.0 (see LICENSE for details)
"""
from __future__ import division, print_function, absolute_import, unicode_literals
import collections
import copy
import gc
import m... | h2oai/h2o-dev | h2o-py/h2o/expr.py | Python | apache-2.0 | 16,556 |
import string
import random
import math
import itertools
import re
import datetime
from django.utils import timezone
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models
from django.db import IntegrityError
from django.db.models import ObjectDoesNotExist... | Bionetbook/bionetbook | bnbapp/protocols/models.py | Python | mit | 52,610 |
import unittest
import os.path
import pandas as pd
from multiplate import multiplateIO
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "test_data")
class TestIsInstance(unittest.TestCase):
def test_enspire_csv_parser(self):
"""Check that parsed EnSpire csv matches expected data"""
test_... | campenr/multiplate | multiplate/test/test.py | Python | bsd-3-clause | 758 |
# decay learning rate test
import tensorflow as tf # neural network for function approximation
import gym # environment
import numpy as np # matrix operation and math functions
from gym import wrappers
import gym_morph # customized environment for cart-pole
import matplotlib.pyplot as plt
import time
for test_num in ... | GitYiheng/reinforcement_learning_test | test03_monte_carlo/t21_cartpole_dnn_local.py | Python | mit | 7,348 |
#!/usr/bin/env python
# -*- coding : utsf8 -*-
DEFAULT_HOST, DEFAULT_PORT = "localhost", 37100
import sys, json
sys.path.append('./gen-py')
from DataAccess import QueryProcessorService
from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBin... | 573719929/Common-Processor | Client.py | Python | apache-2.0 | 1,058 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'lkdconfigdetailsform.ui'
#
# Created: Mon Jun 8 21:00:01 2009
# by: PyQt4 UI code generator 4.4.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
class Ui_Dialog(object):
def setupUi(self,... | efeciftci/lkd-uye-plasmoid | contents/code/lkdconfigdetailsform.py | Python | gpl-2.0 | 4,880 |
from nltk.tokenize import RegexpTokenizer
concept = 'A firewall is a part of a computer system or network that is designed to block unauthorized access while permitting authorized communications. It is a device or set of devices which is configured to permit or deny computer based application upon a set of rules and o... | tjohn351/Termediator | Tests/removePunctuation.py | Python | mit | 548 |
import pytest
import numpy as np
from context import Runner, ExecutionType, get_configs, docker_available
class MockContext():
def __init__(self):
self.obj = {}
@pytest.mark.skipif(not docker_available(), reason='Docker is not available')
def test_runner_langermann():
internal_conf = get_configs('c... | d53dave/cgopt | tests/test_runner.py | Python | mit | 685 |
import asyncio
import functools
from django.core.exceptions import SynchronousOnlyOperation
def async_unsafe(message):
"""
Decorator to mark functions as async-unsafe. Someone trying to access
the function while in an async context will get an error message.
"""
def decorator(func):
@func... | georgemarshall/django | django/utils/asyncio.py | Python | bsd-3-clause | 1,059 |
#
# Copyright 2015, 2017, 2021 Lars Pastewka (U. Freiburg)
# 2020 Johannes Hoermann (U. Freiburg)
# 2014 James Kermode (Warwick U.)
#
# matscipy - Materials science with Python at the atomic-scale
# https://github.com/libAtoms/matscipy
#
# This program is free software: you can redistribute it and/o... | libAtoms/matscipy | tests/matscipytest.py | Python | lgpl-2.1 | 4,902 |
import __builtin__
import abc
import math
from natsort import natsorted, ns
import os
import subprocess
import re
import threading
import time
import xml.etree.ElementTree as ET
"""
This is the abstract class for all PlaybackModules.
All PlaybackModules need to implement the @abstractmethods in order to function.
"""... | emmercm/piradio | Player/PlaybackModules.py | Python | mit | 31,031 |
#!/usr/bin/python
#
# Copyright 2017 Google 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 a... | tst-ahernandez/earthenterprise | earth_enterprise/src/server/wsgi/wms/ogc/xml/v111/exception.py | Python | apache-2.0 | 21,567 |
from django.conf.urls import url
from places import views
urlpatterns = [
url(r'^$', views.index, name='index')
]
| EntilZha/docker-workshop | backend/places/urls.py | Python | mit | 119 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from itertools import compress
mylist = [1,4,-5, 10, 7, 2, 3, -1]
print([n for n in mylist if n > 0])
pos = (n for n in mylist if n > 0)
for x in pos:
print(x, end = ',')
print()
values = ['1', '2', '-3', '-', '4', 'N/A', '5']
def is_int(val):
try:
x ... | firery/live-long-and-prosper | Python/Python Cookbook(the 3rd edition)/ch01/p16_filter.py | Python | apache-2.0 | 820 |
'''
add.py
Takes a list of input ingredient names. Imports each if not already present.
If already present, duplicates and rotates the ingredient.
Thomas Storey
2016
'''
import sys
import argparse
import bpy
import numpy as np
import os
import bmesh
from math import *
from mathutils import *
import random
def getO... | thomasrstorey/recipesfordisaster | actions/bake.py | Python | mit | 4,214 |
import re
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, FormRequest, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy.http import FormRequest
from productloader import load_product
im... | 0--key/lib | portfolio/Python/scrapy/inkshop/cartridgesavecouk.py | Python | apache-2.0 | 2,521 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from unittest import TestCase as PythonTestCase
import redis
class TestCase(PythonTestCase):
def setUp(self):
self.redis = redis.Redis(host='localhost', port=7575, db=0)
self.redis.flushall()
| heynemann/octopus | tests/__init__.py | Python | mit | 262 |
""" Test suite for the fixer modules """
# Python imports
import os
import unittest
from itertools import chain
from operator import itemgetter
# Local imports
from lib2to3 import pygram, pytree, refactor, fixer_util
from lib2to3.tests import support
class FixerTestCase(support.TestCase):
# Other test cases ca... | linuxwhatelse/plugin.audio.linuxwhatelse.gmusic | resources/libs/lib-sys/lib2to3/lib2to3/tests/test_fixers.py | Python | gpl-3.0 | 122,292 |
# This file is part of Invenio.
# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011 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; either version 2 of the
# License, or (at your option)... | jmacmahon/invenio | modules/websubmit/lib/functions/Move_Files_Archive.py | Python | gpl-2.0 | 2,161 |
#!/usr/bin/env python3
from struct import pack, unpack
from datetime import date
from pathlib import Path
import os.path
import argparse
import sys
import re
configFilename = 'openmw.cfg'
configPaths = { 'linux': '~/.config/openmw',
'freebsd': '~/.config/openmw',
'darwin': '~/Libra... | jmelesky/omwllf | omwllf.py | Python | isc | 17,912 |
"""
EGADS transforms algorithms. See EGADS Algorithm Documentation for more info.
"""
__author__ = "mfreer, ohenry"
__date__ = "2017-01-08 11:42"
__version__ = "1.2"
import logging
try:
from interpolation_linear import *
from isotime_to_elements import *
from isotime_to_seconds import *
from seconds_t... | eufarn7sp/egads-eufar | egads/algorithms/transforms/__init__.py | Python | bsd-3-clause | 547 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_awsci
----------------------------------
Tests for `awsci` module.
"""
import unittest
from awsci import awsci
class TestAwsci(unittest.TestCase):
def setUp(self):
pass
def test_something(self):
pass
def tearDown(self):
... | glemmaPaul/AWSci | tests/test_awsci.py | Python | isc | 325 |
#
# 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... | airbnb/airflow | airflow/providers/qubole/example_dags/example_qubole.py | Python | apache-2.0 | 9,117 |
import os
from flask import Flask, current_app
from .extensions import db, login_manager, csrf, mail
import config as Config
from .common import constants as COMMON_CONSTANTS
from .api import helloworld
from .user import user
from .user import User
# For import *
__all__ = ['create_app']
DEFAULT_BLUEPRINTS = [
use... | MedQA/medqa | app/app.py | Python | mit | 1,979 |
#!/usr/bin/python
import re
import subprocess
# Calls the R system specifying that commands come from file commands.R
# The commands.R provided with this assignment will read the file named
# data and will output a histogram of that data to the file pageshist,pdf
def runR( ):
res = subprocess.call(['R', '-f', 'co... | PLJNS/Rutgers-Prin-Prog-Fall-2013 | Python/pages.py | Python | mit | 1,179 |
"""
Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.
Example 1:
Input: [1,1,2,3,3,4,4,8,8]
Output: 2
Example 2:
Input: [3,3,7,7,10,11,11]
Output: 10
Note: Your solution should ... | yfpeng/pengyifan-leetcode | src/main/python/pyleetcode/Single_Element_in_a_Sorted_Array.py | Python | bsd-3-clause | 1,481 |
from ..utils import *
##
# Minions
# Tentacle of N'Zoth
class OG_151:
deathrattle = Hit(ALL_MINIONS, 1)
| smallnamespace/fireplace | fireplace/cards/wog/neutral_legendary.py | Python | agpl-3.0 | 108 |
##########################################################################
#
# Copyright (c) 2008-2011, 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:
#
# * Redis... | lento/cortex | test/IECoreGL/UserAttributesTest.py | Python | bsd-3-clause | 5,167 |
from unittest import TestCase
from flake8.options.manager import OptionManager
from darglint.config import get_config
from darglint.docstring.style import DocstringStyle
from darglint.flake8_entry import DarglintChecker
from darglint.strictness import Strictness
class Flake8TestCase(TestCase):
"""Tests that flak... | terrencepreilly/darglint | integration_tests/test_flake8.py | Python | mit | 1,115 |
"""Decodes a sentence using the Viterbi Algorithm
Input: a sentence (str)
Initialization: set pi(0, <START>, <START>) = 1
"""
from nltk.tokenize import TreebankWordTokenizer
from preprocessing import import_wsj
from parameters_class import Parameters
class Decoder:
def __init__(self, corpus_name):
"""Initializ... | ischeinfeld/py_nlp | src_deprecated/decoder_class_old.py | Python | mit | 2,037 |
def test():
assert True
| brianjimenez/python-course | material/examples/test_example_7.py | Python | mit | 29 |
# Copyright 2014 Hewlett-Packard Development Company, L.P
# 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.... | Tesora-Release/tesora-horizon | openstack_dashboard/test/integration_tests/tests/test_keypair.py | Python | apache-2.0 | 1,445 |
# -*- coding: utf-8 -*-
# Copyright 2014 Rob Ruana
# Licensed under the BSD License, see LICENSE file for details.
"""Tests for :mod:`sphinxcontrib.napoleon.docstring` module."""
import textwrap
from sphinxcontrib.napoleon import Config
from sphinxcontrib.napoleon.docstring import GoogleDocstring, NumpyDocstring
from... | marcoantoniooliveira/labweb | oscar/lib/python2.7/site-packages/tests/napoleon/test_docstring.py | Python | bsd-3-clause | 10,061 |
import re
from datetime import date
from bs4 import BeautifulSoup
from django.test import Client
from freezegun import freeze_time
import ws.utils.perms as perm_utils
from ws import enums, models
from ws.tests import TestCase, factories, strip_whitespace
class Helpers:
client: Client
@staticmethod
def ... | DavidCain/mitoc-trips | ws/tests/views/test_trips.py | Python | gpl-3.0 | 23,912 |
from Sire.IO import *
from Sire.Mol import *
from Sire.CAS import *
from Sire.System import *
from Sire.Move import *
from Sire.MM import *
from Sire.FF import *
from Sire.Units import *
from Sire.Vol import *
from Sire.Maths import *
from Sire.Base import *
from Sire.Qt import *
import os,re,sys
import shutil
comb... | chryswoods/SireTests | unittests/SireIO/amber.py | Python | gpl-2.0 | 13,125 |
#-*- coding: utf-8 -*-
import os
from clang.cindex import Config, Index, TypeKind
class ClangExtractor(object):
def __init__(self, libclang_path, srcdir):
if Config.library_file != libclang_path:
Config.set_library_file(libclang_path)
self.srcdir = srcdir
def extract(self):
... | Frky/scat | src/shell/data/clangextractor.py | Python | mit | 1,769 |
import sys
import pymol
import os
import time
pdb1 = sys.argv[1]
pdb2 = sys.argv[2]
# load pdb files
cmd.load(pdb1,"native")
cmd.load(pdb2,"other")
# full path to first pdb file
full_path = os.path.abspath(pdb1)
dir_path = os.path.dirname(full_path)
# parse residue list
reslist = []
sitem = sys.argv[3].split(",")
r... | larsbratholm/pymol_residue_compare | pymol_residue_compare.py | Python | mit | 1,807 |
from django.conf.urls import url
from eventex.subscriptions.views import new, detail, json_example
urlpatterns = [
url(r'^$', new, name='new'),
url(r'^json$', json_example, name='json_example'),
url(r'^(?P<pk>\d+)/$', detail, name='detail'),
]
| renzon/wttd | eventex/subscriptions/urls.py | Python | agpl-3.0 | 258 |
# Copyright 2012 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 agre... | varunarya10/oslo.config | tests/testmods/fbaar_baa_opt.py | Python | apache-2.0 | 715 |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../tools'))
import files
import graphs
def main(argv):
n, m, edges = files.read_graph(argv[0])
nodes = [n for n in xrange(1, n + 1)]
degree = graphs.degree_table(edges, directed = False)
print ' '.join(str(degre... | cowboysmall/rosalind | src/heights/rosalind_deg.py | Python | mit | 400 |
from yowsup_ext.layers.store import db
import peewee
import datetime
class Broadcast(db.get_base_model()):
wId = peewee.CharField() #Can't remember so far what that was for, but it's in openwa so maybe important
created = peewee.DateTimeField(default=datetime.datetime.now()) | vaginessa/yowlayer-store | yowsup_ext/layers/store/models/broadcast.py | Python | gpl-3.0 | 284 |
def is_hiragana(ch):
return 0x3040 <= ord(ch) <= 0x309F
def is_katakana(ch):
return 0x30A0 <= ord(ch) <= 0x30FF
def get_character_type(ch):
if ch.isspace():
return 'ZSPACE'
elif ch.isdigit():
return 'ZDIGIT'
elif ch.islower():
return 'ZLLET'
elif ch.isupper():
... | Hironsan/HotPepperGourmetDialogue | modules/LanguageUnderstanding/utils/utils.py | Python | mit | 3,481 |
from core.environment import logger
import datasource
# exception pass-through
from datasource import NoSuchTable, DuplicateEntry
from core.utils import *
import re
import copy
_db = None
def getDB():
global _db
if not _db:
_db = datasource.MySQLDataSource(logger=logger)
return _db
def setDB(db):
global _... | palli/statmon | statmon/model.py | Python | gpl-3.0 | 19,026 |
# Copyright 2011-2013 Kwant authors.
#
# This file is part of Kwant. It is subject to the license terms in the file
# LICENSE.rst found in the top-level directory of this distribution and at
# http://kwant-project.org/license. A list of Kwant authors can be found in
# the file AUTHORS.rst at the top-level directory o... | adriaanvuik/solid_state_physics | lll.py | Python | bsd-2-clause | 6,649 |
# -*- coding: utf-8 -*-
"""
Unit tests for reverse URL lookups.
"""
from __future__ import unicode_literals
import sys
import unittest
from admin_scripts.tests import AdminScriptTestCase
from django.conf import settings
from django.conf.urls import include, url
from django.contrib.auth.models import Use... | yephper/django | tests/urlpatterns_reverse/tests.py | Python | bsd-3-clause | 50,926 |
# coding=utf-8
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import hashlib
import os
from pex.interpreter import PythonInterpreter
from pants.backe... | foursquare/pants | src/python/pants/backend/python/tasks/select_interpreter.py | Python | apache-2.0 | 4,991 |
# Copyright 2014 Cloudbase Solutions Srl
# 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 r... | theanalyst/cinder | cinder/volume/drivers/windows/vhdutilsv2.py | Python | apache-2.0 | 2,192 |
import time,datetime,re, hashlib
from dateutil import tz
import os
from .constants import YowConstants
import codecs, sys
import logging
import tempfile
import base64
import hashlib
import os.path, mimetypes
from .optionalmodules import PILOptionalModule, FFVideoOptionalModule
logger = logging.getLogger(__name__)
cla... | dazzzl/yowsup | yowsup/common/tools.py | Python | gpl-3.0 | 5,861 |
"""
a helper class for *HTTP* URL's
@NOTE: surely someone else has written this before, but, I couldn't find one, so I wrote this one.
@author: SodaPhish <[email protected]>
TODO:
* support other protocols other than HTTP
* add a timeout to gethostbyname lookups
"""
import sys,socket
from urlparse import ... | sodaphish/break | sp/net/URL.py | Python | mit | 2,738 |
import serial
import time
import random
import atexit
import GmailHandler as gm
def main():
try:
s = serial.Serial('COM3', 9600) #port is 11 (for COM12), and baud rate is 9600
time.sleep(2) #wait for the Serial to initialize
counter = 0
noNewMessagesAnimationCounter = 0
w... | bramvbilsen/Arduino-Mail-Notifier | ArduinoMailNotifier.py | Python | mit | 1,626 |
# coding: utf-8
from __future__ import unicode_literals
from __future__ import print_function
__author__ = 'dtrillo'
import requests
class Downloading:
""" Clase para recuperar código HTML de una URL """
def necesita_proxy(self):
url = "http://www.bing.es"
html = self._get_url(url)
if... | Paco1994/sportbot | sportbot/sportbot/downloads.py | Python | gpl-3.0 | 2,039 |
import re
from uuid import uuid1
from datetime import datetime, date
import dateutil.relativedelta
from icalendar import Calendar
from icalendar import Event
def display(cal):
return cal.to_ical().decode('utf-8').replace('\r\n', '\n').strip()
def get_ics(schedule):
cal = Calendar()
cal['version'] = '2.... | zhanganyuan/ReCalendar | schedule_to_ics.py | Python | mit | 4,510 |
# function to call the main analysis/synthesis functions in software/models/sineModel.py
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import get_window
import os, sys
sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/'))
import utilFunctions as UF
import sineM... | zangsir/sms-tools | software/models_interface/sineModel_function.py | Python | agpl-3.0 | 2,756 |
# -*- coding: utf-8 -*-
# Copyright(C) 2010-2011 Julien Veyssier
#
# This file is part of weboob.
#
# weboob is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at yo... | laurent-george/weboob | modules/cic/browser.py | Python | agpl-3.0 | 8,378 |
#!/usr/bin/env python
# coding:utf-8
__author__ = 'coderzh'
import os
import re
import subprocess
from datetime import datetime
# replace to vim or others if your like
# EDITOR = ['MarkdownPad2.exe']
EDITOR = ['atom']
if __name__ == '__main__':
post_name = raw_input("Post'title: ")
post_path = 'post/{year}... | longlizl/lilong-hugo-blog | create-post.py | Python | mit | 1,234 |
from django.shortcuts import render, get_object_or_404
from django.contrib.auth.decorators import login_required
from keycheck.forms import addKey
from keycheck.models import GpgKey, Mail
from utils import updateUserMails, makeAdmin
def index(request):
'''
the index view should give an overview of keybiz's capabilit... | nomnomtom/keybiz | keycheck/views.py | Python | agpl-3.0 | 2,422 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free So... | Alignak-monitoring/alignak | tests/test_business_correlator_recursive_bp_rules.py | Python | agpl-3.0 | 4,287 |
import account_bank_statement
import account_invoice
import account_journal
| 3dfxsoftware/cbss-addons | account_bank_statement_vauxoo/model/__init__.py | Python | gpl-2.0 | 76 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.