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
src/app/test/api/http/unit/handlers/v1/job_test.py
jlrpnbbngtn/beer-garden
230
11094365
<gh_stars>100-1000 # -*- coding: utf-8 -*- import copy import json import unittest from datetime import datetime from mock import patch from beer_garden.db.mongo.models import DateTrigger, Job, RequestTemplate from .. import TestHandlerBase @unittest.skip("TODO") class JobAPITest(TestHandlerBase): def setUp(se...
tests/transforms/test_collate.py
siahuat0727/torchio
1,340
11094373
from torch.utils.data import DataLoader import torchio as tio from ..utils import TorchioTestCase class TestCollate(TorchioTestCase): def get_heterogeneous_dataset(self): # Keys missing in one of the samples will not be present in the batch # This is relevant for the case in which a transform is ...
octopus/engine/helper.py
SillyTin/octopus
212
11094389
<reponame>SillyTin/octopus #from .constants import TT256, TT255 import re from z3 import * TT256 = 2 ** 256 TT256M1 = 2 ** 256 - 1 TT255 = 2 ** 255 class helper(object): def is_symbolic(value): return not isinstance(value, int) def is_real(value): return isinstance(value, int) def isA...
examples/python/setup.py
C-NERD/nimview
103
11094414
<reponame>C-NERD/nimview<filename>examples/python/setup.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # python setup.py sdist from setuptools import setup, Extension from setuptools.command.build_ext import build_ext from subprocess import check_call import os from shutil import copy, rmtree this_directory = os.p...
tests/CLI/modules/vs/vs_placement_tests.py
dvzrv/softlayer-python
126
11094422
<gh_stars>100-1000 """ SoftLayer.tests.CLI.modules.vs_placement_tests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :license: MIT, see LICENSE for more details. """ from unittest import mock as mock from SoftLayer import testing class VSPlacementTests(testing.TestCase): def test_create_options(self): ...
142_HITNET/test.py
IgiArdiyanto/PINTO_model_zoo
1,529
11094427
import warnings import os os.environ['TF_CPP_MIN_LOG_LEVEL']='3' warnings.simplefilter(action='ignore', category=FutureWarning) warnings.simplefilter(action='ignore', category=Warning) import tensorflow as tf import numpy as np from pprint import pprint import time import platform H=256 W=256 THREADS=4 # MODEL='flyi...
neurogym/envs/contrib/cv_learning.py
ruyuanzhang/neurogym
112
11094432
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import numpy as np from gym import spaces import neurogym as ngym import matplotlib.pyplot as plt class CVLearning(ngym.TrialEnv): r"""Implements shaping for the delay-response task, in which agents have to integrate two stimuli and report which one is larger on...
pyq/astmatch.py
mindriot101/pyq
144
11094450
from sizzle.match import MatchEngine import ast import astor class ASTMatchEngine(MatchEngine): def __init__(self): super(ASTMatchEngine, self).__init__() self.register_pseudo('extends', self.pseudo_extends) def match(self, selector, filename): module = astor.parsefile(filename) ...
tracking/eval/formatchecker.py
holajoa/keras-YOLOv3-model-set
601
11094464
<gh_stars>100-1000 #! /usr/bin/env python3 # -*- coding: utf-8 -*- from utilities import write_stderr_red class FormatChecker: def __init__(self, groundtruth, hypotheses): """Constructor """ self.groundtruth_ = groundtruth self.hypotheses_ = hypotheses def checkForAmbiguousIDs(self)...
tests/test_globals.py
hacs/integration
2,039
11094522
<gh_stars>1000+ """Test globals.""" # pylint: disable=missing-docstring def test_global_hacs(hacs): assert hacs.core.lovelace_mode == "yaml" hacs.core.lovelace_mode = "storage" assert hacs.core.lovelace_mode == "storage"
slashtags/mixins/__init__.py
Onii-Chan-Discord/phen-cogs
105
11094546
<reponame>Onii-Chan-Discord/phen-cogs<gh_stars>100-1000 from .commands import Commands # noqa from .processor import Processor # noqa
etl/parsers/etw/Microsoft_Windows_L2NACP.py
IMULMUL/etl-parser
104
11094548
<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Microsoft-Windows-L2NACP GUID : 85fe7609-ff4a-48e9-9d50-12918e43e1da """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp impor...
atcoder/abc068/b.py
Ashindustry007/competitive-programming
506
11094560
<gh_stars>100-1000 #!/usr/bin/env python3 # https://abc068.contest.atcoder.jp/tasks/abc068_b n = int(input()) k = 1 while k * 2 <= n: k *= 2 print(k)
examples/generation/docking_generation/guacamol_tdc/guacamol_baselines/smiles_lstm_ppo/running_reward.py
Shicheng-Guo/TDC
577
11094561
class RunningReward(object): def __init__(self, keep_factor: float, initial_value=0) -> None: """ Args: keep_factor: How much of the last value to keep when a new one is added. initial_value: Initial reward """ assert keep_factor >= 0.0 assert keep_fac...
Scripted/attic/PicasaSnap/gdata/calendar/client.py
hung-lab/SlicerCIP
267
11094584
#!/usr/bin/python # # Copyright (C) 2011 Google 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 ...
src/ssort/__init__.py
bwhmather/ssort
238
11094597
<reponame>bwhmather/ssort """ The python source code statement sorter. """ from ssort._exceptions import ResolutionError from ssort._ssort import ssort # Let linting tools know that we mean to re-export ResolutionError. assert ResolutionError is not None __version__ = "0.9.0" __all__ = ["ssort"]
koku/api/resource_types/test/openshift_projects/test_views.py
rubik-ai/koku
157
11094608
# # Copyright 2021 Red Hat Inc. # SPDX-License-Identifier: Apache-2.0 # """Test the Resource Types views.""" from django.db.models import F from django.urls import reverse from rest_framework import status from rest_framework.test import APIClient from tenant_schemas.utils import schema_context from api.iam.test.iam_t...
bgp-add-fake-routes.py
9l/scapy
129
11094616
<reponame>9l/scapy #!/usr/bin/env python3 #Import time so we can set a sleep timer import time #Import scapy from scapy.all import * #Import BGP load_contrib('bgp') #Capture a BGP packet off the wire #You will need to change the IP address here to a valid #BGP neighbor to impersonate pkt = sniff(filter="tcp and ip dst ...
rotkehlchen/api/websockets/notifier.py
rotkehlchenio/rotkehlchen
137
11094656
<gh_stars>100-1000 import json import logging from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional from geventwebsocket import WebSocketApplication from geventwebsocket.exceptions import WebSocketError from geventwebsocket.websocket import WebSocket from rotkehlchen.greenlets import GreenletManager f...
tools/Polygraphy/polygraphy/exception/__init__.py
KaliberAI/TensorRT
5,249
11094676
<reponame>KaliberAI/TensorRT<filename>tools/Polygraphy/polygraphy/exception/__init__.py<gh_stars>1000+ from polygraphy.exception.exception import *
nipio_tests/backend_test.py
onlyrico/nip.io
648
11094677
<reponame>onlyrico/nip.io<filename>nipio_tests/backend_test.py # Copyright 2019 Exentrique Solutions Ltd # # 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/LI...
turla/carbon_tool.py
macdaliot/malware-ioc
1,141
11094691
#!/usr/bin/env python2 # Copyright (c) 2017, ESET # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of cond...
tests/micropython/heapalloc.py
braytac/micropython
303
11094708
# check that we can do certain things without allocating heap memory import gc def f1(a): print(a) def f2(a, b=2): print(a, b) def f3(a, b, c, d): x1 = x2 = a x3 = x4 = b x5 = x6 = c x7 = x8 = d print(x1, x3, x5, x7, x2 + x4 + x6 + x8) global_var = 1 def test(): global global_var ...
app/modules/teams/parameters.py
IsmaelJS/test-github-actions
1,420
11094712
<reponame>IsmaelJS/test-github-actions # encoding: utf-8 """ Input arguments (Parameters) for Team resources RESTful API ----------------------------------------------------------- """ from flask_marshmallow import base_fields from flask_restplus_patched import PostFormParameters, PatchJSONParameters from . import sc...
theme/management/commands/report_quota_inconsistency.py
hydroshare/hydroshare
178
11094722
import csv import math from django.core.management.base import BaseCommand from django.core.exceptions import ValidationError from hs_core.hydroshare import convert_file_size_to_unit from theme.models import UserQuota from hs_core.hydroshare.resource import get_quota_usage_from_irods class Command(BaseCommand): ...
pysmi/borrower/pyfile.py
itsmehara/pysmi
121
11094738
# # This file is part of pysmi software. # # Copyright (c) 2015-2020, <NAME> <<EMAIL>> # License: http://snmplabs.com/pysmi/license.html # try: import importlib try: SOURCE_SUFFIXES = importlib.machinery.SOURCE_SUFFIXES except Exception: raise ImportError() except ImportError: import ...
execution_trace/tests/functions/f_try_ok.py
yoyonel/python-execution-trace
197
11094741
<reponame>yoyonel/python-execution-trace from execution_trace.record import record @record(10) # 1 def f(): # 2 """Fn with a try that does not raise.""" # 3 x = 3 # 4 try: # 5 x = x + 1 # 6 except: # 7 y = 2 # 8 args = () expected_trace = [{u'data': [{u'lineno': 3, u'state': ...
feapder/templates/project_template/main.py
RuixiangS/feapder
876
11094764
<filename>feapder/templates/project_template/main.py<gh_stars>100-1000 # -*- coding: utf-8 -*- """ Created on {DATE} --------- @summary: 爬虫入口 --------- @author: {USER} """ from feapder import ArgumentParser from spiders import * def crawl_xxx(): """ AirSpider爬虫 """ spider = xxx.XXXSpider() spider...
tests/functional/kvpy/sfx_test_tomb.py
efeslab/hse
558
11094769
<reponame>efeslab/hse<filename>tests/functional/kvpy/sfx_test_tomb.py #!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 # # Copyright (C) 2021 Micron Technology, Inc. All rights reserved. from contextlib import ExitStack from hse2 import hse from utility import lifecycle, cli hse.init(cli.CONFIG) try: ...
test/files/exprs_optics_out1.py
symbiont-sam-halliday/hpython
160
11094786
for a_, b_ in c_: a_ += 1 b_ += 2
phobos/io/libraries/__init__.py
hawkina/phobos
323
11094796
#!/usr/bin/python3 # coding=utf-8 # ------------------------------------------------------------------------------- # This file is part of Phobos, a Blender Add-On to edit robot models. # Copyright (C) 2020 University of Bremen & DFKI GmbH Robotics Innovation Center # # You should have received a copy of the 3-Clause ...
small_text/utils/datetime.py
chschroeder/small-text
218
11094830
def format_timedelta(td): if td.days < 0: raise ValueError('timedelta must be positive') hours, sec = divmod(td.seconds, 3600) mins, sec = divmod(sec, 60) return f'{hours:02}:{mins:02}:{sec:02}'
tests/apps/good_flow_app/migrations/0024_add_index_with_condition.py
15five/django-pg-zero-downtime-migrations
376
11094849
# Generated by Django 3.1 on 2019-09-22 20:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('good_flow_app', '0023_drop_index'), ] operations = [ migrations.AddIndex( model_name='testtable', index=models.Index( ...
pywick/transforms/image_transforms.py
achaiah/pywick
408
11094904
<filename>pywick/transforms/image_transforms.py """ Transforms very specific to images such as color, lighting, contrast, brightness, etc transforms NOTE: Most of these transforms assume your image intensity is between 0 and 1, and are torch tensors (NOT numpy or PIL) """ import random import torch as th from torch...
solutions/python/largest-continuous-sum.py
lhayhurst/interview-with-python
201
11094907
"""solution to the largest-continuous-sum problem""" import unittest from functools import reduce def largest_continuous_sum_one(arr): """ returns the largest continous sub sequence in the given list of numbers. """ largest = 0 queue = [] for num in arr: queue.append(num) if len(queue) ...
application/device/smartindustry/motor.py
jason-fox/fogflow
102
11094919
#!/usr/bin/env python import time import os import signal import sys import json import requests from flask import Flask, jsonify, abort, request, make_response from threading import Thread, Lock import logging import nxt app = Flask(__name__, static_url_path = "") discoveryURL = 'http://192.168.1.80:8070/ngsi9' bro...
python/mixed/x86_lstm_demo/data_reader.py
PaddlePaddle/Paddle-Inference-demo
115
11094923
import numpy as np import struct from paddle import fluid def get_data(data_path, place): inputs = [] labels = [] with open(data_path, 'rb') as in_f: while True: plen = in_f.read(4) if plen is None or len(plen) != 4: break alllen = struct.unpack(...
tests/test_scripts.py
vincentfretin/kinto
4,618
11094928
<filename>tests/test_scripts.py import unittest from unittest import mock from kinto import scripts class RebuildQuotasTest(unittest.TestCase): def setUp(self): self.registry = mock.MagicMock() self.registry.settings = {"includes": "kinto.plugins.quotas"} def test_rebuild_quotas_in_read_only...
dataset.py
amorgun/pose-with-style
168
11094962
<reponame>amorgun/pose-with-style<gh_stars>100-1000 from PIL import Image from torch.utils.data import Dataset import torchvision.transforms as transforms import os import pandas as pd import numpy as np import torch import random import pickle class DeepFashionDataset(Dataset): def __init__(self, path, phase, si...
python2/pracmln/mln/inference/__init__.py
seba90/pracmln
123
11094969
<filename>python2/pracmln/mln/inference/__init__.py from exact import EnumerationAsk from mcsat import MCSAT, SampleSAT from gibbs import GibbsSampler # from ipfpm import IPFPM from maxwalk import SAMaxWalkSAT from wcspinfer import WCSPInference from infer import Inference
mpf/tests/test_Playfield.py
Scottacus64/mpf
163
11094970
from mpf.tests.MpfTestCase import MpfTestCase class TestPlayfield(MpfTestCase): def get_config_file(self): return 'test_playfield.yaml' def get_machine_path(self): return 'tests/machine_files/playfield/' # nothing to test currently
leetcode.com/python/946_Validate_Stack_Sequences.py
vansh-tiwari/coding-interview-gym
713
11094988
<reponame>vansh-tiwari/coding-interview-gym<filename>leetcode.com/python/946_Validate_Stack_Sequences.py<gh_stars>100-1000 # Time and space both O(n) class Solution(object): def validateStackSequences(self, pushed, popped): """ :type pushed: List[int] :type popped: List[int] :rtype: ...
hypergan/train_hooks/needs_pytorch/learning_rate_dropout_train_hook.py
limberc/HyperGAN
889
11094995
from __future__ import absolute_import from __future__ import division from __future__ import print_function from hypergan.train_hooks.base_train_hook import BaseTrainHook from operator import itemgetter from tensorflow.python.framework import ops from tensorflow.python.ops import control_flow_ops from tensorflow.pytho...
Packs/XSOARContentUpdateNotifications/Scripts/ListInstalledContentPacks/ListInstalledContentPacks.py
diCagri/content
799
11095023
import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 args = demisto.args() updated = True if args.get('updates') == 'true' else False packs = demisto.executeCommand("demisto-api-get", {"uri": "/contentpacks/installed-expired"})[0]['Contents'].get('response') parsed_packs = [{ ...
examples/independent_marl.py
apexrl/malib
258
11095024
<filename>examples/independent_marl.py<gh_stars>100-1000 # """ # Implementation of independent learning applied to MARL cases. # """ # import argparse # from malib.envs.mpe.env import MPE # from malib.runner import run # parser = argparse.ArgumentParser( # "Independent multi-agent learning on mpe environments." ...
tests/utils/test_shell.py
tomekr/cement
826
11095039
import time import mock from pytest import raises from cement.utils import shell from cement.core.exc import FrameworkError INPUT = 'builtins.input' def add(a, b): return a + b def test_cmd(): out, err, ret = shell.cmd('echo KAPLA!') assert ret == 0 assert out == b'KAPLA!\n' ret = shell.cmd(...
code/quaternions/blender_camera_quaternions.py
ricklentz/2dimageto3dmodel
150
11095040
""" author: <NAME> """ from math import sqrt, pow, acos, pi, asin from scipy.spatial.transform import Rotation as R import numpy as np import torch def scale_to_n(axis, n): return axis / n def blender_camera_position_to_torch_tensor_quaternion(blender_camera_info): x, y, z = blender_camera_info[0] # ...
course/migrations/0007_add_participation_preapproval.py
inducer/courseflow
284
11095090
<reponame>inducer/courseflow from django.db import models, migrations import django.utils.timezone from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('course', '0006_flowpagevisit_remote_address'), ...
source/mitparallel/util.py
jaesikchoi/gpss-research
151
11095091
<reponame>jaesikchoi/gpss-research import config import os import tempfile def mkstemp_safe(directory, suffix): (os_file_handle, file_name) = tempfile.mkstemp(dir=directory, suffix=suffix) os.close(os_file_handle) return file_name def create_temp_file(extension): return mkstemp_safe(config.TEMP_PATH, ...
hyperglass/external/bgptools.py
blkmajik/hyperglass
298
11095123
"""Query & parse data from bgp.tools. - See https://bgp.tools/credits for acknowledgements and licensing. - See https://bgp.tools/kb/api for query documentation. """ # Standard Library import re import socket import asyncio from typing import Dict, List # Project from hyperglass.log import log from hyperglass.cache ...
testing/cookbook/table_query_result_mapper.py
kstepanmpmg/mldb
665
11095148
# # table_query_result_mapper.py # Mich, 2016-01-13 # Copyright (c) 2016 mldb.ai inc. All rights reserved. # # MLDB doesn't guarantee column ordering of SQL queries will match the ordering # of the result. Here is a column mapper example to work around that. # from mldb import mldb class TableQueryResultMapper(object)...
terrascript/data/external.py
mjuenema/python-terrascript
507
11095153
<gh_stars>100-1000 # terrascript/data/external.py # Automatically generated by tools/makecode.py (24-Sep-2021 15:16:09 UTC) # # For imports without namespace, e.g. # # >>> import terrascript.data.external # # instead of # # >>> import terrascript.data.hashicorp.external # # This is only available for 'official' and...
imagetagger/imagetagger/administration/views.py
jbargu/imagetagger
212
11095166
from django.shortcuts import render, get_object_or_404, redirect from django.urls import reverse from django.utils.translation import ugettext_lazy as _ from django.contrib.admin.views.decorators import staff_member_required from django.contrib import messages from django.db import transaction from .forms import Annot...
src/genie/libs/parser/ios/show_service.py
nujo/genieparser
204
11095184
<filename>src/genie/libs/parser/ios/show_service.py<gh_stars>100-1000 '''show_service.py IOS parser for the following show command * show service-group state * show service-group stats ''' # import iosxe parser from genie.libs.parser.iosxe.show_service import \ ShowServiceGroupState as ShowServiceGroupState_iosx...
tools/site_compare/scrapers/__init__.py
zealoussnow/chromium
14,668
11095249
#!/usr/bin/env python # Copyright (c) 2011 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. """Selects the appropriate scraper for a given browser and version.""" from __future__ import print_function import types # TODO...
alipay/aop/api/response/AlipayCommerceDataScenicMappingQueryResponse.py
antopen/alipay-sdk-python-all
213
11095273
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.ScenicAuditResponse import ScenicAuditResponse class AlipayCommerceDataScenicMappingQueryResponse(AlipayResponse): def __init__(self): super(AlipayCommer...
inflate/pack_exe.py
bocke/Amiga-Stuff
153
11095283
<filename>inflate/pack_exe.py # pack_exe.py # # Convert an Amiga load file into a self-unpacking executable. # # Written & released by <NAME> <<EMAIL>> # # This is free and unencumbered software released into the public domain. # See the file COPYING for more details, or visit <http://unlicense.org>. import crcmod....
genrate_fragments/step1_clean_triple.py
YangLingWHU/gAnswer
328
11095287
import re ''' Step 1: Clean the triple file. In the dbpedia case, we just need the part of resource URI that indicate entity/type/predicate names. ''' fileName = []#List of triple files to be process notRdf = open('./notRdf.txt','w')#Record the lines that refers to a type but not rdf:type for index2,fname in en...
tests/types/test_geometry.py
peterandluc/PyHDB
332
11095302
<gh_stars>100-1000 from io import BytesIO import random # import pytest from pyhdb.protocol import types # ########################## Test value unpacking ##################################### @pytest.mark.parametrize("given,expected", [ (b"\xFF", None), (b"\x2d\x50\x4f\x49\x4e\x54\x20\x28\x31\x2e\x30\x30\x30...
visualization/view_scene.py
PratyushaMaiti/gtsfm
122
11095303
<reponame>PratyushaMaiti/gtsfm<filename>visualization/view_scene.py<gh_stars>100-1000 """ Script to render a GTSFM scene using either Open3d or Mayavi mlab. Authors: <NAME> """ import argparse import os from pathlib import Path import numpy as np from gtsam import Rot3, Pose3 import gtsfm.utils.io as io_utils #fro...
h2o-docs/src/booklets/v2_2015/source/GLM_Vignette_code_examples/glm_gamma_example.py
ahmedengu/h2o-3
6,098
11095340
import h2o from h2o.estimators.glm import H2OGeneralizedLinearEstimator h2o.init() h2o_df = h2o.import_file("http://h2o-public-test-data.s3.amazonaws.com/smalldata/prostate/prostate.csv") gamma_inverse = H2OGeneralizedLinearEstimator(family = "gamma", link = "inverse") gamma_inverse.train(y = "DPROS", x = ["AGE","RACE"...
jedi/api/errors.py
mrclary/jedi
641
11095366
""" This file is about errors in Python files and not about exception handling in Jedi. """ def parso_to_jedi_errors(grammar, module_node): return [SyntaxError(e) for e in grammar.iter_errors(module_node)] class SyntaxError(object): """ Syntax errors are generated by :meth:`.Script.get_syntax_errors`. ...
pytorch-DRIT-PONO-MS/src/dataset.py
Boyiliee/PONO
133
11095398
<filename>pytorch-DRIT-PONO-MS/src/dataset.py import os import torch.utils.data as data from PIL import Image from torchvision.transforms import Compose, Resize, RandomCrop, CenterCrop, RandomHorizontalFlip, ToTensor, Normalize import random class dataset_single(data.Dataset): def __init__(self, opts, setname, input...
test/phonon/test_band_structure.py
ladyteam/phonopy
127
11095442
"""Tests for band structure calculation.""" from phonopy.phonon.band_structure import get_band_qpoints def test_band_structure(ph_nacl): """Test band structure calculation by NaCl.""" ph_nacl.run_band_structure( _get_band_qpoints(), with_group_velocities=False, is_band_connection=False ) ph_na...
couler/tests/daemon_step_test.py
javoweb/couler
700
11095462
<reponame>javoweb/couler # Copyright 2021 The Couler 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 requ...
gslib/tests/test_cloud_api_delegator.py
stanhu/gsutil
649
11095475
# -*- coding: utf-8 -*- # Copyright 2020 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
machina/apps/forum/migrations/0001_initial.py
OneRainbowDev/django-machina
572
11095485
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations import mptt.fields import machina.models.fields class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Forum', fields=...
tests/input/portugal/test.py
jacobwhall/panflute
361
11095494
import panflute as pf input_fn = 'benchmark.json' output_fn = 'panflute.json' def empty_test(element, doc): return def test_filter(element, doc): if type(element)==pf.Header: return [] if type(element)==pf.Str: element.text = element.text + '!!' return element print('\nLoading ...
tests/test_optimizers.py
JohnDenis/keras-radam
357
11095513
<filename>tests/test_optimizers.py import os import tempfile from unittest import TestCase import numpy as np from keras_radam.backend import keras from keras_radam import RAdam class TestRAdam(TestCase): @staticmethod def gen_linear_model(optimizer) -> keras.models.Model: model = keras.models.Sequ...
docs/codesnippets/194_top_x_of_user.py
rm1410/instaloader
4,170
11095533
<filename>docs/codesnippets/194_top_x_of_user.py from itertools import islice from math import ceil from instaloader import Instaloader, Profile PROFILE = ... # profile to download from X_percentage = 10 # percentage of posts that should be downloaded L = Instaloader() profile = Profile.from_username(L.co...
CircleciScripts/copy_resourcefiles.py
leaksentinel/aws-sdk-ios
1,026
11095553
<gh_stars>1000+ import os import sys from shutil import copyfile from functions import log, run_command root = sys.argv[1] dest = sys.argv[2] files = { "LICENSE": "LICENSE", "LICENSE.APACHE": "LICENSE.APACHE", "NOTICE": "NOTICE", "README.md": "README.md", "CircleciScripts/src/README.html": "src/so...
others/TestMdiArea/HomeWindow.py
sesu089/stackoverflow
302
11095559
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'HomeWindow.ui' # # Created by: PyQt5 UI code generator 5.8.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_HomeWindow(object): def setupUi(self, MainWindow): ...
tests/test_create.py
RemiRigal/jsonpath-ng
339
11095570
import doctest from collections import namedtuple import pytest import jsonpath_ng from jsonpath_ng.ext import parse Params = namedtuple('Params', 'string initial_data insert_val target') @pytest.mark.parametrize('string, initial_data, insert_val, target', [ Params(string='$.foo', initial_data={}, ...
quokka/core/content/utils.py
songshansitulv/quokka
1,141
11095580
from quokka.utils.text import slugify_category, slugify from flask import current_app as app def url_for_content(content, include_ext=True): """Return a relative URL for content dict or Content model """ if not isinstance(content, dict): data = content.data else: data = content ca...
third_party/Paste/paste/progress.py
tingshao/catapult
5,079
11095592
<filename>third_party/Paste/paste/progress.py # (c) 2005 <NAME> and contributors; written for Paste (http://pythonpaste.org) # Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php # (c) 2005 <NAME> # This module is part of the Python Paste Project and is released under # the MIT License: h...
tests/syntax/test_imports.py
abol-karimi/Scenic
141
11095596
<filename>tests/syntax/test_imports.py """Tests for imports of Scenic modules. Note that this is different from modular scenarios defined using the 'scenario' statement. This file simply tests imports of old-style Scenic modules; the new system of modular scenarios is tested in 'test_modular.py'. """ import os.path i...
recommender/datasets/movielens.py
yugandharaloori/Recommender-Systems-Comparison
136
11095607
<filename>recommender/datasets/movielens.py from io import BytesIO import numpy as np import pandas as pd try: from pandas.io.common import ZipFile except ImportError: from zipfile import ZipFile def get_movielens_data(local_file=None, get_ratings=True, get_genres=False, split_genres=T...
scrapera/text/tests/medium_test.py
Baras64/Scrapera
300
11095620
from scrapera.text.medium import MediumScraper scraper = MediumScraper() scraper.scrape(topic="artificial-intelligence", n_posts=2)
recipes/Python/520585_VectorObject/recipe-520585.py
tdiprima/code
2,023
11095627
#a class used for creating any object moving in 2D or a Vector Object (VObject) #for direction use degrees, think of a 2d environment like: # # 90 # | # | # 180 ----+----- 0 # | # | # 270 # from math imp...
samcli/commands/_utils/option_value_processor.py
michaelbrewer/aws-sam-cli
2,959
11095640
<filename>samcli/commands/_utils/option_value_processor.py """ Parsing utilities commonly used to process information for commands """ import logging from typing import Optional, Dict, Tuple from samcli.commands.exceptions import InvalidImageException LOG = logging.getLogger(__name__) def process_env_var(container_...
T-RNN/Experiment_MNIST.py
ericzy89/DEEPEYE
106
11095682
__author__ = "<NAME>" __copyright__ = "Siemens AG, 2017" __licencse__ = "MIT" __version__ = "0.1" """ MIT License Copyright (c) 2017 Siemens AG 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 wi...
examples/008_sklearn.py
szghlm/smote_variants
271
11095692
<gh_stars>100-1000 # coding: utf-8 # # Integration with sklearn pipelines # # In this notebook, provide some illustration for integration with sklearn pipelines. # In[1]: import keras import imblearn import numpy as np import smote_variants as sv import imblearn.datasets as imb_datasets from sklearn.model_sele...
Beginers/stdlib/theCEOspeech/solution.py
arunkgupta/PythonTrainingExercises
150
11095694
"""Your job is to write a speech for your CEO. You have a list of meaningful phrases that he is fond of such as "knowledge optimization initiatives" and your task is to weave them in to a speech. You also have the opening words "Our clear strategic direction is to invoke..." and some useful joining phrases such as "wh...
etl/parsers/etw/Microsoft_Windows_MediaFoundation_Performance.py
IMULMUL/etl-parser
104
11095728
# -*- coding: utf-8 -*- """ Microsoft-Windows-MediaFoundation-Performance GUID : f404b94e-27e0-4384-bfe8-1d8d390b0aa3 """ from construct import Int8sl, Int8ul, Int16ul, Int16sl, Int32sl, Int32ul, Int64sl, Int64ul, Bytes, Double, Float32l, Struct from etl.utils import WString, CString, SystemTime, Guid from etl.dtyp imp...
util/patch/aslr.py
EarthCompass/patchkit
631
11095737
<reponame>EarthCompass/patchkit import random from collections import defaultdict from util.patch.dis import irdis, IR def aslr(pt, count=3): funcs = {} saved = [] holes = [] pos = pt.binary.next_alloc() for func in pt.funcs(): if func.size < 5: continue ir = irdis(fu...
DQMOffline/Trigger/python/susyHLTEleCaloJetsClient_cfi.py
ckamtsikis/cmssw
852
11095755
import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDHarvester import DQMEDHarvester susyHLTEleCaloJetsClient = DQMEDHarvester("DQMGenericClient", subDirs = cms.untracked.vstring( 'HLT/SUSY/Ele8CaloJet30/*', 'HLT/SUSY/Ele8CaloIdMJet30/*', 'HLT/SUSY/Ele12CaloJet30/*', ...
hwt/pyUtils/testUtils.py
ufo2011/hwt
134
11095763
from itertools import product class TestMatrix(): """ Class which instance is a decorator which executes unittest.TestCase test method with every combination of argumets """ def __init__(self, *args, **kwargs): """ :note: args, kwargs are lists of arguments which should be passed ...
robot-server/tests/test_app.py
anuwrag/opentrons
235
11095791
<reponame>anuwrag/opentrons """Tests for FastAPI application object of the robot server.""" import pytest from mock import MagicMock, patch from fastapi import status from fastapi.testclient import TestClient from typing import Iterator from robot_server.versioning import API_VERSION_HEADER, API_VERSION @pytest.fixt...
tracardi/process_engine/action/v1/connectors/mongo/query/plugin.py
Tracardi/tracardi
153
11095793
<gh_stars>100-1000 import json from json import JSONDecodeError from tracardi.domain.resource import ResourceCredentials from tracardi.domain.resource_config import ResourceConfig from tracardi.service.plugin.plugin_endpoint import PluginEndpoint from tracardi.service.storage.driver import storage from tracardi.servic...
tests/blocks/signal/pulseamplitudemodulator_spec.py
grascher-oe8agk/luaradio
559
11095807
<reponame>grascher-oe8agk/luaradio import math import numpy from generate import * def generate(): def process(symbol_rate, sample_rate, levels, amplitudes, msb_first, x): symbol_period = int(sample_rate / symbol_rate) symbol_bits = int(math.log2(levels)) if amplitudes is None: ...
redisco/models/modelset.py
iamteem/redisco
110
11095822
""" Handles the queries. """ from attributes import IntegerField, DateTimeField import redisco from redisco.containers import SortedSet, Set, List, NonPersistentList from exceptions import AttributeNotIndexed from utils import _encode_key from attributes import ZINDEXABLE # Model Set class ModelSet(Set): def __ini...
flatdata-py/flatdata/lib/archive_builder.py
heremaps/flatdata
140
11095829
<gh_stars>100-1000 ''' Copyright (c) 2021 HERE Europe B.V. See the LICENSE file in the root of this project for license details. ''' from collections import namedtuple import os from .errors import IndexWriterError, MissingFieldError, UnknownFieldError, \ UnknownStructureError, UnknownResourceError, ResourceAlr...
zapcli/commands/session.py
kiwi-bop/zap-cli
196
11095837
""" Group of commands to manage the sessions. .. moduleauthor:: <NAME> (grunny) """ import os import click from zapcli.exceptions import ZAPError from zapcli.helpers import zap_error_handler from zapcli.log import console @click.group(name='session', short_help='Manage sessions.') @click.pass_context def session_...
cactus/exceptions.py
danielchasehooper/Cactus
1,048
11095910
#coding:utf-8 class InvalidCredentials(Exception): """ Raised when invalid credentials are used to connect. """ pass
dmb/modeling/stereo/disp_refinement/__init__.py
jiaw-z/DenseMatchingBenchmark
160
11095912
<reponame>jiaw-z/DenseMatchingBenchmark from .builder import build_disp_refinement
chapter11-detection/model.py
gabrielmahia/obamAI
1,291
11095916
<gh_stars>1000+ """SSD model builder Utilities for building network layers are also provided """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from tensorflow.keras.layers import Activation, Dense, Input from tensor...
tkinter/label/label-width-font/main.py
whitmans-max/python-examples
140
11095928
<filename>tkinter/label/label-width-font/main.py #If you display text in the label, these options define the size of the label in text units. If you display bitmaps or images instead, they define the size in pixels (or other screen units) import tkinter as tk root = tk.Tk() f = None l1 = tk.Label(root, text='Hello'...
third_party/tests/Opentitan/util/reggen/version.py
parzival3/Surelog
156
11095973
<reponame>parzival3/Surelog<gh_stars>100-1000 # Copyright lowRISC contributors. # Licensed under the Apache License, Version 2.0, see LICENSE for details. # SPDX-License-Identifier: Apache-2.0 r"""Standard version printing """ import os import subprocess import sys import pkg_resources # part of setuptools def show...
my.py
deep-fry/mayo
110
11096003
<reponame>deep-fry/mayo<filename>my.py #!/usr/bin/env python3 import os from importlib.util import spec_from_file_location, module_from_spec root = os.path.dirname(__file__) if root == '.': root = '' path = os.path.join(root, 'mayo', 'cli.py') spec = spec_from_file_location('cli', path) cli = module_from_spec(spe...
examples/showcase/src/demos_panels/absolutePanel.py
takipsizad/pyjs
739
11096018
""" ``ui.AbsolutePanel`` is a panel that positions its children using absolute pixel positions. This allows the panel's children to overlap. Note that the AbsolutePanel does not automatically resize itself to fit its children. There is no straightforward way of doing this unless all the children are explicitly sized...