text stringlengths 4 1.02M | meta dict |
|---|---|
from flask import Blueprint, request, render_template, flash, redirect, url_for, g, make_response, jsonify
from flask_login import login_required, current_user
from flask_login import login_user
from flask_login import logout_user
from app import db, lm
from flask_cors import cross_origin
from app.forms.login_user impo... | {
"content_hash": "6525da76a97c2aa55af4466c0c7285cc",
"timestamp": "",
"source": "github",
"line_count": 74,
"max_line_length": 106,
"avg_line_length": 33.608108108108105,
"alnum_prop": 0.634097305991154,
"repo_name": "michaelnetbiz/mistt-solution",
"id": "a28974c16de0a20c8f8031a5bea1dc414f0b34cb",
... |
import numpy as np
import numpy.random as nr
class Exploration(object):
def __init__(self, env):
self.action_size = env.action_space.shape[0]
def add_noise(self, action, info={}):
pass
def reset(self):
pass
class OUExploration(Exploration):
# Reference: https://github.com/rllab/rllab/blob/master... | {
"content_hash": "89b3612f2c34768829e07c0578b668e8",
"timestamp": "",
"source": "github",
"line_count": 48,
"max_line_length": 101,
"avg_line_length": 26.729166666666668,
"alnum_prop": 0.661730319563523,
"repo_name": "carpedm20/NAF-tensorflow",
"id": "7bc0867d9cc87d29e3a680a60648113c1d68b973",
"siz... |
from flask import Flask
from mono.app import init_app
from mono.logger import init_task_logger
def init_task_app():
app = init_app(is_register_api=False)
init_task_logger(app, app.config.get('TASK_LOG_FILE', "monoreader_task.log"))
return app
task_app = init_task_app()
| {
"content_hash": "c6fcf9b0bae31e6fa8d632033051040a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 81,
"avg_line_length": 25.90909090909091,
"alnum_prop": 0.7157894736842105,
"repo_name": "ragnraok/MonoReader",
"id": "2f50add5fb90ddd216372a03d09322abf1223ddd",
"size": "2... |
def hello_string():
return 'hello!'
def hello():
print(hello_string())
| {
"content_hash": "28f5b3eac1e1456fb30eb555b162fdb3",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 23,
"avg_line_length": 12.833333333333334,
"alnum_prop": 0.6363636363636364,
"repo_name": "tdyas/pants",
"id": "75698dfa3e0ccc88a10edf5d3db1d7a411f7dc02",
"size": "210",
"... |
"""BaseModelCardField.
This class serves as a basic shared API between all Model Card data classes (
see model_card.py).
"""
import abc
import dataclasses
import json as json_lib
from typing import Any, Dict
from model_card_toolkit.utils import validation
from google.protobuf import descriptor
from google.protobuf i... | {
"content_hash": "cf35f4528422b51112154fb964f97505",
"timestamp": "",
"source": "github",
"line_count": 156,
"max_line_length": 116,
"avg_line_length": 39.6474358974359,
"alnum_prop": 0.6585286984640258,
"repo_name": "tensorflow/model-card-toolkit",
"id": "5d4e46e6d88ab8ec6a775fccd82a4a11019a415e",
... |
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
impo... | {
"content_hash": "827a431b24daf42fcd7693dd5d2460cf",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 119,
"avg_line_length": 25.55263157894737,
"alnum_prop": 0.7064881565396498,
"repo_name": "mindbody/API-Examples",
"id": "7af521101cb700a5f09f6b1d1ae6a8b48e14cc1d",
"size":... |
"""
from pymel.api.plugins import Command
class testCmd(Command):
def doIt(self, args):
print "doIt..."
testCmd.register()
cmds.testCmd()
testCmd.deregister()
"""
import sys
import inspect
import maya.OpenMayaMPx as mpx
import maya.cmds
global registeredCommands
registeredCommands = []
def _pluginMo... | {
"content_hash": "243b0533636133e7809f3811fdb03622",
"timestamp": "",
"source": "github",
"line_count": 130,
"max_line_length": 105,
"avg_line_length": 27.076923076923077,
"alnum_prop": 0.6539772727272727,
"repo_name": "cgrebeld/pymel",
"id": "6177852648e175bcee12275ed39f9f2620a823c0",
"size": "352... |
<<<<<<< HEAD
<<<<<<< HEAD
#
# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_JP_EXT
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_iso2022, codecs
import _multibytecodec as mbc
codec = _codecs_iso2022.getcodec('iso2022_jp_ext')
class Codec(codecs.Codec):
encode = codec.encode
decode ... | {
"content_hash": "b19a6d27069925af9b37b4e3871c7fc1",
"timestamp": "",
"source": "github",
"line_count": 123,
"max_line_length": 74,
"avg_line_length": 27.211382113821138,
"alnum_prop": 0.7012249775918733,
"repo_name": "ArcherSys/ArcherSys",
"id": "11343647272334fdf3f703bd5f54b360e916114f",
"size": ... |
import sqlite3
con = sqlite3.connect('users.db')
cur = con.cursor()
cur.execute('CREATE TABLE users (id INTEGER PRIMARY KEY, firstName VARCHAR(100), secondName VARCHAR(30))')
con.commit()
cur.execute('INSERT INTO users (id, firstName, secondName) VALUES(NULL, "Guido", "van Rossum")')
con.commit()
print cur.lastrowid
... | {
"content_hash": "a49befecbc53799579ca228748cebcf4",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 106,
"avg_line_length": 29.76923076923077,
"alnum_prop": 0.7390180878552972,
"repo_name": "janusnic/21v-python",
"id": "f2501e0313498c967aeb2ff0e83c4424737963e9",
"size": "... |
import numpy as np
from . import defHeaders_CBox_v3 as defHeaders
from . import test_suite
CBox = None
class CBox_tests_v3(test_suite.CBox_tests):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.loadSaveDataFile = False
@classmethod
def setUpClass(self):
... | {
"content_hash": "0df12267b99610d018c169c94f993a43",
"timestamp": "",
"source": "github",
"line_count": 405,
"max_line_length": 79,
"avg_line_length": 42.13086419753086,
"alnum_prop": 0.5550606575631484,
"repo_name": "DiCarloLab-Delft/PycQED_py3",
"id": "4225aa05a48f786c2fe9132c91ad3fa12917439a",
"... |
from socket import gaierror, gethostbyname
from urlparse import urlparse
from ansible.module_utils.basic import AnsibleModule # noqa: ignore=H303
from keystoneauth1.exceptions import MissingRequiredOptions
import netaddr
from openstack import connect
DOCUMENTATION = """
---
module: service_discovery
short_descripti... | {
"content_hash": "d2ea79636cb8325d9583c3c0100f01bb",
"timestamp": "",
"source": "github",
"line_count": 415,
"max_line_length": 79,
"avg_line_length": 38.08433734939759,
"alnum_prop": 0.5253400822524518,
"repo_name": "npawelek/rpc-maas",
"id": "37af49f7d9bea4eec7fa4bb9f061eace07f4493a",
"size": "16... |
import os
import redis
import urlparse
from werkzeug.wrappers import Request, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, NotFound
from werkzeug.wsgi import SharedDataMiddleware
from werkzeug.utils import redirect
from jinja2 import Environment, FileSystemLoader
clas... | {
"content_hash": "93278d1075f824982154f67c3ccf2712",
"timestamp": "",
"source": "github",
"line_count": 49,
"max_line_length": 93,
"avg_line_length": 34.734693877551024,
"alnum_prop": 0.6750881316098707,
"repo_name": "zzeleznick/zzeleznick.github.io",
"id": "1ef9b1d328fec13af25e394d092d32c86a40acf1",... |
"""
Django settings for mango project.
For more information on this file, see
https://docs.djangoproject.com/en/1.7/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.7/ref/settings/
"""
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
impo... | {
"content_hash": "991de6735f9c44ad6a3488181ba9183f",
"timestamp": "",
"source": "github",
"line_count": 104,
"max_line_length": 71,
"avg_line_length": 23.78846153846154,
"alnum_prop": 0.7134195634599838,
"repo_name": "joyinsky/tododjango",
"id": "5faad083a24a112a6b1175ec72354ac5eb48dd9e",
"size": "... |
from __future__ import annotations
import unittest
from airflow.api_connexion.schemas.health_schema import health_schema
class TestHealthSchema(unittest.TestCase):
def setUp(self):
self.default_datetime = "2020-06-10T12:02:44+00:00"
def test_serialize(self):
payload = {
"metadat... | {
"content_hash": "4347938f272a41c8cc3dbaa29b279c96",
"timestamp": "",
"source": "github",
"line_count": 21,
"max_line_length": 69,
"avg_line_length": 28.80952380952381,
"alnum_prop": 0.6099173553719008,
"repo_name": "cfei18/incubator-airflow",
"id": "f1920e95c51df64815d3fd357eedd04f2d11902d",
"size... |
from flask import Blueprint, abort
from application.db import api
user_page = Blueprint('user_page', __name__)
@user_page.route('/user/add')
def add():
api.add()
return "Add user done"
@user_page.route('/user/show/<user_id>')
def show(user_id):
user = api.get(user_id)
return "show"+ us... | {
"content_hash": "6161769837b3b53026c98dc4a31b5d1b",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 44,
"avg_line_length": 21.933333333333334,
"alnum_prop": 0.6291793313069909,
"repo_name": "shunliz/test",
"id": "ab450f6b72986ec38a3791d76f15a37406799371",
"size": "329",
... |
"""
<fn-group>
<fn fn-type="other">
<label>Additions and Corrections</label>
<p>On page 10, where it was read:</p>
<p>“Joao da Silva”</p>
<p>Now reads:</p>
<p>“João da Silva Santos”</p>
</fn>
</fn-group>
"""
class ArticleWithErrataNotes:
def __init__(self, xmltree):... | {
"content_hash": "ec8221d12bc00d9df52d35f02f639a04",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 101,
"avg_line_length": 23.54,
"alnum_prop": 0.5072217502124045,
"repo_name": "scieloorg/packtools",
"id": "03c36a6098e1adae1f71e76c830436572b441985",
"size": "1186",
"bi... |
import time, sys
import mote
from moteCache import MoteCache
if __name__ == "__main__":
cache = MoteCache()
cache.read()
# print "GetMotes:", cache.getMotes()
allDevs = mote.detectAllPossible()
selectedMoteId = None
for d in allDevs:
if d in cache.getMotes():
selectedMoteI... | {
"content_hash": "bc52af5f64d8ee9b77abcbbabe53eb9f",
"timestamp": "",
"source": "github",
"line_count": 44,
"max_line_length": 95,
"avg_line_length": 21.545454545454547,
"alnum_prop": 0.580168776371308,
"repo_name": "rpwagner/tiled-display",
"id": "4ca2378c48ffee693beae6fabe939bc23ac65df5",
"size":... |
import os
import random
import string
import time
from eventlet import queue
from oslo_log import log
from dragonflow.common import utils as df_utils
from dragonflow import conf as cfg
from dragonflow.controller.common import constants as ctrl_const
from dragonflow.db import api_nb
from dragonflow.db import db_common... | {
"content_hash": "1c9fac064d82bfaf9622674c55228fda",
"timestamp": "",
"source": "github",
"line_count": 149,
"max_line_length": 75,
"avg_line_length": 35.355704697986575,
"alnum_prop": 0.6148443432042521,
"repo_name": "openstack/dragonflow",
"id": "9e20b027d04e1a40b29cfba6385deb85d4290248",
"size":... |
from django.db import models
ADDRESS_DISPLAY_CHARS = 25
class ZipCode(models.Model):
zip_code = models.CharField(db_index=True, max_length=10)
latitude = models.DecimalField(db_index=True, max_digits=10, decimal_places=6)
longitude = models.DecimalField(db_index=True, max_digits=10, decimal_places=6)
s... | {
"content_hash": "75fedab7d1137d3cde2eb9b2c173660a",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 83,
"avg_line_length": 41.54545454545455,
"alnum_prop": 0.7177242888402626,
"repo_name": "philipkimmey/django-geo",
"id": "76bd22bb633c5a2d6a7f4ee9b2203b1a8cc1db74",
"size"... |
"""
A Django staticfiles post-processor for optimizing with RequireJS.
Developed by Dave Hall.
<http://www.etianen.com/>
"""
__version__ = (1, 0, 8)
| {
"content_hash": "f65b8e55320714065b24c03ca9ad17ec",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 15.3,
"alnum_prop": 0.673202614379085,
"repo_name": "muhammad-ammar/django-require",
"id": "3e124c3e049602897cddea5deedbf8e090a86af3",
"size": "153",... |
"""
If the user requests "Docs.Doxygen" then this will call this script as a tool
In which case we include all the Doxygen related builders
"""
from . import Doxygen, DoxygenDefaultTemplate
def generate(env):
Doxygen.generate(env)
DoxygenDefaultTemplate.generate(env)
def exists(env):
if (Doxy... | {
"content_hash": "41c421a8d47b6c7d851905de962811b4",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 77,
"avg_line_length": 29.733333333333334,
"alnum_prop": 0.7130044843049327,
"repo_name": "ASoftTech/Scons-Tools-Grbd",
"id": "e09d5e026e62078fe5864d2e5a7ed6d555822d05",
"s... |
"""Checker decorators"""
from functools import wraps
from flask import render_template
from pysistem.checkers.model import Checker
def yield_checker(field='checker_id', yield_field='checker'):
"""Decorator
Get checker identified by 'field' keyword argument
and save it to 'yield_field' keyword argument.
... | {
"content_hash": "7e94e4a2a34b2de2b7698f7070cb7d20",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 63,
"avg_line_length": 33.19230769230769,
"alnum_prop": 0.6442641946697567,
"repo_name": "TsarN/pysistem",
"id": "06bd5b68aa5b5c94d5e967a5d5901d3a95147a6a",
"size": "888",
... |
from novaclient import exceptions
from novaclient.tests import utils
from novaclient.tests.v1_1 import fakes
from novaclient.v1_1 import flavors
class FlavorsTest(utils.TestCase):
def setUp(self):
super(FlavorsTest, self).setUp()
self.cs = self._get_fake_client()
self.flavor_type = self._g... | {
"content_hash": "ef63205bad33403e3d0c9d61c859a693",
"timestamp": "",
"source": "github",
"line_count": 197,
"max_line_length": 79,
"avg_line_length": 40.13705583756345,
"alnum_prop": 0.5662071582142405,
"repo_name": "metacloud/python-novaclient",
"id": "c18305401a56c1fb2bf707b352d7a8165346342f",
"... |
"""
iven two integers: L and R,
find the maximal values of A xor B given, L <= A <= B <= R
Input Format
The input contains two lines, L is present in the first line.
R in the second line.
Constraints
1 <= L <= R <= 103
Output Format
The maximal value as mentioned in the problem statement.
"""
__author__ = 'Danyang'... | {
"content_hash": "659f608f10bddb841e8095303d0d225c",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 61,
"avg_line_length": 21.5,
"alnum_prop": 0.5459579180509413,
"repo_name": "algorhythms/HackerRankAlgorithms",
"id": "cb424ebc0e6990ea5a21e9c2c3da0c1a337728ae",
"size": "9... |
from __future__ import absolute_import
from __future__ import print_function
import os
import tempfile
import nose.tools as nt
import nbformat
import notedown
simple_backtick = """
```
code1
space_indent
more code
```
text1
``
```
code2
tab_indent
~~~
```
text2"""
simple_tilde = """
~~~
code1
space... | {
"content_hash": "98916c6f5e0fee20a1f0c48118f98709",
"timestamp": "",
"source": "github",
"line_count": 480,
"max_line_length": 101,
"avg_line_length": 23.764583333333334,
"alnum_prop": 0.6527570789865872,
"repo_name": "aaren/notedown",
"id": "777a5af876c0f406acf0ad4875c1376ad5fe2803",
"size": "114... |
"""The main module of the QA Dashboard."""
import json
import time
import datetime
import os
import sys
import requests
import csv
import shutil
import re
from coreapi import *
from jobsapi import *
from configuration import *
from results import *
from html_generator import *
from perf_tests import *
from smoke_tests... | {
"content_hash": "f19059cc5dccfcee39a08c048aa68596",
"timestamp": "",
"source": "github",
"line_count": 496,
"max_line_length": 99,
"avg_line_length": 35.72379032258065,
"alnum_prop": 0.6569219481912072,
"repo_name": "jpopelka/fabric8-analytics-common",
"id": "eefd9ebdf2ebd1618692cee3a187c398434942d4... |
"""Implementation of in-memory backend."""
import copy
import logging
import threading
from taskflow import decorators
from taskflow import exceptions as exc
from taskflow.openstack.common import timeutils
from taskflow.persistence.backends import base
from taskflow.utils import persistence_utils as p_utils
LOG = lo... | {
"content_hash": "e4c092be4f6f4f25ff0f074f9dcbe542",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 78,
"avg_line_length": 36.23809523809524,
"alnum_prop": 0.58832363431575,
"repo_name": "jessicalucci/TaskManagement",
"id": "6b937f4ac90fd8bf4dad9e8d392e194a358fd698",
"si... |
def split_string(string, chunk_size):
"""
Generator function that splits string into chunks.
:param string: string to be split.
:param chunk_size: size of a single chunk.
:return: yields individual chunks.
"""
if not isinstance(string, str):
raise TypeError("string parameter must be... | {
"content_hash": "908ef0327c53f7b3f73d9c635fb81ab2",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 98,
"avg_line_length": 40.29032258064516,
"alnum_prop": 0.6809447558046438,
"repo_name": "Paulius-Maruska/pyhex",
"id": "6d495965d7957a754339315b14e9ce03c65727f6",
"size": ... |
"""The TensorBoard Text plugin."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import json
import textwrap
# pylint: disable=g-bad-import-order
# Necessary for an internal test with special behavior for numpy.
import numpy as np
# py... | {
"content_hash": "213962501fac487f645ea99d095b3502",
"timestamp": "",
"source": "github",
"line_count": 260,
"max_line_length": 80,
"avg_line_length": 32.965384615384615,
"alnum_prop": 0.6757671216894178,
"repo_name": "ioeric/tensorboard",
"id": "a564cad432e29e55c167eda638deb4d62f02130f",
"size": "... |
from django.core.management.base import BaseCommand
from django.utils import timezone
from probe.lib import pyspeedtest
from probe.models import Speed, AverageQuality
from datetime import datetime, timedelta
from probe.lib.helpers import is_first_run
def fill():
if is_first_run():
return
speed_values ... | {
"content_hash": "3e6db0024c23d1e56b972247801f71c8",
"timestamp": "",
"source": "github",
"line_count": 41,
"max_line_length": 109,
"avg_line_length": 27.317073170731707,
"alnum_prop": 0.6642857142857143,
"repo_name": "krstnschwpwr/speedcontrol",
"id": "83223eba9a1bd52b4a95c2b12cf4a2ae8dbfc15c",
"s... |
import datetime
import slugify as unicodeslugify
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import models, transaction
from django.utils.translation import gettext_lazy as _
from asylum.models import AsylumModel
def get_sentinel_user():
"""Gets a "sentinel" us... | {
"content_hash": "81dcbb7a345dd105e698a2a9fe721d3b",
"timestamp": "",
"source": "github",
"line_count": 43,
"max_line_length": 96,
"avg_line_length": 34.95348837209303,
"alnum_prop": 0.6899534264803726,
"repo_name": "HelsinkiHacklab/asylum",
"id": "16ef60faa1357a31c66bddfd5c63737fee5f9cec",
"size":... |
'''
Created on 2014-8-11
@author: wendal
'''
from distutils.core import setup
import py2exe
setup(console=['main.py'],
options={
# And now, configure py2exe by passing more options;
'py2exe': {
# This is magic: if you don't add these, your .exe may
# or may not work on older/newer versions of win... | {
"content_hash": "e3d567aa8d4fbc1551857ffa14eb7abb",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 92,
"avg_line_length": 25.896551724137932,
"alnum_prop": 0.5552596537949401,
"repo_name": "wendal/yeelink_tester",
"id": "b130c9b3ae4debb43a24b659c935ea4ba295c6c3",
"size":... |
from spcControl.monitor import main
main()
| {
"content_hash": "bfff833e7d7f81812dc3ab5b8029d53d",
"timestamp": "",
"source": "github",
"line_count": 4,
"max_line_length": 35,
"avg_line_length": 12,
"alnum_prop": 0.7291666666666666,
"repo_name": "HPPTECH/hpp_IOSTressTest",
"id": "095e04ee179ee642646b64df45489825a2e39f1d",
"size": "52",
"bina... |
"""Utilities."""
import numpy as np
import nibabel as nb
from nipype import logging
from nipype.utils.filemanip import fname_presuffix
from nipype.interfaces.base import (
traits,
isdefined,
File,
InputMultiPath,
TraitedSpec,
BaseInterfaceInputSpec,
SimpleInterface,
)
LOG = logging.getLog... | {
"content_hash": "d3787e0ca5bdb46fdef92a2ec34356e3",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 86,
"avg_line_length": 32.05392156862745,
"alnum_prop": 0.6147729010552072,
"repo_name": "oesteban/niworkflows",
"id": "e3ad2a71aadeaf7c47204fd5970cacf68e9978d8",
"size": ... |
from django.db import models
class Member(models.Model):
id = models.IntegerField(primary_key=True)
name = models.CharField(max_length=100, null=True)
logoff_ts = models.DateTimeField(null=True)
join_ts = models.DateTimeField(null=True)
ship = models.ForeignKey('main.Ship', null=True)
location... | {
"content_hash": "73fa4f09ff73d5b1a0cbe211362d6d7f",
"timestamp": "",
"source": "github",
"line_count": 29,
"max_line_length": 60,
"avg_line_length": 27.310344827586206,
"alnum_prop": 0.6830808080808081,
"repo_name": "all-out/lightswitch",
"id": "8223ca4884f338f9d42656a1a7c8c0b3981e5d51",
"size": "... |
"""Compute-related Utilities and helpers."""
import contextlib
import functools
import inspect
import itertools
import math
import traceback
import netifaces
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from nova.accelerator import cyborg
from nova import block_de... | {
"content_hash": "5990bc105eb8ea2c0717cb3f162d030a",
"timestamp": "",
"source": "github",
"line_count": 1529,
"max_line_length": 79,
"avg_line_length": 40.774362328319164,
"alnum_prop": 0.6495733350442705,
"repo_name": "klmitch/nova",
"id": "1617f1dbe34bd305292ab9bc02200e9960d96e26",
"size": "62961... |
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^local/$', 'main.views.local_item', name='main_local'),
url(r'^$', 'main.views.global_item', name='main_global'),
]
| {
"content_hash": "84a48ec4887512dcaacf086a2335cc58",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 65,
"avg_line_length": 28.714285714285715,
"alnum_prop": 0.6467661691542289,
"repo_name": "yerohin/context_processors_test",
"id": "c4fc2f7266dd048e761a1ee75281f687beb13df7",
... |
from model.contact import Contact
def test_delete_first_contact(app):
if app.contact.count() == 0:
app.contact.create_contact(Contact(firstname="test"))
old_contacts = app.contact.get_contact_list()
app.contact.delete_first_contact()
new_contacts = app.contact.get_contact_list()
# print(old... | {
"content_hash": "71329d4ea4fadfcae0517a6f48172a88",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 61,
"avg_line_length": 36.84615384615385,
"alnum_prop": 0.6764091858037579,
"repo_name": "beorlow/python_training",
"id": "429e51887c0f1eab41a9771d2af81d11c237e1e7",
"size"... |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST,... | {
"content_hash": "848c73fa02e397c2464aa5e99d5f556b",
"timestamp": "",
"source": "github",
"line_count": 1434,
"max_line_length": 264,
"avg_line_length": 58.141562064156204,
"alnum_prop": 0.5278920539730135,
"repo_name": "111pontes/ydk-py",
"id": "465c95fa5a5052746da15b5ea18c6f9dc3cb9570",
"size": "... |
import boto3
import sure # noqa # pylint: disable=unused-import
from moto import mock_quicksight
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
# See our Development Tips on writing tests for hints on how to write good tests:
# http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html
... | {
"content_hash": "b0c6593b215d2892508f86cbc72b363c",
"timestamp": "",
"source": "github",
"line_count": 73,
"max_line_length": 81,
"avg_line_length": 30.26027397260274,
"alnum_prop": 0.5563603440470801,
"repo_name": "spulec/moto",
"id": "4fc878276597982f2eb51abb3bbbf80dee2c51f0",
"size": "2209",
... |
from twisted.internet.protocol import Factory, Protocol
from twisted.internet import reactor
from math import *
from datetime import *
from copy import copy
import sys
import argparse
# Commands
CMD_DID_DRAW = "D"
CMD_SYNC_CLIENT_CONNECT = "S"
CMD_ASYNC_CLIENT_CONNECT = "A"
CMD_BROADCAST = "T"
CMD_PAUSE = "P"
CMD_RESE... | {
"content_hash": "f987e41dc9a010273154699968c058d5",
"timestamp": "",
"source": "github",
"line_count": 261,
"max_line_length": 169,
"avg_line_length": 37.87356321839081,
"alnum_prop": 0.5915022761760242,
"repo_name": "wdlindmeier/mpe-python-server",
"id": "a7a52b5e033d17d561c4bd25ae2b3859afad08c1",
... |
from __future__ import print_function, division, absolute_import
import itertools
from numba import types, intrinsics
from numba.utils import PYVERSION, RANGE_ITER_OBJECTS, operator_map
from numba.typing.templates import (AttributeTemplate, ConcreteTemplate,
AbstractTemplate, built... | {
"content_hash": "428026da302d50d8ea645436e683cc2d",
"timestamp": "",
"source": "github",
"line_count": 812,
"max_line_length": 87,
"avg_line_length": 26.77093596059113,
"alnum_prop": 0.6162020425062104,
"repo_name": "GaZ3ll3/numba",
"id": "837096fb48bfdd92d7b9a1543f273a7f62f05d5b",
"size": "21738"... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
from s3direct.fields import S3DirectField
def get_first_name(self):
return self.first_name
User.add_to_class("__str__", get_first_name)
RATING_CHOICES = (
(1, '1'),
(2, '2'),
(3, 'e'),
(4, '4'),
(5, '5'... | {
"content_hash": "d4a25aafc02555e93eaed8c6b3b66be5",
"timestamp": "",
"source": "github",
"line_count": 146,
"max_line_length": 107,
"avg_line_length": 26.78082191780822,
"alnum_prop": 0.710230179028133,
"repo_name": "ByrdOfAFeather/AlphaTrion",
"id": "97ecfdec4fb41ff90712cb31182d7d66b23f24d4",
"si... |
from django.forms.fields import * # noqa
from django_extras.forms import widgets
from django_extras.core import validators
class ColorField(CharField):
"""
Form field that provides input for color picker
"""
widget = widgets.JQueryColorPicker
def __init__(self, allow_alpha=False, *args, **kwargs... | {
"content_hash": "5b99f8cae4b0a9c84bb21d21ce45314c",
"timestamp": "",
"source": "github",
"line_count": 26,
"max_line_length": 67,
"avg_line_length": 29.807692307692307,
"alnum_prop": 0.6748387096774193,
"repo_name": "gem/django-extras",
"id": "baf5f6ba91ca7e518d09c8c249ed29cb3fd35d3e",
"size": "77... |
""" A Python Database API Specification v2.0 implementation that provides
configuration loading, variable substitution, logging, query banding,
etc and options to use either ODBC or REST"""
# The MIT License (MIT)
#
# Copyright (c) 2015 by Teradata
#
# Permission is hereby granted, free of charge, to any person obta... | {
"content_hash": "befa8a416a3d6e13033ef29c148e40e6",
"timestamp": "",
"source": "github",
"line_count": 873,
"max_line_length": 79,
"avg_line_length": 40.39862542955326,
"alnum_prop": 0.5587501417715777,
"repo_name": "fxstein/PyTd",
"id": "697b22bb0d8036fb7212abe32b4de88cd356461d",
"size": "35268",... |
"""The shares api."""
import ast
from http import client as http_client
from oslo_log import log
from oslo_utils import strutils
from oslo_utils import uuidutils
import webob
from webob import exc
from manila.api import common
from manila.api.openstack import wsgi
from manila.api.views import share_accesses as share... | {
"content_hash": "a543ed09d38ef70d9b7dc381cb14ae41",
"timestamp": "",
"source": "github",
"line_count": 654,
"max_line_length": 79,
"avg_line_length": 40.22477064220183,
"alnum_prop": 0.5707986467480138,
"repo_name": "openstack/manila",
"id": "8099b9a9fb57c2b65a09214182078e419f1a64dc",
"size": "269... |
from keras_cv.bounding_box.converters import _decode_deltas_to_boxes
from keras_cv.bounding_box.converters import _encode_box_to_deltas
from keras_cv.bounding_box.converters import convert_format
from keras_cv.bounding_box.formats import CENTER_XYWH
from keras_cv.bounding_box.formats import REL_XYXY
from keras_cv.bound... | {
"content_hash": "365ca509cc266fdbcf111f7a795f9beb",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 71,
"avg_line_length": 55.86666666666667,
"alnum_prop": 0.8257756563245824,
"repo_name": "keras-team/keras-cv",
"id": "f98b3f884ad7adfb0e323b381cf37e6357065118",
"size": "1... |
from kmip.core import enums
from kmip.core import primitives
class RequestPayload(primitives.Struct):
"""
An abstract base class for KMIP request payloads.
"""
def __init__(self):
super(RequestPayload, self).__init__(enums.Tags.REQUEST_PAYLOAD)
class ResponsePayload(primitives.Struct):
"... | {
"content_hash": "cd4c138fdf548519862cbc51e4b1bac6",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 74,
"avg_line_length": 25.57894736842105,
"alnum_prop": 0.676954732510288,
"repo_name": "OpenKMIP/PyKMIP",
"id": "cbfda03f19e4ccfca6c33a86a323fb3f312b4354",
"size": "1132",... |
import random as r
from gps import *
import time
import threading
import zmq
import zmq_ports as ports
import zmq_topics as topic
import delays
gpsd = None # seting the global variable
class GpsPoller(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
global gpsd # bring it in... | {
"content_hash": "f15f230207aa3bf3334c8c00038ed3b1",
"timestamp": "",
"source": "github",
"line_count": 100,
"max_line_length": 114,
"avg_line_length": 30.24,
"alnum_prop": 0.5724206349206349,
"repo_name": "jeryfast/piflyer",
"id": "b15677d8a8536b13aa08b1f8880bab7ad5c6a5d6",
"size": "3024",
"bina... |
"""
config.py
author: erich@emfeld.com
========================
This file acts as the configuration holder for the environment.
If you want to define a global configuration please define it here.
Naming convention:
- Use capital letters.
- If needed, use underscores ('_') as separators between words
"""
import os
... | {
"content_hash": "7e75133e22ed22ca41471356008832d7",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 122,
"avg_line_length": 40.108695652173914,
"alnum_prop": 0.71869918699187,
"repo_name": "kevinmel2000/EmeraldBox",
"id": "decf0e652e08bcca6ca82ec4d3164adb4b16e6e5",
"size"... |
from azure.identity import DefaultAzureCredential
from azure.mgmt.sql import SqlManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-sql
# USAGE
python delete_a_sync_agent.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
... | {
"content_hash": "4628c53fed527427c43a2cfce848294a",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 127,
"avg_line_length": 33.588235294117645,
"alnum_prop": 0.7250437828371279,
"repo_name": "Azure/azure-sdk-for-python",
"id": "a4d3ba76a2c0a45015e7de51a61a9237c0d39be4",
"... |
import cards
import hands
import pickle
from random import *
# gets indices from hand of size 2
def getIndicesFromHand(hand):
first = hand.cards[0]
second = hand.cards[1]
suited = False
if first.suit == second.suit:
suited = True
firstval = first.get_value()
secondval = second.get_value()
if (fir... | {
"content_hash": "ebc1e2eed7e7025387087816eaeaca77",
"timestamp": "",
"source": "github",
"line_count": 91,
"max_line_length": 106,
"avg_line_length": 27.65934065934066,
"alnum_prop": 0.6519666269368296,
"repo_name": "pmaddi/CPSC458_Final-Project",
"id": "8f462610ab5501f2c57b897d3884e5502531f064",
... |
import sys
import os
SPARK_HOME="SPARK_HOME"
try:
import pyspark
except ImportError:
if SPARK_HOME in os.environ:
spark_home = os.environ.get(SPARK_HOME)
pyspark_path = "%s/python" % spark_home
sys.path.insert(1, pyspark_path)
else:
raise Exception("Required Environment var... | {
"content_hash": "2afea8455d3f382f94344f140946a4b1",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 80,
"avg_line_length": 22.82608695652174,
"alnum_prop": 0.72,
"repo_name": "ashaarunkumar/spark-tk",
"id": "306b8a3e2072daf5bd123a035738536159d78e79",
"size": "1230",
"bi... |
from __future__ import absolute_import
from concurrent.futures import ThreadPoolExecutor
from unittest import TestCase
import asyncio
from opentracing.scope_managers.contextvars import ContextVarsScopeManager
from opentracing.harness.scope_check import ScopeCompatibilityCheckMixin
class AsyncioContextVarsCompabili... | {
"content_hash": "3809e1e9532c2d906430871282d009ec",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 74,
"avg_line_length": 29.333333333333332,
"alnum_prop": 0.7004132231404959,
"repo_name": "opentracing/opentracing-python",
"id": "dd1820fe3d06143c238f647b40352809b41838cc",
... |
import multiprocessing
import multiprocessing.pool
import sys
import os
import torch
from .bound_ops import *
def build_solver_module(self, x=None, C=None, intermediate_layer_bounds=None,
final_node_name=None, model_type="mip", solver_pkg="gurobi"):
r"""build lp/mip solvers in general gra... | {
"content_hash": "d486811de722afd8280b453eb73c4503",
"timestamp": "",
"source": "github",
"line_count": 132,
"max_line_length": 104,
"avg_line_length": 43.5,
"alnum_prop": 0.6088470916057123,
"repo_name": "KaidiXu/auto_LiRPA",
"id": "9720ce552b5fd1f4e52bb3f372e9fd4281f21d16",
"size": "5742",
"bin... |
class HCException(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return repr(self.value)
class LocatorException(HCException):
pass
class NoSuchFileAttachmentError(HCException):
pass
class NoSuchMemberException(HCException):
pass
class NoSuchTagExcep... | {
"content_hash": "b08894cff2ea3ea3d0362d367071d627",
"timestamp": "",
"source": "github",
"line_count": 69,
"max_line_length": 80,
"avg_line_length": 19.014492753623188,
"alnum_prop": 0.694359756097561,
"repo_name": "codedsk/hubcheck",
"id": "2ce643e1a97a66fc5d535152f82a1689ec3767c2",
"size": "1342... |
__author__ = 'Christoph Jansen'
| {
"content_hash": "d7526f2d560cd5750cf30ee5a746814c",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 31,
"avg_line_length": 33,
"alnum_prop": 0.6363636363636364,
"repo_name": "PandoIO/brocas-lm",
"id": "18ed8ce3160b3d7ca4f760f0405e8e9fcfe40367",
"size": "33",
"binary": fa... |
import json
import pecan
from oslo_log import log
from oslo_utils.strutils import bool_from_string
from pecan.core import abort
from vitrage.api.controllers.rest import RootRestController
from vitrage.api.policy import enforce
LOG = log.getLogger(__name__)
# noinspection PyBroadException
class AlarmCountsControll... | {
"content_hash": "f29a126bc4ee42112c6aacb608844295",
"timestamp": "",
"source": "github",
"line_count": 79,
"max_line_length": 74,
"avg_line_length": 31.050632911392405,
"alnum_prop": 0.6061964940888708,
"repo_name": "openstack/vitrage",
"id": "e07750d4d38872a6f9b6397b16d8f9c14ad32753",
"size": "29... |
import os
import webapp2
import jinja2
import webapp2
import json
from google.appengine.ext import ndb
JINJA_ENVIRONMENT = jinja2.Environment(
loader=jinja2.FileSystemLoader(os.path.dirname(__file__)),
extensions=['jinja2.ext.autoescape'],
autoescape=True)
class UserRating(ndb.Model):
username = ndb... | {
"content_hash": "e525f6bb294612d3602f9157deff7b8e",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 71,
"avg_line_length": 32.8051948051948,
"alnum_prop": 0.6417260490894695,
"repo_name": "msavoury/machine-learning",
"id": "8a266198753a3ad1b5e8e439942aba2aadc4f762",
"size... |
from oslo_log import log as logging
from vitrage.common.constants import DatasourceProperties as DSProps
from vitrage.common.constants import EdgeLabel
from vitrage.common.constants import EntityCategory as ECategory
from vitrage.common.constants import VertexProperties as VProps
from vitrage.datasources.alarm_transfo... | {
"content_hash": "56599abcdb255288ca69c9bb7a3786f3",
"timestamp": "",
"source": "github",
"line_count": 83,
"max_line_length": 77,
"avg_line_length": 44.144578313253014,
"alnum_prop": 0.6711244541484717,
"repo_name": "openstack/vitrage",
"id": "3fcac0a51856c0a959360caaefe7fd3e5de846e6",
"size": "42... |
__author__ = 'kkennedy'
import labtronyx
from .c_base import PluginController
class InterfaceController(PluginController):
def __init__(self, c_manager, model):
super(InterfaceController, self).__init__(c_manager, model)
def refresh(self):
self.model.refresh() | {
"content_hash": "e8ac3136fbee2f572a876da14e04845b",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 67,
"avg_line_length": 24,
"alnum_prop": 0.6909722222222222,
"repo_name": "protonyx/labtronyx",
"id": "72e781b202d962cd52e1a1da297454e373e4192f",
"size": "288",
"binary":... |
import os
from .controllers.{{ label }} import {{ class_name }}
def add_template_dir(app):
path = os.path.join(os.path.dirname(__file__), 'templates')
app.add_template_dir(path)
def load(app):
app.handler.register({{ class_name }})
app.hook.register('post_setup', add_template_dir)
| {
"content_hash": "dd077765b7eb0f2c122cd1704c2b1e98",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 63,
"avg_line_length": 30,
"alnum_prop": 0.6633333333333333,
"repo_name": "datafolklabs/cement",
"id": "c65e07268c85923814df032ecce4c815ae632b53",
"size": "301",
"binary"... |
import os
import sys
import math as m
import numpy as np
import astropy.io.fits as pf
from util_PPC import log_wr
from util_PPC import log_fail
from util_PPC import fail_not_exists
from util_PPC import DataManager
from util_RM import do_rmclean
# Constants
C = 2.99792458e8
#----------------------------------------... | {
"content_hash": "2bb6a602bce34f32430a717a611d5d6f",
"timestamp": "",
"source": "github",
"line_count": 90,
"max_line_length": 79,
"avg_line_length": 40.51111111111111,
"alnum_prop": 0.5383982446516731,
"repo_name": "crpurcell/RMpipeL5",
"id": "7ed5cd2539a9635d806a5fb246acfbd6516e4d67",
"size": "66... |
import os, time
from Xlib.display import Display
from Xlib.ext import xtest
from Xlib import X
if "DISPLAY" in os.environ:
displayStr = os.environ["DISPLAY"]
else:
displayStr = ":0"
display = Display( displayStr )
screen = display.screen()
screen.root.warp_pointer(50,100)
print "moved mouse to 50,50"
#print ... | {
"content_hash": "758d4714da1914d1150a8e25709bc6a6",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 69,
"avg_line_length": 23.705882352941178,
"alnum_prop": 0.7320099255583127,
"repo_name": "rpwagner/tiled-display",
"id": "7050f318acd06896de198efd2c7a3a8c4b10122a",
"size"... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from absl import flags
import numpy as np
import os
import sys
import tensorflow.compat.v2 as tf
tf.compat.v1.enable_v2_behavior()
import pickle
from tf_agents.environments import gym_wra... | {
"content_hash": "e6d0c8c921488590f5238d2f986b5c59",
"timestamp": "",
"source": "github",
"line_count": 228,
"max_line_length": 80,
"avg_line_length": 38.51315789473684,
"alnum_prop": 0.6872793531488441,
"repo_name": "google-research/dice_rl",
"id": "d91d66c0f994aa40618f712b757dfad2c1daa31f",
"size... |
from .models import Election, ElectionManager
from config.base import get_environment_variable
from import_export_google_civic.controllers import retrieve_from_google_civic_api_election_query, \
store_results_from_google_civic_api_election_query
import json
import requests
import wevote_functions.admin
from wevote_... | {
"content_hash": "a01416d2b95a4cd81ec03d35fcb1bb88",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 108,
"avg_line_length": 34.4080459770115,
"alnum_prop": 0.6071488224486388,
"repo_name": "wevote/WebAppPublic",
"id": "43d31e5a31eebb1fee85bfb17666a21c1a0e1df6",
"size": "... |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf im... | {
"content_hash": "1c22124abe0865481bd561ccb8311ce8",
"timestamp": "",
"source": "github",
"line_count": 174,
"max_line_length": 605,
"avg_line_length": 33.02298850574713,
"alnum_prop": 0.7053602506091193,
"repo_name": "1064CBread/1064Chat",
"id": "3a2e18c4e54fa7120f7cdc69a12bb1b4ab3adc3c",
"size": ... |
import sys
import numpy
import matplotlib.pyplot
def analyse (filename, outfile = None):
""" Displays the mean, maxima and minimum value for each weather station.
Creates a figure of three subplots, showing values for mean, maxima and minimum value with axis = 0,
y axis labels, and a... | {
"content_hash": "1aaae4968ad91b6431dd690c9225f907",
"timestamp": "",
"source": "github",
"line_count": 55,
"max_line_length": 113,
"avg_line_length": 34.14545454545455,
"alnum_prop": 0.5963791267305645,
"repo_name": "WillRhB/PythonLesssons",
"id": "a11bab0d53839b12434cebc115926afb491df37b",
"size"... |
__author__ = 'nb254'
import csv
def save_to_csv(lines, header, filename):
myfile = open(filename, 'wb')
wr = csv.writer(myfile, quoting = csv.QUOTE_ALL)
wr.writerow(header)
for line in lines:
try:
wr.writerow(line)
except UnicodeError:
fixed_line = list(line)
print 'U... | {
"content_hash": "bfa4950896caa65db99f6a365eae0f3d",
"timestamp": "",
"source": "github",
"line_count": 58,
"max_line_length": 68,
"avg_line_length": 29.086206896551722,
"alnum_prop": 0.5981031416716064,
"repo_name": "Nik0l/UTemPro",
"id": "f20ba9afc1b4daa2be44e5c8b4e73303bbf3d596",
"size": "1715",... |
import os
import angr
import claripy
import nose
from angr.codenode import BlockNode, HookNode, SyscallNode
BIN_PATH = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', '..', 'binaries')
def test_ret_float():
p = angr.load_shellcode(b'X', arch='i386')
class F1(angr.SimProcedure):
def ru... | {
"content_hash": "a24f2bf0e31c2e5dc59a804fe4fa9e6d",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 98,
"avg_line_length": 38.02597402597402,
"alnum_prop": 0.6878415300546448,
"repo_name": "schieb/angr",
"id": "26db7e863305288c7ad916080d6414016d1084ba",
"size": "2928",
... |
from django.shortcuts import render
| {
"content_hash": "66fec7901daf38f4b05bf93d8d4c554b",
"timestamp": "",
"source": "github",
"line_count": 2,
"max_line_length": 35,
"avg_line_length": 18.5,
"alnum_prop": 0.8378378378378378,
"repo_name": "lemanjo/pimanager",
"id": "c70d36c495f321b95046f6ecfb83c0925e81677c",
"size": "48",
"binary": ... |
import ssl
import pytest
from pg8000 import DatabaseError, connect
# This requires a line in pg_hba.conf that requires scram-sha-256 for the
# database scram-sha-256
def test_scram_sha_256_plus(db_kwargs):
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.C... | {
"content_hash": "ef611c1b83791347093b76284f5f26b8",
"timestamp": "",
"source": "github",
"line_count": 22,
"max_line_length": 73,
"avg_line_length": 27.363636363636363,
"alnum_prop": 0.6976744186046512,
"repo_name": "tlocke/pg8000",
"id": "dd35b42392aa4828b27402cdf2b321db64060c96",
"size": "602",
... |
import argparse
import logging
import tableauserverclient as TSC
def main():
parser = argparse.ArgumentParser(description="Explore datasource functions supported by the Server API.")
# Common options; please keep those in sync across all samples
parser.add_argument("--server", "-s", required=True, help=... | {
"content_hash": "61e2b24d2c4b1304fb9dc015c354f5ef",
"timestamp": "",
"source": "github",
"line_count": 87,
"max_line_length": 116,
"avg_line_length": 42.758620689655174,
"alnum_prop": 0.6327956989247312,
"repo_name": "tableau/server-client-python",
"id": "014a274ef0ab8d097a494b7b27ace5cb0c7fbbde",
... |
"""
Implemetation of eiffel like methods (methods with preconditions and postconditions).
eiffelmethod is a new descriptor that implements eiffel like methods. It accepts a method and
optional pre and post conditions. fI the pre or post conditions are not given it searchs methodName_pre
and methodName_post.
"""
impo... | {
"content_hash": "4280f346dfce1c650c2ef8379488825d",
"timestamp": "",
"source": "github",
"line_count": 63,
"max_line_length": 103,
"avg_line_length": 28.523809523809526,
"alnum_prop": 0.5826377295492488,
"repo_name": "ActiveState/code",
"id": "5d98120b46530ce42f943bc58941f395e3ad5588",
"size": "17... |
import os.path
# Only requests for myrig.quickmediasolutions.com will be processed
ALLOWED_HOSTS = ['myrig.quickmediasolutions.com',]
SITE_ID = 1
# Enable timezone-aware datetimes
USE_TZ = True
TIME_ZONE = 'America/Vancouver'
# Determine the directory this file resides in so that an absolute
# path can be specif... | {
"content_hash": "e806612ebdbe3a6b3039639767b31ec3",
"timestamp": "",
"source": "github",
"line_count": 50,
"max_line_length": 72,
"avg_line_length": 26.92,
"alnum_prop": 0.7147102526002972,
"repo_name": "nathan-osman/myrig-website",
"id": "3b02ed87a99b78c87f5317f1f55dc64aaa4b841b",
"size": "1489",... |
from billing.integration import Integration
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from django.conf.urls import patterns
from billing.signals import transaction_was_successful, transaction_was_unsuccessful
from django.http import HttpResponse
from bill... | {
"content_hash": "3cbd2c3e9aa3014ca6a11074d4d56ca9",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 105,
"avg_line_length": 35.86021505376344,
"alnum_prop": 0.5949025487256372,
"repo_name": "SimpleTax/merchant",
"id": "35e2fa0a017568eaf4883455d63be04e6d425198",
"size": "3... |
"""
Python wrappers for Orthogonal Distance Regression (ODRPACK).
Notes
=====
* Array formats -- FORTRAN stores its arrays in memory column first, i.e., an
array element A(i, j, k) will be next to A(i+1, j, k). In C and, consequently,
NumPy, arrays are stored row first: A[i, j, k] is next to A[i, j, k+1]. For
e... | {
"content_hash": "c9de98382008205a575d8cd1e0cf20c4",
"timestamp": "",
"source": "github",
"line_count": 1142,
"max_line_length": 97,
"avg_line_length": 36.78721541155867,
"alnum_prop": 0.5832758087167647,
"repo_name": "nmayorov/scipy",
"id": "45fb08c91dcfab3ffe1af33604f064263ff0b9fc",
"size": "4201... |
import datetime
from datetime import timedelta
import os
import glob
import re
# In[ ]:
# In[2]:
today = datetime.date.today()
yesterday = today - timedelta(1)
# In[3]:
if yesterday.isoweekday() == 3:
yesterday_str = yesterday.strftime("%Y-%m-%d")
# In[4]:
filename = glob.glob("_posts/" + yesterda... | {
"content_hash": "d7c9eb403a389b74ed6220986c8db8dd",
"timestamp": "",
"source": "github",
"line_count": 52,
"max_line_length": 70,
"avg_line_length": 12.673076923076923,
"alnum_prop": 0.637329286798179,
"repo_name": "thehackerwithin/berkeley",
"id": "9958160863f91e8543b2726b4715ca20a20a8864",
"size... |
import oauth2
import urllib
from twitter_users import settings
# not sure why this is necessary, but oauth2 does this, so I'm following its lead
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
REQUEST_TOKEN_URL = 'https://api.twitter.com/oauth/request_tok... | {
"content_hash": "6b9e471f187af40a183fb6c3394f9799",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 113,
"avg_line_length": 32.32051282051282,
"alnum_prop": 0.6291154303847679,
"repo_name": "tamizhgeek/tweetscrapper",
"id": "ab1d2eb62f8c14e8fc2ad1201ea0513866863cef",
"siz... |
import sys
from twopy.board import retrieve_board
from twopy.thread import retrieve_thread
from twopy.utility import retrieve_2ch_boards
def main():
board_url = "http://uni.2ch.net/newsplus/"
result = retrieve_board(board_url)
print result[0]["title"], result[0]["res"], result[0]["dat"]
retrieve_thread... | {
"content_hash": "f11182fff44c25a2d2f7cb96dee64f8f",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 64,
"avg_line_length": 27.130434782608695,
"alnum_prop": 0.6185897435897436,
"repo_name": "rezoo/twopy",
"id": "3ffa062d4096a0b4c9dad6867fc812c58bc4e2be",
"size": "671",
... |
import os
import tempfile
import unittest
from dateutil.parser import parse as dtparse
import numpy as np
from pyaxiom.netcdf.sensors.dsg import IncompleteMultidimensionalTrajectory
import logging
from pyaxiom import logger
logger.level = logging.INFO
logger.handlers = [logging.StreamHandler()]
class TestIncomplet... | {
"content_hash": "9c55a86815a76c33c58ab6688c8198c4",
"timestamp": "",
"source": "github",
"line_count": 88,
"max_line_length": 98,
"avg_line_length": 42.35227272727273,
"alnum_prop": 0.6289240676147035,
"repo_name": "axiom-data-science/pyaxiom",
"id": "29874c9cb08e46d65720548de2793617e54c07f8",
"si... |
import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# -- General configurat... | {
"content_hash": "6972df20a5dd74fea6225966eeacfcc9",
"timestamp": "",
"source": "github",
"line_count": 227,
"max_line_length": 80,
"avg_line_length": 31.845814977973568,
"alnum_prop": 0.6998201687646978,
"repo_name": "jimjkelly/celery-simple-elasticsearch",
"id": "bffc870c30f6578e0df99d9a251db542ba3... |
from khmer import Read
from khmer import ReadParser
from screed import Record
from . import khmer_tst_utils as utils
import pytest
from functools import reduce # pylint: disable=redefined-builtin
def test_read_type_basic():
# test that basic properties of khmer.Read behave like screed.Record
# Constructing w... | {
"content_hash": "205e287af64a0ef0be54268a380768a4",
"timestamp": "",
"source": "github",
"line_count": 468,
"max_line_length": 79,
"avg_line_length": 27.173076923076923,
"alnum_prop": 0.6243610914523866,
"repo_name": "ged-lab/khmer",
"id": "0601a888f2ed71be173ecedddf5b6fb41021d825",
"size": "14589... |
'''
Created on 2016/1/29
:author: hubo
'''
from vlcp.server import main
from vlcp.config.config import manager
if __name__ == '__main__':
manager['module.httpserver.url'] = ''
manager['module.httpserver.vhost.api.url'] = 'ltcp://localhost:8081/'
main(None, ('vlcp.service.manage.webapi.WebAPI', 'vlcp.serv... | {
"content_hash": "c2c03f26a0c1bcc97ee9ec44782fc18c",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 97,
"avg_line_length": 29.571428571428573,
"alnum_prop": 0.6714975845410628,
"repo_name": "hubo1016/vlcp",
"id": "5e9d7f70362ff82e0a5b39a0c0ec0d2b9659e662",
"size": "414",
... |
import utility_function as uf
import tensorflow as tf
from bvlc_alexnet_fc7 import AlexNet
import nt
import numpy as np
import os
import time
import cv2
import image_io
# the dimension of the final layer = feature dim
NN_DIM = 500
FEATURE_DIM = 43264
TRAIN_TXT = 'file_list_train_v2_cn5.txt'
TEST_TXT = 'file_list_test.... | {
"content_hash": "4a3cb3013798dad7525e892c6403ae2b",
"timestamp": "",
"source": "github",
"line_count": 121,
"max_line_length": 100,
"avg_line_length": 36.47933884297521,
"alnum_prop": 0.6438604440416855,
"repo_name": "polltooh/FineGrainedAction",
"id": "27bb55a039a82839e69cf72658a77f68d4b86a55",
"... |
from modelling.sentiment_model import check_model
from modelling.sentiment_model import load_data
from modelling.sentiment_model import load_model
from modelling.sentiment_model import predict
from modelling.sentiment_model import save_model
from modelling.sentiment_model import train_model
| {
"content_hash": "832ae6015c480eaea9dd842308cc2e28",
"timestamp": "",
"source": "github",
"line_count": 6,
"max_line_length": 49,
"avg_line_length": 48.666666666666664,
"alnum_prop": 0.8595890410958904,
"repo_name": "JohnCrickett/Sentiment",
"id": "26f95e790b313f710f94703e90e963cda4f4e773",
"size":... |
"""
Statistical Models
===========
This module combines traversal strategies for visiting and storing the spatial tree-structures.
The spystats range from simple linear to Gaussian Processes.
This file is intented to be big!
Some functions an methods for implementing Gaussian simulation of autocorrelated processes... | {
"content_hash": "0c60dd43c006e1699b91d689f4e4a8ba",
"timestamp": "",
"source": "github",
"line_count": 190,
"max_line_length": 217,
"avg_line_length": 27.03157894736842,
"alnum_prop": 0.6929517133956387,
"repo_name": "molgor/spystats",
"id": "dc24d190f49c55268a2a6958a03baa9d0652c479",
"size": "518... |
'''
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
they can be picked up by Qt linguist.
'''
from subprocess import Popen, PIPE
import glob
import operator
OUT_CPP="src/qt/tinegestrings.cpp"
EMPTY=['""']
def parse_po(text):
"""
Parse 'po' format produced by xgettext.
Return... | {
"content_hash": "68df548905163e47aeae6ab5e0c45995",
"timestamp": "",
"source": "github",
"line_count": 71,
"max_line_length": 80,
"avg_line_length": 25.676056338028168,
"alnum_prop": 0.5699396599012616,
"repo_name": "Tinege/Tinege",
"id": "239668c2414d0f58961d5478826ea1626f0ccf68",
"size": "1841",... |
import os
import re
import shutil
import logging
from migrate import exceptions
from migrate.versioning import pathed, script
log = logging.getLogger(__name__)
class VerNum(object):
"""A version number that behaves like a string and int at the same time"""
_instances = dict()
def __new__(cls, value):
... | {
"content_hash": "1f8678b1b6997f686ce01d8151e191ed",
"timestamp": "",
"source": "github",
"line_count": 212,
"max_line_length": 81,
"avg_line_length": 30.9811320754717,
"alnum_prop": 0.570341047503045,
"repo_name": "eunchong/build",
"id": "a09b8cd9dc5597816f57696109a2477298248d29",
"size": "6615",
... |
from base64 import b64encode
from libcloud.common.base import Connection, JsonResponse
from libcloud.container.base import ContainerImage
__all__ = ["RegistryClient", "HubClient"]
class DockerHubConnection(Connection):
responseCls = JsonResponse
def __init__(
self,
host,
username=No... | {
"content_hash": "d00ee1a2be31f7b160c8204a375924b5",
"timestamp": "",
"source": "github",
"line_count": 165,
"max_line_length": 98,
"avg_line_length": 30.618181818181817,
"alnum_prop": 0.581353919239905,
"repo_name": "apache/libcloud",
"id": "97c65024d7fd1d76ff44531a2e34ca187e07d769",
"size": "5835... |
"""
helloglwidgetplugin.py
A simple OpenGL custom widget plugin for Qt Designer.
Copyright (C) 2006 David Boddie <david@boddie.org.uk>
Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as ... | {
"content_hash": "0bb752636ba0e6d5b2fe2054e61f6e7c",
"timestamp": "",
"source": "github",
"line_count": 97,
"max_line_length": 78,
"avg_line_length": 37.123711340206185,
"alnum_prop": 0.7220216606498195,
"repo_name": "SyllogismRXS/misc",
"id": "c8d50d8a6c2ab7f911fbba6eadbd50a9e4af2e74",
"size": "36... |
from mistral.db.v2 import api as db_api
from mistral.services import workbooks as wb_service
from mistral.services import workflows as wf_service
from mistral.tests.unit.engine import base
from mistral.workflow import states
class WorkflowCancelTest(base.EngineTestCase):
def test_cancel_workflow(self):
wo... | {
"content_hash": "c851f2c89baa283562185ff5e556272c",
"timestamp": "",
"source": "github",
"line_count": 609,
"max_line_length": 74,
"avg_line_length": 29.10673234811166,
"alnum_prop": 0.5223964797472639,
"repo_name": "openstack/mistral",
"id": "ffcc18161da73f91f869138f433ab8d0cd00f9d1",
"size": "18... |
import datetime
import json
import os
import random as _random
import sys
import traceback
from getopt import getopt, GetoptError
from multiprocessing import Process
from os import environ
from wsgiref.simple_server import make_server
import requests as _requests
from jsonrpcbase import JSONRPCService, InvalidParamsEr... | {
"content_hash": "b9450516956ee61520aa60384fddaf77",
"timestamp": "",
"source": "github",
"line_count": 631,
"max_line_length": 151,
"avg_line_length": 36.72583201267829,
"alnum_prop": 0.5283507378959178,
"repo_name": "msneddon/kb_megahit",
"id": "5da2d9a0e9925519fde8d220510ed96507813616",
"size": ... |
'''Conway's Game of Life displayed with PyGame
'''
import os
import sys
import time
import math
import pygame
from pygame.gfxdraw import pixel
from pygame.locals import *
from GameOfLife import NumpyWorld, Patterns
_SurfaceDepth = 32
class PygameCell(object):
def __init__(self,width,height):
se... | {
"content_hash": "6b6db5b398d54c6a370996bdd491be43",
"timestamp": "",
"source": "github",
"line_count": 401,
"max_line_length": 81,
"avg_line_length": 23.860349127182044,
"alnum_prop": 0.4905936454849498,
"repo_name": "JnyJny/GameOfLife",
"id": "39fc7ecbc6374bb4c6c53f73671534bdb3a3dedf",
"size": "9... |
from __future__ import print_function
from telesign.phoneid import PhoneIdClient
customer_id = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890"
api_key = "EXAMPLE----TE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw=="
phone_number = "phone_number"
phone_type_voip = "5"
data = PhoneIdClient(customer_... | {
"content_hash": "4816ceb1ea7a49750bb837776c861df3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 100,
"avg_line_length": 33.31578947368421,
"alnum_prop": 0.6998420221169036,
"repo_name": "TeleSign/python_telesign",
"id": "d3ccf6492dd4ed12ec168c56289ff2701ef03941",
"siz... |
import uuid
from draftHost import models
class BotTeamCreator(object):
NAME = "AI Drafting Opponent #{}"
EMAIL = "draftbot@blackhole.gnmerritt.net"
def __init__(self, draft, draft_form):
self.draft = draft
self.num_teams = draft_form.cleaned_data['team_limit']
self.season = models... | {
"content_hash": "132f6c60d3a7203e95b348187fc3c43a",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 85,
"avg_line_length": 32.38709677419355,
"alnum_prop": 0.5139442231075697,
"repo_name": "gnmerritt/autodraft",
"id": "e93c9e1ff215a3932c717296d085ecbf0789cdc6",
"size": "1... |
import sys
import os
PathPop= ""
if os.path.isfile(PathPop+"population.py")==0:
print "set the variable PathPop to the path where you compile population, for instance D:\Users/vtariel/Desktop/ANV/Population-build/. This folder must contain population.py"
sys.exit(-1)
sys.path.append(PathPop)
from population imp... | {
"content_hash": "7e4d8ae7a1ccf8c87d9a6719e8760039",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 178,
"avg_line_length": 30.241935483870968,
"alnum_prop": 0.7322666666666666,
"repo_name": "Population-image/Population",
"id": "cfb68dbf34d8a821da067c4d11f479640c3d5da6",
... |
from alamo_common.conf import AlamoSettings
settings = AlamoSettings()
| {
"content_hash": "0f2c250f1099f7459c26de48f5277335",
"timestamp": "",
"source": "github",
"line_count": 3,
"max_line_length": 43,
"avg_line_length": 24,
"alnum_prop": 0.8194444444444444,
"repo_name": "RulersOfAsgard/ALAMO-scheduler",
"id": "30895e909832c58d9ea128efe501fcdc1ad4dad9",
"size": "96",
... |
from flask import Blueprint
ui = Blueprint('ui', __name__, template_folder='templates')
import location.ui.views
| {
"content_hash": "187457b1c9cfeea1cc42a692213e5990",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 59,
"avg_line_length": 23,
"alnum_prop": 0.7391304347826086,
"repo_name": "zackdever/location",
"id": "860d9001122b2a1cb32bae2b8938084441d8f415",
"size": "115",
"binary": ... |
"""
An exception collector that finds traceback information plus
supplements
"""
import sys
import traceback
import time
from six.moves import cStringIO as StringIO
import linecache
from paste.exceptions import serial_number_generator
import warnings
DEBUG_EXCEPTION_FORMATTER = True
DEBUG_IDENT_PREFIX = 'E-'
FALLBACK... | {
"content_hash": "d350e83bae09c1bfbab57614347434e1",
"timestamp": "",
"source": "github",
"line_count": 506,
"max_line_length": 76,
"avg_line_length": 37.073122529644266,
"alnum_prop": 0.6140519217442294,
"repo_name": "stefanv/aandete",
"id": "632ce0665aaece41cc00de58dd74d7aa3861070f",
"size": "196... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.