text
stringlengths
4
1.02M
meta
dict
from django.urls import path from wagtail.contrib.forms.views import ( DeleteSubmissionsView, FormPagesListView, get_submissions_list_view, ) app_name = "wagtailforms" urlpatterns = [ path("", FormPagesListView.as_view(), name="index"), path( "submissions/<int:page_id>/", get_submissions_l...
{ "content_hash": "9299c8bca981efce55ed006188db0ace", "timestamp": "", "source": "github", "line_count": 20, "max_line_length": 88, "avg_line_length": 25.05, "alnum_prop": 0.6526946107784432, "repo_name": "zerolab/wagtail", "id": "bd209c42e8ab052fb15be65b72d4dd87b7c8fa3d", "size": "501", "binary":...
from oslo_log import log as logging from heat_integrationtests.common import test from heat_integrationtests.scenario import scenario_base LOG = logging.getLogger(__name__) class CeilometerAlarmTest(scenario_base.ScenarioTestsBase): """Class is responsible for testing of ceilometer usage.""" def setUp(self)...
{ "content_hash": "599b0ef0a52db5e6b8bc033eb910bfb5", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 77, "avg_line_length": 41.355555555555554, "alnum_prop": 0.584631918323482, "repo_name": "steveb/heat", "id": "aa29861a8e1722a6057a6c5131fb96c94b15dca8", "size": "2434", ...
""" This module provides the function riptimize() that is intended to optimize AWS Reserved Instance (RI) utilization by redistributing RIs across the typically 3 availability zones (AZs) in a single RI holding account. The premise of the script is that there exist many AWS accounts linked via consolidated billing...
{ "content_hash": "8a611c39ce2c3de8efd9ed7e458ab1d5", "timestamp": "", "source": "github", "line_count": 334, "max_line_length": 212, "avg_line_length": 49.532934131736525, "alnum_prop": 0.653227756286267, "repo_name": "dbatalov/ri-optimizer", "id": "acc34f6954595823b03da32b66e0eddaf3a2a5af", "size"...
class ClusterTask(object): """ Stores the different kind of tasks being performed by a cluster. """ _lookup = {} def __init__(self, code, name, description): self._code = int(code) self._name = name self._description = description ClusterTask._lookup[self._code] = se...
{ "content_hash": "7cbe1693ec0cd7f13203437a21994db0", "timestamp": "", "source": "github", "line_count": 59, "max_line_length": 73, "avg_line_length": 29.084745762711865, "alnum_prop": 0.5856643356643356, "repo_name": "redhat-openstack/trove", "id": "b91fc1a5fb66eab8ee923f998f567f04f93be28e", "size"...
import mock import testscenarios from oslo import messaging from oslo.messaging import serializer as msg_serializer from tests import utils as test_utils load_tests = testscenarios.load_tests_apply_scenarios class _FakeEndpoint(object): def __init__(self, target=None): self.target = target def foo...
{ "content_hash": "0a1b42ac5f481866df3170e16bb57621", "timestamp": "", "source": "github", "line_count": 161, "max_line_length": 79, "avg_line_length": 38.29192546583851, "alnum_prop": 0.5506893755068938, "repo_name": "JioCloud/oslo.messaging", "id": "8d12278a26cb276d8ee4a96da9a65104533b72fb", "size...
from app.validation.abstract_validator import AbstractValidator from app.validation.validation_result import ValidationResult class MandatoryCheck(AbstractValidator): def validate(self, user_answer): """ Validate that a field is mandatory :param user_answer: The answer the user provided f...
{ "content_hash": "2f99010c82fa7d705f7e088a43652f90", "timestamp": "", "source": "github", "line_count": 36, "max_line_length": 86, "avg_line_length": 37.72222222222222, "alnum_prop": 0.6723122238586157, "repo_name": "qateam123/eq", "id": "6184eeddcbdaa2e48cc1ba761b092956d2ef1452", "size": "1358", ...
""" Created on Fri May 5 09:49:09 2017 @author: dhingratul Create a softmax function to translate Scores into probabilities as a part of Lesson1, Quiz 10 To Do: Add legend to the graph """ import numpy as np import matplotlib.pyplot as plt scores = [3.0, 1.0, 0.2] def softmax(x): """Compute softmax values for e...
{ "content_hash": "90e444341a274a14f290ac0c3a2bc67d", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 64, "avg_line_length": 23.68, "alnum_prop": 0.6858108108108109, "repo_name": "dhingratul/Deep-Learning", "id": "7aa7cd231f0dfacde6d728bf2d824305a3e688be", "size": "639", ...
import sys from cg_trace.main import main sys.exit(main())
{ "content_hash": "ef63f925c4a8d071ce5a7c024b3536be", "timestamp": "", "source": "github", "line_count": 5, "max_line_length": 30, "avg_line_length": 12.2, "alnum_prop": 0.7377049180327869, "repo_name": "github/codeql", "id": "90cc057208a3e92b159aae9f527fed137a39ba8b", "size": "61", "binary": fals...
''' Module for sending messages to Pushover (https://www.pushover.net) .. versionadded:: 2016.3.0 :configuration: This module can be used by either passing an api key and version directly or by specifying both in a configuration profile in the salt master/minion config. For example: .. code-block:: ...
{ "content_hash": "1355dd274e063020b2de904590f8326c", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 162, "avg_line_length": 33.19672131147541, "alnum_prop": 0.6207407407407407, "repo_name": "stephane-martin/salt-debian-packaging", "id": "868fbc581a6f36da7007e1df1e5be25fccd...
import os from setuptools import setup, find_packages def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name="c7n", version='0.8.25.1', description="Cloud Custodian - Policy Rules Engine", long_description=read('README.rst'), classifiers=[ "To...
{ "content_hash": "cf47a9237b90a9eea3f4046c7944e6c6", "timestamp": "", "source": "github", "line_count": 33, "max_line_length": 70, "avg_line_length": 24.575757575757574, "alnum_prop": 0.5795314426633785, "repo_name": "jdubs/cloud-custodian", "id": "629089d4b5dc96f7bf0f6377e58fe9e2787580bb", "size":...
def Binary2Decimal(bin_num): """ Return the decimal representation of bin_num This actually uses the built-in int() function, but is wrapped in a function for consistency """ return int(bin_num, 2) def Decimal2Binary(dec_num): """ Return the binary representation of dec_num """ i...
{ "content_hash": "ea483b7a43eda4ade966e47e77b2513d", "timestamp": "", "source": "github", "line_count": 45, "max_line_length": 56, "avg_line_length": 22.022222222222222, "alnum_prop": 0.6478304742684158, "repo_name": "ActiveState/code", "id": "c631a1d1a6b41b14553ec48794b4729e541ea188", "size": "101...
""" This module contains the checker mode, a base class for code checker modes. """ import logging from pyqode.core.api import TextBlockUserData from pyqode.core.api.decoration import TextDecoration from pyqode.core.api.mode import Mode from pyqode.core.backend import NotRunning from pyqode.core.api.utils import DelayJ...
{ "content_hash": "ddbd39b05c77a9b3913fe5cf096d71c6", "timestamp": "", "source": "github", "line_count": 349, "max_line_length": 79, "avg_line_length": 35.23495702005731, "alnum_prop": 0.575668862324144, "repo_name": "zwadar/pyqode.core", "id": "d50837e1a6cd6fdfbad31059888957137207a65b", "size": "12...
""" Compare volume average temperature profiles, Tv, from 1-D model and 3-D Comsol simulation of white oak particles with Feret diameters of DF = 200 um to 20 mm. Surface area to volume diameter, Dsv, is used for the 1-D model. Requirements: Python 3, NumPy, SciPy, Matplotlib, funcHeatCond, funcOther """ import numpy...
{ "content_hash": "0df2f4f9a96b646a075452b65d8c48b8", "timestamp": "", "source": "github", "line_count": 250, "max_line_length": 81, "avg_line_length": 42.292, "alnum_prop": 0.5996405939657619, "repo_name": "pyrolysis/low-order-particle", "id": "4de209eef7bd3495477d1be9ab96406f9ed1ff93", "size": "10...
# standard library imports from struct import unpack # custom import from .DataTypeConverters import readBew, readVar, varLen class RawInstreamFile: """ It parses and reads data from an input file. It takes care of big endianess, and keeps track of the cursor position. The midi p...
{ "content_hash": "40b39a82b64a67d58e5d19c363c672b7", "timestamp": "", "source": "github", "line_count": 106, "max_line_length": 71, "avg_line_length": 28.764150943396228, "alnum_prop": 0.5651033125614956, "repo_name": "nanotone/midihub", "id": "637f71841bb4c19d8b8044b1192b98be4b532320", "size": "30...
from airflow.exceptions import AirflowException from airflow.hooks.http_hook import HttpHook from airflow.models import BaseOperator from airflow.utils.decorators import apply_defaults class SimpleHttpOperator(BaseOperator): """ Calls an endpoint on an HTTP system to execute an action :param http_conn_id...
{ "content_hash": "558a182dc15103722652dc6c90b144f3", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 79, "avg_line_length": 40.0375, "alnum_prop": 0.621604745551046, "repo_name": "owlabs/incubator-airflow", "id": "8b8532bff2185fdfaf32e332a9cd97105772ffd9", "size": "4015", ...
from .qidian_ranking import QidianRankingSpider from .zh_ranking import ZHRankingSpider
{ "content_hash": "8e61ed566dd3b17f94aceb434dd4aa76", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 47, "avg_line_length": 43.5, "alnum_prop": 0.8735632183908046, "repo_name": "howie6879/owllook", "id": "8e0a99b82438e74cda6b352ace4af89536c9e564", "size": "87", "binary": ...
""" magrathea.core.feed.entry ~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: Copyright 2014 by the RootForum.org team, see AUTHORS. :license: MIT License, see LICENSE for details. """ import base64 import calendar import time from ...utils.convert import to_str, to_bytes from .info import FeedInfo def get_ent...
{ "content_hash": "39845a1c4ca7bf4623c38660d636ac66", "timestamp": "", "source": "github", "line_count": 169, "max_line_length": 117, "avg_line_length": 29.745562130177515, "alnum_prop": 0.5872289635965785, "repo_name": "RootForum/magrathea", "id": "79469de5422df8b871a2ff04e92c210bc18fff0c", "size":...
from decimal import Decimal from twisted.internet import defer from twisted.internet import reactor class SoftwareModule: module = '' def __init__(self, module): self._module = module if not self.module: raise ValueError("Must set a module name") def log(sel...
{ "content_hash": "859fc755531974906a2d7b567559c99e", "timestamp": "", "source": "github", "line_count": 102, "max_line_length": 100, "avg_line_length": 28.333333333333332, "alnum_prop": 0.5335640138408304, "repo_name": "offmessage/blackpearl", "id": "784256a12422f334508e7a08b3da721d29633791", "size...
from django.conf.urls import url from django.views.generic.base import TemplateView from expdj import settings from expdj.apps.experiments.views import (add_battery, add_experiment, add_experiment_template, add_game_template, ...
{ "content_hash": "19b20933d3a383c3404fa7428f4ff50d", "timestamp": "", "source": "github", "line_count": 150, "max_line_length": 123, "avg_line_length": 44.46, "alnum_prop": 0.5107212475633528, "repo_name": "expfactory/expfactory-docker", "id": "fe230d40b7b0e9ce209f1ade064833009f37b323", "size": "66...
command = oslc ("-q -MMD test.osl") # Test deps to custom file location command += oslc ("-q -MMD -MFmydep.d test.osl") # Test deps to stdout command += oslc ("-MM test.osl") # Test deps with custom target command += oslc ("-q -MMD -MF mycustom.d -MT customtarget test.osl") outputs = [ "test.d", "mydep.d", "mycusto...
{ "content_hash": "b4ac1e9a4d37fec6fd3822aebb0c1aeb", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 68, "avg_line_length": 26.076923076923077, "alnum_prop": 0.6489675516224189, "repo_name": "imageworks/OpenShadingLanguage", "id": "88d7b8f5ce3c39ddf454ecbd2faf121054fc567f", ...
"""Common types for gRPC Async API""" from typing import (Any, AnyStr, AsyncIterable, Callable, Iterable, Sequence, Tuple, TypeVar, Union) from grpc._cython.cygrpc import EOF RequestType = TypeVar('RequestType') ResponseType = TypeVar('ResponseType') SerializingFunction = Callable[[Any], bytes] D...
{ "content_hash": "28d764d509baf80ad62672a00b0c5362", "timestamp": "", "source": "github", "line_count": 17, "max_line_length": 77, "avg_line_length": 36, "alnum_prop": 0.7516339869281046, "repo_name": "jboeuf/grpc", "id": "205f6dc622766075b3e91d1479642f0591cf563c", "size": "1192", "binary": false...
import os from argparse import ArgumentParser from typing import Any, Set import orjson from django.conf import settings from requests.packages.urllib3.util.retry import Retry from zerver.lib.management import ZulipBaseCommand from zerver.lib.outgoing_http import OutgoingSession class TorDataSession(OutgoingSession...
{ "content_hash": "919f7a83f3a7089f72171b2c7bd974db", "timestamp": "", "source": "github", "line_count": 74, "max_line_length": 82, "avg_line_length": 34.054054054054056, "alnum_prop": 0.6083333333333333, "repo_name": "eeshangarg/zulip", "id": "b5299ff48c16f0eac26c4774c43f2849998b3093", "size": "252...
from _pydevd_bundle.pydevd_constants import RETURN_VALUES_DICT, dict_iter_items, \ GET_FRAME_NORMAL_GROUP, GET_FRAME_SPECIAL_GROUP HIDDEN_TYPES = ('function', 'type', 'classobj', 'module', 'typing') DOUBLE_UNDERSCORE = '__' DOUBLE_EX = '__exception__' DUMMY_RET_VAL = '_dummy_ret_val' DUMMY_IPYTHON_HIDDEN = '_dummy...
{ "content_hash": "5b149877c87f61132a6869f18757fe0a", "timestamp": "", "source": "github", "line_count": 279, "max_line_length": 125, "avg_line_length": 39.12544802867384, "alnum_prop": 0.575302308537926, "repo_name": "GunoH/intellij-community", "id": "a7df8067ff570cf17d590013fe34e8867443aa17", "siz...
"""Common classes for automatic speech recognition (ASR) datasets. The audio import uses sox to generate normalized waveforms, please install it as appropriate (e.g. using apt-get or yum). """ import numpy as np from tensor2tensor.data_generators import audio_encoder from tensor2tensor.data_generators import problem...
{ "content_hash": "95340df3d2ad80f7ae4835a136261e34", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 80, "avg_line_length": 36.2, "alnum_prop": 0.6663833404164896, "repo_name": "mlperf/training_results_v0.5", "id": "04891d50e8eca52f07337b378297b80208821b95", "size": "5312...
from __future__ import absolute_import import six from geocoder.base import Base from geocoder.keys import here_app_id, here_app_code class Here(Base): """ HERE Geocoding REST API ======================= Send a request to the geocode endpoint to find an address using a combination of country, stat...
{ "content_hash": "73e298a5b06c1a186116dfd84fc68b32", "timestamp": "", "source": "github", "line_count": 127, "max_line_length": 89, "avg_line_length": 27.95275590551181, "alnum_prop": 0.58, "repo_name": "akittas/geocoder", "id": "d5d43cb025573f6d5418288ad1c11842665542ba", "size": "3584", "binary"...
from libcloud.common.types import LibcloudError from libcloud.common.aws import SignedAWSConnection from libcloud.storage.drivers.s3 import BaseS3Connection from libcloud.storage.drivers.s3 import BaseS3StorageDriver from libcloud.storage.drivers.s3 import API_VERSION __all__ = [ "MinIOStorageDriver" ] class Min...
{ "content_hash": "af04dee114fd93b462a4a0e512a88f79", "timestamp": "", "source": "github", "line_count": 46, "max_line_length": 76, "avg_line_length": 39.891304347826086, "alnum_prop": 0.49209809264305177, "repo_name": "Kami/libcloud", "id": "9a496562b4d0ac4a4e0c044ebbd0c1ae755c4ffe", "size": "2617"...
from django.dispatch import receiver from django.db.models import signals from schedule.models import ScheduleEntry, ScheduleTransaction @receiver(signals.post_save, sender=ScheduleEntry) def create_add_transaction(sender, instance, **kwargs): ScheduleTransaction(user=instance.user, term=instance.term, course_crn=...
{ "content_hash": "c13a10e9433f0ceb900a488804bf833e", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 135, "avg_line_length": 49.53846153846154, "alnum_prop": 0.8043478260869565, "repo_name": "gravitylow/OpenCourse", "id": "fcfd4ebd7326bef897835e3e9355305bee155b20", "size":...
from .calc import Mass_eff
{ "content_hash": "36c20a2702a7e66d5f384c7f695326c3", "timestamp": "", "source": "github", "line_count": 1, "max_line_length": 26, "avg_line_length": 27, "alnum_prop": 0.7777777777777778, "repo_name": "wayn3/masseff", "id": "03159b924573e3bb76ab4e63b4f9d2c88f8eed6e", "size": "27", "binary": false,...
import os from threading import RLock from weavelib.exceptions import ObjectAlreadyExists class SynonymRegistry(object): def __init__(self): self.synonym_lock = RLock() self.synonyms = {} def register(self, synonym, target): synonym = os.path.join("/synonyms", synonym.lstrip('/')) ...
{ "content_hash": "1fb025ca3f21a6bc46bb6042cc751cc2", "timestamp": "", "source": "github", "line_count": 24, "max_line_length": 64, "avg_line_length": 26.75, "alnum_prop": 0.6339563862928349, "repo_name": "supersaiyanmode/HomePiServer", "id": "3936713b058e893ba4a6cbb3d140db92fac4b2a5", "size": "642"...
"""The implementation of the SocketOptionsAdapter.""" import socket import warnings import sys import requests from requests import adapters from .._compat import connection from .._compat import poolmanager from .. import exceptions as exc class SocketOptionsAdapter(adapters.HTTPAdapter): """An adapter for req...
{ "content_hash": "c2635b3a2370e3e352b2b9287673be60", "timestamp": "", "source": "github", "line_count": 128, "max_line_length": 79, "avg_line_length": 37.2265625, "alnum_prop": 0.6100734522560336, "repo_name": "endlessm/chromium-browser", "id": "f8aef5dd5e99db598248df22223ce7ee67ab0824", "size": "4...
from tempfile import mkstemp from os import getcwd, remove, close from unittest import TestCase, main from functools import partial from os.path import join from skbio.util import get_data_path from burrito.util import ApplicationError from micronota.bfillings.hmmer import (HMMScan, hmmscan_fasta, ...
{ "content_hash": "caf479b2ec7431c4d99048264e0b6de5", "timestamp": "", "source": "github", "line_count": 97, "max_line_length": 77, "avg_line_length": 33.72164948453608, "alnum_prop": 0.5261387954753898, "repo_name": "mortonjt/micronota", "id": "a11acadebfb00eeb594f8c1b0457cf98e8659ea4", "size": "36...
"""Mujoco environment from OpenAI gym.""" from absl import flags import gym from gym import spaces import numpy as np from seed_rl.common import common_flags from seed_rl.common import env_wrappers from seed_rl.mujoco import toy_env FLAGS = flags.FLAGS class SinglePrecisionWrapper(gym.Wrapper): """Single preci...
{ "content_hash": "7baddf7bc1e4221548d574895a223fb6", "timestamp": "", "source": "github", "line_count": 96, "max_line_length": 79, "avg_line_length": 31.885416666666668, "alnum_prop": 0.6625285854295981, "repo_name": "google-research/seed_rl", "id": "7852609fd6a1edf9187ca582316a03e0b8a8fb4d", "size...
"""payu.models.mom6 ================ Driver interface to the MOM6 ocean model. :copyright: Copyright 2011 Marshall Ward, see AUTHORS for details :license: Apache License, Version 2.0, see LICENSE for details """ # Standard library import os # Extensions import f90nml # Local from payu.models.fms import...
{ "content_hash": "12e0e5d7570e1461b359e3c1631fbb49", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 68, "avg_line_length": 23.106666666666666, "alnum_prop": 0.5401038661281016, "repo_name": "marshallward/payu", "id": "77fbf0584bbc7c492cf51600d199cd21e4ff4ed0", "size": "17...
""" Provides testing capabilities and customisations specific to tephi. .. note:: This module needs to control the matplotlib backend, so it **must** be imported before ``matplotlib.pyplot``. By default, this module sets the matplotlib backend to "agg". But when this module is imported it checks ``sys.argv`...
{ "content_hash": "01aef76583c93099eb75157c68beb099", "timestamp": "", "source": "github", "line_count": 265, "max_line_length": 79, "avg_line_length": 34.61132075471698, "alnum_prop": 0.5604012211077192, "repo_name": "SciTools/tephi", "id": "478c858c83a9091adf6e25f47acbe50bdc0bf0dd", "size": "9345"...
def displayInventory(inv): output = "Inventory:\n" itemCount = 0 #keys = List(inv.keys()).sort() for k in sorted(inv.keys()): output += "{val} {k}\n".format(val=inv[k], k = k) itemCount += inv[k] output += "\nTotal number of items: {count}\n".format(count = itemCount) return output def addToInventory(inv, it...
{ "content_hash": "b3844425390b2b91be867c84e0f76756", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 73, "avg_line_length": 30.923076923076923, "alnum_prop": 0.6517412935323383, "repo_name": "joeryan/pytest-practice", "id": "b98b143780a8b3bd7aac6b95c0ea3f46a1e176a1", "size...
""" toposort.py Sorts dictionary keys based on lists of dependencies. """ class MissingDependency(Exception): """Exception raised when a listed dependency is not in the dictionary.""" class Sorter(object): def __init__(self, dependencies): self.dependencies = dependencies self.visited = set() ...
{ "content_hash": "0a14d1270e8afe93833620d1f5aa01c5", "timestamp": "", "source": "github", "line_count": 35, "max_line_length": 77, "avg_line_length": 30.62857142857143, "alnum_prop": 0.6324626865671642, "repo_name": "flavour/eden", "id": "d4d67ca8488c22ddeb6d14672322eca1db6f901b", "size": "1072", ...
class Credits(): def __init__(self): self.creditsText = ["Oregon Trail - A PyGame clone", "", "Created by:", "Zak - Programming", "David - Programming + Graphics", "", "Thanks for playing!"]
{ "content_hash": "5c1aca66501076da8c849cfafad93c4e", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 54, "avg_line_length": 21.90909090909091, "alnum_prop": 0.5145228215767634, "repo_name": "ZakDoesGaming/OregonTrail", "id": "82eedf99229008690755a04513d5ac79bbcc779d", "siz...
import os import sys import numpy as np from django.conf import settings import django django.setup() import logging logger = logging.getLogger("neurodata") class HistStats(): def mean(self, histogram, bins): """ Given a histogram and the bin widths, calculate the mean for the histogram and return it "...
{ "content_hash": "4b1e8f39e6cf4db0b8e4bf3c3c7131cb", "timestamp": "", "source": "github", "line_count": 83, "max_line_length": 89, "avg_line_length": 26.518072289156628, "alnum_prop": 0.6160835983643799, "repo_name": "openconnectome/open-connectome", "id": "802f9b398ebba356a52b6e6c9005eae09f5c3cee", ...
import django import os from distutils.version import LooseVersion from django.utils.functional import LazyObject from django.core.files.storage import get_storage_class #The following class is taken from https://github.com/jezdez/django/compare/feature/staticfiles-templatetag #and should be removed and replaced by t...
{ "content_hash": "c00236dccab12d042abef4e60fe4f262", "timestamp": "", "source": "github", "line_count": 29, "max_line_length": 107, "avg_line_length": 34.06896551724138, "alnum_prop": 0.7530364372469636, "repo_name": "divio/djangocms-table", "id": "170a3ecaa11248e41e8b5e89ed51c9d19b28b238", "size":...
__source__ = 'https://github.com/kamyu104/LeetCode/blob/master/Python/ternary-expression-parser.py' # https://leetcode.com/problems/ternary-expression-parser/#/description # Time: O(n) # Space: O(1) # # Description: 439. Ternary Expression Parser # # Given a string representing arbitrarily nested ternary expressions, ...
{ "content_hash": "f325bf03a87b4e4f780bc9c074ad8833", "timestamp": "", "source": "github", "line_count": 126, "max_line_length": 107, "avg_line_length": 31.27777777777778, "alnum_prop": 0.5257548845470693, "repo_name": "JulyKikuAkita/PythonPrac", "id": "bd947c849be5f79652edd1ac341c54ddb5f00749", "si...
import datetime as dt from dateutil.relativedelta import relativedelta from datetime import datetime, timedelta from calendar import isleap import pandas as pd def convert_datetime(df): datecols = df.dtypes.index[df.dtypes.index.str.contains('DATE')==True].values for item in datecols: try: ...
{ "content_hash": "26365d33dae0cf45e32b6fcc8ebe0fe4", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 81, "avg_line_length": 30.846153846153847, "alnum_prop": 0.6932668329177057, "repo_name": "igotcharts/charts_and_more_charts", "id": "0cb1ad7b2a1e4fdd3cbf9bf3c06698b65f0e1de1...
from msrest.serialization import Model class SecurityGroupNetworkInterface(Model): """Network interface and all its associated security rules. :param id: ID of the network interface. :type id: str :param security_rule_associations: :type security_rule_associations: ~azure.mgmt.network.v2017_...
{ "content_hash": "4254f24efda1100e1f1775de7591fd66", "timestamp": "", "source": "github", "line_count": 22, "max_line_length": 110, "avg_line_length": 35, "alnum_prop": 0.6805194805194805, "repo_name": "AutorestCI/azure-sdk-for-python", "id": "b087e727a80cc9a0f7c86958d6b00536c8ad83a8", "size": "124...
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("ddcz", "0015_auto_20180614_2308"), ] operations = [ migrations.AlterModelOptions( name="monster", options={"verbose_name": "Nestvůra", "verbose_name_plural": "Bestiá...
{ "content_hash": "304aa96183cd9ee83129f1378ef59321", "timestamp": "", "source": "github", "line_count": 26, "max_line_length": 83, "avg_line_length": 27.26923076923077, "alnum_prop": 0.5613540197461213, "repo_name": "dracidoupe/graveyard", "id": "d8fdcd330f7ec7f0e3b7eba68a6137190fc32a73", "size": "...
from eiger import EigerImages from edf import EDFImages
{ "content_hash": "6570b193b98cc397f0f0c11a8451fbec", "timestamp": "", "source": "github", "line_count": 2, "max_line_length": 29, "avg_line_length": 28, "alnum_prop": 0.8571428571428571, "repo_name": "brunoseivam/chxtools", "id": "5e011ebeab165839dde288ce35ddc40a041ef29c", "size": "56", "binary":...
""" news_data.pipeline.metric_writer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [Pipeline Step 4 of 4] This module subscribes to the 'analyzed_articles' queue and listens for jobs. When it receives a job, it reads the analyzed article results and creates metric data. This is then written to the DB. ...
{ "content_hash": "113673302b2b618f957d32f48362726c", "timestamp": "", "source": "github", "line_count": 258, "max_line_length": 79, "avg_line_length": 32.58914728682171, "alnum_prop": 0.5972882968601332, "repo_name": "lbracken/news_data", "id": "e890d12036a7c87f26da8b35a349236cd09371a1", "size": "8...
''' Module for gathering disk information ''' from __future__ import absolute_import # Import python libs import logging import os import re # Import salt libs import salt.utils import salt.utils.decorators as decorators from salt.exceptions import CommandExecutionError from salt.ext.six.moves import zip log = logg...
{ "content_hash": "39e6d66c20de0a73bc13bf07a4cb45d6", "timestamp": "", "source": "github", "line_count": 249, "max_line_length": 107, "avg_line_length": 27.48995983935743, "alnum_prop": 0.4821037253469686, "repo_name": "smallyear/linuxLearn", "id": "3c4ca3162e0e3819bfcbb333e23e64e43be2e0d7", "size":...
import unittest from recipeformats import mmf class TestParseRecipe(unittest.TestCase): def assert_equal(self, actual, expected_title, expected_categories, expected_yield, expected_servings, expected_ingredients, expected_directions): actual_ingredients = [repr(...
{ "content_hash": "da63c3e1284f63027d335999035e25b0", "timestamp": "", "source": "github", "line_count": 1238, "max_line_length": 220, "avg_line_length": 40.225363489499195, "alnum_prop": 0.5159340549007008, "repo_name": "samjavner/recipeformats", "id": "ce63bf44fea3c0509b4f6e96be91f0e9c127393a", "s...
"""The tests for the Season integration.""" from datetime import datetime from freezegun import freeze_time import pytest from homeassistant.components.season.const import ( DOMAIN, TYPE_ASTRONOMICAL, TYPE_METEOROLOGICAL, ) from homeassistant.components.season.sensor import ( STATE_AUTUMN, STATE_S...
{ "content_hash": "edf6513c3e1344368900538903d5b343", "timestamp": "", "source": "github", "line_count": 158, "max_line_length": 78, "avg_line_length": 34.21518987341772, "alnum_prop": 0.6825749167591565, "repo_name": "w1ll1am23/home-assistant", "id": "0c2470edb7bf5d4cffa7597cc737784ae8af1158", "siz...
""" A set of methods to get coordinate maps which represent slices in space. """ from nipy.core.reference.coordinate_system import CoordinateSystem from nipy.core.reference.coordinate_map import Affine from nipy.core.reference.array_coords import ArrayCoordMap import numpy as np __docformat__ = 'restructuredtext' d...
{ "content_hash": "cabcba58b70392bd2b9b7c5751784be0", "timestamp": "", "source": "github", "line_count": 122, "max_line_length": 76, "avg_line_length": 27.704918032786885, "alnum_prop": 0.5662721893491124, "repo_name": "yarikoptic/NiPy-OLD", "id": "fb10876046afcbce2e80b06c7bd92a401558ea19", "size": ...
from setuptools import setup, find_packages setup( name="easy dataset scrapper", version="0.1.1", description="A lightweight base class to create a dataset scrapper", author="Iuga", packages=find_packages(exclude=["tests", "tools", "docs", ".github"]), install_requires=[] )
{ "content_hash": "e070a613c2c864f81cde495604db3afc", "timestamp": "", "source": "github", "line_count": 10, "max_line_length": 74, "avg_line_length": 30, "alnum_prop": 0.6766666666666666, "repo_name": "iuga/easy_dataset_scrapper", "id": "58cfa54a552abfbd14bf38054dc8a7e713f2e28e", "size": "300", "...
from . import generic # http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.pdf arch = 'ARM' R_ARM_COPY = generic.GenericCopyReloc R_ARM_GLOB_DAT = generic.GenericJumpslotReloc R_ARM_JUMP_SLOT = generic.GenericJumpslotReloc R_ARM_RELATIVE = generic.GenericRelativeReloc R_ARM_ABS32 = generic.Gener...
{ "content_hash": "989f44e8e83e950e0f8919bb2c21b7e5", "timestamp": "", "source": "github", "line_count": 14, "max_line_length": 78, "avg_line_length": 35.357142857142854, "alnum_prop": 0.8141414141414142, "repo_name": "chubbymaggie/cle", "id": "29ff6f414bac9020dd30aa46d7ff24fb22c3b53a", "size": "495...
import os from pymessenger2 import Element, Button from pymessenger2.bot import Bot TOKEN = os.environ.get('TOKEN') APP_SECRET = os.environ.get('APP_SECRET') bot = Bot(TOKEN, app_secret=APP_SECRET) recipient_id = os.environ.get('RECIPIENT_ID') def test_wrong_format_message(): result = bot.send_text_message(re...
{ "content_hash": "902f7aa1d8b7ff6d506096cf4de3b51c", "timestamp": "", "source": "github", "line_count": 80, "max_line_length": 123, "avg_line_length": 32.6875, "alnum_prop": 0.6887189292543021, "repo_name": "karlinnolabs/pymessenger", "id": "0ee4689bf742bb5efed7c42222a95b631631b4f0", "size": "2615"...
"Test pyshell, coverage 12%." # Plus coverage of test_warning. Was 20% with test_openshell. from idlelib import pyshell import unittest from test.support import requires from tkinter import Tk class PyShellFileListTest(unittest.TestCase): @classmethod def setUpClass(cls): requires('gui') cl...
{ "content_hash": "462795b32a7b7306e79e6d9b796f55fd", "timestamp": "", "source": "github", "line_count": 42, "max_line_length": 78, "avg_line_length": 31.11904761904762, "alnum_prop": 0.6794185156847743, "repo_name": "zooba/PTVS", "id": "581444ca5ef21fe9041424bf7629808db7d0b9b7", "size": "1307", "...
""" Created on Sat Sep 2 09:41:08 2017 @author: Kirby Urner """ from math import gcd from string import ascii_lowercase from random import shuffle import unittest def totatives(n): return {x for x in range(n) if gcd(x, n) == 1} def totient(n): return len(totatives(n)) class M: # for "modulo" mod...
{ "content_hash": "e7b1eaa5b5199008306fd2f71230eaee", "timestamp": "", "source": "github", "line_count": 217, "max_line_length": 81, "avg_line_length": 28.857142857142858, "alnum_prop": 0.48658575534972853, "repo_name": "4dsolutions/Python5", "id": "f3fb3cf1bd2156fdcd747a96432a9fb0804a2107", "size":...
""" Claim objects for use with resource tracking. """ from nova.openstack.common import jsonutils from nova.openstack.common import lockutils from nova.openstack.common import log as logging LOG = logging.getLogger(__name__) COMPUTE_RESOURCE_SEMAPHORE = "compute_resources" class NopClaim(object): """For use wit...
{ "content_hash": "099de21037f15e274f72dc8c89725eeb", "timestamp": "", "source": "github", "line_count": 205, "max_line_length": 79, "avg_line_length": 31.84390243902439, "alnum_prop": 0.6024816176470589, "repo_name": "houshengbo/nova_vmware_compute_driver", "id": "c4828b823f25f30ff1ce68f58abc98195d6d...
__author__ = 'huqinghua' # coding=gbk import os import Dui4Win from CommonUtil import CommonUtils if __name__ == "__main__": CommonUtils.SaveExePath() Dui4Win.Run()
{ "content_hash": "3e3dc0f9274e1373fa0835cfb9a20e82", "timestamp": "", "source": "github", "line_count": 11, "max_line_length": 34, "avg_line_length": 17, "alnum_prop": 0.6310160427807486, "repo_name": "est/py-ui4win", "id": "cdd2596ae9950fc6e31883c16ba33bee49c3f30c", "size": "187", "binary": fals...
""" CSB Test Runner app. Run with -h to see the app's documentation. """ from csb.test import Console def main(): return Console('csb.test.cases.*') if __name__ == '__main__': main()
{ "content_hash": "8c51cfcdbafb09b9e769488ddf9aa919", "timestamp": "", "source": "github", "line_count": 13, "max_line_length": 64, "avg_line_length": 15.076923076923077, "alnum_prop": 0.6071428571428571, "repo_name": "csb-toolbox/CSB", "id": "75cf905f6b25d6dd21bedeb6e7bf6e9b1e4dd8b6", "size": "196"...
from __future__ import absolute_import from typing import Any, Dict, List, Optional from zerver.lib import cache from zerver.lib.test_helpers import ( AuthedTestCase, queries_captured, stub, tornado_redirected_to_list ) from zerver.decorator import ( JsonableError ) from zerver.lib.test_runner import ( ...
{ "content_hash": "ccc1a3d868db90ba29886a6b15714f3a", "timestamp": "", "source": "github", "line_count": 1627, "max_line_length": 125, "avg_line_length": 42.105716041794714, "alnum_prop": 0.5953785069920883, "repo_name": "Vallher/zulip", "id": "7d74b901f41ee11f3e528de190f4cddf119b5571", "size": "685...
""" A sub-package for efficiently dealing with polynomials. Within the documentation for this sub-package, a "finite power series," i.e., a polynomial (also referred to simply as a "series") is represented by a 1-D numpy array of the polynomial's coefficients, ordered from lowest order term to highest. For example, a...
{ "content_hash": "c1cbe9371be3f8cff4c48628403c5626", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 78, "avg_line_length": 34.22666666666667, "alnum_prop": 0.6630307752239969, "repo_name": "abalkin/numpy", "id": "43b2caba396f6b0d30302835d9e4158e66f5d1b1", "size": "2581", ...
import uuid from django.test import TestCase from corehq.apps.change_feed import data_sources, topics from corehq.apps.change_feed.document_types import change_meta_from_doc from corehq.apps.change_feed.producer import producer from corehq.apps.change_feed.topics import get_topic_offset from corehq.apps.es import Group...
{ "content_hash": "dfbb4943b7abe00e7e3134fe04475ad3", "timestamp": "", "source": "github", "line_count": 65, "max_line_length": 71, "avg_line_length": 37.56923076923077, "alnum_prop": 0.6883701883701884, "repo_name": "dimagi/commcare-hq", "id": "67132280c7c9b377866cfd4b86d465f7b40a66c1", "size": "24...
from collections import namedtuple from scopus.classes import Search from scopus.utils import listify class ScopusSearch(Search): @property def results(self): """A list of namedtuples in the form (eid doi pii pubmed_id title subtype creator afid affilname affiliation_city affiliation_country ...
{ "content_hash": "3c9c73e16e7bde55a8c63494d79ff020", "timestamp": "", "source": "github", "line_count": 191, "max_line_length": 82, "avg_line_length": 44.13612565445026, "alnum_prop": 0.5730723606168446, "repo_name": "scopus-api/scopus", "id": "5458cc447bb0ffc0aeb6c9bc97744b792c5541d7", "size": "84...
from CIM14.CDPSM.Balanced.IEC61970.Core.IdentifiedObject import IdentifiedObject class BaseVoltage(IdentifiedObject): """Collection of BaseVoltages which is used to verify that the BusbarSection.BaseVoltage and other voltage attributes in the CIM are given a value existing in the collection. """ def __ini...
{ "content_hash": "d582fb4ca89cd13b95b3d350ae6c811f", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 178, "avg_line_length": 37.266666666666666, "alnum_prop": 0.6797853309481217, "repo_name": "rwl/PyCIM", "id": "e9eaaf89d567ba41196bc4f2aedec65e02aa6384", "size": "3895", ...
"""Utility methods to handle the creation of tf.keras.models.Model instances. We use a number of custom classes with tf.keras.models.Model, and when cloning models we need to make sure Keras is aware of all our classes in order to serialize and deserialize them properly. This file contains utility methods to this end...
{ "content_hash": "4e7ed59fca353d026e2b838d421f2577", "timestamp": "", "source": "github", "line_count": 84, "max_line_length": 79, "avg_line_length": 32.583333333333336, "alnum_prop": 0.7223237120935331, "repo_name": "google-research/google-research", "id": "f1d5469b7efb9080f82e3cfdd55ac573ef6fe260",...
""" Script to use DB backups to migrate data for covidcast issues and lag addition Author: Eu Jing Chua Created: 2020-06-26 """ # Standard library import argparse from collections import defaultdict import datetime import glob import gzip from itertools import islice, chain, starmap import logging from multiprocessin...
{ "content_hash": "0f3a7e964857f8340ed89c417c1ec8a3", "timestamp": "", "source": "github", "line_count": 511, "max_line_length": 135, "avg_line_length": 37.79060665362035, "alnum_prop": 0.6228056548081404, "repo_name": "cmu-delphi/delphi-epidata", "id": "1aa2cbe1b405aecca48ca802d7a976fa0b51a9d2", "s...
"""Base class for sparse matrix formats using compressed storage.""" from __future__ import division, print_function, absolute_import __all__ = [] from warnings import warn import operator import numpy as np from scipy._lib.six import zip as izip from .base import spmatrix, isspmatrix, SparseEfficiencyWarning from ...
{ "content_hash": "6c5969554ac58b83ba01a3ac3f147559", "timestamp": "", "source": "github", "line_count": 1116, "max_line_length": 102, "avg_line_length": 38.54390681003584, "alnum_prop": 0.5152621178658607, "repo_name": "haudren/scipy", "id": "cf840960999751bc490a6b0b94d7f8d42da2d96d", "size": "4301...
""" A place for internal code Some things are more easily handled Python. """ from __future__ import division, absolute_import, print_function import re import sys from numpy.compat import unicode from .multiarray import dtype, array, ndarray try: import ctypes except ImportError: ctypes = None if (sys.byt...
{ "content_hash": "d64681260b671ef031e0e247c7df13f7", "timestamp": "", "source": "github", "line_count": 841, "max_line_length": 82, "avg_line_length": 29.751486325802617, "alnum_prop": 0.5413452699732225, "repo_name": "gfyoung/numpy", "id": "30069f0ca3b57b1a2497194862d15869f1f2be84", "size": "25021...
""" Check for IOOS-approved attributes """ import re from numbers import Number import validators from cf_units import Unit from lxml.etree import XPath from owslib.namespaces import Namespaces from compliance_checker import base from compliance_checker.acdd import ACDD1_3Check from compliance_checker.base import (...
{ "content_hash": "464953896be4801e00f71d374290d860", "timestamp": "", "source": "github", "line_count": 2049, "max_line_length": 230, "avg_line_length": 34.734992679355784, "alnum_prop": 0.5179283988085202, "repo_name": "ocefpaf/compliance-checker", "id": "ea91fc4575a1aba3d28dc67a96d05199e1ae02cf", ...
"""Shared functionality for delimiter separated values output modules.""" from __future__ import unicode_literals from plaso.output import formatting_helper from plaso.output import interface class DSVEventFormattingHelper(formatting_helper.EventFormattingHelper): """Delimiter separated values output module event...
{ "content_hash": "ff66063fbc1ee68c76699c9317270ed9", "timestamp": "", "source": "github", "line_count": 137, "max_line_length": 79, "avg_line_length": 32.55474452554745, "alnum_prop": 0.6919282511210763, "repo_name": "rgayon/plaso", "id": "29c1cbc6ebf451038eecdb910e51c013b212180e", "size": "4484", ...
from __future__ import unicode_literals import frappe import unittest from frappe.utils import random_string from frappe.model.workflow import apply_workflow, WorkflowTransitionError, WorkflowPermissionError, get_common_transition_actions from frappe.test_runner import make_test_records class TestWorkflow(unittest.T...
{ "content_hash": "65dd4f15101f31aa30b6544db1b8ac0e", "timestamp": "", "source": "github", "line_count": 164, "max_line_length": 129, "avg_line_length": 31.28048780487805, "alnum_prop": 0.7183235867446394, "repo_name": "saurabh6790/frappe", "id": "9ad0562a86495a7361e40c1a71215c9bc2c6d7d4", "size": "...
from flask import Flask, render_template app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') # export FLASK_DEBUG=1 # export FLASK_APP=hello.py # flask run # FLASK_DEBUG=1 FLASK_APP=hello.py flask run
{ "content_hash": "f2cf6d0d6ec41ff68f7dd36c31bc71af", "timestamp": "", "source": "github", "line_count": 15, "max_line_length": 44, "avg_line_length": 16.533333333333335, "alnum_prop": 0.6895161290322581, "repo_name": "sharkspeed/dororis", "id": "0a1273e0bd3d8b4a0dc6f3d37be00c9dafa1c744", "size": "2...
from __future__ import unicode_literals from django.db import models class YourModel(models.Model): customer_support_email = models.EmailField(null=True, blank=True) marketing_email = models.EmailField(null=True, blank=True)
{ "content_hash": "c878e22637a967a57eac4d4682a4ffc3", "timestamp": "", "source": "github", "line_count": 8, "max_line_length": 69, "avg_line_length": 29.5, "alnum_prop": 0.7627118644067796, "repo_name": "vinta/django-email-confirm-la", "id": "85b0ef33d91dec5ac60cf61c1c0c8894068d3aa8", "size": "236",...
from weixin import WeiXinClient if __name__ == '__main__': wc = WeiXinClient('your_appid', 'your_secret', fc = True, path='/tmp') #"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET" wc.request_access_token() data = '{"touser":"obMnLt3bf7t65jyEsa7vOtXphd...
{ "content_hash": "a7e6cfe7a1426de6dec928d95962e01c", "timestamp": "", "source": "github", "line_count": 37, "max_line_length": 139, "avg_line_length": 71.35135135135135, "alnum_prop": 0.7026515151515151, "repo_name": "wenwenqingqing/weixinpy", "id": "8cef98151539bee8b4837c8dee558ea264773652", "size...
"""passlib.hosts""" #============================================================================= # imports #============================================================================= # core import sys from warnings import warn # pkg from passlib.context import LazyCryptContext from passlib.exc import PasslibRuntim...
{ "content_hash": "e848f1c42a060952bc7fcd2daa0e2c4f", "timestamp": "", "source": "github", "line_count": 115, "max_line_length": 79, "avg_line_length": 32.208695652173915, "alnum_prop": 0.46787257019438444, "repo_name": "austindlawless/cudas", "id": "7df3efd2a5edd874215f08bcc97a7c944bf6749e", "size"...
import pytest from unittest.mock import patch from unittest.mock import Mock from .. import factories as f from taiga.projects.history import services pytestmark = pytest.mark.django_db(transaction=True) from taiga.base.utils import json def test_webhooks_when_create_user_story(settings): settings.WEBHOOKS_E...
{ "content_hash": "6e877702945da487a02bf08a62b2b715", "timestamp": "", "source": "github", "line_count": 290, "max_line_length": 104, "avg_line_length": 42.220689655172414, "alnum_prop": 0.6390068605031035, "repo_name": "curiosityio/taiga-docker", "id": "716697ce2a00f9503a2b00d2f7c5e9c901aa350f", "s...
"""assert functions from numpy and pandas testing """ from statsmodels.compat.pandas import testing as pdt import numpy.testing as npt import pandas from statsmodels.tools.tools import Bunch # Standard list for parsing tables PARAM_LIST = ['params', 'bse', 'tvalues', 'pvalues'] def bunch_factory(attribute, column...
{ "content_hash": "df215ad52a6dd59f9eb1fbd4b02fe8af", "timestamp": "", "source": "github", "line_count": 79, "max_line_length": 77, "avg_line_length": 30.924050632911392, "alnum_prop": 0.6058125255832992, "repo_name": "bashtage/statsmodels", "id": "4a25f34e3de16a9d1c9686bd1517a600beb56992", "size": ...
import argparse import os import sys import urllib.parse from google.cloud import compute CANARY_COMMAND_NAME = "canary" ROLLBACK_CANARY_COMMAND_NAME = "rollback-canary" PROMOTE_CANARY_COMMAND_NAME = "promote-canary" DIRECT_UPDATE_COMMAND_NAME = "direct-update" CANARY_SIZE = compute.FixedOrPercent(fixed=1) def res...
{ "content_hash": "66441a5ac572cdc7f10a4885516734f2", "timestamp": "", "source": "github", "line_count": 342, "max_line_length": 81, "avg_line_length": 38.57309941520468, "alnum_prop": 0.6162825955124318, "repo_name": "iree-org/iree", "id": "ee7372da626a6a632f857bc60a0381c2e4cc2a22", "size": "13434"...
import json from collections import namedtuple from django.conf import settings from casexml.apps.case.models import CommCareCase import logging from corehq.apps.change_feed import topics from pillowtop.checkpoints.manager import DEFAULT_EMPTY_CHECKPOINT_SEQUENCE from pillowtop.checkpoints.util import construct_check...
{ "content_hash": "b7241bb47d47b7751ae219f5ea766884", "timestamp": "", "source": "github", "line_count": 93, "max_line_length": 106, "avg_line_length": 37.60215053763441, "alnum_prop": 0.6822991135258794, "repo_name": "qedsoftware/commcare-hq", "id": "15f1c296ba93d26b893d0a4149f51734ccc1c181", "size...
import unittest from rx.observable import Observable from rx.testing import TestScheduler, ReactiveTest from rx.disposables import Disposable, SerialDisposable on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe subscribed = React...
{ "content_hash": "5276942a0e738198ca0d01218253c520", "timestamp": "", "source": "github", "line_count": 136, "max_line_length": 148, "avg_line_length": 33.3235294117647, "alnum_prop": 0.6284201235657546, "repo_name": "dbrattli/RxPY", "id": "8e1f306b9103d6e71da5eb9b85e75e663c6d4857", "size": "4532",...
from __future__ import print_function, division import matplotlib matplotlib.use('Agg') # Must be before importing matplotlib.pyplot or pylab! from neuralnilm import Net, RealApplianceSource, BLSTMLayer, DimshuffleLayer from neuralnilm.net import BidirectionalRecurrentLayer from lasagne.nonlinearities import sigmoid, r...
{ "content_hash": "859531ebb406a5bd73dbbbf43f829d76", "timestamp": "", "source": "github", "line_count": 214, "max_line_length": 109, "avg_line_length": 26.42056074766355, "alnum_prop": 0.629642730810046, "repo_name": "JackKelly/neuralnilm_prototype", "id": "3d44fcc34375b87a49f23ad41529fd42d8d081ac", ...
import os import gevent import gevent_inotifyx import ezRPGreenlet import ezRPConfig as gConfig from ezbake.discovery import ServiceDiscoveryClient from ezbake.reverseproxy.thriftapi.constants import SERVICE_NAME as EzFrontendServiceName class EzReverseProxyService(object): def __init__(self, logger, staticFileH...
{ "content_hash": "b23605e1a0cc38f0ed3e107148f53d0c", "timestamp": "", "source": "github", "line_count": 61, "max_line_length": 89, "avg_line_length": 42.049180327868854, "alnum_prop": 0.674074074074074, "repo_name": "ezbake/ezbake-platform-services", "id": "4f6f65215dd43444d889397943363774280fd638", ...
from treehopper.api import spi from treehopper.api.spi import ChipSelectMode, SpiMode, SpiBurstMode from treehopper.api.pin import SpiChipSelectPin class SpiDevice: """ SPI device This class provides a simple wrapper around Spi.send_receive() that preserves the chip-select, mode, and frequency config...
{ "content_hash": "5caa938bee993bf6ded11fa64c7da619", "timestamp": "", "source": "github", "line_count": 44, "max_line_length": 169, "avg_line_length": 47.36363636363637, "alnum_prop": 0.6799424184261037, "repo_name": "treehopper-electronics/treehopper-sdk", "id": "c910cec7135360678b2f04ddb233ca0a249a...
"""Test of gRPC Python's interaction with the python logging module""" import unittest import logging import grpc import subprocess import sys INTERPRETER = sys.executable class LoggingTest(unittest.TestCase): def test_logger_not_occupied(self): script = """if True: import logging ...
{ "content_hash": "cdd81c5716f21fbf77914991e8bd98b9", "timestamp": "", "source": "github", "line_count": 86, "max_line_length": 77, "avg_line_length": 28.5, "alnum_prop": 0.5760913912688699, "repo_name": "firebase/grpc", "id": "1b8335a52a7fee4c8d97faeefd3d987b25fc9b85", "size": "3028", "binary": f...
import sys import commands import utility usage = ''' Kit, a project manager for C/C++ -------------------------------- - usage: kit <command> [all|<module>] [flags/options] kit [flags/options] - commands: build ...... compile all sources clean ...... remove compilati...
{ "content_hash": "6c4c045386106fbfff03ad7c6aadb4b6", "timestamp": "", "source": "github", "line_count": 68, "max_line_length": 68, "avg_line_length": 25.13235294117647, "alnum_prop": 0.5301345816266823, "repo_name": "dasmithii/Kit", "id": "e9f7ac981c11a3914e3b50e890ee5682441a1899", "size": "1709", ...
__author__ = 'pacogomez' from pyVim import connect from pyVmomi import vim import requests import ssl import atexit def connect_to_nsx_api(ip, user, password, ssl_verify): appliance_check_url = 'https://{}/api/2.0/services/vcconfig'.format(ip) response = requests.request('GET', appliance_check_url, ...
{ "content_hash": "f43269b60868f790da56aa357b98a651", "timestamp": "", "source": "github", "line_count": 77, "max_line_length": 158, "avg_line_length": 40.688311688311686, "alnum_prop": 0.5652729013724864, "repo_name": "pacogomez/ovftool", "id": "d0909aa2ee45c9a12c295fea13653dc7f83acaf0", "size": "3...
from __future__ import print_function, unicode_literals, division, absolute_import from builtins import (bytes, dict, int, list, object, range, str, # noqa ascii, chr, hex, input, next, oct, open, pow, round, super, filter, map, zip) from future import standard_library standard_library.install_aliases() # noqa: C...
{ "content_hash": "15d82f3e7b0b4d9415e5527b29fef760", "timestamp": "", "source": "github", "line_count": 25, "max_line_length": 125, "avg_line_length": 49.72, "alnum_prop": 0.7055510860820595, "repo_name": "totalgood/nlpia", "id": "f00e66f44b0f63dbf88ff3a4a71859da2a525034", "size": "1289", "binary...
"""SCons.Tool.dvipdf Tool-specific initialization for dvipdf. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation # # P...
{ "content_hash": "1fc43f984c46e76de6108811ebb74ce4", "timestamp": "", "source": "github", "line_count": 125, "max_line_length": 97, "avg_line_length": 32.64, "alnum_prop": 0.6992647058823529, "repo_name": "cournape/numscons", "id": "a2a3169ce588d53830a07eff49368ff825961c3e", "size": "4080", "bina...
"""empty message Revision ID: b472cb98fffd Revises: 7e206db94cf6 Create Date: 2018-01-04 20:57:19.845298 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = 'b472cb98fffd' down_revision = '7e206db94cf6' branch_labels = None depends_on = None def upgrade(): # ...
{ "content_hash": "c7410e9e04b82243e867fda5dfe8ac03", "timestamp": "", "source": "github", "line_count": 40, "max_line_length": 125, "avg_line_length": 43.375, "alnum_prop": 0.7112391930835735, "repo_name": "ahoarfrost/metaseek", "id": "603066882f202c6fd77cab1b8d976a89fe6645a7", "size": "1735", "b...
""" Generalized linear models currently supports estimation using the one-parameter exponential families References ---------- Gill, Jeff. 2000. Generalized Linear Models: A Unified Approach. SAGE QASS Series. Green, PJ. 1984. "Iteratively reweighted least squares for maximum likelihood estimation, and some ...
{ "content_hash": "fe89a5acb6efa753988575d3f6d57fda", "timestamp": "", "source": "github", "line_count": 619, "max_line_length": 88, "avg_line_length": 37.268174474959615, "alnum_prop": 0.6164983310936755, "repo_name": "matthew-brett/draft-statsmodels", "id": "1bf00995a7b09a5172e785e296866a099378e769"...
import unittest2 import mock import json import flask import rq import fakeredis import jobmonitor from jobmonitor import start_worker # The resolve_connection method in rq.connections calls patch_connection(conn) # in rq.compat.connections. This method checks if conn is an instance of # Redis or StrictRedis. # As the...
{ "content_hash": "2a48746691404a753506eb7fd7ee4007", "timestamp": "", "source": "github", "line_count": 166, "max_line_length": 79, "avg_line_length": 41.566265060240966, "alnum_prop": 0.6431884057971015, "repo_name": "alexpearce/jobmonitor", "id": "d8d5d99f70be6d835c6cf10e5928b5a4f59b0315", "size"...
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('catalogue', '0015_product_is_public'), ] operations = [ migrations.AlterField( model_name='productattributevalue', name='val...
{ "content_hash": "c568666ec3d2deed5c6e2dcff2422535", "timestamp": "", "source": "github", "line_count": 38, "max_line_length": 102, "avg_line_length": 34.73684210526316, "alnum_prop": 0.6045454545454545, "repo_name": "django-oscar/django-oscar", "id": "80c3726a80e67b15ede26ffa53bbb23e93e83ee2", "si...
import subprocess, threading class Command(object): def __init__(self, cmd): self.cmd = cmd def run(self, timeout): self.process = None self.rc = None self.stdout = "" self.stderr = "" def target(): self.process = subprocess.Popen(self.cmd, shell=T...
{ "content_hash": "e453747f94e5e624fcaccc6e5625cf7a", "timestamp": "", "source": "github", "line_count": 32, "max_line_length": 131, "avg_line_length": 28.75, "alnum_prop": 0.5956521739130435, "repo_name": "osynge/whatenv", "id": "1130fb4f8fad63d2179de1ed0a54c97578e301f2", "size": "920", "binary":...
import os import sys import hashlib import logging import json from cPickle import PicklingError import redis from totalimpact import REDIS_CACHE_DATABASE_NUMBER # set up logging logger = logging.getLogger("ti.cache") cache_client = redis.from_url(os.getenv("REDIS_URL"), REDIS_CACHE_DATABASE_NUMBER) MAX_PAYLOAD_SIZ...
{ "content_hash": "1203fc2fba06d61d15e1c8113f34baba", "timestamp": "", "source": "github", "line_count": 72, "max_line_length": 98, "avg_line_length": 29.555555555555557, "alnum_prop": 0.6268796992481203, "repo_name": "Impactstory/total-impact-core", "id": "683f0111507d9a056ca107283716ec8013f28ac8", ...
from stackalytics.tests.api import test_api class TestAPIModules(test_api.TestAPI): def test_get_modules(self): with test_api.make_runtime_storage( { 'repos': [ {'module': 'nova', 'organization': 'openstack', 'uri': 'git...
{ "content_hash": "da55692f648e7ae9e834383979810888", "timestamp": "", "source": "github", "line_count": 107, "max_line_length": 79, "avg_line_length": 51.32710280373832, "alnum_prop": 0.39603058994901674, "repo_name": "0xf2/stackalytics", "id": "e4ad64b59caaf3f9e9339bc94ba0223f2a87fec9", "size": "6...
import random class Node: def __init__(self, data): self.data = data self.left = None self.right = None def insert(data, root): """ Inserts a node into the tree. :param data: The data which will be given to the inserted node :param root: The root of the tree :return:...
{ "content_hash": "415a511de963c4291f16c3827f5062ff", "timestamp": "", "source": "github", "line_count": 130, "max_line_length": 105, "avg_line_length": 29.823076923076922, "alnum_prop": 0.6337374258447253, "repo_name": "mindm/2017Challenges", "id": "5f98514cc5abcd1ac0b2289cbf5c8d399295c6cf", "size"...
from rewriter import * from os.path import basename import copy from lan_parser import * from cgen import * from transformation import * from analysis import * fileprefix = "../test/C/" SetNoReadBack = True DoOptimizations = True def LexAndParse(name, createTemp): import ply.yacc as yacc cparser = yacc.yacc(...
{ "content_hash": "f4c8ac4e295aa606a2fc340d163bf79b", "timestamp": "", "source": "github", "line_count": 206, "max_line_length": 128, "avg_line_length": 25.95145631067961, "alnum_prop": 0.5680882903105126, "repo_name": "dikujepsen/OpenTran", "id": "bd13fd4264372dd2fed0b28bde8f932699833d88", "size": ...
""" Helpers to implement a recursive file processing command line script. Verbosity: Verbose modes (default: 3) 0: quiet 1: errors only 2: errors and summary 3: errors, changed files, and summary 4: errors, visited files, and summary 5: debug output """ from __future__ import print_...
{ "content_hash": "225447800c1b5727466e095bb361f6a2", "timestamp": "", "source": "github", "line_count": 383, "max_line_length": 98, "avg_line_length": 36.27676240208877, "alnum_prop": 0.5417446379732258, "repo_name": "mar10/tabfix", "id": "240d53fda271339093db3d7300c2eab854c843a4", "size": "14048",...
import sys import unittest import httplib from libcloud.compute.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver from libcloud.compute.drivers.ec2 import EC2APNENodeDriver, IdempotentParamError from libcloud.compute.base import Node, NodeImage, NodeSize, NodeLocation from test import MockHttp from test.compute imp...
{ "content_hash": "d97c29757bbec9d7762979f9093249f5", "timestamp": "", "source": "github", "line_count": 259, "max_line_length": 119, "avg_line_length": 42.96911196911197, "alnum_prop": 0.6366250336957499, "repo_name": "cloudkick/libcloud", "id": "ca193fd4cd91ffdd9bebc4c24abf0207140f9c6d", "size": "...
import json import os import time import phonenumbers import psycopg2 from ndoh_hub.constants import LANGUAGES def get_addresses(addresses): addresses = addresses.get("msisdn") or {} result = [] for addr, details in addresses.items(): try: p = phonenumbers.parse(addr, "ZA") ...
{ "content_hash": "6a7130f7c8a4ce37bc6a5b3934a9772d", "timestamp": "", "source": "github", "line_count": 364, "max_line_length": 86, "avg_line_length": 29.695054945054945, "alnum_prop": 0.5564807105190119, "repo_name": "praekeltfoundation/ndoh-hub", "id": "ba23de293dafe8d8235bcc59b70f3ff9c1b49c2f", ...
""" run with nosetests -v --nocapture or nosetests -v """ from cloudmesh.config.cm_config import cm_config from cloudmesh.config.mock_user import mock_user from cloudmesh.config.mock_cloud import mock_cloud from cloudmesh.openstack_grizzly_cloud import openstack_grizzly_cloud import mock_keystone import json impor...
{ "content_hash": "175b67b754448a2224ff182791e621f0", "timestamp": "", "source": "github", "line_count": 75, "max_line_length": 78, "avg_line_length": 33.8, "alnum_prop": 0.642603550295858, "repo_name": "rajpushkar83/cloudmesh", "id": "dc7659c606583a6a38ff8c0feadd53f4b77a59a7", "size": "2535", "bi...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tempfile import numpy as np import tensorflow as tf from tensorflow import flags from tensorflow.examples.tutorials.mnist import input_data from tensorflow.lite.experimental.examples.lstm.rnn import bid...
{ "content_hash": "c7bbf8502d6a843495254c7d5aae6517", "timestamp": "", "source": "github", "line_count": 347, "max_line_length": 84, "avg_line_length": 33.25648414985591, "alnum_prop": 0.6494800693240901, "repo_name": "ghchinoy/tensorflow", "id": "a9bfc4ee8a1021d0657709a994ae345b6beee351", "size": "...