code
stringlengths
2
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int32
2
1.05M
from __future__ import unicode_literals """ This module abstracts all the bytes<-->string conversions so that the python 2 and 3 code everywhere else is similar. This also has a few simple functions that deal with the fact that bytes are different between the 2 versions even when using from __future__ import unicode_...
openx/python3-protobuf
python/google/protobuf/internal/utils.py
Python
bsd-3-clause
3,630
########################################################################## # # Copyright (c) 2012, John Haddon. All rights reserved. # Copyright (c) 2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that ...
cedriclaunay/gaffer
python/GafferImageTest/OpenColorIOTest.py
Python
bsd-3-clause
4,580
# -*- coding: utf-8 -*- from copy import deepcopy from cms.admin.placeholderadmin import FrontendEditableAdminMixin, \ PlaceholderAdminMixin from django import forms from django.conf import settings from django.contrib import admin from django.contrib.auth import get_user_model from parler.admin import Translatable...
britny/djangocms-blog
djangocms_blog/admin.py
Python
bsd-3-clause
5,791
# Django settings for nadbproj project. import os.path DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'orac...
earonne/nadb-sample-site
nadb-sample-site/settings.py
Python
bsd-3-clause
4,940
from django import template import clevercss register = template.Library() @register.tag(name="clevercss") def do_clevercss(parser, token): nodelist = parser.parse(('endclevercss',)) parser.delete_first_token() return CleverCSSNode(nodelist) class CleverCSSNode(template.Node): def __init__(self, node...
amitu/gitology
src/gitology/d/templatetags/clevercsstag.py
Python
bsd-3-clause
480
import pyaf.Bench.TS_datasets as tsds import tests.artificial.process_artificial_dataset as art art.process_dataset(N = 128 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 5, transform = "None", sigma = 0.0, exog_count = 100, ar_order = 0);
antoinecarme/pyaf
tests/artificial/transf_None/trend_Lag1Trend/cycle_5/ar_/test_artificial_128_None_Lag1Trend_5__100.py
Python
bsd-3-clause
260
import codecs import os from setuptools import setup, find_packages def read(filename): filepath = os.path.join(os.path.dirname(__file__), filename) return codecs.open(filepath, encoding='utf-8').read() setup( name='lemon-filebrowser', version='0.1.2', license='ISC', description="Fork of Pat...
trilan/lemon-filebrowser
setup.py
Python
bsd-3-clause
998
from __future__ import print_function from __future__ import unicode_literals from builtins import str, bytes, dict, int import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from pattern.search import search, Pattern, Constraint from pattern.en import parsetree, parse, Sentenc...
clips/pattern
examples/04-search/02-constraint.py
Python
bsd-3-clause
2,667
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'RemoveInstanceDatabase' db.create_table(u'maintenance_rem...
globocom/database-as-a-service
dbaas/maintenance/migrations/0051_auto__add_removeinstancedatabase.py
Python
bsd-3-clause
78,775
#!/usr/bin/env python # # newsfetch.py # # kindle-newsfetch is a simple Python script which fetches calibre recipes, # turns them into Kindle newspapers using 'ebook-convert' and sends them to # the configured Kindle e-mail adress using 'calibre-smtp'. # # (c) 2011 Stefan Schleifer, see LICENSE-file import sys, os im...
stefanschleifer/kindle-newsfetch
newsfetch.py
Python
bsd-3-clause
10,161
""" Base backends structures. This module defines base classes needed to define custom OpenID or OAuth auth services from third parties. This customs must subclass an Auth and and Backend class, check current implementation for examples. Also the modules *must* define a BACKENDS dictionary with the backend name (whic...
makinacorpus/django-social-auth
social_auth/backends/__init__.py
Python
bsd-3-clause
31,390
"""Phone number to time zone mapping functionality >>> import phonenumbers >>> from phonenumbers.timezone import time_zones_for_number >>> ro_number = phonenumbers.parse("+40721234567", "RO") >>> tzlist = time_zones_for_number(ro_number) >>> len(tzlist) 1 >>> str(tzlist[0]) 'Europe/Bucharest' >>> mx_number = phonenumb...
vicky2135/lucious
oscar/lib/python2.7/site-packages/phonenumbers/timezone.py
Python
bsd-3-clause
4,947
from __future__ import unicode_literals from operator import attrgetter from django.db import models from django.test import TestCase from .models import Answer, Dimension, Entity, Post, Question class OrderWithRespectToTests(TestCase): @classmethod def setUpTestData(cls): cls.q1 = Question.object...
52ai/django-ccsds
tests/order_with_respect_to/tests.py
Python
bsd-3-clause
4,155
# Coordinate reference systems and functions. # # PROJ.4 is the law of this land: http://proj.osgeo.org/. But whereas PROJ.4 # coordinate reference systems are described by strings of parameters such as # # +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs # # here we use mappings: # # {'proj': 'longlat', 'ellps': '...
sgillies/Fiona
src/fiona/crs.py
Python
bsd-3-clause
5,254
#!/usr/bin/env python import sys import pymongo import json print "import crawled json file into mongodb 'newspapers' database." if len(sys.argv) < 3: print "input as [collection] [json_file]" exit(1) connection = pymongo.Connection("localhost", 27017) news_database = connection.newspapers news_collection = ...
ShiZhan/newspapers
utils/import-to-mongodb.py
Python
bsd-3-clause
637
"""Auto-generated file, do not edit by hand. BS metadata""" from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata PHONE_METADATA_BS = PhoneMetadata(id='BS', country_code=1, international_prefix='011', general_desc=PhoneNumberDesc(national_number_pattern='[2589]\\d{9}', possible_number_pattern='\...
WillisXChen/django-oscar
oscar/lib/python2.7/site-packages/phonenumbers/data/region_BS.py
Python
bsd-3-clause
1,927
from .service import Service class KickstarterService(Service): def get_supporters(self): r = self.get('kickstarter/') self.print_supporters(r) def print_supporters(self, s): for supporter in s: print("%-40s %s" % (str(supporter['name']), str(supporter['message']))) k...
dmonn/socialize
socialize/services/kickstarter_service.py
Python
bsd-3-clause
346
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '/Users/lee/backups/code/iblah_py/ui/ui_profile_dialog.ui' # # Created: Fri May 6 21:47:58 2011 # by: PyQt4 UI code generator 4.8.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fro...
williamyangcn/iBlah_py
ui/ui_profile_dialog.py
Python
bsd-3-clause
4,945
import backend # hopefully fixes issues with Celery finding tasks?
bleedingwolf/Spyglass
spyglass/__init__.py
Python
bsd-3-clause
68
from setuptools import setup, find_packages setup( name='django-test-html-form', version='0.1', description="Make your Django HTML form tests more explicit and concise.", long_description=open('README.rst').read(), keywords='django test assert', author='Dan Claudiu Pop', author_email='danc...
danclaudiupop/django-test-html-form
setup.py
Python
bsd-3-clause
546
import logging, os, random from zc.buildout import UserError, easy_install from zc.recipe.egg import Egg SETTINGS_TEMPLATE = ''' from %(settings_module)s import * SECRET_KEY = "%(secret)s" %(settings_override)s ''' SCRIPT_TEMPLATES = { 'wsgi': easy_install.script_header + ''' %(relative_paths_setup)s import s...
abstract-open-solutions/djc.recipe2
djc/recipe2/recipe.py
Python
bsd-3-clause
11,686
from datetime import datetime from django.test import TestCase from simple_history.signals import ( post_create_historical_record, pre_create_historical_record, ) from ..models import Poll today = datetime(2021, 1, 1, 10, 0) class PrePostCreateHistoricalRecordSignalTest(TestCase): def setUp(self): ...
treyhunner/django-simple-history
simple_history/tests/tests/test_signals.py
Python
bsd-3-clause
1,806
# -*- coding: utf-8 -*- """hamming.py: Return the Hamming distance between two integers (bitwise).""" __author__ = "Russell J. Funk" __date__ = "February 7, 2013" __copyright__ = "Copyright (C) 2013" __reference__ = ["http://wiki.python.org/moin/BitManipulation", "http://en.wikipedia.org/wiki/Hamming...
jkatzsam/matchtools
matchtools/hamming.py
Python
bsd-3-clause
1,270
#!/usr/bin/env python """ Example that displays how to switch between Emacs and Vi input mode. """ from prompt_toolkit import prompt from prompt_toolkit.enums import EditingMode from prompt_toolkit.key_binding.manager import KeyBindingManager from prompt_toolkit.keys import Keys from prompt_toolkit.styles import style...
melund/python-prompt-toolkit
examples/switch-between-vi-emacs.py
Python
bsd-3-clause
1,411
import datetime import numbers from django.db.models.fields import FieldDoesNotExist from django.utils import tree from django.core.exceptions import FieldError try: from django.db.models.sql.constants import LOOKUP_SEP except: from django.db.models.constants import LOOKUP_SEP class HStoreConstraint(): v...
erussell/hstore-field
hstore_field/query.py
Python
bsd-3-clause
6,295
import pytest from six.moves.urllib.parse import quote from ...api import MissingEntry from .base import BaseTestFormgrade from .manager import HubAuthNotebookServerUserManager @pytest.mark.formgrader @pytest.mark.usefixtures("all_formgraders") class TestGradebook(BaseTestFormgrade): def _click_element(self, n...
EdwardJKim/nbgrader
nbgrader/tests/formgrader/test_gradebook_navigation.py
Python
bsd-3-clause
12,452
# Copyright The IETF Trust 2007, All Rights Reserved # Django settings for ietf project. # BASE_DIR and "settings_local" are from # http://code.djangoproject.com/wiki/SplitSettings import os try: import syslog syslog.openlog("datatracker", syslog.LOG_PID, syslog.LOG_USER) except ImportError: pass BASE_DI...
mcr/ietfdb
ietf/settings.py
Python
bsd-3-clause
12,464
# # This sets up how models are displayed # in the web admin interface. # from django.contrib import admin from src.comms.models import Channel, Msg, PlayerChannelConnection, ExternalChannelConnection class MsgAdmin(admin.ModelAdmin): list_display = ('id', 'db_date_sent', 'db_sender', 'db_receivers', 'db_channels...
TaliesinSkye/evennia
src/comms/admin.py
Python
bsd-3-clause
2,737
# -*- encoding: utf-8 -*- from __future__ import unicode_literals """ LANG_INFO is a dictionary structure to provide meta information about languages. About name_local: capitalize it as if your language name was appearing inside a sentence in your language. The 'fallback' key can be used to specify a special ...
yephper/django
django/conf/locale/__init__.py
Python
bsd-3-clause
12,721
DEPS = [ 'depot_tools', 'gclient', 'gerrit', 'gitiles', 'recipe_engine/buildbucket', 'recipe_engine/context', 'recipe_engine/commit_position', 'recipe_engine/cq', 'recipe_engine/json', 'recipe_engine/path', 'recipe_engine/platform', 'recipe_engine/properties', 'recipe...
endlessm/chromium-browser
third_party/depot_tools/recipes/recipe_modules/bot_update/__init__.py
Python
bsd-3-clause
1,081
# -*- coding: utf-8 -*- from __future__ import unicode_literals import autocomplete_light from django.utils.encoding import force_text from .settings import USER_MODEL from .utils.module_loading import get_real_model_class class UserAutocomplete(autocomplete_light.AutocompleteModelBase): search_fields = [ ...
luzfcb/django_documentos
django_documentos/autocomplete_light_registry.py
Python
bsd-3-clause
1,391
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals from rest_framework import viewsets, serializers from dbaas_credentials.models import Credential from .environment import EnvironmentSerializer from .integration_type import CredentialTypeSerializer class IntegrationCredentialSerializer(...
globocom/database-as-a-service
dbaas/api/integration_credential.py
Python
bsd-3-clause
892
# Copyright (c) 2015, Imperial College London # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of condi...
london-escience/libhpc-cf
libhpc/component/bio.py
Python
bsd-3-clause
13,873
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Worker.ping_response_dts' db.add_column('job_runner_worker', 'ping_response_dts', ...
spilgames/job-runner
job_runner/apps/job_runner/migrations/0013_auto__add_field_worker_ping_response_dts.py
Python
bsd-3-clause
9,629
# -*- coding: utf-8 -*- """ eve.io.mongo.geo ~~~~~~~~~~~~~~~~~~~ Geospatial functions and classes for mongo IO layer :copyright: (c) 2017 by Nicola Iarocci. :license: BSD, see LICENSE for more details. """ class GeoJSON(dict): def __init__(self, json): try: self['type'] ...
bcrochet/eve
eve/io/mongo/geo.py
Python
bsd-3-clause
3,352
from __future__ import with_statement, absolute_import from django.contrib import admin from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.admin.views.main import ChangeList, SEARCH_VAR, ALL_VAR from django.contrib.auth.models import User from django.template import Context, Templat...
lisael/pg-django
tests/regressiontests/admin_changelist/tests.py
Python
bsd-3-clause
24,196
""" Utilities for plotting various figures and animations in EEG101. """ # Author: Hubert Banville <hubert@neurotechx.com> # # License: TBD import numpy as np import matplotlib.pylab as plt import collections from scipy import signal def dot_plot(x, labels, step=1, figsize=(12,8)): """ Make a 1D dot plot. ...
NeuroTechX/eeg-101
python_tools/utilities.py
Python
isc
5,241
import datetime import uuid import pytz import os import time from django.contrib.sites.shortcuts import get_current_site from django.core.servers.basehttp import FileWrapper from django.views.decorators.csrf import csrf_exempt from django.core.urlresolvers import reverse, resolve from django.db.models import FieldDoes...
codeadict/kushillu
kushillu/views.py
Python
mit
8,944
""" Tests related specifically to the FacilityDataset model. """ from django.db.utils import IntegrityError from django.test import TestCase from ..models import Classroom from ..models import Facility from ..models import FacilityDataset from ..models import FacilityUser from ..models import LearnerGroup class Faci...
lyw07/kolibri
kolibri/core/auth/test/test_datasets.py
Python
mit
2,905
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Tangible() result.template = "object/tangible/loot/loot_schematic/shared_spear_rack_schematic.iff" result.attribu...
anhstudios/swganh
data/scripts/templates/object/tangible/loot/loot_schematic/shared_spear_rack_schematic.py
Python
mit
479
class BinaryIterator(object): def __init__(self, content): self.body = content.raw_body self._stop = False @classmethod def open_file(self, path): return open(path, 'rb') def __next__(self): if self._stop: raise StopIteration else: self._...
ayemos/osho
akagi/iterators/binary_iterator.py
Python
mit
361
from flask.ext import uploads allowed = uploads.IMAGES _config = uploads.UploadConfiguration( './Application/static/uploads/', base_url='/static/uploads/', allow=allowed, deny=()) images = uploads.UploadSet('images', allowed) images._config = _config
nickw444/ShowCSE
Application/uploads.py
Python
mit
267
# # Example file for working with date information # (For Python 3.x, be sure to use the ExampleSnippets3.txt file) from datetime import date from datetime import time from datetime import datetime def main(): ## DATE OBJECTS # Get today's date from the simple today() method from the date class today = date.tod...
thatguyandy27/python-sandbox
learning-python/Ch3/dates_finished.py
Python
mit
1,126
import socket import poormanslogging as log LISTENPORT = 6666 class Grunt(object): def __init__(self): try: self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.s.bind(('', LISTENPORT)) self.s.listen(1) log.info('Waiting for orders on port {}'.format(LISTENPORT)) (c, a) = self.s.accept() ...
vyral/bombardier
networking/grunt.py
Python
mit
598
"""Landlab component that simulates relative incidence shortwave radiation on sloped surface. Landlab component that computes 1D and 2D total incident shortwave radiation. This code also computes relative incidence shortwave radiation compared to a flat surface. Ref: Bras, Rafael L. Hydrology: an introduction to hydro...
laijingtao/landlab
landlab/components/radiation/__init__.py
Python
mit
2,298
""" Script that trains graph-conv models on ChEMBL dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np np.random.seed(123) import tensorflow as tf tf.set_random_seed(123) import deepchem as dc from chembl_datasets import load_che...
joegomes/deepchem
examples/chembl/chembl_graph_conv.py
Python
mit
1,974
import logging import json import time from collections import defaultdict from flotilla.model import FlotillaServiceRevision, FlotillaUnit, \ GLOBAL_ASSIGNMENT, GLOBAL_ASSIGNMENT_SHARDS from Crypto.Cipher import AES logger = logging.getLogger('flotilla') class FlotillaAgentDynamo(object): """Database intera...
pebble/flotilla
src/flotilla/agent/db.py
Python
mit
4,650
#!/usr/bin/python # -*- coding: utf-8 -*- class User(object): def __init__(self, id, email, passwd, session, session_expire_time, ctime, rtime): self.id = str(id) self.email = email self.passwd = passwd self.session = session self.session_expire_time = session_expire_time ...
liangsun/me
webapp/models/user.py
Python
mit
573
from keras import backend as K from keras import initializations from keras.backend.common import _EPSILON from keras.engine.topology import Layer from keras.engine import InputSpec from theano.tensor.nnet import h_softmax import theano.tensor as T class HierarchicalSoftmax(Layer): def __init__(self, output...
jstarc/nli_generation
hierarchical_softmax.py
Python
mit
2,566
import os import sys import argparse import ConfigParser import testcase_service from bantorra.util import define from bantorra.util.log import LOG as L class TestCase_Base(testcase_service.TestCaseUnit): config = {} """ TestCase_Base. - Parse Command Line Argument. - Create Se...
TE-ToshiakiTanaka/bantorra.old
script/testcase_base.py
Python
mit
1,751
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('robocrm', '0006_auto_20141005_1800'), ] operations = [ migrations.AddField( model_name='robouser', n...
CMU-Robotics-Club/roboticsclub.org
robocrm/migrations/0007_robouser_magnetic.py
Python
mit
461
"""The tests for the Recorder component.""" # pylint: disable=too-many-public-methods,protected-access import unittest import json from datetime import datetime, timedelta from unittest.mock import patch from homeassistant.const import MATCH_ALL from homeassistant.components import recorder from tests.common import g...
emilhetty/home-assistant
tests/components/test_recorder.py
Python
mit
6,293
# Copyright (c) 2019, CRS4 # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation the rights to # use, copy, modify, merge, publish, distribu...
lucalianas/ProMort
promort/odin/permissions.py
Python
mit
1,894
# x = [4, 6, 1, 3, 5, 7, 25] # def stars (a): # i = 0 # while (i < len(a)): # print '*' * a[i] # i += 1 # stars(x) x = [4, "Tom", 1, "Michael", 5, 7, "Jimmy Smith"] def stars (a): i = 0 while (i < len(a)): if type(a[i]) is int: print '*' * a[i] i+=1 else: temp = a[i] temp = temp.lower() ...
jiobert/python
Paracha_Junaid/Assignments/Python/Web_fund/stars.py
Python
mit
368
from distutils.core import setup, Extension, Command from distutils.command.build import build from distutils.command.build_ext import build_ext from distutils.command.config import config from distutils.msvccompiler import MSVCCompiler from distutils import sysconfig import string import sys mkobjs = ['column', 'cust...
electric-cloud/metakit
python/setup.py
Python
mit
7,317
from django.contrib import admin from attachments.admin import AttachmentInlines from tasks.models import Task class TaskOptions(admin.ModelAdmin): inlines = [AttachmentInlines] admin.site.register(Task, TaskOptions)
alex/pinax
pinax/apps/tasks/admin.py
Python
mit
226
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # fakelcs - Waqas Bhatti (wbhatti@astro.princeton.edu) - Oct 2017 # License: MIT. See the LICENSE file for more details. '''This contains various modules that run variable star classification and characterize its reliability and completeness via simulating LCs: - :py:mod...
lgbouma/astrobase
astrobase/fakelcs/__init__.py
Python
mit
530
from random import random def ran_pi(): dim=[2,3] out=[] for i in range(dim[0]): temp=[] for j in range(dim[1]): temp.append(random()) sm=sum(temp) out.append([temp[i]/sm for i in range(dim[1])]) return out pi={i:[[1.0,0.0],[0.0,1.0]] for i in r...
CitizenScienceInAstronomyWorkshop/pyIBCC
attic/create_pi.py
Python
mit
409
#!/usr/bin/env python #-*- coding:utf-8 -*- import logging, os.path import tornado.httpserver import tornado.ioloop import tornado.options import tornado.web import tornado.websocket import tornado.gen class Application(tornado.web.Application): def __init__(self): base_dir = os.path.dirname(__file__) ...
mehmetkose/react-websocket
example/server.py
Python
mit
1,627
numbers = [7, 9, 12, 54, 99] print "This list contains: " for num in numbers: print num # Add your loop below! for num in numbers: print num ** 2
vpstudios/Codecademy-Exercise-Answers
Language Skills/Python/Unit 8/1-Loops/For Loops/13-For your lists.py
Python
mit
158
#!/usr/bin/env python # # Wrapper script for Java Conda packages that ensures that the java runtime # is invoked with the right options. Adapted from the bash script (http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in/246128#246128). # # # Program Parameters # import os import...
jfallmann/bioconda-recipes
recipes/hops/hops.py
Python
mit
2,649
def getitem(list, index): return list[index] def entry_point(i): return getitem([i, 2, 3, 4], 2) + getitem(None, i) def target(*args): return entry_point, [int] def get_llinterp_args(): return [1] # _____ Run translated _____ def run(c_entry_point): c_entry_point(0)
oblique-labs/pyVM
rpython/translator/goal/targetsegfault.py
Python
mit
291
import unittest import pqkmeans import numpy import collections import pickle class TestPQKMeans(unittest.TestCase): def data_source(self, n: int): for i in range(n): yield [i * 100] * 6 def setUp(self): # Train PQ encoder self.encoder = pqkmeans.encoder.PQEncoder(num_subd...
kogaki/pqkmeans
test/clustering/test_pqkmeans.py
Python
mit
2,918
#!/usr/bin/env python import os import time import django from userreport import maint os.environ['DJANGO_SETTINGS_MODULE'] = 'userreport.settings' django.setup() start_time = time.time() remove_time, get_time, save_time = maint.refresh_data() total_time = time.time() - start_time print("--- Remove Time: {:>5.2f} s...
leyyin/stk-stats
maint_graphics.py
Python
mit
651
"""Caching Library using redis.""" import logging from functools import wraps from flask import current_app from walrus import Walrus import api import hashlib import pickle from api import PicoException log = logging.getLogger(__name__) __redis = { "walrus": None, "cache": None, "zsets": {"scores": No...
royragsdale/picoCTF
picoCTF-web/api/cache.py
Python
mit
4,558
''' MLAB calls MATLAB funcitons and looks like a normal python library. authors: Yauhen Yakimovich <eugeny.yakimovitch@gmail.com> Module wrapping borrowed from `sh` project by Andrew Moffat. ''' import os import sys from types import ModuleType from mlabwrap import (MlabWrap, choose_release, find_available_releas...
codypiersall/mlab
src/mlab/releases.py
Python
mit
4,746
#!/usr/bin/python # # Coypyright (C) 2010, University of Oxford # # Licensed under the MIT License. You may obtain a copy of the License at: # # http://www.opensource.org/licenses/mit-license.php # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed ...
bhavanaananda/DataStage
src/SubmitDatasetHandler/ManifestRDFUtils.py
Python
mit
7,221
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('imager_images', '0005_auto_20150728_0129'), ] operations = [ migrations.AlterField( model_name='album', ...
tpeek/django-imager
imagersite/imager_images/migrations/0006_auto_20150729_1539.py
Python
mit
729
#!/usr/bin/env python #encoding:utf-8 import os import sys import requests import MySQLdb from bs4 import BeautifulSoup from bs4 import SoupStrainer if len(sys.argv) != 4: print 'Invalid parameters!' exit(1) print '=' * 60 print 'start:', sys.argv aim_category_id = int(sys.argv[1]) start_point = (int(sys.ar...
JayvicWen/Crawler
3che/crawler.py
Python
mit
4,816
#!/usr/bin/env python3 import traceback from telethon_examples.interactive_telegram_client \ import InteractiveTelegramClient def load_settings(path='api/settings'): """Loads the user settings located under `api/`""" result = {} with open(path, 'r', encoding='utf-8') as file: for line in file...
kyasabu/Telethon
try_telethon.py
Python
mit
1,492
# Copyright (c) 2010-2017 openpyxl
171121130/SWI
venv/Lib/site-packages/openpyxl/reader/__init__.py
Python
mit
35
#Calculen el área de un rectángulo (alineado con los ejes x e y) dadas sus coordenadas x1,x2,y1,y2. from math import pi print 'Ejercicio 6' print '-'*60 x1 = float(raw_input('Introduce x1: ')) x2 = float(raw_input('Introduce x2: ')) y1 = float(raw_input('Introduce y1: ')) y2 = float(raw_input('Introduce y2: ')) base=...
txtbits/daw-python
primeros ejercicios/Ejercicios entradasalida/ejercicio6.py
Python
mit
445
""" Tests that deepchem models make deterministic predictions. """ __author__ = "Bharath Ramsundar" __copyright__ = "Copyright 2016, Stanford University" __license__ = "MIT" import os import tempfile import numpy as np import unittest import sklearn import shutil import deepchem as dc try: import tensorflow as tf ...
peastman/deepchem
deepchem/models/tests/test_predict.py
Python
mit
1,984
# -*- coding: utf-8 -*- import logging from speaklater import make_lazy_string from quokka.modules.accounts.models import User logger = logging.getLogger() def lazy_str_setting(key, default=None): from flask import current_app return make_lazy_string( lambda: current_app.config.get(key, default) ...
maurobaraldi/quokka
quokka/utils/__init__.py
Python
mit
714
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
Azure/azure-sdk-for-python
sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/__init__.py
Python
mit
1,234
#### NOTICE: THIS FILE IS AUTOGENERATED #### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY #### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES from swgpy.object import * def create(kernel): result = Creature() result.template = "object/mobile/shared_dressed_corellia_cec_officer.iff" result.attribute_template_id...
anhstudios/swganh
data/scripts/templates/object/mobile/shared_dressed_corellia_cec_officer.py
Python
mit
453
from __future__ import absolute_import, unicode_literals import pytest from virtualenv.seed.wheels.embed import MAX, get_embed_wheel from virtualenv.seed.wheels.util import Wheel def test_wheel_support_no_python_requires(mocker): wheel = get_embed_wheel("setuptools", for_py_version=None) zip_mock = mocker.M...
pypa/virtualenv
tests/unit/seed/wheels/test_wheels_util.py
Python
mit
901
#!/usr/bin/env python from iris_sdk.models.maps.base_map import BaseMap class RolesListMap(BaseMap): role = None
scottbarstow/iris-python
iris_sdk/models/maps/roles_list.py
Python
mit
119
#!/usr/bin/env python # Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ A collator for Mojo Application Manifests """ import argparse import json import shutil import sys import urlparse def ParseJSONF...
junhuac/MQUIC
src/mojo/public/tools/manifest/manifest_collator.py
Python
mit
1,675
import polyglot import yaml class Heuristics (object): """ The Heuristics class receives a path to the file that is trying to be identified and an array of possible languages for that file. The disambiguate method will find the array with unambiguous strings of syntax for each language and check the file in ques...
jestlabs/polyglot
polyglot/heuristics.py
Python
mit
1,381
from rest_framework.permissions import BasePermission class HasValidProjectToken(BasePermission): """ Return True if the request has a valid project token. """ def has_permission(self, request, view): return bool(request.auth)
PersonalGenomesOrg/open-humans
private_sharing/api_permissions.py
Python
mit
254
from xboxdrv_parser import Controller from time import sleep import os def main (): # Get input from the two analog sticks as yaw, throttle, roll, and pitch. Take the (0 - 255) input value and # map it to a (-1 - 1) range. controller = Controller (["X1", "Y1", "X2", "Y2", "L2", "R2", "X", "/\\", "[]"], ["y...
WSU-RoboticsClub/Tutorials
xbox_controller/xboxdrv/quadcopter_controller_example.py
Python
mit
734
import django_filters from rest_framework import filters from waldur_core.core import filters as core_filters from . import models class InvoiceFilter(django_filters.FilterSet): customer = core_filters.URLFilter( view_name='customer-detail', field_name='customer__uuid' ) customer_uuid = django_f...
opennode/nodeconductor-assembly-waldur
src/waldur_mastermind/invoices/filters.py
Python
mit
1,887
import pytest import os import sys from polyglotdb.io import inspect_ilg from polyglotdb.io.helper import guess_type from polyglotdb.exceptions import DelimiterError, ILGWordMismatchError from polyglotdb import CorpusContext def test_inspect_ilg(ilg_test_dir): basic_path = os.path.join(ilg_test_dir, 'basic.tx...
PhonologicalCorpusTools/PolyglotDB
tests/test_io_ilg.py
Python
mit
1,972
import itertools import json import re import flask from flask import request from web.cache import cache import rethinkdb as r import web.api.api_util as api_util import db import util api = flask.Blueprint("api", __name__, url_prefix="/api") r_conn = db.util.r_conn def _should_skip_get_plugins_cache(): """...
vim-awesome/vim-awesome
web/api/api.py
Python
mit
7,261
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-10-11 19:21 from __future__ import unicode_literals from django.db import migrations, models import prosody.utils class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( ...
Kromey/fbxnano
prosody/migrations/0001_initial.py
Python
mit
1,099
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
rienafairefr/pynYNAB
docs/conf.py
Python
mit
4,876
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 3 15:48:55 2019 @author: epnevmatikakis """ from caiman.paths import caiman_datadir from caiman.utils.utils import load_graph import os import numpy as np try: os.environ["KERAS_BACKEND"] = "tensorflow" from tensorflow.keras.models import ...
simonsfoundation/CaImAn
caiman/tests/test_tensorflow.py
Python
gpl-2.0
1,733
from __future__ import division, absolute_import, unicode_literals from qtpy import QtWidgets from qtpy.QtCore import Qt from . import cmds from . import gitcmds from . import hotkeys from . import icons from . import qtutils from . import utils from .i18n import N_ from .widgets import completion from .widgets impor...
Vdragon/git-cola
cola/difftool.py
Python
gpl-2.0
6,355
# Copyright (C) 2012 Intel 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: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
loveyoupeng/rt
modules/web/src/main/native/Tools/Scripts/webkitpy/style/checkers/cmake_unittest.py
Python
gpl-2.0
5,918
#!/usr/bin/python # -*- coding: ISO-8859-15 -*- import rlib myreport = rlib.Rlib() print rlib.version myreport.add_datasource_xml("local_xml") myreport.add_query_as("local_xml", "data.xml", "data") myreport.add_report("array.xml") myreport.set_output_format_from_text("pdf") myreport.execute() print myreport.get_conte...
SICOM/rlib
src/examples/python/xml.py
Python
gpl-2.0
388
from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Components.ActionMap import ActionMap from Components.ConfigList import ConfigListScreen from Components.MenuList import MenuList from Components.Sources.StaticText import StaticText from Components.config import config, ConfigNumber, Conf...
Taapat/enigma2-openpli-vuplus
lib/python/Plugins/SystemPlugins/AnimationSetup/plugin.py
Python
gpl-2.0
9,065
# -*- coding: utf-8 -*- ''' zen Add-on Copyright (C) 2016 zen 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 (at your option) any later v...
Coelhon/MasterRepo.repository
plugin.video.zen/resources/lib/modules/trailer.py
Python
gpl-2.0
3,897
# -*- python -*- # # wireshark_gen.py (part of idl2wrs) # # Author : Frank Singleton (frank.singleton@ericsson.com) # # Copyright (C) 2001 Frank Singleton, Ericsson Inc. # # This file is a backend to "omniidl", used to generate "Wireshark" # dissectors from CORBA IDL descriptions. The output language generated # ...
zzqcn/wireshark
tools/wireshark_gen.py
Python
gpl-2.0
100,934
# Copyright (C) 2008-2010 Adam Olsen # # 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 distributed in the hope that...
sjohannes/exaile
xl/metadata/mod.py
Python
gpl-2.0
2,441
 from news_spider import news_spider from video_spider import video_spider if __name__ == "__main__": print u'开始爬取咨询信息...' # 设置资讯的存储位置,必须以 \\ 结尾,分为绝对路径和相对路径 # c:\资讯\\ C:\咨询 目录下存放 txt,c:\资讯\图片 目录下存放图片 # 咨询\ 程序当前文件夹下的 资讯 目录存储 txt, 里面的 图片目录存放图片 news_path = u'c:\资讯\\' # 设置视频目...
softtyphoon/tz
tools/17173/ymxk/复件 game_spider.py
Python
gpl-2.0
839
# Opus/UrbanSim urban simulation software. # Copyright (C) 2005-2009 University of Washington # See opus_core/LICENSE specification = {} specification = { 2: { "equation_ids":(1,2), "constant":(0, "act_2_2"), "blmz":("blmz_2_1", 0), "cd1":("cd1_2_1", 0), "dag":("dag_2_1", 0), "d...
christianurich/VIBe2UrbanSim
3rdparty/opus/src/biocomplexity/examples/estimation_lccm_specification_ub91to95.py
Python
gpl-2.0
10,640
# coding=utf-8 import sys sys.path.append("bindings/python/") from unittestpy import TeamcityTestRunner from elliptics_proxy import * import unittest r = remote('localhost', 1025) c = config() c.groups.append(1) c.groups.append(2) c.log_path = 'log' c.remotes.append(r) proxy = elliptics_proxy_t(c) class TestTeamcit...
yandex/libmastermind
tests/bindings/python/test.py
Python
gpl-2.0
1,327
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, unicode_literals import xbmc from . import kodigui from .. import utils, variables as v class OptionsDialog(kodigui.BaseDialog): xmlFile = 'script-plex-options_dialog.xml' path = v.ADDON_PATH theme = 'Main' ...
croneter/PlexKodiConnect
resources/lib/windows/optionsdialog.py
Python
gpl-2.0
1,700
#! /usr/bin/env python from genomon_pipeline.stage_task import * class Markduplicates(Stage_task): task_name = "markduplicates" script_template = """ #!/bin/bash # # Set SGE # #$ -S /bin/bash # set shell in UGE #$ -cwd # execute at the submitted dir pwd # print cu...
eigoshimizu/Genomon
scripts/genomon_pipeline/dna_resource/markduplicates.py
Python
gpl-2.0
742