text
stringlengths
4
1.02M
meta
dict
""" Django settings for betleague project. Generated by 'django-admin startproject' using Django 1.11.4. For more information on this file, see https://docs.djangoproject.com/en/1.11/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.11/ref/settings/ """ import ...
{ "content_hash": "1b461d2d6be4f44f2f4f466ebb9f60ae", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 91, "avg_line_length": 28.055118110236222, "alnum_prop": 0.696042660679203, "repo_name": "asyler/betleague", "id": "c904c0c9f084f2d1749c82f9b9d67aa9e056e33c", "size": "356...
def get_students_with_grade(students, grade): return list(filter(lambda student: student[1] == grade, students)) def get_second_lowest_grade(students): unique_grades = set(map(get_grade, students)) ascending_grades = sorted(unique_grades) return ascending_grades[1] # return second lowest grade def ...
{ "content_hash": "0cb122dee81f8917941490da80b87877", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 70, "avg_line_length": 29.555555555555557, "alnum_prop": 0.6578947368421053, "repo_name": "rootulp/hackerrank", "id": "872e71cb33d03ed20d6dbafbcb96938407c6ec7c", "size": "7...
from django.core.management.base import BaseCommand from payments.utils import send_unpaid_order_email_notifications class Command(BaseCommand): help = 'Send notifications for unpaid order by emails' def handle(self, *args, **options): send_unpaid_order_email_notifications(verbose=options['verbosity...
{ "content_hash": "b8442c291f0d8bfd26447b99e8495094", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 98, "avg_line_length": 35.46153846153846, "alnum_prop": 0.7310195227765727, "repo_name": "Matusf/django-konfera", "id": "7f02aa73e5bb2d572d9d81ebd80dee28f79b7805", "size": ...
from collections import OrderedDict from zorro.di import di, has_dependencies, dependency from tilenol.event import Event class LayoutMeta(type): @classmethod def __prepare__(cls, name, bases): return OrderedDict() def __init__(cls, name, bases, dic): cls.fields = list(dic.keys()) @h...
{ "content_hash": "3312966af97795bbd1d256f96300c5be", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 59, "avg_line_length": 24.233333333333334, "alnum_prop": 0.561898211829436, "repo_name": "tailhook/tilenol", "id": "f39b78feb970f0e9ff6811c050bf186c9ff5b595", "size": "1454...
from morphforge.traces.tracetypes import TraceFixedDT from morphforge.traces.tracetypes import TraceVariableDT from morphforge.traces.tracetypes import TracePointBased from morphforge.traces.tracetypes import TracePiecewise from morphforge.traces.tracetypes import TracePieceFunctionLinear from morphforge.traces.tracety...
{ "content_hash": "7e9605edb6e1696db4113e566512a49b", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 66, "avg_line_length": 32.7, "alnum_prop": 0.81855249745158, "repo_name": "mikehulluk/morphforge", "id": "7dae8020575b14f619319a7ba4c98f55eed31cb9", "size": "2520", "bina...
from collections import defaultdict from os import listdir from os.path import abspath, dirname, isdir, isfile, join, realpath, relpath, splitext import re from subprocess import Popen, PIPE import sys # Runs the tests. WREN_DIR = dirname(dirname(realpath(__file__))) TEST_DIR = join(WREN_DIR, 'test') WREN_APP = join(W...
{ "content_hash": "8e8eb00ddb9d6b537d8155a7616ab82a", "timestamp": "", "source": "github", "line_count": 234, "max_line_length": 86, "avg_line_length": 29.957264957264957, "alnum_prop": 0.6042796005706134, "repo_name": "daimajia/wren", "id": "ba3a6562a386684135cbc900b3cb1aac9a887e8b", "size": "7029"...
from eps2pdf_converter import psfrag_replace import sys from PyQt4 import QtCore, QtGui # from eps2pdf_converter import psfrag_replace class MainWindow(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__(self) self.resize(350, 250) self.setWindowTitle('eps2PDF Converter') ...
{ "content_hash": "b2ca1b816bc68ebe8a246227484274c0", "timestamp": "", "source": "github", "line_count": 226, "max_line_length": 109, "avg_line_length": 38.89823008849557, "alnum_prop": 0.648959162780116, "repo_name": "darcamo/epsfrag2pdf", "id": "42e898d3eb3547a572593728007c3a25fee66c4b", "size": "...
from compiler.compiler import LambdaCompiler def main(): f = open('input.txt', 'r') compiler = LambdaCompiler(f) compiler.perform('output.py') if __name__ == "__main__": main()
{ "content_hash": "5580d6e9c6369b480c92f33d73ed0735", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 44, "avg_line_length": 21.666666666666668, "alnum_prop": 0.6205128205128205, "repo_name": "felipewaku/compiladores-p2", "id": "f1eb1cfbd059baa144867bfced5658ac57b88e52", "si...
from pprint import pprint import matplotlib.pyplot as plt from common import Fft def fft_padded_plot(x): X = Fft(x, sample_rate=8192, padded=True) plt.figure() plt.plot(X.hz, X.abs) plt.xlabel('Frequency (Hz)') plt.ylabel('|H|') plt.savefig('q1_fft_padded.png') def fft_not_padded_plot(x): ...
{ "content_hash": "29e62cf9545411fedbdfae9a31d0ed8a", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 93, "avg_line_length": 25.602941176470587, "alnum_prop": 0.5985066053991959, "repo_name": "viniciusd/DCO1008---Digital-Signal-Processing", "id": "516e1dfe050ac03edd64db2d504b...
from django.contrib import admin from .models import * admin.site.register(Guide) admin.site.register(Category) admin.site.register(Document) admin.site.register(News) admin.site.register(Event) admin.site.register(EventType) admin.site.register(Field) admin.site.register(Catalog) admin.site.register(CatalogFile) adm...
{ "content_hash": "8db07416c9b766dd6b305ac6a9d3addd", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 32, "avg_line_length": 24.714285714285715, "alnum_prop": 0.8179190751445087, "repo_name": "javierwilson/cacaomovilcom", "id": "3c93a58cce1ffbe287436c403b5583c72fb32a30", "s...
from sys import argv from string import strip from os import listdir,path from optparse import OptionParser from datetime import datetime import tarfile _author__ = "Jesse Zaneveld" __copyright__ = "Copyright 2007-2012, The Cogent Project" __credits__ = ["Jesse Zaneveld", "Rob Knight"] __license__ = "GPL" __version__...
{ "content_hash": "a57e3e8733adde0a1caa9aea78a93921", "timestamp": "", "source": "github", "line_count": 342, "max_line_length": 83, "avg_line_length": 33.953216374269005, "alnum_prop": 0.5788839131932484, "repo_name": "sauloal/cnidaria", "id": "add232f58dc333d5dbb4b0a40c65d46eb02d31f6", "size": "11...
from model.contact import Contact from random import randrange def test_delete_some_contact(app): if app.contact.count() == 0: app.contact(Contact(Firstname="First name", Lastname="Last name", address="ddsdsf", homephone="NIckname", mobilephone="Corpo", secondaryphone="698998657", ...
{ "content_hash": "99be3423f728a59f24cbf47259993182", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 134, "avg_line_length": 42.0625, "alnum_prop": 0.6775631500742942, "repo_name": "erybak90/Szkolenie-python", "id": "faf57db1ec3be44d4bd5da365f970f882033b816", "size": "673"...
import tests.model_control.test_ozone_custom_models_enabled as testmod testmod.build_model( ['Fisher'] , ['MovingMedian'] , ['Seasonal_MonthOfYear'] , ['NoAR'] );
{ "content_hash": "cd617ef1790155a75406c73cf0684d2d", "timestamp": "", "source": "github", "line_count": 4, "max_line_length": 91, "avg_line_length": 41, "alnum_prop": 0.7195121951219512, "repo_name": "antoinecarme/pyaf", "id": "80ca0a911bce799bf8d4e1690dd952309ab491a7", "size": "164", "binary": f...
import requests class Page(object): def __init__(self, url='', src='', title=''): self.url = url self.src = src self.title = title self.body = '' def __str__(self): return self.url + '\n' + self.src def to_dict(self): obj = {} obj['url'] = self.ur...
{ "content_hash": "6f6204ca6002089801fd4f42f8ffd480", "timestamp": "", "source": "github", "line_count": 43, "max_line_length": 74, "avg_line_length": 21.651162790697676, "alnum_prop": 0.4865735767991407, "repo_name": "ykakihara/nlp-hackathon", "id": "b55afa792d46f91717e980c01c35bda15efc8424", "size...
"""This is the "nester.py" module and it provides one function called print_lol() which prints lists that may or may not include nested lists.""" import sys def print_lol(the_list, indent=False, level=0, fh=sys.stdout): """This function takes one positional argument called "The_list", which is any Python lis...
{ "content_hash": "18485bff73787d22de3f7cc1f3a1959c", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 166, "avg_line_length": 36.42307692307692, "alnum_prop": 0.6251319957761352, "repo_name": "byplacebo/head-first-python", "id": "bcd3793df8515517ae85cb2847d307578221683d", "...
import email import imaplib import os.path import re from airflow import LoggingMixin, AirflowException from airflow.hooks.base_hook import BaseHook class ImapHook(BaseHook): """ This hook connects to a mail server by using the imap protocol. :param imap_conn_id: The connection id that contains the info...
{ "content_hash": "cdde0bf27c65a335c5c83fef6bfbc113", "timestamp": "", "source": "github", "line_count": 297, "max_line_length": 108, "avg_line_length": 40.178451178451176, "alnum_prop": 0.5595407692952317, "repo_name": "r39132/airflow", "id": "5b441a153faff99317dc101897b63371c1b9507f", "size": "127...
"""Find attributes of a file other than its name. """ import os.path import time print 'File :', __file__ print 'Access time :', time.ctime(os.path.getatime(__file__)) print 'Modified time:', time.ctime(os.path.getmtime(__file__)) print 'Change time :', time.ctime(os.path.getctime(__file__)) print 'Size ...
{ "content_hash": "be8507315f7ca94b93adce44c62d52b2", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 62, "avg_line_length": 32.18181818181818, "alnum_prop": 0.6384180790960452, "repo_name": "Akagi201/learning-python", "id": "651fd54c1e69e419a839663daff6625d4880c2d0", "size...
import re import sys import time from collections import deque from datetime import datetime, timedelta from logging import Logger from threading import Event, Thread from typing import Dict, Generator, Optional from botocore.exceptions import ClientError from botocore.waiter import Waiter from airflow.exceptions imp...
{ "content_hash": "afbe5899ff44dbbe0a4b86e105ff54b0", "timestamp": "", "source": "github", "line_count": 493, "max_line_length": 147, "avg_line_length": 40.8498985801217, "alnum_prop": 0.6263468891206118, "repo_name": "apache/incubator-airflow", "id": "f560dff4e74714acce3a650d62f2c8c783e217cb", "siz...
import logging from typing import List, Optional, TYPE_CHECKING from sqlalchemy.exc import SQLAlchemyError from superset.charts.filters import ChartFilter from superset.dao.base import BaseDAO from superset.extensions import db from superset.models.core import FavStar, FavStarClassName from superset.models.slice impo...
{ "content_hash": "e0f53c9064db127589b17076761d0ee2", "timestamp": "", "source": "github", "line_count": 67, "max_line_length": 82, "avg_line_length": 30.44776119402985, "alnum_prop": 0.5936274509803922, "repo_name": "apache/incubator-superset", "id": "8e16f3b445b49e3855f93843f5d7a2084b86e86c", "siz...
import os import shutil import numpy as np import sys from setup import params from plots import plots from compute_lines import compute_lines import read_fortran as rf import test_rhd as test_rhd def set_params(): """Reads the param file and returns the parameters""" print '\nSetup.py: ' input_file = p...
{ "content_hash": "14b5988bf2cca961d40da3c2c8949765", "timestamp": "", "source": "github", "line_count": 260, "max_line_length": 84, "avg_line_length": 36.14230769230769, "alnum_prop": 0.5594338618708098, "repo_name": "xparedesfortuny/pylines", "id": "aa1faaadc8d775989aa941aed1ed9b00045b0f05", "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 ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungro...
{ "content_hash": "ae59b6fd6fdb4e8c611dcdc56961d230", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 107, "avg_line_length": 54.101694915254235, "alnum_prop": 0.7233709273182958, "repo_name": "Azure/azure-sdk-for-python", "id": "4c1fdb009898fecc62b06dd7c9c3139ca3b2ac78", "...
''' Weather station: One script to rule them all... HMH - 18/07/2018 ''' import sys,time,os import Adafruit_DHT, Adafruit_MCP3008 import Adafruit_GPIO.SPI as SPI import RPi.GPIO as GPIO import spidev import numpy as np from gpiozero import DigitalInputDevice from time import sleep #import math #import subproce...
{ "content_hash": "80678064bf4b6d8fe9272c1b41684e1b", "timestamp": "", "source": "github", "line_count": 343, "max_line_length": 287, "avg_line_length": 38.822157434402335, "alnum_prop": 0.5102883748873536, "repo_name": "opendatadurban/citizen_sensors", "id": "2769d2e12f788e601f14f3cabebb72d34f57a564"...
import ct.models from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('ct', '0041_auto_20191125_0955'), ] operations = [ migrations.AlterField( model_name='unit', name='courselet_days', field=models.IntegerF...
{ "content_hash": "7d42e2abae6f8e74029e1aea0202c5dd", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 115, "avg_line_length": 29.40740740740741, "alnum_prop": 0.5831234256926953, "repo_name": "cjlee112/socraticqs2", "id": "7fad8f68634b8011146cf5b9af09837380091bf6", "size": ...
from swgpy.object import * def create(kernel): result = Static() result.template = "object/static/structure/general/shared_rock_beach_dark_lg.iff" result.attribute_template_id = -1 result.stfName("obj_n","unknown_object") #### BEGIN MODIFICATIONS #### #### END MODIFICATIONS #### return result
{ "content_hash": "56a3ea5579f0ea3cd615362712bf719a", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 82, "avg_line_length": 23.923076923076923, "alnum_prop": 0.6945337620578779, "repo_name": "obi-two/Rebelion", "id": "fb70d5ba82f4a2b6822b777d437c6961495c6a1b", "size": "456...
''' Copyright 2016, EMC, Inc. Author(s): George Paulos ''' import os import sys import subprocess sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/fit_tests/common") import fit_common # Select test group here using @attr from nose.plugins.attrib import attr ...
{ "content_hash": "214c5a5a9dcf47eefdd55dab4d3eee64", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 125, "avg_line_length": 43.523809523809526, "alnum_prop": 0.6192560175054704, "repo_name": "BillyAbildgaard/RackHD", "id": "c0cfa20a78bfe0635245a5940dc971e19259a1b8", "size...
import web import hashlib import time import json # import urllib from markdown import markdown from sign import sign from common import * from config import render,upload_path,app_root,webConfig from conn import client from bson.objectid import ObjectId db = client.pyblog urls = ( '/0', 'dashboard', # root!!!!! '/...
{ "content_hash": "89203a10692307be58423f26e8cd9c8b", "timestamp": "", "source": "github", "line_count": 208, "max_line_length": 208, "avg_line_length": 25.927884615384617, "alnum_prop": 0.609122937140738, "repo_name": "otarim/pyblog", "id": "24ffe76130c83c308b39d132c6b5fa6fcc808c35", "size": "5743"...
from math import sin, pi sinfile = "sintable.dat" sintable = [] try: # open table.dat tablefile = file(sinfile, 'r') for i in tablefile: sintable.append(float(i)) if len(sintable) != 256: raise AttributeError, \ "current file is not a bradian sin table!" tablefile.close() except IO...
{ "content_hash": "02e3899bd9f93f79da18f1443128c19b", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 51, "avg_line_length": 25.454545454545453, "alnum_prop": 0.6598214285714286, "repo_name": "snowfarthing/nibbles_3d", "id": "de2db6008dbd0e3458f8e6897bb9e8cced9e0a75", "size...
""" Organizer user registration """ from hackfsu_com.views.generic import PageView from hackfsu_com.util import acl class OrganizerRegistrationPage(PageView): template_name = 'registration/organizer/index.html' access_manager = acl.AccessManager(acl_accept=[acl.group_user], ...
{ "content_hash": "6282280675db2c2eebbf3c31eaae7bb5", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 104, "avg_line_length": 37.15384615384615, "alnum_prop": 0.6314699792960663, "repo_name": "andrewsosa/hackfsu_com", "id": "19e109418fbd90f5b9295ee03a2b3c0025727bf1", "size"...
from tempest.api.identity import base from tempest import clients from tempest.common import credentials from tempest.common import custom_matchers from tempest import config from tempest import exceptions import tempest.test CONF = config.CONF class BaseObjectTest(tempest.test.BaseTestCase): @classmethod d...
{ "content_hash": "882971f1b7f8c930aa1eef661d651d02", "timestamp": "", "source": "github", "line_count": 118, "max_line_length": 78, "avg_line_length": 40.57627118644068, "alnum_prop": 0.6294903926482874, "repo_name": "afaheem88/tempest_neutron", "id": "fcb80f5ecc30621ee9941571e795f44524c46fc2", "si...
from typing import Optional, List import logging import os import sqlite3 import tempfile from time import time class Storage(object): path = None def __init__(self, path: Optional[str] = None, user: Optional[str] = None): log = logging.getLogger('theonionbox') self.path = None if...
{ "content_hash": "8abbe4da2c6ecdef9d24ef1dffabc34e", "timestamp": "", "source": "github", "line_count": 189, "max_line_length": 124, "avg_line_length": 33.48148148148148, "alnum_prop": 0.4943109987357775, "repo_name": "ralphwetzel/theonionbox", "id": "69abb2dd5cf725b27f4fc8beb10d74bae338f20b", "siz...
from django.db import models # Create your models here. class Notice(models.Model): ORGANIZATION_CHOICES = ( ('KIN', 'KIN'), ('SSA', 'SUST Science Arena'), ('DIK', 'Dik Theater'), ) title = models.CharField(max_length=150) body = models.TextField(blank=True) pubdate = model...
{ "content_hash": "62f8f8155582fdcd9cef684ddd4553dd", "timestamp": "", "source": "github", "line_count": 23, "max_line_length": 79, "avg_line_length": 27.82608695652174, "alnum_prop": 0.6359375, "repo_name": "salmanwahed/haystack-test-project", "id": "c997d91ffb3f1bca34468bb0e6311331cac2410c", "size...
import os, re, sys, copy from optparse import OptionParser from immunoseq.lib.immunoseqLib import * import matplotlib.cm as cm import matplotlib.pyplot as pyplot from matplotlib.ticker import * from matplotlib.font_manager import FontProperties import matplotlib.backends.backend_pdf as pltBack def getData(seqs1, seq...
{ "content_hash": "c31ff67e34485de234a129232367e6b1", "timestamp": "", "source": "github", "line_count": 203, "max_line_length": 182, "avg_line_length": 30.748768472906406, "alnum_prop": 0.5719320730535085, "repo_name": "ngannguyen/immunoseq", "id": "f41c96fff83ba4536bb5110653c906a682197098", "size"...
import json import json_myobj obj = json_myobj.MyObj('instance value goes here') print('First attempt') try: print(json.dumps(obj)) except TypeError as err: print('ERROR:', err) def convert_to_builtin_type(obj): print('default(', repr(obj), ')') # Convert objects to a dictionary of their representat...
{ "content_hash": "37280a6f56475165ba9e4c45abb80de5", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 61, "avg_line_length": 21.192307692307693, "alnum_prop": 0.6261343012704175, "repo_name": "jasonwee/asus-rt-n14uhp-mrtg", "id": "1a811012c7237034e167e88df7b29712006d0db6", ...
from django.db import connection from django.http import HttpResponseNotAllowed from django.template import loader from django.middleware.locale import LocaleMiddleware from django.utils.deprecation import MiddlewareMixin from django.utils.translation.trans_real import parse_accept_lang_header class HTTPResponseNotAl...
{ "content_hash": "5b780d6e1f243b2b41e01b7d1bbd14c4", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 78, "avg_line_length": 34.18032786885246, "alnum_prop": 0.6316546762589929, "repo_name": "kobotoolbox/kobocat", "id": "773392524f5daedbbdac728a781b97fdf55f096a", "size": "2...
"""Profile urls.""" from django.conf.urls import url from .views import Profile, PublicProfile, EditProfile from django.contrib.auth.decorators import login_required urlpatterns = [ url(r'^edit', EditProfile.as_view(), name='edit-profile'), url(r'^(?P<username>\w+)', PublicProfile.as_view(), name='public_profi...
{ "content_hash": "a26635fc3afc2efa63eba8570dd58d51", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 79, "avg_line_length": 40.2, "alnum_prop": 0.7039800995024875, "repo_name": "pasaunders/django-imager", "id": "e69aa53bff1309a850104aa805e809f99e4cf458", "size": "402", "...
import subprocess import types import pytest import salt.client.ssh.shell as shell from tests.support.mock import patch @pytest.fixture def keys(tmp_path): pub_key = tmp_path / "ssh" / "testkey.pub" priv_key = tmp_path / "ssh" / "testkey" return types.SimpleNamespace(pub_key=pub_key, priv_key=priv_key) ...
{ "content_hash": "61f7cee85c7ba6deba630cf75812e841", "timestamp": "", "source": "github", "line_count": 54, "max_line_length": 75, "avg_line_length": 32.68518518518518, "alnum_prop": 0.648158640226629, "repo_name": "saltstack/salt", "id": "37065c4c187601b2b2a59b93fd8737fe353c888f", "size": "1765", ...
from django.shortcuts import render, redirect from django.http import HttpResponseRedirect from .models import SupportProject # Create your views here. def index( request ): sp = SupportProject.objects.all() if sp.count() == 1: return HttpResponseRedirect( sp.first().project.get_absolute_url() )...
{ "content_hash": "a4a230430fcaaca2cccd79cc6e4fca72", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 76, "avg_line_length": 29.333333333333332, "alnum_prop": 0.6795454545454546, "repo_name": "postpdm/ich_bau", "id": "c77bfcd69447b6d8753b518a3930aaea586d8856", "size": "440"...
from ._compat import FileNotFoundError class SnakePitException(Exception): """Base exception class""" class ConfigDoesNotExist(SnakePitException, FileNotFoundError): """Raised when config file not found.""" class InvalidConfiguration(SnakePitException): """Raised when does not open config file.""" c...
{ "content_hash": "a72113c98fdebd28167b72062d40e09a", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 63, "avg_line_length": 24.904761904761905, "alnum_prop": 0.7552581261950286, "repo_name": "kk6/snake-pit", "id": "9e11e3f41dfe158b06e064625f1569ba24022df0", "size": "548", ...
"""A wrapper for subprocess to make calling shell commands easier.""" import os import logging import pipes import signal import subprocess import tempfile import constants def Popen(args, stdout=None, stderr=None, shell=None, cwd=None, env=None): return subprocess.Popen( args=args, cwd=cwd, stdout=stdout, ...
{ "content_hash": "09d258232c736a1eef22de2a3947b92c", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 80, "avg_line_length": 30.392156862745097, "alnum_prop": 0.6938709677419355, "repo_name": "cvsuser-chromium/chromium", "id": "dba399f8193f333ebcc94a880cb540ba83d90976", "s...
"""Stack implementation using linked list """ class Node(): def __init__(self): self.item = None self.next = None class Stack(): def __init__(self): self.first = None def push(self, item): node = Node() node.item = item node.next = self.first self.first = node def pop(self): if self.first is No...
{ "content_hash": "28260274e0a19307712e732641bad5c1", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 41, "avg_line_length": 15.475, "alnum_prop": 0.6252019386106623, "repo_name": "Yasik/algorithms-collection", "id": "5c016f14fac0550c2d34c0ab1e5ed8ec467f17f9", "size": "638"...
import absl.testing import test_util model_path = "https://tfhub.dev/tulasiram58827/lite-model/craft-text-detector/dr/1?lite-format=tflite" # Failure: Resize lowering does not handle inferred dynamic shapes. Furthermore, the entire model # requires dynamic shape support. class CraftTextTest(test_util.TFLiteModelTest)...
{ "content_hash": "fc7974a1686703f0d068f7187e9bb8d3", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 102, "avg_line_length": 33.857142857142854, "alnum_prop": 0.7355836849507735, "repo_name": "iree-org/iree-samples", "id": "d533bacf8a368fd016190e9a90e6c731fa18aa4e", "size"...
"""Class to transform an subgraph into another. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from copy import deepcopy from functools import partial from six import iteritems from six import iterkeys from six import string_types from six import Strin...
{ "content_hash": "4cf451e01799a625bf40968c031a5b5c", "timestamp": "", "source": "github", "line_count": 743, "max_line_length": 102, "avg_line_length": 38.1507402422611, "alnum_prop": 0.6809426374091583, "repo_name": "nburn42/tensorflow", "id": "592d37b432ee605d74162e0b8ec6ccdf426c45d1", "size": "2...
""" "Strong star normal form" From "The complexity of regular-(like)-expressions" http://www.springerlink.com/content/978-3-642-14454-7/#section=754924&page=3&locus=34 """ ## Many(Seq(Optional(Lit('x')), Optional(Lit('y')))).black() #. ((x|y))* def normalize(re): return re.black() class Lit: nullable = False ...
{ "content_hash": "56d60aa0c43715a088eee9930e7ca84b", "timestamp": "", "source": "github", "line_count": 64, "max_line_length": 85, "avg_line_length": 27.984375, "alnum_prop": 0.5745393634840871, "repo_name": "JaDogg/__py_playground", "id": "31fdc0fd11f419f2538acfeef1d5373f41acf149", "size": "1791",...
from django.test import TestCase from django.db.models import (CharField, TextField, BooleanField, ForeignKey, SmallIntegerField) from django.contrib.auth.models import User from django.utils.translation import ugettext as _ from deck.models import Event, Pro...
{ "content_hash": "7c89e3591b40ae40a767d62d5ce6ae00", "timestamp": "", "source": "github", "line_count": 362, "max_line_length": 81, "avg_line_length": 39.25966850828729, "alnum_prop": 0.687799043062201, "repo_name": "felipevolpone/speakerfight", "id": "eb067c8b2fe46d0a9b013a62d7aaacd0c5a47fef", "si...
""" The bld lib provides build helper tools. """ # # Package's version # try: from ._version import version as __version__ except ImportError: # broken installation, we don't even try __version__ = "unknown"
{ "content_hash": "db074f994150870823f11dc7f83a2a27", "timestamp": "", "source": "github", "line_count": 12, "max_line_length": 48, "avg_line_length": 18.416666666666668, "alnum_prop": 0.6606334841628959, "repo_name": "osechet/bld", "id": "a600941be74112eeeafe7f827e3c31242572f8fb", "size": "221", ...
"""Completion evaluation code for JavaScript""" import logging import types import re from pprint import pformat from itertools import chain from codeintel2.common import * from codeintel2.util import indent from codeintel2.tree import TreeEvaluator class CandidatesForTreeEvaluator(TreeEvaluator): # Note: the "...
{ "content_hash": "10effefb5c9cca3000d303fcfdddbde6", "timestamp": "", "source": "github", "line_count": 968, "max_line_length": 98, "avg_line_length": 44.256198347107436, "alnum_prop": 0.4935574229691877, "repo_name": "anisku11/sublimeku", "id": "6b50b38c3c5a0e4ede690b0f115a501104ea38f2", "size": "...
import os from setuptools import setup, find_packages setup(name="b_py", version="0.1", description="a test", url="https://example.com", py_modules=['b'], )
{ "content_hash": "eaa3c05f6fc6c0dc2cfbaef3c89e07fd", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 43, "avg_line_length": 20.22222222222222, "alnum_prop": 0.6043956043956044, "repo_name": "dmerejkowsky/qibuild", "id": "d64ba264397eb0023030a9fd248d5691b04ae865", "size": "3...
import asyncio @asyncio.coroutine def open_file(name): print("opening {}".format(name)) return open(name) @asyncio.coroutine def close_file(file): print("closing {}".format(file.name)) file.close() @asyncio.coroutine def read_data(file): print("reading {}".format(file.name)) return file.read(...
{ "content_hash": "f2ba78f5be85bf93fa84ed772df96454", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 59, "avg_line_length": 25.661538461538463, "alnum_prop": 0.6780575539568345, "repo_name": "voidabhi/python-scripts", "id": "c8e39ba3cef7514c1f114572c359dffa5447d22d", "size...
"""Tests for Plex setup.""" import copy from datetime import timedelta import ssl from unittest.mock import patch import plexapi import requests import homeassistant.components.plex.const as const from homeassistant.components.plex.models import ( LIVE_TV_SECTION, TRANSIENT_SECTION, UNKNOWN_SECTION, ) fro...
{ "content_hash": "f39d66c30b028f797b9adab56aa60700", "timestamp": "", "source": "github", "line_count": 273, "max_line_length": 82, "avg_line_length": 35.20879120879121, "alnum_prop": 0.712234706616729, "repo_name": "lukas-hetzenecker/home-assistant", "id": "c9bcce0ac83f6e5398c629ecc3defe903356d2b7",...
from devstack import component as comp from devstack import log as logging LOG = logging.getLogger("devstack.components.nova_client") class NovaClientUninstaller(comp.PythonUninstallComponent): def __init__(self, *args, **kargs): comp.PythonUninstallComponent.__init__(self, *args, **kargs) class NovaCl...
{ "content_hash": "d36e4053c689ad9a20ce2e6ad8e06988", "timestamp": "", "source": "github", "line_count": 27, "max_line_length": 68, "avg_line_length": 30.88888888888889, "alnum_prop": 0.6462829736211031, "repo_name": "hagleitn/Openstack-Devstack2", "id": "fcabd713059a34dbba2d21d9756ec5925d128183", "...
import io from PyPDF2 import PdfFileReader, PdfFileWriter def diff_pdf_pages(pdf1_path, pdf2_path): pdf2_fp = PdfFileReader(io.BytesIO(pdf2_path)) pdf2_len = pdf2_fp.getNumPages() if not pdf1_path: return list(range(0, pdf2_len)) pdf1_fp = PdfFileReader(io.BytesIO(pdf1_path)) pdf1_len = ...
{ "content_hash": "b2e0dd2ccd73847f6e2c5f55cbc8fd97", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 50, "avg_line_length": 24.916666666666668, "alnum_prop": 0.5964325529542921, "repo_name": "patryk4815/wtie_utp_plan", "id": "f036865dfd9c078061450214bbc244dc9ba27d55", "siz...
"""IPVS module This module exists as a pure-python replacement for ipvsadm. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import six import socket import struct import utils.cpuload.netlink.netlink as netlink ...
{ "content_hash": "27dd5182af887c2a87be12efa1efc894", "timestamp": "", "source": "github", "line_count": 616, "max_line_length": 79, "avg_line_length": 31.32792207792208, "alnum_prop": 0.5401077831899679, "repo_name": "knightXun/BabyCare", "id": "bcef5ebcc1ed68a7dba9e590f4921bd5eb6d94dd", "size": "1...
from __future__ import division """ Computes the correction for surace energy error associated with vacancy formation energy by deducing the surface area of vacancy from the first principles calculation of vacancies with lda, pbe and pw91 functionals. The unit area correction computed is defined in Phys.Rev.B 73, 1...
{ "content_hash": "1c31a11f0caf5d773b579e4884789025", "timestamp": "", "source": "github", "line_count": 132, "max_line_length": 78, "avg_line_length": 34.42424242424242, "alnum_prop": 0.6234595070422535, "repo_name": "mbkumar/pycdcd", "id": "0606139f4400713fd8b33ade82622fc3c87b7e23", "size": "4544"...
from __future__ import absolute_import from __future__ import division from __future__ import print_function # no unicode literals import WatchmanTestCase import json import tempfile import os import os.path import sys try: import unittest2 as unittest except ImportError: import unittest @unittest.skipIf(sys...
{ "content_hash": "bded0a55fc59c8ed0abb50df36ebe398", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 75, "avg_line_length": 31.943396226415093, "alnum_prop": 0.6237448316597756, "repo_name": "dhruvsinghal/watchman", "id": "701b8d8d66085df174645ba205b7c4a1b73e26cc", "size":...
"""empty message Revision ID: 0112_add_start_end_dates Revises: 0111_drop_old_service_flags Create Date: 2017-07-12 13:35:45.636618 """ from datetime import datetime import sqlalchemy as sa from alembic import op from app.dao.date_util import get_month_start_and_end_date_in_utc down_revision = "0111_drop_old_servi...
{ "content_hash": "1b9f26f92f369638ec1ee7241ffbdd29", "timestamp": "", "source": "github", "line_count": 53, "max_line_length": 118, "avg_line_length": 33.698113207547166, "alnum_prop": 0.641097424412094, "repo_name": "alphagov/notifications-api", "id": "8ae738c88aaf83ec0833c588e1453d955ad350c6", "s...
from __future__ import unicode_literals class SurveyorError(Exception): pass class XMLParseError(SurveyorError, ValueError): pass class UnexpectedTagError(XMLParseError): def __init__(self, incoming, expected): message = "Expected tag is {0}, but got {1}".format(expected, incoming) su...
{ "content_hash": "cec69bc90e2a4075d38e9bb616ece8f4", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 110, "avg_line_length": 28.966666666666665, "alnum_prop": 0.6777905638665133, "repo_name": "9seconds/surveyor", "id": "fd18a18bfb94a337b78e70f21d40ea0e6a5a6c93", "size": "8...
from collections import OrderedDict import os import re from typing import ( Dict, Mapping, MutableMapping, MutableSequence, Optional, Sequence, Tuple, Type, Union, cast, ) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as...
{ "content_hash": "b6c420283863677b426e0841420f063c", "timestamp": "", "source": "github", "line_count": 2875, "max_line_length": 126, "avg_line_length": 40.170086956521736, "alnum_prop": 0.5913983149910381, "repo_name": "googleapis/python-bare-metal-solution", "id": "3fa985a33faddf3b85cf995528f512ad8...
'''Autogenerated by xml_generate script, do not edit!''' from OpenGL import platform as _p, arrays # Code generation uses this from OpenGL.raw.GLES2 import _types as _cs # End users want this... from OpenGL.raw.GLES2._types import * from OpenGL.raw.GLES2 import _errors from OpenGL.constant import Constant as _C import...
{ "content_hash": "16c9f1cc99193936952b71eb35e91cc9", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 133, "avg_line_length": 46.35294117647059, "alnum_prop": 0.7829949238578681, "repo_name": "alexus37/AugmentedRealityChess", "id": "6fc1138568d191a06ecb203a8009bb3d68c16711", ...
SIMPLE_TYPES = { 'auto': 'key', 'foreignkey': 'key', 'biginteger': 'number', 'decimal': 'number', 'float': 'number', 'integer': 'number', 'positiveinteger': 'number', 'positivesmallinteger': 'number', 'smallinteger': 'number', 'nullboolean': 'boolean', 'char': 'string', ...
{ "content_hash": "b200bf07db739b2c26f4a4a6e5868cd3", "timestamp": "", "source": "github", "line_count": 120, "max_line_length": 77, "avg_line_length": 37.35, "alnum_prop": 0.6845158411423472, "repo_name": "murphyke/avocado", "id": "2a9a4ff85b08be85f0f841415f7ffe00cff3987a", "size": "4830", "binar...
import json import requests import argparse import os SERVER_URL = 'https://patchwork.kernel.org/api/1.1' USERNAME = 'kvalo' PROJECT = 'linux-wireless' # set patchwork token in PATCHWORK_TOKEN enviroment variable, but most # of the commands will work without the token anyway def get_auth_headers(): headers = {}...
{ "content_hash": "f6e97dbdd732087f7e9e6dce463002db", "timestamp": "", "source": "github", "line_count": 248, "max_line_length": 111, "avg_line_length": 32.068548387096776, "alnum_prop": 0.5737457563183704, "repo_name": "kvalo/pwcli", "id": "66806bc1450f7779893d66ea20cfe6ffeaa0d20a", "size": "9527",...
import base64 from twisted.internet import reactor, protocol import os PORT = 8000 import struct def get_bytes_from_file(filename): return open(filename, "rb").read() # remove this for distribution of server KEY = "WoAh_A_Key!?" def length_encryption_key(): return len(KEY) def get_magic_png(): ...
{ "content_hash": "b377da2a78404522dfac04545a8b3072", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 49, "avg_line_length": 22.2972972972973, "alnum_prop": 0.6812121212121212, "repo_name": "trailofbits/greenhorn", "id": "e76294e5dd03b63ab721bfed4bbb3d12f4709617", "size": "...
from django.test import TestCase class Test1(TestCase): def test_init(self): # Arrange # Act response = self.client.get(path='/gmod/') #Assert self.assertTemplateUsed(response, 'gmod/gmod.html')
{ "content_hash": "a6f81b909877de65394db7e916b173b3", "timestamp": "", "source": "github", "line_count": 16, "max_line_length": 59, "avg_line_length": 15.375, "alnum_prop": 0.6016260162601627, "repo_name": "aldenjenkins/foobargamingwebsite", "id": "9802b1f96472044de4686d9811954286905e012e", "size": ...
import platform import unittest import pytest from conans.test.utils.tools import TestClient conanfile_py = """ from conans import ConanFile class HelloConan(ConanFile): name = "Hello" version = "0.1" """ conanfile = """[requires] Hello/0.1@lasote/testing """ cmake = """set(CMAKE_CXX_COMPILER_WORKS 1) se...
{ "content_hash": "f21b1b90add4157d3d4d7ddce0730946", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 100, "avg_line_length": 36.013888888888886, "alnum_prop": 0.5969919012726571, "repo_name": "conan-io/conan", "id": "f2bbf07e30080dcf6da515ad1c7631df3756974f", "size": "2593...
import scrapy from scrapy.crawler import CrawlerProcess from twisted.internet import selectreactor selectreactor.install() class NoRequestsSpider(scrapy.Spider): name = 'no_request' def start_requests(self): return [] process = CrawlerProcess(settings={ "TWISTED_REACTOR": "twisted.internet.sele...
{ "content_hash": "7efcdeab3f5a767d918cb9677c734155", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 70, "avg_line_length": 18.227272727272727, "alnum_prop": 0.7556109725685786, "repo_name": "elacuesta/scrapy", "id": "e0d2dab2652e3fdad57f8ede20a6a482e68a65ae", "size": "401...
from functools import wraps from flask import current_app, g, request, redirect, url_for, session, _app_ctx_stack, _request_ctx_stack from werkzeug.local import LocalProxy from models import User, Project, Experiment current_project = LocalProxy(lambda: _get_project()) current_experiment = LocalProxy(lambda: _get_exp...
{ "content_hash": "5a65b57e51ab2e0dde47619bccff4626", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 130, "avg_line_length": 35.530434782608694, "alnum_prop": 0.6627508565834557, "repo_name": "lalitkumarj/NEXT-psych", "id": "ea77e3fddfe81f5a4ab44a5579c5ccfda286097f", "siz...
import pickle import pytest from pydantic import BaseModel, Protocol, ValidationError try: import msgpack except ImportError: msgpack = None class Model(BaseModel): a: float = ... b: int = 10 def test_obj(): m = Model.parse_obj(dict(a=10.2)) assert str(m) == 'Model a=10.2 b=10' def test...
{ "content_hash": "66adfbd7fd6625e15c4d52972b952fd9", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 119, "avg_line_length": 31.626984126984127, "alnum_prop": 0.6745294855708909, "repo_name": "petroswork/pydantic", "id": "3fc9153d8814194c2c2a0a082d82672f8163bbac", "size":...
import os import flask_testing import unittest from app import app, db from blapi.authorization.models import User from blapi.authorization.tests.factories import UserFactory class TestAuthorizationModels(flask_testing.TestCase): def create_app(self): app.config['SQLALCHEMY_DATABASE_URI'] = \ ...
{ "content_hash": "e379fc4b8ff9442b7c96787e99dd8299", "timestamp": "", "source": "github", "line_count": 73, "max_line_length": 74, "avg_line_length": 28.698630136986303, "alnum_prop": 0.5866348448687351, "repo_name": "andela-jkamau/blapi", "id": "9536c310e2b6773cde67980bca7bf169e759e4fc", "size": "...
import analyticsclient.constants.data_format as DF class Module(object): """ Module related analytics data. """ def __init__(self, client, course_id, module_id): """ Initialize the Module client. Arguments: client (analyticsclient.client.Client): The client to use to acce...
{ "content_hash": "e214a2f2dcb3bf982e3527da7caefc25", "timestamp": "", "source": "github", "line_count": 62, "max_line_length": 88, "avg_line_length": 33.04838709677419, "alnum_prop": 0.6168862859931674, "repo_name": "open-craft/edx-analytics-data-api-client", "id": "2df0c2e2fc46ae4b2b88cb3c817516e23d...
from swmmtoolbox import *
{ "content_hash": "51005efd4fc980e66c4aaefb6c480149", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 25, "avg_line_length": 26, "alnum_prop": 0.8076923076923077, "repo_name": "lucashtnguyen/swmmtoolbox", "id": "4cfe9b00009fca044638b86e7daefc39319bde8a", "size": "26", "bin...
input = """ % a and b are the top-level PTs. a | b. % After taking a, c and d are the PTs and each of them leads to a model. c | d :- a. % After backtracking, not a is propagated and, among others, b is derived. % So g and h are additional PTs in the top level now. g | h :- b, not a. % g directly leads to...
{ "content_hash": "a179a2d385b3c6fd8667c7e5cbcca365", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 78, "avg_line_length": 26.931818181818183, "alnum_prop": 0.6270042194092827, "repo_name": "veltri/DLV2", "id": "9793a24383544b4e8085ef892d28ecfa0bf1393a", "size": "1185", ...
import os, io import numpy as np # noqa (API import) import param __version__ = str(param.version.Version(fpath=__file__, archive_commit="$Format:%h$", reponame="holoviews")) from . import util # noqa (API import) from .annotators import a...
{ "content_hash": "68fd5f160c3aed475f4b9cee1a877497", "timestamp": "", "source": "github", "line_count": 91, "max_line_length": 90, "avg_line_length": 45.417582417582416, "alnum_prop": 0.606823130897653, "repo_name": "ioam/holoviews", "id": "46c225ab4b40d2bc98b769a123f315eec76dbbfa", "size": "4133",...
from fastapi import FastAPI from httpx import AsyncClient import pytest class TestUsersRoutes: @pytest.mark.asyncio async def test_ping_status(self, app: FastAPI, client: AsyncClient) -> None: """Test grid client status API.""" res = await client.get(app.url_path_for("ping")) assert r...
{ "content_hash": "55d1a969e5d78ffbd41c8e20c7034f8d", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 80, "avg_line_length": 29.214285714285715, "alnum_prop": 0.6601466992665037, "repo_name": "OpenMined/PySyft", "id": "53a55326076b1bab7b7171003e37b2edf01d082b", "size": "423...
import yaml import pandas as pd from airflow.models import Variable import logging, os, requests, subprocess, re, shutil, gzip from igf_airflow.logging.upload_log_msg import send_log_to_channels from igf_data.utils.fileutils import check_file_path, get_temp_dir, copy_local_file, get_datestamp_label from igf_data.utils....
{ "content_hash": "80b461dad07e5ce8aaef5e0bfa6943b8", "timestamp": "", "source": "github", "line_count": 427, "max_line_length": 146, "avg_line_length": 32.840749414519905, "alnum_prop": 0.5875347643157669, "repo_name": "imperial-genomics-facility/data-management-python", "id": "557092e4a3e8e74e236913...
"""Django settings for test app.""" # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = 'secret_key_for_test' ALLOWED_HOSTS = ['*'] # Application definition INSTALLED_APPS = ( 'django.contrib.admin'...
{ "content_hash": "19394a7b59264a04ce49c752cc570a55", "timestamp": "", "source": "github", "line_count": 78, "max_line_length": 76, "avg_line_length": 26.858974358974358, "alnum_prop": 0.6544152744630072, "repo_name": "census-instrumentation/opencensus-python", "id": "3a391eb8ad5db7650c53f6de6a665693f...
''' Created on 2014-12-17 @author: Shawn ''' import json import unittest import parser Encoder = json.JSONEncoder() Decoder = json.JSONDecoder() def suite(): testSuite1 = unittest.makeSuite(TestParser, "test") alltestCase = unittest.TestSuite([testSuite1, ]) return alltestCase class TestParser(unitt...
{ "content_hash": "1a37cab417de012aa5ea58fbc7acb71d", "timestamp": "", "source": "github", "line_count": 60, "max_line_length": 55, "avg_line_length": 17.4, "alnum_prop": 0.5919540229885057, "repo_name": "lamter/parsexcel", "id": "aacfb437a5a9db383bcfc6812ab47a0cd5f4b66b", "size": "1120", "binary"...
from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('websqlrunner', '0002_remove_run_parallel'), ] operations = [ migrations.AlterField...
{ "content_hash": "107b7ae7967577bc306c986c4d5ba500", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 110, "avg_line_length": 25.8, "alnum_prop": 0.6608527131782945, "repo_name": "snava10/sqlRunner", "id": "a3bfe2cf118fd329a415ad74286e7c429497de83", "size": "588", "binary...
from django.conf import settings from django.core.mail import send_mass_mail from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ from pigeon.notification import Notification def build_emails(notification): context = {'site': notification.site} for user i...
{ "content_hash": "bf8ba2625c182912b998ed446cf3f803", "timestamp": "", "source": "github", "line_count": 34, "max_line_length": 71, "avg_line_length": 30.41176470588235, "alnum_prop": 0.7079303675048356, "repo_name": "incuna/django-user-deletion", "id": "6f6ccb14a25ede7850baff8162f41e8a1921252e", "s...
from ssc.api import Data def test_data(): input_array = [0, 1, 2, 3] d = Data() d['test_array'] = input_array assert input_array == d['test_array']
{ "content_hash": "3742b000114c910facc670708be71cf1", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 41, "avg_line_length": 20.75, "alnum_prop": 0.5783132530120482, "repo_name": "StationA/sscpy", "id": "845c52da4cf936c4cf47e453c19019b663b3be6b", "size": "166", "binary": f...
print 'Please think of a number between 0 and 100!' high = 100 low = 0 found = False while found == False: middle = (high + low) / 2 print('Is your secret number ' + str(middle)+ '?') feedback = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' t...
{ "content_hash": "dc4004b0dc4141ea363852c3d92c1605", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 160, "avg_line_length": 29.61904761904762, "alnum_prop": 0.612540192926045, "repo_name": "avontd2868/6.00.1x-1", "id": "f4756e48a8e444d3f5b622000b85b503a995e9f1", "size": "...
import datetime from south.db import db from south.v2 import DataMigration from django.db import models from django.template.defaultfilters import slugify class Migration(DataMigration): def forwards(self, orm): "Write your forwards methods here." # Note: Don't use "from appname.models import Mod...
{ "content_hash": "91a265ad0fd5bdf481b375b62e06e2be", "timestamp": "", "source": "github", "line_count": 165, "max_line_length": 218, "avg_line_length": 78.87272727272727, "alnum_prop": 0.5510988166589826, "repo_name": "arpitprogressive/arpittest", "id": "34515f90d8b722a0035f9bb8cdde0e933fc0894a", "...
""" Handle logging of the application stuff to the database This will be replaced by something outside the app at some point, so the realy code should all be in /lib/applogging.py vs in here. This is only the db store side """ from datetime import datetime from datetime import timedelta from sqlalchemy import Column...
{ "content_hash": "bf1027d7bc36c426d5b60dec21863345", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 78, "avg_line_length": 30.54385964912281, "alnum_prop": 0.684663986214819, "repo_name": "mazz/kifu", "id": "dcc9a674bd5645100a61b12854b0c03b201e30e7", "size": "1741", "bi...
import pychrono as chrono import pychrono.vehicle as veh import pychrono.irrlicht as irr def main(): #print("Copyright (c) 2017 projectchrono.org\nChrono version: ", CHRONO_VERSION , "\n\n") step_size = 0.005 sys = chrono.ChSystemNSC() sys.Set_G_acc(chrono.ChVectorD(0, 0, -9.81)) sys.SetSolverTyp...
{ "content_hash": "36f443d88eded039900056ae8bd29409", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 113, "avg_line_length": 43.78125, "alnum_prop": 0.663633119200571, "repo_name": "Milad-Rakhsha/chrono", "id": "af8ad5a1080e13d4be6b123bece5395f5d64c8ed", "size": "6315", ...
"""Test RPC calls related to net. Tests correspond to code in rpc/net.cpp. """ import time from test_framework.test_framework import OakcoinTestFramework from test_framework.util import ( assert_equal, assert_raises_jsonrpc, connect_nodes_bi, p2p_port, start_nodes, ) class NetTest(OakcoinTestFr...
{ "content_hash": "1495cc9601a19eb39c7aa55d7a5a321f", "timestamp": "", "source": "github", "line_count": 90, "max_line_length": 102, "avg_line_length": 40, "alnum_prop": 0.6252777777777778, "repo_name": "stratton-oakcoin/oakcoin", "id": "eb538abf8713a37ba30eac00fb8b53d30c6fb52f", "size": "3809", "...
""" config :copyright: 2016 by [email protected]. """ #from __future__ import unicode_literals import sys PY3=sys.version>"3" from os.path import dirname, abspath, expanduser, join as joinpath import json import logging logger = logging.getLogger(__name__) config_default = { "CLIENT_KEY": "", "C...
{ "content_hash": "0712f0d6e31fc6f9b313cbf38589363e", "timestamp": "", "source": "github", "line_count": 52, "max_line_length": 77, "avg_line_length": 21.21153846153846, "alnum_prop": 0.614687216681777, "repo_name": "raptorz/pyfan", "id": "4ac229b7b7a9fa7e646b2a5dbc870284f6a48179", "size": "1127", ...
import os, sys bindir = os.path.abspath(os.path.dirname(sys.argv[0])) libdir = bindir + "/../lib" sys.path.append(libdir) import logging import lacuna import lacuna.exceptions as err import lacuna.binutils.libtrain_spies as lib ts = lib.TrainSpies() l = ts.client.user_logger for p in ts.planets: ### Set the cu...
{ "content_hash": "3bb54836d5c4d2295fca24e4ea078cf0", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 100, "avg_line_length": 29.833333333333332, "alnum_prop": 0.6312849162011173, "repo_name": "tmtowtdi/MontyLacuna", "id": "824c0fe65ad127898d96f999485a64dc8ec8feb1", "size":...
import unittest from irrexplorer import utils class TestClassification(unittest.TestCase): def test_classification(self): a = utils.classifySearchString('10.0.0.1') self.assertEquals(type(a), utils.Prefix) a = utils.classifySearchString('1.3.4.0/24') self.assertEquals(type(a), ...
{ "content_hash": "f390af0c0b0d83771f609597ca9c5eac", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 61, "avg_line_length": 22.35135135135135, "alnum_prop": 0.6469165659008465, "repo_name": "job/irrexplorer", "id": "b8eef2cb6d69309c4a50ac3cedfb6a2e3f9d23dc", "size": "850",...
from distutils.core import setup, Extension; module = Extension("spammodule", sources=["spammodule.c"]); setup(name = "spammodule", version="1.0", description="spam package!", ext_modules=[module]);
{ "content_hash": "4d6e85813176aa2c142dd4ca20e80365", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 44, "avg_line_length": 24.333333333333332, "alnum_prop": 0.6666666666666666, "repo_name": "benrbray/matey", "id": "dc57b55b784dad8a57636f7514df3d36a3009fad", "size": "219", ...
import cv2 print 'test' print '123'
{ "content_hash": "be2569313476ff7fdf302e8386fcfe78", "timestamp": "", "source": "github", "line_count": 3, "max_line_length": 12, "avg_line_length": 11.666666666666666, "alnum_prop": 0.7428571428571429, "repo_name": "GO-HACKATHON/QuantumSigmoid", "id": "63f91078578b3613fa39be9650292c6f4f0b9145", "s...
""" Django settings for testproject project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ import os import django try: import guardian has_guardian = T...
{ "content_hash": "bbebdba85dda6f131fd280f537345229", "timestamp": "", "source": "github", "line_count": 162, "max_line_length": 83, "avg_line_length": 23.950617283950617, "alnum_prop": 0.6724226804123712, "repo_name": "vittoriozamboni/django-groups-manager", "id": "7aeed53a2aa2abd2a187392c030d0b25319...
import subprocess import urllib ''' download train and test images from S3 to local drive ''' #settings: files = ["./data/X_small_test.txt","./data/X_small_train.txt"] #download files filenames = [] for file in files: with open(file,'r') as f: filenames += f.readlines() for i in xrange(len(filenames)): ...
{ "content_hash": "5c928537dbea1871fa445761067542f4", "timestamp": "", "source": "github", "line_count": 21, "max_line_length": 131, "avg_line_length": 28.761904761904763, "alnum_prop": 0.6539735099337748, "repo_name": "unisar/CIFARClassification", "id": "fb888df0e5ddde7922a4dde80abd9f931b95cb87", "...
import os def prefix_envvar(envvar): return 'ODOOKU_%s' % envvar def get_envvar(envvar, default=None): return os.environ.get(prefix_envvar(envvar), default)
{ "content_hash": "8ef4dead074528a2426ee14d35efc112", "timestamp": "", "source": "github", "line_count": 9, "max_line_length": 57, "avg_line_length": 18.77777777777778, "alnum_prop": 0.7100591715976331, "repo_name": "adaptivdesign/odooku-compat", "id": "5399b079883bd519a08e2f25ec096fc0fb56c9ca", "si...
from __future__ import print_function from __future__ import division from __future__ import absolute_import import six from dashboard.api import api_request_handler from dashboard.pinpoint.models import change from dashboard.common import utils if utils.IsRunningFlask(): from flask import request def _CheckUse...
{ "content_hash": "6ff8813d567ab45dec1cddcdbfae8f4f", "timestamp": "", "source": "github", "line_count": 57, "max_line_length": 83, "avg_line_length": 33.14035087719298, "alnum_prop": 0.6326098464796188, "repo_name": "catapult-project/catapult", "id": "324ef032820e1b1d4058ccfc39cdb7a9ae0bbe70", "siz...
import collections import random import types import itertools from yaql.context import EvalArg, ContextAware from yaql.exceptions import YaqlExecutionException from yaql.utils import limit def join(self, others, join_predicate, composer): for self_item in self(): for other_item in others(): i...
{ "content_hash": "d1641372f5c7609a8727d9daca7c33f4", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 77, "avg_line_length": 24.311475409836067, "alnum_prop": 0.6318273769386379, "repo_name": "istalker2/yaql", "id": "25ef8b02758a00e9a77a85c75671ea9c1615bd67", "size": "3580...
import json from django.db import models from django.db.models.loading import get_model from django.core.urlresolvers import reverse from myuser.models import MyUser class RVU(models.Model): """ Relative value-units; tracks the total RVU values based on Medicare reimbursement schedules. May change annua...
{ "content_hash": "df64b9eab66510fa893ba59f91a660b6", "timestamp": "", "source": "github", "line_count": 140, "max_line_length": 82, "avg_line_length": 30.7, "alnum_prop": 0.6191251744997673, "repo_name": "shapiromatron/comp523-medcosts", "id": "bd551e66d76687dd276afc606596101f11ad3c5e", "size": "42...
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice # Connects to the current device, returning a MonkeyDevice object device = MonkeyRunner.waitForConnection() # Installs the Android package. Notice that this method returns a boolean, so you can test # to see if the installation worked. device.installPack...
{ "content_hash": "9e3b759e84786ba31cb41d1495fe5f1d", "timestamp": "", "source": "github", "line_count": 30, "max_line_length": 90, "avg_line_length": 29.9, "alnum_prop": 0.778149386845039, "repo_name": "gmission/gmission_reborn_android", "id": "1823e7ed8d8dc176994f9e51fac240fb93c3d21c", "size": "95...
from msrest.serialization import Model class VirtualNetworkGatewaySku(Model): """VirtualNetworkGatewaySku details. :param name: Gateway SKU name. Possible values are: 'Basic', 'HighPerformance','Standard', and 'UltraPerformance'. Possible values include: 'Basic', 'HighPerformance', 'Standard', 'Ult...
{ "content_hash": "430b1a051a3639bf86cf1d3479fa7914", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 74, "avg_line_length": 35.55555555555556, "alnum_prop": 0.6359375, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "d458232bd0abc81d87f7410748d85d56b10a5ceb", "size":...
''' Created by auto_sdk on 2015.04.21 ''' from aliyun.api.base import RestApi class Ecs20140526DescribeInstanceAttributeRequest(RestApi): def __init__(self,domain='ecs.aliyuncs.com',port=80): RestApi.__init__(self,domain, port) self.InstanceId = None def getapiname(self): return 'ecs.aliyuncs.com.Des...
{ "content_hash": "9040745fa5470df8792a5d8b55110841", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 64, "avg_line_length": 32.36363636363637, "alnum_prop": 0.7331460674157303, "repo_name": "wanghe4096/website", "id": "1bb4476ded0c67ce41b50d6e6e1e6daa0886c0ef", "size": "35...
"""This is the users module. """ from flask import Blueprint users = Blueprint('users', __name__, static_folder='static', template_folder='templates') from app.users.views import *
{ "content_hash": "8617a96539522b695bf7b7f5819aa39b", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 89, "avg_line_length": 23, "alnum_prop": 0.7119565217391305, "repo_name": "flowsha/zhwh", "id": "206dd349cca6e80a2862f5f74097ea814e487dbd", "size": "278", "binary": false,...
from glance.hacking import checks from glance.tests import utils class HackingTestCase(utils.BaseTestCase): def test_assert_true_instance(self): self.assertEqual(1, len(list(checks.assert_true_instance( "self.assertTrue(isinstance(e, " "exception.BuildAbortException))")))) ...
{ "content_hash": "fbf7a983dd258aebcb952e114b4e8392", "timestamp": "", "source": "github", "line_count": 39, "max_line_length": 75, "avg_line_length": 37.743589743589745, "alnum_prop": 0.623641304347826, "repo_name": "tanglei528/glance", "id": "dbad0f6e55432bf5abc93df5a09029dee2af9600", "size": "207...
from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_param_SimpleIntLink', [dirname(__file__)]) except ImportError: import...
{ "content_hash": "3ce1e998eca5f4b84c396e4688d6c0fe", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 107, "avg_line_length": 35.98969072164948, "alnum_prop": 0.6545402463477513, "repo_name": "silkyar/570_Big_Little", "id": "9fd28afa96945d9c04f3ccc77d31c9c7477eeb77", "size"...