text stringlengths 4 1.02M | meta dict |
|---|---|
from test_models import *
from test_utils import *
from test_periods import *
from test_templatetags import *
from test_views import *
from test_rule import *
| {
"content_hash": "7ab64b7a9ac7f73d1fe661722b8bc2a4",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 31,
"avg_line_length": 22.857142857142858,
"alnum_prop": 0.76875,
"repo_name": "tscholze/py-hasi-home-analytical-system-interface",
"id": "3b3a11aa86c39a7e936ed4dd0fa1541f6b85... |
import requests
import time
import random
from pyquery import PyQuery as pq
from mongodb import db
from settings import ALADDIN_BASE_URLS
def get_aladdin_pages():
"""
获取每个分类的分页url,存进mongodb
:return:
"""
breadcrumb_search_url = 'http://www.aladdin-e.com/breadcrumbSearch/1/{amount}/20/{page}/CS/{cata... | {
"content_hash": "9ee78160a1033ee3775fa7baa8ddc0b9",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 105,
"avg_line_length": 29.763157894736842,
"alnum_prop": 0.53315649867374,
"repo_name": "mutoulbj/chem_spider",
"id": "ffd51538f4df1b66ab02174e006605cd89fbc5fb",
"size": "... |
import os
import sys
from optparse import OptionParser
from urllib import urlopen
from ua_mapper.wurfl2python import WurflPythonWriter, DeviceSerializer
OUTPUT_PATH = os.path.abspath(os.path.dirname(__file__))
WURFL_ARCHIVE_PATH = os.path.join(OUTPUT_PATH, "wurfl.zip")
WURFL_XML_PATH = os.path.join(OUTPUT_PATH, "wurf... | {
"content_hash": "bf7dc45f0179b0fe97daf5d943135405",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 99,
"avg_line_length": 32.758620689655174,
"alnum_prop": 0.6236842105263158,
"repo_name": "praekelt/wsgi-ua-mapper",
"id": "69875b6dccbf6cc613d30a85d01e61dfe3989140",
"size... |
"""
The lexicon is constructed by calling
``lexicon.fromstring(<lexicon string>)``.
In order to construct a parser, you also need a rule set.
The standard English rules are provided in chart as
``chart.DefaultRuleSet``.
The parser can then be constructed by calling, for example:
``parser = chart.CCGChartParser(<lexic... | {
"content_hash": "7294755a22a69ee060e44684bf33f3ca",
"timestamp": "",
"source": "github",
"line_count": 354,
"max_line_length": 110,
"avg_line_length": 33.72598870056497,
"alnum_prop": 0.6151268950498366,
"repo_name": "nelango/ViralityAnalysis",
"id": "9b89e8ddbf94792c957ec9e183056afa4631c268",
"si... |
from helper import norm, unitize
from collections import defaultdict
from math import pow
import scipy as sp
import pprint
from logger import logger
base_logger = logger.getChild('links')
base_logger.info('Inside links.py')
########################################################
### Link Stuff ##################... | {
"content_hash": "9c7558d96cbc1d3e9df2b76df1da56e1",
"timestamp": "",
"source": "github",
"line_count": 282,
"max_line_length": 209,
"avg_line_length": 31.94326241134752,
"alnum_prop": 0.5576154529307282,
"repo_name": "alexalemi/cancersim",
"id": "8cf644c098487718024d1daf51f863d8b958b2d4",
"size": ... |
"""
OpentTMI module for Priority
"""
from opentmi_client.utils.Base import BaseApi
from opentmi_client.utils.decorators import setter_rules
class Priority(BaseApi):
"""
Priority class
"""
@property
def level(self):
"""
Getter for level
:return: String
"""
r... | {
"content_hash": "8aa07a64df533e5f0d41c03948fbb7ba",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 56,
"avg_line_length": 22.352941176470587,
"alnum_prop": 0.5280701754385965,
"repo_name": "OpenTMI/opentmi-client-python",
"id": "81ce17faec81fb7eb8f288e28af3d761d1a5fa9b",
... |
import sys
from operator import itemgetter
def adder(tagN,tagW): # Adder Function which maintains Top N list
l = len(topNTags)
if len(topNTags) == None:l = 0
if l < N or topNTags[N-1][1] < totalWeight:
if l == N:topNTags.pop()
topNTags.append([oldTag,totalWeight])
topN... | {
"content_hash": "0c895682fa7b5c50c284a7c2d0771a48",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 83,
"avg_line_length": 28.11764705882353,
"alnum_prop": 0.6108786610878661,
"repo_name": "np1810/Hadoop_and_MapReduce",
"id": "0eae1d4220aea50189ac41a63b477a1c48e2a0b3",
"s... |
"""Operations for feeding input data using TensorFlow placeholders."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
def prepare_feed_dict(model, features, labels=None, is_training=None):
"""Prepares a feed_dict for sess.run() ... | {
"content_hash": "a92d4cab043d4cbb81db045e38031e28",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 80,
"avg_line_length": 33.84,
"alnum_prop": 0.7044917257683215,
"repo_name": "jiaphuan/models",
"id": "566cc623b3d6c51c0bfe7935e2ddb579890bb7d2",
"size": "3126",
"binary"... |
import sys, logging, unittest
import feedparser
from calendar import timegm
from time import gmtime
from operator import itemgetter
from lxml import html
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.username = 'testuser'
self.feedurl_invalid = 'http://www.cnn.com'
... | {
"content_hash": "2a9f00015da9a9096e1cd4f5a029d9af",
"timestamp": "",
"source": "github",
"line_count": 98,
"max_line_length": 199,
"avg_line_length": 45.89795918367347,
"alnum_prop": 0.6373943975100045,
"repo_name": "mattdeboard/rss-connector",
"id": "1a85c2a8c3cf6de3da082b79d594c817a334bab0",
"si... |
from __future__ import division
import datetime
from django.conf import settings
from django.db import models
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.contrib.contenttypes import generic
from django.db.models.signals import m2m_changed
from o... | {
"content_hash": "0290af3880f8d059ec2422874ec093b3",
"timestamp": "",
"source": "github",
"line_count": 639,
"max_line_length": 110,
"avg_line_length": 28.408450704225352,
"alnum_prop": 0.5964854294056079,
"repo_name": "zbyufei/open-budgets",
"id": "fff39d85ba9cb160b87ac08f321ad25af7ac613f",
"size"... |
'''
Description
If using files, (call by command line or from python):
all the inputs are raw float32 vectors files that are reshaped by the number
of f0 values in ff0.
There are three safe patches that were not described in the publication[1]:
(These are not critical, they might remove a few artifacts h... | {
"content_hash": "8ea7dce5aa6d8fa3c00bc07b58fca8f0",
"timestamp": "",
"source": "github",
"line_count": 311,
"max_line_length": 329,
"avg_line_length": 42.845659163987136,
"alnum_prop": 0.6212382739212008,
"repo_name": "etosha/pulsemodel",
"id": "539ee22aff4b3d26c97adb5787c77e8b2ecd9ef6",
"size": "... |
import json
import os
from build_fail import BuildFail
from build_pass import BuildPass
from slackclient import SlackClient
"""
Split a comma seperated string into a list, removing any white space while your there.
"""
def spliterator(bad_string):
if bad_string:
return bad_string.replace(' ', '').split('... | {
"content_hash": "2d105face5adb8bfdaeb3c21fa5ce160",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 86,
"avg_line_length": 33.20338983050848,
"alnum_prop": 0.590096988259316,
"repo_name": "otormaigh/slack-notify-wercker-step",
"id": "4601b46627cc8856b588f9534fb1d6043eee49be... |
"""Tests for tensorflow.python.training.saver.py."""
import functools
import os
from tensorflow.python.eager import context
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import errors
from tensorflow.python.framework import ops as ops_lib
from tensorflow.python.keras.engine impo... | {
"content_hash": "e1a2d5e059e588b6a02dd0a36b57414f",
"timestamp": "",
"source": "github",
"line_count": 140,
"max_line_length": 76,
"avg_line_length": 39.05714285714286,
"alnum_prop": 0.6978785662033651,
"repo_name": "sarvex/tensorflow",
"id": "a92378834c659efccee7ac4cc302bbe40329488a",
"size": "61... |
import logging
from flask import render_template, request, session, url_for
from flask_wtf.csrf import CSRFError
from requests.exceptions import ConnectionError
from structlog import wrap_logger
from werkzeug.utils import redirect
from frontstage import app
from frontstage.common.session import Session
from frontstag... | {
"content_hash": "7b6ceaef94891b16b0ec90c8c2fa2c96",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 118,
"avg_line_length": 32.52173913043478,
"alnum_prop": 0.7309491978609626,
"repo_name": "ONSdigital/ras-frontstage",
"id": "9af7a12cb201ea222bcf6bd962130d443e8794c6",
"si... |
from __future__ import unicode_literals, absolute_import
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.core.validators import MaxValueValidator
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.tra... | {
"content_hash": "e8799d49ee5df8f9d80f8e05ae668a65",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 91,
"avg_line_length": 33.08620689655172,
"alnum_prop": 0.7107868681605003,
"repo_name": "WarszawskaGrupaWspolnegoKodowania/Coding_Buddy",
"id": "aa367be116a81b9ab1d080408931... |
from flask import Flask, request, json
import RPi.GPIO as GPIO
import threading
import time
import socket
import ast
import Adafruit_DHT
GPIO.setmode(GPIO.BCM)
USE_TEST_TEMPERATURES = False
app = Flask(__name__)
class sensorReader(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
... | {
"content_hash": "3d510b4089459a1d3e46d1b59e963dbe",
"timestamp": "",
"source": "github",
"line_count": 189,
"max_line_length": 107,
"avg_line_length": 36.84126984126984,
"alnum_prop": 0.5460290104839868,
"repo_name": "mpascu/SmartThermostatServer",
"id": "af870d44380e3fdcaa397f30d62f1b1b9861168d",
... |
import re
from crud_object import main
def test_main(cloud_config, capsys):
main(cloud_config.storage_bucket, __file__)
out, err = capsys.readouterr()
assert not re.search(r'Downloaded file [!]=', out)
assert re.search(r'Uploading.*Fetching.*Deleting.*Done', out, re.DOTALL)
| {
"content_hash": "e776e266c501255e430831ad16dd92b4",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 76,
"avg_line_length": 26.818181818181817,
"alnum_prop": 0.6915254237288135,
"repo_name": "clarko1/Cramd",
"id": "89e764b4d58788b5eb9823f4d7bb903ab0f5d435",
"size": "870",
... |
import roslib; roslib.load_manifest('ur_driver')
import time, sys, threading, math
import copy
import datetime
import socket, select
import struct
import traceback, code
import optparse
import SocketServer
import rospy
import actionlib
from sensor_msgs.msg import JointState
from control_msgs.msg import FollowJointTraj... | {
"content_hash": "2f6324834f0898d5748aa109f140e9ec",
"timestamp": "",
"source": "github",
"line_count": 1022,
"max_line_length": 129,
"avg_line_length": 38.10665362035225,
"alnum_prop": 0.5740659904994223,
"repo_name": "ibaranov-cp/ridgeback_ur10",
"id": "0ee7e7d45e0944b437116f33178b9cc8c02a74e3",
... |
from imports import *
def nick_exist(nick):
"""Check if the nickname exists
Args:
nick: the nickname user entered
Returns:
Whether there are same nick name in database
"""
result = db_session.query(User).filter_by(nick=nick).all()
if len(result) > 0:
return True
... | {
"content_hash": "061349c73c2bc0a5b244d10cf64c012c",
"timestamp": "",
"source": "github",
"line_count": 176,
"max_line_length": 95,
"avg_line_length": 21.505681818181817,
"alnum_prop": 0.5928665785997358,
"repo_name": "NewBeeStudio/xichao-new",
"id": "d3f00380a27dd56f8b543cf909674feb350eebcd",
"siz... |
class BuildingPoint(object):
def __init__(self, point, is_start, height):
self.point = point;
self.is_start = is_start
self.height = height
def __lt__(self, other):
if self.point != other.point:
return self.point < other.point
else:
if se... | {
"content_hash": "2547b90c299371f88bcda0e02ffa8c5a",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 85,
"avg_line_length": 30.183333333333334,
"alnum_prop": 0.5389287686361126,
"repo_name": "rtkasodariya/interview",
"id": "049bb4bfb45bbe44e090ab1baf00fa1c6a308def",
"size"... |
"""Similar to the last problem, the bulk of 3.py is scraping a large comment
from the source of the webpage in order to find the name of the next webpage
to visit. The hint this time is to look for one "small letter" surrounded
by exactly three "big bodyguards" (letters) on each of its sides. To find all
matches of thi... | {
"content_hash": "e7433cfe42d6434d22247386819b024c",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 80,
"avg_line_length": 48.4054054054054,
"alnum_prop": 0.7604690117252931,
"repo_name": "cjonsmith/python-challenge",
"id": "5b104704de914379e176b538d5fcacaa9236bbc0",
"siz... |
import unittest
from datetime import datetime
from unittest.mock import patch
from airflow.exceptions import AirflowException
from airflow.models import DAG, Connection
from airflow.providers.qubole.sensors.qubole import QuboleFileSensor, QubolePartitionSensor
from airflow.utils import db
DAG_ID = "qubole_test_dag"
T... | {
"content_hash": "118e5c7c9cce3c61788898d3b45000f4",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 91,
"avg_line_length": 34.08064516129032,
"alnum_prop": 0.608140085186938,
"repo_name": "wooga/airflow",
"id": "646d16a70b16dcea0c2f62966d00c9e6e392f5fa",
"size": "2903",
... |
from __future__ import absolute_import
from builtins import object
from math import *
from proteus import *
from proteus.default_p import *
try:
from .cylinder import *
except:
from cylinder import *
from proteus.mprans import PresInit
#domain = ctx.domain
#nd = ctx.nd
name = "pressureInitial"
coefficients=Pr... | {
"content_hash": "d9bedd762a69b07cdf1b6b0a7700e47d",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 108,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.671062271062271,
"repo_name": "erdc/proteus",
"id": "e285e017bb9646e3434811419b8640d8dfdb8bc4",
"size": "1365",
... |
from __future__ import absolute_import
from sentry.models import GroupHash
from sentry.testutils import TestCase
class GroupTest(TestCase):
def test_fetch_and_record_last_processed_event_id(self):
group = self.group
grouphash = GroupHash.objects.create(
project=group.project,
... | {
"content_hash": "a1ee19a5e5042ef6afc2908f20a7967b",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 60,
"avg_line_length": 24.916666666666668,
"alnum_prop": 0.5919732441471572,
"repo_name": "gencer/sentry",
"id": "6a108087713bb97a17ea52983cc8949ecc7f7681",
"size": "598",
... |
import pytest
from django.test.utils import override_settings
from django.urls import reverse
from democracy.models import Hearing
@pytest.mark.django_db
def test_hearing_delete_action(admin_client, default_hearing):
change_url = reverse('admin:democracy_hearing_changelist')
data = {'action': 'delete_selecte... | {
"content_hash": "f4ff57f2699adce154b4acc8f120a498",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 90,
"avg_line_length": 38.29032258064516,
"alnum_prop": 0.7447346251053075,
"repo_name": "City-of-Helsinki/kerrokantasi",
"id": "c7e737dc42c94caa7246b099278c3675ace05bfd",
... |
'''
(By default, this script will be automatically invoked by download_fddb.sh)
Manually invoke this script to generate image list and annotation files with
absolute paths.
Please make sure this script stays aside with a folder fddb which contains
sub-folders: 2002, 2003, FDDB-folds.
Invoke this script again after y... | {
"content_hash": "479fff371a3617d62ba4f3e6ddda2b9f",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 97,
"avg_line_length": 30.133333333333333,
"alnum_prop": 0.6299778761061947,
"repo_name": "Microos/FaceAnnotationTool",
"id": "d75141d990afac921b02ba1d275179d479e9e81d",
"s... |
import os
import os.path
import tempfile
import shutil
import json
from nose.tools import eq_
from nose.tools import with_setup
from build_pack_utils import utils
from common.integration import ErrorHelper
from common.components import BuildPackAssertHelper
from common.components import HttpdAssertHelper
from common.co... | {
"content_hash": "43d3c7c4c27794ebbe90103e1767f3cf",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 78,
"avg_line_length": 40.587188612099645,
"alnum_prop": 0.6013152126260413,
"repo_name": "pipeflo/php-moodle-buildpack",
"id": "05065e6ed7907fae349b63c05c9a31e9c4e5a9fa",
... |
from importlib import import_module
# Django
from django.conf import settings
from django.db.models.signals import post_migrate
# External
try:
from south.signals import post_migrate
South = True
except ImportError:
South = False
# User
import notifier
from notifier.models import Backend
from notifier im... | {
"content_hash": "438295a3ca94360250a4ed38e0e3d7f7",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 27.662650602409638,
"alnum_prop": 0.60801393728223,
"repo_name": "iberben/django-notifier",
"id": "e77c01a01402e4575621c81b74ea7296844b445e",
"size":... |
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from moments.extensions import mail
def send_async_email(app, msg):
with app.app_context():
mail.send(msg)
def send_email(to, subject, template, **kwargs):
msg = Message(current_app.config['MO... | {
"content_hash": "f16214044a6a94e03297ff8e0a37b7b6",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 106,
"avg_line_length": 29.84375,
"alnum_prop": 0.7047120418848167,
"repo_name": "greyli/moments-dev",
"id": "09ca47915e5d6b5faf0afdb0e56fdd8fc236deab",
"size": "1003",
"... |
""" test the scalar Timestamp """
import calendar
from datetime import datetime, timedelta
import locale
import unicodedata
import dateutil
from dateutil.tz import tzutc
import numpy as np
import pytest
import pytz
from pytz import timezone, utc
from pandas._libs.tslibs import conversion
from pandas._libs.tslibs.tim... | {
"content_hash": "092d10d2c86701643989c7ddbd8fe4b0",
"timestamp": "",
"source": "github",
"line_count": 988,
"max_line_length": 88,
"avg_line_length": 39.70040485829959,
"alnum_prop": 0.575769936773404,
"repo_name": "MJuddBooth/pandas",
"id": "b55d00b44fd6736d43003d6031d7d5b201ef5314",
"size": "392... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0005_auto_20170423_0859'),
]
operations = [
migrations.AddField(
model_name='book',
name='copies',
fiel... | {
"content_hash": "1fa055583faca4cda00cbe819aca94f2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 49,
"avg_line_length": 20.61111111111111,
"alnum_prop": 0.5849056603773585,
"repo_name": "AthmanZiri/vitabu",
"id": "650622c839e60ec5d06c14effd47b5c0126c892e",
"size": "444... |
import os, pprint
from os import removedirs
def underscore_to_camelcase(name):
name = name.title().replace("_", "")
return name[0].lower() + name[1:]
def underscore_to_camelcase_upper(name):
name = name.title().replace("_", "")
return name[0].upper() + name[1:]
def remove_folder(folder):
""" R... | {
"content_hash": "7fd27f5f4a7cfe8b72aa89f756d1b12d",
"timestamp": "",
"source": "github",
"line_count": 198,
"max_line_length": 128,
"avg_line_length": 34.86363636363637,
"alnum_prop": 0.4667535853976532,
"repo_name": "wfnex/openbras",
"id": "947fc31d48aef63b6605dfdcf486adc9c060ad2a",
"size": "7523... |
import unittest
import json
from lock import RPiLock
from user import User
from requests import Response
try:
from unittest.mock import patch, MagicMock, mock_open
except ImportError:
from mock import patch, MagicMock, mock_open
FAKE_LOCKS = [
{
'pk': 1,
'serial': 'randomserial',
},
]
... | {
"content_hash": "8e5d76c38e640368da3bbaeb03d9c682",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 76,
"avg_line_length": 28.584615384615386,
"alnum_prop": 0.5756189451022605,
"repo_name": "Secured-Pi/raspberry-pi-client",
"id": "a053b51fcf5b80d6be199dc018fa7908ba601d0f",... |
from __future__ import print_function
import re
import requests
import pprint
from orionsdk import SwisClient
def main():
# Connect to SWIS
server = 'localhost'
username = 'admin'
password = ''
swis = SwisClient(server, username, password)
alert_name = 'NTA Alert on machine-hostname'
query... | {
"content_hash": "e88bf7bc512f5a0a9be84e8e0e9db0d1",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 129,
"avg_line_length": 21.78787878787879,
"alnum_prop": 0.6244784422809457,
"repo_name": "solarwinds/orionsdk-python",
"id": "2f3ce5d5e04ad7893560e31274a30a3800087d9e",
"s... |
from main import BaseHandler
from models.blog_post import blog_key
from google.appengine.ext import ndb
import time
class DeletePostHandler(BaseHandler):
"""Delete post if authored by user"""
def get(self):
if self.user:
post_id = self.request.get("post")
key = ndb.Key('BlogPo... | {
"content_hash": "c55db52191f1cc17bea4cf4735c4299a",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 37.2972972972973,
"alnum_prop": 0.5557971014492754,
"repo_name": "ashutoshpurushottam/wishper-blog",
"id": "c4775ddcb8fa53a5a1e29821b4ced65f4673c64f",
... |
"""Update encrypted deploy password in Travis config file
"""
from __future__ import print_function
import base64
import json
import os
from getpass import getpass
import yaml
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from cryptography.hazmat.backends import default_backend
from cry... | {
"content_hash": "26d7f2370b40530ebdb02790bb28cf8a",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 79,
"avg_line_length": 30.883333333333333,
"alnum_prop": 0.6807879114948732,
"repo_name": "kdheepak/ewspy",
"id": "be35d63ec0639542e4a31ff773672addf7e52688",
"size": "3752... |
from selenium import webdriver
class Clicker:
def start_clicking(self):
driver = webdriver.Chrome()
driver.get("https://pep.pxl.be/Personeelsregister/PersoneelZoeken.aspx")
name_field = driver.find_element_by_id("ctl00_ContentPlaceHolder1_txtZoekenNaam")
name_field.click()
... | {
"content_hash": "7b74b54a30da9470a32b29b4816fbe40",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 114,
"avg_line_length": 39.42857142857143,
"alnum_prop": 0.7137681159420289,
"repo_name": "wgroeneveld/productivity-course",
"id": "445294b7ae9e9447ced3a4b5a06baf0ce44841ff",... |
from st2actions.runners.pythonrunner import Action
import requests
class MmonitBaseAction(Action):
def __init__(self, config):
super(MmonitBaseAction, self).__init__(config=config)
self.user = config['username']
self.password = config['password']
self.url = config['host']
s... | {
"content_hash": "6db965ca84d82813b36f7b04e6c2f994",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 84,
"avg_line_length": 34.93103448275862,
"alnum_prop": 0.6169792694965449,
"repo_name": "pidah/st2contrib",
"id": "d8fdc1615c8eae2fdf54a013704699d18119463d",
"size": "1013... |
import mock
from oslo_config import cfg
import oslo_messaging
from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.handlers import resources_rpc
from neutron.services.trunk.rpc import agent
from neutron.tests import base
class TrunkSkeletonTest(base.BaseTestCase):
# TODO(fitoduarte): add more tes... | {
"content_hash": "0f5d6b9245689ab0ce9ae684ee2934ac",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 78,
"avg_line_length": 47.34285714285714,
"alnum_prop": 0.6928183464091732,
"repo_name": "eayunstack/neutron",
"id": "8ed87c2ce65473fb7f3b8d0da661bcc60ed5e9e9",
"size": "22... |
"""User subscription table.
A subscription is any time-limited modification to a user's privileges,
such as increased storage quota. Subscriptions may be paid (initially
supporting iOS in-app purchases) or granted for other reasons such as
referring new users.
"""
__author__ = 'ben@emailscrubbed.com (Ben Darnell)'
... | {
"content_hash": "594195afad2d70c1ee97b688dbae8023",
"timestamp": "",
"source": "github",
"line_count": 161,
"max_line_length": 108,
"avg_line_length": 38.484472049689444,
"alnum_prop": 0.7198192382182053,
"repo_name": "peixiaobin/viewfinder",
"id": "34021a5b7c0c409ae4233f5fa913562f945fbcb7",
"size... |
import markov, time, random
from blick import BlickLoader
from google import search
from random import randrange
b = BlickLoader(grammarType="default")
phonetics = []
phonetics.append(["th", " TH", " DH"])
phonetics.append(["sh", " SH"])
phonetics.append(["ee", " IY1"])
phonetics.append(["ai", " EY1"])
phonetics.appen... | {
"content_hash": "c4eb1d668231f32bd78fb3c6a82d3642",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 102,
"avg_line_length": 35.96,
"alnum_prop": 0.5525583982202447,
"repo_name": "jordanrinke/proop",
"id": "18683cfc0854cd8787a68266ff616e02f70e39ef",
"size": "3596",
"bin... |
"""An integration test for datastore_write_it_pipeline
This test creates entities and writes them to Cloud Datastore. Subsequently,
these entities are read from Cloud Datastore, compared to the expected value
for the entity, and deleted.
There is no output; instead, we use `assert_that` transform to verify the
result... | {
"content_hash": "b44e0d22ce33dd73b9a05a77e76f1120",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 80,
"avg_line_length": 29.095238095238095,
"alnum_prop": 0.7266775777414075,
"repo_name": "iemejia/incubator-beam",
"id": "7b3c01b2b72c25a786ec7e5ad81df10b0f44ee70",
"size"... |
import json
import logging
import socket
from django.utils.translation import ugettext as _
from sqoop import client, conf
from desktop.lib.django_util import JsonResponse
from desktop.lib.exceptions import StructuredException
from desktop.lib.rest.http_client import RestException
from exception import handle_rest_ex... | {
"content_hash": "7142561966a2579aa19f3d8e76f9755d",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 148,
"avg_line_length": 30.647058823529413,
"alnum_prop": 0.7264875239923224,
"repo_name": "mapr/hue",
"id": "102f94e3713cb7f4d54a92cb7577fb87cf2d6886",
"size": "1834",
"... |
print("Hello World")
print("Second Line")
| {
"content_hash": "3a7735d526d34becc71ce8c41ff79806",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 20,
"avg_line_length": 14.333333333333334,
"alnum_prop": 0.6976744186046512,
"repo_name": "fsoustra/myPiLapse",
"id": "26847cb0d9f2837b24ec8221882b968b6891e052",
"size": "62... |
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import pkgutil
from pex.pex import PEX
from pants.backend.python.python_chroot import PythonChroot
from pants.backend.python.targets.python_binary import P... | {
"content_hash": "03c7df97eb73beaf7edbec45ed9cd14f",
"timestamp": "",
"source": "github",
"line_count": 163,
"max_line_length": 100,
"avg_line_length": 40.969325153374236,
"alnum_prop": 0.6227912548667266,
"repo_name": "tejal29/pants",
"id": "602376f746c1bace0e1bcff1e037f8fbbf2fb01c",
"size": "6825... |
import uuid
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.db import migrations, models, transaction
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.utils import translation
from django.utils.encoding import force_... | {
"content_hash": "a3d2db43355aaa32497fe5895c94617b",
"timestamp": "",
"source": "github",
"line_count": 331,
"max_line_length": 111,
"avg_line_length": 34.6797583081571,
"alnum_prop": 0.650317971948776,
"repo_name": "jnns/wagtail",
"id": "2c289264df996a238bbc92e0aa99a0d854b72890",
"size": "11479",
... |
from ..cw_model import CWModel
class SurveyQuestion(CWModel):
def __init__(self, json_dict=None):
self.id = None # (Integer)
self.sequenceNumber = None # (Integer)
self.type = None # *(Enum)
self.question = None # *(String(1000))
self.options = None # (Surve... | {
"content_hash": "5e67e0b82e9aded206fe4d0a6cd46890",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 55,
"avg_line_length": 34.1578947368421,
"alnum_prop": 0.5639445300462249,
"repo_name": "joshuamsmith/ConnectPyse",
"id": "749f99d3d9b255c4ee3518914e546f802bfc7490",
"size"... |
import random
from tests.ggrc import TestCase
from freezegun import freeze_time
from datetime import date, datetime
import os
from ggrc import db
from ggrc_workflows.models import Workflow, Cycle, TaskGroup
from ggrc_workflows import start_recurring_cycles
from ggrc_workflows.services.workflow_cycle_calculator import ... | {
"content_hash": "640141615bfb5f96dc259bf360ef648a",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 126,
"avg_line_length": 35.87614678899082,
"alnum_prop": 0.5723692622426799,
"repo_name": "hasanalom/ggrc-core",
"id": "d90213f7656d450604fa057cb1612234f677fd23",
"size": ... |
from uuid import uuid4
from cassandra.cqlengine import ValidationError
from cassandra.cqlengine.models import Model
from cassandra.cqlengine.management import sync_table, drop_table
from cassandra.cqlengine import columns
from tests.integration.cqlengine import is_prepend_reversed
from tests.integration.cqlengine.base... | {
"content_hash": "ab072c7029702078cdd7f7ff94fa9aef",
"timestamp": "",
"source": "github",
"line_count": 218,
"max_line_length": 96,
"avg_line_length": 42.96788990825688,
"alnum_prop": 0.6340343760008541,
"repo_name": "mike-tr-adamson/python-driver",
"id": "a3b80f15f54b8318a4b6748b7eb39b8a41634dcd",
... |
'''
Created on Sep 30, 2014
@author: Valentina
'''
import sys
import processvideo as pv
import cv2
import matplotlib.pyplot as plt
import numpy as np
import util
def track(video, cursorimg):
pos = video.tracktemplate(cursorimg, debug=True)
return pos
def write(pos, cursorpostxt="cursorpos.txt"):
print "W... | {
"content_hash": "e48258761b77058eeebb7dee205f80e7",
"timestamp": "",
"source": "github",
"line_count": 66,
"max_line_length": 64,
"avg_line_length": 26,
"alnum_prop": 0.6095571095571095,
"repo_name": "adobe-research/video-lecture-summaries",
"id": "fcb24121956f7e82c8047e73d7f75866e9449894",
"size"... |
import word
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def read(fname):
with open(fname) as fp:
content = fp.read()
return content
setup(
name='wordgrapher',
version=word.__version__,
description='Word Graph utility built with NLTK and... | {
"content_hash": "c363a851219beb047cc187c6dc8b750a",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 69,
"avg_line_length": 27.151515151515152,
"alnum_prop": 0.6417410714285714,
"repo_name": "tistaharahap/WordGraph",
"id": "6445493cebe6a544910bc11cbd98a796d87d5e8f",
"size"... |
import re
import time
import requests
from typing import Union, List
from ..exceptions import APIError, RaceCardError, InvalidResponse
from ..utils import check_status_code
from .baseendpoint import BaseEndpoint
from .. import resources
from ..compat import json
class RaceCard(BaseEndpoint):
"""
RaceCard ope... | {
"content_hash": "40caf56db644cb9ab15b2e5014c5388d",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 87,
"avg_line_length": 33.782051282051285,
"alnum_prop": 0.5910815939278937,
"repo_name": "liampauling/betfairlightweight",
"id": "a2f1a96ffeaff4aa96f86d3415a929e378c94ea0",... |
from collections.abc import Mapping
from flask import g
from marshmallow import EXCLUDE, Schema
from webargs.flaskparser import FlaskParser
from webargs.multidictproxy import MultiDictProxy
from werkzeug.datastructures import MultiDict
def _strip_whitespace(value):
if isinstance(value, str):
value = valu... | {
"content_hash": "667c50e17b788a78c48c3e64454ef644",
"timestamp": "",
"source": "github",
"line_count": 136,
"max_line_length": 111,
"avg_line_length": 40.56617647058823,
"alnum_prop": 0.6920427768714881,
"repo_name": "ThiefMaster/indico",
"id": "a52d56b07d7dbd81719688bf7a617866172d83de",
"size": "... |
import time
from apns import APNs
import simplejson as json
class FeedbackProxy(object):
def __init__(self, use_sandbox, cert_file, key_file):
self.use_sandbox = use_sandbox
self.cert_file = cert_file
self.key_file = key_file
self._apns = APNs(
use_sandbox=self.use_sa... | {
"content_hash": "51713d8feea5c4896ca686d29a20cb46",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 61,
"avg_line_length": 24.444444444444443,
"alnum_prop": 0.5787878787878787,
"repo_name": "voyagegroup/apns-proxy-server",
"id": "a4772ff1cf113a740973f2eec75a6ef0c3b28dfd",
... |
import unittest
from pivotal import Pivotal, BASE_URL, PROTO_SWITCH
class PivotalTest(unittest.TestCase):
def test_protocol_switch(self):
self.assertEqual(PROTO_SWITCH[True], 'https://')
self.assertEqual(PROTO_SWITCH[False], 'http://')
def _test_url_strings(self, use_https):
pv = Pi... | {
"content_hash": "483076f6bfc6adf447ed2686131ef161",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 82,
"avg_line_length": 33.24242424242424,
"alnum_prop": 0.6226071103008204,
"repo_name": "robhudson/pivotal-py",
"id": "76f3b39a97433c40e66209544c1d247ccfc42a12",
"size": "... |
import distutils.version as dist_version
import os
from oslo.config import cfg
from manila.db import migration
from manila.db.sqlalchemy.session import get_engine
from manila import exception
from manila.openstack.common import log as logging
import migrate
from migrate.versioning import util as migrate_util
impor... | {
"content_hash": "79de715b5cad8f69f9fc4c3238d8be51",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 77,
"avg_line_length": 31.166666666666668,
"alnum_prop": 0.67316766278704,
"repo_name": "aostapenko/manila",
"id": "a0fa5aaddc4576d890457a57a47ede0088a59a1f",
"size": "395... |
import jwt
import structlog
from datetime import datetime, timedelta
from sqlalchemy.orm import exc
from opentaxii.auth import OpenTAXIIAuthAPI
from opentaxii.entities import Account as AccountEntity
from opentaxii.sqldb_helper import SQLAlchemyDB
from .models import Base, Account
__all__ = ['SQLDatabaseAPI']
lo... | {
"content_hash": "ce33d033920ca8ae04be3e0fa831b8fa",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 106,
"avg_line_length": 34.08527131782946,
"alnum_prop": 0.625653854901069,
"repo_name": "Intelworks/OpenTAXII",
"id": "95598def8757695fe13c51cad4074b5d27b8a3eb",
"size": ... |
import urllib
from lxml import etree
from tempest.common.rest_client import RestClientXML
from tempest import config
from tempest.services.compute.xml.common import xml_to_json
CONF = config.CONF
class TenantUsagesClientXML(RestClientXML):
def __init__(self, auth_provider):
super(TenantUsagesClientXML... | {
"content_hash": "ccbed8e16b7cf1062eb5be8ad90136fc",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 66,
"avg_line_length": 30.07894736842105,
"alnum_prop": 0.6500437445319335,
"repo_name": "ntymtsiv/tempest",
"id": "93eeb00492501e701be5ff7121aa82ff35b5ab69",
"size": "1774... |
import inspect
import uuid
from sys import version_info
if version_info[0] < 3:
str_buffer_types = [str]
else:
str_buffer_types = [bytes]
def add_tuples(a, b):
return list(map(sum, list(zip(a, b))))
def throw(x):
raise x
def random_name_suffix():
return format(uuid.uuid4().hex)
def get_padd... | {
"content_hash": "0a22feb8932429f42137c58e0067159b",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 113,
"avg_line_length": 22.82051282051282,
"alnum_prop": 0.648314606741573,
"repo_name": "bdr00/typedef",
"id": "a0194ba57bef830923b54c7540ecb1cacf951572",
"size": "890",
... |
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_resource
from nssrc.com.citrix.netscaler.nitro.resource.base.base_resource import base_response
from nssrc.com.citrix.netscaler.nitro.service.options import options
from nssrc.com.citrix.netscaler.nitro.exception.nitro_exception import nitro_... | {
"content_hash": "167d58f0a460bcffa08dbe8d57400ccf",
"timestamp": "",
"source": "github",
"line_count": 339,
"max_line_length": 430,
"avg_line_length": 41.05604719764012,
"alnum_prop": 0.7424198879149303,
"repo_name": "atopuzov/nitro-python",
"id": "dc193a0116f8ff7acf99470ebf092878fb8a31c7",
"size"... |
import fnmatch
import os
from flask import Flask, redirect, request, send_from_directory
from flask_compress import Compress
from loguru import logger
from flexget.webserver import register_app, register_home
logger = logger.bind(name='webui')
manager = None
debug = False
app_base = None
ui_base = os.path.dirname(... | {
"content_hash": "e9ca5f57117ba1035814a9eeb36fe4f5",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 110,
"avg_line_length": 29.526315789473685,
"alnum_prop": 0.6213903743315508,
"repo_name": "malkavi/Flexget",
"id": "77d7225cfaa6e4cbc464bf0a8dc232842c1fcbf5",
"size": "280... |
""" Merges 3 CSV files into 1.
The two first columns identify the records.
First file: numerators
Columns: product, template, nc, na
Second file: denominators
Columns: product, template, denominator
Third file: strengths
Columns: product, template, strength
**Example of ... | {
"content_hash": "d6809eec7e14b972e579e9f7c5fac4a0",
"timestamp": "",
"source": "github",
"line_count": 171,
"max_line_length": 121,
"avg_line_length": 29.795321637426902,
"alnum_prop": 0.5960745829244357,
"repo_name": "hypermindr/barbante",
"id": "32a7f98b3bc381d7d3df94dedf3a1769d5e904ed",
"size":... |
"""
views.py
URL route handlers
Note that any handler params must match the URL route params.
For example the *say_hello* handler, handling the URL route '/hello/<username>',
must be passed *username* as the argument.
"""
from csv import DictReader
import logging
from datetime import datetime
from google.appengi... | {
"content_hash": "a7c1333486514d4969ee0a1069477ef5",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 91,
"avg_line_length": 35.76981132075472,
"alnum_prop": 0.6653655448887014,
"repo_name": "dcifuen/cloudbday",
"id": "75e7e092cb23114da22e85642ba326719d6eb1ca",
"size": "95... |
import os
import unittest
import sys
import time
try:
from tests_pydevd_python import debugger_unittest
except:
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
from tests_pydevd_python import debugger_unittest
from _pydevd_frame_eval.pydevd_frame_eval_main import frame_eval_func
IS_FRAME_EVAL_AV... | {
"content_hash": "db1859da97c86e320b248aedb3a26676",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 115,
"avg_line_length": 39.763636363636365,
"alnum_prop": 0.6649519890260631,
"repo_name": "vvv1559/intellij-community",
"id": "535cd8006d8a5b4f36a4e41e0fd45f6e66f5691e",
... |
import json
import os
from . import ExtensionModule
from .. import dependencies
from .. import mlog
from ..mesonlib import Popen_safe, MesonException
from ..programs import ExternalProgram
class DlangModule(ExtensionModule):
class_dubbin = None
init_dub = False
def __init__(self, interpreter):
su... | {
"content_hash": "a18ed27d9bca49a4b01ce68bfcd80c51",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 94,
"avg_line_length": 36.898305084745765,
"alnum_prop": 0.4988516306844281,
"repo_name": "jpakkane/meson",
"id": "60d28854ec956e684daf7e46f68707b80c1aac7e",
"size": "5033... |
"""Integrates dogpile.cache for Pyramid
"""
from setuptools import setup, find_packages
import os.path
def project_path(*names):
return os.path.join(os.path.dirname(__file__), *names)
setup(
name='pyramid_dogpile_cache2',
version='1.2.0.dev0',
install_requires=[
'Beaker', # For parsing pyl... | {
"content_hash": "03692ed23565bd560bcd9655d158a041",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 78,
"avg_line_length": 26.74,
"alnum_prop": 0.6230366492146597,
"repo_name": "ZeitOnline/pyramid_dogpile_cache2",
"id": "82d11981d4a7576b504125f15f5064b48de4da6f",
"size": ... |
"""
file: document.py
Description: defines the "all purpose" document object. A document is a
holder that will contain various informations, such as a content, a set
of segmentations or annotations.
author: Yoann Dupont
MIT License
Copyright (c) 2018 Yoann Dupont
Permission is hereby granted, free of charge, to an... | {
"content_hash": "3d3c5a5d79b47d4c4963e94e0646106e",
"timestamp": "",
"source": "github",
"line_count": 514,
"max_line_length": 210,
"avg_line_length": 43.06225680933852,
"alnum_prop": 0.5607662419806633,
"repo_name": "YoannDupont/SEM",
"id": "93ba6cd43f7f628b1555c6ab6fda3203b1f27b18",
"size": "221... |
from __future__ import print_function
from __future__ import absolute_import
import os
import tct
import sys
params = tct.readjson(sys.argv[1])
binabspath = sys.argv[2]
facts = tct.readjson(params['factsfile'])
milestones = tct.readjson(params['milestonesfile'])
reason = ''
resultfile = params['resultfile']
result = t... | {
"content_hash": "2b48608bf00c2a86c830324a1085f8ea",
"timestamp": "",
"source": "github",
"line_count": 112,
"max_line_length": 94,
"avg_line_length": 27.428571428571427,
"alnum_prop": 0.4970703125,
"repo_name": "marble/Toolchain_RenderDocumentation",
"id": "af945457ff796ad053181fe10acac4d265ab72fe",... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("djangocms_page_meta", "0006_auto_20160423_1859"),
]
operations = [
migrations.AlterModelOptions(
name="genericmetaattribute",
options={
"verbose_name... | {
"content_hash": "240c00792114bbc337f3608761aca09a",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 110,
"avg_line_length": 35.02040816326531,
"alnum_prop": 0.5477855477855478,
"repo_name": "nephila/djangocms-page-meta",
"id": "69f55fce36fbd96e386e910fbbb2ae381716b9b9",
"... |
import wandb
from wandb import util
from wandb.plots.utils import (
test_missing,
test_types,
encode_labels,
deprecation_notice,
)
chart_limit = wandb.Table.MAX_ROWS
def heatmap(x_labels, y_labels, matrix_values, show_text=False):
"""
Generates a heatmap.
Arguments:
matrix_values (a... | {
"content_hash": "d934c4072ee98ec067a21a3539ae45cd",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 92,
"avg_line_length": 34.01234567901235,
"alnum_prop": 0.5255898366606171,
"repo_name": "wandb/client",
"id": "073735a4f344ca66e48a7bcd6699972461d2a39c",
"size": "2755",
... |
import os
import time
import math
import sys
import argparse
import logging
import subprocess
import MPIfR_LOFAR_LuMP
import MPIfR_LOFAR_LuMP_Recorder_Common
################################################################################
# GLOBALS
####################################################################... | {
"content_hash": "b83136a4f3b041488192c0c7fbe454f9",
"timestamp": "",
"source": "github",
"line_count": 258,
"max_line_length": 271,
"avg_line_length": 40.748062015503876,
"alnum_prop": 0.5747170170265385,
"repo_name": "AHorneffer/lump-lofar-und-mpifr-pulsare",
"id": "9318a19b0769e56b723f2af9444412cd... |
import unittest
import parlai.utils.testing as testing_utils
from parlai.core.agents import create_agent
@testing_utils.skipUnlessGPU
class TestDialogptModel(unittest.TestCase):
"""
Test of DialoGPT model.
"""
def _test_batchsize(self, batchsize, add_start_token):
utterances = [
'... | {
"content_hash": "eaf417976f8c7f224270f3c7dd32611d",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 98,
"avg_line_length": 34.262773722627735,
"alnum_prop": 0.5108649339582446,
"repo_name": "facebookresearch/ParlAI",
"id": "aa647d108548c413e5dd1e65b8f9d584a354b521",
"siz... |
import json
import pathlib
import yaml
class ConfigReader:
def __init__(self, path: pathlib.Path):
self.config_path = path
def import_config(self):
path = self.config_path
content = open(path).read()
if path.suffix in [".yaml", ".yml"]:
return yaml.load(content, L... | {
"content_hash": "2bb30f447d4ebe112a57db10423c624a",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 79,
"avg_line_length": 26.789473684210527,
"alnum_prop": 0.5992141453831041,
"repo_name": "cihai/cihai",
"id": "28e2d515545c06f16678dc759fefb5aa85832cf2",
"size": "509",
... |
import re
import pytest
from waterbutler.providers.github.path import GitHubPath
class TestGitHubPath:
def test_id_accessors(self):
gh_path = GitHubPath('/foo', _ids=[('master', None), ('master', 'abcea54as123')])
assert gh_path.branch_ref == 'master'
assert gh_path.file_sha == 'abcea5... | {
"content_hash": "0efb34c24da66985ae1ae04b79b77794",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 92,
"avg_line_length": 32.357142857142854,
"alnum_prop": 0.6225165562913907,
"repo_name": "Johnetordoff/waterbutler",
"id": "3904d4becee5bbff8e3aad7b0682cd2644a67620",
"siz... |
import windmill
import exceptions
import os, sys, shutil, time, signal
import killableprocess
import logging
if sys.platform == "win32":
import _winreg as wreg
if sys.platform == "cygwin":
import cygwinreg as wreg
logger = logging.getLogger(__name__)
class InternetExplorer(object):
registry_mod... | {
"content_hash": "9ade0e8fbc195207cc4433722b9cdaea",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 122,
"avg_line_length": 39.22727272727273,
"alnum_prop": 0.5538818076477404,
"repo_name": "ept/windmill",
"id": "344adf1c3ba9fabae0ac216b2a77882a81dace10",
"size": "4085",
... |
"""File IO methods that wrap the C++ FileSystem API."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import binascii
import os
import uuid
import six
from tensorflow.python.framework import errors
from tensorflow.python.lib.io import _pywrap_file_io
fro... | {
"content_hash": "658ddad526856ae3efe1d0e827aba0a8",
"timestamp": "",
"source": "github",
"line_count": 926,
"max_line_length": 89,
"avg_line_length": 28.370410367170628,
"alnum_prop": 0.6614517909481938,
"repo_name": "frreiss/tensorflow-fred",
"id": "faf39d03d8e35275174825bf800f8cf362456c4a",
"siz... |
"""
STA 9792 Assignment 2 compute unsmooth ngram
Created on Tue Sep 6 19:28:42 2017
@author: Qijun (Vince) Chen
"""
import re
import pandas as pd
#import matplotlib.pyplot as plt
def unsmooth_ngram(inputFile, n=1, freq=1): # n=1: unigram, n=2: bigram, etc. # the count paramter define the desired minimum expression ... | {
"content_hash": "3d257a9158a1bf108660463740ba7120",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 154,
"avg_line_length": 44.03448275862069,
"alnum_prop": 0.6209866875489428,
"repo_name": "vc0150/Natrual-Language-Processing",
"id": "8d1ffa851b7346164da04097ebb7d4689fd13d8... |
import math
import copy
from matplotlib import lines as mlines, axis as maxis, \
patches as mpatches
import art3d
import proj3d
import numpy as np
def get_flip_min_max(coord, index, mins, maxs):
if coord[index] == mins[index]:
return maxs[index]
else:
return mins[index]
def move_from... | {
"content_hash": "cf224dcc38f13304a11a4ff181b59b92",
"timestamp": "",
"source": "github",
"line_count": 436,
"max_line_length": 87,
"avg_line_length": 38.55275229357798,
"alnum_prop": 0.533999643048367,
"repo_name": "lthurlow/Network-Grapher",
"id": "20034a9e17f236a7aeb95b5d66e8994aa47dbb75",
"size... |
"""3D backpropagation algorithm with a tilted axis of rotation"""
import multiprocessing as mp
import warnings
import numexpr as ne
import numpy as np
import pyfftw
import scipy.ndimage
from . import util
_ncores = mp.cpu_count()
def estimate_major_rotation_axis(loc):
"""
For a list of points on the unit ... | {
"content_hash": "06fc30bd1d5f638c2119b53d32f43c0b",
"timestamp": "",
"source": "github",
"line_count": 949,
"max_line_length": 79,
"avg_line_length": 37.270811380400424,
"alnum_prop": 0.5879841673734804,
"repo_name": "RI-imaging/ODTbrain",
"id": "7b68468423e87bff8f65d634e82a97924bc3e323",
"size": ... |
from temboo.core.choreography import Choreography
from temboo.core.choreography import InputSet
from temboo.core.choreography import ResultSet
from temboo.core.choreography import ChoreographyExecution
import json
class CommitteeContributions(Choreography):
def __init__(self, temboo_session):
"""
... | {
"content_hash": "8ab25fe379a1d29c25fe4ae46c7ada1d",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 230,
"avg_line_length": 48.71604938271605,
"alnum_prop": 0.7108464267612773,
"repo_name": "jordanemedlock/psychtruths",
"id": "64a152a57fb18581bdb7eb533d5c4ea8c707b695",
"s... |
from perception.shared.variables import db_config
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL
from sqlalchemy.orm import sessionmaker
class Sql(object):
def __init__(self):
self.create_session()
@staticmethod
def create_session():
engine = create_engine(URL... | {
"content_hash": "78620604a3a1c4a3ce00e5685d5832db",
"timestamp": "",
"source": "github",
"line_count": 28,
"max_line_length": 67,
"avg_line_length": 27.821428571428573,
"alnum_prop": 0.6302952503209243,
"repo_name": "asrozar/perception",
"id": "6bccb373e1eb589088f0cb6e11b7ce9d369ee332",
"size": "7... |
import socket
import select
import os.path
import time
import atexit
from logging import debug, info, warn, error
from threading import Thread
from functools import partial
import RPIO
import RPIO._GPIO as _GPIO
# Internals
_SYS_GPIO_ROOT = '/sys/class/gpio/'
_TCP_SOCKET_HOST = "0.0.0.0"
GPIO_FUNCTIONS = {0: "OUTPUT... | {
"content_hash": "b0ce2326542865b1dbe7d09a3c7c834d",
"timestamp": "",
"source": "github",
"line_count": 342,
"max_line_length": 79,
"avg_line_length": 40.30701754385965,
"alnum_prop": 0.5745375408052231,
"repo_name": "TechV/DroneOS",
"id": "cef492da811f16531ffea18d5de02e631896abf3",
"size": "14586"... |
"""Regresssion tests for urllib"""
import urllib.parse
import urllib.request
import urllib.error
import http.client
import email.message
import io
import unittest
from unittest.mock import patch
from test import support
import os
try:
import ssl
except ImportError:
ssl = None
import sys
import tempfile
from nt... | {
"content_hash": "9c7afc9100b3019b19ce64c5c4022c1c",
"timestamp": "",
"source": "github",
"line_count": 1483,
"max_line_length": 108,
"avg_line_length": 40.476736345246124,
"alnum_prop": 0.570176753794126,
"repo_name": "juanyaw/python",
"id": "58ca2a5cd84f1b236922fbd9a78852e6206e2436",
"size": "600... |
from setuptools import setup
# Remove build status and move Gitter link under title for PyPi
README = open('README.rst').read() \
.replace('|Build Status|', '', 1) \
.replace('|Gitter|', '', 1) \
.replace('===\n', '===\n\n|Gitter|\n')
setup(
name='django-cacheops',
version='2.4.2',
... | {
"content_hash": "a110297ce553ee09900685bb89f4bc14",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 98,
"avg_line_length": 29.983050847457626,
"alnum_prop": 0.5692481628038439,
"repo_name": "bourivouh/django-cacheops",
"id": "15c4c82581bfee4c606f2aa74b92b64b14fdf918",
"si... |
try:
import uio
import micropython
micropython.mem_total
except (ImportError, AttributeError):
print("SKIP")
raise SystemExit
data = b"1234" * 256
before = micropython.mem_total()
buf = uio.BytesIO(data)
after = micropython.mem_total()
print(after - before < len(data))
| {
"content_hash": "5297373ea452ae000d02781380bdfca6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 37,
"avg_line_length": 15.631578947368421,
"alnum_prop": 0.6868686868686869,
"repo_name": "bvernoux/micropython",
"id": "3b9f141270d5aa3219bb78f1f909068ea2fe4ba4",
"size": ... |
import json
import uuid
from openstackclient.tests.functional import base
class NetworkTests(base.TestCase):
"""Functional tests for Network commands"""
@classmethod
def setUpClass(cls):
super(NetworkTests, cls).setUpClass()
cls.haz_network = cls.is_service_enabled('network')
class Net... | {
"content_hash": "b81a0d68286d4da1719ee23f51a03c00",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 79,
"avg_line_length": 40.36144578313253,
"alnum_prop": 0.5453731343283582,
"repo_name": "openstack/python-openstackclient",
"id": "2287f329309888fe6f6bd691e5b5b6ecd5264192",... |
from PyCat import pycat
class TestBoundaryValue:
def test_WeakNormal(self):
assert pycat.portCheck(0)
assert pycat.portCheck("0")
assert pycat.portCheck(65535)
assert pycat.portCheck("65535")
def test_WeakRobust(self):
assert not pycat.portCheck(-1)
assert not... | {
"content_hash": "d95720353d51ca7c9c4e36d41c45e399",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 44,
"avg_line_length": 23.933333333333334,
"alnum_prop": 0.6206128133704736,
"repo_name": "aweimeow/PyCat",
"id": "ba4832abdf810d35eb1bbb438dcf6be2da8e97a1",
"size": "1795"... |
from typing import Any, cast, Dict, Optional
from pyre_extensions import none_throws
from backend.common.consts.notification_type import NotificationType
from backend.common.models.district import District
from backend.common.models.notifications.notification import Notification
class DistrictPointsNotification(Not... | {
"content_hash": "33bb626767d685f6c17adf904c046435",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 76,
"avg_line_length": 33.53846153846154,
"alnum_prop": 0.6735474006116208,
"repo_name": "the-blue-alliance/the-blue-alliance",
"id": "59a6b12cf6eb747a3ec28e9f02d1fecaa43a894... |
from __future__ import unicode_literals, division, absolute_import
import datetime
from flexget.plugins.api_snep import SnepChartsConnector
from flexget.plugins.filter.charts import ChartsConnector, ChartsRelease, ChartsEntry
from tests import use_vcr
class SnepMockConnector(ChartsConnector):
@property
def o... | {
"content_hash": "4cf12b7bf03ab40cf829b5c8a715bf5f",
"timestamp": "",
"source": "github",
"line_count": 95,
"max_line_length": 174,
"avg_line_length": 39.85263157894737,
"alnum_prop": 0.620972002113048,
"repo_name": "lildadou/Flexget",
"id": "f7e8959814dcd3e9e5189654d0ba44a6c49bc757",
"size": "3810... |
from __future__ import unicode_literals
from setuptools import setup
import sys
install_requires = [
'pycrypto',
'pyyaml',
]
extras_require = {
'test': ['coverage', 'mock', 'nose'],
}
if sys.version_info < (2, 7, 0):
install_requires.append('argparse')
extras_require['test'].append('unittest2')... | {
"content_hash": "050e239489d5f5b9a4a1b4c5ecacf8e2",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 78,
"avg_line_length": 30.770491803278688,
"alnum_prop": 0.5897709110282365,
"repo_name": "thusoy/public-pillar",
"id": "fd89ef5a948df955af0dcf2cfb395d5aa24007f7",
"size": ... |
import json
import os
import re
import subprocess
import time
from collections import defaultdict
from typing import Any, DefaultDict, Dict, List
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
normal_queues = [
"deferred_work",
"digest_emails",
"email_mirror",
... | {
"content_hash": "5e9f1e4172828bc06b8bc623f3d31ccf",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 120,
"avg_line_length": 34.48947368421052,
"alnum_prop": 0.6262780405920952,
"repo_name": "eeshangarg/zulip",
"id": "cae5b05f11a4985035af1fe98447f9c98189ea1a",
"size": "65... |
from twython import Twython
import json
from response_filter import ResponseFilter
twitter = Twython(APP_KEY, APP_SECRET, oauth_version=2)
ACCESS_TOKEN = twitter.obtain_access_token()
twitter = Twython(APP_KEY, access_token=ACCESS_TOKEN)
languages = ['en', 'ru', 'de']
search_params = {'en': ['#SyrianRefugees', 'b... | {
"content_hash": "a43cfaec775b3995369b1214de496783",
"timestamp": "",
"source": "github",
"line_count": 24,
"max_line_length": 272,
"avg_line_length": 46.583333333333336,
"alnum_prop": 0.6717352415026834,
"repo_name": "mostly-cookies/InfoRetrieval01",
"id": "60d100353a25f6b1ffb59093298b4bce482bd81f",... |
ANSIBLE_METADATA = {'status': ['stableinterface'],
'supported_by': 'community',
'version': '1.0'}
DOCUMENTATION = '''
---
module: cs_facts
short_description: Gather facts on instances of Apache CloudStack based clouds.
description:
- This module fetches data from the metada... | {
"content_hash": "4ed64e67238d3a530e586620bbbfa6f7",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 127,
"avg_line_length": 31.54854368932039,
"alnum_prop": 0.6117864286813356,
"repo_name": "nwiizo/workspace_2017",
"id": "6f51127df65ba04c6b23a25ad986f1f032d88161",
"size"... |
"""
Space-Time animation for one dimensional cellular automata.
"""
##########################################################################
## Imports
##########################################################################
import numpy as np
#####################################################################... | {
"content_hash": "6353f47352c656e767261162a8466713",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 77,
"avg_line_length": 27.697674418604652,
"alnum_prop": 0.4966414777497901,
"repo_name": "bbengfort/cellular-automata",
"id": "9b41166fe5b7688855f2a2ca1646e6aced798937",
"... |
"""
heroku.helpers
~~~~~~~~~~~~~~
This module contians the helpers.
"""
from datetime import datetime
from dateutil.parser import parse as parse_datetime
import sys
if sys.version_info > (3, 0):
basestring = (str, bytes)
def is_collection(obj):
"""Tests if an object is a collection."""
col = getattr(... | {
"content_hash": "9697d7257509772b708a618c8b9f0d3d",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 79,
"avg_line_length": 25.713178294573645,
"alnum_prop": 0.5562255049743744,
"repo_name": "musclegenes/heroku.py-3.4",
"id": "26f45a6c2ded541ad5b30b48a03ed6d857ee5ffe",
"s... |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2014 Roland Bettinelli
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | {
"content_hash": "6974acea8ba8c154cddd094c5abd7a43",
"timestamp": "",
"source": "github",
"line_count": 718,
"max_line_length": 203,
"avg_line_length": 45.34818941504178,
"alnum_prop": 0.633507371007371,
"repo_name": "Glorfindelrb/pyBPMN20engine",
"id": "3f29f4de2ab71a38c489e656b6bd7dfe704f1645",
"... |
"""
Sample code usage of the pyTournamentTracker
"""
from tournament import *
def initial_setup():
"""
Deletes the players and matches for a clean start
"""
delete_matches()
delete_players()
def basic_usage():
"""
Basic usage of the pyTournamentTracker library
"""
print... | {
"content_hash": "37cee5fb076fff0c5eb984dfc9a06e6c",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 104,
"avg_line_length": 34.63013698630137,
"alnum_prop": 0.5292721518987342,
"repo_name": "MFry/pyTournamentTracker",
"id": "06370ab6fb8c9e7400bd64b33c7efeaaaccff08e",
"siz... |
import os.path
from os.path import dirname
from datetime import datetime, timedelta, tzinfo
from time import time, gmtime, strftime
import hashlib
import logging
import requests
import urllib
import json
from urlparse import urljoin
from constance import config as c_config
import bleach
try:
from commons.urlr... | {
"content_hash": "e3cc64454c46a89b588ae0855618254a",
"timestamp": "",
"source": "github",
"line_count": 251,
"max_line_length": 82,
"avg_line_length": 32.49800796812749,
"alnum_prop": 0.637244084835111,
"repo_name": "deepankverma/badges.mozilla.org",
"id": "29c539bcbb56d0cef687e663c29f9ac46bec7e49",
... |
import os
def main(j, args, params, tags, tasklet):
page = args.page
page.addCSS(cssContent='''
.bigpicture{
margin: 10px 0 15px 0;
}
.bigpicture-container{
text-align: center;
}
.subtitle{
margin-bottom: 10px;
display: block;
}
.subtitle-paragraph{
margin-bottom: 5px;
}
.bigpicture... | {
"content_hash": "69d1feda3560d731b67bb687be5407fc",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 94,
"avg_line_length": 30.988095238095237,
"alnum_prop": 0.6699961582789089,
"repo_name": "Jumpscale/jumpscale6_core",
"id": "c310251a2da4f52ebffef5671f6f35da7430e26d",
"si... |
""" TF 2.0 BlenderbotSmall model."""
import random
from typing import List, Optional, Tuple, Union
import numpy as np
import tensorflow as tf
from ...activations_tf import get_tf_activation
from ...modeling_tf_outputs import (
TFBaseModelOutput,
TFBaseModelOutputWithPastAndCrossAttentions,
TFSeq2SeqLMOu... | {
"content_hash": "eb8204ff9bea19acda2a1474da8f80dd",
"timestamp": "",
"source": "github",
"line_count": 1452,
"max_line_length": 221,
"avg_line_length": 47.74724517906336,
"alnum_prop": 0.6311355998211426,
"repo_name": "huggingface/transformers",
"id": "e6c066af1295f7582e9279e98a263f8a9b701556",
"s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.