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 |
|---|---|---|---|---|
tools/prepare_iata_airline_dump_file.py | mtrampont/opentraveldata | 208 | 26184 | <reponame>mtrampont/opentraveldata
#!/usr/bin/env python
import getopt, sys, io
import pandas as pd
#
# Usage
#
def usage (script_name):
"""
Display the usage.
"""
print ("")
print ("Usage: {} [options]".format(script_name))
print ("")
print ("That script transforms and filter a fix width... |
tests/test_functions/http_log_exception/main.py | KaylaNguyen/functions-framework-python | 479 | 26194 | <filename>tests/test_functions/http_log_exception/main.py
# Copyright 2020 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
#
# U... |
swift/internal/swift_c_module.bzl | BalestraPatrick/rules_swift | 215 | 26212 | # Copyright 2018 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... |
mamonsu/plugins/system/linux/__init__.py | sgrinko/mamonsu | 188 | 26278 | __all__ = [
'proc_stat', 'disk_stats', 'disk_sizes',
'memory', 'uptime', 'open_files', 'net', 'la'
,'pg_probackup'
]
from . import *
|
src/ralph/networks/migrations/0010_auto_20170216_1230.py | DoNnMyTh/ralph | 1,668 | 26296 | <gh_stars>1000+
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('networks', '0009_auto_20160823_0921'),
]
operations = [
migrations.AlterFie... |
tacker/api/views/__init__.py | takahashi-tsc/tacker | 116 | 26300 | # Copyright (C) 2020 NTT DATA
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
vkwave/vkscript/__init__.py | krasnovmv/vkwave | 222 | 26312 | <reponame>krasnovmv/vkwave<gh_stars>100-1000
import vkwave.vkscript.handlers.assignments
import vkwave.vkscript.handlers.blocks
import vkwave.vkscript.handlers.calls
import vkwave.vkscript.handlers.expressions
import vkwave.vkscript.handlers.statements
import vkwave.vkscript.handlers.types
from .converter import VKScri... |
validation_tests/case_studies/merewether/plot_results.py | samcom12/anuga_core | 136 | 26319 | from anuga.utilities import plot_utils as util
from matplotlib import pyplot as pyplot
import numpy
verbose= True
swwfile = 'merewether_1m.sww'
p=util.get_output(swwfile)
p2=util.get_centroids(p)
# Time index at last time
tindex = len(p2.time)-1
if verbose: print('calculating experimental transect')
x_data = ... |
test/test_conf.py | nandub/Limnoria | 476 | 26329 | ##
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binar... |
qf_lib/documents_utils/document_exporting/element/custom.py | webclinic017/qf-lib | 198 | 26352 | # Copyright 2016-present CERN – European Organization for Nuclear Research
#
# 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... |
electronics/scripts/generate_svg.py | chrisdearman/splitflap | 2,138 | 26370 | <filename>electronics/scripts/generate_svg.py<gh_stars>1000+
#!/usr/bin/env python3
# Copyright 2015-2016 <NAME> and the splitflap contributors
#
# 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 Li... |
examples/deco_add_param.py | scholer/clize | 390 | 26390 | <gh_stars>100-1000
from sigtools.wrappers import decorator
from clize import run
@decorator
def with_uppercase(wrapped, *args, uppercase=False, **kwargs):
"""
Formatting options:
:param uppercase: Print output in capitals
"""
ret = wrapped(*args, **kwargs)
if uppercase:
return str(ret... |
mealpy/utils/visualize/linechart.py | thieu1995/mealpy | 162 | 26424 | #!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu" at 17:12, 09/07/2021 %
# ... |
rules/tamper/wordpress.py | lavon321/Kunlun-M | 1,059 | 26452 | # -*- coding: utf-8 -*-
"""
wordpress
~~~~
tamper for wordpress
:author: LoRexxar <<EMAIL>>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
wordpress = {
"esc_url": [10... |
tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py | souravsingh/chainercv | 1,600 | 26460 | <reponame>souravsingh/chainercv<filename>tests/links_tests/model_tests/yolo_tests/test_yolo_v3.py
import numpy as np
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links import YOLOv3
@testing.parameterize(*testing.product({
'n_fg_class': [1, 5, 20],
}... |
Plug-and-play module/attention/CBAM/cbam.py | riciche/SimpleCVReproduction | 923 | 26464 | <filename>Plug-and-play module/attention/CBAM/cbam.py
import torch
import torch.nn as nn
def conv3x3(in_planes, out_planes, stride=1):
"3x3 convolution with padding"
return nn.Conv2d(in_planes,
out_planes,
kernel_size=3,
stride=stride,
... |
diffrax/solver/kvaerno5.py | FedericoV/diffrax | 377 | 26472 | import numpy as np
from ..local_interpolation import ThirdOrderHermitePolynomialInterpolation
from .runge_kutta import AbstractESDIRK, ButcherTableau
γ = 0.26
a21 = γ
a31 = 0.13
a32 = 0.84033320996790809
a41 = 0.22371961478320505
a42 = 0.47675532319799699
a43 = -0.06470895363112615
a51 = 0.16648564323248321
a52 = 0.... |
Hinting/Remove Zero Deltas in Selected Glyphs.py | justanotherfoundry/Glyphs-Scripts | 283 | 26473 | #MenuTitle: Remove Zero Deltas in Selected Glyphs
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Goes through all layers of each selected glyph, and deletes all TT Delta Hints with an offset of zero. Detailed Report in Macro Window.
"""
def process( Layer ):
try:... |
torchvision/prototype/utils/__init__.py | yoshitomo-matsubara/vision | 12,063 | 26476 | <reponame>yoshitomo-matsubara/vision<filename>torchvision/prototype/utils/__init__.py
from . import _internal
|
annotation/application/document.py | seal-git/chABSA-dataset | 107 | 26519 | <gh_stars>100-1000
import os
import shutil
import json
class Document():
def __init__(self,
doc_id, doc_text, edi_id, company_name,
body, topic):
self.doc_id = doc_id
self.doc_text = doc_text
self.edi_id = edi_id
self.company_name = company_name
... |
__scraping__/just-eat.fr - robobrowser/main.py | whitmans-max/python-examples | 140 | 26538 | <reponame>whitmans-max/python-examples
# date: 2019.05.05
# author: Bartłomiej 'furas' Burek
import robobrowser
br = robobrowser.RoboBrowser(user_agent='Mozilla/5.0 (X11; Linux i586; rv:31.0) Gecko/20100101 Firefox/31.0')
br.parser = 'lxml'
br.open("https://www.just-eat.fr")
print(br.get_forms())
iframe_src = br.s... |
nototools/drop_hints.py | RoelN/nototools | 156 | 26541 | <filename>nototools/drop_hints.py
#!/usr/bin/env python
#
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licen... |
floss/decoding_manager.py | fireeye/flare-floss | 2,067 | 26545 | <filename>floss/decoding_manager.py
# Copyright (C) 2017 Mandiant, Inc. All Rights Reserved.
import logging
from typing import List, Tuple
from dataclasses import dataclass
import viv_utils
import envi.memory
import viv_utils.emulator_drivers
from envi import Emulator
from . import api_hooks
logger = logging.getLog... |
datadog_checks_base/tests/openmetrics/test_interface.py | vbarbaresi/integrations-core | 663 | 26555 | <filename>datadog_checks_base/tests/openmetrics/test_interface.py
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.base import OpenMetricsBaseCheckV2
from datadog_checks.base.constants import ServiceCheck
from datadog_c... |
hbaselines/envs/deeploco/envs.py | reufko/h-baselines | 186 | 26585 | """Script containing the DeepLoco environments."""
import gym
import numpy as np
import os
import sys
import cv2
try:
sys.path.append(os.path.join(os.environ["TERRAINRL_PATH"], "simAdapter"))
import terrainRLSim # noqa: F401
except (KeyError, ImportError, ModuleNotFoundError):
pass
class BipedalSoccer(g... |
river/tree/hoeffding_tree.py | online-ml/creme | 1,105 | 26589 | <reponame>online-ml/creme<filename>river/tree/hoeffding_tree.py
import collections
import functools
import io
import math
import typing
from abc import ABC, abstractmethod
from river import base
from river.utils.skmultiflow_utils import (
calculate_object_size,
normalize_values_in_dict,
)
from .nodes.branch i... |
services/docker/webrecorder/local.py | rachelaus/perma | 317 | 26591 | import hashlib
import logging
import os
import shutil
import traceback
from contextlib import closing
from pywb.utils.loaders import BlockLoader
from webrecorder.rec.storage.base import BaseStorage
from webrecorder.rec.storage.storagepaths import add_local_store_prefix, strip_prefix
logger = logging.getLogger('wr.io... |
cape_privacy/pandas/transformations/test_utils.py | vismaya-Kalaiselvan/cape-python | 144 | 26612 | <gh_stars>100-1000
import pandas as pd
class PlusN:
"""A sample transform that adds n to a specific field.
Attributes:
field: The field that this transform will be applied to.
n: The value to add to the field.
"""
identifier = "plusN"
type_signature = "col->col"
def __init__... |
ext/testlib/suite.py | mandaltj/gem5_chips | 135 | 26640 | <gh_stars>100-1000
# Copyright (c) 2017 <NAME> and <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of co... |
rotkehlchen/accounting/export/csv.py | rotkehlchenio/rotkehlchen | 137 | 26690 | <reponame>rotkehlchenio/rotkehlchen
import json
import logging
from csv import DictWriter
from pathlib import Path
from tempfile import mkdtemp
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Tuple
from zipfile import ZIP_DEFLATED, ZipFile
from rotkehlchen.accounting.pnl import PnlTotals
from rotkehlchen.c... |
src/abundance.py | Ilia-Abolhasani/modify_vamb | 111 | 26706 | import sys
import os
import argparse
import numpy as np
parser = argparse.ArgumentParser(
description="""Command-line bin abundance estimator.
Print the median RPKM abundance for each bin in each sample to STDOUT.
Will read the RPKM file into memory - beware.""",
formatter_class=argparse.RawDescriptionHelpForm... |
pony/orm/tests/test_f_strings.py | luckydonald/pony | 2,628 | 26762 | <filename>pony/orm/tests/test_f_strings.py
from sys import version_info
if version_info[:2] >= (3, 6):
from pony.orm.tests.py36_test_f_strings import * |
applications/MultilevelMonteCarloApplication/python_scripts/statistical_variable_utilities.py | lkusch/Kratos | 778 | 26808 | <filename>applications/MultilevelMonteCarloApplication/python_scripts/statistical_variable_utilities.py
# Import Python libraries
import numpy as np
# Import distributed framework
from exaqute import *
try:
init()
except:
pass
try:
computing_units_auxiliar_utilities = int(os.environ["computing_units_auxil... |
contrib/experiments/interpretation/penobscot/local/default.py | elmajdma/seismic-deeplearning | 270 | 26829 | <gh_stars>100-1000
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __... |
src/backend/common/sitevars/flask_secrets.py | ofekashery/the-blue-alliance | 266 | 26831 | from typing import TypedDict
from backend.common.sitevars.sitevar import Sitevar
class ContentType(TypedDict):
secret_key: str
class FlaskSecrets(Sitevar[ContentType]):
DEFAULT_SECRET_KEY: str = "thebluealliance"
@staticmethod
def key() -> str:
return "flask.secrets"
@staticmethod
... |
mmdet/ops/nms_rotated/nms_rotated_wrapper.py | vpeopleonatank/OBBDetection | 274 | 26841 | <reponame>vpeopleonatank/OBBDetection
import BboxToolkit as bt
import numpy as np
import torch
from . import nms_rotated_ext
def obb2hbb(obboxes):
center, w, h, theta = torch.split(obboxes, [2, 1, 1, 1], dim=1)
Cos, Sin = torch.cos(theta), torch.sin(theta)
x_bias = torch.abs(w/2 * Cos) + torch.abs(h/2 * ... |
stronghold/tests/testmixins.py | davitovmasyan/django-stronghold | 252 | 26846 | from stronghold.views import StrongholdPublicMixin
import django
from django.views.generic import View
from django.views.generic.base import TemplateResponseMixin
if django.VERSION[:2] < (1, 9):
from django.utils import unittest
else:
import unittest
class StrongholdMixinsTests(unittest.TestCase):
def ... |
pydis_site/apps/api/migrations/0055_reminder_mentions.py | Numerlor/site | 700 | 26851 | <filename>pydis_site/apps/api/migrations/0055_reminder_mentions.py
# Generated by Django 2.2.14 on 2020-07-15 07:37
import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0054_user_inva... |
hata/ext/extension_loader/client_extension.py | Multiface24111/hata | 173 | 26853 | <gh_stars>100-1000
__all__ = ()
from ...backend.utils import KeepType
from ...discord.client import Client
from .extension import EXTENSIONS, EXTENSION_STATE_LOADED
@KeepType(Client)
class Client:
@property
def extensions(self):
"""
Returns a list of extensions added to the client. Added by ... |
MANN/Utils/similarities.py | jgyllinsky/How-to-Learn-from-Little-Data | 161 | 26859 | import tensorflow as tf
def cosine_similarity(x, y, eps=1e-6):
z = tf.batch_matmul(x, tf.transpose(y, perm=[0,2,1]))
z /= tf.sqrt(tf.multiply(tf.expand_dims(tf.reduce_sum(tf.multiply(x,x), 2), 2),tf.expand_dims(tf.reduce_sum(tf.multiply(y,y), 2), 1)) + eps)
return z
|
data/synthetic/analyze.py | thonic/pyhawkes | 221 | 26877 | import gzip
import pickle
import os
def analyze(data_path):
"""
Run the comparison on the given data file
:param data_path:
:return:
"""
if data_path.endswith(".gz"):
with gzip.open(data_path, 'r') as f:
S, true_model = pickle.load(f)
else:
with open(data_path... |
rl_coach/graph_managers/hrl_graph_manager.py | jl45621/coach | 1,960 | 26882 | <reponame>jl45621/coach
#
# Copyright (c) 2017 Intel Corporation
#
# 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 app... |
sphinx-sources/Examples/ComputerPrac/FresnelPlane.py | jccmak/lightpipes | 132 | 26893 | #!/usr/bin/env python
"""
Computer practical 6.1. Fresnel diffraction, plane wavefront.
=============================================================
This is part of the 'computer practical' set of assignments.
Demonstrates Fresnel diffraction when a plane wavefront enters
a round hole.
Measur... |
python/parserDev/brothon/live_simulator.py | jzadeh/aktaion | 112 | 26926 | """LiveSimulator: This class reads in various Bro IDS logs. The class utilizes
the BroLogReader and simply loops over the static bro log
file, replaying rows and changing any time stamps
Args:
eps (int): Events Per Second that the simulator will emit events (default... |
test/util_test.py | quiet-oceans/libais | 161 | 26943 | #!/usr/bin/env python
"""Tests for ais.util."""
import unittest
from ais import util
import six
class UtilTest(unittest.TestCase):
def testMaybeToNumber(self):
self.assertEqual(util.MaybeToNumber(None), None)
self.assertEqual(util.MaybeToNumber([]), [])
self.assertEqual(util.MaybeToNumber({}), {})
... |
Chapter8/listing8_1.py | hohsieh/osgeopy-code | 160 | 26945 | <filename>Chapter8/listing8_1.py
# Script to reproject a shapefile.
from osgeo import ogr, osr
# Create an output SRS.
sr = osr.SpatialReference()
sr.ImportFromProj4('''+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23
+lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80
+datum=NAD83 +units=m +... |
Validation/RecoTrack/python/customiseMTVForBPix123Holes.py | ckamtsikis/cmssw | 852 | 26947 | <filename>Validation/RecoTrack/python/customiseMTVForBPix123Holes.py
from __future__ import print_function
# This customise file provides an example (in the form of holes in
# BPix L1-L2 and L3-L3) on how to select a subset of generalTracks
# (e.g. by phi and eta) and setup various MTV instances for those
# (selected t... |
examples/hist.py | RyanAugust/geoplotlib | 1,021 | 26959 | <reponame>RyanAugust/geoplotlib
"""
Example of 2D histogram
"""
import geoplotlib
from geoplotlib.utils import read_csv, BoundingBox
data = read_csv('data/opencellid_dk.csv')
geoplotlib.hist(data, colorscale='sqrt', binsize=8)
geoplotlib.set_bbox(BoundingBox.DK)
geoplotlib.show()
|
recipes/Python/578871_Simple_Tkinter_strip_chart/recipe-578871.py | tdiprima/code | 2,023 | 26969 | # (c) MIT License Copyright 2014 <NAME>
# Please reuse, modify or distribute freely.
from collections import OrderedDict
import tkinter as tk
class StripChart( tk.Frame ):
def __init__( self, parent, scale, historySize, trackColors, *args, **opts ):
# Initialize
super().__init__( parent, *args, **opts ... |
graph_explorer/structured_metrics/plugins/vmstat.py | farheenkaifee/dashboard_3 | 284 | 26977 | from . import Plugin
class VmstatPlugin(Plugin):
targets = [
{
'match': '^servers\.(?P<server>[^\.]+)\.vmstat\.(?P<type>.*)$',
'target_type': 'rate',
'tags': {'unit': 'Page'}
}
]
def sanitize(self, target):
target['tags']['type'] = target['tags'... |
SimCalorimetry/EcalSelectiveReadoutProducers/python/ecalDigis_craft_cfi.py | ckamtsikis/cmssw | 852 | 26991 | import FWCore.ParameterSet.Config as cms
simEcalDigis = cms.EDProducer("EcalSelectiveReadoutProducer",
# Label of input EB and EE digi collections
digiProducer = cms.string('simEcalUnsuppressedDigis'),
# Instance name of input EB digi collections
EBdigiCollection = cms.string(''),
# Instance name... |
plugin/AssemblerSPAdes/bin/RunAssembler.py | konradotto/TS | 125 | 27024 | #!/usr/bin/env python
import json
import os
import subprocess
import sys
def fileExistsAndNonEmpty(filename):
if not os.path.exists(filename):
return False
return os.stat(filename).st_size > 0
class AssemblerRunner(object):
def __init__(self, sample_id, sample_seq, bam_file):
with open("st... |
blogs/views/feed.py | daaawx/bearblog | 657 | 27051 | from django.http.response import Http404
from django.http import HttpResponse
from blogs.helpers import unmark, clean_text
from blogs.views.blog import resolve_address
from feedgen.feed import FeedGenerator
import mistune
def feed(request):
blog = resolve_address(request)
if not blog:
raise Http404... |
tests/functional/test_tagged_unions_unknown.py | karim7262/botocore | 1,063 | 27054 | <gh_stars>1000+
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "licen... |
tools/launcher.py | agentx-cgn/Hannibal | 189 | 27105 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
https://docs.python.org/2/library/subprocess.html#popen-objects
http://stackoverflow.com/questions/1606795/catching-stdout-in-realtime-from-subprocess
http://askubuntu.com/questions/458041/find-x-window-name
http://stackoverflow.com/questions/9681959/how-can-i-use-xdot... |
src/jarvis/jarvis/skills/collection/remember.py | jameswynn/Python-ai-assistant | 424 | 27125 | # MIT License
# Copyright (c) 2019 <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 without limitation the rights
# to use, copy, modify, merge, publish... |
tests/test_inheritance_and_pydantic_generation/test_validators_in_generated_pydantic.py | ivangirko/ormar | 905 | 27151 | <filename>tests/test_inheritance_and_pydantic_generation/test_validators_in_generated_pydantic.py<gh_stars>100-1000
import enum
import databases
import pydantic
import pytest
import sqlalchemy
from pydantic import ValidationError
import ormar
from tests.settings import DATABASE_URL
metadata = sqlalchemy.MetaData()
... |
torchbnn/functional.py | Harry24k/bayesian-neural-network-pytorch | 178 | 27192 | <reponame>Harry24k/bayesian-neural-network-pytorch
import math
import torch
from .modules import *
def _kl_loss(mu_0, log_sigma_0, mu_1, log_sigma_1) :
"""
An method for calculating KL divergence between two Normal distribtuion.
Arguments:
mu_0 (Float) : mean of normal distribution.
log_s... |
Python3/537.py | rakhi2001/ecom7 | 854 | 27201 | <reponame>rakhi2001/ecom7<filename>Python3/537.py
__________________________________________________________________________________________________
sample 24 ms submission
class Solution:
def complexNumberMultiply(self, a: str, b: str) -> str:
A = [int(x) for x in a.replace('i','').split('+')]
B = ... |
metaworld/policies/sawyer_push_wall_v2_policy.py | yiwc/robotics-world | 681 | 27212 | <reponame>yiwc/robotics-world<filename>metaworld/policies/sawyer_push_wall_v2_policy.py
import numpy as np
from metaworld.policies.action import Action
from metaworld.policies.policy import Policy, assert_fully_parsed, move
class SawyerPushWallV2Policy(Policy):
@staticmethod
@assert_fully_parsed
def _pa... |
sdk/notificationhubs/azure-mgmt-notificationhubs/azure/mgmt/notificationhubs/models/__init__.py | rsdoherty/azure-sdk-for-python | 2,728 | 27240 | <reponame>rsdoherty/azure-sdk-for-python
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R... |
python/15_bsearch/bsearch_recursion.py | shipan3452/algo | 22,028 | 27269 | <reponame>shipan3452/algo
"""
Author: dreamkong
"""
from typing import List
def bsearch(nums: List[int], target: int) -> int:
return bsearch_internally(nums, 0, len(nums)-1, target)
def bsearch_internally(nums: List[int], low: int, high: int, target: int) -> int:
if low > high:
return -1
m... |
alphamind/model/data_preparing.py | rongliang-tech/alpha-mind | 186 | 27271 | # -*- coding: utf-8 -*-
"""
Created on 2017-8-24
@author: cheng.li
"""
import bisect
import datetime as dt
from typing import Iterable
from typing import Union
import numpy as np
import pandas as pd
from simpleutils.asserts import require
from PyFin.DateUtilities import Period
from PyFin.api import BizDayConventions... |
Echoes/Filezilla.py | xeddmc/BrainDamage | 1,520 | 27277 | # Based on the work of https://github.com/AlessandroZ/LaZagne/blob/master/Windows/lazagne/
import xml.etree.cElementTree as ET
import os, base64
class Filezilla():
def __init__(self):
options = {'command': '-f', 'action': 'store_true', 'dest': 'filezilla', 'help': 'filezilla'}
def run(self):
i... |
libcity/model/trajectory_loc_prediction/SERM.py | moghadas76/test_bigcity | 221 | 27280 | <filename>libcity/model/trajectory_loc_prediction/SERM.py<gh_stars>100-1000
import torch
import torch.nn as nn
import numpy as np
from libcity.model.abstract_model import AbstractModel
from torch.nn.utils.rnn import pack_padded_sequence
from torch.nn.utils.rnn import pad_packed_sequence
class EmbeddingMatrix(nn.Modul... |
src/api/test/test_datahub_serializer.py | RogerTangos/datahub-stub | 192 | 27300 | <filename>src/api/test/test_datahub_serializer.py<gh_stars>100-1000
from mock import patch
from django.test import TestCase
from ..serializer import DataHubSerializer
class DataHubSerializerTests(TestCase):
"""Test DataHubSerializer methods"""
def setUp(self):
self.username = "delete_me_username"
... |
cflearn/api/ml/interface.py | carefree0910/carefree-learn | 400 | 27370 | import os
import json
import shutil
import numpy as np
from typing import Any
from typing import Dict
from typing import List
from typing import Type
from typing import Tuple
from typing import Union
from typing import Callable
from typing import Optional
from typing import NamedTuple
from tqdm.autonotebook import tq... |
test/testing/test_pandas_assert.py | S-aiueo32/gokart | 255 | 27390 | <reponame>S-aiueo32/gokart
import unittest
import pandas as pd
import gokart
class TestPandasAssert(unittest.TestCase):
def test_assert_frame_contents_equal(self):
expected = pd.DataFrame(data=dict(f1=[1, 2, 3], f3=[111, 222, 333], f2=[4, 5, 6]), index=[0, 1, 2])
resulted = pd.DataFrame(data=dic... |
WebMirror/util/StatusUpdater/Updater.py | awesome-archive/ReadableWebProxy | 193 | 27430 |
if __name__ == "__main__":
import logSetup
logSetup.initLogging()
import pickle
from common import database
import config
import common.LogBase
import WebMirror.rules
from WebMirror.OutputFilters.util.MessageConstructors import pack_message
import WebMirror.TimedTriggers.TriggerBase
import common.get_rpyc
# impo... |
data_structures/heap/heap_using_heapq.py | ruler30cm/python-ds | 1,723 | 27469 | <reponame>ruler30cm/python-ds
"""
Heap in python using heapq library function
Note: by default, heapq creates a min-heap. To make it a
max-heap, add items after multiplying them by -1
"""
from heapq import heappop, heappush, heapify
heap = []
heapify(heap)
heappush(heap, 10)
heappush(heap, 11)
heappush(heap, 2)
he... |
S2.Surface_Normal/regNormalNet/regNormalNet.py | leoshine/Spherical_Regression | 133 | 27496 | <filename>S2.Surface_Normal/regNormalNet/regNormalNet.py<gh_stars>100-1000
# coding: utf8
"""
@Author : <NAME>
"""
import os
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from torch.autograd import Variable
import torch
from basic.common import rdict
import numpy as np
from easydict import Ea... |
timemachines/skaters/orbt/orbitlgtskaterfactory.py | iklasky/timemachines | 253 | 27524 |
from timemachines.skaters.orbt.orbitinclusion import using_orbit
if using_orbit:
from timemachines.skaters.orbt.orbitwrappers import orbit_lgt_iskater
from timemachines.skatertools.utilities.conventions import Y_TYPE, A_TYPE, R_TYPE, E_TYPE, T_TYPE
from timemachines.skatertools.batch.batchskater import ba... |
sponsors/migrations/0038_auto_20210827_1223.py | Manny27nyc/pythondotorg | 911 | 27531 | # Generated by Django 2.0.13 on 2021-08-27 12:23
from django.db import migrations
def populate_sponsorship_package_fk(apps, schema_editor):
Sponsorship = apps.get_model('sponsors.Sponsorship')
SponsorshipPackage = apps.get_model('sponsors.SponsorshipPackage')
for sponsorship in Sponsorship.objects.all()... |
backpack/extensions/secondorder/diag_ggn/permute.py | jabader97/backpack | 395 | 27565 | """Module defining DiagGGNPermute."""
from backpack.core.derivatives.permute import PermuteDerivatives
from backpack.extensions.secondorder.diag_ggn.diag_ggn_base import DiagGGNBaseModule
class DiagGGNPermute(DiagGGNBaseModule):
"""DiagGGN extension of Permute."""
def __init__(self):
"""Initialize.""... |
analysis_engine/prepare_history_dataset.py | virdesai/stock-analysis-engine | 819 | 27577 | """
Helper for loading a ``Trading History`` dataset
"""
import json
import zlib
import pandas as pd
import analysis_engine.consts as ae_consts
import spylunking.log.setup_logging as log_utils
log = log_utils.build_colorized_logger(name=__name__)
def prepare_history_dataset(
data,
compress=False,
... |
scripts/count_git_changes.py | ShankarNara/shogun | 2,753 | 27578 | <reponame>ShankarNara/shogun
import os
import sys
insertions=0
deletions=0
files=0
FROMVER=""
if len(sys.argv)>1:
FROMVER=sys.argv[1]
TOVER=""
if len(sys.argv)>2:
TOVER=sys.argv[2]
TMPNAME=os.tmpnam()
VER=""
if len(FROMVER)>0:
VER=FROMVER+'..'
if len(TOVER)>0:
if len(VER)==0:
VER='..'
VER=VER+TOVER
os.system('... |
tools/telemetry/telemetry/core/platform/power_monitor/android_ds2784_power_monitor_unittest.py | kjthegod/chromium | 231 | 27591 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.core.platform.power_monitor import android_ds2784_power_monitor
class DS2784PowerMonitorMonitorTest(unittest.TestCase):
d... |
nlt/debug/dataset.py | isabella232/neural-light-transport | 176 | 27607 | <filename>nlt/debug/dataset.py
# Copyright 2020 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 applicabl... |
events/migrations/0043_remove_premium_restrictions.py | alysivji/GetTogether | 446 | 27633 | # Generated by Django 2.0 on 2018-08-25 14:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("events", "0042_allow_team_without_country")]
operations = [
migrations.RemoveField(model_name="team", name="is_premium"),
migrations.RemoveField(model_name... |
test/com/facebook/buck/parser/testdata/disable_implicit_native_rules/skylark/implicit_in_extension_bzl/extension.bzl | Unknoob/buck | 8,027 | 27635 | <filename>test/com/facebook/buck/parser/testdata/disable_implicit_native_rules/skylark/implicit_in_extension_bzl/extension.bzl
""" Example module """
def java_maker(*args, **kwargs):
""" Make you a java """
java_library(*args, **kwargs)
|
thriftpy2/contrib/aio/transport/framed.py | JonnoFTW/thriftpy2 | 5,079 | 27644 | <filename>thriftpy2/contrib/aio/transport/framed.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import struct
import asyncio
from io import BytesIO
from .base import TAsyncTransportBase, readall
from .buffered import TAsyncBufferedTransport
class TAsyncFramedTransport(TAsyncTransportBase):
"... |
upper_print.py | DazEB2/SimplePyScripts | 117 | 27657 | <reponame>DazEB2/SimplePyScripts<gh_stars>100-1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
def upper_print(f):
def wrapper(*args, **kwargs):
f(*[i.upper() if hasattr(i, 'upper') else i for i in args], **kwargs)
return wrapper
if __name__ == '__main__':
text = 'hel... |
AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_ttk_textonly.py | CEOALT1/RefindPlusUDK | 2,757 | 27659 | import os
from test import test_support
# Skip this test if _tkinter does not exist.
test_support.import_module('_tkinter')
this_dir = os.path.dirname(os.path.abspath(__file__))
lib_tk_test = os.path.abspath(os.path.join(this_dir, '..', 'lib-tk', 'test'))
with test_support.DirsOnSysPath(lib_tk_test):
i... |
lbworkflow/tests/purchase/models.py | wearypossum4770/django-lb-workflow | 194 | 27666 | from django.db import models
from lbworkflow.models import BaseWFObj
class Purchase(BaseWFObj):
title = models.CharField("Title", max_length=255)
reason = models.CharField("Reason", max_length=255)
def __str__(self):
return self.reason
class Item(models.Model):
purchase = models.ForeignKey... |
cube2/server.py | bobssup/kripken | 892 | 27669 | <gh_stars>100-1000
#!/usr/bin/env python
'''
Sets up websocket server support to run the server in one HTML page and the client in another HTML page. Each connects to a websocket server, which we relay together, so the two pages think they are connected to each other (see websocket_bi tests in emscripten).
Instructio... |
src/spaczz/regex/__init__.py | brunobg/spaczz | 153 | 27682 | <reponame>brunobg/spaczz
"""Module for regex components."""
from .regexconfig import RegexConfig
__all__ = ["RegexConfig"]
|
imagetagger/imagetagger/annotations/migrations/0006_auto_20170826_1431.py | jbargu/imagetagger | 212 | 27683 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-26 12:31
from __future__ import unicode_literals
import json
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('annotations', '0005_auto_20170826_1424'),
... |
asn1tools/version.py | eerimoq/asn1tools | 198 | 27689 | __version__ = '0.159.0'
|
tests/integration/boxscore/test_ncaab_boxscore.py | MArtinherz/sportsipy | 221 | 27694 | <reponame>MArtinherz/sportsipy<filename>tests/integration/boxscore/test_ncaab_boxscore.py<gh_stars>100-1000
import mock
import os
import pandas as pd
from datetime import datetime
from flexmock import flexmock
from sportsipy import utils
from sportsipy.constants import HOME
from sportsipy.ncaab.constants import BOXSCOR... |
image-generation/variational-auto-encoder/vq-vae/models/vq_vae.py | AaratiAkkapeddi/nnabla-examples | 228 | 27721 | # Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... |
magma/backend/coreir/coreir_transformer.py | leonardt/magma | 167 | 27723 | <gh_stars>100-1000
from abc import ABC, abstractmethod
from copy import copy
import json
import logging
import os
import coreir as pycoreir
from magma.digital import Digital
from magma.array import Array
from magma.bits import Bits
from magma.backend.check_wiring_context import check_wiring_context
from magma.backend... |
test/connector/exchange/altmarkets/test_altmarkets_user_stream_tracker.py | BGTCapital/hummingbot | 542 | 27726 | <gh_stars>100-1000
#!/usr/bin/env python
import sys
import asyncio
import logging
import unittest
import conf
from os.path import join, realpath
from hummingbot.connector.exchange.altmarkets.altmarkets_user_stream_tracker import AltmarketsUserStreamTracker
from hummingbot.connector.exchange.altmarkets.altmarkets_auth... |
catalyst/core/misc.py | tadejsv/catalyst | 206 | 27738 | from typing import Dict, List, Tuple, Union
from collections import OrderedDict
from functools import lru_cache
import warnings
from torch.utils.data import BatchSampler, DataLoader
from catalyst.core.callback import (
Callback,
CallbackWrapper,
IBackwardCallback,
ICriterionCallback,
IOptimizerCal... |
practice/bitwise_operations/ex2.py | recursivelycurious/wordnik-repl | 346 | 27764 | <reponame>recursivelycurious/wordnik-repl
print 0b1, #1
print 0b10, #2
print 0b11, #3
print 0b100, #4
print 0b101, #5
print 0b110, #6
print 0b111 #7
print "******"
print 0b1 + 0b11
print 0b11 * 0b11
|
learning_algorithm/neural_network.py | Bermuhz/DataMiningCompetitionFirstPrize | 128 | 27773 | <reponame>Bermuhz/DataMiningCompetitionFirstPrize
from sklearn.neural_network import MLPClassifier
from commons import variables
from commons import tools
from scipy.stats import mode
def learn(x, y, test_x):
(temp_x, temp_y) = tools.simple_negative_sample(x, y, variables.select_rate_nn)
clf = MLPClassifier(... |
top_players.py | ergest/Fantasy-Premier-League | 1,011 | 27794 | <gh_stars>1000+
from getters import *
from parsers import *
def main():
data = get_data()
parse_top_players(data, 'data/2020-21')
if __name__ == '__main__':
main()
|
ch10-unsupervised/clustering/spectral_clustering/tests/test_spectral_embedding_.py | skforest/intro_ds | 314 | 27796 | # -*- coding: UTF-8 -*-
import numpy as np
from numpy.testing import assert_array_almost_equal
from spectral_clustering.spectral_embedding_ import spectral_embedding
def assert_first_col_equal(maps):
constant_vec = [1] * maps.shape[0]
assert_array_almost_equal(maps[:, 0] / maps[0, 0], constant_vec)
def test... |
GPLT_Python/L1-003.py | upupming/algorithm | 107 | 27803 | <gh_stars>100-1000
a = str(input())
b = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for i in a:
b[i] = b[i] + 1
for i in range(len(b)):
if b[str(i)] == 0:
continue
print(str(i) + ':' + str(b[str(i)]))
|
cubes/query/__init__.py | digitalsatori/cubes | 1,020 | 27807 | from .browser import *
from .cells import *
from .computation import *
from .statutils import *
|
pymoo/operators/mutation/nom.py | jarreguit/pymoo | 762 | 27808 | <filename>pymoo/operators/mutation/nom.py
from pymoo.core.mutation import Mutation
class NoMutation(Mutation):
def _do(self, problem, X, **kwargs):
return X
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.