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 |
|---|---|---|---|---|---|---|
import argparse
import parsl
from parsl.app.app import python_app
from parsl.tests.configs.local_threads import config
@python_app(cache=True)
def random_uuid(x, cache=True):
import uuid
return str(uuid.uuid4())
def test_python_memoization(n=2):
"""Testing python memoization disable
"""
x = ran... | Parsl/parsl | parsl/tests/test_python_apps/test_memoize_1.py | Python | apache-2.0 | 976 | 0 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim: ts=4:sw=4:sts=4:ai:et:fileencoding=utf-8:number
import sys
if sys.version_info < (3, 0):
python_OldVersion = True
else:
python_OldVersion = False
import pprint
from sqlalchemy import Column, ForeignKey, Integer, String, Boolean, Table, or_, CHAR, Enum
... | jiquintana/proxy-final | db_model/db_layer.py | Python | gpl-3.0 | 30,743 | 0.009791 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import subprocess
import sys
from ....tests.helper import pytest
def test_wcsapi_extension(tmpdir):
# Test that we can build a simple C extension with the... | piotroxp/scibibscan | scib/lib/python3.5/site-packages/astropy/wcs/tests/extension/test_extension.py | Python | mit | 2,891 | 0.001038 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""shortener URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a... | elijah74/django-url-shortener | base/conf/urls/all.py | Python | bsd-3-clause | 915 | 0 |
from contextlib import suppress
import asyncio
from concurrent.futures import CancelledError
from .exceptions import SetupException
class AsyncioRunning:
"base runner class that sets up and runs the loop & payload"
RESTART_DELAY = 15 # seconds until waiter & runner are restarted
# these three required per ... | koodaamo/asynciohelpers | asynciohelpers/service.py | Python | gpl-3.0 | 6,449 | 0.021244 |
# from i2clibraries import i2c_hmc58831
from socket import socket
from socket import AF_INET
from socket import SOCK_STREAM
from socket import error as socket_error
from time import sleep
from time import time
from struct import pack
from datetime import datetime
from threading import Thread
import config
import ParKin... | sialm/par_king | client/ParKingClient.py | Python | mit | 11,117 | 0.004408 |
"""
Helper methods for working with learning contexts
"""
from edx_django_utils.plugins import PluginManager
from opaque_keys import OpaqueKey
from opaque_keys.edx.keys import LearningContextKey, UsageKeyV2
from openedx.core.djangoapps.xblock.apps import get_xblock_app_config
class LearningContextPluginManager(Plugi... | stvstnfrd/edx-platform | openedx/core/djangoapps/xblock/learning_context/manager.py | Python | agpl-3.0 | 1,895 | 0.001583 |
import unittest
import asyncio
from pulsar import send
from pulsar.apps.test import test_timeout
from .manage import DiningPhilosophers
class TestPhylosophers(unittest.TestCase):
app_cfg = None
concurrency = 'thread'
@classmethod
@asyncio.coroutine
def setUpClass(cls):
app = DiningPhilo... | dejlek/pulsar | examples/philosophers/tests.py | Python | bsd-3-clause | 1,021 | 0 |
# -*- coding: utf-8 -*-
import os
import grp
import tempfile
from django.conf import settings
from utilities import encoding
import shutil
import zipfile
gid = None
if (settings.USEPRAKTOMATTESTER):
gid = grp.getgrnam('praktomat').gr_gid
def makedirs(path):
if os.path.exists(path):
return
else:
... | KITPraktomatTeam/Praktomat | src/utilities/file_operations.py | Python | gpl-2.0 | 3,099 | 0.002259 |
import numpy as np
import matplotlib.pyplot as plt
import time
def regions(seed=0, randspots, activityrate=1, cyclelength=1, cycleoverlap=0,
maxlat=70, minlat=0, tsim=1000, tstart=0, dir="."):
"""
inputs
activityrate - number of bipoles (1= solar)
cyclelength - length of cycle in years
... | RuthAngus/LSST-max | code/soft/regions.py | Python | mit | 5,812 | 0.025292 |
from novaclient import exceptions
from novaclient.v1_1 import security_group_rules
from novaclient.tests import utils
from novaclient.tests.v1_1 import fakes
cs = fakes.FakeClient()
class SecurityGroupRulesTest(utils.TestCase):
def test_delete_security_group_rule(self):
cs.security_group_rules.delete(1)... | tylertian/Openstack | openstack F/python-novaclient/novaclient/tests/v1_1/test_security_group_rules.py | Python | apache-2.0 | 2,485 | 0.002414 |
from proteus import *
from dambreak_Ubbink_medium import *
from ls_consrv_p import *
timeIntegrator = ForwardIntegrator
timeIntegration = NoIntegration
femSpaces = {0:basis}
subgridError = None
massLumping = False
numericalFluxType = DoNothing
conservativeFlux = None
shockCapturing = None
fullNewton... | erdc-cm/air-water-vv | 3d/dambreak_Ubbink/dambreak_Ubbink_medium/ls_consrv_n.py | Python | mit | 982 | 0.01222 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: omi
# @Date: 2014-08-24 22:08:33
# @Last Modified by: omi
# @Last Modified time: 2015-03-30 23:36:21
'''
__ ___________________________________________
| \ ||______ | |______|_____||______|______
| \_||______ | |______| |______||______
... | chaserhkj/musicbox | setup.py | Python | mit | 1,899 | 0.003686 |
# Natural Language Toolkit: SemCor Corpus Reader
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Nathan Schneider <nschneid@cs.cmu.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Corpus reader for the SemCor Corpus.
"""
from __future__ import absolute_import, unicode_literals... | MyRookie/SentimentAnalyse | venv/lib/python2.7/site-packages/nltk/corpus/reader/semcor.py | Python | mit | 11,106 | 0.005312 |
from .. import NextGenInstanceResource, NextGenListResource
class CredentialList(NextGenInstanceResource):
"""
A Credential List Resource.
See the `SIP Trunking API reference
<https://www.twilio.com/docs/sip-trunking/rest/credential-lists>_`
for more information.
.. attribute:: sid
T... | kramwens/order_bot | venv/lib/python2.7/site-packages/twilio/rest/resources/trunking/credential_lists.py | Python | mit | 1,709 | 0 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
# 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/l... | ruijie/quantum | quantum/tests/unit/test_linux_dhcp.py | Python | apache-2.0 | 23,666 | 0.000085 |
# -*- coding: utf-8 -*-
import os
import logging
from dotenv import find_dotenv, load_dotenv
from constants import *
import json
from utils import json_from_file, merge_json
import shutil
from settings import *
def prepare_train_data():
""" Runs data processing scripts to turn traning raw data from (../raw) into
... | iamhuy/rumour-veracity-verification | src/data/make_interim.py | Python | mit | 7,273 | 0.0044 |
import json
from django.test import TestCase
from rest_framework.test import APIRequestFactory
from helpcenter import models
from helpcenter.api import serializers
from helpcenter.api.testing_utils import full_url
from helpcenter.testing_utils import create_article, create_category
class TestArticleSerializer(Test... | smalls12/django_helpcenter | helpcenter/api/tests/test_serializers.py | Python | mit | 6,657 | 0 |
'''
Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
For example, given the range [5, 7], you should return 4.
'''
class Solution(object):
def rangeBitwiseAnd(self, m, n):
"""
:type m: int
:type n: int
... | gavinfish/leetcode-share | python/201 Bitwise AND of Numbers Range.py | Python | mit | 541 | 0.005545 |
#!/usr/bin/env python
## path configuration
caffe_root = './caffe'
script_path = '.'
caffe_model = script_path + '/soccer.prototxt'
caffe_weight = script_path + '/snapshot/superlatefusion_iter_15000.caffemodel'
caffe_inference_weight = script_path + '/superlatefusion_inference.caffemodel'
### start generate caffemode... | xionluhnis/decnet-scripts | test.py | Python | mit | 1,462 | 0.008208 |
#!/usr/bin/python
# -*- encoding: UTF-8 -*-
# SockBoatServer created on 15/8/30 下午3:49
# Copyright 2014 offbye@gmail.com
"""
"""
__author__ = ['"Xitao":<offbye@gmail.com>']
from SocketServer import ThreadingTCPServer, StreamRequestHandler
import traceback
import threading
import os,sys
from pi_pwm import PiPWM
... | offbye/PiBoat | pyboat/piboat.py | Python | apache-2.0 | 2,413 | 0.003374 |
# -*- coding: utf-8 -*-
__author__ = 'mkaplenko'
import httplib
import time
class MobilMoneySms(object):
def __init__(self, phone_to, message):
self.phone_to = phone_to
self.message = message
self.sync = int(time.time()*100)
class MobilMoneySmsClient(object):
connection_host = 'gate.... | mkaplenko/mobilmoney_sms | client.py | Python | gpl-2.0 | 1,933 | 0.001046 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emmanuel Girardin <emmanuel.girardin@outlook.com>
#
# The licence is in the fil... | emgirardin/compassion-modules | sbc_compassion/tools/zbar_wrapper.py | Python | agpl-3.0 | 2,203 | 0 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models
from odoo.tools.translate import html_translate
class DigestTip(models.Model):
_name = 'digest.tip'
_description = 'Digest Tips'
_order = 'sequence'
sequence = fields.Int... | t3dev/odoo | addons/digest/models/digest_tip.py | Python | gpl-3.0 | 784 | 0 |
# models.py
import os
import socket
import datetime
import random
import re
from django import forms
from django import urls
from django.db import models
from django.db.models.signals import pre_save
from .unique_slugify import unique_slugify
from .titlecase import titlecase
from functools import reduce
def time2s(... | CarlFK/veyepar | dj/main/models.py | Python | mit | 22,252 | 0.011639 |
import sys
from time import sleep
from colored import stylize, fg, attr
def flush(msg, err=None, fast=None, wait=0, code='reg'):
codes = dict(
error=fg('red') + attr('bold'),
reg=fg(28) + attr('bold'),
blue=fg('blue')
)
if err:
if fast:
print(stylize('\n[-] {0... | xybydy/kirilim | utils.py | Python | gpl-2.0 | 934 | 0 |
from PySide.QtGui import QTableWidget, QTableWidgetItem, QColor, QAbstractItemView
from PySide.QtCore import Qt
from angr.analyses.cfg.cfg_fast import MemoryData
from ...utils import filter_string_for_display
class QStringTableItem(QTableWidgetItem):
def __init__(self, mem_data, *args, **kwargs):
supe... | Ruide/angr-dev | angr-management/angrmanagement/ui/widgets/qstring_table.py | Python | bsd-2-clause | 3,604 | 0.001942 |
def __load():
import imp, os, sys
try:
dirname = os.path.dirname(__loader__.archive)
except NameError:
dirname = sys.prefix
path = os.path.join(dirname, 'wx._gdi_.pyd')
#print "py2exe extension module", __name__, "->", path
mod = imp.load_dynamic(__name__, path)
## ... | hanipcode/norinproject | build/bdist.win-amd64/winexe/temp/wx._gdi_.py | Python | mit | 358 | 0.011173 |
import machine
import time
DIAGNOSTIC_LED = None
try:
with open('config/diagnostic_led.pin', 'r') as fp:
invert = False
value = int(fp.read())
if value < 0:
value = -value
invert = True
DIAGNOSTIC_LED = machine.Signal(value, machine.Pin.OUT, invert=invert)
... | terrence2/OpenActuator | OpenActuator/app_a/diagnostic_led.py | Python | gpl-3.0 | 838 | 0.002387 |
from django.core.management import call_command
import pytest
from ideascube.mediacenter.tests.factories import DocumentFactory
from taggit.models import Tag
pytestmark = pytest.mark.django_db
def test_count_should_count_usage(capsys):
DocumentFactory.create_batch(size=4, tags=['tag1'])
call_command('tags'... | ideascube/ideascube | ideascube/tests/test_tags_command.py | Python | agpl-3.0 | 4,017 | 0.000747 |
#!/usr/bin/env python
# setup of the grid parameters
# default queue used for training
training_queue = { 'queue':'q1dm', 'memfree':'16G', 'pe_opt':'pe_mth 2', 'hvmem':'8G', 'io_big':True }
# the queue that is used solely for the final ISV training step
isv_training_queue = { 'queue':'q1wm', 'memfree':'32G', 'pe_opt... | guker/spear | config/grid/para_training_local.py | Python | gpl-3.0 | 1,092 | 0.032051 |
while True:
print('Enter your age:')
age = input()
if age.isdecimal():
break
print('Please enter a number for your age.')
while True:
print('Select a new password (letters and numbers only):')
password = input()
if password.isalnum():
break
print('Passwords can only have... | ir0nb8t/tutorials | automateTheBoringStuff/vailidateInput.py | Python | gpl-3.0 | 344 | 0 |
#!/usr/bin/env python
from ansible.module_utils.basic import AnsibleModule
from subprocess import Popen, PIPE
from os import path
import re
import yaml
def parse_verify_output(output_lines, pkg_name, pkg_ver=None,
ex_re_list=None, cmd_md5sum=False):
result = []
for line in output_lines... | aepifanov/mos_mu | modules/pkgs_verify_md5.py | Python | apache-2.0 | 4,932 | 0.003447 |
##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | uclouvain/OSIS-Louvain | education_group/ddd/service/write/copy_training_service.py | Python | agpl-3.0 | 2,322 | 0.002154 |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2020, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | ericmjl/bokeh | bokeh/core/validation/__init__.py | Python | bsd-3-clause | 3,227 | 0.005888 |
# -*- coding: utf-8 -*-
from base_writer import BaseWriter
class LuaWriter(BaseWriter):
def begin_write(self):
super(LuaWriter, self).begin_write()
self.output("module(...)", "\n\n")
def write_sheet(self, name, sheet):
self.write_value(name, sheet)
if name == "main_sheet":
self.write_value("main_length... | youlanhai/ExcelToCode | xl2code/writers/lua_writer.py | Python | mit | 2,039 | 0.038744 |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | e4p/dsub | dsub/providers/google.py | Python | apache-2.0 | 46,657 | 0.004479 |
from dsmr_parser import telegram_specifications
from dsmr_parser.objects import Telegram
from dsmr_parser.parsers import TelegramParser
from example_telegrams import TELEGRAM_V4_2
parser = TelegramParser(telegram_specifications.V4)
telegram = Telegram(TELEGRAM_V4_2, parser, telegram_specifications.V4)
print(telegram)
| ndokter/dsmr_parser | test/experiment_telegram.py | Python | mit | 320 | 0 |
# Copyright (c) 2015 Daniel Garcia
#
# See the file LICENSE.txt for copying permission.
import unittest
import random
from gameboard.gameboard import Gameboard, Direction
from gameboard.coordinate import Coordinate
class TestBoard(unittest.TestCase):
def setUp(self):
self.board = Gameboard()
def tes... | gamda/gameboard | gameboard/tests/unit_tests.py | Python | mit | 14,863 | 0.010496 |
import random
import numpy as np
import itertools, copy
def split_data_with_overlap(data_grouped_by_hour, valid_size, overlap_size, window_size,
overlap_interictal=True, overlap_preictal=True, random_state=42):
random.seed(random_state)
number_of_test_interictal_hours = max(1, int... | IraKorshunova/kaggle-seizure-prediction | utils/data_splitter.py | Python | mit | 4,982 | 0.004617 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Radim Rehurek <me@radimrehurek.com>
#
# This code is distributed under the terms and conditions
# from the MIT License (MIT).
#
"""Implements the majority of smart_open's top-level API.
The main functions are:
* ``parse_uri()``
* ``open()``
"""
import codecs
impor... | piskvorky/smart_open | smart_open/smart_open_lib.py | Python | mit | 15,002 | 0.001067 |
#!/bin/python
"""
Main user interface and controller for Tinbergen.
"""
import sys
import os
import gobject
import gtk
import gst
import tbdatamodel
import string
#import math
NO_TIME = float('nan')
if __name__ == '__main__':
# Get the path to this script using sys.argv[0]
script_dir = os.path.dirname(sys.a... | biogeo/tinbergen | tinbergen.py | Python | mit | 24,413 | 0.004956 |
# ~*~ coding: utf-8 ~*~
"""
tests.marshmallow.test_extension
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests for the :class:`MarshmallowAwareApp` to ensure that it will properly
register the extension and can be used, as well as testing the top level
schema.
"""
import pytest
from flask_marshmallow import fields
from fleaker i... | croscon/fleaker | tests/marshmallow/test_extension.py | Python | bsd-3-clause | 1,644 | 0.001217 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | roadmapper/ansible | lib/ansible/modules/cloud/google/gcp_compute_health_check.py | Python | gpl-3.0 | 47,123 | 0.004159 |
_base_ = [
'../_base_/models/cascade_mask_rcnn_r50_fpn.py',
'../_base_/datasets/coco_instance.py',
'../_base_/schedules/schedule_2x.py', '../_base_/default_runtime.py'
]
model = dict(
backbone=dict(
depth=101,
init_cfg=dict(type='Pretrained',
checkpoint='torchvisio... | open-mmlab/mmdetection | configs/seesaw_loss/cascade_mask_rcnn_r101_fpn_random_seesaw_loss_mstrain_2x_lvis_v1.py | Python | apache-2.0 | 4,807 | 0 |
I = complex(0,1)
ha2ev = 27.211396132
ev2cm1 = 8065.5440044136285
bohr2ang = 0.52917720859
atomic_mass = [ None, 1.00794, 4.002602, 6.941, 9.012182,
10.811, 12.0107, 14.0067, 15.9994, 18.9984032,
20.1797, 22.98976928, 24.305,26.9815386, 28.0855,
... | alexmoratalla/yambopy | yambopy/units.py | Python | bsd-3-clause | 2,898 | 0.007591 |
# -*- coding: utf-8 -*-
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import NotSupported
class bitstamp1 (Exchange):
def describe(self):
return self.deep_extend(super(bitstamp1, self).describe(), {
'id': 'bitstamp1',
'na... | tritoanst/ccxt | python/ccxt/bitstamp1.py | Python | mit | 10,277 | 0.001946 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | addition-it-solutions/project-all | addons/account_check_writing/report/check_print.py | Python | agpl-3.0 | 2,876 | 0.006259 |
# Copyright 2015 Tigera, 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 writing, ... | caseydavenport/calico-docker | tests/st/policy/test_profile.py | Python | apache-2.0 | 15,579 | 0.000514 |
# -*- encoding: utf-8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2017 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
#... | QubesOS/qubes-core-admin | qubes/tests/vm/appvm.py | Python | lgpl-2.1 | 7,275 | 0.001925 |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..preprocess import MaskTool
def test_MaskTool_inputs():
input_map = dict(args=dict(argstr='%s',
),
count=dict(argstr='-count',
position=2,
),
datum=dict(argstr='-datum %s',
),
dilate_inputs... | sgiavasis/nipype | nipype/interfaces/afni/tests/test_auto_MaskTool.py | Python | bsd-3-clause | 1,585 | 0.024606 |
import os, colorama, random_functions, module1, module2, module3, module4, module5, module6, module7
class Main1(random_functions.random_functions_class):
def tool_menu_front(self):
try:
colorama.init(autoreset=True)
self.seperator()
self.logo()
se... | deepak7mahto/ForensicsTool | ForensicsTool/ForensicsTool/Forensics_tool_redesigned_using_oops.py | Python | mit | 14,272 | 0.007077 |
from checkpy.assertlib.basic import *
| Jelleas/CheckPy | checkpy/assertlib/__init__.py | Python | mit | 38 | 0 |
# -*- coding: utf-8 -*-
#
# 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
... | mrares/incubator-airflow | tests/utils/log/test_logging.py | Python | apache-2.0 | 4,229 | 0.000473 |
# coding: utf-8
#
# drums-backend a simple interactive audio sampler that plays vorbis samples
# Copyright (C) 2009 C.D. Immanuel Albrecht
#
# 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 Fou... | immo/pyTOM | df/df_interpreter.py | Python | gpl-3.0 | 1,707 | 0.018161 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.9.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
# Bu... | drewUCL/Automation-Station | mysite/mysite/settings.py | Python | mit | 3,404 | 0.003231 |
from __future__ import division, print_function, absolute_import
import pkg_resources
__version__ = pkg_resources.get_distribution('pyworld').version
from .pyworld import *
| JeremyCCHsu/Python-Wrapper-for-World-Vocoder | pyworld/__init__.py | Python | mit | 176 | 0 |
# Mercurial extension to provide 'hg relink' command
#
# Copyright (C) 2007 Brendan Cully <brendan@kublai.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
"""recreates hardlinks between repository clones"""
from mercurial imp... | mikel-egana-aranguren/SADI-Galaxy-Docker | galaxy-dist/eggs/mercurial-2.2.3-py2.7-linux-x86_64-ucs4.egg/hgext/relink.py | Python | gpl-3.0 | 6,076 | 0.001317 |
import math
from sqlalchemy.sql import expression
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.types import DateTime
from blazeutils.strings import randchars
from keg.db import db
class utcnow(expression.FunctionElement):
type = DateTime()
@compiles(utcnow, 'postgresql')
def _pg_utcnow(element... | nZac/keg-elements | keg_elements/db/utils.py | Python | bsd-3-clause | 2,393 | 0.001672 |
import os
import sys
import time
import posixpath
import threading
if sys.version > '3':
import urllib.parse
from http.server import HTTPServer
from http.server import SimpleHTTPRequestHandler
else:
import urllib
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPReque... | braceio/tags | tags/generator.py | Python | mit | 7,669 | 0.002738 |
# Copyright (c) 2020 Dell Inc. or its subsidiaries.
# 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
#
# ... | openstack/cinder | cinder/tests/unit/volume/drivers/dell_emc/powermax/test_powermax_common.py | Python | apache-2.0 | 235,073 | 0.000009 |
from ajenti.api import *
from ajenti.plugins import *
info = PluginInfo(
title='Supervisor',
icon='play',
dependencies=[
PluginDependency('main'),
PluginDependency('services'),
BinaryDependency('supervisord'),
],
)
def init():
import main
| lupyuen/RaspberryPiImage | usr/share/pyshared/ajenti/plugins/supervisor/__init__.py | Python | apache-2.0 | 287 | 0 |
# -*- coding: utf-8 -*-
import copy
from lxml import etree, html
from openerp import SUPERUSER_ID, tools
from openerp.addons.website.models import website
from openerp.http import request
from openerp.osv import osv, fields
class view(osv.osv):
_inherit = "ir.ui.view"
_columns = {
'page': fields.bool... | rdeheele/odoo | addons/website/models/ir_ui_view.py | Python | agpl-3.0 | 9,428 | 0.003076 |
# Copyright (C) 2011-2012 Patrick Totzke <patricktotzke@gmail.com>
# This file is released under the GNU GPL, version 3 or a later revision.
# For further details see the COPYING file
import os
import email
import tempfile
import re
from email.header import Header
import email.charset as charset
charset.add_charset('u... | a-sk/alot | alot/db/utils.py | Python | gpl-3.0 | 15,380 | 0.001235 |
def LShift(t, k):
k %= 8
return ((t << k) | (t >> (8 - k))) & 0xff
def encode(p):
ret = ""
for i in range(8):
ret = ('|' if (p >> i) & 1 else 'O') + ret
return ret
A = [85, 128, 177, 163, 7, 242, 231, 69, 185, 1, 91, 89, 80, 156, 81, 9, 102, 221, 195, 33, 31, 131, 179, 246, 15, 139, 205,... | Qwaz/solved-hacking-problem | SSCTF/2016/Crypto&Exploit/HeHeDa/Algorithm1-577265e1.py | Python | gpl-2.0 | 3,529 | 0.001133 |
from lib.oauth2 import Consumer as OAuthConsumer, Token, Request as OAuthRequest, \
SignatureMethod_HMAC_SHA1
from urllib2 import Request, urlopen
from lib import simplejson
import config
# Twitter configuration
TWITTER_SERVER = 'api.twitter.com'
TWITTER_REQUEST_TOKEN_URL = 'https://%s/oauth/request... | sabirmostofa/app-engine-facebook | lib/twitter.py | Python | lgpl-3.0 | 4,934 | 0.003445 |
graph = {
'Sarijadi': ['Jl.Surya Sumantri'],
'Jl.Surya Sumantri': ['Pasteur'],
'Pasteur': ['Jl.Dr.Djunjunan'],
'Jl.Dr.Djunjunan': ['Jl.Pajajaran'],
'Jl.Pajajaran': ['Bandara Husain Sastra Negara'],
'Bandara Husain Sastra Negara': ['Band... | D4TI3A/KhaeraTunnisa1144044 | doc/Kuliah/Tugas2.py | Python | gpl-3.0 | 1,425 | 0.006316 |
'''
Main learner class.
@author: anze.vavpetic@ijs.si
'''
from collections import defaultdict
from hedwig.core import UnaryPredicate, Rule, Example
from hedwig.core.settings import logger
from hedwig.stats.significance import is_redundant
from hedwig.stats.scorefunctions import interesting
class BottomUpLearner:
... | anzev/hedwig | hedwig/learners/bottomup.py | Python | mit | 2,529 | 0.001186 |
from minimax_kata.executioner import Executioner
from minimax_kata.interface import WALL_SPACE_CHAR
from minimax_kata.interface import EMPTY_SPACE_CHAR
from minimax_kata.interface import PLAYER_ONE_TRAIL_CHAR
from minimax_kata.interface import PLAYER_TWO_TRAIL_CHAR
from minimax_kata.interface import PLAYER_ONE_CHARS
f... | JamesChristie/minimax_kata | minimax_kata/interface/char_policy.py | Python | gpl-3.0 | 1,673 | 0.012552 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from kivy.app import App
from kivy.properties import ObjectProperty
from kivy.uix.screenmanager import Screen
from precios import Precio
class Ventana(Screen):
precio = ObjectProperty
origen=""
destino=""
def Origen(self, origen):
self.origen = origen
print (origen)... | mdmirabal/Parcial2-Prog3 | main.py | Python | mit | 1,078 | 0.042672 |
"""Dependency tracking for trackable objects."""
# 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/li... | aldian/tensorflow | tensorflow/python/training/tracking/tracking.py | Python | apache-2.0 | 12,398 | 0.005565 |
#
# Race Capture App
#
# Copyright (C) 2014-2016 Autosport Labs
#
# This file is part of the Race Capture App
#
# This 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 ... | ddimensia/RaceCapture_App | autosportlabs/racecapture/views/configuration/rcp/wirelessconfigview.py | Python | gpl-3.0 | 3,591 | 0.005291 |
########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. 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... | codilime/cloudify-rest-client | cloudify_rest_client/blueprints.py | Python | apache-2.0 | 7,791 | 0 |
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.shortcuts import redirect, get_object_or_404
from django.template.response import TemplateResponse
from django.utils.translation import ugettext_lazy as _
from django.views.decorators.http import require_POST
fr... | papedaniel/oioioi | oioioi/forum/views.py | Python | gpl-3.0 | 11,557 | 0.000865 |
import psycopg2
import collections
import json
import sys
def consulta(query):
cursor.execute(query)
return cursor.fetchall()
def constroi_consulta_lista(lista_tabelas):
tabelas = ""
for tabela in lista_tabelas:
tabelas = tabelas + "'" + tabela + "',"
query = "SELECT distinct cl2.relname AS ref_table FROM ... | xandmaga/migracao_py-upsert | postgres-list-table.py | Python | mit | 6,300 | 0.012857 |
from FireGirlOptimizer import *
FGPO = FireGirlPolicyOptimizer()
###To create, uncomment the following two lines:
FGPO.createFireGirlPathways(10,50)
#FGPO.saveFireGirlPathways("FG_pathways_20x50.fgl")
###To load (already created data), uncomment the following line
#FGPO.loadFireGirlPathways("FG_pathways_20x50.fgl")
... | buckinha/gravity | deprecated/test_script_optimizer2.py | Python | mpl-2.0 | 1,197 | 0.016708 |
"""Basic Event item definition."""
from gaphas.geometry import Rectangle
from gaphas.util import path_ellipse
from gaphor.core.modeling import DrawContext
from gaphor.diagram.presentation import (
Classified,
ElementPresentation,
from_package_str,
)
from gaphor.diagram.shapes import Box, IconBox, Text, st... | amolenaar/gaphor | gaphor/RAAML/fta/basicevent.py | Python | lgpl-2.1 | 1,914 | 0.000522 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: yuchou
@time: 2017/8/7 10:28
""" | yuchou/xblog | blog/templatetags/__init__.py | Python | mit | 91 | 0.010989 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import RPi.GPIO as GPIO
import deviceConfig
import time
class Rele:
#Rele
valueRele = 0
def __init__(self):
GPIO.setup(deviceConfig.pinRele, GPIO.OUT)
GPIO.setup(deviceConfig.pinReleLed, GPIO.OUT)
GPIO.setup(deviceConfig.pinReleButton, GPIO.IN, pull_up_down=GP... | PascualArroyo/Domotics | Raspberry/rele.py | Python | gpl-2.0 | 1,058 | 0.038752 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | magic/tests/base.py | Python | agpl-3.0 | 22,419 | 0.003167 |
import unittest
import helper.config
import mock
from vetoes import config
class FeatureFlagMixinTests(unittest.TestCase):
def test_that_flags_are_processed_during_initialize(self):
settings = helper.config.Data({
'features': {'on': 'on', 'off': 'false'}
})
consumer = config... | dave-shawley/vetoes | tests/feature_flag_tests.py | Python | bsd-3-clause | 751 | 0 |
import glob
import os
import sys
import pyRootPwa
import pyRootPwa.utils
def parseMassBinArgs(allMassBins, massBinArg):
massBins = []
if massBinArg == "all":
massBins = allMassBins
elif ("-" in massBinArg) or ("," in massBinArg):
rawMassBinIndices = massBinArg.split(",")
massBinIndices = []
for massBinIn... | odrotleff/ROOTPWA | pyInterface/package/utils/_parseUtils.py | Python | gpl-3.0 | 3,290 | 0.029787 |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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
#
# Unle... | technige/py2neo | py2neo/cypher/queries.py | Python | apache-2.0 | 7,877 | 0.002158 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2009 Christopher Lenz
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
"""Mapping from raw JSON data structures to Python objects and vice versa.
>>> from couchdb import ... | ssaavedra/couchdb-python | couchdb/mapping.py | Python | bsd-3-clause | 22,390 | 0.001385 |
# Time: O(n)
# Space: O(1)
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
# Two pointers solution.
class Solution(object):
def plusOne(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""... | tudennis/LeetCode---kamyu104-11-24-2015 | Python/plus-one-linked-list.py | Python | mit | 1,560 | 0 |
from datetime import timedelta
import time
from pypi_portal.core.email import send_email, send_exception
from pypi_portal.extensions import mail, redis
def raise_and_send():
with mail.record_messages() as outbox:
try:
raise ValueError('Fake error.')
except ValueError:
send... | Robpol86/Flask-Large-Application-Example | tests/core/test_email.py | Python | mit | 1,330 | 0.001504 |
import errno
import os
from flask import current_app, abort
import ujson
import werkzeug.utils
def safe_mkdirs(path):
if os.path.exists(path):
return
try:
os.mkdir(path)
except OSError as e:
# Check for race conditions. If for some reason two threads/greenlets/whatever
# tries to create the sam... | shuhaowu/projecto | projecto/utils.py | Python | apache-2.0 | 5,402 | 0.01666 |
from django.contrib.staticfiles import storage
# Configure the permissions used by ./manage.py collectstatic
# See https://docs.djangoproject.com/en/1.10/ref/contrib/staticfiles/
class TTStaticFilesStorage(storage.StaticFilesStorage):
def __init__(self, *args, **kwargs):
kwargs['file_permissions_mode'] = 0... | Goodly/TextThresher | thresher_backend/storage.py | Python | apache-2.0 | 446 | 0.002242 |
from robot import Robot
class TheRobot(Robot):
def initialize(self):
# Try to get in to a corner
self.forseconds(5, self.force, 50)
self.forseconds(0.9, self.force, -10)
self.forseconds(0.7, self.torque, 100)
self.forseconds(6, self.force, 50)
# Then look around and... | CodingRobots/CodingRobots | robots/examples/Ninja.py | Python | gpl-3.0 | 2,216 | 0.000903 |
#!/usr/bin/python
import sys
import copy
# Create fruitlist
fruitlist = [u"Apples", u"Pears", u"Oranges", u"Peaches"]
# Display all fruit - helper method
def displayAllFruit(fruitlist):
sys.stdout.write("\nHere is the current list of fruit:\n")
sys.stdout.write(", ".join(fruitlist))
sys.stdout.write(... | AmandaMoen/AmandaMoen | students/KarlGentner/list_lab.py | Python | gpl-2.0 | 4,184 | 0.001195 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('course', '0010_auto_20151214_1714'),
]
operations = [
migrations.AddField(
model_name='coursechapter',
... | ttsirkia/a-plus | course/migrations/0011_auto_20151215_1133.py | Python | gpl-3.0 | 624 | 0.001603 |
import sys
import pygame
import time
from tetris_window import *
from tetrimino_factory import *
# TASK 0:
#
# Enter your group information:
#
GROUP_ID = 0
AUTHOR1 = 'Sait Celebi'
AUTHOR1_PURDUE_USERNAME = 'celebis'
AUTHOR2 = 'John Doe'
AUTHOR2_PURDUE_USERNAME = 'john123'
AUTHOR3 = 'Donald Knuth'
AUTHOR3_PURDUE_USERN... | amcw7777/python-exercises | cs177/project4/tetris.py | Python | apache-2.0 | 3,217 | 0.010258 |
from rest_framework import viewsets, permissions
import models
import serializers
class PageViewSet(viewsets.ModelViewSet):
"""
This viewset automatically provides `list`, `create`, `retrieve`,
`update` and `destroy` actions.
"""
queryset = models.Page.objects.all()
serializer_class = seriali... | esitamon/django-skeleton | app/website/api.py | Python | gpl-3.0 | 840 | 0.00119 |
#
# -*- coding: utf-8 -*-
#
# Copyright 2011 Voldemar Khramtsov <harestomper@gmail.com>
#
# 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 o... | itmages/itmages-service | itmagesd/common.py | Python | gpl-2.0 | 2,588 | 0.004637 |
from indivo.lib import iso8601
from indivo.models import EquipmentScheduleItem
XML = 'xml'
DOM = 'dom'
class IDP_EquipmentScheduleItem:
def post_data(self, name=None,
name_type=None,
name_value=None,
name_abbrev=None,
scheduled... | newmediamedicine/indivo_server_1_0 | indivo/document_processing/idp_objs/equipmentscheduleitem.py | Python | gpl-3.0 | 3,298 | 0.014554 |
# -*- coding: utf-8 -*-
# pylint: disable=I0011
""" rTorrent Queue Manager.
Copyright (c) 2012 The PyroScope Project <pyroscope.project@gmail.com>
"""
# 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 Fo... | pyroscope/pyrocore | src/pyrocore/torrent/queue.py | Python | gpl-2.0 | 6,987 | 0.00458 |
def extractNightskytlWordpressCom(item):
'''
Parser for 'nightskytl.wordpress.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loi... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractNightskytlWordpressCom.py | Python | bsd-3-clause | 560 | 0.033929 |
# Copyright (C) 2020 University of Konstanz - Data Analysis and Visualization Group
# This file is part of SciBib <https://github.com/dbvis-ukon/SciBib>.
#
# SciBib 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 Fo... | UKN-DBVIS/SciBib | app/backend/db_controller/query/authors_publications.py | Python | apache-2.0 | 1,871 | 0.003207 |
# This file is part of the Frescobaldi project, http://www.frescobaldi.org/
#
# Copyright (c) 2008 - 2014 by Wilbert Berendsen
#
# 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
... | wbsoft/frescobaldi | frescobaldi_app/snippet/import_export.py | Python | gpl-2.0 | 7,763 | 0.000902 |
"""Base class for undirected graphs.
The Graph class allows any hashable object as a node
and can associate key/value attribute pairs with each undirected edge.
Self-loops are allowed but multiple edges are not (see MultiGraph).
For directed graphs see DiGraph and MultiDiGraph.
"""
# Copyright (C) 2004-2015 by
# ... | chrisnatali/networkx | networkx/classes/graph.py | Python | bsd-3-clause | 55,144 | 0.000254 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.