text stringlengths 4 1.02M | meta dict |
|---|---|
"""
hellofriend.py
Author: Sam Supattapone
Credit: J.C. Napier
Assignment: Hello, friend!
Write and submit an interactive Python program that asks for the user's name and age,
then prints how much older Python is than the user (based on a simple comparison of
birth year). Python's first public release occurred in 1... | {
"content_hash": "da55094b998494eee152940a3a78a72a",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 86,
"avg_line_length": 36.91304347826087,
"alnum_prop": 0.7373380447585395,
"repo_name": "SSupattapone/Hello-friend",
"id": "243d01527c64c853484e9655f8868996358da2a8",
"siz... |
import argparse
import json
import os
import re
import sys
import tarfile
import urllib
from urllib import request
from urllib import parse
try:
from bs4 import BeautifulSoup
except ImportError:
raise ImportError("Please install BeautifulSoup (apt-get install python3-bs4 or pip install beautifulsoup4 should do... | {
"content_hash": "a54ff571e3716530865620e37bb9262e",
"timestamp": "",
"source": "github",
"line_count": 362,
"max_line_length": 126,
"avg_line_length": 34.671270718232044,
"alnum_prop": 0.6035375667277508,
"repo_name": "mattgodbolt/compiler-explorer",
"id": "f1b69fd68a68ab9598330fb93e09e68168a20ed8",... |
"""Test utilities for running dtf tests"""
from __future__ import absolute_import
from __future__ import print_function
import json
import os
import shutil
import sys
import tempfile
import unittest
import zipfile
from subprocess import Popen, PIPE
import configparser
import dtf.constants as constants
import dtf.co... | {
"content_hash": "d2d2d952cc2be3c2541e9dce38bc103f",
"timestamp": "",
"source": "github",
"line_count": 365,
"max_line_length": 73,
"avg_line_length": 22.21095890410959,
"alnum_prop": 0.6197113605526089,
"repo_name": "android-dtf/dtf",
"id": "cba6aece4b7f6695e085f08b1086050468c95db0",
"size": "8747... |
def func(x, y):
return x * y
print(func('abc', 3))
# abcabcabc
print(func(4, 3))
# 12
def func_annotations(x: 'description-x', y: 'description-y') -> 'description-return':
return x * y
print(func_annotations('abc', 3))
# abcabcabc
print(func_annotations(4, 3))
# 12
def func_annotations_default(x: 'descrip... | {
"content_hash": "bfa1319faca20c4e5f4f31e26da40b14",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 97,
"avg_line_length": 21.25531914893617,
"alnum_prop": 0.6676676676676677,
"repo_name": "nkmk/python-snippets",
"id": "b597f67178a781f78d2f7628bea8f47b0e64b481",
"size": "... |
from dart.client.python.dart_client import Dart
from dart.model.action import Action
from dart.model.action import ActionData
from dart.model.dataset import FileFormat, Compression
from dart.model.dataset import RowFormat
from dart.model.datastore import Datastore
from dart.model.datastore import DatastoreData
from dar... | {
"content_hash": "8ed3f763e5a39a8082513d34a9ea2920",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 132,
"avg_line_length": 40.674418604651166,
"alnum_prop": 0.6186392224128073,
"repo_name": "RetailMeNotSandbox/dart",
"id": "fbe0d61b2cc7f55b4de9417dccab20deb2d98629",
"siz... |
from django.conf.urls import *
urlpatterns = patterns('custom.apps.wisepill.views',
url(r'^device/?$', 'device_data', name='wisepill_device_event'),
url(r'^export/events/', 'export_events', name='export_wisepill_events'),
)
| {
"content_hash": "9fc2d2853c966617bccda35921256148",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 76,
"avg_line_length": 38.833333333333336,
"alnum_prop": 0.6909871244635193,
"repo_name": "puttarajubr/commcare-hq",
"id": "40762fb878844b57c9469511c85cbd948cbe14e5",
"size"... |
from modules.Evaluator import Evaluator
## This command evaluates system's performance
# @author Adriano Zanette
# @version 0.1
class Evaluate:
## Class constuctor
# @author Adriano Zanette
# @version 0.1
# @return Evaluate
def __init__(self):
pass
## Execute the evaluation
# @author Adriano Zanett... | {
"content_hash": "28701323b562b2212cc2aaf5ffd09e3d",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 46,
"avg_line_length": 22.615384615384617,
"alnum_prop": 0.6751700680272109,
"repo_name": "adzanette/scf-extractor",
"id": "79a5e738bc5c939aca206c0fb8f5c807e383942e",
"size... |
class OpsyError(Exception):
"""Base class for exceptions in opsy."""
class NoConfigFile(OpsyError):
"""Config file not found."""
class NoConfigSection(OpsyError):
"""Config section not found."""
class MissingConfigOption(OpsyError):
"""Missing a required option in the config file."""
class Dupli... | {
"content_hash": "1866228933f09137957abe8cbbde507d",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 55,
"avg_line_length": 22.055555555555557,
"alnum_prop": 0.707808564231738,
"repo_name": "testeddoughnut/opsy",
"id": "235675d7bbac90309cc9f93346aa44712e39f12a",
"size": "3... |
from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . import models
from . import v... | {
"content_hash": "80c56973cf81e07efe6cfcdb8b1f37ba",
"timestamp": "",
"source": "github",
"line_count": 290,
"max_line_length": 127,
"avg_line_length": 50.203448275862065,
"alnum_prop": 0.6169379765093757,
"repo_name": "Sonicbids/django",
"id": "e09ee125620563cfa774be969015c1d83526508a",
"size": "1... |
def merge_dicts(*dicts):
"""
Given any number of dicts, shallow copy and merge into a new dict,
precedence goes to key value pairs in latter dicts.
"""
result = {}
for d in dicts:
result.update(d)
return result
def evaluate_term(term, **kwargs):
return term.evaluate(**kwargs) i... | {
"content_hash": "e8139ab2b0e197e7df49588300dd78e5",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 73,
"avg_line_length": 27.53846153846154,
"alnum_prop": 0.6480446927374302,
"repo_name": "eykd/ravel",
"id": "7e1a498a9a3802932fcb96367116382755b4fd14",
"size": "358",
"b... |
from django import forms
from hackfsu_com.views.generic import ApiView
from hackfsu_com.util import acl
from api.models import Hackathon, JudgeInfo
class ResponseForm(forms.Form):
approved = forms.BooleanField()
checked_in = forms.BooleanField()
rsvp = forms.BooleanField()
affiliation = forms.CharFie... | {
"content_hash": "0fe70ef77a062ac971937a1f25ae445d",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 93,
"avg_line_length": 30.366666666666667,
"alnum_prop": 0.6893523600439078,
"repo_name": "andrewsosa/hackfsu_com",
"id": "5083fae00a3eff5986ae04befe354bc3c701a027",
"size"... |
from seat_checker import seat_checker
from file_to_list import file_to_list
from time import sleep
def main():
"""Check each crn course in CRN_file and if a spot is open, print a message
CRN containing file should have the form:
11111
24871
35192
"""
# --------Insert CRN_file name below
... | {
"content_hash": "65fee4655f617873221d2db796b49224",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 82,
"avg_line_length": 26.183673469387756,
"alnum_prop": 0.5331254871395168,
"repo_name": "EMcCormack/TAMU-Seat-Checker",
"id": "b9f573690a62916aba889561894c7a0b1b95fb07",
... |
import unittest
import os
import warnings
from pymatgen.command_line.enumlib_caller import EnumlibAdaptor, EnumError
from pymatgen import Element, Structure
from pymatgen.transformations.standard_transformations import \
SubstitutionTransformation
from monty.os.path import which
from pymatgen.transformations.site_t... | {
"content_hash": "90057f9273ed43bfed139d6176e8756d",
"timestamp": "",
"source": "github",
"line_count": 150,
"max_line_length": 83,
"avg_line_length": 42.46,
"alnum_prop": 0.5897315120113048,
"repo_name": "dongsenfo/pymatgen",
"id": "8d4aef882e1966f10a265853de9abacf44ab9bc2",
"size": "6479",
"bin... |
import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
# sets initial station number to channel 8
station = 8
os.system("mpc play " + str(station))
#initialise previous input variable to 0
prev_input = 0
while True:
#take a reading from pin 23
input = GPIO.input(23)
#if t... | {
"content_hash": "372611325345ebe2a9d0be793ca9d870",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 71,
"avg_line_length": 22.133333333333333,
"alnum_prop": 0.6927710843373494,
"repo_name": "blogmywiki/pi-radio",
"id": "9b7293995e13ddd7a734c1187ba71c5743f502aa",
"size": "... |
from datetime import date
from django.contrib.auth.models import Group
from questionnaire.forms.filter import UserFilterForm, ExportFilterForm, QuestionFilterForm
from questionnaire.models import Region, Organization, Country, Theme, Questionnaire
from questionnaire.tests.base_test import BaseTest
class UserProfile... | {
"content_hash": "843c6cfec5cc71287f06a7e0eb146275",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 104,
"avg_line_length": 38.03738317757009,
"alnum_prop": 0.643980343980344,
"repo_name": "eJRF/ejrf",
"id": "8882bb92401388e2882ada977b2766eaf008e04f",
"size": "4070",
"... |
import re
from xml.etree import ElementTree
class DBusNode:
def __init__(self, bus, service, path=None):
self.bus = bus
self.service = service
if path is None:
path = '/' + service.replace('.', '/')
self.path = path
@property
def proxy(self):
if 'proxy'... | {
"content_hash": "4e64f53f29f2e35b15bdf41626f5d901",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 74,
"avg_line_length": 31,
"alnum_prop": 0.5008064516129033,
"repo_name": "coiot-ble/coiotd",
"id": "d02547f8b10ba4dce411d7ddfa795d55d7c00e2d",
"size": "1263",
"binary": ... |
"""Tests for tf.GrpcServer."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
import tensorflow as tf
class GrpcServerTest(tf.test.TestCase):
def testRunStep(self):
server = tf.train.Server.create_local_server()
... | {
"content_hash": "925dea75ef62f41abaa7529bed99446e",
"timestamp": "",
"source": "github",
"line_count": 183,
"max_line_length": 78,
"avg_line_length": 34.256830601092894,
"alnum_prop": 0.6158877013877812,
"repo_name": "ivano666/tensorflow",
"id": "b1133aeefdf837a27411975e6cf7cfc606b83b87",
"size": ... |
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/creature/player/shared_wookiee_male.iff"
result.attribute_template_id = -1
result.stfName("species","wookiee")
#### BEGIN MODIFICATIONS ####
#### END MODIFICATIONS ####
return result | {
"content_hash": "10ed60bbbd3623aecda5b56c49548467",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 67,
"avg_line_length": 22.53846153846154,
"alnum_prop": 0.6928327645051194,
"repo_name": "anhstudios/swganh",
"id": "8e070d55e826fb6925880db2649e4b203887398c",
"size": "438... |
"""
Tests exportExcelToTable
"""
from exportTableToExcel import exportTableToExcel, \
_exportDataframeToExcel
from importExcelToTable import importExcelToTable, \
_importExcelToDataframe
from scisheets.core import api as api
from scisheets.core import helpers_test as ht
import os
import pandas as pd
import u... | {
"content_hash": "2824e7c8b76e0a244b8611fd7f848792",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 68,
"avg_line_length": 29.559139784946236,
"alnum_prop": 0.6558748635867588,
"repo_name": "ScienceStacks/JViz",
"id": "965e02501b82f66f116750a4f8d133abea16d732",
"size": "2... |
"""Tests for IPython.utils.text"""
#-----------------------------------------------------------------------------
# Copyright (C) 2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#----------------... | {
"content_hash": "cd592d885a5ddfc81a806adc0e621db5",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 98,
"avg_line_length": 36.49090909090909,
"alnum_prop": 0.5581714000996513,
"repo_name": "nitin-cherian/LifeLongLearning",
"id": "ad533030abde5c257b8d8645ce2f5bc4fb108850",
... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
import base64
import os
import re
import zlib
import itertools
import hashlib
import datetime
import collections
import six
from six.moves import zip as izip
from . import environment
from .console... | {
"content_hash": "26438e089844abfb7a9c8670b6a5a08b",
"timestamp": "",
"source": "github",
"line_count": 1034,
"max_line_length": 99,
"avg_line_length": 31.900386847195357,
"alnum_prop": 0.5227830832196453,
"repo_name": "qwhelan/asv",
"id": "d17c9a146a22417a9b2909fb51ea45f48d86664b",
"size": "33074"... |
def process(self):
self.edit("LATIN")
if self.has("DIGIT"):
self.edit("DIGIT", "")
self.lower()
self.edit("SPACE", "space")
self.edit("EXCLAMATION MARK", "exclam")
self.edit("QUESTION MARK", "question")
self.edit("QUOTATION MARK", "quotedbl")
self.edit("NUMBER SIGN", "numbers... | {
"content_hash": "8520e7e9a82e46bac0fb9187d922fdfc",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 55,
"avg_line_length": 36.15555555555556,
"alnum_prop": 0.6238475722188076,
"repo_name": "LettError/glyphNameFormatter",
"id": "980ad9f2880a84dcce5d659f6b84e6814b8f664f",
"... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from accounts.views import SignInAndSignUp, LogoutView, ProductView, ServiceView, ContactView, AboutView
from oscar.app import application as oscarapplication
from paypal.express.dashboard.app import application
from django.conf impor... | {
"content_hash": "8fbef4b0594deff9d0ab43abecb38869",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 104,
"avg_line_length": 38.825,
"alnum_prop": 0.6658081133290406,
"repo_name": "aarticianpc/greenpointtrees",
"id": "1e054d5d8fabb5d886ace0d00c25bf43f1c20f31",
"size": "155... |
from django.db import migrations
def rm_import_waffle_switch(apps, schema_editor):
Switch = apps.get_model('waffle', 'Switch')
# drop the waffle switch blocklist_auto_import to avoid confusion
Switch.objects.filter(name='blocklist_auto_import').delete()
class Migration(migrations.Migration):
depende... | {
"content_hash": "928c1a6267bd7ce5da7d00161be6540d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 27.15,
"alnum_prop": 0.6611418047882136,
"repo_name": "diox/olympia",
"id": "a6cc4a33cfb4e15287715d8dcb77254f7c68bc77",
"size": "592",
"binary": fa... |
"""
archivebot.py - discussion page archiving bot.
usage:
python pwb.py archivebot [OPTIONS] TEMPLATE_PAGE
Bot examines backlinks (Special:WhatLinksHere) to TEMPLATE_PAGE.
Then goes through all pages (unless a specific page specified using options)
and archives old discussions. This is done by breaking a page in... | {
"content_hash": "e67721372847c54fa4527f2c06994f1a",
"timestamp": "",
"source": "github",
"line_count": 918,
"max_line_length": 79,
"avg_line_length": 36.9041394335512,
"alnum_prop": 0.5674774189739654,
"repo_name": "wikimedia/pywikibot-core",
"id": "04e365b3149149d92a2b6b84dbe78c209e6d9e25",
"size... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "djaaks.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "12a072c2ea002685ac627d1206e1c824",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 70,
"avg_line_length": 25.22222222222222,
"alnum_prop": 0.7092511013215859,
"repo_name": "rklabs/djaaks",
"id": "0b92de5ab8a86d05a615319b69f87d66469a0677",
"size": "249",
... |
'''
Used to convert the Microsoft Sentence Completion Challnege (MSCC) learning corpus into a one-sentence-per-line format.
'''
import sys
from nltk.tokenize import word_tokenize, sent_tokenize
def write_paragraph_lines(paragraph_lines):
paragraph_str = ' '.join(paragraph_lines)
for sent in sent_to... | {
"content_hash": "374650b6fb2a857cb5c137a6d24d4110",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 119,
"avg_line_length": 27.045454545454547,
"alnum_prop": 0.5915966386554622,
"repo_name": "orenmel/context2vec",
"id": "aca506beda482ed20089785d25c1e8e6018e28cd",
"size": ... |
import contextlib
import locale
import subprocess
import sys
from typing import IO, Mapping, Sequence, Tuple, Union
def shutdown_process(proc: subprocess.Popen) -> Tuple[bytes, bytes]:
"""Gracefully shutdown a child process."""
with contextlib.suppress(subprocess.TimeoutExpired):
return proc.communic... | {
"content_hash": "8b0be7fa9e69287d092a4d90eedf829b",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 122,
"avg_line_length": 26.391304347826086,
"alnum_prop": 0.6562328390993959,
"repo_name": "jonparrott/nox",
"id": "9bd1c115a856577842bc00d7b25a9f96722e2271",
"size": "2410... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shutil
from pants.backend.jvm.subsystems.jvm_tool_mixin import JvmToolMixin
from pants.backend.jvm.targets.jar_library import JarLibrary
from pants.b... | {
"content_hash": "06a93ed05dfcdef5e510a5fee96f0664",
"timestamp": "",
"source": "github",
"line_count": 133,
"max_line_length": 99,
"avg_line_length": 42.63157894736842,
"alnum_prop": 0.6583774250440917,
"repo_name": "peiyuwang/pants",
"id": "35ecfe3a5da7aaf40af6b64073378e97ef151e10",
"size": "5817... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('job', '0016_auto_20170411_0342'),
]
operations = [
migrations.AddField(
model_name='job',
n... | {
"content_hash": "129e572ae3b535d5b995189857d39323",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 136,
"avg_line_length": 25.789473684210527,
"alnum_prop": 0.6346938775510204,
"repo_name": "jamesaud/se1-group4",
"id": "8cc18b80d8f0ef65beccc38275ebd251c964331a",
"size": ... |
from trbm_base import TRBMBase
from copy import deepcopy
import numpy as np
class TRBM(TRBMBase):
def __init__(self, number_visible_units=1, number_hidden_units=1, order=1, network=None):
self.visible_values = list()
self.hidden_values = list()
self.visible_to_visible_bias = list()
... | {
"content_hash": "b8469601fcac38abb9efc0a7f0bb4016",
"timestamp": "",
"source": "github",
"line_count": 256,
"max_line_length": 198,
"avg_line_length": 55.20703125,
"alnum_prop": 0.6163588763885941,
"repo_name": "aleksandar-mitrevski/fault_and_anomaly_detection",
"id": "9aa87b6a6ed2addf1b62ca3e24111f... |
from ._models_py3 import AgentPool
from ._models_py3 import AgentPoolAvailableVersions
from ._models_py3 import AgentPoolAvailableVersionsPropertiesAgentPoolVersionsItem
from ._models_py3 import AgentPoolListResult
from ._models_py3 import AgentPoolUpgradeProfile
from ._models_py3 import AgentPoolUpgradeProfileProperti... | {
"content_hash": "c4c786c5445362ee89a3a2a5b5e4ca87",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 87,
"avg_line_length": 43.00355871886121,
"alnum_prop": 0.8178583250579279,
"repo_name": "Azure/azure-sdk-for-python",
"id": "c37cbbf5c7555fc5a480a571f8acf9e2c6cf0600",
"s... |
from __future__ import absolute_import
import ctypes
import struct
from .hash_engine import HashEngine
from .utilities import d2h
HASH_SEED = 0x46E945F8 # static hash seed from app
class HashLibrary(HashEngine):
def __init__(self, library_path):
self._hash_lib = ctypes.cdll.LoadLibrary(libr... | {
"content_hash": "5574de88540d50526df43de8745f856e",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 102,
"avg_line_length": 39.236363636363635,
"alnum_prop": 0.6399443929564411,
"repo_name": "PokeHunterProject/pogom-updated",
"id": "4a83048e5305a91a5805e0bb799bf020d9b78dd3"... |
"""Stable Noisy Optimization by Branch and FIT algorithm (SNOBFIT) optimizer."""
from typing import Any, Dict, Optional, Callable, Tuple, List
import numpy as np
from qiskit.utils import optionals as _optionals
from .optimizer import Optimizer, OptimizerSupportLevel, OptimizerResult, POINT
@_optionals.HAS_SKQUANT.r... | {
"content_hash": "ac958b9553cc11f3bc6530662afac008",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 96,
"avg_line_length": 34.86666666666667,
"alnum_prop": 0.6047527997814804,
"repo_name": "QISKit/qiskit-sdk-py",
"id": "f74d8ca8515395bea9a314b68d7dd67db2c44c68",
"size": ... |
"""
prompt_toolkit
==============
Author: Jonathan Slenders
Description: prompt_toolkit is a Library for building powerful interactive
command lines in Python. It can be a replacement for GNU
readline, but it can be much more than that.
See the examples directory to learn about the usage.
... | {
"content_hash": "85080fc92dcfe491f65a56350d4e8ab6",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 74,
"avg_line_length": 28.681818181818183,
"alnum_prop": 0.7242472266244057,
"repo_name": "lancezlin/ml_template_py",
"id": "a8d02038d5e7071110665285450d04182ce3c5f9",
"siz... |
"""Log entries within the Google Stackdriver Logging API."""
import json
import re
from google.protobuf import any_pb2
from google.protobuf.json_format import Parse
from google.cloud._helpers import _name_from_project_path
from google.cloud._helpers import _rfc3339_nanos_to_datetime
_LOGGER_TEMPLATE = re.compile(r... | {
"content_hash": "b9d7395dd9beabbe70b3c6ee48da0c6a",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 79,
"avg_line_length": 35.13586956521739,
"alnum_prop": 0.6334106728538283,
"repo_name": "ammarkhann/FinalSeniorCode",
"id": "284562c5de5be5bda5c02a2c53f9bbeea0d58209",
"s... |
"""Integrates distutils/setuptools with Paver."""
import re
import os
import sys
from os.path import *
from fnmatch import fnmatchcase
from distutils.util import convert_path
from distutils import log
try:
from setuptools import dist
except ImportError:
from distutils import dist
from distutils.errors import D... | {
"content_hash": "5efe709055c0916ec2b332147de71b63",
"timestamp": "",
"source": "github",
"line_count": 276,
"max_line_length": 87,
"avg_line_length": 34.84782608695652,
"alnum_prop": 0.6048034934497817,
"repo_name": "ArcherSys/ArcherSys",
"id": "5d744467b9d308d29d933959049a7a3a5f36713d",
"size": "... |
__author__ = 'Shamal Faily, Robin Quetin'
from .Borg import Borg
import os
import logging
import json
from cairis.tools.GraphicsGenerator import GraphicsGenerator
from .MySQLDatabaseProxy import MySQLDatabaseProxy
from .ARM import ARMException
def testUploadDirectory(uploadDir,logger):
image_upload_dir = os.path... | {
"content_hash": "a918d2e1ddb5f17573ab40e4c15c9d98",
"timestamp": "",
"source": "github",
"line_count": 199,
"max_line_length": 203,
"avg_line_length": 30.231155778894472,
"alnum_prop": 0.6712101063829787,
"repo_name": "nathanbjenx/cairis",
"id": "d5d29a3c80e419067675e7aac86a559291bd4a91",
"size": ... |
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.timezone import now
from django_esutils.models import ESManager
class User(AbstractUser):
language = models.CharField(max_length=10, default='fr')
class Category(models.Model):
name = models.CharField(max_le... | {
"content_hash": "d71cd30ba16dc926a1ec44d6ed7325f7",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 76,
"avg_line_length": 24.3265306122449,
"alnum_prop": 0.6946308724832215,
"repo_name": "novafloss/django-esutils",
"id": "9c60606e04889064d4b1104a6059715ec20aeb6a",
"size"... |
"""A simple reader for file segs produced by GCS output writer."""
from google.appengine.ext.mapreduce import output_writers
try:
from google.appengine._internal import cloudstorage
if hasattr(cloudstorage, "_STUB"):
cloudstorage = None
except ImportError:
pass
class _GCSFileSegReader(object):
"""... | {
"content_hash": "88115c3563845dcdc48da681ccc4c587",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 76,
"avg_line_length": 24.25423728813559,
"alnum_prop": 0.6160027952480782,
"repo_name": "GoogleCloudPlatform/python-compat-runtime",
"id": "a8ebd93809e1bdac58a5587af3884cd7... |
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.linear_model import LinearRegression
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
# Fitting Polynomial Regression to the dataset
from sklearn.preprocessing import PolynomialFeatures... | {
"content_hash": "6c028485a80bd0ca4c5919597e68429d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 88,
"avg_line_length": 28.155555555555555,
"alnum_prop": 0.7166535122336227,
"repo_name": "TheAlgorithms/Python",
"id": "374c35f7f905b2aa6f15b437bc3eb81f4fba5095",
"size": ... |
from datetime import datetime, timedelta
from django.core.management.base import NoArgsCommand
class Command(NoArgsCommand):
help = "Clean unpayed invoces older than one day."
def handle_noargs(self, **options):
from webmoney.models import Invoice
Invoice.objects.filter(
crea... | {
"content_hash": "7ac4a9889676dbad207e1945ac39f41c",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 63,
"avg_line_length": 31.615384615384617,
"alnum_prop": 0.6909975669099757,
"repo_name": "gotlium/django-payment-webmoney",
"id": "63b1cc82fd08cae6eb0acbd48e8371b732405b0b",... |
from time import sleep
import logging
from flaky import flaky
import pytest
from swimpy.routes import ROUTES
from swimpy.model.message import Ping, Ack, PingReq, Alive
from swimpy.model.node import Node
from swimpy.runtime import Runtime
from swimpy.util import send_message
LOGGER = logging.getLogger(__name__)
@py... | {
"content_hash": "cf8e29d4e683951fdaa11ad0d5a87c5f",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 100,
"avg_line_length": 27.919753086419753,
"alnum_prop": 0.5931903603802786,
"repo_name": "jefffm/swimpy",
"id": "f2a0a8aa3ee83a3c66bcdf84a679dabfc7d21859",
"size": "4523... |
from django.conf import settings
from django.http import HttpResponse, HttpResponseNotAllowed, JsonResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from .frontend.models import Post, Attachment, Newsgroup, ModPriv
from .frontend import util
from . import thumbnail
... | {
"content_hash": "327f8ef55e1498c1f9e2085d17962413",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 121,
"avg_line_length": 30.3625,
"alnum_prop": 0.5617538081515027,
"repo_name": "majestrate/nntpchan",
"id": "46e09b19eee86e10741cdf6e7463fbe35115877b",
"size": "4858",
... |
from ..constants import OK
class Resource(object):
"""
Represents a Resource with a status.
"status" may be one of:
- "ok", the resource is available
- "warning", the resource may not be available
" "error", the resource is unavailable
"""
def __init__(self, name, description, **kwar... | {
"content_hash": "9ff4cda7a4968156926a8eb0b683541c",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 62,
"avg_line_length": 24.94736842105263,
"alnum_prop": 0.6244725738396625,
"repo_name": "TabbedOut/django_canary_endpoint",
"id": "86e99ce03305d3098add04dd02002d4b6c6d6621",... |
import boto3
import json
import os
import re
import requests
import six
import threading
from six.moves import range
from girder import events
from girder.models.assetstore import Assetstore
from girder.models.file import File
from girder.models.folder import Folder
from girder.models.upload import Upload
from girder.... | {
"content_hash": "f63c13fc8399cb29ba0984acd8fc3527",
"timestamp": "",
"source": "github",
"line_count": 481,
"max_line_length": 96,
"avg_line_length": 44.46153846153846,
"alnum_prop": 0.6009071355092116,
"repo_name": "data-exp-lab/girder",
"id": "715227f06e119417bfd0cea44739088dd69ab493",
"size": "... |
from datetime import date
from collections import defaultdict
# Imports from other SPC apps
from scipy_central.utils import get_IP_address
import models
static_items = {'spc-main-page': 1,
'spc-about-page': 2,
'spc-about-licenses': 3,
'spc-markup-help': 4,
... | {
"content_hash": "70646a3b9babbb37fe3e575fc82705ee",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 78,
"avg_line_length": 37.8125,
"alnum_prop": 0.5646280991735537,
"repo_name": "ksurya/SciPyCentral",
"id": "f6496a9eca7db6fa0e7d648970dd0766b8e923ca",
"size": "3044",
"b... |
"""Base test cases for all neutron tests.
"""
import contextlib
import gc
import logging as std_logging
import os
import os.path
import random
import weakref
import eventlet.timeout
import fixtures
import mock
from oslo_concurrency.fixture import lockutils
from oslo_config import cfg
from oslo_messaging import conffi... | {
"content_hash": "12582b8a0e2ae76f506cfb74f07774e0",
"timestamp": "",
"source": "github",
"line_count": 423,
"max_line_length": 79,
"avg_line_length": 34.822695035460995,
"alnum_prop": 0.639511201629328,
"repo_name": "mmnelemane/neutron",
"id": "cb5fb3ee66f9077f3b31044ed57ac2612277688f",
"size": "1... |
from __future__ import print_function
import argparse
import csv
import os
import sys
import tabulate
from fontTools import ttLib
args = argparse.ArgumentParser(
description='Print out usWidthClass of the fonts')
args.add_argument('font', nargs="+")
args.add_argument('--csv', default=False, action='store_true')
a... | {
"content_hash": "48bb02714da7a15d2d9d55a669df3b8d",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 66,
"avg_line_length": 27.526315789473685,
"alnum_prop": 0.6175908221797323,
"repo_name": "davelab6/fontbakery",
"id": "d801549157f8ecdae1ada30c652759f915ec0870",
"size": "... |
import logging
from django.core.urlresolvers import reverse
from django import http
from mox import IsA # noqa
from horizon import exceptions
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
from troveclient import common
INDEX_URL = reverse('horizon:project:databases:inde... | {
"content_hash": "bbe346f854c0051f5d4aa82a3db56dd8",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 78,
"avg_line_length": 37.09814323607427,
"alnum_prop": 0.5835835835835835,
"repo_name": "zouyapeng/horizon_change",
"id": "2a090dd86d2fc51b159622ffa810227c4dd9015f",
"siz... |
"""Component builders for non-recurrent networks in DRAGNN."""
import tensorflow as tf
from tensorflow.python.platform import tf_logging as logging
from dragnn.python import component
from dragnn.python import dragnn_ops
from dragnn.python import network_units
from syntaxnet.util import check
def fetch_linked_embe... | {
"content_hash": "234ff9481fe8b8704a4437ca3add03bc",
"timestamp": "",
"source": "github",
"line_count": 462,
"max_line_length": 81,
"avg_line_length": 38.995670995671,
"alnum_prop": 0.6951043516873889,
"repo_name": "wangyang59/tf_models",
"id": "f00ac92fed7a2b914d2dcbf4071c30c1b9d92ffc",
"size": "1... |
"""
This is the Python implementation for the Java package "java.util.concurrent.atomic", compiled by Pava.
"""
import pava
from pava import nan, inf
pava_classes = {}
pava.module(__name__)
import atomic
| {
"content_hash": "b5f53e6129564cfdab692c176557b012",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 103,
"avg_line_length": 17.333333333333332,
"alnum_prop": 0.7259615384615384,
"repo_name": "laffra/pava",
"id": "368488f3704e51df9455ed8196963c85898861a0",
"size": "208",
... |
class AI:
"""Player defined AI
Attributes:
name (str): AI name
source (str): source code or .PER file
type (int): AI type
unknown1 (int): unknown1
unknown2 (int): unknown2
"""
def __init__(self, name="", source="", type=0,
unknown1=0, unknown2=... | {
"content_hash": "8e68cd39f3cffb2df7e74e83b5a3c5d5",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 62,
"avg_line_length": 25.322222222222223,
"alnum_prop": 0.4853005704256253,
"repo_name": "dderevjanik/agescx",
"id": "3e8b78dac584db17a7db078ba1fa1f62f35b8037",
"size": "2... |
class ScryfallSet:
def __init__(self, data):
self.name = data["name"]
self.code = data["code"]
self.released_at = data.get("released_at", None)
self.block = data.get("block", None)
self.block_code = data.get("block_code", None)
self.parent_set_code = data.get("parent_... | {
"content_hash": "80afc8a01c0b37ce796f042e8b4b774f",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 98,
"avg_line_length": 40.6,
"alnum_prop": 0.562807881773399,
"repo_name": "PolarPayne/scrycli",
"id": "e260b532c7eab9212117166d721324b6dd433f3c",
"size": "812",
"binary"... |
class Persona:
# Init es el constructor, en esta funcion vamos a pasar como parametro los valores iniciales de los atributos
# Recordar siempre pasar self como primer parametro
def __init__(self, nombre, apellido, dni, fechaNacimiento):
# Asignamos a cada atributo el valor del parametro
sel... | {
"content_hash": "3c5c473dea808da249bb29430cbe1ceb",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 159,
"avg_line_length": 36.40243902439025,
"alnum_prop": 0.6760469011725293,
"repo_name": "spalladino/algoritmos-gcba",
"id": "e6b9e497fad012212e262e010b7d729c8ba9ab7f",
"s... |
import socket
import requests
import urllib2
import json
import msgpack
import collections
import time, thread, threading
from flask import request, Request, jsonify
from flask import Flask
from flask import make_response
app = Flask(__name__)
projects_map = {}
xos_tenant_info_map = {}
xos_instances_info_map = {}
us... | {
"content_hash": "9c6da4cd158d05da556f015cd7caa53b",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 220,
"avg_line_length": 48.93993993993994,
"alnum_prop": 0.6272933668773394,
"repo_name": "xmaruto/mcord",
"id": "848ccc062b28a60785a2df434ae5f575c5f41f68",
"size": "16297... |
"""Support for Z-Wave cover devices."""
import logging
from typing import Any, Callable, List, Optional
from zwave_js_server.client import Client as ZwaveClient
from zwave_js_server.model.value import Value as ZwaveValue
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_GARAGE,
DOMA... | {
"content_hash": "6dfcee27d86f88af6a7e5ea9c373aacd",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 94,
"avg_line_length": 35.74431818181818,
"alnum_prop": 0.6502940708949293,
"repo_name": "partofthething/home-assistant",
"id": "ff77bdb408dbc1f238d1a843ac0894ef17f695be",
... |
SECURETRACK = "securetrack"
SECURECHANGE = "securechange" | {
"content_hash": "551f5bb299e5a5b6c4786677ccb83b2d",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 29,
"avg_line_length": 28.5,
"alnum_prop": 0.8070175438596491,
"repo_name": "Tufin/pytos",
"id": "2f592e0b473ef974fa4b334aa73051b7de3f9dd2",
"size": "57",
"binary": false,... |
"""This code example updates a user by adding " Sr." to the end of their name.
To determine which users exist, run get_all_users.py.
"""
# Import appropriate modules from the client library.
from googleads import ad_manager
USER_ID = 'INSERT_USER_ID_TO_UPDATE_HERE'
def main(client, user_id):
# Initialize approp... | {
"content_hash": "38466cf9b7e94d7b6ed1971afb555167",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 78,
"avg_line_length": 29.285714285714285,
"alnum_prop": 0.6634146341463415,
"repo_name": "googleads/googleads-python-lib",
"id": "14f5a0fe0a5e63d19c1ab959d6f172477b18e783",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Servicios.usuario'
db.add_column(u'servicios_servicios', 'usuario',
self.gf('django.db.models.... | {
"content_hash": "559a4640e099a1ad4c56dc9080d829d7",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 187,
"avg_line_length": 67.37190082644628,
"alnum_prop": 0.5619479882237488,
"repo_name": "CARocha/simasinnovacion",
"id": "86ee0e8504880d07f68ae7b3da930c39ac973fd6",
"siz... |
from django.contrib.sites.models import Site
from django.db import models
from django.utils.translation import pgettext_lazy
from ..core.utils.translations import TranslationProxy
from ..core.weight import WeightUnits
from . import AuthenticationBackends
from .patch_sites import patch_contrib_sites
patch_contrib_site... | {
"content_hash": "756077858e64c90ec80dfefe670a37cd",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 79,
"avg_line_length": 37.44186046511628,
"alnum_prop": 0.6863354037267081,
"repo_name": "UITools/saleor",
"id": "c9460921c12432c7c7ba0b9490cd64350dbd0ea5",
"size": "3220",... |
"""
================================
Recognizing hand-written digits
================================
This example shows how scikit-learn can be used to recognize images of
hand-written digits, from 0-9.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# License: BSD 3 clause
# Standard scien... | {
"content_hash": "7531d2894cba431fb2478ad062f17e37",
"timestamp": "",
"source": "github",
"line_count": 128,
"max_line_length": 80,
"avg_line_length": 35.703125,
"alnum_prop": 0.6339168490153173,
"repo_name": "vinayak-mehta/scikit-learn",
"id": "f760916d1f66e3862c113eedc65a393614bdc031",
"size": "4... |
import os
from .test_monitors import test_monitor_collection
def test_argument_converter(args):
'''
Takes an argparse namespace, and converts it into argument dictionaries.
Each argument dictionary is fed into a specific function or class in the
training script. e.g. admin_kwargs is the set of argument... | {
"content_hash": "3b758a5370a165555b554ba7f6af2bbb",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 76,
"avg_line_length": 26.931506849315067,
"alnum_prop": 0.6012207527975585,
"repo_name": "isaachenrion/jets",
"id": "20cafd8e313f14d9eb2839256bb73b399e21aa6f",
"size": "19... |
import pytest ; pytest
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Module under test
import bokeh.protocol.message as message # isort:skip
#---------------------------------------------------... | {
"content_hash": "2838552a9b68bdd035045af55d251179",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 78,
"avg_line_length": 41.027027027027025,
"alnum_prop": 0.25428194993412384,
"repo_name": "ericmjl/bokeh",
"id": "0a8e4d6b692d7a45bd9c629f0ae09ea169673cb4",
"size": "2022"... |
import numpy as np
import pandas as pd
import sklearn.metrics as metrics
from bigdl.chronos.utils import deprecated
from bigdl.chronos.autots.deprecated.preprocessing.impute.abstract import BaseImpute
@deprecated('Please use `bigdl.chronos.data.TSDataset` instead.')
class LastFill(BaseImpute):
"""
Impute mis... | {
"content_hash": "50b4d6c6c1eb08ffa0a0bf282996b59a",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 84,
"avg_line_length": 25.59259259259259,
"alnum_prop": 0.6396526772793053,
"repo_name": "intel-analytics/BigDL",
"id": "8fc129b06e225d3bd17d1cb4c9fc82fd4c4f5490",
"size": ... |
def orderedSequentialSearch(alist, item):
pos = 0
found = False
stop = False
while pos < len(alist) and not found and not stop:
if alist[pos] == item:
found = True
else:
if alist[pos] > item:
stop = True
else:
pos = pos+... | {
"content_hash": "f84e8bc00a59d1b1de4b8ee0332245cd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 54,
"avg_line_length": 24.285714285714285,
"alnum_prop": 0.48823529411764705,
"repo_name": "robin1885/algorithms-exercises-using-python",
"id": "2ac00c7a63e473cfe97734057b3e3... |
from django.shortcuts import render, get_object_or_404
from .models import Poster
def index(request):
posters = Poster.objects.all()
return render(request, 'posters/index.jade', {'posters': posters})
| {
"content_hash": "85530bd9c91ac73a84dfef5b877cd724",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 68,
"avg_line_length": 34.166666666666664,
"alnum_prop": 0.751219512195122,
"repo_name": "CMU-Robotics-Club/roboticsclub.org",
"id": "c9de6667b8309dbaeb37c1d9ae2cc8fd78d64fdf"... |
"""
update/__init__.py
Created by Thomas Mangin on 2009-11-05.
Copyright (c) 2009-2012 Exa Networks. All rights reserved.
Modified by Orange - 2014
"""
from copy import deepcopy
from bagpipe.exabgp.structure.address import AFI,SAFI
from bagpipe.exabgp.message import Message,prefix
from bagpipe.exabgp.message.update... | {
"content_hash": "0cb1f50d239860ee75b57416b236ee19",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 85,
"avg_line_length": 34.55952380952381,
"alnum_prop": 0.6830864622803996,
"repo_name": "murat1985/bagpipe-bgp",
"id": "5984e09ffaaa17d5e278f882a7d8494a3ca61465",
"size": ... |
import operator
from ..sql import operators
class UnevaluatableError(Exception):
pass
_straight_ops = set(getattr(operators, op)
for op in ('add', 'mul', 'sub',
# Py2K
'div',
# end Py2K
... | {
"content_hash": "c51222d79886c88ca183fd2c5bf77795",
"timestamp": "",
"source": "github",
"line_count": 113,
"max_line_length": 73,
"avg_line_length": 35.78761061946903,
"alnum_prop": 0.49727992087042533,
"repo_name": "denny820909/builder",
"id": "894ac139e791f901ff4a0b8aeb03c74c684b4d51",
"size": ... |
from datetime import datetime
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.sites.models import Site
from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from django.template.defaultfilters import linebreaks, escape, striptags
fr... | {
"content_hash": "46d714220e4778258753784eab9e5345",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 83,
"avg_line_length": 33.56410256410256,
"alnum_prop": 0.6504965622612682,
"repo_name": "edisonlz/fruit",
"id": "b05f51c61fac8d99e6cbd3b0d29f821af3d4d8df",
"size": "2618",... |
import os
import re
import IECore
import Gaffer
## Creates a custom Gaffer extension by exporting one or more Boxes
# as new node types defined in a python module. An associated startup
# file is generated to add the nodes to the node menu. If `directory`
# is placed on the GAFFER_EXTENSION_PATHS then the extension ... | {
"content_hash": "69698cc6aa3458429d83b80255c18624",
"timestamp": "",
"source": "github",
"line_count": 192,
"max_line_length": 106,
"avg_line_length": 25.15625,
"alnum_prop": 0.6532091097308489,
"repo_name": "appleseedhq/gaffer",
"id": "911a10fefc91b01a49f31ef86daf6e6b3a2da7ea",
"size": "6621",
... |
from test import unit
import unittest
import tempfile
import os
import time
from shutil import rmtree
from hashlib import md5
from tempfile import mkdtemp
from test.unit import FakeLogger
from swift.obj import auditor
from swift.obj import server as object_server
from swift.obj.server import DiskFile, write_metadata, D... | {
"content_hash": "ba493acc574e36bb2add7158f3747f09",
"timestamp": "",
"source": "github",
"line_count": 374,
"max_line_length": 79,
"avg_line_length": 38.06149732620321,
"alnum_prop": 0.5474534597822269,
"repo_name": "Triv90/SwiftUml",
"id": "4cb61696bfde04270530ea8cc9d4e4fcb5f9a958",
"size": "1482... |
import os
import mozinfo
import shlex
import subprocess
import sys
# determine the platform-specific invocation of `ps`
if mozinfo.isMac:
psarg = '-Acj'
elif mozinfo.isLinux:
psarg = 'axwww'
else:
psarg = 'ax'
def ps(arg=psarg):
"""
python front-end to `ps`
http://en.wikipedia.org/wiki/Ps_%28U... | {
"content_hash": "a9a3e905a477bfbdb38f322544f226f1",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 67,
"avg_line_length": 27.513157894736842,
"alnum_prop": 0.5839311334289814,
"repo_name": "wilebeast/FireFox-OS",
"id": "ee34c081c2a2eb7efa23df09718c86dce0ae87c1",
"size": ... |
from django.apps.registry import Apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django.db.migrations.exceptions import InvalidBasesError
from django.db.migrations.operations import (
AddField, AlterField, DeleteModel, RemoveField,
)
from django.db.migrations.... | {
"content_hash": "0d1450604cdf0ae54cbb192b787b96fb",
"timestamp": "",
"source": "github",
"line_count": 1183,
"max_line_length": 117,
"avg_line_length": 39.385460693153,
"alnum_prop": 0.584272315583886,
"repo_name": "hobarrera/django",
"id": "2e53e4f82578266688a38e85498bce22b5fe74ab",
"size": "4659... |
import random
import math
class Chromosome(object):
class PerfectMatch(Exception):
def __init___(self, perfectSpecimen):
Exception.__init__(self, "Perfect match found")
def __init__(self, chromosomeType, genes):
"""
:param chromosomeType: a template for the chromosome
... | {
"content_hash": "02106a9211d3e539d48fd6aa5b12bb11",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 113,
"avg_line_length": 33.70945945945946,
"alnum_prop": 0.5748647023451593,
"repo_name": "littley/pyvolution",
"id": "7ed323273dcd0b703182da5c919c7527ff0377b8",
"size": "... |
"""
Created on Thu Oct 15 12:53:42 2015
@author: Reed
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.formula.api as sm
import patsy
'''
script for basic exploratory analysis and naively pooled regression across all stores
'''
enriched_path = '../data/enr... | {
"content_hash": "d67ee39559cf69c9ccb1de51d7fa131c",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 212,
"avg_line_length": 30.47761194029851,
"alnum_prop": 0.718413320274241,
"repo_name": "bwpriest/rossmannsales",
"id": "f205576d050cc89c475872b09be956a9780857d0",
"size":... |
"""
Utility script used to run the flake8 linter over all the project Python
sources.
"""
from __future__ import absolute_import, print_function, unicode_literals
import os
import subprocess
import sys
__all__ = [
'lint',
]
# -----------------------------------------------------------------------------
# Con... | {
"content_hash": "e9cb8e74c2b946f2bf0955bb37bf35f1",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 79,
"avg_line_length": 21.392857142857142,
"alnum_prop": 0.5481357818586533,
"repo_name": "rudkx/swift",
"id": "260761a4bca2b6b366c8c2718023ff967060458b",
"size": "2169",
... |
from pylib.gtest import gtest_test_instance
from pylib.instrumentation import instrumentation_test_instance
from pylib.junit import junit_test_instance
from pylib.linker import linker_test_instance
from pylib.monkey import monkey_test_instance
from pylib.local.device import local_device_environment
from pylib.local.dev... | {
"content_hash": "205ed7f82eb380d41d3973b00ddae304",
"timestamp": "",
"source": "github",
"line_count": 53,
"max_line_length": 77,
"avg_line_length": 47.16981132075472,
"alnum_prop": 0.7592,
"repo_name": "chrisdickinson/nojs",
"id": "1a2872819d9c2fd09551f1017a320cb7a8e147e2",
"size": "2663",
"bin... |
"""
-----------------------------------------------------------------------------
Copyright (c) 2009-2019, Shotgun Software Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must re... | {
"content_hash": "7d38be4eadc154c3a21f28542eaa9782",
"timestamp": "",
"source": "github",
"line_count": 4329,
"max_line_length": 184,
"avg_line_length": 44.34488334488334,
"alnum_prop": 0.5635753689397768,
"repo_name": "cpenv/autocpenv",
"id": "2683c3969d1dcb8a456a2d8548ce295b32b46c66",
"size": "19... |
"""
Helper methods for operations related to the management of VM records and
their attributes like VDIs, VIFs, as well as their lookup functions.
"""
import contextlib
import os
import time
import urllib
import uuid
from xml.dom import minidom
from xml.parsers import expat
from eventlet import greenthread
from oslo_... | {
"content_hash": "fb7cd1bc5aea56f5343f8f8100135323",
"timestamp": "",
"source": "github",
"line_count": 2626,
"max_line_length": 79,
"avg_line_length": 37.613480578827115,
"alnum_prop": 0.5895538254381258,
"repo_name": "thomasem/nova",
"id": "eee943f9fdbb1934c53064b508610817f3a786eb",
"size": "9947... |
DNSREDIR_CONFIGDIR_PREFIX = "/etc/dnsredir/"
DNSREDIR_LOGDIR_PREFIX = "/var/log/dnsredir/"
DNSREDIR_PIDFILE_PREFIX = "/var/run/dnsredir."
REDIR_USER = "princeton_coredirect"
#REDIR_USER = "arizona_tools1"
#DEMUX_USER = "arizona_tools1"
DEMUX_USER = "princeton_codnsdemux"
HEARTBEAT_PORT = 9000
#not required as of now, a... | {
"content_hash": "18d7dad28606a81e890aa8bbd8b424fd",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 89,
"avg_line_length": 38.42857142857143,
"alnum_prop": 0.7434944237918215,
"repo_name": "wathsalav/xos",
"id": "d0c00c24ff67a28bfaa1ef9944eb271812c0bcaf",
"size": "561",
... |
import pytest
from ate.tags import CompileStatement
from ate.ate import ParseContext, Template
from ate.exceptions import ParseError
class TestErrorHandling:
def test_simple(self):
tpl = ParseContext("{% nonexisting and unclosed")
with pytest.raises(ParseError) as e:
res, skip = Comp... | {
"content_hash": "714de4f4f4c213b1357f7799b518a05f",
"timestamp": "",
"source": "github",
"line_count": 80,
"max_line_length": 57,
"avg_line_length": 24.7375,
"alnum_prop": 0.5411824153612936,
"repo_name": "iivvoo/ate",
"id": "351580b38987389bb4ad6a9d97d12fd534fc847d",
"size": "1979",
"binary": f... |
import decimal
from django.core.management.color import no_style
from django.db import NotSupportedError, connection, transaction
from django.db.backends.base.operations import BaseDatabaseOperations
from django.db.models import DurationField, Value
from django.test import (
SimpleTestCase,
TestCase,
Trans... | {
"content_hash": "e37c2ed72637571e739ab284d7622b97",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 87,
"avg_line_length": 37.43693693693694,
"alnum_prop": 0.6531103356996751,
"repo_name": "dsanders11/django",
"id": "b19b7ee5586f1326fa64ebbd151b481e4da51fdd",
"size": "83... |
"""
Created on Mar 8, 2014
@author: tjoneslo
"""
import os
import logging
from pypdflite import PDFLite
from pypdflite import PDFCursor
from pypdflite.pdfobjects.pdfline import PDFLine
from pypdflite.pdfobjects.pdfellipse import PDFEllipse
from pypdflite.pdfobjects.pdftext import PDFText
from Galaxy import Sector, Gal... | {
"content_hash": "3c7278cd4b4ea03d122f4a6661629ef3",
"timestamp": "",
"source": "github",
"line_count": 543,
"max_line_length": 125,
"avg_line_length": 36.57090239410682,
"alnum_prop": 0.5384228018934435,
"repo_name": "makhidkarun/traveller_pyroute",
"id": "3dfac1993f6fc3a8d37942e4bb8131d211df70cb",
... |
from turtle import *
cote = 150
angle = 60
begin_fill()
pencolor("black")
fillcolor("light blue")
left(angle)
forward(cote)
right(180 - angle)
forward(cote)
right(180 - angle)
forward(cote)
end_fill()
hideturtle()
done() | {
"content_hash": "d5ab4fea5d712ac83051cfcc2b87389d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 23,
"avg_line_length": 11.25,
"alnum_prop": 0.7066666666666667,
"repo_name": "TGITS/programming-workouts",
"id": "7762bdf0d306692d386de4e76b68272ac15472b1",
"size": "225",
... |
import os
from collections import OrderedDict
from nmt import train
from char_base import *
layers = {'ff': ('param_init_fflayer', 'fflayer'),
'fff': ('param_init_ffflayer', 'ffflayer'),
'gru': ('param_init_gru', 'gru_layer'),
'two_layer_gru_decoder': ('param_init_two_layer_gru_decoder',... | {
"content_hash": "5c3f6475150e96f0893db95639b23726",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 83,
"avg_line_length": 36.93103448275862,
"alnum_prop": 0.6034858387799564,
"repo_name": "nyu-dl/dl4mt-cdec",
"id": "0ddcac79edf7f048c100db801aa5c67a7a5bb0b0",
"size": "321... |
import pyaf.Bench.TS_datasets as tsds
import tests.artificial.process_artificial_dataset as art
art.process_dataset(N = 32 , FREQ = 'D', seed = 0, trendtype = "Lag1Trend", cycle_length = 30, transform = "Difference", sigma = 0.0, exog_count = 20, ar_order = 12); | {
"content_hash": "8d1c6f1ba12e63dfa08d5f675be18677",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 166,
"avg_line_length": 38,
"alnum_prop": 0.706766917293233,
"repo_name": "antoinecarme/pyaf",
"id": "067c49ae64e56517e0a7b36a5bdee8cb4ba32cac",
"size": "266",
"binary": f... |
"""Configuration for Cooking Basic Mini.
This is an extension of the cooking environments from:
meltingpot/python/configs/substrates/collaborative_cooking.py
The structure of this file (and how configs are handled for these environments)
follow the design patterns introduced there.
Same as Cooking Basic but a miniat... | {
"content_hash": "921bab903d1fe9e66d241c4049dfd910",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 88,
"avg_line_length": 31.782608695652176,
"alnum_prop": 0.7906976744186046,
"repo_name": "google-research/google-research",
"id": "666e8b1bcf74f31700247a774583c32cb4c2131b",... |
import cmd
import atexit
import subprocess
import readline
import os
from Zpy.Processor import Processor
from Zpy.Completer import Completer
import sys
class Cmd(cmd.Cmd):
def __init__(self):
super(Cmd, self).__init__()
self.prompt = '(Zpy) '
self.processor = Processor()
self.comp... | {
"content_hash": "c9da248f498213b6f98b1d43305f90bd",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 95,
"avg_line_length": 28.046875,
"alnum_prop": 0.5777158774373259,
"repo_name": "albertaleksieiev/zpy",
"id": "2ec515cf92922189169b71038a1777672ee0008e",
"size": "1795",
... |
from flask import Blueprint, render_template, flash, request, abort, url_for, redirect
from flask_login.utils import login_required, login_user, logout_user
from modules.Auth.forms import LoginForm
from modules.Auth.models import User
Keys = Blueprint('Keys', __name__, template_folder='templates', static_folder='stati... | {
"content_hash": "8c7ed46e108f3bf58d5db16f0f39702f",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 98,
"avg_line_length": 40.285714285714285,
"alnum_prop": 0.75177304964539,
"repo_name": "srebrny/simple-rest-api",
"id": "80f7c9ade6a49cda22dda41b66546a610c7f19a1",
"size":... |
"""
Updated by Lin Xiong Jul-21, 2017
Modified by Lin Xiong Oct-30, 2017 (add SE building block)
Thanks to Cher Keng Heng
"""
import argparse,logging,os
import mxnet as mx
from symbol_se_inception_v4 import get_symbol
logger = logging.getLogger()
logger.setLevel(logging.INFO)
formatter = logging.Formatt... | {
"content_hash": "bd2581dd5e7a71edc169afa3f0417605",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 178,
"avg_line_length": 59.91503267973856,
"alnum_prop": 0.5692156648849133,
"repo_name": "bruinxiong/SENet.mxnet",
"id": "c73def109d4ecb8d7f21319819e0769e4f3d9f58",
"size... |
from __future__ import unicode_literals
from decimal import Decimal
from mock import MagicMock, patch
from prices import Price
import pytest
from satchless.item import InsufficientStock
from . import Cart, SessionCart
from . import forms
from .forms import ReplaceCartLineForm, ReplaceCartLineFormSet
from ..cart.utils... | {
"content_hash": "a7f66be305c5d137f1749bdcd83e879b",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 76,
"avg_line_length": 30.01298701298701,
"alnum_prop": 0.6978220106735901,
"repo_name": "spartonia/saleor",
"id": "d86586bc6925c5ace97982e841ffbe6e1dcd2250",
"size": "693... |
import json
from anchore_engine import db
from anchore_engine.db import ObjectStorageRecord
def put(userId, bucket, key, data, metadata=None, session=None):
if not session:
session = db.Session
our_result = (
session.query(ObjectStorageRecord)
.filter_by(userId=userId, bucket=bucket,... | {
"content_hash": "0b50762e4a8aef7befa0e737737cbc5a",
"timestamp": "",
"source": "github",
"line_count": 125,
"max_line_length": 130,
"avg_line_length": 25.928,
"alnum_prop": 0.5887071891391545,
"repo_name": "anchore/anchore-engine",
"id": "e29089321c4f2bda11f1bb3f1153b0f3ffcf1c98",
"size": "3241",
... |
from MEHI.serial.fusion import *
from MEHI.serial.IO import load_tiff
from test_utils import LocalTestCase
import numpy as np
import os,sys
L_pwd = os.path.abspath('.') + '/test_data/L_side/'
R_pwd = os.path.abspath('.') + '/test_data/R_side/'
class LocalTestFusionCase(LocalTestCase):
def setUp(self):
sup... | {
"content_hash": "508ded88ed5e898fcaeb31c4156d1907",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 53,
"avg_line_length": 32.625,
"alnum_prop": 0.6561302681992337,
"repo_name": "septicmk/MEHI",
"id": "374ca83de4476b44d656e950743d9421f22a5e6c",
"size": "1194",
"binary":... |
"""Tests for tensorflow.ops.resource_variable_ops."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import copy
import gc
import os
import pickle
import numpy as np
from tensorflow.python.eager import context
from tensorflow.python.framework import const... | {
"content_hash": "cb2db928ce166376401077cefc9e3819",
"timestamp": "",
"source": "github",
"line_count": 974,
"max_line_length": 88,
"avg_line_length": 42.5482546201232,
"alnum_prop": 0.6538777086047971,
"repo_name": "brchiu/tensorflow",
"id": "45b9ede813e1592fa28d1c8c6c9dc9aeea0a8d6d",
"size": "421... |
"""OpenID Provider Authentication interface unit test package
NERC DataGrid Project
"""
__author__ = "P J Kershaw"
__date__ = "12/11/09"
__copyright__ = "(C) 2009 Science and Technology Facilities Council"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revisio... | {
"content_hash": "c8885333d750e84a0af306d8d3d2cc7b",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 68,
"avg_line_length": 33.3,
"alnum_prop": 0.6846846846846847,
"repo_name": "philipkershaw/ndg_security_server",
"id": "bd3fae4aefff10dc2528034598f6105240ce064e",
"size": "... |
from udsoncan.client import Client
from udsoncan import services
from udsoncan.exceptions import *
from test.ClientServerTest import ClientServerTest
class TestRoutineControl(ClientServerTest):
def __init__(self, *args, **kwargs):
ClientServerTest.__init__(self, *args, **kwargs)
def test_start_routin... | {
"content_hash": "04047757341ff9a36f9adbdffd80d96b",
"timestamp": "",
"source": "github",
"line_count": 164,
"max_line_length": 105,
"avg_line_length": 50.19512195121951,
"alnum_prop": 0.7088192419825073,
"repo_name": "pylessard/python-udsoncan",
"id": "df1e212fb5c1bc48214a121b86466a12c4c0e856",
"s... |
cars = 100
# 4.0 is a floating point
space_in_a_car = 4.0
drivers = 30
passengers = 90
cars_not_driven = cars - drivers
cars_driven = drivers
carpool_capacity = cars_driven * space_in_a_car
average_passengers_per_car = passengers / cars_driven
print "There are", cars, "cars available."
print "There are only", drivers... | {
"content_hash": "9cf585162884fdac421dbd40e0a7b33f",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 72,
"avg_line_length": 34.470588235294116,
"alnum_prop": 0.726962457337884,
"repo_name": "CodeCatz/litterbox",
"id": "9005af9a69abb0747d52da84106b4f791526a0ee",
"size": "65... |
from CIM14.IEC61970.Generation.GenerationDynamics.SteamSupply import SteamSupply
class FossilSteamSupply(SteamSupply):
"""Fossil fueled boiler (e.g., coal, oil, gas)
"""
def __init__(self, boilerControlMode="following", superHeater2Capacity=0.0, auxPowerVersusFrequency=0.0, feedWaterIG=0.0, controlPED=0.0... | {
"content_hash": "cca9f96f838a78d19c9e7f961576cc29",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 677,
"avg_line_length": 57.73170731707317,
"alnum_prop": 0.7163779749331081,
"repo_name": "rwl/PyCIM",
"id": "96f3a90268f0051201abc2ca2678783fc1edacc5",
"size": "8201",
... |
lines = []
try:
while True:
line = raw_input()
lines.append(line)
except EOFError:
pass
import re
pattern = re.compile('[aiueoAIUEO]')
for line in lines:
if pattern.search(line):
print(line.upper())
else:
print(line.lower()) | {
"content_hash": "aee2eb601fab04743ebdd5d2b4577874",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 36,
"avg_line_length": 16.6,
"alnum_prop": 0.6465863453815262,
"repo_name": "Fukayanegi/CodeIQ_py",
"id": "3a45859f63abbe24c84eae9f9f8ae8eba775b02a",
"size": "266",
"bina... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.