code stringlengths 3 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int64 3 1.05M |
|---|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from config import *
if config.config_usr_info_storage is "sqlite":
import sqlite_store as key_storage
elif config.config_usr_info_storage is "mysql":
import mysql_store as key_storage
elif config.config_usr_info_storage is "file":
import file_store as key_storage
else... | lifulong/account-manager | src/core/store.py | Python | gpl-2.0 | 538 |
#!/usr/bin/python
### github.com/bl4de | hackerone.com/bl4de ###
import sys
import hashlib
import urllib
import base64
description = """
hasher.py - hash string using SHA1, MD5, Base64, Hex, Encode URL etc.
usage: ./hasher.py [string_to_hash]
"""
def usage():
print description
exit(0)
... | bl4de/security-tools | hasher.py | Python | mit | 880 |
from django.db import models
from django.conf import settings
def get_path(instance, second):
print(second)
return instance.path
# Create your models here.
class Document(models.Model):
CAN_VIEW = 'can_view_document'
CAN_DELETE = 'can_delete_document'
CAN_UPDATE = 'can_change_document'
filena... | apiaas/drawer-api | document/models.py | Python | apache-2.0 | 881 |
try:
unicode
except NameError:
raise ImportError
from pybench import Test
from string import join
class ConcatUnicode(Test):
version = 2.0
operations = 10 * 5
rounds = 60000
def test(self):
# Make sure the strings are *not* interned
s = unicode(join(map(str,... | google/google-ctf | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Tools/pybench/Unicode.py | Python | apache-2.0 | 11,642 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.text}.
"""
from cStringIO import StringIO
from twisted.trial import unittest
from twisted.python import text
sampleText = \
"""Every attempt to employ mathematical methods in the study of chemical
questions must ... | skycucumber/Messaging-Gateway | webapp/venv/lib/python2.7/site-packages/twisted/test/test_text.py | Python | gpl-2.0 | 6,494 |
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | googleapis/python-dialogflow | google/cloud/dialogflow_v2/services/session_entity_types/transports/grpc.py | Python | apache-2.0 | 18,035 |
#!/usr/bin/env python
import sys
import yaml
from PIL import Image
import math
def find_bounds(map_image):
x_min = map_image.size[0]
x_end = 0
y_min = map_image.size[1]
y_end = 0
pix = map_image.load()
for x in range(map_image.size[0]):
for y in range(map_image.size[1]):
va... | OSUrobotics/long-term-mapping | timemap_server/scripts/crop_map.py | Python | gpl-2.0 | 2,296 |
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from scipy.fftpack import fft, ifft, rfft, irfft
from .utils import sizeof_fmt, logger, get_config, warn, _explain_exception
# Support CUDA for FFTs; requires scikits.cuda and pycuda
_cuda_capable = False
_multiply_inpla... | jniediek/mne-python | mne/cuda.py | Python | bsd-3-clause | 15,317 |
class Queue:
"""Stack class represents a first-in-first-out (FIFO) stack of objects"""
def __init__(self):
self.items = []
# def isEmpty(self):
# code this method such that it returns a boolean when the stack is empty
def enqueue(self, item):
self.items.insert(0, item)
# def ... | sjamcsclub/ROOM-B-CS-Club-Materials | Stacks and Queues/Student Queue.py | Python | gpl-3.0 | 520 |
import unittest
import epidb_client
from epidb_client import EpiDBClient
from epidb_client.tests import config
class LiveResponseSubmitTestCase(unittest.TestCase):
def setUp(self):
self.client = EpiDBClient(config.api_key)
self.client.server = config.server
self.answers = {'q0000': '0',
... | ISIFoundation/influenzanet-epidb-client | src/epidb_client/tests/test_live_response_submit.py | Python | agpl-3.0 | 1,878 |
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2008 Doug Hellmann All rights reserved.
#
"""Burning a candle at both ends.
"""
__version__ = "$Id$"
#end_pymotw_header
import collections
import threading
import time
candle = collections.deque(xrange(11))
def burn(direction, nextSource):
while True:
... | qilicun/python | python2/PyMOTW-1.132/PyMOTW/collections/collections_deque_both_ends.py | Python | gpl-3.0 | 731 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, ConfigParser, tweepy, inspect, hashlib
path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
# read config
config = ConfigParser.SafeConfigParser()
config.read(os.path.join(path, "config"))
# your hashtag or search query and tweet l... | rmkmahesh/twitter-retweet-bot | retweet.py | Python | mpl-2.0 | 2,615 |
# Copyright (C) 2012 Google 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:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | loveyoupeng/rt | modules/web/src/main/native/Tools/Scripts/webkitpy/performance_tests/perftestsrunner_integrationtest.py | Python | gpl-2.0 | 29,978 |
import numpy as np
from collections import defaultdict
ingredients = ['milk', 'egg', 'sugar', 'salt', 'flour']
fillings = ['banana', 'strawberry jam', 'chocolate', 'walnut']
cake_ingredients = np.array([8.0, 8.0, 4.0, 1.0, 9.0])
cake_fillings = {
'banana': [1, 0, 0, 0],
'strawberry': [0, 30, 0, 0],
... | tuestudy/ipsc | 2011/P/pancake-dgoon-easy.py | Python | mit | 899 |
import setpath
import functions
import random
# coding: utf-8
import math
import json
from fractions import Fraction
def dummycode(*args):
# if type(args[0]) not in (str,unicode):
# yield args[0]
rid = args[0]
colname = args[1]
val = args[2]
values = json.loads(args[3])
values.pop(0)... | alexpap/exareme | exareme-tools/madis/src/functionslocal/row/linearregressionR.py | Python | mit | 1,267 |
# Outspline - A highly modular and extensible outliner.
# Copyright (C) 2011-2014 Dario Giovannetti <dev@dariogiovannetti.net>
#
# This file is part of Outspline.
#
# Outspline 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 Softw... | xguse/outspline | src/outspline/extensions/organism_basicrules/occur_regularly_group.py | Python | gpl-3.0 | 5,426 |
import re
from jabbapylib.podium import podium
from jabbapylib.filesystem import ini
def test_read_ini():
ini_file = '{home}/.mozilla/firefox/profiles.ini'.format(home=podium.get_home_dir())
path = ini.read_ini('Profile0', ini_file)['path']
assert re.search('.{8}\.default', path) | jabbalaci/jabbapylib | tests/filesystem/test_ini.py | Python | gpl-3.0 | 293 |
import optparse
from os import curdir
from os.path import abspath
import sys
from autoscalebot.tasks import start_autoscaler
from autoscalebot import version
def main(args=sys.argv[1:]):
CLI_ROOT = abspath(curdir)
sys.path.insert(0, CLI_ROOT)
parser = optparse.OptionParser(
usage="%prog or type ... | wieden-kennedy/autoscalebot | autoscalebot/cli.py | Python | bsd-3-clause | 747 |
"""
Lovasz-Softmax and Jaccard hinge loss in PyTorch
Maxim Berman 2018 ESAT-PSI KU Leuven (MIT License)
"""
# from __future__ import print_function, division
import torch
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
try:
from itertools import ifilterfalse
except ImportEr... | Diyago/Machine-Learning-scripts | DEEP LEARNING/segmentation/Understanding-Clouds-from-Satellite-Images-master/losses/lovasz_losses.py | Python | apache-2.0 | 8,487 |
import crilib.repositories
import crilib.packaging
import crilib.server
serv = crilib.server.Server("server.yml")
ldr = crilib.packaging.PackageLoader()
pkg = crilib.repositories.PackageMeta("minecraft-vanilla", "MC1.11.2")
ldr.init_pkg(pkg)
ictx = crilib.packaging.InstallContext(pkg, serv)
bundle = ldr.find_inited... | treyzania/Craftitizer | cri/test.py | Python | mit | 416 |
# DESCRIPTION: Tests the performance of the engine.
# 4920646f6e5c2774206361726520696620697420776f726b73206f6e20796f7572206d61636869
# 6e652120576520617265206e6f74207368697070696e6720796f7572206d616368696e6521
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import time, unittest
from l... | kmiller96/Quark-ChessEngine | tests/test_performance.py | Python | mit | 7,450 |
"""
This is a simple example on how to use Flask and Asynchronous RPC calls.
I kept this simple, but if you want to use this properly you will need
to expand the concept.
Things that are not included in this example.
- Reconnection strategy.
- Consider implementing utility functionality for checking and gett... | eandersson/python-rabbitmq-examples | Flask-examples/amqpstorm_threaded_rpc_client.py | Python | gpl-3.0 | 3,624 |
from django import template
register = template.Library()
| aksh1/wagtail-cookiecutter-foundation | {{cookiecutter.repo_name}}/pages/templatetags/pages_tags.py | Python | mit | 58 |
# -*- coding: utf-8 -*-
"""
gspread.urls
~~~~~~~~~~~~
Google API urls.
"""
SPREADSHEETS_API_V4_BASE_URL = 'https://sheets.googleapis.com/v4/spreadsheets'
SPREADSHEET_URL = SPREADSHEETS_API_V4_BASE_URL + '/%s'
SPREADSHEET_BATCH_UPDATE_URL = SPREADSHEETS_API_V4_BASE_URL + '/%s:batchUpdate'
SPREADSHEET_VALUES_URL = SP... | LukeMurphey/splunk-google-drive | src/bin/google_drive_app/gspread/urls.py | Python | apache-2.0 | 688 |
# Written by Arno Bakker
# Updated by George Milescu
# see LICENSE.txt for license information
""" Simple definitions for the Tribler Core. """
import os
DLSTATUS_ALLOCATING_DISKSPACE = 0 # TODO: make sure this get set when in this alloc mode
DLSTATUS_WAITING4HASHCHECK = 1
DLSTATUS_HASHCHECKING = 2
DLSTATUS_D... | egbertbouman/tribler-g | Tribler/Core/simpledefs.py | Python | lgpl-2.1 | 5,719 |
import numpy as np
from numpy.random import randn
from numpy.testing import assert_almost_equal, dec
from dipy.reconst.vec_val_sum import vec_val_vect
def make_vecs_vals(shape):
return randn(*(shape)), randn(*(shape[:-2] + shape[-1:]))
try:
np.einsum
except AttributeError:
with_einsum = dec.skipif(True... | nilgoyyou/dipy | dipy/reconst/tests/test_vec_val_vect.py | Python | bsd-3-clause | 1,302 |
# -*- coding: utf-8 -*-
import pytest
from model_mommy import mommy
from oauth2_provider.models import (
get_access_token_model,
get_application_model
)
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory, force_authenticate
from django_toolkit import shortcuts
Applica... | luizalabs/django-toolkit | tests/test_shortcuts.py | Python | mit | 1,277 |
#
"""
"""
import os
import json
try:
import vtk
has_vtk = True
except ImportError:
has_vtk = False
def convert(data, in_format, out_format='json'):
"""
"""
if in_format == 'json':
pnm = json_to_json(data)
elif in_format == 'dat':
pnm = imperial_to_json(data)
elif in... | oliveirarodolfo/ipnm | ipnm/format_converter.py | Python | mit | 7,923 |
# This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'g:i A'
# DATETIME_FORMAT =
# YEAR_MONTH_FORMAT =
MONTH_DAY_FORMAT = 'j F'
SHO... | sametmax/Django--an-app-at-a-time | ignore_this_directory/django/conf/locale/hi/formats.py | Python | mit | 684 |
from flask import Flask, request, jsonify, send_from_directory
import os
import uuid
import shutil
import psycopg2
import urlparse
import json
from psycopg2.extras import Json
urlparse.uses_netloc.append("postgres")
url = urlparse.urlparse(os.environ["DATABASE_URL"])
conn = psycopg2.connect(
database=url.path[1:]... | spb201/turbulent-octo-rutabaga-api | app.py | Python | mit | 2,394 |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2016-03-05 13:59
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('proposals', '0022_auto_20160227_1637'),
]
operations = [
migrations.AddField... | pycontw/pycontw2016 | src/proposals/migrations/0023_auto_20160305_1359.py | Python | mit | 829 |
#$Id$
from books.model.PageContext import PageContext
from books.model.Instrumentation import Instrumentation
class TransactionList:
"""This class is used to create object for Transaction list."""
def __init__(self):
"""Initialize parameters for Transaction list object."""
self.transactions =... | zoho/books-python-wrappers | books/model/TransactionList.py | Python | mit | 1,583 |
"""Create a conduit from the available information.
Can try to examine './.arcconfig' and '~/.arcrc' if not enough
information is provided.
"""
# =============================================================================
# CONTENTS
# -----------------------------------------------------------------------------
# p... | valhallasw/phabricator-tools | py/phl/phlsys_makeconduit.py | Python | apache-2.0 | 10,069 |
from django.db import models
from django.db.models import Count
from belt.managers import SearchQuerySetMixin
class PostQuerySet(SearchQuerySetMixin, models.QuerySet):
pass
class CategoryQuerySet(SearchQuerySetMixin, models.QuerySet):
pass
class BlogQuerySet(SearchQuerySetMixin, models.QuerySet):
def... | marcosgabarda/django-belt | tests/app/managers.py | Python | mit | 406 |
bot_user = 'U041TJU13'
irc_channel = 'C040NNZHT'
outputs = []
def process_message(data):
message_text = data.get('text')
if message_text:
if (bot_user in message_text) and ('source' in message_text):
outputs.append([irc_channel, '`https://github.com/paulnurkkala/comm-slackbot`'])
| paulnurkkala/comm-slackbot | plugins/get_source/get_source.py | Python | gpl-2.0 | 297 |
# NOTE: For xVideos use the direct link, which should look something like this: "http://www.xvideos.com/video123456/blah_blah_blah"
# Plugin for gallery_get.
import re
# Each definition can be one of the following:
# - a string
# - a regex string
# - a function that takes source as a parameter and returns an array o... | regosen/gallery_get | gallery_plugins/plugin_xVideos.py | Python | mit | 1,251 |
from importlib import import_module
from django.apps import AppConfig as BaseAppConfig
class AppConfig(BaseAppConfig):
name = "ocp"
def ready(self):
import_module("ocp.receivers")
| FreedomCoop/valuenetwork | ocp/apps.py | Python | agpl-3.0 | 201 |
from typing import Optional, Sequence
from waitlist.storage.database import HistoryEntry, Shipfit
def create_history_object(target_id: int, event_type: str, source_id: Optional[int] = None,
fitlist: Optional[Sequence[Shipfit]] = None) -> HistoryEntry:
h_entry = HistoryEntry()
h_entr... | SpeedProg/eve-inc-waitlist | waitlist/utility/history_utils.py | Python | mit | 524 |
#!/usr/bin/env python
# This is only the automatic generated test file for ../restack.py
# This must be filled with real tests and this commentary
# must be cleared.
# If you want to help, read the python unittest documentation:
# http://docs.python.org/library/unittest.html
import sys
sys.path.append('..') # this li... | piksels-and-lines-orchestra/inkscape | share/extensions/test/restack.test.py | Python | gpl-2.0 | 711 |
# Copyright (c) 2008 Joost Cassee
# Licensed under the terms of the MIT License (see LICENSE.txt)
"""
This TinyMCE widget was copied and extended from this code by John D'Agostino:
http://code.djangoproject.com/wiki/CustomWidgetsTinyMCE
"""
import json
from django import forms
from django.conf import settings
from dj... | dani0805/django-tinymce4 | tinymce/widgets.py | Python | mit | 5,087 |
VERSION = (0, 7, 1, 'final', 0)
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
sub = ''
if VERSION[3] != 'final':
mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'}
sub = mapping[VERSION[3]] + str(VERSION[... | nagyistoce/geokey | geokey/version.py | Python | apache-2.0 | 350 |
from __future__ import absolute_import
from .base import Decider, DeciderPoller, DeciderWorker # NOQA # isort:skip
from . import command # NOQA # isort:skip
| botify-labs/simpleflow | simpleflow/swf/process/decider/__init__.py | Python | mit | 162 |
## -*- coding: utf-8 -*-
import logging
from os import environ
from subprocess import call
from createhdr.createhdr import ReadTif
from os.path import join, dirname
from celery import shared_task, group
from django.conf import settings
from django.contrib.gis.geos import MultiPolygon
from imagery.models import Image
... | ibamacsr/indicar-process | indicarprocess/catalogo/tasks.py | Python | agpl-3.0 | 3,329 |
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The niftyreg module provides classes for interfacing with `niftyreg
<http://sourceforge.net/projects/niftyreg/>`_ command line tools.
These are the base tools for working with ... | mick-d/nipype | nipype/interfaces/niftyreg/base.py | Python | bsd-3-clause | 5,517 |
############################################################################
# GENERAL MAPPINGS
############################################################################
from lily.contacts.models import Contact
lilyuser_to_owner_mapping = {
3: '', # 'sanne.bakker@voys.nl'
4: 'joris.beltman@voys.nl', # 'j... | HelloLily/hellolily | lily/hubspot/tenant_mappings/tenant_50.py | Python | agpl-3.0 | 11,733 |
"""Tests for ``amici.pandas``"""
import itertools
import amici
import numpy as np
import pytest
# test parameters for test_pandas_import_export
combos = itertools.product(
[(10, 5), (5, 10), ()],
repeat=3
)
cases = [{
'fixedParameters': combo[0],
'fixedParametersPreequilibration': combo[1],
'fix... | AMICI-developer/AMICI | python/tests/test_pandas.py | Python | bsd-2-clause | 1,653 |
"""
Diabicus: A calculator that plays music, lights up, and displays facts.
Copyright (C) 2016 Michael Lipschultz
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 3 of the License, or
(... | lipschultz/diabicus | resources/special_music.py | Python | gpl-3.0 | 2,129 |
# coding: utf-8
from __future__ import absolute_import
import flask
import auth
import config
import model
import util
from main import app
facebook_config = dict(
access_token_url='https://graph.facebook.com/v4.0/oauth/access_token',
api_base_url='https://graph.facebook.com/v4.0/',
authorize_url='https://ww... | lipis/github-stats | main/auth/facebook.py | Python | mit | 1,386 |
from __future__ import division
from builtins import str
from builtins import range
from builtins import object
from past.utils import old_div
import os
import math
import numpy as np
from osgeo import gdal
class RasterParameters(object):
def __init__(self, raster_x_size, raster_y_size, geo_trans, srs, number_of_... | JRoehrig/GIRS | girs/rast/parameter.py | Python | mit | 5,561 |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | tejal29/pants | src/python/pants/backend/codegen/tasks/jaxb_gen.py | Python | apache-2.0 | 6,748 |
# (C) 2017, Markus Wildi, markus.wildi@bluewin.ch
#
# 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, or (at your option)
# any later version.
#
# This program is distr... | RTS2/rts2 | scripts/u_point/unittest/rts2_environment.py | Python | lgpl-3.0 | 5,725 |
'''
Created on Jul 31, 2014
@author: David Zwicker <dzwicker@seas.harvard.edu>
This package provides class definitions for referencing a single video file.
This code has been modified from the project moviepy, which is released under
the MIT license at github:
https://github.com/Zulko/moviepy/blob/master/moviepy/vid... | david-zwicker/video-analysis | video/io/backend_ffmpeg.py | Python | bsd-3-clause | 28,074 |
from featuretools.entityset.relationship import Relationship, RelationshipPath
def test_relationship_path(es):
log_to_sessions = Relationship(es['sessions']['id'],
es['log']['session_id'])
sessions_to_customers = Relationship(es['customers']['id'],
... | Featuretools/featuretools | featuretools/tests/entityset_tests/test_relationship.py | Python | bsd-3-clause | 3,335 |
# -*- coding: UTF-8 -*-
#
# The MIT License
#
# Copyright (c) 2009-2012 Felix Schwarz <felix.schwarz@oss.schwarz.eu>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, i... | gpatonay/popy | pycerberus/api.py | Python | mit | 18,239 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organization', '0003_organization_color'),
]
operations = [
migrations.AddField(
m... | Inter-Actief/alexia | alexia/apps/organization/migrations/0004_location_color.py | Python | bsd-3-clause | 626 |
#!/usr/bin/env python
# Standard library imports
import argparse
import json
import logging
import logging.handlers
import threading
import time
# Additional library imports
import bottle
import RPIO
# The state history is stored in a flat file.
HISTORY_FILENAME = 'history.log'
# These are logical pin numbers ba... | lordjabez/garage-envoy | garage-envoy.py | Python | mit | 8,718 |
#Напишите программу, которая выводит имя, под которым скрывается Михаил Николаевич Румянцев.
#Дополнительно необходимо вывести область интересов указанной личности, место рождения,
#годы рождения и смерти (если человек умер), вычислить возраст на данный момент (или момент смерти).
#Для хранения всех необходимых данн... | Mariaanisimova/pythonintask | INBa/2015/KODZOKOV_M_M/task_4_9.py | Python | apache-2.0 | 1,454 |
# from koala.protocol import Koala
# from protocol import Koala
import sys, math, random
from routing_table import RoutingTable, NeighborEntry
from message import Message
from protocol import Koala
from util import Util
class Node(object):
DC_SIZE = 100
WORLD_SIZE = 100
MAGIC = 2
MAX_VAL = 999999
... | gtato/koala | prototype/koala/node.py | Python | gpl-3.0 | 15,912 |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The niftyreg module provides classes for interfacing with the `NiftyFit`_ command line tools.
Top-level namespace for niftyfit
"""
from .base import (Info)
from .dwi import (FitDwi, DwiTool)
from .asl ... | fprados/nipype | nipype/interfaces/niftyfit/__init__.py | Python | bsd-3-clause | 336 |
class A:
x = 1
y = 'hello'
class B:
z = 'bye'
class C(A,B):
def salutation(self):
return '%d %s %s' % (self.x, self.y, self.z)
inst = C()
print inst.salutation()
inst.x = 100
print inst.salutation()
| jjack15/CS402-Project-UTK | OnlinePythonTutor/v1-v2/tutorials/oop/oop_demo.py | Python | agpl-3.0 | 215 |
#!/usr/bin/python2
import sys
import csv
import os
def main(hippiefile, pairfile, out):
"""A script to take a file output by the HIPPIE script and match the pairs in it to a file containing protein pairs:
input:
hippiefile - output of HIPPIE script
pairfile - list of protein pairs
output:
... | gngdb/opencast-bio | scripts/hippiematch.py | Python | mit | 2,056 |
import hashlib
import zlib
###
# Returns MD5 checksum of argument data encoded in UTF-8
#
def md5Checksum(data):
"""
>>> file = open('tmp.txt', 'w')
>>> file.close()
>>> data = open('tmp.txt', 'r').read()
>>> md5Checksum(data.encode())
'd41d8cd98f00b204e9800998ecf8427e'
"""
... | aturki/pyATK | pyATK/Misc/Crypto.py | Python | mit | 1,498 |
import sys
import ceph_medic
import logging
from ceph_medic import runner, collector
from tambo import Transport
logger = logging.getLogger(__name__)
def as_list(string):
if not string:
return []
string = string.strip(',')
# split on commas
string = string.split(',')
# strip spaces
... | alfredodeza/ceph-doctor | ceph_medic/check.py | Python | mit | 2,944 |
#!/usr/bin/env python
from PIL import Image
import sys
sys.path.insert(0, r'../python/')
import encode
lut = [[0.8487,0.84751182,0.84479598,0.840213,0.83359314,0.8257851,0.814752,0.80006949,0.78216192,0.76060494,0.73658673,0.7086645,0.67777182,0.64475739,0.60987582,0.57134484,0.52729731,0.48562614,0.45167814],[0,0.0... | tangrams/data2image | example/lut.py | Python | mit | 817 |
"""
Test for JsonResponse and JsonResponseBadRequest util classes.
"""
import json
import unittest
import mock
from django.http import HttpResponse, HttpResponseBadRequest
from util.json_request import JsonResponse, JsonResponseBadRequest
class JsonResponseTestCase(unittest.TestCase):
"""
A set of tests t... | cpennington/edx-platform | common/djangoapps/util/tests/test_json_request.py | Python | agpl-3.0 | 4,846 |
#!/usr/bin/env python
'''
Pymodbus Asynchronous Client Examples
--------------------------------------------------------------------------
The following is an example of how to use the asynchronous modbus
client implementation from pymodbus.
'''
#------------------------------------------------------------------------... | mjfarmer/scada_py | pymodbus/examples/common/asynchronous-client.py | Python | gpl-3.0 | 5,916 |
import time
class Challenge:
MAX_TAGS = 5
def __init__(self, ctf_channel_id, channel_id, name, category):
"""
An object representation of an ongoing challenge.
ctf_channel_id : The slack id for the associated parent ctf channel
channel_id : The slack id for the associated chann... | OpenToAllCTF/OTA-Challenge-Bot | bottypes/challenge.py | Python | mit | 2,557 |
from rest_framework import serializers
from drf_haystack.serializers import HaystackSerializerMixin
from .models import {{ cookiecutter.model_name }}
from .search_indexes import {{ cookiecutter.model_name }}Index
class {{ cookiecutter.model_name }}Serializer(serializers.ModelSerializer):
class Meta:
mod... | rickydunlop/cookiecutter-django-app-template-drf-haystack | {{cookiecutter.app_name}}/serializers.py | Python | mit | 771 |
from __future__ import absolute_import
# The celery app must be loaded here to make the @shared_task decorator work.
from .celery import app as celery_app
| rmyers/dtrove-ui | raxui/__init__.py | Python | mit | 156 |
########################################################################
#
# File Name: HTMLDocument.py
#
#
"""
WWW: http://4suite.com/4DOM e-mail: support@4suite.com
Copyright (c) 2000 Fourthought Inc, USA. All Rights Reserved.
See http://4suite.com/COPYRIGHT for license and copyright informati... | selfcommit/gaedav | pyxml/dom/html/HTMLDocument.py | Python | lgpl-2.1 | 11,651 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################
# _______ ______ #
# |_ _\ \ / / ___| #
# | | \ \ / /\___ \ #
# | | \ V / ___) | #
# |_| \_/ |____/ #
# #
####################... | TeskeVirtualSystem/CloneInterface | clone.py | Python | gpl-2.0 | 8,341 |
#!/usr/bin/python
import sys
import signal
import logging
import daemon
import sniffer
class Service(daemon.Daemon):
"""
Usage:
service = Service(options)
service.run() # Interactive
service = Service(options)
service.start() # Daemon
"""
def __ini... | mkatircioglu/urlsniffer | urlsniffer/service.py | Python | gpl-2.0 | 992 |
import requests
import bs4
import webbrowser
import sys
# retrieve top search result links
print('googling...')
url = 'https://www.google.com'
print(url)
# res = requests.get(url)
proxies = {
'https': 'https://127.0.0.1:1080',
'http': 'http://127.0.0.1:1080'
}
# headers = {
# 'user-agent': 'Mozilla/5.0 (Wi... | sallyyoo/ced2 | py/practice/11/testLucky.py | Python | mit | 768 |
# coding:utf-8
"""
# decorator_run.py
#
# Copyright(C) by AbsentM. 2018
#
# Author: AbsentM
# Date: 2018/02/10
#
# Description:
# Use decorator function to execute simple run flow.
#
# decorator_run.py == simple_sun.py
#
"""
def wrapper(func):
"""
Define a wrapper function, and use function a... | absentm/Demo | Python-demo/decorator-demo/decorator_run.py | Python | mit | 1,023 |
from pandac.PandaModules import *
from direct.distributed.ClockDelta import *
from direct.task.Task import Task
from direct.interval.IntervalGlobal import *
from TrolleyConstants import *
from toontown.golf import GolfGlobals
from toontown.toonbase import ToontownGlobals
from direct.distributed import DistributedObject... | Spiderlover/Toontown | toontown/safezone/DistributedPicnicBasket.py | Python | mit | 23,489 |
#! /usr/bin/env python
# Copyright (c) 2010-2013 Magnus Olsson (magnus@minimum.se)
# See LICENSE for details
"""awsxd - AWS-X GSM weather station daemon
This application implements an server for reception of AWS-X GSM weather
station UDP packets. For each received packet, the contents will be decoded,
verified and ins... | WindWiz/awsx-daemon | awsxd.py | Python | gpl-3.0 | 11,645 |
"""
WSGI config for apiDamificados project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
settingsEnv = "apiDamificad... | ramrodo/devfbackend-api | apiDamificados/apiDamificados/wsgi.py | Python | mit | 552 |
from django import template
from django.conf import settings
register = template.Library()
@register.assignment_tag
def settings_value(name):
return getattr(settings, name, "")
@register.assignment_tag
def is_topology_model(model):
return hasattr(model, 'kind') and hasattr(model, 'offset')
| mabhub/Geotrek | geotrek/common/templatetags/geotrek_tags.py | Python | bsd-2-clause | 304 |
"""
Finding isomorphic/canonical representations of the flop.
In Texas Holdem suits have no intrinsic value. Thus, if the flop is "2d 3d 4d",
the possible holecards "5c 6c", "5h 6h", and "5s 6s" are equivalent -- they are
each a straight and the suits are irrelevant. Similarly, the flop "4d 3d 2d" is
equivalent to the... | mjwestcott/PyPokertools | examples/isomorph.py | Python | mit | 10,374 |
# Generated by Django 3.1.2 on 2020-10-21 02:11
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('files', '0004_image_compressed'),
('inventory', '0007_auto_20201021_0154'),
]
operations = [
migrat... | hackerspace-ntnu/website | inventory/migrations/0008_auto_20201021_0211.py | Python | mit | 527 |
# 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... | cernops/keystone | keystone/token/_simple_cert.py | Python | apache-2.0 | 3,268 |
"""
Support for binary sensors using Tellstick Net.
This platform uses the Telldus Live online service.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.tellduslive/
"""
import logging
from homeassistant.components import binary_sensor, te... | PetePriority/home-assistant | homeassistant/components/tellduslive/binary_sensor.py | Python | apache-2.0 | 1,646 |
"""
we use this to mark the active ccx, for use by ccx middleware and some views
"""
ACTIVE_CCX_KEY = '_ccx_id'
| dkarakats/edx-platform | lms/djangoapps/ccx/__init__.py | Python | agpl-3.0 | 112 |
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class GameInformerIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?gameinformer\.com/(?:[^/]+/)*(?P<id>.+)\.aspx'
_TEST = {
'url': 'http://www.gameinformer.com/b/features/archive/2015/09/26/replay-animal-cro... | epitron/youtube-dl | youtube_dl/extractor/gameinformer.py | Python | unlicense | 1,315 |
# Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
"""Unit tests for :func:`iris.analysis.cartography._xy_range`"""
# Import iris.tests first so that some things can be initial... | pp-mo/iris | lib/iris/tests/unit/analysis/cartography/test__xy_range.py | Python | lgpl-3.0 | 1,628 |
from django.shortcuts import render
from django.views import View
class SiteUpdateNotifier(View):
def get(self, request):
pass
| k00n/site_update_notifier | siteUpdateNotifier/sun/views.py | Python | mit | 141 |
# -*- coding: utf-8 -*-
"""
Created on Tue May 31 19:59:03 2016
@author: Stella Psomadaki
"""
#run for mini
import os
import time
from tabulate import tabulate
from pointcloud.AbstractQuerier import Querier
import pointcloud.oracleTools as ora
###########################
### Setup Variables ###
... | stpsomad/DynamicPCDMS | pointcloud/run/zand/loose_ranges_glueing.py | Python | isc | 3,080 |
import unittest
from pymacaron_core.swagger.api import API
from pymacaron_core.models import get_model
from pymacaron_core.models import PyMacaronModel
#
# Swagger spec
#
yaml_str = """
swagger: '2.0'
info:
version: '0.0.1'
host: some.server.com
schemes:
- http
produces:
- application/json
definitions:
Foo:... | erwan-lemonnier/klue-client-server | test/test_model.py | Python | bsd-3-clause | 7,677 |
from rgp import rgp
class rgp_hm(rgp):
pass
| hiqdev/reppy | heppy/modules/rgp_hm.py | Python | bsd-3-clause | 49 |
import numpy as np
from scipy.optimize import differential_evolution as DE
from scipy.special import exp1
try:
# If this import is not done outside main(), then eval() fails in the
# definition of the moves
from emcee import moves
except ImportError:
pass
import warnings
from ..best_fit.bf_common impor... | asteca/ASteCA | packages/data_analysis/plx_analysis.py | Python | gpl-3.0 | 9,707 |
from sqlalchemy.sql import select
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine, Column, Integer, String, Float, Date, MetaData
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
import sqlite3
from xlrd import open_workbook
import re
import click
from datet... | maxwell-lv/MyQuant | ssd.py | Python | gpl-3.0 | 7,030 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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 later version.
#
# Ansible is distribut... | sivel/ansible-modules-core | network/sros/sros_command.py | Python | gpl-3.0 | 7,892 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | googlefonts/nanoemoji | src/nanoemoji/write_font.py | Python | apache-2.0 | 29,050 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import six
from agate import Table
from agate.data_types import *
from agate.testcase import AgateTestCase
class TestPrintTable(AgateTestCase):
def setUp(self):
self.rows = (
('1.7', 2000, 'a'),
('11.18', None, None),
('0',... | onyxfish/agate | tests/test_table/test_print_table.py | Python | mit | 3,803 |
import socket # Import socket module
s = socket.socket() # Create a socket object
host = socket.gethostname() # Get local machine name
port = 8082 # Reserve a port for your service.
s.connect((host, port))
s.send("send".encode())
check = s.recv(1024).decode()
print(check)
whil... | ukholiday94/Project | 1stStep/client.py | Python | gpl-3.0 | 634 |
# 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 textwrap import... | sameerparekh/pants | tests/python/pants_test/backend/core/tasks/test_filter.py | Python | apache-2.0 | 9,825 |
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import load_backend, login
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.shortcuts import redirect
from importlib import import_module
from django.utils import six
from django.contrib.au... | digris/openbroadcast.org | website/tools/loginas/views.py | Python | gpl-3.0 | 2,714 |
import sys
from PyQt4 import QtGui
import Ui_MainWindow
import AddFloorDialog
import OpenFloorDialog
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
self.ui = Ui_MainWindow.Ui_MainWindow();
self.ui.setupUi(self);
self.ui.actionNew.triggered.... | shufeike/TerrianEditor | main.py | Python | gpl-2.0 | 873 |
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, cstr
from frappe import _
from datetime import date, timedelta
from datetime import datetime
#from frappe.utils import now, add_minutes
def execute(filters=None):
columns, data = [], []
columns = get_columns()
data = get_re... | shitolepriya/Saloon_erp | erpnext/crm/report/todays_appointments/todays_appointments.py | Python | agpl-3.0 | 1,158 |
"""
Quotes
======
The ``quotes`` plugin can be used to capture quotes in a database. It will also
print a quote containg the name of the joining person on every join.
It provides the following commands:
- ``qadd <quote>``
Adds a new quote to the database
- ``qdelete <quote id>``
Admin only.
Deletes the quo... | mineo/lala | lala/plugins/quotes.py | Python | mit | 10,919 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.