text stringlengths 4 1.02M | meta dict |
|---|---|
"""
Functions for ecommerce
"""
from base64 import b64encode
import hashlib
import hmac
from itertools import chain
import logging
from urllib.parse import quote_plus
import uuid
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import transaction
from django.http.... | {
"content_hash": "6e0e55ae7427627be6b12ac978e95732",
"timestamp": "",
"source": "github",
"line_count": 521,
"max_line_length": 159,
"avg_line_length": 34.78886756238004,
"alnum_prop": 0.6534068965517241,
"repo_name": "mitodl/micromasters",
"id": "62b7e1904ccac6163905450ece7e6273c461fc3e",
"size": ... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-i... | {
"content_hash": "9119685497a2060f2940a52a81ca5057",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 125,
"avg_line_length": 48.2,
"alnum_prop": 0.7095435684647303,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c743c45383d55e1265bd047df5c23d3de1693d6f",
"size": "3601",... |
from pymongo import MongoClient
from twisted.trial.unittest import TestCase
from tests.utils import ObjectMaker
from vusion.persist import ShortcodeManager, Shortcode
class TestShortcodeManager(TestCase, ObjectMaker):
def setUp(self):
self.database_name = 'test_vusion_db'
c = MongoClient(w... | {
"content_hash": "55ab5d2e3a39c5eff8f5f0442f26e950",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 82,
"avg_line_length": 36.68888888888889,
"alnum_prop": 0.5935796486977589,
"repo_name": "texttochange/vusion-backend",
"id": "ce4d06f71942d50a44548ba13c01266b8f3d2feb",
"s... |
from django.conf import settings as django_settings
from django.db import models
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes.models import ContentType
from gnotify import settings
class NotificationType(models.Model):
"""
Notification... | {
"content_hash": "25b8249cb3ec2beda7366ad4a7cba875",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 146,
"avg_line_length": 32.29447852760736,
"alnum_prop": 0.6054331306990881,
"repo_name": "indexofire/gork",
"id": "7e43d1adb6a27efab2bb7c3934fb0181c733828b",
"size": "528... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lab', '0025_auto_20160404_0534'),
]
operations = [
migrations.AddField(
model_name='people',
name='display_priority',
... | {
"content_hash": "96ee87296017f342e994dc2205fcbca5",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 97,
"avg_line_length": 25.782608695652176,
"alnum_prop": 0.5632377740303541,
"repo_name": "skbly7/serc",
"id": "56bf8907f53361834e69b099aea77b8208871d4d",
"size": "665",
... |
"""
Provide reverse functions that return fully qualified URLs
"""
from __future__ import unicode_literals
from django.core.urlresolvers import reverse as django_reverse
from django.utils.functional import lazy
def reverse(viewname, args=None, kwargs=None, request=None, format=None, **extra):
"""
Sa... | {
"content_hash": "3f77a019365d2d631dfa602dc50ab358",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 82,
"avg_line_length": 33.34782608695652,
"alnum_prop": 0.6844850065189049,
"repo_name": "hfercc/mese2014",
"id": "ddfc14edbc2abf338218cef44e6d2b6dcab5566e",
"size": "767",... |
"""Default AppConfig for dal_select2."""
from django.apps import AppConfig
# from django.core import checks
class DefaultApp(AppConfig):
"""Default app for dal_select2."""
name = 'dal_select2'
def ready(self):
"""Register select2_submodule_check."""
| {
"content_hash": "730a496a5c646cf47b4a9ec6c49690a7",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 47,
"avg_line_length": 22.833333333333332,
"alnum_prop": 0.6788321167883211,
"repo_name": "yourlabs/django-autocomplete-light",
"id": "83750e8da4f29ba969e72ddc76f6267332891b6... |
import unittest, netCDF4, tempfile, os
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
cache_size = 10000
cache_nelems = 100
cache_preempt = 0.5
cache_size2 = 20000
cache_nelems2 = 200
cache_preempt2 = 1.0
class RefCountTestCase(unittest.TestCase):
def setUp(self):
nc = netCDF4.... | {
"content_hash": "7278d9b221514186ddab03e6755e1210",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 97,
"avg_line_length": 38.292682926829265,
"alnum_prop": 0.6535031847133758,
"repo_name": "Unidata/netcdf4-python",
"id": "129ce7128857abe471a7c66d8c3076ab6e4b4faf",
"size"... |
import logging as python_logging
import logging.config
log_config = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
},
},
'handlers': {
'default': {
'level... | {
"content_hash": "6c859b1835325704b9f84a662625cc6c",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 73,
"avg_line_length": 20.228571428571428,
"alnum_prop": 0.4957627118644068,
"repo_name": "LostProperty/schedule",
"id": "ddd3d04e5528f3c1badde2e552f2aa243eda55b4",
"size":... |
import sys
import os
# If extensions (or modules to document with autodoc) are in another
# directory, add these directories to sys.path here. If the directory is
# relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# Get the proje... | {
"content_hash": "3c6f8aca7caaa0859d585f3d664a21f8",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 76,
"avg_line_length": 30.68846153846154,
"alnum_prop": 0.7024689810753227,
"repo_name": "OpenDataScienceLab/skdata",
"id": "66405fc3ffb1fabaf9d26e0fd385b77e573c1044",
"si... |
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class ManagementConfig(AppConfig):
name = 'rdmo.management'
verbose_name = _('Management')
| {
"content_hash": "eb29f35409e6e220b3dfa2ff8cc848fe",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 54,
"avg_line_length": 27.142857142857142,
"alnum_prop": 0.7526315789473684,
"repo_name": "rdmorganiser/rdmo",
"id": "b2a1f9ab096656bfa69aa1250dd24a21208618de",
"size": "190... |
"""
WSGI config for dreact 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.10/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... | {
"content_hash": "99a79599aac58bedffd4c00426ecb244",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.375,
"alnum_prop": 0.7692307692307693,
"repo_name": "KyoungRan/Django_React_ex",
"id": "b807f82befceda140dec6f16a7788ffdec10b472",
"size": "390",
... |
""" crmngr utility module """
# stdlib
from fnmatch import fnmatchcase
import sys
def truncate(string, max_len=1000):
"""returns a truncated to max_len version of a string (or str(string))"""
string = str(string)
if len(string) > max_len - 12:
return string[:max_len] + '...TRUNCATED'
return s... | {
"content_hash": "399af6c4a62189445f12dcf67f616820",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 77,
"avg_line_length": 28.166666666666668,
"alnum_prop": 0.5761834319526628,
"repo_name": "vshn/crmngr",
"id": "21e9ec7bd789fdebf4dd45359712e95293650438",
"size": "1352",
... |
"""Test the fundrawtransaction RPC."""
from test_framework.test_framework import BitcoinTestFramework, BITCORED_PROC_WAIT_TIMEOUT
from test_framework.util import *
def get_unspent(listunspent, amount):
for utx in listunspent:
if utx['amount'] == amount:
return utx
raise AssertionError('Co... | {
"content_hash": "a3fb9e2fd202148a29ecfe86da97a58a",
"timestamp": "",
"source": "github",
"line_count": 720,
"max_line_length": 223,
"avg_line_length": 44.583333333333336,
"alnum_prop": 0.5596884735202492,
"repo_name": "LIMXTEC/BitCore",
"id": "9dc52dbe3d3e1b9ed8d2ef161c92574c99b888bc",
"size": "32... |
from .compat import collections_abc
class DirectedGraph(object):
"""A graph structure with directed edges."""
def __init__(self):
self._vertices = set()
self._forwards = {} # <key> -> Set[<key>]
self._backwards = {} # <key> -> Set[<key>]
def __iter__(self):
return iter(... | {
"content_hash": "882260eaab6ef920f5d6046033f2c278",
"timestamp": "",
"source": "github",
"line_count": 143,
"max_line_length": 81,
"avg_line_length": 29.356643356643357,
"alnum_prop": 0.5971891376846117,
"repo_name": "kennethreitz/pipenv",
"id": "479aad5dc176370dedefe63d0cc77a9168b1f7ec",
"size": ... |
__author__ = 'jmartinez'
__version__ = '1.0.2'
import os
import click
import requests
import requirements
import shutil
import subprocess
import sys
import tarfile
import tempfile
import zipfile
from datetime import date
from glob import glob as ls
from jinja2 import Environment, FileSystemLoader
from uuid import uui... | {
"content_hash": "f656f954f4992be1db6233ec5d7869c5",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 80,
"avg_line_length": 32.985849056603776,
"alnum_prop": 0.5792935792935793,
"repo_name": "ncode/spec-from-pypi",
"id": "fa0564a1a938d102782d703389505c6d48081ed4",
"size":... |
from flask import Flask, render_template, request
from flask_flatpages import FlatPages,pygments_style_defs
from flask_frozen import Freezer
import sys
BOLG_URL = 'http://blog.zeromake.com'
DEBUG = True
FLATPAGES_AUTO_RELOAD = DEBUG
FLATPAGES_EXTENSION = '.md'
FLATPAGES_MARKDOWN_EXTENSIONS = ['markdown.exte... | {
"content_hash": "17e26e70ce30827c0bded12b522c9e4f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 169,
"avg_line_length": 34.82,
"alnum_prop": 0.6318207926479035,
"repo_name": "zeromake/zero_blog",
"id": "159f20604bf7d3506560434af8f9176438935c24",
"size": "1785",
"bin... |
"""
A variety of app callables used to test WEB-INF interactions.
"""
def test_import_from_lib_python(environ, start_response):
from test_lib import some_libs
writer = start_response("200 OK", [])
return ["Factorial 10 is %d" % some_libs.factorial(10)]
def test_import_from_zip_file(environ, st... | {
"content_hash": "7f8342b5a4197cffe2251b1b267ff363",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 62,
"avg_line_length": 30.545454545454547,
"alnum_prop": 0.6369047619047619,
"repo_name": "pjenvey/modjy-pjenvey",
"id": "4dcc952e6e94b87e230e00192e0151cf35688d03",
"size":... |
"""Simple command-line example for Moderator.
Command-line application that exercises the Google Moderator API.
Usage:
$ python moderator.py
You can also get help on all the command-line flags the program understands
by running:
$ python moderator.py --help
To get detailed log output run:
$ python moderator... | {
"content_hash": "3fe2609512ca7fad02cd012c04d7f11e",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 79,
"avg_line_length": 33.796992481203006,
"alnum_prop": 0.6843159065628476,
"repo_name": "MapofLife/MOL",
"id": "b7da058f2f810e296d1a50015e861e9436749847",
"size": "5123"... |
import glob
def main():
file_list = glob.glob("include/flatbuffers/*.h", recursive=False)
for filename in file_list:
print(filename)
with open(filename) as infile:
lines = infile.readlines()
begin_index = index_any(lines, [
"namespace flatbuffers {\n",
... | {
"content_hash": "9ce8129571b6c15b07d30b19ed6384e4",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 70,
"avg_line_length": 32.41025641025641,
"alnum_prop": 0.5174050632911392,
"repo_name": "effekseer/Effekseer",
"id": "1204aaabbf40393c92e57dfe03e8f20d859e1a11",
"size": "1... |
from setuptools import setup, find_packages
LONG_DESCRIPTION = """
Mustache template engine for Django 1.8 and newer, with support for Django context processors.
"""
def readme():
try:
readme = open("README.md")
except IOError:
return LONG_DESCRIPTION
return readme.read()
setup(
nam... | {
"content_hash": "e6dffcbe59ad5f73ba8febd4c7b8751f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 94,
"avg_line_length": 28.80952380952381,
"alnum_prop": 0.5757575757575758,
"repo_name": "wq/django-mustache",
"id": "28fa930a6c1d84533613e15ba81f56df02fda58d",
"size": "18... |
from contextlib import redirect_stdout
from io import StringIO
from pathlib import Path
import lief
from utils import get_sample
lief.logging.set_level(lief.logging.LOGGING_LEVEL.INFO)
def test_change_note(tmp_path: Path):
etterlog = lief.parse(get_sample('ELF/ELF64_x86-64_binary_etterlog.bin'))
build_id = e... | {
"content_hash": "34132a6ef677cde073daa7c80d488618",
"timestamp": "",
"source": "github",
"line_count": 96,
"max_line_length": 128,
"avg_line_length": 31.375,
"alnum_prop": 0.6835989375830013,
"repo_name": "lief-project/LIEF",
"id": "8f00eef236f1fcafb1498e23b74c3ed10e3d9a94",
"size": "3034",
"bin... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0007_contact_recruiter'),
]
operations = [
migrations.AddField(
model_name='contact',
name='phone_number_quick_copy',
field=models.CharField(... | {
"content_hash": "6fbceb419eb9223bb283a89c48fe12a8",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 89,
"avg_line_length": 24.5,
"alnum_prop": 0.5994897959183674,
"repo_name": "RobSpectre/garfield",
"id": "d4c74fb282069ae5a637abda5bb7211e05a99381",
"size": "441",
"binar... |
import unittest
import omniture
import os
from datetime import date
import pandas
import datetime
import requests_mock
creds = {}
creds['username'] = os.environ['OMNITURE_USERNAME']
creds['secret'] = os.environ['OMNITURE_SECRET']
test_report_suite = 'omniture.api-gateway'
class ReportTest(unittest.TestCase):
de... | {
"content_hash": "a1f60414a340b5fa559bc86afddaebf5",
"timestamp": "",
"source": "github",
"line_count": 157,
"max_line_length": 163,
"avg_line_length": 48.65605095541401,
"alnum_prop": 0.6729938473622202,
"repo_name": "vmAggies/omniture-master",
"id": "27d5aac3bbb9245874eadcbab7c58334b66ce874",
"si... |
import os
from io import open as io_open
__all__ = ["__version__"]
# major, minor, patch, -extra
version_info = 4, 23, 4
# Nice string for the version
__version__ = '.'.join(map(str, version_info))
# auto -extra based on commit hash (if not tagged as release)
scriptdir = os.path.dirname(__file__)
gitdir = os.path.... | {
"content_hash": "a692480a2935d79e3dde82c7b9efe15d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 79,
"avg_line_length": 39.36206896551724,
"alnum_prop": 0.49846692947875604,
"repo_name": "ryfeus/lambda-packs",
"id": "0292d1e2e28523a187bcfc51ae198e54895e9ec5",
"size": "... |
from timeit import timeit
from memory_profiler import profile
from elementpath.regex import UNICODE_CATEGORIES, UnicodeSubset
def run_timeit(stmt='pass', setup='pass', number=1000):
seconds = timeit(stmt, setup=setup, number=number)
print("{}: {}s".format(stmt, seconds))
@profile
def unicode_subset_objects... | {
"content_hash": "9855258b070ba5a95dba292120f67569",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 75,
"avg_line_length": 30.264705882352942,
"alnum_prop": 0.6248785228377065,
"repo_name": "sissaschool/elementpath",
"id": "4116700f3d47d94c96d6690d90ba2a4df40a5bc8",
"size... |
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.template import Context
_mail_context_processors = None
# This is a function rather than module-level procedural code because we only
# want it to execute if somebody uses MailContext.
def get_mail_processors():
g... | {
"content_hash": "f7617d23906186032a3a53a697132e61",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 125,
"avg_line_length": 41.883720930232556,
"alnum_prop": 0.6413103831204886,
"repo_name": "philippbosch/django-campaign",
"id": "e821301297b9788f7f24738fd4193c399e4e9480",
... |
class Subject(object):
def __init__(self):
self._observers = []
def attach(self, observer):
if not observer in self._observers:
self._observers.append(observer)
def detach(self, observer):
try:
self._observers.remove(observer)
except ValueError:
... | {
"content_hash": "e20b9f5da73e52d26eb71850504fb32a",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 55,
"avg_line_length": 22.59493670886076,
"alnum_prop": 0.5719887955182072,
"repo_name": "JiangKlijna/design-pattern",
"id": "400d80c4de6676d43f6508851519c15e0f095eb2",
"si... |
'''
@author: Sergio Rojas
@contact: rr.sergio@gmail.com
--------------------------
Contenido bajo
Atribución-NoComercial-CompartirIgual 3.0 Venezuela (CC BY-NC-SA 3.0 VE)
http://creativecommons.org/licenses/by-nc-sa/3.0/ve/
Creado en abril 23, 2016
'''
def myinput(par):
"""
Esta funcion permite leer datos d... | {
"content_hash": "86481e51513bd67f227433e966e2870b",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 83,
"avg_line_length": 31.137931034482758,
"alnum_prop": 0.5454042081949059,
"repo_name": "rojassergio/Aprendiendo-a-programar-en-Python-con-mi-computador",
"id": "922cacd0fd... |
from zeit.cms.browser.resources import Resource, Library
import zeit.cms.browser.resources
lib = Library('zeit.imp', 'resources')
Resource('ui4w.css')
Resource('ui4w.js', depends=[ui4w_css])
Resource('imp.css')
Resource('imp.js', depends=[
zeit.cms.browser.resources.base,
ui4w_js, imp_css])
| {
"content_hash": "e1392c6f5dacb81918ef756826db07d3",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 56,
"avg_line_length": 27.454545454545453,
"alnum_prop": 0.7251655629139073,
"repo_name": "ZeitOnline/zeit.imp",
"id": "85e1e105f528d36315717fb300ac1a215e331a64",
"size": "... |
from morphforge.morphology.core import MorphologyTree, Section, Region
import numpy
from morphforge import units
from morphforge.core.misc import is_float, is_int
import morphforge
from morphforge.units import qty
# pylint: disable=E1103
# pylint tries to work out the return value of _convert_to_unit,
# but does it w... | {
"content_hash": "afe393908a0eab42f7c25d8074f35db1",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 166,
"avg_line_length": 39.36923076923077,
"alnum_prop": 0.6451738960531458,
"repo_name": "mikehulluk/morphforge",
"id": "0d8a40481f18e4efd6fca42ae6175ac350ee2b44",
"size":... |
"""
Modules related to structure used throughout PTYSH.
"""
import dbus
from collections import OrderedDict
from yaml import Loader
from yaml import MappingNode
class _Singleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls]... | {
"content_hash": "3e1d69073972425997958399303da0c6",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 106,
"avg_line_length": 27.22222222222222,
"alnum_prop": 0.5924198250728863,
"repo_name": "IPOT/PTYSH",
"id": "0081788a6540311d6624dee1f5768300bd9e131b",
"size": "5170",
... |
from modules.Configuration import config
from models.scf import Frame, ReferenceFrame, Verb, database
from modules.Plotter import Plotter
from filter import Filter
## This class is used for evaluating system performance
# @author Adriano Zanette
# @version 1.0
class Evaluator():
## class constructor
# @author Adr... | {
"content_hash": "42f2f905a36bec80139efb7e41a49bfe",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 136,
"avg_line_length": 35.770731707317076,
"alnum_prop": 0.6435292513296059,
"repo_name": "adzanette/scf-extractor",
"id": "ab7de331800778dc95d27f812ee0d641035223df",
"si... |
from torchvision.datasets import CIFAR100
import numpy as np
class CIFAR100N(CIFAR100):
"""
Extends CIFAR100 dataset to yield index of element in addition to image and target label.
"""
def __init__(self,
root,
train=True,
transform=None,
... | {
"content_hash": "25c4d24eb537e1c971549c5eebab9439",
"timestamp": "",
"source": "github",
"line_count": 70,
"max_line_length": 103,
"avg_line_length": 39.01428571428571,
"alnum_prop": 0.5173928963749542,
"repo_name": "google-research/understanding-curricula",
"id": "8c60ede866c80f1538c72bfcbda25f5265... |
from __future__ import with_statement
import sys, os, subprocess, errno, hashlib, threading, signal, gzip
from mparts.rpc import RPCServer, RPCProxy
LOG_COMMANDS = False
__all__ = ["CAPTURE", "STDERR", "DISCARD",
"CHECKED", "UNCHECKED"]
CAPTURE = "\0CAPTURE"
STDERR = "\0STDERR"
DISCARD = "\0DISCARD"
CHE... | {
"content_hash": "3ecf28a55fc8de50fb3c093a08ff7a31",
"timestamp": "",
"source": "github",
"line_count": 313,
"max_line_length": 96,
"avg_line_length": 33.546325878594246,
"alnum_prop": 0.4997142857142857,
"repo_name": "KMU-embedded/mosbench-ext",
"id": "d4c9395780c9659422a29a7248d9a4753f26af6b",
"s... |
import re
import argparse
def read_features(f_file):
"""
Read the feature file and return a nested dictionary of feature values.
"""
f_dict = {}
m = [line.rstrip().split('\t') for line in f_file.read().rstrip().split('\n')]
f_names = m[0][1:]
for line in m[1:]:
if line[0] != 'empty'... | {
"content_hash": "c04076f130f7644e5c93804b6a7c7ffb",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 125,
"avg_line_length": 35.275862068965516,
"alnum_prop": 0.5536005213424569,
"repo_name": "bhallen/constraint-translator",
"id": "c6ae50ef9f5f3dfded98e8d251cd3f86c78b9e92",
... |
from datetime import datetime, timedelta
from urllib.parse import urlparse
import requests
from requests.exceptions import ConnectTimeout, ReadTimeout
import simplejson
from django.conf import settings
from django.contrib import messages
from django.contrib.auth import logout
from django.core.urlresolvers import reve... | {
"content_hash": "9abbb30a790446541530e3514b615c31",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 107,
"avg_line_length": 36.02479338842975,
"alnum_prop": 0.5774260151410874,
"repo_name": "willkg/standup",
"id": "d077e51697fe58616998695a376df534755b20eb",
"size": "4359... |
"""
main module for dft basis sets
"""
__author__ = "Fenglai Liu"
import sys
import os
import infor
import generateAngBasis
import generateBasis
import derivorder
# setting the basis set order
maxLChoice = 6
if len(sys.argv) == 2:
maxLChoice = int(sys.argv[1])
elif len(sys.argv) > 2:
print "Wrong argv list! We onl... | {
"content_hash": "eb097da69db96c2a9763a015849dd561",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 80,
"avg_line_length": 21.071428571428573,
"alnum_prop": 0.6994350282485876,
"repo_name": "murfreesboro/dftints",
"id": "8bb9ceac16545dae174296942579a410940ccf5b",
"size": ... |
'''There is a story I like about PG Wodehouse, author of the Jeeves
and Wooster novels. He had an unusual method of editing his own work.
He would write (long hand) a page of his new book. And read it, and
place the page on the wall of his study, and start on the next page.
But the page stuck to the wall was not at s... | {
"content_hash": "d97cfdcea88afcbf4c227ddae036a315",
"timestamp": "",
"source": "github",
"line_count": 219,
"max_line_length": 114,
"avg_line_length": 28.67579908675799,
"alnum_prop": 0.621656050955414,
"repo_name": "mikadosoftware/weaver",
"id": "d191a927499b508556b82b98e3c12f75b4291d42",
"size":... |
"""
Volume driver for NetApp Data ONTAP (7-mode) iSCSI storage systems.
"""
from cinder import interface
from cinder.volume import driver
from cinder.volume.drivers.netapp.dataontap import block_7mode
@interface.volumedriver
class NetApp7modeISCSIDriver(driver.BaseVD,
driver.ConsistencyG... | {
"content_hash": "23d603e6d58a59366fdd2a6ad4d09496",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 76,
"avg_line_length": 38.48760330578512,
"alnum_prop": 0.6465535752630449,
"repo_name": "Nexenta/cinder",
"id": "9ba51d838a82b667f98881274c733c751eb50ce0",
"size": "5345"... |
"""Regression test for zone_importer_lib.py
Make sure you are running this against a database that can be destroyed.
DO NOT EVER RUN THIS TEST AGAINST A PRODUCTION DATABASE.
"""
__copyright__ = 'Copyright (C) 2009, Purdue University'
__license__ = 'BSD'
__version__ = '#TRUNK#'
import unittest
import os
from roste... | {
"content_hash": "b31b5e59f35f7ee986de7d472d5271ee",
"timestamp": "",
"source": "github",
"line_count": 296,
"max_line_length": 93,
"avg_line_length": 55.63175675675676,
"alnum_prop": 0.5189773486366672,
"repo_name": "stephenlienharrell/roster-dns-management",
"id": "3a8797ec15ff76926848d4f541405f553... |
from __future__ import print_function
import argparse
import json
import os
_FILE_URL = 'https://repo.maven.apache.org/maven2/org/robolectric/pluginapi/4.3.1/pluginapi-4.3.1.jar'
_FILE_NAME = 'pluginapi-4.3.1.jar'
_FILE_VERSION = '4.3.1'
def do_latest():
print(_FILE_VERSION)
def get_download_url(version):
... | {
"content_hash": "0db63dfed9715b0d25401dab352fc728",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 102,
"avg_line_length": 22.145833333333332,
"alnum_prop": 0.6077140169332079,
"repo_name": "ric2b/Vivaldi-browser",
"id": "100d93a0c8cf74e7b732f228a087a7885db337b6",
"size"... |
import sys
if sys.version_info < (2, 7): # pragma: no cover
unittest_mod = 'unittest2'
else: # pragma: no cover
unittest_mod = 'unittest'
unittest = __import__(unittest_mod)
__all__ = ('unittest',)
| {
"content_hash": "a1e8be91f81ef127750933444c3dae6f",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 49,
"avg_line_length": 23.333333333333332,
"alnum_prop": 0.6285714285714286,
"repo_name": "malept/pyoath-toolkit",
"id": "da7950eaaa41d4e0fd0a71ad489e56e70c77374a",
"size": ... |
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
config = {
'name': "arakhne",
'packages': [
"arakhne",
"arakhne.common",
"arakhne.corpus",
"arakhne.corpus.files",
"arakhne.doc",
"arakhne.settings",
"arakhne.s... | {
"content_hash": "40b75f8d726f66a50cec69ac1e8b7f72",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 78,
"avg_line_length": 30.133333333333333,
"alnum_prop": 0.5685840707964602,
"repo_name": "thePortus/arakhne",
"id": "b4d3230896d2747e99a426f32c480de06628fc81",
"size": "13... |
from setuptools import setup, find_packages
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='django-generic-scaffold',
version='0.5.6',
description='Generic scaffolding for Django',
long_description=readme(),
author='Serafeim Papastefanos',
author_email='spa... | {
"content_hash": "b37772e65a4bca11d67fba4f7d8daafc",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 61,
"avg_line_length": 33.89795918367347,
"alnum_prop": 0.5647200481637568,
"repo_name": "spapas/django-generic-scaffold",
"id": "6d049596fde380b79a5a61e1b03cd15a9215fa5d",
... |
""" Elements """
import errors
from utils import Utils
NL = "\n"
class Element:
"""Element."""
def __init__( self, name, parent=None):
self.name = name
self.params = []
self.parent = parent
self.content = []
def __call__( self, *args, **kwargs ):
self.p... | {
"content_hash": "64664a3eaaed43042572a2e42126c733",
"timestamp": "",
"source": "github",
"line_count": 508,
"max_line_length": 103,
"avg_line_length": 21.04527559055118,
"alnum_prop": 0.45814236273501074,
"repo_name": "svilborg/simplerestler",
"id": "fbf525fa9ad00fa59dd1dcfa78a5a4a22a295312",
"siz... |
from scrapy_kafka.spiders import ListeningKafkaSpider
from ..items import DmozItem
class CustomKafkaSpider(ListeningKafkaSpider):
name = "dmoz_kafka"
allowed_domains = ["dmoz.org"]
def parse(self, response):
for sel in response.xpath('//ul/li'):
item = DmozItem()
item['tit... | {
"content_hash": "eea9f794f195182b2d5dab731e7a7d17",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 33.13333333333333,
"alnum_prop": 0.5975855130784709,
"repo_name": "dfdeshom/scrapy-kafka",
"id": "c26aa5a698f4b2c7208e48dc45fbbb2afefec89a",
"size": ... |
import nova.conf
from nova.tests.functional.api_sample_tests import api_sample_base
CONF = nova.conf.CONF
class FlavorsSampleJsonTest(api_sample_base.ApiSampleTestBaseV21):
sample_dir = 'flavors'
def _get_flags(self):
f = super(FlavorsSampleJsonTest, self)._get_flags()
f['osapi_compute_exten... | {
"content_hash": "807922daca07f7029b8243dffedbc448",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 73,
"avg_line_length": 38.395348837209305,
"alnum_prop": 0.6529376135675349,
"repo_name": "bigswitch/nova",
"id": "6c10dbe61c30ac114972ad07f86fd0efcfa15c0f",
"size": "2283"... |
import requests
from bs4 import BeautifulSoup
from .common import get_text_if_exists
def get_admin_announces():
"""Get announces from the administration office of University of Tokyo"""
url = "http://www.c.u-tokyo.ac.jp/zenki/news/kyoumu/index.html"
host = url.split("/zenki", 2)[0]
res = requests.ge... | {
"content_hash": "6b0279c76d1e515fbd98ccf58680ce49",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 77,
"avg_line_length": 34.25,
"alnum_prop": 0.5343065693430656,
"repo_name": "wkentaro/utaskweb",
"id": "dee01d84b35eee56c1804272fe396c2c323ccce2",
"size": "1420",
"binar... |
"""Generate XML and HTML test reports."""
try:
from mako.runtime import Context
from mako.template import Template
from mako import exceptions
except (ImportError):
pass # Mako not installed but it is ok.
import os
import string
import xml.etree.cElementTree as ET
def _filter_msg(msg, output_format):
"""... | {
"content_hash": "42491699e81cb5f6777c1f4b1561b458",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 78,
"avg_line_length": 37.57608695652174,
"alnum_prop": 0.6546138270176454,
"repo_name": "arkmaxim/grpc",
"id": "4fe9cf84136f96f2c6c4bd4ef34b10f1787dc97b",
"size": "4986",
... |
"""efi module."""
from __future__ import print_function
from cStringIO import StringIO
from _ctypes import CFuncPtr as _CFuncPtr
import _efi
import atexit
import binascii
import bits
import bits.cdata
from collections import OrderedDict
from ctypes import *
from efikeys import *
import redirect
import os
import sys as... | {
"content_hash": "3f83a9ed717415293f5c314eceebe53f",
"timestamp": "",
"source": "github",
"line_count": 1928,
"max_line_length": 313,
"avg_line_length": 40.350103734439834,
"alnum_prop": 0.6569959508965871,
"repo_name": "biosbits/bits",
"id": "306f114619f9696578d82d8237bdbccecd06b17a",
"size": "793... |
"""
Barbican defined mime-types
"""
import six
from barbican.common import utils
# Supported content types
# Note: These types may be provided by clients.
PLAIN_TEXT = ['text/plain',
'text/plain;charset=utf-8',
'text/plain; charset=utf-8']
PLAIN_TEXT_CHARSETS = ['utf-8']
BINARY = ['app... | {
"content_hash": "199e4cdab8407987f30d78f009c7cfae",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 78,
"avg_line_length": 35.836879432624116,
"alnum_prop": 0.6544626954284584,
"repo_name": "openstack/barbican",
"id": "ab7c8f0608cbad2ed0980b7f8992f719a0475602",
"size": "... |
"""
Main implementation of Flamyngo webapp and all processing.
"""
import json
import os
import re
from functools import wraps
import pandas as pd
import plotly
import plotly.express as px
from flask import Response, make_response, render_template, request
from flask.json import jsonify
from monty.json import jsaniti... | {
"content_hash": "185530a04eb40d5c442a3b10be83a900",
"timestamp": "",
"source": "github",
"line_count": 456,
"max_line_length": 107,
"avg_line_length": 30.032894736842106,
"alnum_prop": 0.5809419496166484,
"repo_name": "materialsvirtuallab/flamyngo",
"id": "3324f647024b39851cc48701920b0434236c0c5f",
... |
from alad_support import *
from results_support import *
from test_setups import *
"""
python pyalad/alad.py
"""
if __name__ == '__main__':
args = get_command_args(debug=False, debug_args=None)
configure_logger(args)
opts = Opts(args)
logger.debug(opts.str_opts())
# print opts.str_opts()
... | {
"content_hash": "4afa6f2b027bd0969bfed839f20b31fb",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 80,
"avg_line_length": 17.870967741935484,
"alnum_prop": 0.6407942238267148,
"repo_name": "shubhomoydas/pyaad",
"id": "aa41e1fbab88754a01ad184c4759466ba0e9b07c",
"size": "5... |
from coalib.bears.GlobalBear import GlobalBear
from coalib.results.Result import Result
class ProcessingGlobalTestRawFileBear(GlobalBear):
USE_RAW_FILES = True
def run(self):
for filename in self.file_dict:
return [Result.from_values('GlobalTestRawBear',
... | {
"content_hash": "902c57bf09e12986964244c2adb59bfb",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 59,
"avg_line_length": 30.153846153846153,
"alnum_prop": 0.5867346938775511,
"repo_name": "IPMITMO/statan",
"id": "7934476a9204d6e3cfa54a787fc3d2870d9f6b12",
"size": "392",... |
import os, sys, hashlib, binascii, time, decimal, logging, locale, re, io
import difflib, json, inspect, tempfile, shutil
import apsw, pytest, requests
from requests.auth import HTTPBasicAuth
CURR_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
sys.path.append(os.path.n... | {
"content_hash": "1b8c53cb4c35e8bdbd75a637cedc7861",
"timestamp": "",
"source": "github",
"line_count": 378,
"max_line_length": 146,
"avg_line_length": 43.25132275132275,
"alnum_prop": 0.6350847146614472,
"repo_name": "Reddcraft/reddcraftd",
"id": "62936173cc50071615dda0129e71a3cf4e9bfe81",
"size":... |
from .. import events
from ..entity import entity_method
@events.subscriber
def did_load_object(event):
"""
Sets _parent references for entities in a container when the container
entity is loaded.
"""
if hasattr(event.actor, 'container'):
contents = list(event.actor.container.contents.value... | {
"content_hash": "4b3866ce52164b9955694182a43c89cc",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 94,
"avg_line_length": 33.888888888888886,
"alnum_prop": 0.6633879781420765,
"repo_name": "wirefish/amber",
"id": "89b94d0906afaeb86ec801818bc01ded975491fc",
"size": "915",... |
from twisted.internet.protocol import Factory
from twisted.protocols.basic import LineReceiver
from twisted.internet import reactor
from twisted.web.websockets import WebSocketsResource, WebSocketsProtocol, lookupProtocolForFactory
from twisted.web.resource import Resource
from twisted.web.server import Site
from twis... | {
"content_hash": "f95a829bedac27b6e23e9f55b58bfa9b",
"timestamp": "",
"source": "github",
"line_count": 135,
"max_line_length": 121,
"avg_line_length": 31.637037037037036,
"alnum_prop": 0.5876843830484664,
"repo_name": "alexkau/ChatGlobal",
"id": "b28a5d2577baa4581c4f3b75e32ce927d58801ee",
"size": ... |
from django.utils.translation import ugettext_lazy as _
from facebook import GraphAPIError
from rest_framework import serializers
from user import constants
from user.models import FruitUser
from ..utils import facebook as fcb
class AuthTokenFacebookSerializer(serializers.Serializer):
email = serializers.Email... | {
"content_hash": "5dff7e33a9eac480e4147b2385db638f",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 101,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.615424430641822,
"repo_name": "jsmesami/naovoce",
"id": "7e4723b46ebae7efc590abec615e63df0bf2c3c3",
"size": "193... |
import bisect
import re
import token
import tokenize
class ChangeCollector(object):
def __init__(self, text):
self.text = text
self.changes = []
def add_change(self, start, end, new_text=None):
if new_text is None:
new_text = self.text[start:end]
self.changes.appe... | {
"content_hash": "9963645443427242ad3342c0316f03ff",
"timestamp": "",
"source": "github",
"line_count": 364,
"max_line_length": 79,
"avg_line_length": 30.535714285714285,
"alnum_prop": 0.512280701754386,
"repo_name": "sreejithr/emacs.d",
"id": "5dbfbb10e289a9a5db800f29b47c050c24a37962",
"size": "11... |
__author__ = 'Avinesh_Kumar'
'''
MIT License
Copyright (c) 2017 Avinesh Kumar
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,... | {
"content_hash": "fa4b13f7d803873e670b93a8ca5ecc2c",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 78,
"avg_line_length": 34.532467532467535,
"alnum_prop": 0.6991350131628432,
"repo_name": "avinesh09/SimplePyHttpServer",
"id": "b9f9a372efef3d29cfdd2c58aa5050c20b4650a1",
... |
import sys
import math
import random
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
import pymel.core as PyMEL
kNodeName = "cyclone"
kNodeId = OpenMaya.MTypeId(0x10001) # Must be < 0x80000
class cyclone(OpenMayaMPx.MPxNode):
aCurve = OpenMaya.MObject()
aRandomSeed = OpenMaya.MObject()
... | {
"content_hash": "2bb15037da5948ec38e6e8c9c64c5ae2",
"timestamp": "",
"source": "github",
"line_count": 169,
"max_line_length": 97,
"avg_line_length": 32.81065088757396,
"alnum_prop": 0.745356176735798,
"repo_name": "arharvey/Manifest",
"id": "fad94874300f69e0ac863d80f1f5c4ced1cc49b7",
"size": "556... |
"""A simple example on how to use keras model for inference."""
import time
from absl import app
from absl import flags
from absl import logging
import tensorflow as tf
import tensorflow.compat.v1 as tf1
import tensorflow_datasets as tfds
import effnetv2_model
import preprocessing
import utils
FLAGS = flags.FLAGS
d... | {
"content_hash": "716fd6bb93a3dae35c18d60de57ffdab",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 79,
"avg_line_length": 33.46875,
"alnum_prop": 0.6822284469343293,
"repo_name": "google/automl",
"id": "5ea6e3f68bc583bd14eb07ff4eee081ac78bcabd",
"size": "7108",
"binar... |
from keystoneclient.auth.identity import v2
from keystoneclient import session
from neutronclient.v2_0 import client
import sys
PUBLIC_NET_NAME="CHINATELECOM"
PUBLIC_SUBNET_NAME="CHINATELECOM"
PUBLIC_SUBNET_CIDR="115.238.155.160/27"
SHARED_SUBNET_CIDR="172.30.248.0/22"
START="115.238.155.162"
END="115.238.155.190"
DNS... | {
"content_hash": "6cc19cd8f903eb7c2ebf53ac7b1209e1",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 135,
"avg_line_length": 32.60233918128655,
"alnum_prop": 0.6462780269058296,
"repo_name": "zhaozhilong1993/demon",
"id": "c4bb0cfb5c710c4caef084eb7ea1f800e9b97dee",
"size"... |
from astropy.coordinates import SkyCoord
from astropy.table import Table, Column
import astropy.units as u
from astropy.units import Quantity
from gammapy.spectrum.models import LogParabola
from gammapy.spectrum import CrabSpectrum
def define_flux_crab_above_energy(emin=1 * u.TeV, emax=10 * u.TeV):
crab = CrabSpec... | {
"content_hash": "4c8f1e704c8df6cd3a04c0469b8da0d0",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 121,
"avg_line_length": 39.096774193548384,
"alnum_prop": 0.6363448844884488,
"repo_name": "gammasky/cta-dc",
"id": "638a83740a18ac28840c4401d923b24d2f4b705c",
"size": "48... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from noball_django.settings import DEBUG, STATIC_ROOT
admin.autodiscover()
urlpatterns = patterns('',
url(r'^static/(?P<path>.*)$', 'django.views.static.serve'
,{'document_root': STATIC_ROOT}),
url(r'^mlb/', include('ml... | {
"content_hash": "994d4f0882fd45aee55c2340cc2bf671",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 25.615384615384617,
"alnum_prop": 0.6936936936936937,
"repo_name": "Shinichi-Nakagawa/no-ball",
"id": "718a17437bf71b0179945e75ea2d34d89327e4dd",
"si... |
"""Unit tests around ``hospital.assertions``."""
| {
"content_hash": "80bee783e81aa4c280836426024349b3",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 48,
"avg_line_length": 49,
"alnum_prop": 0.673469387755102,
"repo_name": "python-hospital/hospital",
"id": "ae430c5dc7079901e721b035758b8629ab4424c9",
"size": "73",
"binar... |
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import StaleElementReferenceException, NoSuchElementException, NoSuchWindowException
def init():
driver = webdriver.Chrome()
driver.get("http://www.instagram.com")
return driver
| {
"content_hash": "344778331f400cc21d07f4aabace39d2",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 116,
"avg_line_length": 41.714285714285715,
"alnum_prop": 0.8321917808219178,
"repo_name": "jshaker/igbot",
"id": "497227f0970807a8a9fcc5b80e9c3b01c52aa2fc",
"size": "292",
... |
import pytest
from couchbase.exceptions import CouchbaseException
from couchbase.options import (AnalyticsOptions,
GetOptions,
InsertOptions,
QueryOptions,
RemoveOptions,
... | {
"content_hash": "82e3db802b6f92b867984440a0f05e11",
"timestamp": "",
"source": "github",
"line_count": 168,
"max_line_length": 117,
"avg_line_length": 35.17261904761905,
"alnum_prop": 0.5564393298358437,
"repo_name": "couchbase/couchbase-python-client",
"id": "29276bf73d470eb8f743069a64342c8a713509c... |
from setuptools import setup
__version__ = 'unknown'
with open('po_localization/version.py') as version_file:
exec(version_file.read())
with open('README.rst') as readme_file:
long_description = readme_file.read()
setup(
name='po_localization',
packages=[
'po_localization',
'po_locali... | {
"content_hash": "9a74441959c275d009075ee76507285f",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 101,
"avg_line_length": 38.36,
"alnum_prop": 0.6225234619395204,
"repo_name": "kmichel/po-localization",
"id": "e90f109f4c1bad147947e3749403b96a315fff95",
"size": "1934",
... |
print("Hallo Welt")
| {
"content_hash": "d2fb080452fdac2cfc84d170ef8bc20e",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 19,
"avg_line_length": 20,
"alnum_prop": 0.7,
"repo_name": "kantel/python-schulung",
"id": "62fd63ba6e10b372367a6277964956bcb394b78b",
"size": "20",
"binary": false,
"co... |
import os
import re
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import chrome_remote_control
def Main(args):
options = chrome_remote_control.BrowserOptions()
parser = options.CreateParser('rendering_microbenchmark_test.py <sitelist>')
# TODO(nduca): Add test specific options here,... | {
"content_hash": "e232f9e115086ef80f5452f05f91b25c",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 80,
"avg_line_length": 31.930555555555557,
"alnum_prop": 0.6324488908220965,
"repo_name": "junmin-zhu/chromium-rivertrail",
"id": "4dd26ed42f5ff0ae55b7ae62f3b105c04d1e9167",
... |
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic.base import TemplateView
from django.utils.decorators import method_decorator
from django.contrib.auth import authenticate, login, logout
from rest_framework import generics, permissions, status, views
from rest_framework.response im... | {
"content_hash": "c6f00b1895c6600c7680341cdcd78607",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 106,
"avg_line_length": 30.98936170212766,
"alnum_prop": 0.6848609680741503,
"repo_name": "ratnim/JRR-Prototyp1",
"id": "f11e4bb9bfe68c8346a5945f73e8cad60f488c45",
"size":... |
import numpy as np
import networkx as nx
import random
from tqdm import tqdm
from itertools import product, combinations, count
random.seed(12345)
DEBUG = False
def change_sign_to_distance(g, mapping={-1: 1, 1: -1}):
for i, j in g.edges_iter():
g[i][j]['weight'] = mapping[g[i][j]['sign']]
return g
... | {
"content_hash": "35e7ca708c79feda0f61921697d59174",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 98,
"avg_line_length": 31.41826923076923,
"alnum_prop": 0.5121652639632747,
"repo_name": "xiaohan2012/snpp",
"id": "1cd2e10fd13d4d4e16f84f94da97b62f6394f670",
"size": "653... |
from setuptools import setup
import os
long_description = open("README.rst").read()
install_requires = ['numpy>=1.7.1',
'quantities>=0.9.0']
if os.environ.get('TRAVIS') == 'true' and \
os.environ.get('TRAVIS_PYTHON_VERSION').startswith('2.6'):
install_requires.append('unittest2>=0.5.1')
s... | {
"content_hash": "9d9b06756d615ab1c3d2bb8492e5573d",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 167,
"avg_line_length": 40.2972972972973,
"alnum_prop": 0.6237424547283702,
"repo_name": "guangxingli/python-neo",
"id": "7f0259a0f47300230bf2120b1bddc2d4e2007c95",
"size":... |
import re
from urllib.parse import urljoin
from streamlink.plugin import Plugin
from streamlink.plugin.api import validate
from streamlink.stream import HLSStream
COOKIE_PARAMS = (
"devicetype=desktop&"
"preferred-player-odm=hlslink&"
"preferred-player-live=hlslink"
)
_id_re = re.compile(r"/(?:program|di... | {
"content_hash": "da2e8883ee7cd4844bf31876d4eac2e6",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 81,
"avg_line_length": 28.21875,
"alnum_prop": 0.6140642303433002,
"repo_name": "beardypig/streamlink",
"id": "a04542158e4f8e06c8341e8fc4d8ac71a5730cdb",
"size": "1806",
... |
"""Define package tests."""
| {
"content_hash": "a59668f657b1e492b804c457b341aa70",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 27,
"avg_line_length": 28,
"alnum_prop": 0.6428571428571429,
"repo_name": "bachya/regenmaschine",
"id": "948444043ca110469d7042e0cfdbb8eb88f7077f",
"size": "28",
"binary":... |
from logging import getLogger
from pygrim.decorators import template_method
log = getLogger(__file__)
class ContextIface(object):
""" testy contextu dostupneho z templaty"""
def postfork(self):
pass
@template_method('context.jinja', session=True)
def context(self, context):
return {... | {
"content_hash": "2de24e02bb19a571bf95d67ec0774c09",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 51,
"avg_line_length": 20.88235294117647,
"alnum_prop": 0.6309859154929578,
"repo_name": "ondrejkajinek/pyGrim",
"id": "3257c2e79bf198f21d7a1db9cccf08fbf01f0ea3",
"size": "... |
"""
Created on March 8th 2018
@author: rouxpn
"""
from __future__ import division, print_function, unicode_literals, absolute_import
import os
import numpy as np
class combine():
"""
Combines the PHISICS and RELAP output into one.
"""
def __init__(self,workingDir,relapData, phisicsData,depTimeDict,inpTimeDi... | {
"content_hash": "4d6cace3d81d427f32755605b30ae78c",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 116,
"avg_line_length": 40.62222222222222,
"alnum_prop": 0.6641137855579868,
"repo_name": "joshua-cogliati-inl/raven",
"id": "86bf6aa648f54d40fb23310152bc290b895c3e1f",
"si... |
"""Parallel workflow execution via OAR http://oar.imag.fr
"""
import os
import stat
from time import sleep
import subprocess
import json
from .base import (SGELikeBatchManagerBase, logger, iflogger, logging)
from nipype.interfaces.base import CommandLine
class OARPlugin(SGELikeBatchManagerBase):
"""Execute usi... | {
"content_hash": "a120f783394696fd8492cbba1cdb6fe2",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 79,
"avg_line_length": 34.23287671232877,
"alnum_prop": 0.5074029611844738,
"repo_name": "dgellis90/nipype",
"id": "89fb42fbcc48f93ad29a00acb5b97f1212211b3d",
"size": "499... |
"""Code for assessing alignment accuracy"""
import re
import pysam
from mitty.simulation.sequencing.writefastq import ri, load_qname_sidecar, parse_qname
# good to have these together. Code that uses score_alignment_error is very likely to use
# ri, load_qname_sidecar and parse_qname
from mitty.lib.cigars import cigarv... | {
"content_hash": "bdd08db1eaf7223b21fc9590716b28bd",
"timestamp": "",
"source": "github",
"line_count": 108,
"max_line_length": 109,
"avg_line_length": 36.75925925925926,
"alnum_prop": 0.6642317380352645,
"repo_name": "sbg/Mitty",
"id": "bcf4cdab35e05c55f01f68d8dd61b517c9320062",
"size": "3970",
... |
__author__ = 'Kevin Godden'
import csv
import os
import time
import re
import fnmatch
import math
from datetime import datetime
from decimal import Decimal
#del show(i):
# name = i.path + i.
def to_timestamp(dt):
# return str(calendar.timegm(dt.timetuple()))
epoch = datetime.utcfromtimestamp(0)
delta... | {
"content_hash": "65655cece0b7314248123fd5942946d3",
"timestamp": "",
"source": "github",
"line_count": 410,
"max_line_length": 126,
"avg_line_length": 32.91951219512195,
"alnum_prop": 0.5406386604430614,
"repo_name": "kgodden/ook",
"id": "f7feb30949dcec103979fef3833bae8ff8b77635",
"size": "13497",... |
from .models import Task
from .serializers import TaskSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
from django.utils import timezone
import datetime
now = datetime.date.today()
class TaskViewSet(viewsets.ModelViewSet):
... | {
"content_hash": "afae0c47f27361fd93357897ec17779f",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 52,
"avg_line_length": 25.8,
"alnum_prop": 0.7550387596899225,
"repo_name": "PabloSuarez/API_django",
"id": "d5c676812ed67aea8840e4b28876cba2042dce08",
"size": "645",
"bi... |
from chatterbot import ChatBot
# Create a new instance of a ChatBot
bot = ChatBot(
'Default Response Example Bot',
storage_adapter='chatterbot.storage.SQLStorageAdapter',
logic_adapters=[
{
'import_path': 'chatterbot.logic.BestMatch'
},
{
'import... | {
"content_hash": "eee80ad685243cb5b51635075a54dca5",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 92,
"avg_line_length": 29.59375,
"alnum_prop": 0.6240760295670539,
"repo_name": "sahararaju/dataasservices",
"id": "854fe437ba1994a561117cfe675d5422c1c42425",
"size": "972"... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "netavg.settings.local")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "1a638291467ca70b8630d51397eb3c75",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 76,
"avg_line_length": 25.88888888888889,
"alnum_prop": 0.7124463519313304,
"repo_name": "grollins/netavg-django",
"id": "9b7db84ae2d71737ad21877bfbaee6930928f8ab",
"size": ... |
import os
from os.path import relpath, join
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
def find_package_data(data_root, package_root):
files = []
for root, dirnames, filenames in os.walk(data_root):
for fn in filenames:
... | {
"content_hash": "0ba140e3559cb8c04f8615bf19987602",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 96,
"avg_line_length": 39.57575757575758,
"alnum_prop": 0.6730474732006125,
"repo_name": "bmanubay/open-forcefield-tools",
"id": "223ab2388d1edbe612f8c775975ee7adcba6e98b",
... |
import asyncio
import e2c.async as e2c
config = (
'.run -- action',
'action.out -- print')
async def action(data, out):
await out(data)
async def run_async():
sess = e2c.Session(config)
sess.actor('action', action)
sess.actor('print', lambda data: print(data))
sess.visualize()
awa... | {
"content_hash": "4d3e7ef3c800b24e0502924d9f60cc54",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 49,
"avg_line_length": 17.2,
"alnum_prop": 0.6441860465116279,
"repo_name": "elastic-event-components/e2c",
"id": "5f072c2d8b8b10c6aeb7065f33c93557c5eb206c",
"size": "1114"... |
"""add account id
Revision ID: 3734300868bc
Revises: 3772e5bcb34d
Create Date: 2013-09-30 18:07:21.729288
"""
# revision identifiers, used by Alembic.
revision = '3734300868bc'
down_revision = '3772e5bcb34d'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('account_profile', sa.Colu... | {
"content_hash": "889730f3e0d1f8a2fd316cac3bdaa03f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 77,
"avg_line_length": 17,
"alnum_prop": 0.7186700767263428,
"repo_name": "vsilent/smarty-bot",
"id": "564245834f32541caae95d4abf3e9cf4c18a206a",
"size": "391",
"binary":... |
from mock import Mock
from oslo.config import cfg
import testtools
from glance import db as db_api
import glance.db
from glance.openstack.common import importutils
CONF = cfg.CONF
CONF.import_opt('use_tpool', 'glance.db')
CONF.import_opt('data_api', 'glance.db')
class DbApiTest(testtools.TestCase):
def test_get... | {
"content_hash": "ed3fbea536bac1097a020310240fd230",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 78,
"avg_line_length": 33.83582089552239,
"alnum_prop": 0.6325540361711512,
"repo_name": "cloudbau/glance",
"id": "a4605db65b1f42c923100775cca9cd7a209998a1",
"size": "2948"... |
"""\
This module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.
Functions:
socket() -- create a new socket object
socketpai... | {
"content_hash": "e8b4865dffe292469e461165042a71ff",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 79,
"avg_line_length": 31.49135802469136,
"alnum_prop": 0.5362239297475302,
"repo_name": "MalloyPower/parsing-python",
"id": "f96a14683715eabfec8936cea14e6f9a63a381cb",
"s... |
import os
import re
import sys
from io import open
from setuptools import setup
name = 'pyramid-restful-jsonapi'
package = 'pyramid_restful_jsonapi'
description = 'JSONAPI support for Pryamid Restful Framework'
url = 'https://github.com/danpoland/pyramid-restful-jsonapi'
author = 'Daniel Poland'
author_email = 'danpo... | {
"content_hash": "e791df915b3cefc83cdacc84e1f1e70b",
"timestamp": "",
"source": "github",
"line_count": 106,
"max_line_length": 90,
"avg_line_length": 27.5,
"alnum_prop": 0.6260720411663808,
"repo_name": "danpoland/pyramid-restful-jsonapi",
"id": "85f3daf4faca298469d25cf01defceeeae002e3a",
"size": ... |
__title__ = "persiantools"
__url__ = "https://github.com/mhajiloo/persiantools"
__version__ = "1.4.1"
__build__ = __version__
__author__ = "Majid Hajiloo"
__author_email__ = "majid.hajiloo@gmail.com"
__license__ = "MIT"
__copyright__ = "Copyright 2016-2019 Majid Hajiloo"
import sys
PY2 = True if sys.version_info[0] ... | {
"content_hash": "aebc291c88bbc18b48b74c7537012887",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 52,
"avg_line_length": 25.76923076923077,
"alnum_prop": 0.6447761194029851,
"repo_name": "mhajiloo/persiantools",
"id": "675c5ae296fe1ada1bf5ec6ee9cb5467f6d4f192",
"size": ... |
from django.contrib.gis.db import models
from apps.common.models import AbstractFeature, AbstractObservation
class SamplingFeature(AbstractFeature):
geometry = models.PointField(
help_text="Spatial information about feature.",
srid=3857
)
class Observation(AbstractObservation):
# TODO: m... | {
"content_hash": "78ee9ca07dbb214b1efe6cc3c66e25a7",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 81,
"avg_line_length": 31.93103448275862,
"alnum_prop": 0.6846652267818575,
"repo_name": "gis4dis/poster",
"id": "0f17a16afce8a558f9faa8d53c20ccd232b70723",
"size": "926",
... |
"""
An example to show receiving events from an Event Hub with checkpoint store doing checkpoint by batch asynchronously.
In the `receive_batch` method of `EventHubConsumerClient`:
If no partition id is specified, the checkpoint_store are used for load-balance and checkpoint.
If partition id is specified, the checkpoin... | {
"content_hash": "c2b1dd9defdd77fbed3dea186f401cc0",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 117,
"avg_line_length": 37.666666666666664,
"alnum_prop": 0.7339927121290994,
"repo_name": "Azure/azure-sdk-for-python",
"id": "f9518456784d7bab419352dcdeb231374a94ea7d",
"... |
import time
from flask import current_app, request
from flask.ext.login import current_user
from functools import wraps
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-ou... | {
"content_hash": "6bb051aa9e0decd16c04a44da3e425a7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 92,
"avg_line_length": 37.484848484848484,
"alnum_prop": 0.5808407437348424,
"repo_name": "alexandreblin/tvshows",
"id": "f0cc492cebaf9e5fa6a9e193a5708477c061fffb",
"size":... |
from horizon import tabs
from django.utils.translation import ugettext_lazy as _
class DetailsTab(tabs.Tab):
"""Class to handle the data population of the test details views."""
name = _("Details")
slug = "details"
template_name = \
"project/connections/reachability_tests/_detail_overview.htm... | {
"content_hash": "ee47cd939cd980bdc1db6fe421fba8f4",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 30.27777777777778,
"alnum_prop": 0.7073394495412844,
"repo_name": "wolverineav/horizon-bsn",
"id": "53206b0010a79b516a8eab31c97e1413fc5742e2",
"size"... |
"""
Finds and prints MSVC and Windows SDK paths.
It outpus:
Line 1: the base path of the Windows SDK.
Line 2: the most recent version of the Windows SDK.
Line 3: the path of the most recent MSVC.
Example:
C:\Program Files (x86)\Windows Kits\10
10.0.19041.0
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTool... | {
"content_hash": "83165dd882c8df85c0da872ac4e65614",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 88,
"avg_line_length": 28.438356164383563,
"alnum_prop": 0.6189788053949904,
"repo_name": "google/perfetto",
"id": "1628c0720ae3b1db99340e323562c047d87ce2e0",
"size": "2699... |
from time import sleep
from gppylib.commands.base import Command, ExecutionError, REMOTE, WorkerPool
from gppylib.db import dbconn
from gppylib.commands import gp
from gppylib.gparray import GpArray
from test.behave_utils.utils import *
import platform
from behave import given, when, then
# todo ONLY implemented for... | {
"content_hash": "396bc12ebf08e270d61876abea382925",
"timestamp": "",
"source": "github",
"line_count": 124,
"max_line_length": 135,
"avg_line_length": 48.766129032258064,
"alnum_prop": 0.6816603274350918,
"repo_name": "ashwinstar/gpdb",
"id": "65d2349e22c94ef0e16593bbe303e14062494159",
"size": "60... |
from custom_exceptions.bad_plateau_init import BadPlateauInit
class Plateau:
upper_x = 0
upper_y = 0
def __init__(self, upper_x, upper_y):
if upper_x <= 0:
raise BadPlateauInit
if upper_y <= 0:
raise BadPlateauInit
self.upper_x = upper_x
self.upp... | {
"content_hash": "b072cc0edc9b797937e544a8a09d084f",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 90,
"avg_line_length": 31.071428571428573,
"alnum_prop": 0.5348659003831417,
"repo_name": "tkanoff/therover",
"id": "3c230a6d710ced2e23cecaee171583b24fc9e261",
"size": "133... |
from django.conf.urls.defaults import patterns, url
urlpatterns = patterns('beeswax.views',
url(r'^$', 'index', name='index'),
url(r'^execute/?$', 'execute_query', name='execute_query'),
url(r'^execute/design/(?P<design_id>\d+)$', 'execute_query', name='execute_design'),
url(r'^execute/query/(?P<query_histor... | {
"content_hash": "4c9b12647e428f67d3169f63e3dcf15b",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 147,
"avg_line_length": 58.278688524590166,
"alnum_prop": 0.6610407876230661,
"repo_name": "yongshengwang/builthue",
"id": "4bd3c502227c86f72dc7deab7cb8890701933876",
"size... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.