text stringlengths 4 1.02M | meta dict |
|---|---|
n=int(input())
e=int(input())
edge_u=list()
edge_v=list()
for i in range(e):
x,y=map(int,input().split())
edge_u.append(x)
edge_v.append(y)
# create empty adjacency lists - one for each node -
# with a Python list comprehension
adjList = [[] for k in range(n)]
for i in range(len(edge_u)):
u=edge_u[i]
... | {
"content_hash": "2544fb932d8afca1c3d81c957cd06c50",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 52,
"avg_line_length": 21.264705882352942,
"alnum_prop": 0.5822959889349931,
"repo_name": "saisankargochhayat/algo_quest",
"id": "18eaa5a663a5a095a42212867dd81b2909d19862",
... |
"""
Common webapp related base views.
"""
from pyramid.httpexceptions import HTTPMethodNotAllowed
from pyramid.response import Response
HTTP_METHODS = frozenset(["DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT"])
class BaseView(object):
"""
A base view class supporting route and view configuration... | {
"content_hash": "6a9f79fa25db241dba7784d6fb0568db",
"timestamp": "",
"source": "github",
"line_count": 93,
"max_line_length": 86,
"avg_line_length": 31.56989247311828,
"alnum_prop": 0.5888964577656676,
"repo_name": "mozilla/ichnaea",
"id": "37ff61320ec90710b8c703549b0dd0e3eb1f6603",
"size": "2936"... |
import re
from typing import Optional, Tuple, cast
from .ast import Location
from .location import SourceLocation, get_location
from .source import Source
__all__ = ["print_location", "print_source_location"]
def print_location(location: Location) -> str:
"""Render a helpful description of the location in the ... | {
"content_hash": "20923a35067a2b8abf06b12fdc371eb7",
"timestamp": "",
"source": "github",
"line_count": 77,
"max_line_length": 86,
"avg_line_length": 35.246753246753244,
"alnum_prop": 0.6031687546057479,
"repo_name": "graphql-python/graphql-core",
"id": "6d13b1e1a070e39f1592be4a69ce1303bdd1123b",
"... |
import os
import sys
# 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 con... | {
"content_hash": "9a883bc34fa1a7719cda33d3e70d6c27",
"timestamp": "",
"source": "github",
"line_count": 231,
"max_line_length": 128,
"avg_line_length": 33.21212121212121,
"alnum_prop": 0.7005995828988529,
"repo_name": "VandyAstroML/Vanderbilt_Computational_Bootcamp",
"id": "2254b604d92677ef0440e3bbbb... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user_profile', '0003_auto_20160914_0043'),
]
operations = [
migrations.AlterField(
model_name='userprofile',
name='hireable'... | {
"content_hash": "361dcbf1bc1c4f42a48f83aafbeceb14",
"timestamp": "",
"source": "github",
"line_count": 23,
"max_line_length": 53,
"avg_line_length": 24.47826086956522,
"alnum_prop": 0.5879218472468917,
"repo_name": "welliam/imagersite",
"id": "c7a5f14a1854e63a3fa93e1f2eb6f1e995c5d467",
"size": "63... |
from django.db.transaction import non_atomic_requests
from django.utils.translation import ugettext
from olympia import amo
from olympia.amo.feeds import NonAtomicFeed
from olympia.amo.templatetags.jinja_helpers import absolutify, url
from olympia.amo.utils import render
from olympia.lib.cache import cached
from .mod... | {
"content_hash": "58e8003aa69241d64a31a4ad290ee9cf",
"timestamp": "",
"source": "github",
"line_count": 62,
"max_line_length": 76,
"avg_line_length": 31.580645161290324,
"alnum_prop": 0.6527068437180796,
"repo_name": "harry-7/addons-server",
"id": "029cd469f570f1dcdd7b3cef48fe88a8cff7741b",
"size":... |
import smtplib
import email
def send_email(sender, recipient, subject, body, send=True):
message = email.mime.text.MIMEText(body)
message[u'Subject'] = subject
message[u'From'] = sender
message[u'To'] = recipient
if send:
s = smtplib.SMTP()
s.connect()
s.sendmail(sender, ... | {
"content_hash": "3a362b442e79a6f774719fa7bfba5c23",
"timestamp": "",
"source": "github",
"line_count": 67,
"max_line_length": 72,
"avg_line_length": 27.08955223880597,
"alnum_prop": 0.6440771349862259,
"repo_name": "jperla/webify",
"id": "befe4dd66bb8cf91e0412d14fd7af4484509ffd3",
"size": "1815",
... |
'''
Implementation of scene controller and scene manipulation tools.
'''
import pyglet
from editor import rLoader
from pyglet.window import mouse, key
from pyglet.gl import glPopMatrix, glPushMatrix, \
glScalef, glClearColor, glLineWidth, GL_TRIANGLES, \
glEnable, GL_BLEND, glTranslatef
import appEngine.scenegr... | {
"content_hash": "0de30b932f739eea94a9b93057adc734",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 120,
"avg_line_length": 35.045375218150085,
"alnum_prop": 0.5671032319107614,
"repo_name": "chrisbiggar/sidescrolltesting",
"id": "4aa19d84a0de6471d09dc84882ec23ba39dabae1",... |
import hashlib
from distutils.filelist import findall
from os.path import relpath, join, basename
from zipfile import ZipFile
def get_md5(file_path):
md5_hash = hashlib.md5()
with open(file_path, 'rb') as file_:
batch_size = 4096
chunk = file_.read(batch_size)
while chunk:
... | {
"content_hash": "a42290dcfe97c6347fb3a8970e9828c1",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 69,
"avg_line_length": 30.12,
"alnum_prop": 0.6374501992031872,
"repo_name": "ahcub/armory",
"id": "882e554e62cf8a0201c873e3eec01eec732ab81a",
"size": "753",
"binary": fa... |
from __future__ import print_function
import sys
import os.path
from urllib2 import urlopen
INVLIST_URL = 'http://dev.tsadm.local:8000/asb/inv/lst/'
SSL_CERT_FILE = os.path.expanduser('~/.asbot.pem')
ssl_context = None
if INVLIST_URL.startswith('https:'):
try:
import ssl
ssl_context = ssl.create... | {
"content_hash": "da6fc4cfc80fc49ff2da8900bb205637",
"timestamp": "",
"source": "github",
"line_count": 30,
"max_line_length": 75,
"avg_line_length": 25.9,
"alnum_prop": 0.646074646074646,
"repo_name": "jctincan/tsadm-ansible",
"id": "4268e4d0a005ef77841452a968062a9ee276b3d8",
"size": "801",
"bin... |
from girder.models.group import Group
from girder.utility import mail_utils
def sendEmailToGroup(groupName, templateFilename, templateParams, subject=None, asynchronous=True):
"""
Send a single email with all members of a group as the recipients.
:param groupName: The name of the group.
:param templa... | {
"content_hash": "d3bef3bc2279facb1746176cc478dbff",
"timestamp": "",
"source": "github",
"line_count": 25,
"max_line_length": 99,
"avg_line_length": 41.88,
"alnum_prop": 0.6981852913085005,
"repo_name": "ImageMarkup/isic-archive",
"id": "2860b22603cfedea1fddb62ba94466365885ea7f",
"size": "1047",
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('halfwayapp', '0007_auto_20160224_1908'),
]
operations = [
migrations.AlterField(
model_name='meeting',
... | {
"content_hash": "a92892810831368b9e9ee2dc8ef91f76",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 153,
"avg_line_length": 33.61764705882353,
"alnum_prop": 0.615923009623797,
"repo_name": "cszc/meethalfway",
"id": "559aa8dd04b6365d4a2c9e8c41f5fef0d7cdec00",
"size": "1215... |
from __future__ import absolute_import
import datetime
import getpass
import logging
import pytz
from django.core import mail
from sentry.conf import settings
from sentry.exceptions import InvalidInterface, InvalidData
from sentry.interfaces import Interface
from sentry.models import Group, Project
from tests.base ... | {
"content_hash": "caf75dc5bb077091cd68b00e2a655810",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 162,
"avg_line_length": 38.848101265822784,
"alnum_prop": 0.5854241338112306,
"repo_name": "Kronuz/django-sentry",
"id": "5e4f9e052070047e944b88e2bd3be911239b1176",
"size"... |
def biggestValue(values):
biggest = values[0]
for num in values:
if (num > biggest):
biggest = num
return biggest
| {
"content_hash": "6ea768bfc53162ee3c3dca7281cad7be",
"timestamp": "",
"source": "github",
"line_count": 7,
"max_line_length": 27,
"avg_line_length": 21,
"alnum_prop": 0.5714285714285714,
"repo_name": "crissyg/SCH-PRACTICE",
"id": "144e643a9e5192a25d32ba53374613ac753ead78",
"size": "147",
"binary"... |
import errno
import os
def resolve_relative_path(file_name):
path = os.path.normpath(os.path.join(
os.path.dirname(
__import__('rally_runners').__file__), '../', file_name))
if os.path.exists(path):
return path
def mkdir_tree(path):
try:
os.makedirs(path)
except O... | {
"content_hash": "1cfa7727d93012c837e3c4e3ea908346",
"timestamp": "",
"source": "github",
"line_count": 20,
"max_line_length": 69,
"avg_line_length": 22.3,
"alnum_prop": 0.5627802690582959,
"repo_name": "shakhat/rally-runners",
"id": "53430d632125de03bb8f17b4f24bfd138c77f63c",
"size": "1008",
"bi... |
from baseGate import *
from Gate import *
import copy
#only X,Y,Z,I,H,S,Sd,T,Td,CNOT is allowed
import re
#delay measure opertor class used in DMif
class DMO:
def __init__(self,ql,vl):
#storage the control-qubit list
self.DMOql = ql
self.split = SplitGate()
self.DMOvl = vl
#get the info about the function ... | {
"content_hash": "e07ecdf7c356ab9c394fc10ec28104aa",
"timestamp": "",
"source": "github",
"line_count": 265,
"max_line_length": 98,
"avg_line_length": 23.42641509433962,
"alnum_prop": 0.6420747422680413,
"repo_name": "zhangxin20121923/QuanSim",
"id": "d8589ff75492a87f9b50a0b939cf7bb570580207",
"siz... |
__author__ = 'Nihar'
__project__ = 'QuantAnalysis'
import talib
import os
import numpy as np
# DEFINE THRESHOLD FOR SUCCESS
success = 75
# HARD CODE PARAMETERS
right = 0.03
veryright = 0.05
delta = 30
upperbound = 80
lowerbound = 20
class LongTerm:
def analysis(self, filename):
# READ PRICES FILE
... | {
"content_hash": "9275d33b11c8f3cac066bbad4b1731a6",
"timestamp": "",
"source": "github",
"line_count": 92,
"max_line_length": 304,
"avg_line_length": 38.33695652173913,
"alnum_prop": 0.5032605613836121,
"repo_name": "niharparikh/Projects",
"id": "de28031951bb98bf831f58d6739c1cf58915c4f9",
"size": ... |
from ConfigParser import ParsingError, RawConfigParser
from StringIO import StringIO
from collections import defaultdict
from functools import partial
from pkg_resources import resource_filename
from genshi.builder import tag
from trac.config import Configuration, ConfigSection
from trac.core import *
from trac.env i... | {
"content_hash": "fe674ae1c9c46f3d622335c76b23b949",
"timestamp": "",
"source": "github",
"line_count": 504,
"max_line_length": 79,
"avg_line_length": 42.692460317460316,
"alnum_prop": 0.5585351117720871,
"repo_name": "exocad/exotrac",
"id": "f5aca3fc681cde1944db697a6015a9a2a2d588c3",
"size": "2215... |
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: win_msg
version_added: "2.3"
short_description: Sends a message to logged in users on Windows hosts.
description:
- Wraps the msg.exe command i... | {
"content_hash": "ce646e4965df9d6b129a33f2f6096910",
"timestamp": "",
"source": "github",
"line_count": 81,
"max_line_length": 155,
"avg_line_length": 33.55555555555556,
"alnum_prop": 0.6902133922001472,
"repo_name": "e-gob/plataforma-kioscos-autoatencion",
"id": "fa0250994bd600bf4a3a539e8f423bb49136... |
import logging
LOGGER = logging.getLogger(__name__)
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
import django.contrib.auth.forms as django_auth_forms
from django.core.validators import MinLengthValidator
from django.contrib.auth impor... | {
"content_hash": "7c54f80c1417982f42d0b518d9e24c39",
"timestamp": "",
"source": "github",
"line_count": 195,
"max_line_length": 111,
"avg_line_length": 28.333333333333332,
"alnum_prop": 0.6209954751131221,
"repo_name": "echodelt/django-auth-skel-project",
"id": "ebf4887fd80fc310b965e979d56423173f69ef... |
''' import statements. '''
import pyglet
pyglet.options['debug_gl'] = False
from pyglet_app_line_update_cheetah_with_mmap import PygletApp
from pyglet_app_helper import process_sys_argv
''' user config options. '''
# set the 'abs_plugin_ID' to the value you see in Matlab - or provide a value on
# the command line. wi... | {
"content_hash": "6ca2d1bab55c644cf87bd24374d960bd",
"timestamp": "",
"source": "github",
"line_count": 64,
"max_line_length": 167,
"avg_line_length": 31.359375,
"alnum_prop": 0.731938216243149,
"repo_name": "StimOMatic/StimOMatic",
"id": "703c7099cf52cb58911f269ae9703ddc5544b5ae",
"size": "2008",
... |
import random
import re
from email.headerregistry import Address
from typing import List, Sequence
from unittest.mock import patch
import ldap
import orjson
from django.conf import settings
from django.core import mail
from django.test import override_settings
from django_auth_ldap.config import LDAPSearch
from zerve... | {
"content_hash": "aa1eab042c4776cb8bfe0fb92e0096dd",
"timestamp": "",
"source": "github",
"line_count": 985,
"max_line_length": 269,
"avg_line_length": 54.24162436548223,
"alnum_prop": 0.5988058695814928,
"repo_name": "brainwane/zulip",
"id": "f6b8f640277ec2c52a545a040a69f60bba388c25",
"size": "534... |
""" A StreamHandler that extracts messages from streams """
from __future__ import print_function
from collections import defaultdict
import sys
import traceback
from .thrift_message import ThriftMessage
class StreamContext(object):
def __init__(self):
self.bytes = ''
class StreamHandler(object):
... | {
"content_hash": "397275abe6f7a68f62255e1a791a3ed8",
"timestamp": "",
"source": "github",
"line_count": 103,
"max_line_length": 82,
"avg_line_length": 31.854368932038835,
"alnum_prop": 0.535202682109113,
"repo_name": "shrijeet/thrift-tools",
"id": "52694e15de156a63d28edf3880389d6b49e94a23",
"size":... |
import os
from shutil import which
from threading import Lock
from vcstool.executor import USE_COLOR
from .vcs_base import VcsClientBase
from ..util import rmtree
class HgClient(VcsClientBase):
type = 'hg'
_executable = None
_config_color = None
_config_color_lock = Lock()
@staticmethod
de... | {
"content_hash": "480b87bdfb7da66b4de36581d095f8b1",
"timestamp": "",
"source": "github",
"line_count": 333,
"max_line_length": 79,
"avg_line_length": 35.945945945945944,
"alnum_prop": 0.4944026733500418,
"repo_name": "dirk-thomas/vcstool",
"id": "e0eb3ddc3bdc00171f350eb3fccf6f13560113e9",
"size": ... |
'''Example WordCountTopology'''
import sys
import heron.api.src.python.api_constants as constants
from heron.api.src.python import Grouping, TopologyBuilder
from heron.examples.src.python.spout import WordSpout
from heron.examples.src.python.bolt import CountBolt
# Topology is defined using a topology builder
# Refer... | {
"content_hash": "3e5f57ddec58e4289dbb9c2a85812fc8",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 85,
"avg_line_length": 38.81481481481482,
"alnum_prop": 0.6946564885496184,
"repo_name": "streamlio/heron",
"id": "0b60b0586aac5c9380bd78c5bcf7619f82fe5464",
"size": "1640"... |
from flask import Flask
import os
import psycopg2
from contextlib import closing
from flask import g
from flask import render_template
from flask import abort
from flask import request
from flask import url_for
from flask import redirect
from flask import session
import datetime
import markdown
#import pygments
from pa... | {
"content_hash": "719187d128714f6a3e44d58ab92a2866",
"timestamp": "",
"source": "github",
"line_count": 204,
"max_line_length": 78,
"avg_line_length": 28.642156862745097,
"alnum_prop": 0.6198870443265446,
"repo_name": "miracode/learning_journal",
"id": "d1cd37b900ebef4bdc28efd44391b64de5b5464f",
"s... |
import argparse
import glob
import joblib
import os
from satdetect.ioutil import imgpath2list
from satdetect.featextract import WindowExtractor, HOGFeatExtractor
from satdetect.detect import BasicTrainSetBuilder, Detector
def runDetector(imgpath='', cpath='', decisionThr=0.5,
**kwargs):
''' Run pre-... | {
"content_hash": "0b1b458ce44f3433a005ef619f2586eb",
"timestamp": "",
"source": "github",
"line_count": 51,
"max_line_length": 79,
"avg_line_length": 31.019607843137255,
"alnum_prop": 0.6845764854614412,
"repo_name": "michaelchughes/satdetect",
"id": "a085cea95262c746cad14fe26f44156f5a97105a",
"siz... |
from django.shortcuts import render_to_response, get_object_or_404
from blogpost.models import BlogPost
from blogpost.forms import BlogForm
from django.http import HttpResponseRedirect
def blogList(request):
blogs = BlogPost.objects.all()
return render_to_response('blogpost/blog_list.html', {'blogs': blogs})
... | {
"content_hash": "4dfdba101a875a2ecd2c7bc02696a7a2",
"timestamp": "",
"source": "github",
"line_count": 78,
"max_line_length": 91,
"avg_line_length": 35.294871794871796,
"alnum_prop": 0.6077006901561932,
"repo_name": "hisuley/sxj",
"id": "48f2bf2a61c691ddc37d1bc6857155f81b974fbe",
"size": "2753",
... |
import unittest
import Trace
import TraceOperations
import BinaryCodec
import StringIO
testTrace1 = "data/note.bin"
testTrace2 = "data/simplecube.bin"
class TraceOperationsTest(unittest.TestCase):
def loadTrace(self, traceFile):
trace = Trace.Trace()
reader = BinaryCodec.Reader(trace, open(tr... | {
"content_hash": "5462ebc945f02d5a359577beb40aa48f",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 70,
"avg_line_length": 31.56923076923077,
"alnum_prop": 0.6106237816764133,
"repo_name": "skyostil/tracy",
"id": "f8b2039a7125658c588d2ed13b7eac2fadf3ebeb",
"size": "3155",... |
from __future__ import print_function
from __future__ import division
import time
import random
random.seed(67)
import numpy as np
np.random.seed(67)
import matplotlib
matplotlib.use('Agg')
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import os
sns.set_style... | {
"content_hash": "eef9ff0f65041d480d19abdca747e6cd",
"timestamp": "",
"source": "github",
"line_count": 138,
"max_line_length": 140,
"avg_line_length": 35.36231884057971,
"alnum_prop": 0.7102459016393443,
"repo_name": "altermarkive/Resurrecting-JimFleming-Numerai",
"id": "b1cd759568cb598e5eab62738cc9... |
import numpy as np
import math
from sklearn import datasets, neighbors, linear_model
digits = datasets.load_digits()
X_digits = digits.data
y_digits = digits.target
np.random.seed(0)
indices = np.random.permutation(len(X_digits))
num_samples = len(digits.data)
test_set_size = math.floor(.1 * num_samples)
print "num... | {
"content_hash": "ec870730d6b2b44189a59f48b514b533",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 74,
"avg_line_length": 28.984615384615385,
"alnum_prop": 0.685244161358811,
"repo_name": "pieteradejong/python",
"id": "392303fb6b5905b82fdd0d5bfe9bb6f6e393360a",
"size": "... |
import logging
from pyvisdk.exceptions import InvalidArgumentError
########################################
# Automatically generated, do not edit.
########################################
log = logging.getLogger(__name__)
def PropertyFilterUpdate(vim, *args, **kwargs):
'''The PropertyFilterUpdate data object ty... | {
"content_hash": "c74385e9a5df7a89eec5feaa94b5ad3f",
"timestamp": "",
"source": "github",
"line_count": 34,
"max_line_length": 124,
"avg_line_length": 35.411764705882355,
"alnum_prop": 0.6254152823920266,
"repo_name": "xuru/pyvisdk",
"id": "cce246cc7fb67827ecc2feec30d4a018d2ebca65",
"size": "1205",... |
# -*- coding: utf-8 -*-
# Copyright 2012 Google Inc. All Rights Reserved.
#
# 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 require... | {
"content_hash": "9888c65ecf7418f17d9cb8e8553d6522",
"timestamp": "",
"source": "github",
"line_count": 237,
"max_line_length": 80,
"avg_line_length": 38.9957805907173,
"alnum_prop": 0.7231118805453365,
"repo_name": "catapult-project/catapult",
"id": "b92bf8021de029b922170b6a7d31185f0b9c7e2b",
"siz... |
'''
Copyright (c) 2012-2017, Agora Games, LLC All rights reserved.
https://github.com/agoragames/kairos/blob/master/LICENSE.txt
'''
from .exceptions import *
from datetime import datetime, timedelta
import operator
import sys
import time
import re
import warnings
import functools
if sys.version_info[:2] > (2, 6):
... | {
"content_hash": "20c4bd28ef84ebc89f1807d5e2adb859",
"timestamp": "",
"source": "github",
"line_count": 1066,
"max_line_length": 139,
"avg_line_length": 32.54502814258912,
"alnum_prop": 0.6455480932753005,
"repo_name": "agoragames/kairos",
"id": "4667cc7bbd33b40c382d10b6b0d2038b36a82104",
"size": "... |
from __future__ import absolute_import, print_function
from sentry import analytics
class OrganizationCreatedEvent(analytics.Event):
type = "organization.created"
attributes = (
analytics.Attribute("id"),
analytics.Attribute("name"),
analytics.Attribute("slug"),
analytics.Att... | {
"content_hash": "d2643b25b9501158da5c940ac3338515",
"timestamp": "",
"source": "github",
"line_count": 17,
"max_line_length": 56,
"avg_line_length": 24.058823529411764,
"alnum_prop": 0.7017114914425427,
"repo_name": "mvaled/sentry",
"id": "173b48f6ba29795800326e1c5892fe2d1a36abf3",
"size": "409",
... |
import copy
from dsl_parser import (exceptions,
utils,
constants)
from dsl_parser.interfaces import interfaces_parser
from dsl_parser.elements import (node_types as _node_types,
plugins as _plugins,
relati... | {
"content_hash": "6eafc4be33e38f66e330140c1dcafce0",
"timestamp": "",
"source": "github",
"line_count": 573,
"max_line_length": 79,
"avg_line_length": 39.4694589877836,
"alnum_prop": 0.5689777148921118,
"repo_name": "cloudify-cosmo/cloudify-dsl-parser",
"id": "07a6ed95cf9ec6bbefd9ff923fd7c88ed48df28a... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from .core import UnitedStates
class NewJersey(UnitedStates):
"""New Jersey"""
include_good_friday = True
include_election_day_every_year = True
| {
"content_hash": "6b8884dfe48fd4689525d04b84be8ac6",
"timestamp": "",
"source": "github",
"line_count": 10,
"max_line_length": 66,
"avg_line_length": 26.9,
"alnum_prop": 0.6654275092936803,
"repo_name": "sayoun/workalendar",
"id": "59cac9e499256d2cc6023989491f376b61837cdf",
"size": "293",
"binary... |
import os
import re
import abc
import sys
import json
import inspect
import logging
import platform
import types
import subprocess
from argparse import Namespace
from pprint import pprint
from copy import copy, deepcopy
from xml.dom import minidom
from xml.dom.minidom import Document
from pegasus.platforms import... | {
"content_hash": "6e31665652209ee824860444a2e9d13b",
"timestamp": "",
"source": "github",
"line_count": 225,
"max_line_length": 128,
"avg_line_length": 28.26222222222222,
"alnum_prop": 0.7232269224720868,
"repo_name": "apetrone/pegasus",
"id": "fa3b788eeadd4354ed7f368ef87778c7f896d77d",
"size": "64... |
import os, os.path, sys
import json
import optparse
import random
import subprocess
import tempfile
import time
class ScalingTester:
def __init__(self, url, object_file, user_file,
match_field, filter_fields, method, client_location):
self._url = url
self._method = method
s... | {
"content_hash": "71edd06a4ac67e803a7b74c8d0be040c",
"timestamp": "",
"source": "github",
"line_count": 142,
"max_line_length": 80,
"avg_line_length": 38.17605633802817,
"alnum_prop": 0.5712968087068806,
"repo_name": "tcmitchell/geni-ch",
"id": "5d9d0def31b6f772a39a2c9a6b0e008785077d1b",
"size": "6... |
import os
from smartstart.utilities.plot import plot_summary, \
mean_reward_std_episode, steps_episode, show_plot
from smartstart.utilities.utilities import get_data_directory
# Get directory where the summaries are saved. Since it is the same folder as
# the experimenter we can use the get_data_directory method... | {
"content_hash": "207cfca8de3fba0087bad8e6b7e464ea",
"timestamp": "",
"source": "github",
"line_count": 38,
"max_line_length": 77,
"avg_line_length": 35.86842105263158,
"alnum_prop": 0.6815847395451211,
"repo_name": "BartKeulen/smartstart",
"id": "06a08292fd2d4b759c08e81fe5f22447ea69da19",
"size": ... |
"""
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this ... | {
"content_hash": "1550a14b63d340c6e46990ee5b03aed7",
"timestamp": "",
"source": "github",
"line_count": 86,
"max_line_length": 93,
"avg_line_length": 33.7906976744186,
"alnum_prop": 0.7629043358568479,
"repo_name": "alexryndin/ambari",
"id": "0c82e6fdefd58729bdacdd1192aea67715b34436",
"size": "2924... |
import re
import mechanize
from bitcasa import BitcasaClient
from casanova.exceptions import LoginError
class Client(BitcasaClient):
def __init__(self, client_id, client_secret, email, password):
super(Client, self).__init__(client_id, client_secret,
"http://localhos... | {
"content_hash": "f18f98d95670d3f8d674c0dab34b0a68",
"timestamp": "",
"source": "github",
"line_count": 65,
"max_line_length": 134,
"avg_line_length": 37.55384615384615,
"alnum_prop": 0.6185989348627612,
"repo_name": "kristinn/casanova",
"id": "da67a32bbf52ee68d111f7bba2e20349db6c4aee",
"size": "24... |
"""
Entrypoint module, in case you use `python -mconfigurator`.
Why does this file exist, and why __main__? For more info, read:
- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""
import sys
from confi... | {
"content_hash": "f83ec4a4a6f22bdf026cea1b18f160bb",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 64,
"avg_line_length": 24.5625,
"alnum_prop": 0.6921119592875318,
"repo_name": "thanos/python-configurator",
"id": "2197e67cf12c6b9b57659d560ecd07895994ad3d",
"size": "393"... |
"""
remove - remove a device configuration
"""
from report import Report
import sys
def main (args, app):
for report in Report.FromConfig(app.config):
if args.report == report.name:
report.remove(app.config)
app.config.save( )
print 'removed', report.format_url( )
break
| {
"content_hash": "4f9237d55ecb47349fdb9065594bc002",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 46,
"avg_line_length": 23.307692307692307,
"alnum_prop": 0.6633663366336634,
"repo_name": "openaps/openaps",
"id": "c7929145f560b7f51c6e40c41eb182325d3643b9",
"size": "304"... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('place', '0007_auto_20141207_1710'),
]
operations = [
migrations.AddField(
model_name='place',
name='yelp_rating',
... | {
"content_hash": "fb2bcd1830ac2bd142772870549df1f3",
"timestamp": "",
"source": "github",
"line_count": 19,
"max_line_length": 59,
"avg_line_length": 22.210526315789473,
"alnum_prop": 0.5876777251184834,
"repo_name": "pizzapanther/Localvore",
"id": "41279b54cc0559b5d544b60d268426fed0686a8e",
"size"... |
"""Instance API tests.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import unittest
import mock
import jsonschema
import six
from treadmill import admin
from treadmill import exc
from treadmill import master... | {
"content_hash": "e77edb329aac8d0524a97ae09f8574ac",
"timestamp": "",
"source": "github",
"line_count": 202,
"max_line_length": 79,
"avg_line_length": 34.15346534653465,
"alnum_prop": 0.5538483838237426,
"repo_name": "captiosus/treadmill",
"id": "9ed42d59ad6aefa203e7e2525a7b717f4e489665",
"size": "... |
import binascii
import socket
import struct
import sys
import hashlib
UDP_IP = "127.0.0.1"
UDP_PORT_client = 5005#different ports because for assignment 4 we want same loop back address for ip
UDP_PORT_server=5006
unpacker = struct.Struct('I I 32s')#struct for receiving the packet form server. ACK, SEQ, Checksum. no d... | {
"content_hash": "2dd3f2e913513eeeea83d1d8030cbbbf",
"timestamp": "",
"source": "github",
"line_count": 208,
"max_line_length": 109,
"avg_line_length": 33.31730769230769,
"alnum_prop": 0.6971139971139971,
"repo_name": "V-Lam/School-Assignments-and-Labs-2014-2017",
"id": "2ed4efbf5da46a28471172be90152... |
import http.server
import time
import os
import pyroute2
import socketserver
import threading
from functools import partial
from pathlib import Path
class ThreadingHTTPServer(socketserver.ThreadingMixIn, http.server.HTTPServer):
pass
class HTTPServer:
def __init__(self, path, remote_ip):
self.path = p... | {
"content_hash": "fed4bdee055e1592a0278e6d7095f3f8",
"timestamp": "",
"source": "github",
"line_count": 59,
"max_line_length": 79,
"avg_line_length": 29.966101694915253,
"alnum_prop": 0.5978506787330317,
"repo_name": "EttusResearch/meta-ettus",
"id": "38213f62c594477aca6806ece7694ec195de4770",
"siz... |
from .rule_data_source import RuleDataSource
class RuleMetricDataSource(RuleDataSource):
"""A rule metric data source. The discriminator value is always
RuleMetricDataSource in this case.
:param resource_uri: the resource identifier of the resource the rule
monitors. **NOTE**: this property cannot b... | {
"content_hash": "b1d42e24d0b2f9a890df1c11caff6095",
"timestamp": "",
"source": "github",
"line_count": 31,
"max_line_length": 90,
"avg_line_length": 36.483870967741936,
"alnum_prop": 0.6569407603890363,
"repo_name": "AutorestCI/azure-sdk-for-python",
"id": "d18479246de7931d354e2dae6233801800e17744",... |
import django.forms as forms
from patreon.models import PatreonAppCreds
class CredsChoices(forms.ModelChoiceField):
def label_from_instance(self, obj):
return obj.label
def creds_form(user):
class CredsForm(forms.Form):
account = CredsChoices(queryset=PatreonAppCreds.objects.filter(user=user),... | {
"content_hash": "73bf1f11dd80e95f1aec1cacbe52e645",
"timestamp": "",
"source": "github",
"line_count": 11,
"max_line_length": 98,
"avg_line_length": 32.90909090909091,
"alnum_prop": 0.7403314917127072,
"repo_name": "google/mirandum",
"id": "7b3b2ffe4f53c4d81ff966006fb025526c9bf1bf",
"size": "362",... |
from ...subsystem.courses.course import Course
import logging
from django.core.management.base import BaseCommand
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Running the scraper to populate the courses for the 400 level courses'
def handle(self, *args, **options):
Cour... | {
"content_hash": "22080d3f50a12cecab8b2d9ffd24ba1c",
"timestamp": "",
"source": "github",
"line_count": 36,
"max_line_length": 82,
"avg_line_length": 34.22222222222222,
"alnum_prop": 0.46185064935064934,
"repo_name": "foxtrot94/EchelonPlanner",
"id": "6d0d612279fdb184e255c4f89e9ca53b7cc054e5",
"siz... |
import pylibvw
SearchState = pylibvw.SearchState
class SearchTask():
def __init__(self, vw, sch, num_actions):
self.vw = vw
self.sch = sch
self.blank_line = self.vw.example("")
self.blank_line.finish()
self.bogus_example = self.vw.example("1 | x")
def __del__(self):
... | {
"content_hash": "d744e9b7876caf257b6723a2ff73d897",
"timestamp": "",
"source": "github",
"line_count": 630,
"max_line_length": 238,
"avg_line_length": 42.7984126984127,
"alnum_prop": 0.5860252939212995,
"repo_name": "hhexiy/vowpal_wabbit",
"id": "0d3d26f8858a1cb4095b12df39827f862bbe2474",
"size": ... |
import sys
from PyQt4 import QtGui, QtCore
from mainwindowpyqt4 import Ui_MainWindow
class MainWindow(QtGui.QMainWindow):
### functions for the buttons to call
def pressedOnButton(self):
print ("Pressed On!")
def pressedOffButton(self):
print ("Pressed Off!")
def __init__(self):
... | {
"content_hash": "9d2884b16d1c037347a8bb160c883dec",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 78,
"avg_line_length": 27.21212121212121,
"alnum_prop": 0.6202672605790646,
"repo_name": "shinichiba/YamadaLabSkinFrictionR7",
"id": "ccb0bc71879219393292c9ff0b9108ecf453af8a... |
import factory
import factory.fuzzy
from zeus import models
from zeus.utils import timezone
from .base import ModelFactory
from .types import GUIDFactory
class RepositoryFactory(ModelFactory):
id = GUIDFactory()
owner_name = factory.Faker("word")
name = factory.Faker("word")
url = factory.LazyAttrib... | {
"content_hash": "143032eefbe291fcd476b834d06b5cc9",
"timestamp": "",
"source": "github",
"line_count": 39,
"max_line_length": 87,
"avg_line_length": 32.282051282051285,
"alnum_prop": 0.6441620333598094,
"repo_name": "getsentry/zeus",
"id": "dddbb8a029ea98ed95361c9ac635b5509a0d90c5",
"size": "1259"... |
from __future__ import absolute_import
import copy
import hashlib
import re
try:
reduce
except NameError:
from functools import reduce
from functools import partial
from itertools import product
from Cython.Utils import cached_function
from .Code import UtilityCode, LazyUtilityCode, TempitaUtilityCode
from .... | {
"content_hash": "cceda328366456238b22b4818db61288",
"timestamp": "",
"source": "github",
"line_count": 5199,
"max_line_length": 134,
"avg_line_length": 37.387382188882476,
"alnum_prop": 0.5796210456998513,
"repo_name": "cython/cython",
"id": "da30809a37d1f7c52331bb7bec8ab6a31f6407d4",
"size": "194... |
import os
from models import Advertisement, Municipality, ObjectType
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
from sqlalchemy import create_engine
from sklearn.model_selection import train_test_split
from sklearn import metrics
from sklearn.linear_model import LassoLa... | {
"content_hash": "2bdcd48165232500cc434f03314aa35a",
"timestamp": "",
"source": "github",
"line_count": 241,
"max_line_length": 135,
"avg_line_length": 40.83817427385892,
"alnum_prop": 0.6306644990855517,
"repo_name": "bhzunami/Immo",
"id": "b1860031d25f3489bfe8e95f52a5d6e2fd1f2f35",
"size": "9851"... |
'''
Load and Preprocess Sample Images
Before supplying an image to a pre-trained network in Keras, there are some required preprocessing steps. You will learn
more about this in the project; for now, we have implemented this functionality for you in the first code cell of the
notebook. We have imported a very small dat... | {
"content_hash": "494b37234dd1d32845eddf2ece61bdee",
"timestamp": "",
"source": "github",
"line_count": 61,
"max_line_length": 122,
"avg_line_length": 41.868852459016395,
"alnum_prop": 0.7576350822239624,
"repo_name": "coolsgupta/machine_learning_nanodegree",
"id": "514b9a2ef0d63b3b09cdd7b3f5052ae505... |
from bongo.apps.bongo import models
from rest_framework import serializers
class AdvertiserSerializer(serializers.ModelSerializer):
class Meta:
model = models.Advertiser
fields = ('id', 'name',)
| {
"content_hash": "bb52882de1127c360b1db366c3f9564a",
"timestamp": "",
"source": "github",
"line_count": 8,
"max_line_length": 56,
"avg_line_length": 27.125,
"alnum_prop": 0.7235023041474654,
"repo_name": "BowdoinOrient/bongo",
"id": "40cc63c31d29f1107cd03da341445fd5eed91fdd",
"size": "217",
"bina... |
from .context import procamcalib
import unittest
class AdvancedTestSuite(unittest.TestCase):
"""Advanced test cases."""
def test_thoughts(self):
procamcalib.core.hello()
if __name__ == '__main__':
unittest.main()
| {
"content_hash": "11f028ce7a0f5d063a32156596f49001",
"timestamp": "",
"source": "github",
"line_count": 14,
"max_line_length": 43,
"avg_line_length": 17.071428571428573,
"alnum_prop": 0.6610878661087866,
"repo_name": "I2Cvb/procamcalib",
"id": "80812cdc6da57b8798a169d0b4df16aa8e3c48ca",
"size": "26... |
import json
import logging
import threading
import socket
import select
import uuid
import time
from plugs import PlugLess, PlugLs
from ssh_channel import SSHChannel
SESSION_TIMEOUT = 300
BUFF_SIZE = 512
OUT_BUFF_SIZE = 512 # TODO check maximum allowed chunk size for nonblocking write
logger = logging.getLogger('%s'%(... | {
"content_hash": "e648ff4bf80b1a715bddb8893c59c69b",
"timestamp": "",
"source": "github",
"line_count": 351,
"max_line_length": 117,
"avg_line_length": 33.49002849002849,
"alnum_prop": 0.5039557635048916,
"repo_name": "katichev/rt-pager",
"id": "515fba094b8e93431239e56f3096d6dd3652f5e4",
"size": "1... |
_base_ = ['./mask2former_swin-t-p4-w7-224_lsj_8x2_50e_coco-panoptic.py']
pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_base_patch4_window12_384.pth' # noqa
depths = [2, 2, 18, 2]
model = dict(
backbone=dict(
pretrain_img_size=384,
embed_dims=128,
de... | {
"content_hash": "f34bb37122259099c8991928adfb9428",
"timestamp": "",
"source": "github",
"line_count": 42,
"max_line_length": 124,
"avg_line_length": 38.30952380952381,
"alnum_prop": 0.6824114356743319,
"repo_name": "open-mmlab/mmdetection",
"id": "33a805c35eb1aa0adf81b3b69889d3f0a96cf4fa",
"size"... |
# pylint: disable=line-too-long
class BaseNumbers:
NumberReplaceToken = '@builtin.num'
FractionNumberReplaceToken = '@builtin.num.fraction'
IntegerRegexDefinition = lambda placeholder, thousandsmark: f'(((?<!\\d+\\s*)-\\s*)|((?<=\\b)(?<!(\\d+\\.|\\d+,))))\\d{{1,3}}({thousandsmark}\\d{{3}})+(?={placeho... | {
"content_hash": "ddd8c5649aede4af1bdbd0675ee9a283",
"timestamp": "",
"source": "github",
"line_count": 9,
"max_line_length": 200,
"avg_line_length": 67,
"alnum_prop": 0.5854063018242123,
"repo_name": "matthewshim-ms/Recognizers-Text",
"id": "c751eca504d708d6c9862f44276d56fd44e0d3a4",
"size": "959"... |
import json
import os
try:
from unittest.mock import Mock, patch
except ImportError:
from mock import Mock, patch
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import pytest
# Alter path and import modules
from sensu_plugin.handler import SensuHandler
from sensu_plug... | {
"content_hash": "9cef58af0cfce6d94e19f5db36740afe",
"timestamp": "",
"source": "github",
"line_count": 187,
"max_line_length": 78,
"avg_line_length": 33.18716577540107,
"alnum_prop": 0.6040928134063809,
"repo_name": "sensu/sensu-plugin-python",
"id": "b506fae282d0fb53a6a729e8b124f99892b9f297",
"si... |
__author__ = 'July'
# http://agiliq.com/blog/2013/09/understanding-threads-in-python/
#define a global variable
from threading import Thread
from threading import Lock
some_var = 0
lock = Lock()
class IncrementThreadRace(Thread):
def run(self):
#we want to read a global variable
#and then increme... | {
"content_hash": "c6bb9868a5b329f1f4eb11dd972e57cc",
"timestamp": "",
"source": "github",
"line_count": 57,
"max_line_length": 76,
"avg_line_length": 28.964912280701753,
"alnum_prop": 0.6178073894609327,
"repo_name": "JulyKikuAkita/PythonPrac",
"id": "b0cc8af1a683cc2420e4a0bd338d4b358556ad25",
"siz... |
"""The Lucene Query DSL parser based on PLY
"""
# TODO : add reserved chars and escaping, regex
# see : https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html
# https://lucene.apache.org/core/3_6_0/queryparsersyntax.html
import re
import ply.lex as lex
import ply.yacc as yac... | {
"content_hash": "0dd1b85676ef9b626261d0b7cd24d21b",
"timestamp": "",
"source": "github",
"line_count": 254,
"max_line_length": 145,
"avg_line_length": 23.53937007874016,
"alnum_prop": 0.5945810336176618,
"repo_name": "adsabs/object_service",
"id": "f109e518431174d2d51dec2b208959ef2634c64a",
"size"... |
"""Make hex structure libraries for all nif versions.
Installation
------------
Make sure you have PyFFI installed (see http://pyffi.sourceforge.net).
Then, copy makehsl.py to your Hex Workshop structures folder
C:\Program Files\BreakPoint Software\Hex Workshop 4.2\Structures
and run it. This will create a .hsl ... | {
"content_hash": "9281f9256c2da647e5a42a606c6d415f",
"timestamp": "",
"source": "github",
"line_count": 232,
"max_line_length": 118,
"avg_line_length": 40.025862068965516,
"alnum_prop": 0.5858281283652811,
"repo_name": "griest024/PokyrimTools",
"id": "85ca9e46f8e4185b19f812ad5e3d38d45209864e",
"siz... |
"""Query operators for the file backend."""
import operator
import re
import six
if six.PY3:
from functools import reduce
def boolean_operator_query(boolean_operator):
"""Generate boolean operator checking function."""
def _boolean_operator_query(expressions):
"""Apply boolean operator to expres... | {
"content_hash": "fc6d6262ffe0fce4ea7265abceca53eb",
"timestamp": "",
"source": "github",
"line_count": 205,
"max_line_length": 77,
"avg_line_length": 34.13170731707317,
"alnum_prop": 0.608546519937116,
"repo_name": "cwoebker/blitzdb",
"id": "950a65299e4aa9b7b0acdcfb163917b3dfdbdb2a",
"size": "6997... |
import torch
from pyinn.utils import Stream, load_kernel
kernel = """
extern "C"
__global__ void swap(float2 *x, int total)
{
int tx = blockIdx.x * blockDim.x + threadIdx.x;
if(tx >= total)
return;
float2 v = x[tx];
//x[tx] = make_float2(v.y, v.x);
x[tx] = make_float2(v.x, -v.y);
}
"""
CUDA_NUM... | {
"content_hash": "25eb6c3ef7dcb40b5fb7460b2da3b818",
"timestamp": "",
"source": "github",
"line_count": 102,
"max_line_length": 95,
"avg_line_length": 29.627450980392158,
"alnum_prop": 0.5628722700198544,
"repo_name": "szagoruyko/pyinn",
"id": "9efb58ef4719aad1e098715804e1aa11a4994151",
"size": "30... |
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import math
from open_image import open_image
def max_filter(path, region_size):
'''
Values for every pixel equals to the max of all values in the region
:param path: path to the image
:param region_size: size of the ... | {
"content_hash": "67af6ae34d55a28e9f0b8e32a8ead329",
"timestamp": "",
"source": "github",
"line_count": 35,
"max_line_length": 108,
"avg_line_length": 36.628571428571426,
"alnum_prop": 0.6575663026521061,
"repo_name": "vvvityaaa/PyImgProcess",
"id": "5a7ca0faae741af154384e3ee2e108e7fd6fca83",
"size... |
import os
from process import queueProcess, execCmd
from util.data import PackXXTea, RemoveUtf8Bom
import util
projectdir = util.toolsPath
# win32 and android
LuaJitBin = os.path.join(projectdir, "bin/win32/luajit.exe")
LuaBin = os.path.join(projectdir, "bin/win32/luac.exe")
# iOS ... | {
"content_hash": "0e86a8554b54cf8811b3d3fab78360db",
"timestamp": "",
"source": "github",
"line_count": 109,
"max_line_length": 93,
"avg_line_length": 34.862385321100916,
"alnum_prop": 0.5518421052631579,
"repo_name": "lyzardiar/RETools",
"id": "0035ef16e4921eefa9908d469b16ebc5cb7895ac",
"size": "3... |
from http.server import HTTPServer, BaseHTTPRequestHandler
from queue import Queue
from threading import Thread, Event
import json
# Import Tuple type which is used in optional function type annotations.
from typing import Tuple
import keyprofile
class WebServerManager():
"""Creates new web server thread."""
... | {
"content_hash": "fc2d9a096ad1d63fe3079f8c37941a70",
"timestamp": "",
"source": "github",
"line_count": 147,
"max_line_length": 135,
"avg_line_length": 37.72108843537415,
"alnum_prop": 0.6281334535617673,
"repo_name": "miikka-h/Projektikurssi17",
"id": "56c9b576c4b07f06a09432d9df383cacb01c81d5",
"s... |
"""
Module :mod:`pyesgf.search.context`
===================================
Defines the :class:`SearchContext` class which represents each ESGF search
query.
"""
import os
import sys
import copy
from webob.multidict import MultiDict
from .constraints import GeospatialConstraint
from .consts import (TYPE_DATASET, ... | {
"content_hash": "da407163d5158ac53cffb3f0683a48f1",
"timestamp": "",
"source": "github",
"line_count": 363,
"max_line_length": 86,
"avg_line_length": 37.3168044077135,
"alnum_prop": 0.6012845120330725,
"repo_name": "ESGF/esgf-pyclient",
"id": "5e0cf32306ab84c8c928f71ea9954859a6b9d82d",
"size": "13... |
'''
Given a binary tree, check whether it’s a binary search tree or not.
'''
class Node: def __init__(self, val=None):
self.left, self.right, self.val = None, None, val
INFINITY = float("infinity")
NEG_INFINITY = float("-infinity")
def isBST(tree, minVal=NEG_INFINITY, maxVal=INFINITY):
if tree is N... | {
"content_hash": "a6756202be30a1197828baddcb4926be",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 83,
"avg_line_length": 24.46875,
"alnum_prop": 0.6704980842911877,
"repo_name": "jenniferwx/Programming_Practice",
"id": "ca087c2bf539df721e4f79e8430ce0bb7441ed39",
"size":... |
from __future__ import unicode_literals, print_function, absolute_import
import os
def touch(fname):
file = open(fname, "w")
file.write("Hello World")
file.close()
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
return True
return False
| {
"content_hash": "92cbbed887fee98097ae8d5737675238",
"timestamp": "",
"source": "github",
"line_count": 16,
"max_line_length": 72,
"avg_line_length": 18.375,
"alnum_prop": 0.6428571428571429,
"repo_name": "avara1986/ardy",
"id": "edef88d34cf6caf27e921a4e81fd5454a548ac26",
"size": "326",
"binary":... |
import time
import datetime
import dateutil
import stripe
import hashlib
import re
import redis
import uuid
import mongoengine as mongo
from django.db import models
from django.db import IntegrityError
from django.db.utils import DatabaseError
from django.db.models.signals import post_save
from django.db.models import ... | {
"content_hash": "bd81cfe51f5f50e1a74e835a70ff201b",
"timestamp": "",
"source": "github",
"line_count": 1561,
"max_line_length": 163,
"avg_line_length": 44.63741191543882,
"alnum_prop": 0.5680334103531911,
"repo_name": "AlphaCluster/NewsBlur",
"id": "ea72c1b2c996081e3de135af54e58a58c9f12326",
"size... |
from atve.application.atveapplication import AtveTestRunner
| {
"content_hash": "ae82c044a63c1f5e07aa4279b357d85f",
"timestamp": "",
"source": "github",
"line_count": 1,
"max_line_length": 59,
"avg_line_length": 60,
"alnum_prop": 0.9,
"repo_name": "TE-ToshiakiTanaka/atve",
"id": "0959a802db215b2b48a117ea69322ecaf0eb1439",
"size": "60",
"binary": false,
"co... |
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
# Destination settings
source_server = ""
target_server = ""
port = 53
# Build test packet to catch
tcp_pkt = Ether() / IP(dst=target_server) / TCP(dport=port)
print("Sending test packet...\n----")
print(tcp_pkt.summary... | {
"content_hash": "10142ae695bad67c6dd56598fd8631f7",
"timestamp": "",
"source": "github",
"line_count": 15,
"max_line_length": 59,
"avg_line_length": 22.6,
"alnum_prop": 0.7138643067846607,
"repo_name": "Aclark2089/Scapy_DDoS",
"id": "10a8d93b4459c22335154934021cce6706d432d8",
"size": "369",
"bin... |
from django.conf.urls import url
from django.core.exceptions import ObjectDoesNotExist
from django.core.paginator import Paginator, InvalidPage
from django.db.models import Count
from django.http import Http404
from django.template.loader import render_to_string
from tastypie import fields
from tastypie.authoriz... | {
"content_hash": "f0fe401dc26bb4417b19381dc7a62c80",
"timestamp": "",
"source": "github",
"line_count": 244,
"max_line_length": 79,
"avg_line_length": 42.717213114754095,
"alnum_prop": 0.5747865297898878,
"repo_name": "fergalmoran/dss",
"id": "e044d277957c47dd765148e890e8010d01f560f3",
"size": "104... |
#!/usr/bin/python
import realog.debug as debug
import lutin.tools as tools
import os
def get_type():
return "LIBRARY"
def get_desc():
return "opencv CORE library matrix computation evironement"
def get_licence():
return "APAPCHE-2"
def get_maintainer():
return ["Maksim Shabunin <[email protected]>"]
d... | {
"content_hash": "e17cf1a83d702e728f604ef144133089",
"timestamp": "",
"source": "github",
"line_count": 300,
"max_line_length": 89,
"avg_line_length": 38.50333333333333,
"alnum_prop": 0.650333304475803,
"repo_name": "generic-library/opencv-lutin",
"id": "e908c8013a59a811084ff7da860f8669e4d76d65",
"... |
import ConfigParser
import os
config = ConfigParser.ConfigParser()
config.read('rapa.cnf')
mysql_server = config.get('Mysql', 'server')
mysql_port = config.get('Mysql', 'port')
mysql_user = config.get('Mysql', 'user')
mysql_password = config.get('Mysql', 'password')
mysql_database = config.get('Mysql', 'DB')
mysql_da... | {
"content_hash": "89bf77c301cf1277e80bb39acce71ab2",
"timestamp": "",
"source": "github",
"line_count": 33,
"max_line_length": 72,
"avg_line_length": 37.75757575757576,
"alnum_prop": 0.7054574638844302,
"repo_name": "giorgioladu/Rapa",
"id": "36f5bb1a774ae7c3cd0096507f312d00c8f5da83",
"size": "2159... |
def create_controller_js(stream, module):
"""
Creates AngularJS controller from module
:param stream:
:param module:
:return:
"""
from wutu_compiler.utils import get_implemented_methods
from wutu_compiler.core.grammar import Provider, Function, SimpleDeclare
stream.write("wutu.contro... | {
"content_hash": "439404145be8b4b829344ed25e6879d4",
"timestamp": "",
"source": "github",
"line_count": 27,
"max_line_length": 132,
"avg_line_length": 53.81481481481482,
"alnum_prop": 0.6751548520302821,
"repo_name": "zaibacu/wutu-compiler",
"id": "8711bece4fb191d8a3d17bc215cbd3b764f0c356",
"size":... |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting field 'BlogPost.post_ptr'
db.delete_column('cms_blogpost', 'post_ptr_id')
# Adding field 'BlogPost.id'
d... | {
"content_hash": "004d9b7db4cbaafa6c64638d125b2dff",
"timestamp": "",
"source": "github",
"line_count": 131,
"max_line_length": 182,
"avg_line_length": 62.732824427480914,
"alnum_prop": 0.5564614261377464,
"repo_name": "ncsu-stars/Stars-CMS",
"id": "4f1ff15553a54f42548a24bd9f02ddb9191424ba",
"size"... |
"""Site services for use with a Web Site Process Bus."""
import os
import re
import signal as _signal
import sys
import time
import threading
from cherrypy._cpcompat import basestring, get_daemon, get_thread_ident
from cherrypy._cpcompat import ntob, Timer, SetDaemonProperty
# _module__file__base is used by Autorelo... | {
"content_hash": "6537cd03f3a8715c28b96d031e08ed84",
"timestamp": "",
"source": "github",
"line_count": 740,
"max_line_length": 100,
"avg_line_length": 36.002702702702706,
"alnum_prop": 0.5698896479243301,
"repo_name": "CodyKochmann/pi-cluster",
"id": "0ec585c0a6e35910d2ebef06456b2b1db1d3d35d",
"si... |
import re
import json
import sys
pattern = re.compile(r"""\s* # starting whitespaces
(?P<distribution>[\d\.\*]{10}?)\s+ # distribution of votes
(?P<votes>[\d]*?)\s+ # number of votes
(?P<ra... | {
"content_hash": "9ac7d01ceba1e5a5e31e84fe544e6338",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 88,
"avg_line_length": 30.72222222222222,
"alnum_prop": 0.49065702230259195,
"repo_name": "symat/spark-api-comparison",
"id": "5a791342e1b0ff8613e29b2f804535353f8c93ff",
"s... |
import re
import pygame
from log import Logerer
from colours import *
from time import sleep
from numpy import add
class Background(object):
'''class to draw background given a string'''
def __init__(self, name, level_string, verbose=True, screen=False):
'''class for creating background'''
sel... | {
"content_hash": "786b11750c1430370e471ada4e4adf4e",
"timestamp": "",
"source": "github",
"line_count": 148,
"max_line_length": 99,
"avg_line_length": 35.689189189189186,
"alnum_prop": 0.5276410450586899,
"repo_name": "martyni/rusty_game",
"id": "8b79de2fec70715a1198ef56e052f3232065a27d",
"size": "... |
class UnitError(Exception):
'''Unit Error'''
pass
class UnitExecutionError(UnitError):
'''Unit Execution Error'''
pass
class UnitOutputError(UnitError):
'''Unit Output Error'''
pass
| {
"content_hash": "07d53d3fe0a73b495f300819d1cf0717",
"timestamp": "",
"source": "github",
"line_count": 12,
"max_line_length": 36,
"avg_line_length": 17.416666666666668,
"alnum_prop": 0.6602870813397129,
"repo_name": "Harmon758/Harmonbot",
"id": "704c7b85c96b1c5bf0084378925e296dcc8b8bf3",
"size": "... |
from __future__ import annotations
from dynaconf import settings
print(settings.YAML)
print(settings.HOST)
print(settings.PORT)
# using production values for context
with settings.using_env("PRODUCTION"):
print(settings.ENVIRONMENT)
print(settings.HOST)
# back to development env
print(settings.get("ENVIRON... | {
"content_hash": "a65678ea4c0a7cb0b5fe3762e76f92c6",
"timestamp": "",
"source": "github",
"line_count": 45,
"max_line_length": 73,
"avg_line_length": 23.244444444444444,
"alnum_prop": 0.6749521988527725,
"repo_name": "rochacbruno/dynaconf",
"id": "02bedcf4af428c5a7397a50806ae821e16021565",
"size": ... |
"""Tests for the file entry implementation using the SleuthKit (TSK)."""
import unittest
from dfvfs.path import os_path_spec
from dfvfs.path import qcow_path_spec
from dfvfs.path import tsk_path_spec
from dfvfs.resolver import context
from dfvfs.vfs import tsk_file_entry
from dfvfs.vfs import tsk_file_system
from te... | {
"content_hash": "4eefa3cfbf256850e9fdcc5db8823613",
"timestamp": "",
"source": "github",
"line_count": 368,
"max_line_length": 79,
"avg_line_length": 37.27445652173913,
"alnum_prop": 0.7103594080338267,
"repo_name": "dc3-plaso/dfvfs",
"id": "741212fdbfe0741227b8223490bcf8af59184cf9",
"size": "1376... |
"""Pgbouncer check
Collects metrics from the pgbouncer database.
"""
# stdlib
import urlparse
# 3p
import psycopg2 as pg
import psycopg2.extras as pgextras
# project
from checks import AgentCheck, CheckException
class ShouldRestartException(Exception):
pass
class PgBouncer(AgentCheck):
"""Collects metric... | {
"content_hash": "9607ef8f3a9295b60a30f5587a7893e0",
"timestamp": "",
"source": "github",
"line_count": 236,
"max_line_length": 116,
"avg_line_length": 38.355932203389834,
"alnum_prop": 0.5172337604949182,
"repo_name": "serverdensity/sd-agent-core-plugins",
"id": "13dc69bcac4fce0c909c459788817c86a5be... |
"""create report table
Revision ID: d2c3abb804
Revises: 210414005a
Create Date: 2014-05-25 20:05:53.851881
"""
# revision identifiers, used by Alembic.
revision = 'd2c3abb804'
down_revision = '210414005a'
from alembic import context, op
import sqlalchemy as sa
import bauble.db as db
from bauble.model import Report... | {
"content_hash": "03362cdfabb182f23a251c60e209d653",
"timestamp": "",
"source": "github",
"line_count": 54,
"max_line_length": 155,
"avg_line_length": 33.370370370370374,
"alnum_prop": 0.6842397336293008,
"repo_name": "Bauble/bauble.api",
"id": "36a2af795fb529b3b449581668e5a4a5c77229ea",
"size": "1... |
import sys
import os
import tempfile
ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)))
CALLBACK_FILE = os.path.join(ROOT, 'callback_notes')
CACHED_METHOD_FILE = os.path.join(ROOT, 'cached_method_notes')
if not os.path.exists(CACHED_METHOD_FILE):
open(CACHED_METHOD_FILE,'w+')
def callback_for_method... | {
"content_hash": "9bcd202ee2e040840d8c76a2bef7b264",
"timestamp": "",
"source": "github",
"line_count": 32,
"max_line_length": 63,
"avg_line_length": 25.96875,
"alnum_prop": 0.6329723225030084,
"repo_name": "buzzfeed/caliendo",
"id": "35f48979b7b2380624386483ab8900df134e7867",
"size": "831",
"bin... |
import pbr.version
__version__ = pbr.version.VersionInfo(
'backblast').version_string()
| {
"content_hash": "c6a2d6674fed5e1816c3f3179a899a3e",
"timestamp": "",
"source": "github",
"line_count": 5,
"max_line_length": 38,
"avg_line_length": 18.8,
"alnum_prop": 0.7021276595744681,
"repo_name": "kickstandproject/backblast",
"id": "2d2df4ada0b1a2680796bcb1e5f4a9b88f157b18",
"size": "665",
... |
import socket
def send_data(sock,data):
sock.sendall(data)
def receive_data(sock,size = 4096):
data = bytes()
while size:
recv = sock.recv(size)
if not recv:
raise ConnectionError()
data += recv
size -= len(recv)
return data
def nDigit(s,size):
s = str(s)
if(len(s)<size):
s = '0'*(size-len(s))+s
... | {
"content_hash": "3b3e28b77960f1a9904d60e8f089eee6",
"timestamp": "",
"source": "github",
"line_count": 46,
"max_line_length": 68,
"avg_line_length": 22.956521739130434,
"alnum_prop": 0.6998106060606061,
"repo_name": "paramsingh/lazycoin",
"id": "9721823375d9b48e9b55e928d9fc15df05688fc7",
"size": "... |
from datetime import timedelta
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
from pandas import (
DateOffset, Interval, IntervalIndex, Timedelta, Timestamp, date_range,
interval_range, timedelta_range)
import pandas.util.testing as tm
from pandas.tseries.offsets import Da... | {
"content_hash": "c22dcd04c64df88807ae39643fe0cfed",
"timestamp": "",
"source": "github",
"line_count": 314,
"max_line_length": 79,
"avg_line_length": 40.97133757961783,
"alnum_prop": 0.6125145744267392,
"repo_name": "cbertinato/pandas",
"id": "572fe5fbad1005b8ba7eb67a20f64dd375248d9a",
"size": "12... |
import argparse
import os
import re
import shutil
import subprocess
import sys
import tarfile
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \
DIST_ARCH
from lib.util import scoped_cwd, rm_rf, get_atom_shell_version, make_zip, \
safe_mkdir, exec... | {
"content_hash": "7b96de0e7b5af9a1110bedbe4d16fc71",
"timestamp": "",
"source": "github",
"line_count": 285,
"max_line_length": 79,
"avg_line_length": 28.789473684210527,
"alnum_prop": 0.6204753199268739,
"repo_name": "rprichard/electron",
"id": "e623b088c6bd02a6b6b61e21edf9a5caebd1e5e4",
"size": "... |
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, HttpResponseNotAllowed
from django.views.generic import simple
from vt_manager_kvm.controller.users.forms import *
from django.contrib.auth.forms import PasswordChangeF... | {
"content_hash": "e06bb2143fc9c7aecef7c07a335c4f24",
"timestamp": "",
"source": "github",
"line_count": 84,
"max_line_length": 69,
"avg_line_length": 27.857142857142858,
"alnum_prop": 0.6858974358974359,
"repo_name": "ict-felix/stack",
"id": "1b9c765ae1ac6f5fd4783125796e1b5409734087",
"size": "2340... |
import sys
import os
import generic_run
if __name__ == "__main__":
if (len(sys.argv) < 8):
print("This script is not intended for standalone use - integrate with meld instead.")
sys.exit(1)
v, r = generic_run.run_cmd_simple(["meld", sys.argv[2], sys.argv[5]])
if not v:
print(r)
... | {
"content_hash": "2dec6f67c3e247a5f2740bbf48f7ad6a",
"timestamp": "",
"source": "github",
"line_count": 13,
"max_line_length": 94,
"avg_line_length": 25.923076923076923,
"alnum_prop": 0.5816023738872403,
"repo_name": "mvendra/mvtools",
"id": "1f68130bc9efc09bc8ed817ab8f6eef8b93fdbaa",
"size": "361"... |
import datetime
from .base import Database
class InsertVar:
"""
A late-binding cursor variable that can be passed to Cursor.execute
as a parameter, in order to receive the id of the row created by an
insert statement.
"""
types = {
'AutoField': int,
'BigAutoField': int,
... | {
"content_hash": "b0242c4fac7625e089e4be53708d072d",
"timestamp": "",
"source": "github",
"line_count": 76,
"max_line_length": 81,
"avg_line_length": 28.355263157894736,
"alnum_prop": 0.6046403712296984,
"repo_name": "mdworks2016/work_development",
"id": "4617886d832761e5ec92ddd5b0d8282097548dab",
... |
"""All minimum dependencies for scikit-learn."""
from collections import defaultdict
import platform
import argparse
# scipy and cython should by in sync with pyproject.toml
# NumPy version should match oldest-supported-numpy for the minimum supported
# Python version.
# see: https://github.com/scipy/oldest-supporte... | {
"content_hash": "f89f40f13f628ce5df5a8226c037ae40",
"timestamp": "",
"source": "github",
"line_count": 72,
"max_line_length": 86,
"avg_line_length": 36.77777777777778,
"alnum_prop": 0.6393504531722054,
"repo_name": "scikit-learn/scikit-learn",
"id": "6d4183b29eec538c9b8b00a8fbcee793d90d63cc",
"siz... |
import os
from io import BytesIO
import glob
import math
import random
import sys
import PIL
import numpy as np
from numpy import argmax, array
from sklearn.model_selection import train_test_split
from keras.callbacks import Callback, ModelCheckpoint, TensorBoard
from keras.models import Model
from keras.utils import n... | {
"content_hash": "a96b0426b795e5eca736989a1c9aa376",
"timestamp": "",
"source": "github",
"line_count": 413,
"max_line_length": 153,
"avg_line_length": 34.30992736077482,
"alnum_prop": 0.6160197600564573,
"repo_name": "utensil/julia-playground",
"id": "e5b1aa47473a3ea9ddcb49330e36449d0846ca4b",
"si... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.