text stringlengths 4 1.02M | meta dict |
|---|---|
"""
This file is part of WSQL-SDK
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS F... | {
"content_hash": "8bdc0bd3252db65c4156390e35d67f9d",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 122,
"avg_line_length": 38.276595744680854,
"alnum_prop": 0.5797665369649806,
"repo_name": "WebSQL/sdk",
"id": "51683e55ff9cae84ddc8d4a50aecc00a8f5e5f80",
"size": "8995",
... |
"""Support for Open-Meteo weather."""
from __future__ import annotations
from open_meteo import Forecast as OpenMeteoForecast
from homeassistant.components.weather import Forecast, WeatherEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import TEMP_CELSIUS
from homeassistant.core i... | {
"content_hash": "cf4bf49d2702b7261982fdc7d823fea0",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 86,
"avg_line_length": 34.932203389830505,
"alnum_prop": 0.655992236778263,
"repo_name": "GenericStudent/home-assistant",
"id": "bb7170bb5da1c65562b43b87ff612fca630dd862",
... |
"""
Support to interact with a Music Player Daemon.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/media_player.mpd/
"""
import logging
import socket
import voluptuous as vol
from homeassistant.components.media_player import (
MEDIA_TYPE_MUSIC, SUP... | {
"content_hash": "ae42b6ded505ef61fd8aeb85d61eedfb",
"timestamp": "",
"source": "github",
"line_count": 235,
"max_line_length": 74,
"avg_line_length": 30.56595744680851,
"alnum_prop": 0.6164555199777252,
"repo_name": "hexxter/home-assistant",
"id": "56af3cd88f96f97789fee0319e5c86f9084baedf",
"size"... |
import numpy as np
import pandas as pd
def datetime64_to_microseconds(dt):
return dt.astype('uint64')
def travel_time(start_time, path, measurements_by_station, station_metadata, time_granularity=60*60):
"""Calculate the travel time along the given path at the given start time
Args:
path - list of station ... | {
"content_hash": "b83bccab199cf0a712872a2186b83ecf",
"timestamp": "",
"source": "github",
"line_count": 60,
"max_line_length": 120,
"avg_line_length": 41.71666666666667,
"alnum_prop": 0.6815821014782262,
"repo_name": "sryza/freewaydata",
"id": "6d007d5e98fc1ee0f9d55e7afd5acad534ad5144",
"size": "25... |
"""
fs.memoryfs
===========
A Filesystem that exists in memory only. Which makes them extremely fast, but non-permanent.
If you open a file from a `memoryfs` you will get back a StringIO object from the standard library.
"""
import datetime
import stat
from fs.path import iteratepath, pathsplit, normpath
from fs.b... | {
"content_hash": "800c680f049fdc291152996b40538588",
"timestamp": "",
"source": "github",
"line_count": 693,
"max_line_length": 155,
"avg_line_length": 33.331890331890335,
"alnum_prop": 0.5696350491363262,
"repo_name": "Konubinix/pyfilesystem",
"id": "5688c40cf2c859379f21233309a21a78969e6bed",
"siz... |
'''
@author: Frank
'''
import unittest
from virtualrouter import virtualrouter
from virtualrouter.plugins import dns
from zstacklib.utils import jsonobject
from zstacklib.utils import uuidhelper
from zstacklib.utils import http
import time
class Test(unittest.TestCase):
CALLBACK_URL = 'http://localhost:7272/test... | {
"content_hash": "a1f8950c7d0ba5625e783d2033b621e8",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 151,
"avg_line_length": 27.333333333333332,
"alnum_prop": 0.64198606271777,
"repo_name": "mingjian2049/zstack-utility",
"id": "ee875fe05107feb1675c2816f3b60630e81936d3",
"s... |
"""
This is part of shot detector.
Produced by w495 at 2017.05.04 04:18:27
"""
from __future__ import absolute_import, division, print_function
import logging
from shot_detector.handlers import BaseVideoHandler, BaseEventHandler
class BaseShotDetector(BaseVideoHandler, BaseEventHandler):
"""
..... | {
"content_hash": "7eff77fc7523a7739ac163e55bfad76d",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 69,
"avg_line_length": 30.342105263157894,
"alnum_prop": 0.6027753686036427,
"repo_name": "w495/python-video-shot-detector",
"id": "2f0e5e581f289a1ac9f92b0264fea7544cdfdc41",... |
from configs.module import Module
from irc.utils import formatcodes
def init():
m = Module('echo')
m.set_help('Echo text and provide various text functions.')
m.add_command_hook('echo',
{
'function': echo,
'help': 'Echo text.',
'noquote': True,
'args... | {
"content_hash": "590810a484cfec85ed39856e772baa1e",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 64,
"avg_line_length": 29.040650406504064,
"alnum_prop": 0.4333706606942889,
"repo_name": "shacknetisp/fourthevaz",
"id": "b2824531e68f905b27d9a8a2e3a050162d292d42",
"size... |
from github import Github
import requests
from bs4 import BeautifulSoup
from st2actions.runners.pythonrunner import Action
__all__ = [
'BaseGithubAction'
]
BASE_URL = 'https://github.com'
class BaseGithubAction(Action):
def __init__(self, config):
super(BaseGithubAction, self).__init__(config=confi... | {
"content_hash": "c5249a112986b71815c61c2ced4f6eab",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 81,
"avg_line_length": 31.630434782608695,
"alnum_prop": 0.5958762886597938,
"repo_name": "lmEshoo/st2contrib",
"id": "7f15b31fb9628b5ddae04bf8b34245495db006ff",
"size": "1... |
'''A module containing a class for storing Creature objects in a
SQLite database.'''
import csv
import sqlite3
__all__ = ['CreatureDB']
class CreatureDB(object):
'''Class for storing Creature objects in a SQLite database.'''
def __init__(self, name='creature.db', use_nominal_cr=False):
self.... | {
"content_hash": "3d2594d19714ffa4f3bcf715c9015310",
"timestamp": "",
"source": "github",
"line_count": 184,
"max_line_length": 70,
"avg_line_length": 34.79891304347826,
"alnum_prop": 0.5092925191316571,
"repo_name": "lot9s/pathfinder-rpg-utils",
"id": "66a8219a037a7e8683c03fc2bc823490a1f72d46",
"s... |
from .util import GeneralLicense
class License(GeneralLicense):
_labels = ['mit']
name = 'MIT'
description = '''
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 r... | {
"content_hash": "5910ef2ca91ce5c830a33759a1493d61",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 78,
"avg_line_length": 46.6530612244898,
"alnum_prop": 0.7729658792650919,
"repo_name": "nullhack/python-template",
"id": "c4a2e408d118331aeb78b89da554177ef5fa20cd",
"size"... |
"""
Bombolone
~~~~~~~~~~~~~~~~~~~~~
Bombolone is a tasty Content Management System for Python based on Flask,
MongoDB, AngularJS, Sass and Bootstrap. It's designed to be a simple,
flexible toolset for projects of any size.
:copyright: (c) 2014 by @zizzamia
:license: BSD (See LICENSE for details)
"""
__title__ = 'b... | {
"content_hash": "d1b8998811110b3ebead16a1bf64bf28",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 74,
"avg_line_length": 26.1875,
"alnum_prop": 0.6730310262529833,
"repo_name": "Opentaste/bombolone",
"id": "14479bc6a90f4c8a209c0df35254474a2d4ec1c2",
"size": "443",
"bi... |
from __future__ import absolute_import
from chaco.scales.api import *
| {
"content_hash": "45dbb437f725cb555581fc8000155c9c",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 38,
"avg_line_length": 35,
"alnum_prop": 0.7714285714285715,
"repo_name": "enthought/etsproxy",
"id": "5a3849c2f60e353c87b99e4b0954972f231da0a8",
"size": "85",
"binary": f... |
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography import x509 as c_x509
from cryptography.x509.oid import NameOID
import mock
impo... | {
"content_hash": "dc4e404df0622a58eff8ce5d8abb5c4d",
"timestamp": "",
"source": "github",
"line_count": 193,
"max_line_length": 79,
"avg_line_length": 39.66321243523316,
"alnum_prop": 0.6496407576747224,
"repo_name": "jay-lau/magnum",
"id": "459e23625781f5c7d1bafa58de772fa040aef1d5",
"size": "8259"... |
import boinc_path_config
from sched_messages import SchedMessages, CRITICAL
from subprocess import CalledProcessError, check_output as _check_output, STDOUT
from itertools import chain
import os, os.path as osp
from uuid import uuid4
from time import time
import argparse
import re
log = SchedMessages()
class CheckOu... | {
"content_hash": "0bcd4278687c7ea504a66425836a9284",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 102,
"avg_line_length": 35.825581395348834,
"alnum_prop": 0.6517364492048037,
"repo_name": "grctest/project-rain-site",
"id": "2c4cb9b463f34d1a55e09ca25011b46f4407c555",
"s... |
import _plotly_utils.basevalidators
class OutlinecolorValidator(_plotly_utils.basevalidators.ColorValidator):
def __init__(
self, plotly_name="outlinecolor", parent_name="densitymapbox.colorbar", **kwargs
):
super(OutlinecolorValidator, self).__init__(
plotly_name=plotly_name,
... | {
"content_hash": "5d6411c1a164d9b97f8e57097d2d4adc",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 88,
"avg_line_length": 34.23076923076923,
"alnum_prop": 0.6292134831460674,
"repo_name": "plotly/plotly.py",
"id": "adb140cd1d7fd4d713db03b127e8586cee4e42f0",
"size": "445"... |
"""
This module provides helper code to make type annotation within Airflow
codebase easier.
"""
try:
# Protocol and TypedDict are only added to typing module starting from
# python 3.8 we can safely remove this shim import after Airflow drops
# support for <3.8
from typing import ( # type: ignore # n... | {
"content_hash": "6e3050c5ba474762b0fdab170100b57e",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 95,
"avg_line_length": 33.875,
"alnum_prop": 0.7047970479704797,
"repo_name": "DinoCow/airflow",
"id": "6fd6d8c8252f2e26e2cab251b7e61144888f8c4d",
"size": "1330",
"binary... |
""" Defines the ImagePlot class.
"""
from __future__ import with_statement
# Standard library imports
from math import ceil, floor, pi
# Enthought library imports.
from traits.api import Bool, Either, Enum, Instance, \
List, Range, Trait, Tuple
from kiva.agg import GraphicsContextArr... | {
"content_hash": "8272de1c68ad6fc4b848ff4262ef8d72",
"timestamp": "",
"source": "github",
"line_count": 322,
"max_line_length": 85,
"avg_line_length": 41.30124223602485,
"alnum_prop": 0.5351530190239868,
"repo_name": "burnpanck/chaco",
"id": "d1df84072e6f2f8599160fa0d4acea4d2a0ff7f0",
"size": "1346... |
"""Process handling utilities."""
import os
import subprocess
import sys
import tempfile
import threading
import time
import urllib.request
try:
import psutil
except ImportError:
psutil = None
from clusterfuzz._internal.base import utils
from clusterfuzz._internal.metrics import logs
from clusterfuzz._internal.s... | {
"content_hash": "81e05438311f7b3c03d11d6e9d8be06f",
"timestamp": "",
"source": "github",
"line_count": 455,
"max_line_length": 95,
"avg_line_length": 29.58901098901099,
"alnum_prop": 0.6516378221793062,
"repo_name": "google/clusterfuzz",
"id": "ad68ee4345ee68b63eaa3497edd3caada24b1df0",
"size": "1... |
import simplejson
import json
import logging
import urllib2
from google.appengine.api import users
from google.appengine.api import urlfetch
from django.http import HttpResponse, JsonResponse
from django.shortcuts import render, redirect
from rest_framework import status
from rest_framework.decorators import api_vie... | {
"content_hash": "b48776ae66a28010a89090c383fa876d",
"timestamp": "",
"source": "github",
"line_count": 284,
"max_line_length": 120,
"avg_line_length": 45.13732394366197,
"alnum_prop": 0.5527732272408145,
"repo_name": "Sunnepah/iupds-appscale",
"id": "3a7f0af76b751a357fffe9c9bdbfd2902d92cca5",
"siz... |
import rospy
import time
import os
import math
from sensor_msgs.msg import Imu, NavSatFix
from barc.msg import ECU, Encoder, Z_KinBkMdl
from numpy import pi, cos, sin, eye, array, zeros, unwrap
from ekf import ekf
from system_models import f_KinBkMdl, h_KinBkMdl
from tf import transformations
from numpy import unwrap
... | {
"content_hash": "d10d1b2f8a4edffdd92b0c4a5ee2b20b",
"timestamp": "",
"source": "github",
"line_count": 267,
"max_line_length": 116,
"avg_line_length": 32.28838951310861,
"alnum_prop": 0.5777752000927967,
"repo_name": "BARCproject/barc",
"id": "0deaef1934e8056523acbaff88b81f24d1bd7999",
"size": "94... |
'''
将各个属性进行整理,然后得到特征矩阵:
得到的特征矩阵分为三类:
1.
'''
if __name__ == "__main__":
# 输入:
precontentfilename = "../all_asc_tweetsOutput/Preprocess/precontent"
sentimentfilename = "../all_asc_tweetsOutput/sentiment"
yearfilename = "../all_asc_tweetsOutput/year"
monthfilename = "../all_asc_tweetsOu... | {
"content_hash": "a8bb0a19826a83f3a44ac886bd8bd89c",
"timestamp": "",
"source": "github",
"line_count": 191,
"max_line_length": 119,
"avg_line_length": 48.68062827225131,
"alnum_prop": 0.5491503549150355,
"repo_name": "opinion-extraction-propagation/TASC-FeatureExtraction",
"id": "382d869e579b6babab9... |
from distutils.core import setup
import distutils.cmd
import sys, os, subprocess, traceback, re
def main():
rv_filename = 'RELEASE-VERSION'
try:
version = get_version()
version_file = open(rv_filename, 'w')
version_file.write(version)
version_file.close() # ensure sdist build p... | {
"content_hash": "0f8271db04c7c2ddf0223b44e3d7ef05",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 90,
"avg_line_length": 40.48809523809524,
"alnum_prop": 0.5777712437518377,
"repo_name": "neurord/pysb",
"id": "32d389d2c720fe07c5d3f674166446226eae5a9c",
"size": "3424",
... |
"""## Arithmetic Operators
TensorFlow provides several operations that you can use to add basic arithmetic
operators to your graph.
@@add
@@sub
@@mul
@@div
@@truediv
@@floordiv
@@mod
@@cross
## Basic Math Functions
TensorFlow provides several operations that you can use to add basic
mathematical functions to your g... | {
"content_hash": "15980d1c9a1df58d4c0a6b244e768590",
"timestamp": "",
"source": "github",
"line_count": 1718,
"max_line_length": 86,
"avg_line_length": 33.5430733410943,
"alnum_prop": 0.6589445919447481,
"repo_name": "ninotoshi/tensorflow",
"id": "9312a84f3eb463c065c198e0f9670b752f05830d",
"size": ... |
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "teach.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| {
"content_hash": "b0a2b11198cdfed46272c5f700ef5073",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 69,
"avg_line_length": 25.11111111111111,
"alnum_prop": 0.7079646017699115,
"repo_name": "selenamarie/teach-today",
"id": "6088206c52d4b0ebbe25766f19d9d4e458a2e297",
"size":... |
"""
Stakeholder engagement API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 1.0
Generated by: https://github.com/swagger-api/swagger-code... | {
"content_hash": "dcbe214dbfcb274615e2c63e6a1adf62",
"timestamp": "",
"source": "github",
"line_count": 40,
"max_line_length": 186,
"avg_line_length": 22.5,
"alnum_prop": 0.6988888888888889,
"repo_name": "iEngage/python-sdk",
"id": "eb9e3a140a6e504c8a621761eb4b852c6a9c1ebf",
"size": "917",
"binar... |
import pytest
from tc_common import BaseTest
class TestMySQLBackUp(BaseTest):
@pytest.mark.vcr
def test_mysql_backup_create_time(self):
policy = self.load_policy(
{
"name": "test_mysql_backup_create_time",
"resource": "tencentcloud.mysql-backup",
... | {
"content_hash": "c62d665d44d519dbeb5125438f6769bd",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 56,
"avg_line_length": 27.92,
"alnum_prop": 0.4040114613180516,
"repo_name": "thisisshi/cloud-custodian",
"id": "0768787cb8507863182f862ccb52b9c74dca6aca",
"size": "777",
... |
from __future__ import absolute_import
import os
import signal
import subprocess
import sys
from six import print_
from ccmlib import common, repository
from ccmlib.cluster import Cluster
from ccmlib.cluster_factory import ClusterFactory
from ccmlib.cmds.command import Cmd
from ccmlib.common import ArgumentError, ge... | {
"content_hash": "6557dc2341a82e85058521885a37bb53",
"timestamp": "",
"source": "github",
"line_count": 857,
"max_line_length": 321,
"avg_line_length": 47.38973162193699,
"alnum_prop": 0.6069977593381429,
"repo_name": "mike-tr-adamson/ccm",
"id": "a1478935d51639edb570d9d09c5e49522c283b72",
"size": ... |
from .AlternatingAttention import *
| {
"content_hash": "5977ebac2896e9074cd8bcbeb5bbb886",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 35,
"avg_line_length": 36,
"alnum_prop": 0.8333333333333334,
"repo_name": "nschuc/alternating-reader-tf",
"id": "7fe8d42b431ca1661b3072c51f30b8e9b6673332",
"size": "36",
"... |
import unittest
from google.appengine.api import memcache
from google.appengine.ext import db
from google.appengine.ext import testbed
from google.appengine.datastore import datastore_stub_util
import webapp2
import web
class TestHandlers(unittest.TestCase):
def setUp(self):
# First, create an instance of the... | {
"content_hash": "0789b0278eba006394615e01266a2330",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 92,
"avg_line_length": 33.64102564102564,
"alnum_prop": 0.7370426829268293,
"repo_name": "vishy16/test_repo",
"id": "315403c7fd3d8ac90095e9cd47164e3a0a5d494b",
"size": "131... |
"""Adds functionality for handling data problems.
A data problem is a database integrity problem which is not
visible by the DBMS because detecting it requires higher business
intelligence. Some data problems can be fixed automatically,
others need human interaction.
The application developer writes **data checkers*... | {
"content_hash": "d9d5f91c9f149629e8372682ef106a4f",
"timestamp": "",
"source": "github",
"line_count": 107,
"max_line_length": 78,
"avg_line_length": 34.44859813084112,
"alnum_prop": 0.6692892023874119,
"repo_name": "khchine5/lino",
"id": "dd8032a16330bb3425c86a9c47bbbb885d4b1bb2",
"size": "3785",... |
from django.apps import AppConfig
class Shanghai(object):
"""
A main class for a Shanghai application.
"""
name = 'shanghai'
verbose_name = 'Shanghai'
def __init__(self):
self._registry = dict()
def register(self, resource):
"""
Registers a resource in the applic... | {
"content_hash": "5f06c5ccf7e3888e90fb7e67b3e9ef6f",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 70,
"avg_line_length": 26,
"alnum_prop": 0.6070686070686071,
"repo_name": "bobisjan/django-shanghai",
"id": "3316fef62db1813f9383823f75cfb5e4cbec009c",
"size": "1924",
"b... |
from datetime import datetime, date, timedelta
from django.db import models
class Category(models.Model):
"""
A category grouping services
"""
name = models.CharField(max_length=100)
slug = models.SlugField()
description = models.CharField(max_length=255)
class Meta:
ordering = ('... | {
"content_hash": "9cc3a6b17bbc2bdee64154d54fce4d0c",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 78,
"avg_line_length": 27.7027027027027,
"alnum_prop": 0.5463414634146342,
"repo_name": "sijis/django-plank",
"id": "f5642c6117d1097edff5a3e614bb1b9c7aeb5614",
"size": "41... |
import argparse
import tempfile
from pathlib import Path
from typing import Union
from .fmi2slave import FMI2_MODEL_OPTIONS
from .builder import FmuBuilder
FilePath = Union[str, Path]
def create_csv_slave(csv_file: FilePath):
classname = csv_file.stem.capitalize()
filename = csv_file.name
return f"""
imp... | {
"content_hash": "d95884de2a2ce2f5680f0c0724dcfe82",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 115,
"avg_line_length": 34.734234234234236,
"alnum_prop": 0.550641940085592,
"repo_name": "joshua-cogliati-inl/raven",
"id": "c36c513b1fa48722059d29c190945bf213b9459b",
"s... |
from org.gluu.service.cdi.util import CdiUtil
from org.gluu.oxauth.security import Identity
from org.gluu.model.custom.script.type.auth import PersonAuthenticationType
from org.gluu.oxauth.service import AuthenticationService
from org.gluu.util import StringHelper
import java
class PersonAuthentication(PersonAuthenti... | {
"content_hash": "e14eae7c8488f97e4b1e0fe0152c85c0",
"timestamp": "",
"source": "github",
"line_count": 85,
"max_line_length": 114,
"avg_line_length": 36.67058823529412,
"alnum_prop": 0.6952197625922362,
"repo_name": "GluuFederation/oxAuth",
"id": "8ebfaa3c59ecda7fcf40a9f79d405183244edf40",
"size":... |
'''
Scroll View
===========
.. versionadded:: 1.0.4
The :class:`ScrollView` widget provides a scrollable/pannable viewport that is
clipped at the scrollview's bounding box.
Scrolling Behavior
------------------
ScrollView accepts only one child, and applies a viewport/window to it
according to the :data:`scroll_x`... | {
"content_hash": "11137988142a9100b55d195eddcd9bc3",
"timestamp": "",
"source": "github",
"line_count": 730,
"max_line_length": 80,
"avg_line_length": 35.586301369863016,
"alnum_prop": 0.5905766417738086,
"repo_name": "5y/kivy",
"id": "26974a30398caeaa8d07dad57567f9b17e183f4a",
"size": "25978",
"... |
import argparse
import logging
import math
import os
import sqlite3
from collections import defaultdict
from pathlib import Path
from struct import unpack
import cv2
import matplotlib.pyplot as pl
import numpy as np
import opensfm.actions.undistort as osfm_u
from matplotlib import cm
from mpl_toolkits.axes_grid1 impor... | {
"content_hash": "1d14af3b7a6aef0e9d0648db1376983c",
"timestamp": "",
"source": "github",
"line_count": 590,
"max_line_length": 87,
"avg_line_length": 35.271186440677965,
"alnum_prop": 0.5747717443536761,
"repo_name": "mapillary/OpenSfM",
"id": "9388883f4a8673404148c80f4a11a3a393f5056c",
"size": "2... |
from functools import lru_cache
def maxgain(n, weights, values, capacity):
@lru_cache(None)
def get_maxgain(ind, remaining_weight):
if ind == n or remaining_weight == 0:
return 0
if weights[ind] > remaining_weight:
return get_maxgain(ind+1, remaining_weight)
igno... | {
"content_hash": "818013564a736a525879dd5a6a8d943b",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 80,
"avg_line_length": 30.73076923076923,
"alnum_prop": 0.6157697121401752,
"repo_name": "sayak1711/coding_solutions",
"id": "ca5c54a879960d5b90f5ea4eb321ac4d21e12e34",
"si... |
"""
Msgpack serializer support for reading and writing pandas data structures
to disk
portions of msgpack_numpy package, by Lev Givon were incorporated
into this module (and tests_packers.py)
License
=======
Copyright (c) 2013, Lev Givon.
All rights reserved.
Redistribution and use in source and binary forms, with ... | {
"content_hash": "b686265a92817eef80381e24e1656eb0",
"timestamp": "",
"source": "github",
"line_count": 790,
"max_line_length": 79,
"avg_line_length": 34.821518987341776,
"alnum_prop": 0.5294267330691773,
"repo_name": "nmartensen/pandas",
"id": "a2fc4db23700c2405eae522eafa7ff44e2c2f651",
"size": "2... |
from os import listdir
from os.path import isfile, isdir, join, dirname
from re import sub
from urllib import urlopen
from subprocess import Popen, PIPE
from configparser import ConfigParser
import fcntl, socket, struct
def getHwAddr(ifname):
"""The pure python solution for this problem under Linux to get the MAC... | {
"content_hash": "860bcc8610f8470b676ac95d57bbdb9d",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 181,
"avg_line_length": 35.013513513513516,
"alnum_prop": 0.48552682362022387,
"repo_name": "stfc/MagDB",
"id": "581034365100d2df7c40cf8de31c1c37c279efb6",
"size": "5206",... |
import json
""" Input: the lyrics list, the tfidf scores list, a list of song and line indices
Output: List of tuples of words with highest tf-idf scores
Given a list of song-line tuple (song_index, line_index),
returns a list of a word-score tuple, with the word with highest score
at the head of the l... | {
"content_hash": "66f0771600593535c4fb3499c1bbd958",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 82,
"avg_line_length": 41.22222222222222,
"alnum_prop": 0.5831087151841868,
"repo_name": "warrencrowell/cs4300sp2016-TweetBeat",
"id": "2fd8a53da744b8e7b1dcf6c0f05ac9a1f5c7ad... |
"""
WSGI config for smarthumidor project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "smarthumidor.settings")
from dja... | {
"content_hash": "a0f5502af778cb4478f0a1d03bdc519b",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 28.5,
"alnum_prop": 0.7794486215538847,
"repo_name": "bkillenit/smarthumidor",
"id": "9bce7ce09b0c63bfaec1b661689590d6ddb57320",
"size": "399",
"bi... |
"""
$ ./example5_mpl.py [fits file]
This example program shows to capture button and keypress events
for your own use. After loading a FITS file use the following keys:
Press 'x' to turn on capture of events and bypass most normal keystroke
processing. Press it again to resume normal processing. An on-screen
mes... | {
"content_hash": "2ea6d118648ccb94a98671da0a2596ac",
"timestamp": "",
"source": "github",
"line_count": 160,
"max_line_length": 75,
"avg_line_length": 33.56875,
"alnum_prop": 0.6196239061627258,
"repo_name": "Rbeaty88/ginga",
"id": "1d061ec7356ec567b0f76dc963cf67d16ab448d8",
"size": "5695",
"bina... |
from socket import *
# Message to send
msg = '\r\nI love computer networks!'
endmsg = '\r\n.\r\n'
# Choose a mail server (e.g. Google mail server) and call it mailserver
mailserver = 'smtp.gmail.com'
# Create socket called clientSocket and establish a TCP connection with mailserver
clientSocket = socket(AF_INET, SOC... | {
"content_hash": "d8059444cc7c6b09dcdc77377f6ab153",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 82,
"avg_line_length": 29.319444444444443,
"alnum_prop": 0.7280909521553766,
"repo_name": "moranzcw/Computer-Networking-A-Top-Down-Approach-NOTES",
"id": "3b3ab3b56e02388becd... |
def tsplit(string, delimiters):
"""Behaves str.split but supports multiple delimiters."""
delimiters = tuple(delimiters)
stack = [string,]
for delimiter in delimiters:
for i, substring in enumerate(stack):
substack = substring.split(delimiter)
stack.pop(i)
... | {
"content_hash": "5861f0505946261f693c9c4e582e20fb",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 61,
"avg_line_length": 31.785714285714285,
"alnum_prop": 0.5910112359550562,
"repo_name": "ActiveState/code",
"id": "4a6560c2e50cc3382bf535bd14286d0948f1a572",
"size": "445... |
from django.utils.translation import ugettext as _
from dragoman_blog.model_bases import BaseEntry, BaseEntryTranslation
from cms.models.fields import PlaceholderField
class Entry(BaseEntry):
placeholder = PlaceholderField('dragoman_placeholder')
class Meta:
verbose_name = _('Entry')
verb... | {
"content_hash": "5744ac099f347c99f31be2edd0457ec2",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 69,
"avg_line_length": 31.923076923076923,
"alnum_prop": 0.7108433734939759,
"repo_name": "fivethreeo/cmsplugin-dragoman",
"id": "11eae2e9dc213d888fe5ac3a6b87fa529009ddc5",
... |
"""
requests_cache.core
~~~~~~~~~~~~~~~~~~~
Core functions for configuring cache and monkey patching ``requests``
"""
from contextlib import contextmanager
from datetime import datetime, timedelta
from alp.request import requests
from alp.request.requests import Session as OriginalSession
from alp.request... | {
"content_hash": "0f9b179600b90a9148d4b49f12693e8e",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 102,
"avg_line_length": 36.82673267326733,
"alnum_prop": 0.5765559887081597,
"repo_name": "bfontaine/alfred-pp",
"id": "e567b16b908d2157f9336c30a91a6a92343530dc",
"size": ... |
from __future__ import unicode_literals
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('status', '0001_initial'),
]
operations = [
migra... | {
"content_hash": "8f51fc80a52c577e5e057f9f04f688f6",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 66,
"avg_line_length": 24.96,
"alnum_prop": 0.5689102564102564,
"repo_name": "mozilla/standup",
"id": "720caf6df8eb8b2a38268a6059505179fa444b4c",
"size": "648",
"binary":... |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
VERSION = "unknown"
class TextAnalyticsClientConfiguration(... | {
"content_hash": "cbf9b7f38d48656433cccb7c8212a4d0",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 129,
"avg_line_length": 47.296875,
"alnum_prop": 0.6957383548067394,
"repo_name": "Azure/azure-sdk-for-python",
"id": "e6046dcdb4f9190eff67ca928e9fac33d60d8be0",
"size": "3... |
"""
Administration docstring
"""
| {
"content_hash": "a18f7fa974a6ef48c4259d6d3fc3e39e",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 24,
"avg_line_length": 11,
"alnum_prop": 0.696969696969697,
"repo_name": "nuwainfo/treeio",
"id": "276b15f89f59721c67937e4eb65e608b767949bd",
"size": "146",
"binary": fals... |
from sympy.core import Basic, C, Dict, sympify
from sympy.matrices import zeros
from sympy.functions import floor
from sympy.utilities.misc import default_sort_key
from sympy.utilities.iterables import has_dups, flatten
from sympy.ntheory.residue_ntheory import int_tested
import random
from collections import defaultd... | {
"content_hash": "5a29eab0f06c239a9b64ef21e2a1d93f",
"timestamp": "",
"source": "github",
"line_count": 704,
"max_line_length": 80,
"avg_line_length": 28.515625,
"alnum_prop": 0.49778331257783315,
"repo_name": "flacjacket/sympy",
"id": "5beb710f4aff5964fb9a8bbe84374b3bab63a0a6",
"size": "20075",
... |
from subprocess import Popen, PIPE
# proc = Popen(["./badencrypt.py", "poop"],stdout=PIPE)
# hexCiphertext = proc.communicate()[0].strip()
hexCiphertext = "1caaeb57ac2d4af7f0b7fce4e7238427d80721572ab7756552cecce8b3b35f30b098ba91594575af78cfaa06e282f53e286ce54345ea5dc244d20c2c370d4a332fcc462d463aa505ec31ec2c79d784bf"
... | {
"content_hash": "1597a555b074aa608d6acaf11669695b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 178,
"avg_line_length": 30.746268656716417,
"alnum_prop": 0.6898058252427185,
"repo_name": "somethingnew2-0/CS642-HW4",
"id": "d22f83b6c627eddd19a7101ebb4f19eb103420f4",
"s... |
"""
:mod:`tests` -- Utility methods for tests.
===================================
.. automodule:: utils
:platform: Unix
:synopsis: Tests for Nova.
.. moduleauthor:: Nirmal Ranganathan <nirmal.ranganathan@rackspace.com>
.. moduleauthor:: Tim Simpson <tim.simpson@rackspace.com>
"""
from proboscis import asserts... | {
"content_hash": "133c3d53f4618aa51f3151e2995ccd56",
"timestamp": "",
"source": "github",
"line_count": 118,
"max_line_length": 77,
"avg_line_length": 35.41525423728814,
"alnum_prop": 0.6111509930605408,
"repo_name": "denismakogon/trove-guestagent",
"id": "389ef2089379d70f1edb500db9cdb52cf7b02074",
... |
"""
.. module: security_monkey.accounts.sample_extended_aws
:platform: Unix
:synopsis: Extends an AWS account with additional qualifiers that may be
used to in the applied_to_account method in custom auditors
.. version:: $$VERSION$$
.. moduleauthor:: Bridgewater OSS <opensource@bwater.com>
"""
# from s... | {
"content_hash": "9d0a2654433c2ec9ae33f5e639362ab3",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 110,
"avg_line_length": 36.404761904761905,
"alnum_prop": 0.6546762589928058,
"repo_name": "markofu/security_monkey",
"id": "adf2a69c78461611a8fa9e18e63ebb33b2f4680a",
"siz... |
"""Test code for the Face layer of RPC Framework."""
import abc
import contextlib
import threading
import unittest
# test_interfaces is referenced from specification in this module.
from grpc.framework.foundation import logging_pool
from grpc.framework.interfaces.face import face
from grpc_test.framework.common impor... | {
"content_hash": "20b0dd76697abf50c85531ce1bd572db",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 96,
"avg_line_length": 42.0997150997151,
"alnum_prop": 0.6923597482574271,
"repo_name": "doubi-workshop/grpc",
"id": "272a37f15f818c7cf81788eece97ec836fa0caf6",
"size": "1... |
'''
Created on Apr 29, 2010
@author: jnaous
'''
from django import forms
from models import OpenFlowAggregate, OpenFlowSliceInfo, OpenFlowConnection
from openflow.plugin.models import OpenFlowInterface, NonOpenFlowConnection
from expedient.common.utils import create_or_update
from django.forms.models import ModelChoi... | {
"content_hash": "f0f9bd8db4807136588912334c574f62",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 78,
"avg_line_length": 33.27731092436975,
"alnum_prop": 0.6436868686868686,
"repo_name": "avlach/univbris-ocf",
"id": "1ff57f8d4bd7172a109e7260720001f2a4c44733",
"size": "... |
import sys
import json
from datetime import datetime
from dateutil.parser import parse
import paho.mqtt.client as mqtt
from pyspark import SparkContext
from pyspark.streaming import StreamingContext
from pyspark.streaming.mqtt import MQTTUtils
# Some useful stuff
brokerHost = "mqtt.freo.me"
brokerPort = 1883
brokerU... | {
"content_hash": "aef3d8a1fa70db5d7814b63d5ec8e136",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 121,
"avg_line_length": 41.078947368421055,
"alnum_prop": 0.6668802049967969,
"repo_name": "pzfreo/auto-deploy-node-js",
"id": "861c52ca35cffae820ce2f3a36b7d3d2ffe1d7e0",
"... |
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from sentry.web.frontend.base import BaseView
class HomeView(BaseView):
def get(self, request):
# TODO(dcramer): deal with case when the user cannot create orgs
organi... | {
"content_hash": "6496ef18db52ded3ef1e9f976081c204",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 79,
"avg_line_length": 34.76470588235294,
"alnum_prop": 0.7089678510998308,
"repo_name": "jokey2k/sentry",
"id": "032133900256fa53b8045331848d9d91bf910873",
"size": "591",
... |
"""Utilities of test case class."""
import uuid
from contextlib import contextmanager
from . import ctx
from web.models.issue import Issue
from web.models.comment import Comment
from web.models.attached_file import AttachedFile
from web.models.user import User
def create_issue(subject=None, comments=None, state_id=1)... | {
"content_hash": "2a1004bce80072f6794a9e8764774417",
"timestamp": "",
"source": "github",
"line_count": 82,
"max_line_length": 89,
"avg_line_length": 25.841463414634145,
"alnum_prop": 0.633317602642756,
"repo_name": "mmktomato/zenmai-bts",
"id": "4eb121afdaf96b344c637b1c9a22bc4195814c4d",
"size": "... |
"""
This module is all programs entrance.
It have menu.
"""
import tempfile
import uuid
from flask import Flask, request, render_template, send_file
from ciphers import (additive_cipher, multiply_cipher,
affine_cipher, Playfair,
Foursquare, Vigenere, Swaper,
... | {
"content_hash": "7a5c52b5a74579db2e144e6e683500cc",
"timestamp": "",
"source": "github",
"line_count": 280,
"max_line_length": 104,
"avg_line_length": 35.55,
"alnum_prop": 0.5427968655816757,
"repo_name": "alexei-alexov/information_protection",
"id": "c941943ebe37034f6d5b8328c56541e79572b1eb",
"si... |
"""Module provider for Namesilo"""
import logging
from xml.etree import ElementTree
import requests
from lexicon.exceptions import AuthenticationError
from lexicon.providers.base import Provider as BaseProvider
LOGGER = logging.getLogger(__name__)
NAMESERVER_DOMAINS = ["namesilo.com"]
def provider_parser(subparse... | {
"content_hash": "399d53f90a47279594ca2c8916ee11b3",
"timestamp": "",
"source": "github",
"line_count": 159,
"max_line_length": 87,
"avg_line_length": 34.742138364779876,
"alnum_prop": 0.5677045619116582,
"repo_name": "AnalogJ/lexicon",
"id": "4639d16bb5a696d9d8b474c1ff999c9c4504f9da",
"size": "552... |
"""Tools for creating Raw objects from numpy arrays"""
# Authors: Eric Larson <larson.eric.d@gmail.com>
#
# License: BSD (3-clause)
import numpy as np
from ..base import _BaseRaw
from ...utils import verbose, logger
class RawArray(_BaseRaw):
"""Raw object from numpy array
Parameters
----------
dat... | {
"content_hash": "d4a56083f7697f37780a941190fd0aaa",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 79,
"avg_line_length": 34.16,
"alnum_prop": 0.5743559718969555,
"repo_name": "yousrabk/mne-python",
"id": "8231c612317cbba1855ad825a21e86169de60a66",
"size": "1708",
"bin... |
from PyQt5.QtGui import QPainter, QColor, QPen
from PyQt5.QtCore import QPoint
import math
class QTurtle():
direction = 0
posstack = []
ppos = pos = None
delta = None
speed = None
qp = None
def __init__(self, qp, x, y, d=math.pi/2, speed=5):
self.ppos = self.pos = QPoint(x,y)
self.qp = qp
self.delta = d... | {
"content_hash": "67b7c93b774b351766c903f6ad13982b",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 76,
"avg_line_length": 22.933333333333334,
"alnum_prop": 0.6550387596899225,
"repo_name": "ax-rwnd/lparser-python",
"id": "2cecb0eb80a93964b9a00d8829e4985dd083bff1",
"size"... |
"""Common test objects."""
import copy
from datetime import datetime
import json
from unittest.mock import ANY, patch
from homeassistant.components import mqtt
from homeassistant.components.mqtt import debug_info
from homeassistant.components.mqtt.const import MQTT_DISCONNECTED
from homeassistant.components.mqtt.mixin... | {
"content_hash": "6bf8d01b00156e18b8eb93ba7ca6c048",
"timestamp": "",
"source": "github",
"line_count": 1268,
"max_line_length": 108,
"avg_line_length": 34.28627760252366,
"alnum_prop": 0.6645198389879241,
"repo_name": "home-assistant/home-assistant",
"id": "16af5b8e48484603e294def1b6cda7fc3f740eea",... |
from django.conf.urls import patterns
from django.conf.urls import url
from openstack_dashboard.dashboards.settings.apipassword import views
urlpatterns = patterns('',
url(r'^$', views.ApiPasswordView.as_view(), name='index'))
| {
"content_hash": "1563be2bed911060a198796e5f5d7c9f",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 69,
"avg_line_length": 29.25,
"alnum_prop": 0.7649572649572649,
"repo_name": "trystack/python-django-horizon-facebook",
"id": "e2fb5ce6e0dbcca5b5db87b438c641f5b229184b",
"si... |
from rest_framework import generics, permissions, authentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.views import APIView
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
from django.db.models import Q
from .serializers import *
from .p... | {
"content_hash": "6cef28d8a96d12c48fc76d9d1e358077",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 67,
"avg_line_length": 33.42424242424242,
"alnum_prop": 0.7633726201269265,
"repo_name": "underlost/coreExtend",
"id": "b577f948c9f4c72ab5d9bef54390e775905afda4",
"size": "... |
from itertools import count
import re, os, cStringIO, time, cgi, urlparse
from xml.dom import minidom as dom
from xml.sax.handler import ErrorHandler, feature_validation
from xml.dom.pulldom import SAX2DOM
from xml.sax import make_parser
from xml.sax.xmlreader import InputSource
from twisted.python import htmlizer, te... | {
"content_hash": "cc862e7423126cae5cc9e6e76086f7d8",
"timestamp": "",
"source": "github",
"line_count": 1118,
"max_line_length": 112,
"avg_line_length": 34.97406082289803,
"alnum_prop": 0.6552006342548784,
"repo_name": "biddisco/VTK",
"id": "5cc71aa77e17013fce6cdfc0c174c80b4266d77b",
"size": "39175... |
import logging
import mimetypes
import os
import sys
from bottle import get, default_app, static_file
from bson import json_util as json
from greenlet import greenlet as Greenlet
from six import StringIO
from lxml import html
from lxml.html import builder as E
from sockjs.tornado import router as _router,... | {
"content_hash": "6c32d961f97a69832cea40295674db05",
"timestamp": "",
"source": "github",
"line_count": 344,
"max_line_length": 77,
"avg_line_length": 30.625,
"alnum_prop": 0.5187470336971998,
"repo_name": "nehz/avalon",
"id": "6354ebe51b2b4f88a4649ce4362e8a1da3c9389c",
"size": "10780",
"binary":... |
"""Tests and benchmarks for the trace_type module."""
import collections
import timeit
from absl.testing import parameterized
from tensorflow.core.function import trace_type
from tensorflow.core.function.trace_type import default_types
from tensorflow.python.compat import v2_compat
from tensorflow.python.data.ops im... | {
"content_hash": "ac86358e034a865163c875feb362d4d1",
"timestamp": "",
"source": "github",
"line_count": 453,
"max_line_length": 103,
"avg_line_length": 34.147902869757175,
"alnum_prop": 0.656797465899541,
"repo_name": "tensorflow/tensorflow-experimental_link_static_libraries_once",
"id": "21603230670... |
from __future__ import unicode_literals
from future.builtins import open, range, str
from _ast import PyCF_ONLY_AST
import os
from shutil import copyfile, copytree
from django.contrib.auth import get_user_model
from django.db import connection
from django.template import Context, Template
from django.test import Test... | {
"content_hash": "3a5c9f0f70086d7d65ceede72923b81f",
"timestamp": "",
"source": "github",
"line_count": 216,
"max_line_length": 75,
"avg_line_length": 31.685185185185187,
"alnum_prop": 0.6113383985973115,
"repo_name": "spookylukey/mezzanine",
"id": "d2a33169c9c511ad0d894538006e480d960096cf",
"size"... |
"""
Expectation Propagation
=======================
Introduction
------------
This module implements the building-blocks for EP inference: EP parameter
fitting, log of the marginal likelihood, and derivative of the log of the
marginal likelihood.
"""
from .ep import EP
from .linear_kernel import EPLinearKernel
__al... | {
"content_hash": "0c769d697181d540068127e22a04e1f0",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 73,
"avg_line_length": 21.9375,
"alnum_prop": 0.6894586894586895,
"repo_name": "limix/glimix-core",
"id": "38733f0d9b09d50e2183816ae4f84e0ef15cf7da",
"size": "351",
"bina... |
from django.contrib import admin
from transactions.models import *
class EndUserAdmin(admin.ModelAdmin):
def get_model_perms(self, request):
'''
Return empty perms dict thus hiding the model from admin index.
'''
return {}
class StudentAdmin(admin.ModelAdmin):
fields = ('name', 'c... | {
"content_hash": "31ea003d90836df48c2dc494a4f788e5",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 120,
"avg_line_length": 41.074074074074076,
"alnum_prop": 0.6807935076645627,
"repo_name": "sourabhv/Cope-Old",
"id": "d66136ec61ecd5fd9f06e9e0e61ef95de3ff8262",
"size": "1... |
import formatter
import unittest
from test import test_support
htmllib = test_support.import_module('htmllib', deprecated=True)
class AnchorCollector(htmllib.HTMLParser):
def __init__(self, *args, **kw):
self.__anchors = []
htmllib.HTMLParser.__init__(self, *args, **kw)
def get_a... | {
"content_hash": "e646de647c906d8df6a4fd897bbae5e8",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 70,
"avg_line_length": 29.666666666666668,
"alnum_prop": 0.4924279433317049,
"repo_name": "Jeff-Tian/mybnb",
"id": "f45e87112539a279d5ac542e9f9f9468881f4c89",
"size": "2047... |
import sys
import pytest
import typeconverter
if sys.version_info < (3, 0, 0):
PY3 = None
PY2 = object()
string_basetype = basestring
def to_str(x):
return unicode(x)
else:
PY3 = object()
PY2 = None
string_basetype = str
def to_str(x):
return str(x)
def test_conv... | {
"content_hash": "2e190e3f2707b54dbcaf93e4cf8c626a",
"timestamp": "",
"source": "github",
"line_count": 137,
"max_line_length": 75,
"avg_line_length": 23.773722627737225,
"alnum_prop": 0.5618667485416027,
"repo_name": "Hardtack/TypeConverter",
"id": "023de3a613b083cc418b31d01a6f61b0d8d15b69",
"size... |
"""ScopedAnnotation allows the profiler to annotate device (e.g., GPU) events.
Usage:
with scoped_annotation.ScopedAnnotation('name'):
...
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import six
from tensorflow.python.profiler.internal im... | {
"content_hash": "492f3c3700af3eb0ec7d0ea1e8deed5f",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 80,
"avg_line_length": 29.942857142857143,
"alnum_prop": 0.6612595419847328,
"repo_name": "renyi533/tensorflow",
"id": "1d7e2b024b4e1a789e9bcfda306d865a00f77cd9",
"size": "... |
from django.db import models
from django.contrib.auth.models import User
from entrez.models import EntrezEntry
class Room(models.Model):
name = models.CharField(max_length=255)
desc = models.TextField()
creator = models.ForeignKey(User, related_name='creator')
members = models.ManyToManyField(User, re... | {
"content_hash": "d432571c381265f1f7b37d0ce787b54e",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 65,
"avg_line_length": 26.12,
"alnum_prop": 0.6937212863705973,
"repo_name": "indexofire/django-entrez",
"id": "785925d17a1cb0a231f215ed8977424c46e10459",
"size": "677",
... |
"""Urls for the Zinnia feeds"""
from django.conf.urls.defaults import url
from django.conf.urls.defaults import patterns
from zinnia.feeds import LatestEntries
from zinnia.feeds import EntryDiscussions
from zinnia.feeds import EntryComments
from zinnia.feeds import EntryTrackbacks
from zinnia.feeds import EntryPingbac... | {
"content_hash": "82c3ec835a78c58e6347f3b0dce6c466",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 65,
"avg_line_length": 45.18181818181818,
"alnum_prop": 0.46277665995975853,
"repo_name": "jfdsmit/django-blog-zinnia",
"id": "7a0b8eba4340c8a97fd8b1d57861665bf7a5ffec",
"s... |
import requests
from requests.compat import urljoin
from agent import Agent
from multiprocessing import Pool
def spawn(request):
Agent(request['sid'], request['server'], request['term'], request['crn']).run()
class Spawner:
def __init__(self, server, pool_size):
self.server = server
self.pool_size =... | {
"content_hash": "d4fcf00a841939e97ad411131ffa8929",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 81,
"avg_line_length": 23.555555555555557,
"alnum_prop": 0.6356132075471698,
"repo_name": "chidoli/agent-pete",
"id": "07fbb22489847c5939f0ff8f867ee1c5def79e3d",
"size": "8... |
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
import errno
import re
from typing import Optional
import msgfy
import pyparsing as pp
import subprocrunner as spr
from ._const import Network, Tc, TcCommandOutput, TrafficDirection
try:
import ujson as json
except ImportError:
import ... | {
"content_hash": "842180ee52409ee587b190f04c2aa408",
"timestamp": "",
"source": "github",
"line_count": 188,
"max_line_length": 100,
"avg_line_length": 34.21808510638298,
"alnum_prop": 0.5230840976216384,
"repo_name": "thombashi/tcconfig",
"id": "8d979b9653ac9938a5deefbfc2011adfb1b4c7b2",
"size": "... |
from system.log_support import init_logger
import time
from system.motion_detection import MotionDetectorV3Traced
import config
import datetime as dts
import numpy as np
from system.camera_support import CameraConnectionSupport
import cv2 as cv
import imutils
class MotionDetectionTester(CameraConnectionSupport):
... | {
"content_hash": "06e51dd9a26eb91e93280ac7203c6a6e",
"timestamp": "",
"source": "github",
"line_count": 166,
"max_line_length": 123,
"avg_line_length": 33.48795180722892,
"alnum_prop": 0.5509983810037776,
"repo_name": "JFF-Bohdan/pynvr",
"id": "e5031a901d8ecc9270c279cd08bb069988c75538",
"size": "55... |
"""
[path]
cd /Users/brunoflaven/Documents/01_work/blog_articles/extending_streamlit_usage/simple_app_spacy_example/
[file]
streamlit run simple_app_spacy_example_11.py
# more on infos and apps on
https://streamlit.io/
https://streamlit.io/gallery
https://docs.streamlit.io/en/stable/
Source: http... | {
"content_hash": "0a0075159cae084af970657e5edef48d",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 105,
"avg_line_length": 19.548387096774192,
"alnum_prop": 0.7112211221122112,
"repo_name": "bflaven/BlogArticlesExamples",
"id": "e07f73afc02a33e9a44a19c16bafb496c6ff1108",
... |
"""
WSGI config for restaurant project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SE... | {
"content_hash": "7e54e62a190189f1876ef32485723420",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 78,
"avg_line_length": 24.8125,
"alnum_prop": 0.7732997481108312,
"repo_name": "PI-Technology/django-main-app",
"id": "1dbb67b9ca28b9808fd85197e18ae3df306add03",
"size": "3... |
import os
import tensorflow as tf
import tempfile
from datetime import datetime, timedelta
import numpy as np
import argparse
import logging
import shutil
import subprocess
import apache_beam as beam
import random
import sys
from . import train_autoencoder as trainer
class Predict(beam.DoFn):
def __init__(self,... | {
"content_hash": "433ad6a08f530c58e5b8e68f3e6e0906",
"timestamp": "",
"source": "github",
"line_count": 129,
"max_line_length": 93,
"avg_line_length": 35.06201550387597,
"alnum_prop": 0.5878841476895865,
"repo_name": "GoogleCloudPlatform/ml-design-patterns",
"id": "2e1afd33ffdac99fb5d35d5ab8ebe7a7f65... |
"""
Here we try to safely use crispy_form if installed
"""
from django.utils.translation import ugettext as _
from bazar.utils.imports import safe_import_module
# Try to import "crispy-forms" base stuff to use for the default helper
try:
from crispy_forms.helper import FormHelper
from crispy_forms.layout impo... | {
"content_hash": "cc629081bd7bed5c6beff4df6aae9587",
"timestamp": "",
"source": "github",
"line_count": 47,
"max_line_length": 101,
"avg_line_length": 38.59574468085106,
"alnum_prop": 0.6411245865490628,
"repo_name": "emencia/emencia-django-bazar",
"id": "abf25030bb93ffb4fcf64033e3adfa6fa2c15d87",
... |
import codecs
import os
import re
from setuptools import find_packages, setup
here = os.path.abspath(os.path.dirname(__file__))
# Read the version number from a source file.
# Why read it, and not import?
# see https://groups.google.com/d/topic/pypa-dev/0PkjVpcxTzQ/discussion
def find_version(*file_paths):
# Op... | {
"content_hash": "836e50c05c0f7a4598ba611140b3b4b8",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 71,
"avg_line_length": 28.53846153846154,
"alnum_prop": 0.6339622641509434,
"repo_name": "sivel/ansible-template-ui",
"id": "f1c72e14b868b545ae5a418a35adfc30f245e0aa",
"siz... |
from distutils.core import setup
setup(
name = "uri",
version = "1.0",
description = "A library for URI handling featuring an implementation of URI-Templates",
author = 'Jacob Kaplan-Moss',
author_email = 'jacob@jaobian.org',
py_modules = ['uri'],
classifiers = [
'Development Status... | {
"content_hash": "ba73726719ac0ba5a6a7fbf6d028b862",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 92,
"avg_line_length": 30.666666666666668,
"alnum_prop": 0.6032608695652174,
"repo_name": "jacobian-archive/uri",
"id": "f840b41d64166c57a7d4d24c4469940c2b809b65",
"size": ... |
from flask import Flask, render_template, request
import search_engine
m = {"crossroads": 1, "cafe3": 3, "ckc": 4, "foothill": 6}
libraries = ['anthropology library',
'art history/classics library',
'bancroft library/university archives',
'berkeley law library',
'bioscience & natural resources library',
'business... | {
"content_hash": "f4e31691832f52caddbdcb823d9ba23c",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 73,
"avg_line_length": 30.25,
"alnum_prop": 0.7032664305391578,
"repo_name": "yishuangl/cal",
"id": "0656fcef841c3759264d80df7ed501f5b831a1f4",
"size": "2541",
"binary": ... |
import _plotly_utils.basevalidators
class DtickValidator(_plotly_utils.basevalidators.AnyValidator):
def __init__(
self, plotly_name="dtick", parent_name="choropleth.colorbar", **kwargs
):
super(DtickValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent... | {
"content_hash": "c58a088220bb9b7c9f58131953a10c43",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 78,
"avg_line_length": 35.57142857142857,
"alnum_prop": 0.6044176706827309,
"repo_name": "plotly/plotly.py",
"id": "a1ad58a5e86670c7805d436d9ad6fafaea6dd64d",
"size": "498"... |
"""Utilities for dynamically importing python files."""
import importlib
import pkgutil
def LoadModulesForPath(path, package_prefix=None):
"""Load all modules on 'path', with prefix 'package_prefix'.
Example usage:
LoadModulesForPath(__path__, __name__)
Args:
path: Path containing python modules.
... | {
"content_hash": "2ec2f3cc220c97849ff95282f98cbd8e",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 79,
"avg_line_length": 37.172413793103445,
"alnum_prop": 0.7077922077922078,
"repo_name": "GoogleCloudPlatform/PerfKitBenchmarker",
"id": "197462a1e0421bbff159fcf6bbc9d1c3d45... |
from __future__ import annotations
import warnings
from typing import Sequence
from airflow.providers.common.sql.operators.sql import SQLExecuteQueryOperator
class ExasolOperator(SQLExecuteQueryOperator):
"""
Executes sql code in a specific Exasol database
:param sql: the SQL code to be executed as a s... | {
"content_hash": "0f1fba03a1962ef6e535c037c2603f5d",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 96,
"avg_line_length": 38.146341463414636,
"alnum_prop": 0.6540920716112532,
"repo_name": "apache/airflow",
"id": "253e443b8ee6c0b873e310010b6cff39d61b3103",
"size": "2351"... |
import argparse
import collections
import operator
import os
import sys
import time
from typing import Dict, Generator, Tuple, Optional
import mxnet as mx
import numpy as np
from . import arguments
from . import constants as C
from . import vocab
from .data_io import smart_open, get_tokens, tokens2ids
from .log impor... | {
"content_hash": "ed677ff9848c4469d8afe59f2fb4ae6d",
"timestamp": "",
"source": "github",
"line_count": 329,
"max_line_length": 194,
"avg_line_length": 43.41337386018237,
"alnum_prop": 0.6328502415458938,
"repo_name": "mlperf/training_results_v0.6",
"id": "e18071658ab553ae44ff8f217cab7ac14941611e",
... |
import asyncio
import json
from typing import Any
from collections import OrderedDict
from plenum.common.constants import NONCE, TYPE, IDENTIFIER, DATA
from plenum.common.types import f
from plenum.common.util import getCryptonym
from anoncreds.protocol.prover import Prover
from anoncreds.protocol.types import Schema... | {
"content_hash": "bafe5dc8e652443f20051ef029ee51a6",
"timestamp": "",
"source": "github",
"line_count": 206,
"max_line_length": 94,
"avg_line_length": 39.37378640776699,
"alnum_prop": 0.6272962643323882,
"repo_name": "keenondrums/sovrin-node",
"id": "12ccac52ea00f462ed8f25b9466dd1e106db3ae1",
"size... |
from django.core.management.base import BaseCommand
from salt_observer.models import Minion
from . import ApiCommand
import json
class Command(ApiCommand, BaseCommand):
help = 'Fetch and save packagedata'
def save_packages(self, api):
packages = api.get('pkg.list_pkgs')
upgrades = api.get('... | {
"content_hash": "6d551990a6541a31ab71c3c33174edc8",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 100,
"avg_line_length": 32.39473684210526,
"alnum_prop": 0.5751421608448416,
"repo_name": "hs-hannover/salt-observer",
"id": "bdf99d6de022ec69f3337a2ae77622ef3aa99710",
"si... |
from tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack(fill=BOTH, expand=1)
#Listbox
listbox = Listbox(frame)
for item in ['red', 'green', 'blue', 'yellow', 'pink']:
listbox.insert(END, item)
listbox.grid(row=0, co... | {
"content_hash": "022e79119e41b95196a9f2d63d372791",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 63,
"avg_line_length": 28.304347826086957,
"alnum_prop": 0.5745007680491552,
"repo_name": "simonmonk/prog_pi_ed2",
"id": "e1a92b11f5295ef0e0f132aa0a52a83c587726ee",
"size":... |
"""Manage Robinhood Sessions."""
import uuid
from datetime import datetime, timedelta
from typing import TYPE_CHECKING, Any, Dict, Optional, Union, cast
from urllib.request import getproxies
import certifi
import pytz
import requests
from marshmallow import Schema, fields, post_load
from requests.exceptions import HT... | {
"content_hash": "e900897faa0ebbf726c235ceef191d56",
"timestamp": "",
"source": "github",
"line_count": 554,
"max_line_length": 88,
"avg_line_length": 35.26353790613718,
"alnum_prop": 0.5951576576576577,
"repo_name": "Jamonek/Robinhood",
"id": "3614d7750c0d3b54a6722083c7e6e4a01de316b8",
"size": "19... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import os
import torch
import torch.distributed as dist
import logging
import ray
from ray.tune import Trainable
from ray.tune.resources import Resources
from ray.experimental.sgd.pytorch.p... | {
"content_hash": "053b85d2b25e5c6169bdb4360407b70e",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 79,
"avg_line_length": 37.29807692307692,
"alnum_prop": 0.5845578757411704,
"repo_name": "ujvl/ray-ng",
"id": "91fc2b63ec9fada18aad2ac0363eb09b407df0dd",
"size": "7758",
... |
from PIL import Image
import requests
from io import BytesIO
import webbrowser # This module can control the browser
import json # Json encoder/decoder
from bs4 import BeautifulSoup # Module to sort through HTML
import lxml # Module to prepare html for BeautifulSoup
from urllib.request import urlopen
import sys # Allow... | {
"content_hash": "3abc2b15aa436b0cb3bd754a012350a5",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 144,
"avg_line_length": 35.17307692307692,
"alnum_prop": 0.6649535265172225,
"repo_name": "khou22/MusicDownloader",
"id": "f0d944d0c86d8b4a44b4d9c302ca5f53c8803986",
"size... |
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.test import TestCase
from django.utils import unittest
from django.conf.urls import patterns
from rest_framework import permissions, status
from rest_framework.authentication import OAuth2Authentication
from rest_framework.com... | {
"content_hash": "88375af39f77cddd3ea3fa9be1dea031",
"timestamp": "",
"source": "github",
"line_count": 246,
"max_line_length": 80,
"avg_line_length": 36.50813008130081,
"alnum_prop": 0.6412426233158891,
"repo_name": "vforgione/django-rest-framework-jwt",
"id": "f12778520d363d8b24d0bdb7f5ab5758a0a834... |
import os
import mock
from pecan.testing import load_test_app
from tuskar.manager import models as manager_models
from tuskar.storage import exceptions as storage_exceptions
from tuskar.tests import base
URL_ROLES = '/v2/roles'
URL_PLAN_ROLES = '/v2/plans/plan_uuid/roles'
class RolesTests(base.TestCase):
def... | {
"content_hash": "29ea56d383a723999cf88d5bff6a5b7e",
"timestamp": "",
"source": "github",
"line_count": 120,
"max_line_length": 78,
"avg_line_length": 34.71666666666667,
"alnum_prop": 0.5960153624579932,
"repo_name": "rdo-management/tuskar",
"id": "fbe0fa30911ae04c1415cb359e34a0f6322229b0",
"size":... |
import argparse
import copy
import logging
import os
from typing import Any, Dict, Iterator, List
import torch
from omegaconf import open_dict
from torch import nn
from fairseq import utils
from fairseq.data import encoders
logger = logging.getLogger(__name__)
def from_pretrained(
model_name_or_path,
check... | {
"content_hash": "8af6dbdbf8090df4d05fd4c2fb261f97",
"timestamp": "",
"source": "github",
"line_count": 308,
"max_line_length": 88,
"avg_line_length": 36.188311688311686,
"alnum_prop": 0.5700699802619774,
"repo_name": "pytorch/fairseq",
"id": "b6fa2cb97d713be5b81f6bad345be3f12cc02d70",
"size": "113... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.