max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
cpmpy/ski_assignment.py | tias/hakank | 279 | 12795286 | <gh_stars>100-1000
"""
Ski assignment in cpmpy
From <NAME>, Jr.:
PIC 60, Fall 2008 Final Review, December 12, 2008
http://www.math.ucla.edu/~jhellrun/course_files/Fall%25202008/PIC%252060%2520-%2520Data%2520Structures%2520and%2520Algorithms/final_review.pdf
'''
5. Ski Optimization! Your job at Snapple is pleasant bu... |
plugins/supervisor/__init__.py | ajenti/ajen | 3,777 | 12795309 | <gh_stars>1000+
# pyflakes: disable-all
from .api import *
from .aug import *
from .main import *
|
aries_cloudagent/did/tests/test_did_key_bls12381g1.py | kuraakhilesh8230/aries-cloudagent-python | 247 | 12795332 | from unittest import TestCase
from ...wallet.key_type import KeyType
from ...wallet.util import b58_to_bytes
from ..did_key import DIDKey, DID_KEY_RESOLVERS
from .test_dids import (
DID_B<KEY>,
)
TEST_BLS12381G1_BASE58_KEY = (
"<KEY>"
)
TEST_BLS12381G1_FINGERPRINT = (
"<KEY>"
)
TEST_BLS12381G1_DID = f"di... |
qb_to_dynaboard.py | Pinafore/qb | 122 | 12795346 | <gh_stars>100-1000
import argparse
import json
from pathlib import Path
DS_VERSION = "2018.04.18"
LOCAL_QANTA_PREFIX = "data/external/datasets/"
QANTA_TRAIN_DATASET_PATH = f"qanta.train.{DS_VERSION}.json"
QANTA_DEV_DATASET_PATH = f"qanta.dev.{DS_VERSION}.json"
QANTA_TEST_DATASET_PATH = f"qanta.test.{DS_VERSION}.json"
... |
tests/test_microsoft_trans.py | nidhaloff/deep_translator | 118 | 12795365 | <filename>tests/test_microsoft_trans.py
#!/usr/bin/env python
"""Tests for `deep_translator` package."""
from unittest.mock import patch
import pytest
import requests
from deep_translator import MicrosoftTranslator, exceptions
# mocked request.post
@patch.object(requests, "post")
def test_microsoft_successful_pos... |
build_newlib.py | codyd51/axle | 453 | 12795366 | <reponame>codyd51/axle<filename>build_newlib.py
#!/usr/bin/python3
import os
import tempfile
from pathlib import Path
from typing import Tuple
from build_utils import download_and_unpack_archive, run_and_check
def clone_tool_and_prepare_build_dir(build_dir: Path, url: str) -> Tuple[Path, Path]:
tool_src_dir = do... |
berts_of_a_feather/files_for_replication/process_test_results.py | tommccoy1/hans | 109 | 12795393 | import sys
prefix = sys.argv[1]
fi = open(prefix + "/" + "test_results.tsv", "r")
fo = open(prefix + "/" + "preds.txt", "w")
fo.write("pairID,gold_label\n")
counter = 0
labels = ["contradiction", "entailment", "neutral"]
for line in fi:
parts = [float(x) for x in line.strip().split("\t")]
max_ind = 0
max_val = ... |
reboot_required/tests/test_reboot_required.py | divyamamgai/integrations-extras | 158 | 12795426 | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under Simplified BSD License (see LICENSE)
from os.path import isfile
def test_ok(aggregator, check, instance_ok):
assert isfile(instance_ok['created_at_file'])
check.check(instance_ok)
aggregator.assert_service_check('system.reboot_required', st... |
src/network/assemble.py | BeholdersEye/PyBitmessage | 1,583 | 12795427 | <gh_stars>1000+
"""
Create bitmessage protocol command packets
"""
import struct
import addresses
from network.constants import MAX_ADDR_COUNT
from network.node import Peer
from protocol import CreatePacket, encodeHost
def assemble_addr(peerList):
"""Create address command"""
if isinstance(peerList, Peer):
... |
src/oci/apm_traces/models/query_result_metadata_summary.py | Manny27nyc/oci-python-sdk | 249 | 12795454 | <gh_stars>100-1000
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LIC... |
queue/queue.py | Sherlock-dev/algos | 1,126 | 12795467 | class Queue(object):
def __init__(self):
self._list = []
def count(self):
return len(self._list)
def is_empty(self):
return self.count() == 0
def enqueue(self, item):
self._list.append(item)
def dequeue(self):
try:
return self._list.pop(0)
... |
mpire/signal.py | synapticarbors/mpire | 505 | 12795499 | from inspect import Traceback
from signal import getsignal, SIG_IGN, SIGINT, signal as signal_, Signals
from types import FrameType
from typing import Type
class DelayedKeyboardInterrupt:
def __init__(self, in_thread: bool = False) -> None:
"""
:param in_thread: Whether or not we're living in a t... |
airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py | koji-m/airbyte | 6,215 | 12795507 | <filename>airbyte-integrations/bases/source-acceptance-test/source_acceptance_test/tests/test_full_refresh.py
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import pytest
from airbyte_cdk.models import Type
from source_acceptance_test.base import BaseTest
from source_acceptance_test.utils import Connect... |
gammapy/astro/population/tests/test_simulate.py | Rishank2610/gammapy | 155 | 12795523 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_allclose, assert_equal
import astropy.units as u
from astropy.table import Table
from gammapy.astro.population import (
add_observed_parameters,
add_pulsar_parameters,
add_pwn_parameters,
add_snr_parameters,... |
tables/wikipedia-scripts/weblib/web.py | yash-srivastava19/sempre | 812 | 12795536 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib, urllib2, urlparse, socket
import json, sys, os, hashlib, subprocess, time
from blacklist import BLACKLIST
BASEDIR = os.path.dirname(os.path.realpath(os.path.join(__file__, '..')))
class WebpageCache(object):
def __init__(self, basedi... |
src/anyconfig/ioinfo/constants.py | ssato/python-anyconfig | 213 | 12795551 | #
# Copyright (C) 2018 - 2021 <NAME> <<EMAIL>>
# SPDX-License-Identifier: MIT
#
r"""ioinfo.constants to provide global constant variables.
"""
import os.path
GLOB_MARKER: str = '*'
PATH_SEP: str = os.path.sep
# vim:sw=4:ts=4:et:
|
consoleme/lib/v2/notifications.py | shyovn/consoleme | 2,835 | 12795584 | <gh_stars>1000+
import json as original_json
import sys
import time
from collections import defaultdict
from typing import Dict
import sentry_sdk
import ujson as json
from asgiref.sync import sync_to_async
from consoleme.config import config
from consoleme.lib.cache import (
retrieve_json_data_from_redis_or_s3,
... |
tests/test_percentage_indicator.py | tahmidbintaslim/pyprind | 411 | 12795637 | """
<NAME> 2014-2016
Python Progress Indicator Utility
Author: <NAME> <<EMAIL>>
License: BSD 3 clause
Contributors: https://github.com/rasbt/pyprind/graphs/contributors
Code Repository: https://github.com/rasbt/pyprind
PyPI: https://pypi.python.org/pypi/PyPrind
"""
import sys
import time
import pyprind
n = 100
slee... |
04_CNN_advances/use_vgg_finetune.py | jastarex/DL_Notes | 203 | 12795640 |
# coding: utf-8
# # 使用预训练的VGG模型Fine-tune CNN
# In[1]:
# Import packs
import numpy as np
import os
import scipy.io
from scipy.misc import imread, imresize
import matplotlib.pyplot as plt
import skimage.io
import skimage.transform
import tensorflow as tf
get_ipython().magic(u'matplotlib inline')
cwd = os.getcwd()
pri... |
tests/test_gosubdag_relationships_i126.py | flying-sheep/goatools | 477 | 12795691 | #!/usr/bin/env python
"""Test that GoSubDag contains ancestors from only the user-specified relationships"""
# tests/test_gosubdag_relationships_i126.py
# goatools/gosubdag/gosubdag.py
# goatools/gosubdag/godag_rcnt.py
# goatools/gosubdag/godag_rcnt_init.py
# goatools/godag/go_tasks.py
# goatools/obo_parser.py
from __... |
.githooks/pre-commit-python.py | eshepelyuk/gloo | 3,506 | 12795733 | #!/usr/bin/python3
# This script runs whenever a user tries to commit something in this repo.
# It checks the commit for any text that resembled an encoded JSON web token,
# and asks the user to verify that they want to commit a JWT if it finds any.
import sys
import subprocess
import re
import base64
import binascii
... |
DQM/CSCMonitorModule/python/csc_dqm_masked_hw_cfi.py | ckamtsikis/cmssw | 852 | 12795741 | <reponame>ckamtsikis/cmssw<filename>DQM/CSCMonitorModule/python/csc_dqm_masked_hw_cfi.py<gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
#--------------------------
# Masked HW Elements
#--------------------------
CSCMaskedHW = cms.untracked.vstring(
# == Post LS1 - All ME4/2 chambers should be enabled
... |
tests/test_custom_widgets.py | jerryc05/python-progressbar | 806 | 12795758 | <gh_stars>100-1000
import time
import progressbar
class CrazyFileTransferSpeed(progressbar.FileTransferSpeed):
"It's bigger between 45 and 80 percent"
def update(self, pbar):
if 45 < pbar.percentage() < 80:
return 'Bigger Now ' + progressbar.FileTransferSpeed.update(self,
... |
Algorithms/Dynamic_Programming/0-1_Knapsack_Problem/knapsack_problem_0_1.py | arslantalib3/algo_ds_101 | 182 | 12795769 | <reponame>arslantalib3/algo_ds_101<filename>Algorithms/Dynamic_Programming/0-1_Knapsack_Problem/knapsack_problem_0_1.py
#0/1 Knapsack problem
def knapsack(val, wt, N, C):
table = [[ 0 for _ in range(0, C+1)] for _ in range(0, N+1)]
table[0][0] = 0
for i in range(1, N+1):
for c in range(1... |
api/edge_api/identities/views.py | SolidStateGroup/Bullet-Train-API | 126 | 12795795 | import base64
import json
import typing
import marshmallow
from boto3.dynamodb.conditions import Key
from drf_yasg2.utils import swagger_auto_schema
from flag_engine.api.schemas import APITraitSchema
from flag_engine.identities.builders import (
build_identity_dict,
build_identity_model,
)
from rest_framework ... |
updi/link.py | leonerd/pyupdi | 197 | 12795814 | <reponame>leonerd/pyupdi
"""
Link layer in UPDI protocol stack
"""
import logging
import time
from updi.physical import UpdiPhysical
import updi.constants as constants
class UpdiDatalink(object):
"""
UPDI data link class handles the UPDI data protocol within the device
"""
def __init__(self,... |
src/test/tests/databases/xform_precision.py | visit-dav/vis | 226 | 12795852 | # ----------------------------------------------------------------------------
# CLASSES: nightly
#
# Test Case: xform_precision.py
#
# Tests: Transform manager's conversion to float
#
# Programmer: <NAME>
# Date: September 24, 2006
#
# Modifications:
#
# <NAME>, Wed Jan 20 07:37:11 PST 2010
# ... |
qt__pyqt__pyside__pyqode/pyqt5__draw_text_with_word_wrap.py | DazEB2/SimplePyScripts | 117 | 12795866 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from PyQt5.QtGui import QPixmap, QPainter, QFont
from PyQt5.QtWidgets import QApplication, QLabel
from PyQt5.QtCore import Qt, QRect
app = QApplication([])
text = "Hello World!"
pixmap = QPixmap(180, 130)
pixmap.fill(Qt.white)
painter = QPai... |
playground/jax_basic/test_pmap.py | yf225/alpa | 114 | 12795916 | <reponame>yf225/alpa
from functools import partial
import jax
from jax import lax
import jax.numpy as jnp
def debug_pmap():
@jax.pmap
def func(x, w):
return x @ w
y = func(jnp.ones((2, 4)), jnp.ones((2, 4)))
print(y, type(y))
def test_nested_pmap():
@partial(jax.pmap, axis_name='a0', i... |
self_supervised/vision/dino.py | jwuphysics/self_supervised | 243 | 12795932 | <gh_stars>100-1000
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/15 - dino.ipynb (unless otherwise specified).
__all__ = ['DINOHead', 'get_dino_aug_pipelines', 'DINOModel', 'DINO']
# Cell
from fastai.vision.all import *
from ..augmentations import *
from ..layers import *
from ..models.vision_transformer import *
... |
effects/police.py | vexofp/hyperion | 725 | 12795954 | import hyperion
import time
import colorsys
# Get the parameters
rotationTime = float(hyperion.args.get('rotation-time', 2.0))
colorOne = hyperion.args.get('color_one', (255,0,0))
colorTwo = hyperion.args.get('color_two', (0,0,255))
colorsCount = hyperion.args.get('colors_count', hyperion.ledCount/2)
reverse = bool(hy... |
labml_nn/transformers/alibi/experiment.py | BioGeek/annotated_deep_learning_paper_implementations | 3,714 | 12795955 | """
---
title: Attention with Linear Biases (ALiBi) Experiment
summary: This experiment trains an Attention with Linear Biases (ALiBi) based model on Tiny Shakespeare dataset.
---
# [Attention with Linear Biases (ALiBi)](index.html) Experiment
This is an annotated PyTorch experiment to train a [ALiBi model](index.htm... |
Chapter_14/simulation_model.py | pauldevos/Mastering-Object-Oriented-Python-Second-Edition | 108 | 12795972 | <reponame>pauldevos/Mastering-Object-Oriented-Python-Second-Edition
#!/usr/bin/env python3.7
"""
Mastering Object-Oriented Python 2e
Code Examples for Mastering Object-Oriented Python 2nd Edition
Chapter 14. Example 1 -- simulation model.
"""
from dataclasses import dataclass, astuple, asdict, field
from typing impo... |
tests/exception_test.py | gglin001/poptorch | 128 | 12795997 | <gh_stars>100-1000
#!/usr/bin/env python3
# Copyright (c) 2020 Graphcore Ltd. All rights reserved.
import pytest
import torch
import poptorch
def harness(setting, Model, args):
opts = poptorch.Options()
if setting == "true":
opts.Precision.enableFloatingPointExceptions(True)
elif setting == "fals... |
tests/acceptance/selene_page_factory_test.py | pupsikpic/selene | 572 | 12796012 | <filename>tests/acceptance/selene_page_factory_test.py
# MIT License
#
# Copyright (c) 2015-2021 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... |
contrib/python/CUBRIDdb/connections.py | eido5/cubrid | 253 | 12796064 | """
This module implements connections for CUBRIDdb. Presently there is
only one class: Connection. Others are unlikely. However, you might
want to make your own subclasses. In most cases, you will probably
override Connection.default_cursor with a non-standard Cursor class.
"""
from CUBRIDdb.cursors import *
import t... |
Python/math/sum_of_digits.py | TechSpiritSS/NeoAlgo | 897 | 12796066 | # Python program to Find the Sum of Digits of a Number
def sum_of_digits(num):
# Extracting Each digits
# and compute thier sum in 's'
s = 0
while num != 0:
s = s + (num % 10)
num = num // 10
return s
if __name__ == '__main__':
# Input the number And
# Call the function
... |
monitor/utils/mail.py | laozhudetui/wam | 227 | 12796105 | #!/usr/bin/env python
# coding: utf-8
# __buildin__ modules
import smtplib
from email.mime.text import MIMEText
from monitor.utils.settings import EMAIL_SERVER
from monitor.utils.settings import EMAIL_PORT
from monitor.utils.settings import EMAIL_USER
from monitor.utils.settings import EMAIL_PASS
from monitor.utils.s... |
pl_bolts/callbacks/ssl_online.py | Aayush-Jain01/lightning-bolts | 504 | 12796109 | <filename>pl_bolts/callbacks/ssl_online.py
from contextlib import contextmanager
from typing import Any, Dict, Optional, Sequence, Tuple, Union
import torch
from pytorch_lightning import Callback, LightningModule, Trainer
from pytorch_lightning.utilities import rank_zero_warn
from torch import Tensor, nn
from torch.nn... |
GCC-paddle/gcc/models/emb/from_numpy.py | S-HuaBomb/Contrib | 243 | 12796123 | <reponame>S-HuaBomb/Contrib
import random
import networkx as nx
import numpy as np
class Zero(object):
def __init__(self, hidden_size, **kwargs):
self.hidden_size = hidden_size
def train(self, G):
return np.zeros((G.number_of_nodes(), self.hidden_size))
class FromNumpy(object):
def __i... |
src/yolo4/BaseModel.py | xiao9616/yolo4_tensorflow2 | 212 | 12796167 | # =============================================
# -*- coding: utf-8 -*-
# @Time : 2020/5/14 上午10:50
# @Author : xiao9616
# @Email : <EMAIL>
# @File : BaseModel.py
# @Software: PyCharm
# ============================================
import logging
import tensorflow as tf
import os
f... |
packages/core/minos-microservice-networks/minos/networks/brokers/handlers/__init__.py | bhardwajRahul/minos-python | 247 | 12796186 | from .impl import (
BrokerHandler,
)
from .ports import (
BrokerHandlerService,
BrokerPort,
)
|
HITCON/2018/children_tcache/exploit.py | Per5ianCat/ctf-writeups | 476 | 12796193 | #!/usr/bin/env python
from pwn import *
def new_heap(size, data, attack=False):
p.sendlineafter('Your choice: ', '1')
p.sendlineafter('Size:', str(size))
if attack:
return
p.sendafter('Data:', data)
if len(data) < size:
p.sendline()
def show_heap(index):
p.sendlineafter('Your ... |
codeforces/acmsguru/112.py | Ashindustry007/competitive-programming | 506 | 12796206 | #!/usr/bin/env python3
# https://codeforces.com/problemsets/acmsguru/problem/99999/112
a,b=map(int,input().split())
print(pow(a,b)-pow(b,a))
|
mmgen/models/architectures/ddpm/modules.py | plutoyuxie/mmgeneration | 718 | 12796227 | <reponame>plutoyuxie/mmgeneration<gh_stars>100-1000
# Copyright (c) OpenMMLab. All rights reserved.
from copy import deepcopy
from functools import partial
import mmcv
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ACTIVATION_LAYERS
from mmcv.cnn.bricks impor... |
kaldi/lm/__init__.py | mxmpl/pykaldi | 916 | 12796238 | from ._arpa_file_parser import ArpaParseOptions
from ._arpa_lm_compiler import *
from ._const_arpa_lm import *
from ._kaldi_rnnlm import *
__all__ = [name for name in dir()
if name[0] != '_'
and not name.endswith('Base')]
|
vdpwi/utils/preprocess.py | achyudh/castor | 132 | 12796244 | import argparse
import os
from scipy.special import erf
from scipy.stats import truncnorm
import numpy as np
import data
def build_vector_cache(glove_filename, vec_cache_filename, vocab):
print("Building vector cache...")
with open(glove_filename) as f, open(vec_cache_filename, "w") as f2:
for line i... |
RecoLocalTracker/SubCollectionProducers/python/ClusterMultiplicityFilter_cfi.py | ckamtsikis/cmssw | 852 | 12796248 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
tifClusterFilter = cms.EDFilter("ClusterMultiplicityFilter",
MaxNumberOfClusters = cms.uint32(300),
ClusterCollection = cms.InputTag('siStripClusters')
)
|
networkit/test/test_matching_algorithms.py | angriman/network | 366 | 12796257 | #!/usr/bin/env python3
import random
import unittest
import networkit as nk
class TestMatchingAlgorithms(unittest.TestCase):
def generateRandomWeights(self, g):
if not g.isWeighted():
g = nk.graphtools.toWeighted(g)
for e in g.iterEdges():
g.setWeight(e[0], e[1], random.random())
return g
def setUp(s... |
scripts/examples/OpenMV/32-modbus/modbus_apriltag.py | jiskra/openmv | 1,761 | 12796287 | <gh_stars>1000+
import sensor, image
import time
from pyb import UART
from modbus import ModbusRTU
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
uart = UART(3,115200, parity=None, stop=2, timeout=1, timeout_char=4)
m... |
formats/ycd/__init__.py | Adobe12327/Sollumz | 131 | 12796316 | <filename>formats/ycd/__init__.py
if "bpy" in locals():
import importlib
importlib.reload(Animation)
importlib.reload(AnimSequence)
importlib.reload(Channel)
importlib.reload(Clip)
importlib.reload(ClipDictionary)
importlib.reload(utils)
else:
from . import Animation
from . import An... |
iepy/webui/corpus/migrations/0003_remove_dont_know_option.py | francolq/iepy | 813 | 12796326 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('corpus', '0002_data_migration_dont_know_skip_merge'),
]
operations = [
migrations.AlterField(
model_name='eviden... |
examples/image/plot_dataset_mtf.py | Pandinosaurus/pyts | 1,217 | 12796363 | """
====================================
Data set of Markov transition fields
====================================
A Markov transition field is an image obtained from a time series, representing
a field of transition probabilities for a discretized time series.
Different strategies can be used to bin time series.
It i... |
core/src/autogluon/core/searcher/bayesopt/tuning_algorithms/defaults.py | zhiqiangdon/autogluon | 4,462 | 12796388 | <gh_stars>1000+
from .bo_algorithm_components import LBFGSOptimizeAcquisition
from ..models.meanstd_acqfunc_impl import EIAcquisitionFunction
DEFAULT_ACQUISITION_FUNCTION = EIAcquisitionFunction
DEFAULT_LOCAL_OPTIMIZER_CLASS = LBFGSOptimizeAcquisition
DEFAULT_NUM_INITIAL_CANDIDATES = 250
DEFAULT_NUM_INITIAL_RANDOM_EV... |
tensorflow/27.pyflink-kafka/notebooks/tensorflow_predict.py | huseinzol05/Gather-Tensorflow-Serving | 267 | 12796392 | from pyflink.datastream import StreamExecutionEnvironment, TimeCharacteristic
from pyflink.table import StreamTableEnvironment, DataTypes, EnvironmentSettings
from pyflink.table.descriptors import (
Schema,
Kafka,
Json,
Rowtime,
OldCsv,
FileSystem,
)
from pyflink.table.udf import udf
s_env = St... |
docs/code/snippet_nmf_fro.py | askerdb/nimfa | 325 | 12796445 | import numpy as np
import nimfa
V = np.random.rand(40, 100)
nmf = nimfa.Nmf(V, seed="nndsvd", rank=10, max_iter=12, update='euclidean',
objective='fro')
nmf_fit = nmf()
|
contrib/python/cuuid/base_x.py | Kronuz/Xapiand | 370 | 12796455 | <gh_stars>100-1000
#
# Copyright (C) 2015-2018 Dubalu LLC. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
... |
d3status/tasks/email_tasks.py | nicozhang/startUp | 124 | 12796486 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012 feilong.me. All rights reserved.
#
# @author: <NAME> <<EMAIL>>
# Created on Jun 30, 2012
#
from celery.task import task
from d3status.mail import send_email
@task
def send_email_task(fr, to, subject, body, html=None, attachments=[]):
send_email(f... |
clist/migrations/0012_auto_20191123_0953.py | horacexd/clist | 166 | 12796499 | <gh_stars>100-1000
# Generated by Django 2.1.7 on 2019-11-23 09:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('clist', '0011_auto_20190818_1125'),
]
operations = [
migrations.AddIndex(
model_name='contest',
i... |
dltk/core/residual_unit.py | themantalope/DLTK | 1,397 | 12796516 | <reponame>themantalope/DLTK<filename>dltk/core/residual_unit.py
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import tensorflow as tf
import numpy as np
def vanilla_residual_unit_3d(inputs,
... |
examples/simpleApp.py | tgolsson/appJar | 666 | 12796601 | <filename>examples/simpleApp.py
# import the library
from appJar import gui
app = gui() # top slice - CREATE the GUI
app.addLabel("title", "Welcome to appJar") # add a label
app.setLabelBg("title", "red") # set the label's background to be red
app.go() # bottom s... |
coding_interviews/leetcode/medium/reduce_array_size_to_the_half/reduce_array_size_to_the_half.py | LeandroTk/Algorithms | 205 | 12796620 | <reponame>LeandroTk/Algorithms<filename>coding_interviews/leetcode/medium/reduce_array_size_to_the_half/reduce_array_size_to_the_half.py
# https://leetcode.com/problems/reduce-array-size-to-the-half
'''
Time Complexity: O(NlogN)
Space Complexity: O(N)
'''
def min_set_size(arr):
num_to_count, counts, min_size, cur... |
configs/nas_fcos/ranksort_nas_fcos_r50_caffe_fpn_1x_coco_lr0010.py | yinchimaoliang/ranksortloss | 210 | 12796621 | _base_ = 'ranksort_nas_fcos_r50_caffe_fpn_1x_coco.py'
optimizer = dict(lr=0.010)
|
Scripts/s4cl_tests/utils/common_function_utils_tests.py | ColonolNutty/Sims4CommunityLibrary | 118 | 12796652 | """
The Sims 4 Community Library is licensed under the Creative Commons Attribution 4.0 International public license (CC BY 4.0).
https://creativecommons.org/licenses/by/4.0/
https://creativecommons.org/licenses/by/4.0/legalcode
Copyright (c) COLONOLNUTTY
"""
from typing import Any
from sims4communitylib.modinfo impo... |
Stock/Data/Engine/Common/DyStockDataCommonEngine.py | Leonardo-YXH/DevilYuan | 135 | 12796671 | <filename>Stock/Data/Engine/Common/DyStockDataCommonEngine.py
from .DyStockDataCodeTable import *
from .DyStockDataTradeDayTable import *
from .DyStockDataSectorCodeTable import *
class DyStockDataCommonEngine(object):
""" 代码表和交易日数据引擎 """
def __init__(self, mongoDbEngine, gateway, info):
self._mongoD... |
hackerrank/data-structures/2d-array.py | Ashindustry007/competitive-programming | 506 | 12796688 | #!/usr/bin/env python3
# https://www.hackerrank.com/challenges/2d-array
a=[0]*6
for i in range(6): a[i]=[int(x) for x in input().split()]
c=-9*9
for i in range(1,5):
for j in range(1,5):
c=max(c,a[i-1][j-1]+a[i-1][j]+a[i-1][j+1]+a[i][j]+a[i+1][j-1]+a[i+1][j]+a[i+1][j+1])
print(c)
|
tools/doc2md.py | wiltonlazary/Nidium | 1,223 | 12796710 | #!/usr/bin/env python2.7
import json
from pprint import pprint
import os
import sys
import re
import dokumentor
import subprocess
def parseParam(arg, indent=0, isReturn=False):
out = ""
if isReturn:
out += "Returns (%s): %s\n" % (parseParamsType(arg["typed"]), arg["description"])
else:
out... |
ml/notebook_examples/functions/main.py | bhjeong-goldenplanet/automl | 146 | 12796718 | <filename>ml/notebook_examples/functions/main.py
import logging
import datetime
import logging
import time
import kfp
import kfp.compiler as compiler
import kfp.dsl as dsl
import requests
# TODO: replace yours
# HOST = 'https://<yours>.pipelines.googleusercontent.com'
HOST = 'https://7c7f7f3e3d11e1d4-dot-us-centr... |
tha2/nn/batch_module/batch_input_module.py | luuil/talking-head-anime-2-demo | 626 | 12796719 | from abc import ABC, abstractmethod
from typing import List
from torch import Tensor
from torch.nn import Module
from tha2.nn.base.module_factory import ModuleFactory
class BatchInputModule(Module, ABC):
def __init__(self):
super().__init__()
@abstractmethod
def forward_from_batch... |
tools/sample.py | VanessaDo/cloudml-samples | 1,552 | 12796723 | <gh_stars>1000+
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
iota/commands/extended/broadcast_and_store.py | EasonC13/iota.py | 347 | 12796728 | <reponame>EasonC13/iota.py<gh_stars>100-1000
from iota.commands import FilterCommand
from iota.commands.core.broadcast_transactions import \
BroadcastTransactionsCommand
from iota.commands.core.store_transactions import StoreTransactionsCommand
import asyncio
__all__ = [
'BroadcastAndStoreCommand',
]
class B... |
reddit2telegram/new_channel.py | soulofrubber/reddit2telegram | 187 | 12796746 | #encoding:utf-8
import os
import utils.channels_stuff
def run_script(channel):
os.system('python supplier.py --sub ' + channel.lower())
def med_fashioned_way():
subreddit_name = input('Subreddit name: ')
channel_name = input('Channel name: ')
tags = input('#Tags #in #that #way: ')
print('Subm... |
estruturais/flyweight/main.py | caio-bernardo/design-patterns-python | 363 | 12796753 | class KarakTea:
def __init__(self, tea_type):
self.__tea_type = tea_type
@property
def tea_type(self):
return self.__tea_type
class TeaMaker:
def __init__(self):
self.__available_tea = dict()
def make(self, preference):
if preference not in self.__available_tea:
... |
py/tests/test_nil.py | JakeMakesStuff/erlpack | 108 | 12796757 | from __future__ import absolute_import
from erlpack import pack
def test_nil():
assert pack(None) == b'\x83s\x03nil'
|
dataviva/apps/user/forms.py | joelvisroman/dataviva-site | 126 | 12796766 | <reponame>joelvisroman/dataviva-site
from flask_wtf import Form
from wtforms import TextField, DateField, BooleanField, HiddenField, validators, PasswordField, SelectField
class SignupForm(Form):
email = TextField('email', validators=[validators.Required(), validators.Email()])
fullname = TextField('fullname'... |
osp/institutions/utils.py | davidmcclure/open-syllabus-project | 220 | 12796785 | <reponame>davidmcclure/open-syllabus-project
import tldextract
import re
from urllib.parse import urlparse
def seed_to_regex(seed):
"""
Given a URL, make a regex that matches child URLs.
Args:
seed (str)
Returns: regex
"""
parsed = urlparse(seed)
# 1 -- If the seed has a no... |
jiant/jiant/modules/cove/cove/encoder.py | amirziai/cs229-project | 500 | 12796787 | <gh_stars>100-1000
import os
import torch
from torch import nn
from torch.nn.utils.rnn import pad_packed_sequence as unpack
from torch.nn.utils.rnn import pack_padded_sequence as pack
import torch.utils.model_zoo as model_zoo
model_urls = {
'wmt-lstm' : 'https://s3.amazonaws.com/research.metamind.io/cove/wmtlstm... |
scripts/sprint_report.py | AndrewDVXI/kitsune | 929 | 12796792 | <gh_stars>100-1000
#!/usr/bin/env python
import logging
import sys
import textwrap
import xmlrpc.client
USAGE = 'Usage: sprint_report.py <SPRINT>'
HEADER = 'sprint_report.py: your friendly report view of the sprint!'
# Note: Most of the bugzila api code comes from Scrumbugz.
cache = {}
log = logging.getLogger(__na... |
plugins/tasks_plugin/__init__.py | shivammmmm/querybook | 1,144 | 12796803 | # from tasks.delete_mysql_cache import delete_mysql_cache
# delete_mysql_cache
|
python/tests/test_model.py | alexkreidler/oxigraph | 403 | 12796841 | import unittest
from pyoxigraph import *
XSD_STRING = NamedNode("http://www.w3.org/2001/XMLSchema#string")
XSD_INTEGER = NamedNode("http://www.w3.org/2001/XMLSchema#integer")
RDF_LANG_STRING = NamedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString")
class TestNamedNode(unittest.TestCase):
def test_cons... |
questions/permutations/Solution.py | marcus-aurelianus/leetcode-solutions | 141 | 12796869 | '''
Given a collection of distinct integers, return all possible permutations.
Example:
Input: [1,2,3]
Output:
[
[1,2,3],
[1,3,2],
[2,1,3],
[2,3,1],
[3,1,2],
[3,2,1]
]
'''
class Solution:
def permute(self, nums: List[int]) -> List[List[int]]:
def generate_permutation(nums, ret, curr, visited... |
training/data_lib.py | vsewall/frame-interpolation | 521 | 12796891 | # Copyright 2022 Google LLC
# 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
# https://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, sof... |
ch09/complexity.py | ricjuanflores/practice-of-the-python | 319 | 12796943 | def has_long_words(sentence):
if isinstance(sentence, str): # <1>
sentence = sentence.split(' ')
for word in sentence: # <2>
if len(word) > 10: # <3>
return True
return False # <4>
|
recipes/Python/286229_Remove_control_character_M_opened_html/recipe-286229.py | tdiprima/code | 2,023 | 12797009 | <reponame>tdiprima/code
import string
class Stripper( SGMLParser ) :
...
def handle_data( self, data ) :
data = string.replace( data, '\r', '' )
...
|
f5/bigip/shared/test/functional/test_iapp.py | nghia-tran/f5-common-python | 272 | 12797027 | # Copyright 2015 F5 Networks Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... |
quanttrader/event/__init__.py | qalpha/quanttrader | 135 | 12797038 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .event import *
from .backtest_event_engine import *
from .live_event_engine import * |
alipay/aop/api/domain/MultiStagePayLineInfo.py | antopen/alipay-sdk-python-all | 213 | 12797040 | <reponame>antopen/alipay-sdk-python-all<gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MultiStagePayLineInfo(object):
def __init__(self):
self._payment_amount = None
self._payment_idx = None
@property
... |
src/ape/managers/accounts.py | unparalleled-js/ape | 210 | 12797072 | from typing import Dict, Iterator, List, Type
from dataclassy import dataclass
from pluggy import PluginManager # type: ignore
from ape.api.accounts import AccountAPI, AccountContainerAPI, TestAccountAPI
from ape.types import AddressType
from ape.utils import cached_property, singledispatchmethod
from .config impor... |
BlogPosts/Average_precision/average_precision_post_code.py | markgraves/roamresearch | 190 | 12797086 | <gh_stars>100-1000
from copy import copy
from collections import OrderedDict
import numpy as np
import pandas as pd
from sklearn.metrics import average_precision_score, auc, roc_auc_score
from sklearn.metrics import precision_recall_curve
from sklearn.linear_model import LogisticRegressionCV
from sklearn.cross_validat... |
utils_nlp/models/gensen/utils.py | gohanlon/nlp | 4,407 | 12797099 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Minibatching utilities."""
import itertools
import operator
import os
import pickle
import numpy as np
import torch
from sklearn.utils import shuffle
from torch.autograd impor... |
paragraph_encoder/train_para_encoder.py | rajarshd/Multi-Step-Reasoning | 122 | 12797166 | <filename>paragraph_encoder/train_para_encoder.py
import torch
import numpy as np
import json
import os
import pickle
import sys
import logging
import shutil
from tqdm import tqdm
from torch.autograd import Variable
import torch.optim as optim
import torch.nn.functional as F
from torch.utils.data.sampler import Random... |
orchestra/tests/workflows/test_dir/load_sample_data.py | code-review-doctor/orchestra | 444 | 12797174 | <reponame>code-review-doctor/orchestra
def load(workflow_version):
""" Dummy loading function. """
pass
|
tests/schema/test_visitor.py | mabrains/ALIGN-public | 119 | 12797262 | import pytest
from align.schema.types import BaseModel, Optional, List, Dict
from align.schema.visitor import Visitor, Transformer, cache
@pytest.fixture
def dummy():
class DummyModel(BaseModel):
arg1: str
arg2: Optional[str]
arg3: List[str]
arg4: List[Optional[str]]
arg5: ... |
djangoerp/registration/forms.py | xarala221/django-erp | 345 | 12797325 | <filename>djangoerp/registration/forms.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""This file is part of the django ERP project.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL... |
mpunet/errors/deprecated_warnings.py | alexsosn/MultiPlanarUNet | 156 | 12797402 | from mpunet.logging import ScreenLogger
def warn_sparse_param(logger):
logger = logger or ScreenLogger
sparse_err = "mpunet 0.1.3 or higher requires integer targets" \
" as opposed to one-hot encoded targets. Setting the 'sparse'" \
" parameter no longer has any effect and ma... |
crawler/house_renting/settings.py | bernssolg/house-renting-master | 823 | 12797482 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from house_renting.spider_settings import lianjia, a58
BOT_NAME = 'house_renting'
COMMANDS_MODULE = 'house_renting.commands'
SPIDER_MODULES = ['house_renting.spiders']
NEWSPIDER_MODULE = 'house_renting.spiders'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) A... |
codigo_das_aulas/aula_10/aula_10_08.py | VeirichR/curso-python-selenium | 234 | 12797499 | <reponame>VeirichR/curso-python-selenium<filename>codigo_das_aulas/aula_10/aula_10_08.py
from selenium.webdriver import Firefox
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import (
url_contains,
url_matches
)
url = 'https://selenium.dunossauro.live... |
IronManFly/storage/db/db.py | leepand/IronManFly | 599 | 12797505 | <filename>IronManFly/storage/db/db.py
import threading
import glob
import gzip
try:
from StringIO import StringIO # Python 2.7
except:
from io import StringIO # Python 3.3+
import uuid
import re
import os
import sys
from collections import defaultdict
import pandas as pd
import pybars
from .column import Co... |
opem/Test/test_Padulles_Amphlett.py | Martenet/opem | 173 | 12797517 | # -*- coding: utf-8 -*-
'''
>>> from opem.Dynamic.Padulles_Amphlett import *
>>> import shutil
>>> Test_Vector={"A":50.6,"l":0.0178,"lambda":23,"JMax":1.5,"T":343,"N0":5,"KO2":0.0000211,"KH2":0.0000422,"KH2O":0.000007716,"tH2":3.37,"tO2":6.74,"t1":2,"t2":2,"tH2O":18.418,"rho":1.168,"qMethanol":0.0002,"CV":2,"i-start":0... |
tests/r/test_rep_vict.py | hajime9652/observations | 199 | 12797520 | <filename>tests/r/test_rep_vict.py
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import shutil
import sys
import tempfile
from observations.r.rep_vict import rep_vict
def test_rep_vict():
"""Test module rep_vict.py by downloading
rep_vict.csv and t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.