max_stars_repo_path string | max_stars_repo_name string | max_stars_count int64 | id string | content string | add_param_types int64 | add_return_types int64 | add_class_field_types int64 | add_instance_field_types int64 | add_total int64 | add_error int64 |
|---|---|---|---|---|---|---|---|---|---|---|
tests/unit/integration/test_abort.py | senstb/aws-elastic-beanstalk-cli | 110 | 3246262 | # Copyright 2017 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 "license" file accompa... | 0 | 4 | 0 | 0 | 4 | 0 |
test/testFloatTensor.py | hughperkins/pytorch | 513 | 3246274 | from __future__ import print_function
import PyTorch
from test.test_helpers import myeval, myexec
def test_float_tensor():
PyTorch.manualSeed(123)
print('dir(G)', dir())
print('test_float_tensor')
a = PyTorch.FloatTensor(3, 2)
print('got float a')
myeval('a.dims()')
a.uniform()
myeval(... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/error_correcting_code_demo.py | vipavlovic/pyprobml | 4,895 | 3246313 | <filename>scripts/error_correcting_code_demo.py
# Illustrate parity check code using a directed graphical model
# Authors: murphyk@, Drishtii@
# Based on
#https://github.com/probml/pmtk3/blob/master/demos/errorCorrectingCodeDemo.m
#!pip install pgmpy
import superimport
import pyprobml_utils as pml
import pgmpy_utils ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/clusto/commands/attr.py | thekad/clusto | 216 | 3246351 | #!/usr/bin/env python
# -*- mode: python; sh-basic-offset: 4; indent-tabs-mode: nil; coding: utf-8 -*-
# vim: tabstop=4 softtabstop=4 expandtab shiftwidth=4 fileencoding=utf-8
import sys
import clusto
from clusto import script_helper
import sys
JSON=False
YAML=False
try:
import yaml
YAML=True
except ImportE... | 0 | 0 | 0 | 0 | 0 | 0 |
eos/plugins/info.py | YSaxon/eos | 168 | 3246379 | """Info EOS plugin."""
from re import compile, IGNORECASE
from eos.plugins import AbstractPlugin
class Plugin(AbstractPlugin):
"""
Info EOS plugin.
Populate the Symfony instance with extracted info from the target deployment.
- Symfony version
- PHP version
- Environment (prod, test, dev)
... | 0 | 0 | 2 | 0 | 2 | 0 |
3]. Competitive Programming/08]. LeetCode/1]. Problems/Python/0044)_Wildcard_Matching.py | Utqrsh04/The-Complete-FAANG-Preparation | 6,969 | 3246381 | class Solution:
def isMatch(self, s: str, p: str) -> bool:
sn, pn = len(s), len(p)
si = pi = 0
save_si, save_pi = None, None
while si < sn:
if pi < pn and (p[pi] == '?' or p[pi] == s[si]):
si += 1
pi += 1
elif pi < pn and p[pi] ... | 2 | 1 | 0 | 0 | 3 | 0 |
libs/hwui/tests/scripts/process_systrace.py | rio-31/android_frameworks_base-1 | 164 | 3246407 | #!/usr/bin/env python
import codecs, httplib, json, os, urllib, shutil, subprocess, sys, argparse
upstream_git = 'https://github.com/catapult-project/catapult.git'
script_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
catapult_src_dir = os.path.join(script_dir, 'catapult-upstream')
parser = argparse.ArgumentPa... | 0 | 0 | 0 | 0 | 0 | 0 |
deprecated/software/SLAM/ygz_slam_ros/visualizer_slam_pos.py | mfkiwl/GAAS | 2,111 | 3246417 | import os
import matplotlib.pyplot as plt
import numpy as np
#check_file='without_gps_log.log'
def get_position_by_lines(line):
if line.find('position')>=0:
print line
return map(float,line.split()[-1].split(',')[-4:])
return None
def get_checkfile(check_file_name):
return open(check_file_... | 0 | 0 | 0 | 0 | 0 | 0 |
models/nerf_models.py | icannistraci/nerfmm | 266 | 3246500 | <reponame>icannistraci/nerfmm
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.utils.data
class OfficialNerf(nn.Module):
def __init__(self, pos_in_dims, dir_in_dims, D):
"""
:param pos_in_dims: scalar, number of channels of encoded positions
:param dir_in_dims: scal... | 0 | 0 | 0 | 0 | 0 | 0 |
drf_admin/settings/dev.py | DingGuodong/drf_admin | 228 | 3246505 | """
Django settings for drf_admin project.
Generated by 'django-admin startproject' using Django 2.2.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import date... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/modules/ctypes_config_cache/dumpcache.py | JJTech0130/pypyjs-pwa | 195 | 3246543 | <reponame>JJTech0130/pypyjs-pwa
import sys, os
from ctypes_configure import dumpcache
def dumpcache2(basename, config):
size = 32 if sys.maxint <= 2**32 else 64
filename = '_%s_%s_.py' % (basename, size)
dumpcache.dumpcache(__file__, filename, config)
#
filename = os.path.join(os.path.dirname(__fil... | 0 | 0 | 0 | 0 | 0 | 0 |
1000-1100q/1013.py | rampup01/Leetcode | 990 | 3246561 | <reponame>rampup01/Leetcode
'''
Given an array A of integers, return true if and only if we can partition the array into three non-empty parts with equal sums.
Formally, we can partition the array if we can find indexes i+1 < j with (A[0] + A[1] + ... + A[i] == A[i+1] + A[i+2] + ... + A[j-1] == A[j] + A[j-1] + ... + A... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/image/instance_segmentation/solov2/module.py | chunzhang-hub/PaddleHub | 8,360 | 3246566 | # Copyright (c) 2020 PaddlePaddle 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 appli... | 17 | 5 | 0 | 1 | 23 | 0 |
robogym/envs/dactyl/goals/face_curriculum.py | 0xflotus/robogym | 288 | 3246601 | <reponame>0xflotus/robogym
import typing
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
class FaceCurriculumGoal(GoalGenerator):
""" 'Face curriculum' goal generation. Generate goals that specify a ful... | 0 | 0 | 0 | 0 | 0 | 0 |
juriscraper/opinions/united_states/state/nyappdiv_4th.py | umeboshi2/juriscraper | 228 | 3246620 | # Scraper for New York Appellate Divisions 4th Dept.
# CourtID: nyappdiv_4th
# Court Short Name: NY
from juriscraper.opinions.united_states.state import nyappdiv_1st
class Site(nyappdiv_1st.Site):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.court_id = sel... | 0 | 0 | 0 | 1 | 1 | 0 |
fuzzers/064-gtp-channel-conf/generate.py | marzoul/prjxray | 583 | 3246627 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017-2020 The Project X-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import json
import os
from enum impo... | 0 | 2 | 0 | 0 | 2 | 0 |
dbaas/dbaas_services/analyzing/admin/execution_plan.py | didindinn/database-as-a-service | 303 | 3246630 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django_services import admin
from dbaas_services.analyzing.service import ExecutionPlanService
from dbaas_services.analyzing.forms import ExecutionPlanForm
class ExecutionPlanAdmin(admin.DjangoServicesAdmin):
form = ExecutionPla... | 0 | 0 | 1 | 0 | 1 | 0 |
solutions/LeetCode/Python3/2.py | timxor/leetcode-journal | 854 | 3246650 | __________________________________________________________________________________________________
72ms
× Close
sample 72 ms submission
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def addTwoNumbers(self,... | 0 | 0 | 0 | 0 | 0 | 0 |
peeldb/migrations/0024_auto_20170725_1747.py | sanjay051099/try2- | 199 | 3246656 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-07-25 17:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("peeldb", "0023_qualification_slug"),
]
operations = [
mi... | 0 | 0 | 0 | 0 | 0 | 0 |
lib/mongodb/constants/defaults.py | goztrk/django-htk | 206 | 3246698 | <reponame>goztrk/django-htk<gh_stars>100-1000
HTK_MONGODB_CONNECTION = ''
HTK_MONGODB_NAME = ''
| 0 | 0 | 0 | 0 | 0 | 0 |
pyzoo/test/zoo/models/seq2seq/test_seq2seq.py | abdolence/analytics-zoo | 2,970 | 3246711 | <reponame>abdolence/analytics-zoo<filename>pyzoo/test/zoo/models/seq2seq/test_seq2seq.py
#
# Copyright 2018 Analytics Zoo Authors.
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
pypower/qps_pips.py | Bengt/PYPOWER | 221 | 3246721 | <filename>pypower/qps_pips.py
# Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Uses the Python Interior Point Solver (PIPS) to solve QP (quadratic
programming) problems.
"""
from numpy import Inf, ones, zeros... | 0 | 0 | 0 | 0 | 0 | 0 |
xfel/merging/application/statistics/intensity_histogram.py | dperl-sol/cctbx_project | 155 | 3246736 | <reponame>dperl-sol/cctbx_project<gh_stars>100-1000
from __future__ import division
from xfel.merging.application.worker import worker
from dials.array_family import flex
from six.moves import cStringIO as StringIO
class intensity_histogram(worker):
'''Builds a histogram of reflection intensities'''
def __init__(... | 0 | 0 | 0 | 0 | 0 | 0 |
vit/formatter/until_epoch.py | kinifwyne/vit | 179 | 3246760 | from vit.formatter.until import Until
class UntilEpoch(Until):
def format_datetime(self, until, task) -> object:
return self.epoch(until)
| 0 | 1 | 0 | 0 | 1 | 0 |
demos/two_drones_ardupilot/demo_config.py | TUBSAPISS2018/DroneSimLab | 122 | 3246762 | wind_speed=5
wind_turbulence=3
| 0 | 0 | 0 | 0 | 0 | 0 |
python/randomex.py | honux77/practice | 152 | 3246774 | <reponame>honux77/practice<filename>python/randomex.py
#if the name of this file is random.py, it is impossible to import random module
#please be careful
import random
#demo1, generate random integer
print("1.generate random nuber")
for i in range(0,10):
print("random number:", random.randint(100,107))
#demo2 ... | 0 | 0 | 0 | 0 | 0 | 0 |
kalloc.py | google/Legilimency | 116 | 3246786 | <reponame>google/Legilimency
# Legilimency - Memory Analysis Framework for iOS
# --------------------------------------
#
# Written and maintained by <NAME> <<EMAIL>>
#
# Copyright 2017 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this ... | 0 | 0 | 0 | 0 | 0 | 0 |
example/libtextsort.gyp | JrGoodle/djinni | 2,691 | 3246789 | <filename>example/libtextsort.gyp<gh_stars>1000+
{
"targets": [
{
"target_name": "libtextsort_jni",
"type": "shared_library",
"dependencies": [
"../support-lib/support_lib.gyp:djinni_jni",
],
"ldflags": [ "-llog", "-Wl,--build-id,--gc... | 0 | 0 | 0 | 0 | 0 | 0 |
mpf/modes/high_score/__init__.py | Scottacus64/mpf | 163 | 3246813 | <filename>mpf/modes/high_score/__init__.py
"""Default high score mode."""
| 0 | 0 | 0 | 0 | 0 | 0 |
firefly/test/test_server_master.py | genghaolove/firefly | 675 | 3246826 | #coding:utf8
'''
Created on 2013-8-2
@author: lan (www.9miao.com)
'''
import os
if os.name!='nt':
from twisted.internet import epollreactor
epollreactor.install()
def println(a):
print a
if __name__=="__main__":
from firefly.master.master import Master
master = Master()
master.config('con... | 0 | 0 | 0 | 0 | 0 | 0 |
demo/NavierStokesDrivenCavity.py | spectralDNS/shenfun | 138 | 3246827 | r"""Solve Navier-Stokes equations for the lid driven cavity using a coupled
formulation
The equations are in strong form
.. math::
\nu\nabla^2 u - \nabla p &= (u \cdot \nabla) u) \\
\nabla \cdot u &= 0 \\
i\bs{u}(x, y=1) = (1, 0) \, &\text{ or }\, \bs{u}(x, y=1) = ((1-x)^2(1+x)^2, 0) \\
u(x, y=-1) &=... | 0 | 1 | 0 | 0 | 1 | 0 |
querybook/server/lib/query_executor/executors/snowflake.py | czgu/querybook | 1,144 | 3246840 | <reponame>czgu/querybook<gh_stars>1000+
import re
from snowflake.connector import errors as sf_errors
from sqlalchemy.exc import SQLAlchemyError
from lib.query_executor.utils import get_parsed_syntax_error
from lib.query_executor.executors.sqlalchemy import SqlAlchemyQueryExecutor
class SnowflakeQueryExecutor(SqlAl... | 0 | 0 | 0 | 0 | 0 | 0 |
citeomatic/scripts/generate_oc_configs.py | IntheGrass/citeomatic_learning | 162 | 3246853 | import json
import os
from citeomatic.config import App
from citeomatic.models.options import ModelOptions
from citeomatic.traits import Unicode, Enum
import copy
class GenerateOcConfigs(App):
dataset_type = Enum(('dblp', 'pubmed', 'oc'), default_value='pubmed')
input_config_file = Unicode(default_value=No... | 0 | 0 | 0 | 0 | 0 | 0 |
apply.py | bhaktatejas922/common-intern | 427 | 3246872 | <gh_stars>100-1000
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import os # to get the resume file
import time # to sleep
import get_links
# sample application links if we don't want to run get_links.py
URL_l2 = 'https://jo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/download.py | nicholasli137/python-swiftclient | 216 | 3246874 | import logging
from swiftclient.service import SwiftService, SwiftError
from sys import argv
logging.basicConfig(level=logging.ERROR)
logging.getLogger("requests").setLevel(logging.CRITICAL)
logging.getLogger("swiftclient").setLevel(logging.CRITICAL)
logger = logging.getLogger(__name__)
def is_png(obj) -> object:
... | 0 | 1 | 0 | 0 | 1 | 0 |
src/curt/curt/modules/vision/base_vision_processing.py | sanyaade-teachings/cep | 108 | 3246886 | """
Copyright (C) Cortic Technology Corp. - All Rights Reserved
Written by <NAME> <<EMAIL>>, 2021
"""
from abc import abstractmethod
class BaseVisionProcessing:
def __init__(self, processor_type):
self.processor_type = processor_type
@abstractmethod
def config_worker(self, params):
pass... | 0 | 0 | 0 | 0 | 0 | 0 |
colossalai/nn/lr_scheduler/poly.py | RichardoLuo/ColossalAI | 1,630 | 3246890 | from torch.optim.lr_scheduler import _LRScheduler
from colossalai.registry import LR_SCHEDULERS
from .delayed import WarmupScheduler
@LR_SCHEDULERS.register_module
class PolynomialLR(_LRScheduler):
"""Polynomial learning rate scheduler.
Args:
optimizer (:class:`torch.optim.Optimizer`): Wrapped optim... | 9 | 2 | 0 | 0 | 11 | 0 |
city_scrapers/spiders/il_governors_state_university.py | joshagoldstein/city-scrapers | 255 | 3246914 | <reponame>joshagoldstein/city-scrapers
import re
from datetime import datetime
from city_scrapers_core.constants import BOARD, COMMITTEE
from city_scrapers_core.items import Meeting
from city_scrapers_core.spiders import CityScrapersSpider
class IlGovernorsStateUniversitySpider(CityScrapersSpider):
name = "il_go... | 0 | 0 | 0 | 0 | 0 | 0 |
low_shot_learning/dataloaders/dataloader_fewshot.py | ZhenLiuBuaa/wDAE_GNN_FewShot | 150 | 3246922 | from __future__ import annotations
from __future__ import print_function
import random
import math
import numpy as np
import torch
import torchnet as tnt
class FewShotDataloader:
def __init__(
self,
dataset,
nKnovel: int=5,
nKbase=-1,
nExemplars: int=1,
nTestNovel... | 16 | 21 | 0 | 0 | 37 | 0 |
learn2learn/optim/transforms/transform_dictionary.py | Brikwerk/learn2learn | 1,774 | 3246933 | <reponame>Brikwerk/learn2learn
#!/usr/bin/env python3
import torch
class TransformDictionary(object):
"""docstring for ModuleDependentTransform"""
def __init__(self, dictionary):
self.param_to_transform = {}
for key, transform in dictionary.items():
if isinstance(key, torch.nn.Mo... | 0 | 0 | 0 | 0 | 0 | 0 |
icefuzz/glbmapbits.py | jaxnb/icestorm | 612 | 3246940 | <filename>icefuzz/glbmapbits.py
#!/usr/bin/env python3
import re
import fileinput
tiletype = ""
x, y = 0, 0
for line in fileinput.input():
if line.startswith("LogicTile"):
fields = line.split("_")
tiletype = "Logic"
x, y = int(fields[1]), int(fields[2])
continue
if line.start... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/stf/key_functions.py | SFDO-Alliances/NPSP | 413 | 3246943 | <filename>scripts/stf/key_functions.py
import re
class KeyParser(object):
def __init__(self, key_patterns):
self.key_patterns = key_patterns
def namespace_split(self, name):
"""
Given an API name, return a tuple containing the namespace prefix (if
any) followed by the n... | 0 | 0 | 0 | 0 | 0 | 0 |
train/config.py | deepmind/ithaca | 389 | 3246952 | <filename>train/config.py<gh_stars>100-1000
# Copyright 2021 the Ithaca Authors
#
# 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 ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/utils/casino/table/holdem/checkHandValue.py | lin483/Funny-Nations | 126 | 3246961 | <reponame>lin483/Funny-Nations
from typing import List
from src.utils.poker.Card import Card
def swap(cards: List[Card], positionA, positionB):
temp = cards[positionA]
cards[positionA] = cards[positionB]
cards[positionB] = temp
def isRoyalFlush(cards: List[Card]) -> bool:
royalFlushCards: List[Card]... | 0 | 0 | 0 | 0 | 0 | 0 |
lightly/cli/__init__.py | CodeGuy-007/lightly | 1,515 | 3246986 | <reponame>CodeGuy-007/lightly
""" The lightly.cli module provides a console interface
for training self-supervised models, embedding,
and filtering datasets
"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.cli.lightly_cli import lightly_cli
from lightly.cli.train_cli... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_kmeans.py | GabrielWen/spartan | 156 | 3246990 | import test_common
import spartan
from spartan.examples.sklearn.cluster import KMeans
from spartan import expr
from spartan.util import divup
from spartan.config import FLAGS
from datetime import datetime
from test_common import millis
N_PTS = 10*10
N_CENTERS = 10
N_DIM = 5
ITER = 5
class TestKmeans(test_common.Clust... | 0 | 0 | 0 | 0 | 0 | 0 |
src/build/fuchsia/amber_repo.py | Mr-Sheep/naiveproxy | 575 | 3247010 | <reponame>Mr-Sheep/naiveproxy
# Copyright 2019 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 common
import json
import logging
import os
import shutil
import subprocess
import tempfile
import time
import urllib2
... | 0 | 0 | 0 | 0 | 0 | 0 |
tbx/work/migrations/0022_workpage_date.py | elviva404/wagtail-torchbox | 103 | 3247033 | # Generated by Django 2.2.17 on 2021-02-17 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
("work", "0021_update_streamblock_templates"),
]
operations: list[object] = [
migrations.AddField(
model_n... | 0 | 0 | 2 | 0 | 2 | 0 |
tests/fixtures/protobuf_fixture_pb2.py | JakobSteixner/google-ads-python | 285 | 3247037 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: protobuf_fixture.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import ... | 0 | 0 | 0 | 0 | 0 | 0 |
nuplan/planning/simulation/observation/lidar_pc.py | motional/nuplan-devkit | 128 | 3247058 | <reponame>motional/nuplan-devkit
from typing import Type
from nuplan.planning.scenario_builder.abstract_scenario import AbstractScenario
from nuplan.planning.simulation.history.simulation_history_buffer import SimulationHistoryBuffer
from nuplan.planning.simulation.observation.abstract_observation import AbstractObser... | 0 | 0 | 0 | 0 | 0 | 0 |
test/create_sdf.py | rgga-16/DISN | 225 | 3247064 | from __future__ import annotations
import argparse
from datetime import datetime
import numpy as np
import random
import tensorflow as tf
import socket
import os
import sys
import h5py
import struct
BASE_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(BASE_DIR) # model
sy... | 2 | 2 | 0 | 0 | 4 | 0 |
dlt/viz/csvplot.py | dmarnerides/pydlt | 236 | 3247089 | <reponame>dmarnerides/pydlt<filename>dlt/viz/csvplot.py<gh_stars>100-1000
import os
import time
import argparse
from itertools import compress
from collections import OrderedDict
import matplotlib
from matplotlib.animation import FuncAnimation
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/android/toga_android/libs/android/webkit.py | luizoti/toga | 1,261 | 3247114 | <reponame>luizoti/toga
from rubicon.java import JavaClass, JavaInterface
ValueCallback = JavaInterface("android/webkit/ValueCallback")
WebView = JavaClass("android/webkit/WebView")
WebViewClient = JavaClass("android/webkit/WebViewClient")
| 0 | 0 | 0 | 0 | 0 | 0 |
checklist/test_suite.py | hazardsy/checklist | 1,672 | 3247116 | from __future__ import annotations
import collections
from collections import defaultdict, OrderedDict
import dill
import json
from .abstract_test import load_test, read_pred_file
from .test_types import MFT, INV, DIR
from .viewer.suite_summarizer import SuiteSummarizer
class TestSuite:
def __init__(se... | 35 | 8 | 0 | 1 | 44 | 0 |
examples/the_basics.py | msaladna/mitogen | 1,526 | 3247142 |
#
# This program is a stand-in for good intro docs. It just documents various
# basics of using Mitogen.
#
from __future__ import annotations
from __future__ import absolute_import
from __future__ import print_function
import hashlib
import io
import os
import spwd
import mitogen.core
import mitogen.master
import m... | 0 | 4 | 0 | 0 | 4 | 0 |
spruned/application/abstracts.py | darosior/spruned | 152 | 3247148 | import abc
from typing import List, Dict
import time
from spruned.application import exceptions
from spruned.application.logging_factory import Logger
class RPCAPIService(metaclass=abc.ABCMeta):
errors_ttl: int = 5
max_errors_before_downtime: int = 1
errors: list[object] = []
client: None = None
t... | 10 | 2 | 5 | 0 | 17 | 0 |
eval_pred.py | zhengwsh/text-classification | 107 | 3247153 | <gh_stars>100-1000
#! /usr/bin/env python
# -*- coding: UTF-8 -*-
"""
$ ~/anaconda3/bin/python eval_pred.py --evaluate --checkpoint_dir="./runs/1523240176/checkpoints/"
$ ~/anaconda3/bin/python eval_pred.py --predict --checkpoint_dir="./runs/1523240176/checkpoints/"
"""
import numpy as np
import pandas as pd
import o... | 0 | 0 | 0 | 0 | 0 | 0 |
DPGAnalysis/Skims/python/ZeroBiasPDSkim_cfg.py | ckamtsikis/cmssw | 852 | 3247185 | import FWCore.ParameterSet.Config as cms
process = cms.Process("SKIM")
process.configurationMetadata = cms.untracked.PSet(
version = cms.untracked.string('$Revision: 1.4 $'),
name = cms.untracked.string('$Source: /cvs/CMSSW/CMSSW/DPGAnalysis/Skims/python/ZeroBiasPDSkim_cfg.py,v $'),
annotation = cms.untra... | 0 | 0 | 0 | 0 | 0 | 0 |
code/interview-problems/knights-dialer/level_4.py | alexgolec/interview-problems | 141 | 3247186 | <reponame>alexgolec/interview-problems
# Level 4: A linear-time, constant space solution based on dynamic programming.
from neighbors import neighbors
def count_sequences(start_position, num_hops):
prior_case = [1] * 10
current_case = [0] * 10
current_num_hops = 1
while current_num_hops <= num_hops:
... | 0 | 0 | 0 | 0 | 0 | 0 |
service_catalog/views/global_hook_list_view.py | LaudateCorpus1/squest | 112 | 3247200 | from django.core.exceptions import PermissionDenied
from django_filters.views import FilterView
from django_tables2.views import SingleTableMixin
from guardian.mixins import LoginRequiredMixin
from service_catalog.filters.global_hook_filter import GlobalHookFilter
from service_catalog.models import GlobalHook
from ser... | 0 | 2 | 2 | 0 | 4 | 0 |
tests/onnx2pytorch/operations/test_clip.py | Robust-Robots/onnx2pytorch | 147 | 3247205 | <gh_stars>100-1000
import numpy as np
import pytest
import torch
from onnx2pytorch.operations.clip import Clip
def test_clip():
x_np = np.random.randn(3, 4, 5).astype(np.float32)
x = torch.from_numpy(x_np)
op = Clip(min=-1, max=1)
exp_y_np = np.clip(x_np, -1, 1)
exp_y = torch.from_numpy(exp_y_np... | 0 | 0 | 0 | 0 | 0 | 0 |
aws-blog-real-time-in-memory-oltp-and-analytics-with-apache-ignite/sample/dummyOrderGenerator.py | securityscorecard/aws-big-data-blog | 305 | 3247206 | #!/usr/bin/env python
import uuid
from time import strftime
import random
from faker import Faker
import boto.dynamodb
conn = boto.dynamodb.connect_to_region('<Region_Name>')
table = conn.get_table('<DynamoDB_Table_Name>')
fake = Faker()
shippingmethodarray = ['1-hour','1-day','2-days','1-hour','1-day','1-hour','1-d... | 0 | 0 | 0 | 0 | 0 | 0 |
awacs/signer.py | alanjjenkins/awacs | 358 | 3247242 | <reponame>alanjjenkins/awacs<filename>awacs/signer.py
# Copyright (c) 2012-2021, <NAME> <<EMAIL>>
# All rights reserved.
#
# See LICENSE file for full license.
from .aws import Action as BaseAction
from .aws import BaseARN
service_name = "AWS Signer"
prefix = "signer"
class Action(BaseAction):
def __init__(self... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/c_tokenizer_mod.py | michiyasunaga/DrRepair | 139 | 3247257 | <gh_stars>100-1000
import collections, os
import regex as re
# from util.helpers import get_lines, recompose_program
Token = collections.namedtuple('Token', ['typ', 'value', 'line', 'column'])
########## from tokenizer.py ##########
from abc import abstractmethod
class UnexpectedTokenException(Exception):
pass
... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/502271_These_Nasty_Closures__Caveats_Closure/recipe-502271.py | tdiprima/code | 2,023 | 3247319 | '''
According to my expectations, the three functions in this code below should all
produce the same result. I've been stunned to discover that this is not the case.
'''
def test1():
for i in range(5):
def call(): return i
yield call
def test2():
all = []
for i in range(5):
def call(): retu... | 0 | 0 | 0 | 0 | 0 | 0 |
get_board_followers.py | tiit-learn/py3-pinterest | 210 | 3247328 | from py3pin.Pinterest import Pinterest
username = "username"
password = "password!"
email = "email"
# cred_root is the place the user sessions and cookies will be stored you should specify this to avoid permission issues
cred_root = "cred_root"
pinterest = Pinterest(
email=email, password=password, username=user... | 0 | 0 | 0 | 0 | 0 | 0 |
capstone/capdb/migrations/0001_initial.py | rachelaus/capstone | 134 | 3247356 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-26 16:20
from __future__ import unicode_literals
import capdb.models
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial: bool = True
... | 0 | 0 | 3 | 0 | 3 | 0 |
release/spectrolog.py | thedataflows/lnav | 4,184 | 3247359 | #! /usr/bin/env python
import sys
import time
import datetime
import random
DATE_FMT = "%a %b %d %H:%M:%S %Y"
duration = [] + [80] * 10 + [100] * 10 + [40] * 10
diter = iter(duration)
DURATIONS = (
40,
40,
40,
40,
40,
40,
40,
40,
40,
40,
40,
40,
40,
50,
5... | 0 | 0 | 0 | 0 | 0 | 0 |
test_python_toolbox/test_cute_iter_tools/test_get_items.py | hboshnak/python_toolbox | 119 | 3247380 | # Copyright 2009-2017 <NAME>.
# This program is distributed under the MIT license.
'''Testing module for `cute_iter_tools.get_items`.'''
import itertools
from python_toolbox.cute_iter_tools import get_items
def test():
'''Test the basic workings of `get_items`.'''
iterable = iter(range(10))
assert g... | 0 | 0 | 0 | 0 | 0 | 0 |
matplotlibTUT/plt1_why.py | subshine/tutorials | 10,786 | 3247417 | # View more python tutorials on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
# 1 - why
"""
1. matplotlib is a powerful python data visualization tool;
2. similar with MATLAB. If know matlab... | 0 | 0 | 0 | 0 | 0 | 0 |
src/macad_gym/core/controllers/traffic_lights.py | SHITIANYU-hue/macad-gym | 201 | 3247442 | <filename>src/macad_gym/core/controllers/traffic_lights.py
import math
def get_tls(world,
candidate_transform,
sort=False,
distance_threshold=50.0,
angle_threshold=math.pi / 4.0):
"""Get a list of traffic lights that will affect an actor
Helpful when the actor ... | 0 | 0 | 0 | 0 | 0 | 0 |
src/genie/libs/parser/iosxe/tests/ShowGlbpBrief/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 3247456 | <filename>src/genie/libs/parser/iosxe/tests/ShowGlbpBrief/cli/equal/golden_output_expected.py
expected_output={
'interfaces': {
'Vl220': {
'forwarder': {
'-': {
'grp': '1',
'state': 'Active',
'pri': '255',
'address': '172.16.17.32',
'active_router': ... | 0 | 0 | 0 | 0 | 0 | 0 |
phonopy/api_gruneisen.py | ladyteam/phonopy | 127 | 3247480 | from __future__ import annotations
"""API of mode Grueneisen parameter calculation."""
# Copyright (C) 2015 <NAME>
# All rights reserved.
#
# This file is part of phonopy.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | 11 | 6 | 0 | 2 | 19 | 0 |
barcode/charsets/upc.py | timgates42/python-barcode | 344 | 3247495 | EDGE = "101"
MIDDLE = "01010"
CODES = {
"L": (
"0001101",
"0011001",
"0010011",
"0111101",
"0100011",
"0110001",
"0101111",
"0111011",
"0110111",
"0001011",
),
"R": (
"1110010",
"1100110",
"1101100",
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/SpaceXtract/util.py | gregoryng/SpaceXtract | 115 | 3247507 | from __future__ import annotations
import cv2
from SpaceXtract.general_extract import BaseExtract, RelativeExtract
import random
class Util():
def __init__(self, extractor: BaseExtract):
self.extractor = extractor
def search_switch(self, cap, key, thresh: float=0.5) -> object:
left = 0
... | 7 | 9 | 0 | 0 | 16 | 0 |
tests/test_brownian_path.py | emaballarin/torchsde | 984 | 3247513 | # 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 applicable law or agreed to in writing, ... | 0 | 1 | 0 | 0 | 1 | 0 |
src/tree/1161.maximum-level-sum-of-a-binary-tree/maximum-level-sum-of-a-binary-tree.py | lyphui/Just-Code | 782 | 3247539 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def maxLevelSum(self, root: TreeNode) -> int:
res = depth = 1
Max = float('-inf')
if root:
level = [r... | 1 | 1 | 0 | 0 | 2 | 0 |
docs/examples/fig1p2.py | uluturki/Mathematics-of-Epidemics-on-Networks | 136 | 3247545 | <reponame>uluturki/Mathematics-of-Epidemics-on-Networks<filename>docs/examples/fig1p2.py
import EoN
import networkx as nx
from matplotlib import rc
import matplotlib.pylab as plt
import scipy
import random
colors = ['#5AB3E6','#FF2000','#009A80','#E69A00', '#CD9AB3', '#0073B3',
'#F0E442']
#commands to mak... | 0 | 0 | 0 | 0 | 0 | 0 |
colossalai/nn/parallel/layers/module_utils.py | hpcaitech/ColossalAI | 1,630 | 3247569 | <gh_stars>1000+
from typing import Dict
from colossalai.tensor import ColoParameter, ParallelAction, TensorSpec
from . import ColoModule
import torch
_COLOSSAL_MODULES: Dict[type, ColoModule] = {}
def register_colo_module(module_type: type, colo_module: ColoModule):
global _COLOSSAL_MODULES
_COLOSSAL_MODULES... | 0 | 0 | 0 | 0 | 0 | 0 |
deploy/contents/sync/app/api/users_api.py | ZMaratovna/cloud-pipeline | 126 | 3247577 | <reponame>ZMaratovna/cloud-pipeline
# Copyright 2017-2020 EPAM Systems, Inc. (https://www.epam.com/)
#
# 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/LICE... | 0 | 0 | 0 | 0 | 0 | 0 |
PhysicsTools/PythonAnalysis/python/LumiList.py | Purva-Chaudhari/cmssw | 852 | 3247594 | <filename>PhysicsTools/PythonAnalysis/python/LumiList.py
#!/usr/bin/env python3
from FWCore.PythonUtilities.LumiList import LumiList as ll
import warnings
warnings.warn('PhysicsTools.PythonAnalysis.LumiList is deprecated, please use FWCore.PythonUtilities.LumiList', DeprecationWarning, stacklevel=2)
class LumiList(l... | 0 | 0 | 0 | 0 | 0 | 0 |
test/labeling/model/test_logger.py | melonwater211/snorkel | 2,906 | 3247601 | <filename>test/labeling/model/test_logger.py
import unittest
from snorkel.labeling.model.logger import Logger
class LoggerTest(unittest.TestCase):
def test_basic(self):
metrics_dict = {"train/loss": 0.01}
logger = Logger(log_freq=1)
logger.log(metrics_dict)
metrics_dict = {"train... | 0 | 0 | 0 | 0 | 0 | 0 |
evcouplings/mutate/protocol.py | mrunalimanj/EVcouplings | 117 | 3247642 | <filename>evcouplings/mutate/protocol.py
"""
Sequence statistical energy and mutation effect computation
protocols
Authors:
<NAME>
<NAME> (complex)
"""
import pandas as pd
import matplotlib.pyplot as plt
from bokeh.io import save, output_file
from evcouplings.couplings.model import (
CouplingsModel
)
from ev... | 0 | 0 | 0 | 0 | 0 | 0 |
demo.py | blackhilloldmonster/crnn-1 | 141 | 3247685 | <filename>demo.py
#coding: utf-8
import torch
from torch.autograd import Variable
import utils
import dataset
import os
from PIL import Image
import models.crnn as crnn
#os.environ["CUDA_VISIBLE_DEVICES"] ="1"
model_path = './data/netCRNN_ch_nc_21_nh_128.pth'
img_path = './data/image33.jpg'
alphabet = u'\'ACIMRey万下依口... | 0 | 0 | 0 | 0 | 0 | 0 |
supervisor/superlance/tests/dummy.py | jzmq/minos | 365 | 3247709 | <reponame>jzmq/minos
class DummyRPCServer:
def __init__(self):
self.supervisor = DummySupervisorRPCNamespace()
self.system = DummySystemRPCNamespace()
class DummyResponse:
status = 200
reason = 'OK'
body = 'OK'
def read(self):
return self.body
class DummySystemRPCN... | 0 | 0 | 0 | 0 | 0 | 0 |
niapy/tests/test_kh.py | altaregos/NiaPy | 202 | 3247748 | <gh_stars>100-1000
# encoding=utf8
from niapy.algorithms.basic import KrillHerd
from niapy.tests.test_algorithm import AlgorithmTestCase, MyProblem
class KHTestCase(AlgorithmTestCase):
r"""Test case for KrillHerdV1 algorithm.
Date:
April 2019
Author:
<NAME>
See Also:
* :clas... | 0 | 0 | 0 | 0 | 0 | 0 |
src/tests/fidl/dangerous_identifiers/generate/uses.py | allansrc/fuchsia | 210 | 3247752 | <filename>src/tests/fidl/dangerous_identifiers/generate/uses.py
# Copyright 2020 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__all__ = ["USES"]
from typing import List
from common import *
# Define places that identi... | 0 | 0 | 0 | 0 | 0 | 0 |
funsor/joint.py | fritzo/funsor | 198 | 3247760 | <reponame>fritzo/funsor
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import math
from collections import OrderedDict
from functools import reduce
from typing import Tuple, Union
from multipledispatch import dispatch
import funsor.ops as ops
from funsor.cnf import Contraction, G... | 0 | 0 | 0 | 0 | 0 | 0 |
bench/corpus/test_from_corpus.py | CostanzoPablo/audiomate | 133 | 3247768 | import random
import audiomate
from bench import resources
def run(source_corpus):
audiomate.Corpus.from_corpus(source_corpus)
def test_from_corpus(benchmark):
source_corpus = resources.generate_corpus(
200,
(5, 5),
(5, 5),
(4, 4),
(4, 4),
random.Random(x=23... | 0 | 0 | 0 | 0 | 0 | 0 |
nglview/sandbox/base.py | tovrstra/nglview | 161 | 3247795 | <reponame>tovrstra/nglview
import abc
import six
@six.add_metaclass(abc.ABCMeta)
class BaseMD:
'''Unstable API
'''
@abc.abstractmethod
def initialize(self):
pass
@abc.abstractmethod
def update(self):
pass
@abc.abstractmethod
def stop(self):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
vnpy/gateway/oes/__init__.py | funrunskypalace/vnpy | 19,529 | 3247804 | <filename>vnpy/gateway/oes/__init__.py
from .oes_gateway import OesGateway
| 0 | 0 | 0 | 0 | 0 | 0 |
constants/dns/general.py | goztrk/django-htk | 206 | 3247814 | COMMON_TLDS = [
'com',
'net',
'gov',
]
| 0 | 0 | 0 | 0 | 0 | 0 |
physics_engine.py | jaesik817/visual-interaction-networks_tensorflow | 144 | 3247922 | <gh_stars>100-1000
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import os
import numpy as np
import time
from math import sin, cos, radians, pi
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matpl... | 0 | 0 | 0 | 0 | 0 | 0 |
src/redisenterprise/azext_redisenterprise/generated/custom.py | Mannan2812/azure-cli-extensions | 207 | 3247925 | # --------------------------------------------------------------------------
# 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) AutoRest Code Generator.
# Changes may cause incor... | 27 | 15 | 0 | 0 | 42 | 0 |
example_scripts/queryOBO.py | RJMW/pymzML | 117 | 3247928 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
from collections import defaultdict
import pymzml.obo
FIELDNAMES = ["id", "name", "def", "is_a"]
def main(args):
"""
Use this script to interrogate the OBO database files.
usage:
./queryOBO.py [-h] [-v VERSION] query
Example... | 0 | 2 | 0 | 0 | 2 | 0 |
CPAC/utils/utils.py | FCP-INDI/C-PAC | 125 | 3247932 | <reponame>FCP-INDI/C-PAC<gh_stars>100-1000
import os
import collections.abc
import fnmatch
import gzip
import numbers
import pickle
import threading
import numpy as np
import json
import yaml
from copy import deepcopy
from itertools import repeat
from optparse import OptionError
from voluptuous.error import Invalid
C... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/218332_Generator_for_integer_partitions/recipe-218332.py | tdiprima/code | 2,023 | 3247971 | <gh_stars>1000+
def partitions(n):
# base case of recursion: zero is the sum of the empty list
if n == 0:
yield []
return
# modify partitions of n-1 to form partitions of n
for p in partitions(n-1):
yield [1] + p
if p and (len(p) < 2 or p[1] > p[0]):
yield [p[0] + 1] + p[1:]
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/python/test_tracker.py | eeryinkblot/psmoveapi | 306 | 3248026 | <reponame>eeryinkblot/psmoveapi
#
# PS Move API - An interface for the PS Move Motion Controller
# Copyright (c) 2012 <NAME> <<EMAIL>>
# 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. Re... | 0 | 0 | 0 | 0 | 0 | 0 |
caffe2/python/helpers/db_input.py | Hacky-DH/pytorch | 60,067 | 3248048 | ## @package db_input
# Module caffe2.python.helpers.db_input
def db_input(model, blobs_out, batch_size, db, db_type) -> object:
dbreader_name = "dbreader_" + db
dbreader = model.param_init_net.CreateDB(
[],
dbreader_name,
db=db,
db_type=db_type,
)
return model.net.Te... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/applications/greeter3/greetings/greetings.py | vincentschut/isce2 | 1,133 | 3248050 | def english_standard() -> object:
from .EnglishStandard import EnglishStandard
return EnglishStandard()
def english_cowboy() -> object:
from .EnglishCowboy import EnglishCowboy
return EnglishCowboy()
def spanish() -> object:
from .Spanish import Spanish
return Spanish()
| 0 | 3 | 0 | 0 | 3 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.