text stringlengths 4 1.02M | meta dict |
|---|---|
"""Base class to make optimizers weight decay ready."""
import gin
import numpy as np
import tensorflow as tf
from typing import Union, Callable, Type
FloatTensorLike = Union[tf.Tensor, float, np.float16, np.float32, np.float64]
def _ref(var):
return var.ref() if hasattr(var, "ref") else var.experimental_ref()... | {
"content_hash": "025dc103531d0a8074e43510a9f093fb",
"timestamp": "",
"source": "github",
"line_count": 419,
"max_line_length": 88,
"avg_line_length": 41.71360381861575,
"alnum_prop": 0.6485295800434833,
"repo_name": "soCzech/TransNetV2",
"id": "f6070f88b14d03b45f83878c4e5b56d762b66e4d",
"size": "1... |
"""
The vis package implements various visualization tools. For example, a VTK
Structure viewer.
"""
| {
"content_hash": "0a44d9f931c88ae81b30832b2e3f7170",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 74,
"avg_line_length": 25.25,
"alnum_prop": 0.7623762376237624,
"repo_name": "ctoher/pymatgen",
"id": "a67ef78d0c3af3ded4f88918cbcb5c051f08c787",
"size": "101",
"binary": ... |
import logging
import logging.handlers
import os
from config import config_properties
dirname = os.path.dirname(__file__)
LOG_FILENAME = filename = os.path.join(dirname, '../log/wso2carbon.log')
logger = logging.getLogger()
LOG_LEVEL = config_properties['log_level']
if LOG_LEVEL == "INFO":
log_level = logging.IN... | {
"content_hash": "91ee7ed0b8d0b6881e58499f31a1c563",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 120,
"avg_line_length": 32.34375,
"alnum_prop": 0.7429951690821256,
"repo_name": "wso2/product-apim",
"id": "255b8023a6d4ecac514fe5a4dc1316d988068c0e",
"size": "1035",
"b... |
import os
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
WEBRTC_GITHUB_SAMPLES_URL = 'http://webrtc.github.io/samples/src/content/'
class WebrtcCasesPage(page_module.Page):
def __init__(self, url, page_set):
super(WebrtcCasesPage, self).__init__(url=url... | {
"content_hash": "e357b7e8e905663da193e9e99c0a124b",
"timestamp": "",
"source": "github",
"line_count": 162,
"max_line_length": 77,
"avg_line_length": 30.555555555555557,
"alnum_prop": 0.6874747474747475,
"repo_name": "sgraham/nope",
"id": "16918ebeb18a022fe0f3dfda62cdf8af5ef77981",
"size": "5112",... |
from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec
import sys
from .ttypes import *
DDL_TIME = "transient_lastDdlTime"
ACCESSTYPE_NONE = 1
ACCESSTYPE_READONLY = 2
ACCESSTYPE_WRITEO... | {
"content_hash": "ac19a4ddc96c45909fa2793e286bc168",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 93,
"avg_line_length": 37,
"alnum_prop": 0.7708578143360753,
"repo_name": "sankarh/hive",
"id": "a65791d89398aedc8ad9474b98ab0c5dccc19dac",
"size": "1844",
"binary": fals... |
def extractOtakutlsBlogspotCom(item):
'''
Parser for 'otakutls.blogspot.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Blade And Sword God Soverigen', 'Blade And Sword God Soverigen'... | {
"content_hash": "8de7e74601778df06ce5ac65ebd4d30e",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 110,
"avg_line_length": 29,
"alnum_prop": 0.6751361161524501,
"repo_name": "fake-name/ReadableWebProxy",
"id": "9c3a55a4d8b08aefb2e8ef57e500cbcb2e00e5a0",
"size": "551",
... |
from os.path import abspath, dirname, basename, join
import sys
PROJECT_ABSOLUTE_DIR = dirname(abspath(__file__))
PROJECT_NAME = basename(PROJECT_ABSOLUTE_DIR)
sys.path.append(PROJECT_ABSOLUTE_DIR)
sys.path.append(join(PROJECT_ABSOLUTE_DIR, '../', '../'))
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('juanpex... | {
"content_hash": "f0dd9b8d9c47506d57fcdfc13fec4ec5",
"timestamp": "",
"source": "github",
"line_count": 167,
"max_line_length": 109,
"avg_line_length": 33.964071856287426,
"alnum_prop": 0.6909379407616361,
"repo_name": "edos21/django-model-report",
"id": "4a639b0258ea25b264c9925c01a1ef20f8e76288",
... |
import _plotly_utils.basevalidators
class InsidetextfontValidator(_plotly_utils.basevalidators.CompoundValidator):
def __init__(self, plotly_name="insidetextfont", parent_name="sunburst", **kwargs):
super(InsidetextfontValidator, self).__init__(
plotly_name=plotly_name,
parent_name... | {
"content_hash": "6041b3429c59e59c86dcbe2577d989ba",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 87,
"avg_line_length": 41.08695652173913,
"alnum_prop": 0.5402116402116403,
"repo_name": "plotly/plotly.py",
"id": "a67753dbd63065e0d7eca679ec15e6e0713205c3",
"size": "1890... |
'''Generate html from pandas'''
import numpy as np
def get_best_prices(data):
masked_price = np.ma.masked_array(data, mask=np.isnan(data))
return masked_price.argmin(axis=1)
def replace_special_chars(string):
return string.replace(' ', '_').replace('%', 'percent')
def revert_special_chars(string):
r... | {
"content_hash": "10b69e1a83e6635aef626548cb4b1231",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 69,
"avg_line_length": 36.906976744186046,
"alnum_prop": 0.5658475110270952,
"repo_name": "Nagasaki45/MarketPrices",
"id": "76209b566e134bae332f16e4a94b5ef06f059a12",
"size... |
from test.support import requires_IEEE_754
from test.test_math import parse_testfile, test_file
import test.test_math as test_math
import unittest
import cmath, math
from cmath import phase, polar, rect, pi
import sysconfig
INF = float('inf')
NAN = float('nan')
complex_zeros = [complex(x, y) for x in [0.0, -0.0] for ... | {
"content_hash": "40d9e39d0702f144380061125713f7f0",
"timestamp": "",
"source": "github",
"line_count": 575,
"max_line_length": 80,
"avg_line_length": 39.07304347826087,
"alnum_prop": 0.5464904081541817,
"repo_name": "munyirik/python",
"id": "25ab7c12cbd65f8da00159f4b653bc4f1637403e",
"size": "2246... |
from .db import db
from flask_sqlalchemy import Model
from sqlalchemy import Integer, String, Column, DateTime
class Books(db.Model):
__tablename__ = "books"
id = Column(Integer, primary_key=True)
book_name = Column(String, unique=True)
book_author = Column(String)
img = Column(String)
descri... | {
"content_hash": "3f8d7abfefa98c0210562cf8c1f89ce0",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 70,
"avg_line_length": 26,
"alnum_prop": 0.6240188383045526,
"repo_name": "Ignotus/bookclub",
"id": "ceba7f6a462fe72fb953387254747df06009ad2e",
"size": "3822",
"binary":... |
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": "7887f5d0b0902c0bfbc5a295992b05d6",
"timestamp": "",
"source": "github",
"line_count": 303,
"max_line_length": 654,
"avg_line_length": 31.597359735973598,
"alnum_prop": 0.6843534572801337,
"repo_name": "mahabs/nitro",
"id": "15aac8dd9ef41770bfb529c0a026d7e807af9fad",
"size": "10188... |
import _plotly_utils.basevalidators
class TokenValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(self, plotly_name="token", parent_name="isosurface.stream", **kwargs):
super(TokenValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
... | {
"content_hash": "2c4dc49328fe677e5c3b5f78c6fc47d0",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 87,
"avg_line_length": 38.38461538461539,
"alnum_prop": 0.6052104208416834,
"repo_name": "plotly/plotly.py",
"id": "89752f51f0efc7d433fc0e14c297ae611478d7bc",
"size": "499"... |
"""Operations often used for initializing tensors.
All variable initializers returned by functions in this file should have the
following signature:
def _initializer(shape, dtype=dtypes.float32, partition_info=None):
Args:
shape: List of `int` representing the shape of the output `Tensor`. Some
initialize... | {
"content_hash": "dccc54afbbbc12e10db8ae0c3378b86b",
"timestamp": "",
"source": "github",
"line_count": 1312,
"max_line_length": 82,
"avg_line_length": 34.7484756097561,
"alnum_prop": 0.6483000658039043,
"repo_name": "jalexvig/tensorflow",
"id": "c315722b6ba12d45d023820b09bb7c1de7c2268a",
"size": "... |
"""Remove SSL certificate."""
# :license: MIT, see LICENSE for more details.
import SoftLayer
from SoftLayer.CLI import environment
from SoftLayer.CLI import exceptions
from SoftLayer.CLI import formatting
import click
@click.command()
@click.argument('identifier')
@environment.pass_env
def cli(env, identifier):
... | {
"content_hash": "3a431ea27f439fb90cb59a1ef6ff85ba",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 71,
"avg_line_length": 25.545454545454547,
"alnum_prop": 0.7455516014234875,
"repo_name": "briancline/softlayer-python",
"id": "3f8e7fa114a9582d8b1ab5ccd523abe26071d156",
"... |
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('smartfoosball', '0002_auto_20141223_1513'),
]
operations = [
migrations.AlterField(
model_name='player'... | {
"content_hash": "d4b6d54abe7fd8b4693915fb4d52084d",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 79,
"avg_line_length": 29.839285714285715,
"alnum_prop": 0.5499700777977259,
"repo_name": "smartfoosball/fooscloud",
"id": "1977c8505a0a889d0eb05023fb74df71196443b8",
"size... |
"""
Layered Area Chart
------------------
This example shows a layered area chart.
"""
# category: area charts
import altair as alt
from vega_datasets import data
source = data.iowa_electricity()
alt.Chart(source).mark_area(opacity=0.3).encode(
x="year:T",
y=alt.Y("net_generation:Q", stack=None),
color="s... | {
"content_hash": "87006c41eb3930060c3e016ce439fd65",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 48,
"avg_line_length": 20.6875,
"alnum_prop": 0.6586102719033232,
"repo_name": "jakevdp/altair",
"id": "fe9e42c2cf36fabf2a5b76defc2288acfc63588e",
"size": "331",
"binary"... |
from flask import Flask
from flask import request
from config import MEMBERSHIP_SERVICE_NAME as SERVICE_NAME
from config import MEMBERSHIP_HOST as HOST
from config import MEMBERSHIP_PORT as PORT
from config import MEMBERSHIP_DEBUG as DEBUG
from config import MEMBERSHIP_SECRET_KEY as SECRET_KEY
from config import MEMBE... | {
"content_hash": "0a15c3b180b71c4800ae9de6cfeba33e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 73,
"avg_line_length": 22.670454545454547,
"alnum_prop": 0.7819548872180451,
"repo_name": "zzragida/PythonExamples",
"id": "4a63fb5cd2634782c635d9c0b5727cc76a83b85a",
"size... |
import gevent
def foo():
raise Exception
print("Running in foo")
gevent.sleep(0)
print("Explicit context switch to foo again")
def bar():
print("Explicit context to bar")
gevent.sleep(0)
print("Implicit context switch back to bar")
gevent.joinall([gevent.spawn(foo), gevent.spawn(bar)])
| {
"content_hash": "269a52b7c92fd2b76c9cbcc0b59571c2",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 54,
"avg_line_length": 21.266666666666666,
"alnum_prop": 0.677115987460815,
"repo_name": "aiden0z/snippets",
"id": "fd9af9cf1e14fdca1ec52069b69cfc6e10bce611",
"size": "335"... |
import requests
import json
import MySQLdb
import datetime
import sys
# Script to call the UIUC EWS lab utilization api
# DOES NOT ACCOUNT FOR TIMEZONE!!!
# MYSQL datetime format
time_format = '%Y-%m-%d %H:%M:%S'
def fetch(link):
"""
Parameters: URL to page to read
Returns: JSON from page
"""
... | {
"content_hash": "8dddfb9a914f25c25920ba893ec8b227",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 142,
"avg_line_length": 29.27956989247312,
"alnum_prop": 0.5846492838780757,
"repo_name": "codypilot/SQLToPython",
"id": "1facf6e28831e984885e385b7c854a295ef254a2",
"size":... |
"""
pycroft.lib.facilities
~~~~~~~~~~~~~~~~~~~~~~
"""
import logging
import re
import typing as t
from collections import defaultdict
from dataclasses import dataclass
from sqlalchemy import func, and_, distinct, literal_column
from sqlalchemy.orm import aliased, contains_eager, joinedload
from pycroft.helpers.i18n i... | {
"content_hash": "d109a98e03cae5f9e9b3ccb34a9b9d45",
"timestamp": "",
"source": "github",
"line_count": 233,
"max_line_length": 130,
"avg_line_length": 31.180257510729614,
"alnum_prop": 0.6192704748795596,
"repo_name": "agdsn/pycroft",
"id": "f5f876d8f1e9aade18193dc948ad6038495d2e24",
"size": "7265... |
try:
import sys
import re
import os
import subprocess
import tempfile
import socket
from core.configparser import ConfigParser
from core.threadpool import Worker,ThreadPool
except ImportError,e:
import sys
sys.stdout.write("%s\n" %e)
sys.exit(1)
class MountDetect:
def __init__(self, c... | {
"content_hash": "8893e161b0c772caf12cd0d53c647840",
"timestamp": "",
"source": "github",
"line_count": 357,
"max_line_length": 148,
"avg_line_length": 30.84313725490196,
"alnum_prop": 0.6036690582145128,
"repo_name": "noikiy/depdep",
"id": "d5f8bebd65cc50564d4846a075dbb455db938045",
"size": "11011... |
import numpy as np
import pandas as pd
import cPickle
import datetime
from itertools import product
class Hyperparameter(object):
"""Base class for a grid search parameter"""
def __init__(self, name):
self.name = name
def get_all_values(self):
raise NotImplementedError()
def... | {
"content_hash": "ed5a6b2d20af5816029dbb80ba0947d7",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 85,
"avg_line_length": 37.8013698630137,
"alnum_prop": 0.5843449900344265,
"repo_name": "henryre/shalo",
"id": "5f3c6231259154822148855ae97fca2bf2ea6f2d",
"size": "5519",
... |
import unittest
from datetime import timedelta, time
from airflow import DAG, configuration, settings
from airflow import exceptions
from airflow.exceptions import AirflowException, AirflowSensorTimeout
from airflow.models import TaskInstance, DagBag
from airflow.operators.bash_operator import BashOperator
from airflo... | {
"content_hash": "855fe0c9a14606eb32ea6c3ae27ca75a",
"timestamp": "",
"source": "github",
"line_count": 305,
"max_line_length": 83,
"avg_line_length": 34.104918032786884,
"alnum_prop": 0.550471063257066,
"repo_name": "r39132/airflow",
"id": "18fff556bf035f84eb056f7ce3ad009658e6f7fe",
"size": "11213... |
"""Common constants shared across DeepVariant's codebase.
This file is for very general constants in the code that end up needing to be
accessed in a variety of places, often in live code as well as throughout the
code in tests.
"""
# Default width [in basepairs] for our DeepVariant data tensor.
PILEUP_DEFAULT_WIDTH ... | {
"content_hash": "26a7bb91984ba32e908104588a85fd18",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 77,
"avg_line_length": 34.266666666666666,
"alnum_prop": 0.7645914396887159,
"repo_name": "google/deepvariant",
"id": "26a3cda6a2f7aa742d9c2861626e8e458f220b9b",
"size": "2... |
import datetime
import pandas as pd
import mapping.leaflet_map as lm
import copy
import math
import general.general_objects as geno
import general.general_units as genu
import hurricane.hurricane_nws23 as hm
import joblib as job
import configparser as cpar
import numpy as np
import mapping.gdal_mapping as gdm
import r... | {
"content_hash": "3cc46658cb4d4de6fb1f2f4534a9832a",
"timestamp": "",
"source": "github",
"line_count": 1094,
"max_line_length": 584,
"avg_line_length": 45.80347349177331,
"alnum_prop": 0.542537268754116,
"repo_name": "cliftbar/FlaPyDisaster",
"id": "a2b7705c93048bd05f691d8075af1c1f57cca87e",
"size... |
"""Parametric vision transformer models for classification."""
from typing import Any
import chex
import gin
import haiku as hk
import jax
import jax.numpy as jnp
from learned_optimization.tasks import base
from learned_optimization.tasks.datasets import base as datasets_base
from learned_optimization.tasks.datasets ... | {
"content_hash": "8dc6d0c601361d7dbe38ce3a7c3932fe",
"timestamp": "",
"source": "github",
"line_count": 105,
"max_line_length": 89,
"avg_line_length": 35.885714285714286,
"alnum_prop": 0.7123142250530785,
"repo_name": "google/learned_optimization",
"id": "ef27c7a976ea142d50f1a7ac25991e7659fcd98d",
... |
from __future__ import unicode_literals, print_function
from time import sleep, time
from mock.ui import MockUi
import lnc.main
def create_variables(func, task_count):
"""Use task list returned by this function because run_tasks_in_parallel()
modifies task list that was passed to it."""
tasks = []
f... | {
"content_hash": "46ce819f9abe4715b77048fb08e2b12a",
"timestamp": "",
"source": "github",
"line_count": 110,
"max_line_length": 78,
"avg_line_length": 23.01818181818182,
"alnum_prop": 0.6374407582938388,
"repo_name": "atrosinenko/lecture-notes-compiler",
"id": "6bbac1e8c510f6509e03d2d0ccbb9dce4dae3c6... |
from pymongo import MongoClient
client = MongoClient()
db = client.fpl_users
coll = db.fpl_user_data
#cursor = db.fpl_user_data.find()
#for document in cursor:
# print(document)
cursor = db.fpl_user_data.aggregate(
[
{"$group": {"_id": "$main_user_region", "count": {"$sum": 1}}}
]
)
for document in... | {
"content_hash": "686cc732bb6d798fe02d961319bbbbdc",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 70,
"avg_line_length": 22.764705882352942,
"alnum_prop": 0.6382428940568475,
"repo_name": "ChaiBapchya/fantasypremierleague-datascience",
"id": "db2c8627f07e862d2869f08f43d46... |
__author__ = 'chuqiao'
import smtplib
import base64
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
def viewlog(file):
file = open("syncsolr.log")
file.seek(0,2)# Go to the end of the file
while True:
line = file.readline()
if "***Finished synchronizi... | {
"content_hash": "d33cd3805cd73e92c59b67b5f1a0dcca",
"timestamp": "",
"source": "github",
"line_count": 75,
"max_line_length": 72,
"avg_line_length": 23.986666666666668,
"alnum_prop": 0.6336853807670928,
"repo_name": "elixirhub/events-portal-scraping-scripts",
"id": "aeb2a47dc4cdb15ff4d184b7447feca60... |
from PIL import Image
import numpy as np
import argparse
def main():
parser = argparse.ArgumentParser(
description='Add the RGB bytes in an image')
parser.add_argument('inFile', help='Input image file for addition')
args = parser.parse_args()
img = Image.open(args.inFile)
imgArr = np.array(img)
ax1, ax2, ax3 ... | {
"content_hash": "9ce6ffb2d510c5eaf7348a327d6b5b49",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 68,
"avg_line_length": 22.59090909090909,
"alnum_prop": 0.6780684104627767,
"repo_name": "mitre-cyber-academy/2013-grabbag-300",
"id": "9bf18c606d14341b947f1e24c7a73e002b40f9... |
def _get_version() -> str:
from pathlib import Path
from versioningit import get_version
import streamlink
return get_version(
project_dir=Path(streamlink.__file__).parents[2]
)
# The following _get_version() call will get replaced by versioningit with a static version string when buildin... | {
"content_hash": "e10e52dec6944f5f0cfff1e7000ba4c7",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 123,
"avg_line_length": 35.46153846153846,
"alnum_prop": 0.6876355748373102,
"repo_name": "chhe/streamlink",
"id": "fc9b48a494c40c02332f7d40f60c332908e0c311",
"size": "566"... |
"""Formatting utilities."""
from client import exceptions
import textwrap
#############
# Whtespace #
#############
def dedent(text):
"""Dedents a string of text.
Leading whitespace that is common to all lines in the string is
removed. Any leading newlines and trailing whitespace is also
removed.
... | {
"content_hash": "eefc579a37fea44ce3615ca6af91c5fe",
"timestamp": "",
"source": "github",
"line_count": 111,
"max_line_length": 81,
"avg_line_length": 30.126126126126128,
"alnum_prop": 0.5891148325358851,
"repo_name": "jackzhao-mj/ok-client",
"id": "6a51b4774b861df73d01f1fce525b9471306c366",
"size"... |
import math
import os
import requests
from utils import spiral_stepper
class SatImageCollector(object):
"""
Given a latitude, longitude and some other constraints (like zoom level) the
object can collect satellite images from the Google Maps API in spiral steps
around the initial location.
"""
... | {
"content_hash": "fe3042c6bd331c5f663c1ff77736e6c8",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 97,
"avg_line_length": 35.51776649746193,
"alnum_prop": 0.5673860225811062,
"repo_name": "BradAJ/satclass",
"id": "ed549a2b236da17bf9e685d40095412fa7e98de6",
"size": "6997... |
"""
This module responsible for postprocessing the SpirV Metadata
All the stringly typed references will be linked during this stage.
"""
from typing import Dict
from typing import Optional
from typing import Union
from vulkan_generator.vulkan_parser.internal import internal_types
from vulkan_generator.vulkan_parse... | {
"content_hash": "2795cb440c1b41b653324f768f93c202",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 118,
"avg_line_length": 44.15217391304348,
"alnum_prop": 0.6745445593303792,
"repo_name": "google/agi",
"id": "30b9ead636cd37cbf2672e5c8f65a1247a06c97d",
"size": "4643",
... |
from __future__ import absolute_import
import gpxpy
import gpxpy.gpx
import json
import time
from pokemongo_bot.base_task import BaseTask
from pokemongo_bot.cell_workers.utils import distance
from pokemongo_bot.cell_workers.utils import format_dist
from pokemongo_bot.cell_workers.utils import i2f
from pokemongo_bot.hum... | {
"content_hash": "a3dd7e532c65464dafd341cfac85375c",
"timestamp": "",
"source": "github",
"line_count": 229,
"max_line_length": 162,
"avg_line_length": 36.30567685589519,
"alnum_prop": 0.5442626894394996,
"repo_name": "dtee/PokemonGo-Bot",
"id": "6b3274c4b49cb189ea622d0ef22bdebb01ff2103",
"size": "... |
'''
Created on Nov 21, 2014
@author: hijungshin
'''
from visualobjects import VisualObject
import sys
import util
import processframe as pf
import os
import cv2
from video import Video
def remove_duplicate_pixels(visobj, panorama_fg, cleanupdir):
"""objects appear only once, related to first time that they appe... | {
"content_hash": "a25f939f2e4eca089d87eea111060d72",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 134,
"avg_line_length": 34.070754716981135,
"alnum_prop": 0.5987816696663436,
"repo_name": "adobe-research/video-lecture-summaries",
"id": "c276fb8c5efffb8eac6a5c0155dc956f1... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class UserProfile(models.Model):
user = models.OneToOneField(User, unique=True)
birth = models.DateField(blank=True, null=True)
phone = models.CharField(max_length=20, null=True)
def __str__(self):
... | {
"content_hash": "a6c999bc0641c43e53c33f29e5fe3c03",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 61,
"avg_line_length": 34.08,
"alnum_prop": 0.7053990610328639,
"repo_name": "glon/django_test",
"id": "29076521f362675453f9c082b5356ec0ba0b78c0",
"size": "852",
"binary"... |
from __future__ import absolute_import
import io
import os
import re
from setuptools import setup
DISCSI_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'src', 'datera', 'datera_iscsi.py')
README_FILE = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'README.rst')
VRE = re... | {
"content_hash": "ee783cd049ee446f4e3c888acd813b8b",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 78,
"avg_line_length": 29.555555555555557,
"alnum_prop": 0.6611170784103115,
"repo_name": "Datera/cinder-driver",
"id": "86840ba1b6b97f1c60a57a924384e1b98a116965",
"size": ... |
from django.conf.urls import url, patterns
from views import PlenumMeetingsListView, PlenumView
from committees.models import CommitteeMeeting
from committees.views import MeetingDetailView
meetings_list = PlenumMeetingsListView.as_view(
queryset=CommitteeMeeting.objects.all(), paginate_by=20)
plenumurlpatterns ... | {
"content_hash": "20fd994b8c9df25979667d02ea3c4afe",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 111,
"avg_line_length": 48.06666666666667,
"alnum_prop": 0.6005547850208044,
"repo_name": "daonb/Open-Knesset",
"id": "d8155ef37b2bf01a0aafc1dff2d733607f081924",
"size": "7... |
from datetime import timedelta
from typing import Optional, Union
from appium.options.common.supports_capabilities import SupportsCapabilities
WAIT_FOR_QUIESCENCE = 'waitForQuiescence'
class WaitForQuiescenceOption(SupportsCapabilities):
@property
def wait_for_quiescence(self) -> Optional[bool]:
"""... | {
"content_hash": "2bb8c4ebea4d3122c32eaaed617746cb",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 86,
"avg_line_length": 37.52,
"alnum_prop": 0.7132196162046909,
"repo_name": "appium/python-client",
"id": "b8be7f3221a5a4c64a1beab7b9e2d0674e5316a8",
"size": "1726",
"bi... |
"""Config for EC2.
Block {Min:0, init:1, Max:1}
==================
| ++++++++++++++ |
| | Node | |
| | | |
| | Task Task | |
| | | |
| ++++++++++++++ |
==================
"""
from parsl.providers import AWSProvider
from parsl.config import Config
from parsl.executors.ipp import IPyParall... | {
"content_hash": "53298dc22e9a86cd8e5be5fd823c81a2",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 107,
"avg_line_length": 30.767441860465116,
"alnum_prop": 0.5238095238095238,
"repo_name": "swift-lang/swift-e-lab",
"id": "e22556e3c04af23fad21108d1aa366dec77b808d",
"size... |
'''
Hubble Nova plugin for running arbitrary commands and checking the output of
those commands
This module is deprecated, and must be explicitly enabled in pillar/minion
config via the hubblestack:nova:enable_command_module (should be set to True
to enable this module). This allows nova to run arbitrary commands via ... | {
"content_hash": "18af4e2ee41aec4d9f3eac0f4a283c64",
"timestamp": "",
"source": "github",
"line_count": 224,
"max_line_length": 96,
"avg_line_length": 36.5625,
"alnum_prop": 0.49511599511599513,
"repo_name": "HubbleStack/Nova",
"id": "70fd6b8861fc883a10306664765ff6ba813c5305",
"size": "8216",
"bi... |
"""Tests for light platform."""
from unittest.mock import patch
from pyHS100 import SmartBulb
from homeassistant.components import tplink
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
ATTR_HS_COLOR,
DOMAIN as LIGHT_DOMAIN,
)
from homeassistant.components.tplink.common ... | {
"content_hash": "fe4d6bc69648bfe03d7728f249a1c8f8",
"timestamp": "",
"source": "github",
"line_count": 220,
"max_line_length": 150,
"avg_line_length": 29.363636363636363,
"alnum_prop": 0.5263157894736842,
"repo_name": "leppa/home-assistant",
"id": "8d1d4d94738884d61ebf918ad41d64f4cbbde195",
"size"... |
import os
import re
import locale
import logging
import subprocess
from io import open
import click
import sqlparse
from . import export
from .main import special_command, NO_QUERY, PARSED_QUERY
from .favoritequeries import favoritequeries
from .utils import handle_cd_command
TIMING_ENABLED = False
use_expanded_outp... | {
"content_hash": "87716544c808161e1e84d493d073a53f",
"timestamp": "",
"source": "github",
"line_count": 242,
"max_line_length": 153,
"avg_line_length": 29.75206611570248,
"alnum_prop": 0.6120833333333333,
"repo_name": "mdsrosa/mycli",
"id": "415e33d3e258f1cbef7ead5cafd235915d4a47fe",
"size": "7200"... |
"""This module contains various utility functions."""
import inspect
import itertools
import math
import ast
import os
import tokenize
import copy
from types import LambdaType
# pylint: disable=unused-import
from typing import (Callable, Dict, Iterator, List, NamedTuple, Optional, Sequence, Tuple, TypeVar, cast, Union... | {
"content_hash": "18585546e12f228bcf0dc6de175ca2fb",
"timestamp": "",
"source": "github",
"line_count": 651,
"max_line_length": 120,
"avg_line_length": 35.30414746543779,
"alnum_prop": 0.5920462950876735,
"repo_name": "HPAC/matchpy",
"id": "4ea1c8d7f1d1d41181339d433863b22bd0a8ef1c",
"size": "23029"... |
"""
Unit Tests for nova.console.rpcapi
"""
from oslo.config import cfg
from nova.console import rpcapi as console_rpcapi
from nova import context
from nova.openstack.common import rpc
from nova import test
CONF = cfg.CONF
class ConsoleRpcAPITestCase(test.NoDBTestCase):
def _test_console_api(self, method, rpc_m... | {
"content_hash": "9eebd9c78235fa8714e696373387bb3f",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 77,
"avg_line_length": 35.5,
"alnum_prop": 0.608547838756678,
"repo_name": "sacharya/nova",
"id": "fa591ffa4f7509474d179a9877bc066038c1f82b",
"size": "2711",
"binary": fa... |
from Config.settings import LOGHOME
from HelpDesk.desks.coaches import CoachesHelpDesk
from logging import error, exception, info, basicConfig
from logging import _nameToLevel as nameToLevel
from argparse import ArgumentParser
from sys import exc_info
from os.path import exists, join
from os import mkdir
__author__ = ... | {
"content_hash": "e37ae43171bb9bdec0e1085dfcba0d0f",
"timestamp": "",
"source": "github",
"line_count": 56,
"max_line_length": 98,
"avg_line_length": 29.660714285714285,
"alnum_prop": 0.6556291390728477,
"repo_name": "flopezag/fiware-management-scripts",
"id": "de026b54fc1528fabd262c2b0060bba2611237b... |
"""Backend compiler related feature registration"""
# pylint: disable=invalid-name,unused-argument, len-as-condition, too-many-nested-blocks,
# pylint: disable=too-many-local-variables, too-many-arguments, no-else-return
from __future__ import absolute_import
import tvm
from tvm import te, topi
from tvm.runtime impor... | {
"content_hash": "c3f3a55246ec5c7b472241f56817ca2b",
"timestamp": "",
"source": "github",
"line_count": 1180,
"max_line_length": 100,
"avg_line_length": 32.45338983050848,
"alnum_prop": 0.5898420159289725,
"repo_name": "Laurawly/tvm-1",
"id": "76c806905b18555a61a678df044d6b73d071ae0e",
"size": "390... |
"""
Module for persistent variables, config settings etc
"""
import sqlite3
import os
import vc.util
def get(name, default = ''):
"""
Fetch a string variable, if not exists return default
"""
if vc.globals.OS == "windows" :
from win32com.shell import shell,shellcon
home = shell.SHGetFo... | {
"content_hash": "32ef0407a4d76a3f763d254e66641d65",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 91,
"avg_line_length": 25.941176470588236,
"alnum_prop": 0.6009070294784581,
"repo_name": "Lussarn/vcontrol-log-analyzer",
"id": "e465e5c5e438089807bbfb460ab8099e24c406b3",
... |
import os
from flask import Flask
from flask_mail import Mail
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
from flask_assets import Environment
from flask_wtf import CsrfProtect
from flask_compress import Compress
from flask_rq import RQ
from config import config
from .assets import app... | {
"content_hash": "fcbfb9a82de85bb076477e1b876e476e",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 77,
"avg_line_length": 33.10227272727273,
"alnum_prop": 0.7181599725369036,
"repo_name": "hack4impact/maps4all",
"id": "97a259f052ca0bf74d83a78d8e769b31366c3884",
"size": "... |
import os
from traitlets import default, Unicode
from traitlets.config.application import catch_config_error
from .baseapp import NbGrader
class GenerateConfigApp(NbGrader):
name = u'nbgrader-generate-config'
description = u'Generates a default nbgrader_config.py file'
examples = ""
filename = Unic... | {
"content_hash": "b9591ed2d1ea7683ed43ed349f1a236b",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 78,
"avg_line_length": 28.916666666666668,
"alnum_prop": 0.6628242074927954,
"repo_name": "jupyter/nbgrader",
"id": "110d1442e74cd9a97304ba8f2ff79a8acf3fc175",
"size": "105... |
from __future__ import absolute_import, print_function, unicode_literals
import os
import io
import unittest
import subprocess
import tempfile
import shutil
import types
import threading
import time
from vcstools import GitClient
from vcstools.vcs_base import VcsError
try:
from socketserver import TCPServer, Bas... | {
"content_hash": "49144a112a73f609ddef1ae4c58a119c",
"timestamp": "",
"source": "github",
"line_count": 776,
"max_line_length": 856,
"avg_line_length": 46.64819587628866,
"alnum_prop": 0.6581673526893008,
"repo_name": "wkentaro/vcstools",
"id": "b250f8f8500cbb84eff5847c88ea80e8bd12e7c8",
"size": "3... |
'''
testdict.py
(c) Will Roberts 25 February, 2015
Unit tests for the redblack.rbdict class.
'''
import random
import unittest
from .. import redblack
class TestDict(unittest.TestCase):
@unittest.expectedFailure
def test_ctor_none(self):
# dict(None) raises TypeError
# redblack.rbdict does ... | {
"content_hash": "48a968e23728aa68caee52694e46f495",
"timestamp": "",
"source": "github",
"line_count": 141,
"max_line_length": 71,
"avg_line_length": 35.39716312056738,
"alnum_prop": 0.5073131636946504,
"repo_name": "wroberts/pyredblack",
"id": "351e9db7cfaf3044a6f32add598a19ecbbb3daee",
"size": "... |
from django.conf import settings
from django.shortcuts import render_to_response, get_object_or_404
from django.http import HttpResponseRedirect
from django.core.exceptions import ObjectDoesNotExist
from django.template import RequestContext
from django.db.models import Q
from django.views.generic import TemplateView
... | {
"content_hash": "0ca19f4af62ee3fb11f364a1e06e033b",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 119,
"avg_line_length": 38.44615384615385,
"alnum_prop": 0.7046818727490997,
"repo_name": "aawsolutions/bslcks",
"id": "93ae871d92d7bbfcd6bfb51e4867c249db0f1aac",
"size": "... |
'''Communicate with local or remote peercoin-daemon via JSON-RPC'''
from operator import itemgetter
from pypeerassets.constants import param_query, params
try:
from peercoin_rpc import Client
except:
raise EnvironmentError("peercoin_rpc library is required for this to work,\
use pi... | {
"content_hash": "3e739612ef2cd2656bcd92b5a49523c1",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 102,
"avg_line_length": 32.833333333333336,
"alnum_prop": 0.5647208121827412,
"repo_name": "backpacker69/pypeerassets",
"id": "f20cfa11c73abd87ce332e8c7abb0025ce8460dd",
"s... |
from liblas import file
from liblas import srs
import sys
def line_prepend(filename,line):
with open(filename,'r+') as f:
content = f.read()
f.seek(0,0)
f.write(line.rstrip('\r\n') + '\n' + content)
def las2ply(inputFile,outputFile):
# Open the LAS file and reproject to Pseudo-Mercator
... | {
"content_hash": "65212b2d9018f1d2d4758a82b74ffc55",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 97,
"avg_line_length": 28.456521739130434,
"alnum_prop": 0.6867838044308633,
"repo_name": "tangrams/LIDar-tools",
"id": "74629de493ae8de57dda36c66c184dcdbe1c06bf",
"size": ... |
"""
"""
from datetime import datetime
from vnpy.api.mini import (
THOST_FTDC_OAS_Submitted,
THOST_FTDC_OAS_Accepted,
THOST_FTDC_OAS_Rejected,
THOST_FTDC_OST_NoTradeQueueing,
THOST_FTDC_OST_PartTradedQueueing,
THOST_FTDC_OST_AllTraded,
THOST_FTDC_OST_Canceled,
THOST_FTDC_D_Buy,
THOS... | {
"content_hash": "69afd7b2bd9bf1248c18e9a2841b8b88",
"timestamp": "",
"source": "github",
"line_count": 817,
"max_line_length": 99,
"avg_line_length": 29.828641370869033,
"alnum_prop": 0.5620845301600328,
"repo_name": "msincenselee/vnpy",
"id": "0a96ef87202ccf19c739fe8561aa015f2813b85a",
"size": "2... |
"""Contains the logic for `aq show continent --continent`."""
from aquilon.aqdb.model import Continent
from aquilon.worker.broker import BrokerCommand
class CommandShowContinentContinent(BrokerCommand):
required_parameters = ["continent"]
def render(self, session, continent, **_):
return Continent.... | {
"content_hash": "da6505ed0a41b73ec8fe1181e2192a8a",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 68,
"avg_line_length": 30.333333333333332,
"alnum_prop": 0.75,
"repo_name": "guillaume-philippon/aquilon",
"id": "f5ada4b4d0d3a9f474b2933ecc81f013767f7b10",
"size": "1072",... |
"""
Copyright 2012 GroupDocs.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in w... | {
"content_hash": "2eb48c645e0f6530713b4d0b037a700e",
"timestamp": "",
"source": "github",
"line_count": 37,
"max_line_length": 77,
"avg_line_length": 30.756756756756758,
"alnum_prop": 0.6476274165202109,
"repo_name": "liosha2007/temporary-groupdocs-python-sdk",
"id": "ed9d3e2cd7e45b6333b3389e7b9eb25c... |
from django.db import models
# Create your models here.
class DatedModel(models.Model):
birth_date = models.DateTimeField(auto_now_add=True)
mod_date = models.DateTimeField(auto_now=True)
class Project(DatedModel):
name = models.CharField(max_length=5000)
slug = models.SlugField()
description = models.Text... | {
"content_hash": "449c040a0fc143a78577175792f691f2",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 68,
"avg_line_length": 28.076923076923077,
"alnum_prop": 0.7452054794520548,
"repo_name": "hackedhead/shelves-proto",
"id": "54b9fe22e19b6e2d1761cbc9cc64c9fd70db9329",
"siz... |
"""
This module implements WSGI related helpers adapted from ``werkzeug.wsgi``
:copyright: (c) 2010 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import urllib
# `get_host` comes from `werkzeug.wsgi`
def get_host(environ):
"""Return the real host for the giv... | {
"content_hash": "17b4d17540b48fb5ebf2998527f47b42",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 78,
"avg_line_length": 37.096774193548384,
"alnum_prop": 0.6243478260869565,
"repo_name": "mitsuhiko/raven",
"id": "b8213d2ec51cd40182bd98d5e84b68f75dedd12c",
"size": "2300... |
'''
Created on Nov 5, 2016
@author: Admin
'''
from AudioPlayer import *
class MediaPlayerClass:
_audio_player = AudioPlayerClass()
_audio_extensions = ['flac', 'mp3']
def play(self, title):
if title.split('.')[1] in self._audio_extensions:
self._audio_player.play_song(title... | {
"content_hash": "990ee92483864d5787adc80f89d8c2e2",
"timestamp": "",
"source": "github",
"line_count": 18,
"max_line_length": 57,
"avg_line_length": 21.11111111111111,
"alnum_prop": 0.5868421052631579,
"repo_name": "lucafon/DesignPatterns",
"id": "c83d841d155edabb17a469848a58b567b3aeab8b",
"size":... |
"""Unit tests for `tensorboard.manager`."""
import dataclasses
import datetime
import errno
import json
import os
import re
import tempfile
from unittest import mock
from tensorboard import manager
from tensorboard import test as tb_test
from tensorboard import version
from tensorboard.util import tb_logging
def _... | {
"content_hash": "999ce27c85f324cb062f0aa3c60ffb6e",
"timestamp": "",
"source": "github",
"line_count": 377,
"max_line_length": 80,
"avg_line_length": 38.03183023872679,
"alnum_prop": 0.5931789649881434,
"repo_name": "tensorflow/tensorboard",
"id": "d612caf873cba83733dc9aede4b2c14908445823",
"size"... |
from datetime import datetime, timedelta
from numbers import Number
from random import choice, uniform, gauss, random, randint
from typing import List, Union
from plenum.common.metrics_collector import MetricsName, MetricsEvent, MetricsCollector
from plenum.common.value_accumulator import ValueAccumulator
def gen_me... | {
"content_hash": "04114e73e05bf3121144f06eda32f5d6",
"timestamp": "",
"source": "github",
"line_count": 68,
"max_line_length": 87,
"avg_line_length": 29.573529411764707,
"alnum_prop": 0.6270512182993535,
"repo_name": "evernym/zeno",
"id": "02b3a5d88a43f848a145ecfa8fbb9676825d1c87",
"size": "2011",
... |
from flask import Flask, request, render_template, url_for
from nltk.corpus import wordnet as wn
import nltk.data
import csv
from collections import defaultdict
import re
from nltk.corpus import stopwords
import unicodedata
import cgi
from util import *
stopwords = stopwords.words('english')
app = Flask(__name__)
@a... | {
"content_hash": "823badda4047fe2a369c66085213d8de",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 137,
"avg_line_length": 28.970588235294116,
"alnum_prop": 0.6862944162436548,
"repo_name": "adamobeng/chirp",
"id": "d8a8c1630f146a0fe6548cebab8d4e92bc2f5dd2",
"size": "985... |
from builtins import object
import logging
import time
import json
from desktop.lib.rest.http_client import HttpClient
from sqoop.client.link import Link
from sqoop.client.job import Job
from sqoop.client.connector import Connector
from sqoop.client.driver import Driver
from sqoop.client.exception import SqoopExcept... | {
"content_hash": "1fab4714eb902165a8074f20008ad70e",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 118,
"avg_line_length": 35.65865384615385,
"alnum_prop": 0.6660374814615073,
"repo_name": "kawamon/hue",
"id": "b9bcbf4aea4a8287a605f89f0591229156e0371b",
"size": "8187",
... |
import time
from SimpleCV import *
from SimpleCV.Display import Display, pg
cam = Camera() #initialize the camera
done = False # setup boolean to stop the program
max_threshold = 500 # this is used for the edge detection
threshold_step = 0.5 # this is the amount to adjust the threshold by each time the display is upda... | {
"content_hash": "92ce845548ec1b0a2c91851731d76df4",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 107,
"avg_line_length": 33.81481481481482,
"alnum_prop": 0.7207009857612268,
"repo_name": "nikhilgk/SimpleCV",
"id": "bfe26882f6badb071c91879d447f986c3615fa6d",
"size": "11... |
name = "Correction for interaction distance 1"
shortDesc = u""
longDesc = u"""
"""
| {
"content_hash": "622f486e926c898167ada18f048432fe",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 46,
"avg_line_length": 16.8,
"alnum_prop": 0.6666666666666666,
"repo_name": "Molecular-Image-Recognition/Molecular-Image-Recognition",
"id": "7db2e54eada696dd3dddee812a6e66f99... |
class MDP(object):
def call(self,input_arrs):
"""
Call the mdp
"""
raise NotImplementedError
def initialize_mdp_arrays(self):
raise NotImplementedError
def input_info(self):
"""
mapping from name -> (size, dtype)
"""
raise NotImpleme... | {
"content_hash": "4b3e32e78c2f01d744578df7eea3ee6b",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 76,
"avg_line_length": 28.47761194029851,
"alnum_prop": 0.5476939203354297,
"repo_name": "SFPD/rlreloaded",
"id": "21a3edbb7dc37982b957850e896e9b67d273f98d",
"size": "1908"... |
from model.contact import Contact
from fixture.string_helper import *
import os.path
import jsonpickle
import getopt
import sys
try:
opts, arga = getopt.getopt(sys.argv[1:], "n:f:", ["number of contacts", "file"])
except getopt.GetoptError as err:
getopt.usage()
sys.exit(2)
n = 1
f = "data/contacts.json"... | {
"content_hash": "f97f7976574c2231914d41e6ab8590e8",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 88,
"avg_line_length": 32.2093023255814,
"alnum_prop": 0.540072202166065,
"repo_name": "obutkalyuk/Python_15",
"id": "a084a450fc622a9ed24e81b96b56f5d39efc3c0f",
"size": "13... |
import proto
from typing import Dict, List, NamedTuple, Optional, Sequence, Tuple, Union
from google.api_core import operation
from google.api_core import exceptions as api_exceptions
from google.auth import credentials as auth_credentials
from google.cloud import aiplatform
from google.cloud.aiplatform import base
f... | {
"content_hash": "203ff769e674a51ece7560b51afc11c2",
"timestamp": "",
"source": "github",
"line_count": 2366,
"max_line_length": 151,
"avg_line_length": 48.60143702451395,
"alnum_prop": 0.6166917410927811,
"repo_name": "sasha-gitg/python-aiplatform",
"id": "4af337b3e81e41b112342bafe46551969f5e5316",
... |
from collections import Iterable
import collections
import sys
if sys.version_info.major > 2:
basestring = str
def to_str(item):
return bytearray.decode(item) if isinstance(item, bytearray) else str(item)
def listify(item, default=None, itemlen=0):
"""
Convert C{item} to a list if it isn't one alr... | {
"content_hash": "50b96a47348d6c5147e4a4ceeaa825fc",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 104,
"avg_line_length": 22.929577464788732,
"alnum_prop": 0.5792383292383292,
"repo_name": "cts2/rf2db",
"id": "d5373ec8df928c61ec5bd38bed95ccb215c75ce6",
"size": "3201",
... |
"""This example creates a flash in-page creative.
Requires a flash asset, backup image asset, and an advertiser ID as input.
To get an advertiser ID, run get_advertisers.py.
"""
import argparse
import sys
from apiclient import sample_tools
from apiclient.http import MediaFileUpload
from oauth2client import client
#... | {
"content_hash": "f7ae46d1db9015fa1607eff061917d87",
"timestamp": "",
"source": "github",
"line_count": 119,
"max_line_length": 79,
"avg_line_length": 32.924369747899156,
"alnum_prop": 0.6727922409392547,
"repo_name": "falbassini/googleads-dfa-reporting-samples",
"id": "71d767b927f4fbbd8f999c40245312... |
import signal
from pants.backend.python.targets.python_binary import PythonBinary
from pants.backend.python.tasks.python_execution_task_base import PythonExecutionTaskBase
from pants.base.exceptions import TaskError
from pants.base.workunit import WorkUnitLabel
from pants.util.osutil import safe_kill
class PythonRun... | {
"content_hash": "b75125cf88ef471fb864ea690f7a62fd",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 96,
"avg_line_length": 40.25581395348837,
"alnum_prop": 0.6013864818024264,
"repo_name": "wisechengyi/pants",
"id": "7d3a58024b34f404861fd6704db699afbe34f11c",
"size": "186... |
from __future__ import print_function
import os
import string
from io import StringIO
from rdkit.six import string_types
import glob
LINEEND = '\015\012'
##########################################################
#
# image compression helpers. Preprocessing a directory
# of images will offer a vast speedup.
#
####... | {
"content_hash": "0259462f6aaf734ce7095d5ba37e55d2",
"timestamp": "",
"source": "github",
"line_count": 312,
"max_line_length": 104,
"avg_line_length": 33.6025641025641,
"alnum_prop": 0.5808851583365128,
"repo_name": "adalke/rdkit",
"id": "d908447405b8eca675cfd4f97b6a8caa737ec71a",
"size": "10573",... |
from __future__ import annotations
import copy
import datetime
import fnmatch
import logging
import time
from typing import Any
from typing import Dict
from typing import Iterable
from typing import List
from typing import Optional
from typing import Set
from typing import Tuple
from typing import Union
from typing im... | {
"content_hash": "86ffb65df2ae84cfb63b06bb5cba4fbe",
"timestamp": "",
"source": "github",
"line_count": 829,
"max_line_length": 102,
"avg_line_length": 35.72496984318456,
"alnum_prop": 0.5749594813614263,
"repo_name": "Netflix/repokid",
"id": "96bfd691c371e4b03afe40b5e8395574c39941d3",
"size": "302... |
import time
import numpy
import logging
from .basebot import DIRECTIONS, LightCycleBaseBot
from .worker import RemoteInstance
logger = logging.getLogger(__name__)
class LightCycleArena(object):
PLAYING = 0
LOST = 1
WINNER = 2
def __init__(self, players, width=100, height=100):
self.width =... | {
"content_hash": "16342aa44fcd36cb42e674db05783ecd",
"timestamp": "",
"source": "github",
"line_count": 134,
"max_line_length": 119,
"avg_line_length": 38.23134328358209,
"alnum_prop": 0.5256685535818856,
"repo_name": "Onapsis/pytron",
"id": "5be90080e838dc8d30d4ebddbd281c3cd3d29903",
"size": "5141... |
"""
Tests For CellStateManager
"""
import datetime
import time
import mock
from oslo_config import cfg
from oslo_db import exception as db_exc
from oslo_utils import timeutils
import six
from nova.cells import state
from nova.db.sqlalchemy import models
from nova import exception
from nova import objects
from nova i... | {
"content_hash": "498382389063cf98a2345ae61a9729ee",
"timestamp": "",
"source": "github",
"line_count": 360,
"max_line_length": 79,
"avg_line_length": 36.486111111111114,
"alnum_prop": 0.6032736962314427,
"repo_name": "dims/nova",
"id": "7f72a3d9f4ffbf1f6109deaf867cacefe694cb5b",
"size": "13771",
... |
from expfactory.defaults import EXPFACTORY_DATABASE
if EXPFACTORY_DATABASE == "filesystem":
from .filesystem import *
else:
from .relational import *
if EXPFACTORY_DATABASE.startswith("sqlite"):
from .sqlite import *
| {
"content_hash": "d17c74b1393865a8189ed6f94d1e545c",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 51,
"avg_line_length": 26.555555555555557,
"alnum_prop": 0.7196652719665272,
"repo_name": "expfactory/expfactory",
"id": "6df2506f3625ea63c6bc971197b8a1fac0029dca",
"size": ... |
from typing import Any, Callable, Dict, List, Optional, TypeVar
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.p... | {
"content_hash": "4113efb567baf1f984050f546611fa3d",
"timestamp": "",
"source": "github",
"line_count": 380,
"max_line_length": 221,
"avg_line_length": 42.502631578947366,
"alnum_prop": 0.6469568447774131,
"repo_name": "Azure/azure-sdk-for-python",
"id": "2cacd805dd3f12cae0690de5cdb5f7aacd3e5cf1",
... |
__all__ = ("delphi",
)
import templates.Delphi.delphi
| {
"content_hash": "26ca7ebd3d0117ee192d089b8f21f3b3",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 30,
"avg_line_length": 16.5,
"alnum_prop": 0.5454545454545454,
"repo_name": "flavour/eden",
"id": "f1f9edd0b0b6b13b4431d1c8eba7750ee6601387",
"size": "66",
"binary": false... |
"""
pysteps.utils.transformation
============================
Methods for transforming data values.
.. autosummary::
:toctree: ../generated/
boxcox_transform
dB_transform
NQ_transform
sqrt_transform
"""
import numpy as np
import scipy.stats as scipy_stats
import warnings
from s... | {
"content_hash": "3fcce95955a96226cf4e47a9f850cfa3",
"timestamp": "",
"source": "github",
"line_count": 383,
"max_line_length": 88,
"avg_line_length": 30.013054830287206,
"alnum_prop": 0.5734667246628969,
"repo_name": "pySTEPS/pysteps",
"id": "46be85ab34fd30f66d82250a037c5074e6a34527",
"size": "115... |
import cyclone.web
class MainHandler(cyclone.web.RequestHandler):
def get(self):
self.write("Hello, world")
class Application(cyclone.web.Application):
def __init__(self):
cyclone.web.Application.__init__(self, [(r"/", MainHandler)],
xheaders=False)
| {
"content_hash": "a657124d1ebf3eda69bad5527002bbf6",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 69,
"avg_line_length": 26.583333333333332,
"alnum_prop": 0.5862068965517241,
"repo_name": "fiorix/cyclone",
"id": "321af987703da5a510ccf6c6785f97b5dc495cc5",
"size": "1256"... |
"""Tests for estimators.linear."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import json
import sys
import tempfile
# TODO: #6568 Remove this hack that makes dlopen() not crash.
if hasattr(sys, 'getdlopenflags') and hasattr(sys, 'set... | {
"content_hash": "d665dd3523d89e0b91fc2978c056a6fe",
"timestamp": "",
"source": "github",
"line_count": 1637,
"max_line_length": 91,
"avg_line_length": 38.810018326206475,
"alnum_prop": 0.6102436567399105,
"repo_name": "tomasreimers/tensorflow-emscripten",
"id": "ad122fcaaa276f7bb05c8b1a2d50eb8d3e67e... |
from textwrap import dedent
from pontoon.base.tests import assert_attributes_equal, TestCase, UserFactory
from pontoon.base.utils import aware_datetime
from pontoon.sync import KEY_SEPARATOR
from pontoon.sync.formats import po
from pontoon.sync.tests.formats import FormatTestsMixin
BASE_POFILE = """
#
msgid ""
msgst... | {
"content_hash": "a9c02e2970d8574a1515b8d31a5d0106",
"timestamp": "",
"source": "github",
"line_count": 386,
"max_line_length": 77,
"avg_line_length": 27.78497409326425,
"alnum_prop": 0.5448951048951048,
"repo_name": "mozilla/pontoon",
"id": "3bd98c02cb824554a3aa5c868ccc99dc7e5fc044",
"size": "1072... |
"""
:Author Patrik Valkovic
:Created 04.07.2017 19:45
:Licence MIT
Part of grammpy
"""
from typing import Any
from .support._RuleConnectable import _RuleConnectable
class Terminal(_RuleConnectable):
'''
Represent Terminal in formal grammar.
'''
def __init__(self, symbol):
# type: (Any) -> T... | {
"content_hash": "1295fe97f071cfa82188884007bc3f67",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 60,
"avg_line_length": 23.406779661016948,
"alnum_prop": 0.5445329471397538,
"repo_name": "PatrikValkovic/grammpy",
"id": "701729f5ae2b0dad0633d59d93eeb297438d9329",
"size"... |
"""Module invoked via `python3 -m alien_wallpaper`."""
if __name__ == "__main__":
from .console import main
main()
| {
"content_hash": "3fa45e134fdbffe7d5036c15c7ca1dd5",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 54,
"avg_line_length": 20.833333333333332,
"alnum_prop": 0.584,
"repo_name": "rgardner/Alien-Wallpaper",
"id": "6502c8d8c46734ce006844c01876aa6594340a79",
"size": "125",
"... |
import os
from datetime import datetime
from uuid import uuid4
import gevent
from flask import Blueprint
from flask import request, render_template, copy_current_request_context
from werkzeug.utils import secure_filename
from bynge.lib.processor.audio import AudioFileProcessor
from bynge.models import IncomingFile
fr... | {
"content_hash": "063a99cec57f37762a888eb96b6bf76c",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 119,
"avg_line_length": 32.666666666666664,
"alnum_prop": 0.6952380952380952,
"repo_name": "gutmensch/bynge",
"id": "82a7777578af63f8886646f48676f5b3ae9ac722",
"size": "147... |
import dask
import pytest
from distributed.protocol import loads, dumps, msgpack, maybe_compress, to_serialize
from distributed.protocol.compression import compressions
from distributed.protocol.serialize import Serialize, Serialized, serialize, deserialize
from distributed.system import MEMORY_LIMIT
from distributed.... | {
"content_hash": "e8c8b77faea2773cef771d8fc215ad6b",
"timestamp": "",
"source": "github",
"line_count": 222,
"max_line_length": 88,
"avg_line_length": 28.292792792792792,
"alnum_prop": 0.6108899856710714,
"repo_name": "blaze/distributed",
"id": "6c8296edecbca35c7da85687e3f20ae6c19b0775",
"size": "6... |
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
def runtests():
from django.core.management import execute_from_command_line
os.environ.setdefault(
"DJANGO_SETTINGS_MODULE",
"test_project.settings"
)
argv = [sys.argv[0], 'test', '--verbosity=2... | {
"content_hash": "8891025375a1e44d4cef8b7bee23049d",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 64,
"avg_line_length": 20.9,
"alnum_prop": 0.6220095693779905,
"repo_name": "rcmachado/django-pieguard",
"id": "f44cb39fa14acc1a46d9616b3306b7e0acbfc8d3",
"size": "440",
... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'StatsCache.threshold'
db.add_column('Viewer_statscache', 'threshold', self.gf('django.db.models.fields.Float... | {
"content_hash": "954f34d9643623ac4641243ef5a0d94f",
"timestamp": "",
"source": "github",
"line_count": 153,
"max_line_length": 185,
"avg_line_length": 67.26143790849673,
"alnum_prop": 0.5636964337770868,
"repo_name": "abztrakt/labtracker",
"id": "6ad4dae54424f5f062db83bbe866b2860e3f9025",
"size": ... |
import numpy as np
def sart(sinogram: np.ndarray, angles: np.ndarray, initial: np.ndarray = None,
iterations: int = 1, count=None, max_count=None):
"""Simultaneous Algebraic Reconstruction Technique
SART computes an inverse of the Radon transform in two dimensions.
The reconstruction technique ... | {
"content_hash": "5657ad57f88ff9068d70a23fbc2214b7",
"timestamp": "",
"source": "github",
"line_count": 281,
"max_line_length": 78,
"avg_line_length": 41.00711743772242,
"alnum_prop": 0.5243426191096069,
"repo_name": "RI-imaging/radontea",
"id": "c59dc97a475618580665ec31327302f5ecd34045",
"size": "... |
import better_exceptions
better_exceptions.hook()
def div(x, y):
x / y
def cause(x, y):
try:
div(x, y)
except Exception:
raise ValueError("Division error")
def context(x, y):
try:
cause(x, y)
except Exception as e:
raise ValueError("Cause error") from e
context(1,... | {
"content_hash": "62d1b137b88ecd43303629865164bb78",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 46,
"avg_line_length": 17.05263157894737,
"alnum_prop": 0.5925925925925926,
"repo_name": "Qix-/better-exceptions",
"id": "a54ef9d66260e1603a1f360a721e61a2b52be721",
"size":... |
import click
import json
from os.path import expanduser, join as path_join
from beescripts.apis import BeeminderAPI, TrelloAPI
class Context(object):
def __init__(self, beeminder, trello):
self.beeminder = beeminder
self.trello = trello
@click.group()
@click.pass_context
def cli(ctx):
with... | {
"content_hash": "ebec3fc3977dd7badd6456b3922926ab",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 74,
"avg_line_length": 28.704545454545453,
"alnum_prop": 0.6516231195566112,
"repo_name": "wswld/eduard",
"id": "b433c505cae16e9436dae628ade5c16149a8bb4a",
"size": "1263",
... |
import sys
import py
from py._path import svnwc as svncommon
from common import CommonFSTests
class CommonSvnTests(CommonFSTests):
def test_propget(self, path1):
url = path1.join("samplefile")
value = url.propget('svn:eol-style')
assert value == 'native'
def test_proplist(self, path1)... | {
"content_hash": "51bc464d3ffa6a1bb9e9ae29da88658c",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 68,
"avg_line_length": 29.806451612903224,
"alnum_prop": 0.6168831168831169,
"repo_name": "lamby/pkg-codespeak-lib",
"id": "8d94a9ca649cd3139c04e4adaecd26550436f9a2",
"size... |
from citeproc import *
import json
STYLE = Style('./apa.csl')
print STYLE
REFS = json.loads(open('./refs.json').read())
print REFS
PROCESSED = process_bibliography(STYLE, REFS)
print PROCESSED
print format_bibliography(PROCESSED)
| {
"content_hash": "6754941a2398e7f0838b31ce7917fddf",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 45,
"avg_line_length": 23.2,
"alnum_prop": 0.7543103448275862,
"repo_name": "jasonzou/MyPapers",
"id": "021bfb60b41f09a9f691a0647335517dcdefe4f7",
"size": "233",
"binary"... |
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.geos import GEOSGeometry, MultiPolygon, Polygon, WKTWriter
def convert_geom_to_multipolygon(geom):
if isinstance(geom, Polygon):
return MultiPolygon(geom)
else:
return geom
def _remove_invalid_geometries(in_featu... | {
"content_hash": "1975e8a7cc379101f0f658ad98f52cf4",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 82,
"avg_line_length": 31.6875,
"alnum_prop": 0.6982248520710059,
"repo_name": "DemocracyClub/EveryElection",
"id": "28e03f82772aa4573dd234feed31a6d2354be123",
"size": "202... |
"""This module contains functions for filtering node and edge iterables.
It relies heavily on the concepts of `functional programming <https://en.wikipedia.org/wiki/Functional_programming>`_
and the concept of `predicates <https://en.wikipedia.org/wiki/Predicate_(mathematical_logic)>`_.
"""
from . import (
edge_f... | {
"content_hash": "3978b56ee18491786777e058ec0c30ba",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 117,
"avg_line_length": 29.53846153846154,
"alnum_prop": 0.7239583333333334,
"repo_name": "pybel/pybel",
"id": "e5e091ec13c7dd086c59e7d0eb769b8c59965275",
"size": "793",
... |
"""
mweigert@mpi-cbg.de
"""
from __future__ import absolute_import
from PyQt5 import QtGui
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from biobeam.beam_gui.fieldpanel import FieldPanel
from biobeam.beam_gui.fieldstate import CylindricalState, BeamState, LatticeState
class FieldListPanel(QtWidgets.QWidg... | {
"content_hash": "915f7eb16faab568c5bbde5ff5fdef9c",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 81,
"avg_line_length": 21.641975308641975,
"alnum_prop": 0.5978322875071307,
"repo_name": "maweigert/biobeam",
"id": "d15727bf25e4e19dea8bc37cff83bddad0fb2444",
"size": "17... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.