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 |
|---|---|---|---|---|---|---|---|---|---|---|
src/netius/common/__init__.py | timgates42/netius | 107 | 3321172 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... | 0 | 0 | 0 | 0 | 0 | 0 |
cobra/hostid/darwinhostid.py | rnui2k/vivisect | 716 | 3321184 | <reponame>rnui2k/vivisect
from ctypes import *
from ctypes import util
iokit = cdll.LoadLibrary(util.find_library('IOKit'))
cf = cdll.LoadLibrary(util.find_library('CoreFoundation'))
cf.CFStringCreateWithCString.argtypes = [c_void_p, c_char_p, c_int32]
cf.CFStringCreateWithCString.restype = c_void_p
cf.CFStringGetC... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/separating-inputs-and-outputs/upstream.py | msarahan/guildai | 694 | 3321197 | <gh_stars>100-1000
import os
# Ensure directory for model.
if not os.path.exists("models"):
os.mkdir("models")
# Write model.
with open("models/checkpoint.txt", "w") as f:
f.write("upstream")
| 0 | 0 | 0 | 0 | 0 | 0 |
tests/common/gcp_api/test_data/fake_admin_directory_responses.py | aarontp/forseti-security | 921 | 3321198 | <reponame>aarontp/forseti-security
# Copyright 2017 The Forseti Security 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/LI... | 0 | 0 | 0 | 0 | 0 | 0 |
challenge_7/python/system123/tests.py | YearOfProgramming/2017Challenges | 271 | 3321205 | <filename>challenge_7/python/system123/tests.py<gh_stars>100-1000
import unittest
from challenge_7 import find_missing_number
class Tests(unittest.TestCase):
def test1(self):
self.assertEqual( find_missing_number([0,4,1,2]), 3 )
def test2(self):
self.assertEqual( find_missing_number([4,1,2,3]), 0 )
def test3... | 0 | 0 | 0 | 0 | 0 | 0 |
sources/common.py | xmolnix/Carla-RL | 219 | 3321256 | <reponame>xmolnix/Carla-RL
from dataclasses import dataclass
import os
import json
import settings
# Stop reasons
@dataclass
class STOP:
running = 0
now = 1
at_checkpoint = 2
stopping = 3
stopped = 4
carla_simulator_error = 5
restarting_carla_simulator = 6
carla_simulator_restarted = 7... | 0 | 0 | 0 | 0 | 0 | 0 |
marrow/mailer/manager/transactional.py | cynepiaadmin/mailer | 166 | 3321264 | # encoding: utf-8
from __future__ import annotations
"""Currently unsupported and non-functional."""
raise ImportError("This module is currently unsupported.")
import transaction
from functools import partial
from zope.interface import implements
from transaction.interfaces import IDataManager
from marrow.mail... | 3 | 2 | 2 | 0 | 7 | 0 |
pysad/utils/pandas_streamer.py | selimfirat/pysad | 155 | 3321279 | <reponame>selimfirat/pysad
from pysad.utils.array_streamer import ArrayStreamer
from pysad.core.base_streamer import BaseStreamer
class PandasStreamer(BaseStreamer):
"""Simulator class to iterate dataframe(s).
Args:
shuffle (bool): Whether shuffle the data initially (Default=False).
"""
def ... | 0 | 0 | 0 | 0 | 0 | 0 |
z3/cumulative_tests.py | Wikunia/hakank | 279 | 3321310 | <filename>z3/cumulative_tests.py
#!/usr/bin/python -u
# -*- coding: latin-1 -*-
#
# Test of the cumulative constraint in Z3
#
# The (decomposition of) cumulative constraint is defined in z3_utils_hakank.py
#
# Also, see the following models that use cumulative:
# - furniture_movining.py
#
# This Z3 model was written... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/49. GroupAnagrams.py | nizD/LeetCode-Solutions | 263 | 3321325 | '''Given an array of strings strs, group the anagrams together. You can return the answer in any order.
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
Example 1:
Input: strs = ["eat","tea","tan","ate","nat","bat"]
O... | 0 | 1 | 0 | 0 | 1 | 0 |
test/ci_app_tests/test_cpuinfo.py | slabasan/Caliper | 220 | 3321343 | # CpuInfo tests
import unittest
import calipertest as calitest
class CaliperCpuInfoTest(unittest.TestCase):
""" Caliper CpuInfo test case """
def test_papi(self):
target_cmd = [ './ci_test_basic' ]
query_cmd = [ '../../src/tools/cali-query/cali-query', '-e' ]
caliper_config = {
... | 0 | 0 | 0 | 0 | 0 | 0 |
pyNastran/dev/bdf_vectorized/cards/elements/mass/mass.py | ACea15/pyNastran | 293 | 3321352 | from __future__ import annotations
import numpy as np
class Mass:
def __init__(self, model):
"""
Defines the ShellProperties object.
Parameters
----------
model : BDF
the BDF object
"""
self.model = model
self.n: int = 0
self.conm1... | 8 | 5 | 0 | 1 | 14 | 0 |
calvin/tests/test_calvinresponse.py | gabrielcercel/calvin-base | 334 | 3321366 | # -*- coding: utf-8 -*-
# Copyright (c) 2016 - 2018 Ericsson AB
#
# 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 appl... | 0 | 0 | 0 | 0 | 0 | 0 |
utils/eval_util.py | RubanSeven/CRAFT_keras | 176 | 3321372 | <reponame>RubanSeven/CRAFT_keras<filename>utils/eval_util.py<gh_stars>100-1000
# -*- coding: utf-8 -*-
# @Author: Ruban
# @License: Apache Licence
# @File: eval_util.py
| 0 | 0 | 0 | 0 | 0 | 0 |
el_pagination/tests/integration/test_feed_wrapper.py | TwilioDevEd/django-el-pagination | 324 | 3321382 | <reponame>TwilioDevEd/django-el-pagination
"""Twitter-style pagination feeding an specific content wrapper integration tests."""
from __future__ import unicode_literals
import el_pagination.settings
from el_pagination.tests.integration import SeleniumTestCase
class FeedWrapperPaginationTest(SeleniumTestCase):
... | 0 | 0 | 0 | 0 | 0 | 0 |
ambari-server/src/main/python/ambari_server/enableStack.py | likenamehaojie/Apache-Ambari-ZH | 1,664 | 3321405 | <reponame>likenamehaojie/Apache-Ambari-ZH<gh_stars>1000+
#!/usr/bin/env python
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to ... | 0 | 0 | 0 | 0 | 0 | 0 |
modules/loss.py | Masterchef365/pvcnn | 477 | 3321479 | <filename>modules/loss.py
import torch.nn as nn
import modules.functional as F
__all__ = ['KLLoss']
class KLLoss(nn.Module):
def forward(self, x, y):
return F.kl_loss(x, y)
| 0 | 0 | 0 | 0 | 0 | 0 |
PyObjCTest/test_nspopupbutton.py | Khan/pyobjc-framework-Cocoa | 132 | 3321483 | <reponame>Khan/pyobjc-framework-Cocoa
from PyObjCTools.TestSupport import *
from AppKit import *
try:
unicode
except NameError:
unicode = str
class TestNSPopUpButton (TestCase):
def testConstants(self):
self.assertIsInstance(NSPopUpButtonWillPopUpNotification, unicode)
def testMethods(self):... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dataerror.py | jona-sassenhagen/trafaret | 259 | 3321492 | import pytest
import trafaret as t
def test_dataerror_value():
error = t.DataError(error='Wait for good value', value='BAD ONE', code='bad_value')
assert error.as_dict() == 'Wait for good value'
assert error.as_dict(value=True) == "Wait for good value, got 'BAD ONE'"
assert error.to_struct() == {
... | 0 | 0 | 0 | 0 | 0 | 0 |
qf_lib/documents_utils/email_publishing/email_publisher.py | webclinic017/qf-lib | 198 | 3321493 | <filename>qf_lib/documents_utils/email_publishing/email_publisher.py
# 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 o... | 0 | 0 | 0 | 0 | 0 | 0 |
fasta/report_or_replace_nonstandard_residues.py | senjoro/biocode | 355 | 3321507 | #!/usr/bin/env python3
import argparse
import sys
from biocode import utils
'''
Description:
Some software is not written to handle the ambiguity residues defined by IUPAC. The
residue "J" in a protein sequence, for example, can represent leucine or isoleucine but
can cause some software to fail. You can use this... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/integration/src/case/test_index_agent.py | divenswu/proximabilin | 103 | 3321530 | # Copyright 2021 Alibaba, Inc. and 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | 37 | 15 | 0 | 0 | 52 | 0 |
solutions/problem_232.py | ksvr444/daily-coding-problem | 1,921 | 3321534 | from __future__ import annotations
class Trie:
def __init__(self):
self.size: int = 0
self.value: int = 0
self.letter_map: dict[object,object] = dict()
def __repr__(self) -> object:
return "{}: {}".format(self.letter_map, self.value)
def add_word(self, word, value) -> None:... | 0 | 4 | 0 | 3 | 7 | 0 |
vispy/visuals/glsl/__init__.py | hmaarrfk/vispy | 2,617 | 3321549 | <gh_stars>1000+
"""Repository of common GLSL functions."""
| 0 | 0 | 0 | 0 | 0 | 0 |
venv/lib/python3.8/site-packages/statsmodels/tools/tests/test_data.py | johncollinsai/post-high-frequency-data | 6,931 | 3321550 | <filename>venv/lib/python3.8/site-packages/statsmodels/tools/tests/test_data.py
import numpy as np
import pandas
from statsmodels.tools import data
def test_missing_data_pandas():
"""
Fixes GH: #144
"""
X = np.random.random((10, 5))
X[1, 2] = np.nan
df = pandas.DataFrame(X)
vals, cnames, ... | 0 | 0 | 0 | 0 | 0 | 0 |
slidedeck/watch.py | sherlockholmes/slidedeck | 187 | 3321569 | import os
import sys
import time
from slidedeck.render import process_slides
try:
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
except:
print('#'*78)
print('The watch command requires that you install the python package "watchdog"')
print('for monitoring... | 1 | 2 | 0 | 0 | 3 | 0 |
factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_part_detections/signals.py | kaka-lin/azure-intelligent-edge-patterns | 176 | 3321597 | """App signals.
"""
import logging
from django.db.models.signals import m2m_changed, post_save, pre_save
from django.dispatch import receiver
from ..cameras.models import Camera
from .models import PartDetection
from .utils import deploy_all_helper
logger = logging.getLogger(__name__)
@receiver(
signal=pre_sa... | 0 | 0 | 0 | 0 | 0 | 0 |
docs/notebooks/transfer_learning/bert_classifier_fine_tuning/quantize.py | Pandinosaurus/models-intelai | 357 | 3321602 | <gh_stars>100-1000
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 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... | 0 | 0 | 0 | 0 | 0 | 0 |
device_e2e/leak_tracker.py | Azure/azure-iot-sdk-python | 366 | 3321604 | # Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for
# full license information.
import gc
import inspect
import os
import weakref
import time
import logging
import importlib
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.INFO)
... | 0 | 7 | 0 | 2 | 9 | 0 |
insights/parsers/tests/test_pam.py | lhuett/insights-core | 121 | 3321613 | import pytest
from insights.parsers.pam import PamConf, PamDConf, PamConfEntry
from insights.parsers import get_active_lines, pam
from insights.tests import context_wrap
import doctest
PAM_CONF_DATA = """
#%PAM-1.0
vsftpd auth required pam_securetty.so
vsftpd auth requisite pam_unix.so n... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/577106_Threadsafe_observer_pattern_implemented/recipe-577106.py | tdiprima/code | 2,023 | 3321618 | <filename>recipes/Python/577106_Threadsafe_observer_pattern_implemented/recipe-577106.py
from Observer import _obwan, Observable
import threading
from synchlock import synchronous
class _tsobwan(_obwan):
"""Subclassed _obwan to provide thread synchronization"""
def __init__(self):
_obwan.__init__(self... | 0 | 0 | 0 | 0 | 0 | 0 |
src/mcedit2/rendering/sky.py | elcarrion06/mcedit2 | 673 | 3321619 | <filename>src/mcedit2/rendering/sky.py
"""
sky
"""
from __future__ import absolute_import, division, print_function
import logging
from OpenGL import GL
import numpy
from mcedit2.rendering.scenegraph import scenenode, rendernode
from mcedit2.util.glutils import gl
log = logging.getLogger(__name__)
class SkyRen... | 0 | 0 | 0 | 0 | 0 | 0 |
baseline/reader.py | shar999/mead-baseline | 241 | 3321652 | <gh_stars>100-1000
import os
import re
from typing import List, Dict
import codecs
import json
from itertools import chain
import logging
from collections import Counter
import numpy as np
import baseline.data
from baseline.vectorizers import Dict1DVectorizer, Token1DVectorizer, create_vectorizer, HasPredefinedVocab
fr... | 0 | 0 | 0 | 0 | 0 | 0 |
Python/schbebsi.py | kennethsequeira/Hello-world | 1,428 | 3321673 | <filename>Python/schbebsi.py
print "Hello Schbebsi!"
| 0 | 0 | 0 | 0 | 0 | 0 |
Bar/bar_stack0.py | pyecharts/pyecharts_gallery | 759 | 3321674 | from pyecharts import options as opts
from pyecharts.charts import Bar
from pyecharts.faker import Faker
c = (
Bar()
.add_xaxis(Faker.choose())
.add_yaxis("商家A", Faker.values(), stack="stack1")
.add_yaxis("商家B", Faker.values(), stack="stack1")
.set_series_opts(label_opts=opts.LabelOpts(is_show=Fals... | 0 | 0 | 0 | 0 | 0 | 0 |
data_gen/xml_to_csv.py | alfanyRizaMahendra/tf2-object-detection-api | 111 | 3321682 | import os
import argparse
import pandas as pd
import xml.etree.ElementTree as ET
def xml_to_csv(path) -> object:
xml_list = []
for file in os.scandir(path):
if file.is_file() and file.name.endswith(('.xml')):
xml_file = os.path.join(path, file.name)
tree = ET.parse(xml_file)
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/custom_cluster/test_blacklisted_dbs_and_tables.py | Keendata/impala | 746 | 3321686 | <reponame>Keendata/impala
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/components/homewizard/__init__.py | MrDelik/core | 30,023 | 3321691 | """Tests for the HomeWizard integration."""
| 0 | 0 | 0 | 0 | 0 | 0 |
scripts/run_lola_dice.py | jleni/lola | 125 | 3321698 | <reponame>jleni/lola
"""Run script for LOLA-DiCE on IPD."""
import click
import tensorflow as tf
from lola_dice.envs import IPD
from lola_dice.policy import SimplePolicy, MLPPolicy, RecurrentPolicy
from lola_dice.rpg import train
@click.command()
@click.option("--use-dice/--no-dice", default=True,
he... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/cpydiff/core_class_mro.py | sebastien-riou/micropython | 13,648 | 3321700 | <filename>tests/cpydiff/core_class_mro.py<gh_stars>1000+
"""
categories: Core,Classes
description: Method Resolution Order (MRO) is not compliant with CPython
cause: Depth first non-exhaustive method resolution order
workaround: Avoid complex class hierarchies with multiple inheritance and complex method overrides. Kee... | 0 | 0 | 0 | 0 | 0 | 0 |
aztk/models/software.py | Geims83/aztk | 161 | 3321729 | class Software:
"""
Enum with list of available softwares
"""
spark: str = "spark"
| 0 | 0 | 1 | 0 | 1 | 0 |
examples/network/http_server_simplistic_commented.py | sebastien-riou/micropython | 13,648 | 3321748 | <filename>examples/network/http_server_simplistic_commented.py<gh_stars>1000+
#
# MicroPython http_server_simplistic.py example
#
# This example shows how to write the smallest possible HTTP
# server in MicroPython. With comments and convenience code
# removed, this example can be compressed literally to ten
# lines. T... | 0 | 0 | 0 | 0 | 0 | 0 |
PaddleNLP/Research/ACL2019-KTNET/retrieve_concepts/ner_tagging_squad/tagging.py | XiaoguangHu01/models | 1,319 | 3321809 | <filename>PaddleNLP/Research/ACL2019-KTNET/retrieve_concepts/ner_tagging_squad/tagging.py
# -*- coding: utf-8 -*-
# ==============================================================================
# Copyright 2019 Baidu.com, Inc. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# yo... | 0 | 0 | 0 | 0 | 0 | 0 |
softdelete/south_migrations/0001_initial.py | RedMoon32/django-softdelete | 242 | 3321819 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ChangeSet'
db.create_table('softdelete_changeset', (
('id', self.gf('django.db... | 0 | 0 | 2 | 0 | 2 | 0 |
doc/samples/config_params.py | m4ta1l/doit | 1,390 | 3321844 | <reponame>m4ta1l/doit<gh_stars>1000+
from doit.tools import config_changed
option = "AB"
def task_with_params():
return {'actions': ['echo %s' % option],
'uptodate': [config_changed(option)],
'verbosity': 2,
}
| 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode/python3/795.py | ZintrulCre/LeetCode_Archiver | 279 | 3321856 | <filename>LeetCode/python3/795.py
class Solution:
def numSubarrayBoundedMax(self, A: 'List[int]', L: 'int', R: 'int') -> 'int':
i, m, j, res = 0, -1, 0, 0
while j < len(A):
if A[j] >= L and A[j] <= R:
m = j
res += m - i + 1
elif A[j] < L:
... | 0 | 0 | 0 | 0 | 0 | 0 |
train_on_gazefollow.py | ejcgt/attention-target-detection | 101 | 3321887 | import torch
from torchvision import transforms
import torch.nn as nn
from model import ModelSpatial
from dataset import GazeFollow
from config import *
from utils import imutils, evaluation
import argparse
import os
from datetime import datetime
import shutil
import numpy as np
from scipy.misc import imresize
from t... | 0 | 1 | 0 | 0 | 1 | 0 |
examples/frameworks/fire/fire_typing.py | thepycoder/clearml | 2,097 | 3321936 | from typing import Tuple, List
from clearml import Task
import fire
def with_ret() -> Tuple:
print("With ret called")
return 1, 2
def with_args(arg1: int, arg2: List):
print("With args called", arg1, arg2)
def with_args_and_ret(arg1: int, arg2: List) -> Tuple:
print("With args and ret called", arg... | 4 | 2 | 0 | 0 | 6 | 0 |
modules/dbnd-airflow-monitor/src/airflow_monitor/syncer/runtime_syncer.py | busunkim96/dbnd | 224 | 3321991 | from __future__ import annotations
import logging
from typing import List
from airflow_monitor.common import capture_monitor_exception
from airflow_monitor.common.airflow_data import (
AirflowDagRun,
AirflowDagRunsResponse,
DagRunsStateData,
)
from airflow_monitor.common.base_component import BaseMonitorC... | 6 | 5 | 1 | 0 | 12 | 0 |
tests/test_tutorial/test_create_db_and_table/test_tutorial003.py | spawn08/sqlmodel | 5,490 | 3322065 | from sqlalchemy import inspect
from sqlalchemy.engine.reflection import Inspector
from sqlmodel import create_engine
def test_create_db_and_table(clear_sqlmodel):
from docs_src.tutorial.create_db_and_table import tutorial003 as mod
mod.sqlite_url = "sqlite://"
mod.engine = create_engine(mod.sqlite_url)
... | 0 | 0 | 1 | 0 | 1 | 0 |
tests/openxml/wordprocessing/test_level_override.py | botzill/pydocx | 127 | 3322079 | # coding: utf-8
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
from unittest import TestCase
from pydocx.openxml.wordprocessing import Level, LevelOverride
from pydocx.util.xml import parse_xml_from_string
class LevelOverrideTestCase(TestCase):
def _load_from_xml(self,... | 0 | 1 | 0 | 0 | 1 | 0 |
platform/ios/scripts/clang-tidy-diff.py | roblabs/maplibre-gl-native | 4,234 | 3322083 | <gh_stars>1000+
#!/usr/bin/env python
#
#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===----------------------... | 0 | 0 | 0 | 0 | 0 | 0 |
util/trace/stack.py | mfkiwl/snitch | 105 | 3322084 | #!/usr/bin/env python3
# Copyright 2020 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Analyze set of trace files for stack pointer location
# Usage: ./stack.py trace_hart_*.txt
import sys
import re
files = sys.... | 0 | 1 | 0 | 0 | 1 | 0 |
mamba_gator/tests/test_actionsstack.py | hbcarlos/gator | 111 | 3322091 | <filename>mamba_gator/tests/test_actionsstack.py
import asyncio
import functools
import subprocess
import sys
import time
import pytest
from mamba_gator.handlers import ActionsStack
@pytest.mark.asyncio
async def test_ActionsStack_cancel():
a = ActionsStack()
dt = 0.01
async def dummy_action():
... | 0 | 0 | 0 | 0 | 0 | 0 |
hc/accounts/migrations/0032_auto_20200819_0757.py | karthikprabhu/healthchecks | 4,813 | 3322134 | <filename>hc/accounts/migrations/0032_auto_20200819_0757.py
# Generated by Django 3.1 on 2020-08-19 07:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0031_auto_20200803_1413'),
]
operations = [
migrations.AddConstraint(
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/unit/operations/test_envvarops.py | senstb/aws-elastic-beanstalk-cli | 110 | 3322156 | # -*- coding: utf-8 -*-
# Copyright 2018 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 t... | 0 | 1 | 0 | 0 | 1 | 0 |
fooltrader/botsamples/eos_statistic_bot.py | beaquant/fooltrader | 1,103 | 3322233 | # -*- coding: utf-8 -*-
from datetime import timedelta, datetime
import pandas as pd
from fooltrader.bot.bot import NotifyEventBot
from fooltrader.contract.es_contract import get_es_kdata_index, get_es_statistic_index
from fooltrader.domain.data.es_quote import CommonKData, CommonStatistic
from fooltrader.settings im... | 0 | 2 | 0 | 0 | 2 | 0 |
pyvisa/ctwrapper/cthelper.py | jpsecher/pyvisa | 393 | 3322243 | # -*- coding: utf-8 -*-
from __future__ import annotations
"""Cross platform helper of ctypes.
This file is part of PyVISA.
:copyright: 2014-2020 by PyVISA Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
import ctypes
import os
import sys
if sys.platform == "win32":
FUNCT... | 0 | 4 | 0 | 0 | 4 | 0 |
bindings/python/setup.py | augustye/muniverse | 380 | 3322247 | from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='muniverse',
version='0.1.1',
description='An API for controllin... | 0 | 0 | 0 | 0 | 0 | 0 |
pysad/transform/postprocessing/__init__.py | selimfirat/pysad | 155 | 3322267 | """
The :mod:`pysad.transform.postprocessing` module includes postprocessors to transform model scores for streaming learning.
"""
from .postprocessors import AveragePostprocessor, MaxPostprocessor, MedianPostprocessor, ZScorePostprocessor
from .running_postprocessors import RunningAveragePostprocessor, RunningMaxPost... | 0 | 0 | 0 | 0 | 0 | 0 |
test/IECoreHoudini/ToHoudiniCortexObjectConverter.py | ericmehl/cortex | 386 | 3322278 | ##########################################################################
#
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistribu... | 4 | 6 | 1 | 0 | 11 | 0 |
terrascript/resource/onelogin/onelogin.py | mjuenema/python-terrascript | 507 | 3322341 | # terrascript/resource/onelogin/onelogin.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:23:37 UTC)
import terrascript
class onelogin_app_role_attachments(terrascript.Resource):
pass
class onelogin_app_rules(terrascript.Resource):
pass
class onelogin_apps(terrascript.Resource):
pass
... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/cross_compile.py | duppercloud/gut | 299 | 3322369 | <filename>scripts/cross_compile.py<gh_stars>100-1000
#!/usr/bin/env python
import itertools
import os
import subprocess
dest_path = os.environ['DEST']
go_src_path = os.path.join(os.environ['GOROOT'], 'src')
gut_src_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')
bootstrap = os.environ.get('BOOT... | 0 | 0 | 0 | 0 | 0 | 0 |
geometric_fusion/model.py | L-Net-1992/transfuser | 447 | 3322446 | <reponame>L-Net-1992/transfuser
from collections import deque
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from torchvision import models
class ImageCNN(nn.Module):
"""
Encoder network for image input list.
Args:
c_dim (int): output dimension of the laten... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/separate_audio/app.py | bhardwajRahul/opyrator | 2,642 | 3322501 | import os
import subprocess
import sys
from tempfile import NamedTemporaryFile, TemporaryDirectory
from pydantic import BaseModel, Field
from opyrator.components.types import FileContent
class AudioSeparationInput(BaseModel):
audio_file: FileContent = Field(..., mime_type="audio/mpeg")
class AudioSeparationOu... | 1 | 1 | 3 | 0 | 5 | 0 |
flexxamples/howtos/basic_emit.py | tbnorth/flexx | 1,662 | 3322519 | """
Example demonstrating the emitting of events using the emit() method.
The "!" in the event name is to supress a warning for connecting to an
event that is not known beforehand (i.e. there is no corresponding
property or emitter).
"""
from flexx import event
class Basic(event.Component):
@event.reaction('!fo... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter06/python_re_search_2.py | stavsta/Mastering-Python-Networking-Second-Edition | 107 | 3322552 | <filename>Chapter06/python_re_search_2.py
#!/usr/bin/env python3
import re, datetime
startTime = datetime.datetime.now()
term1 = re.compile('ACLLOG-5-ACLLOG_FLOW_INTERVAL')
term2 = re.compile('PAM: Authentication failure')
fileList = ['sample_log_anonymized.log', 'sample_log_anonymized_1.log']
for log in fileList:... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/pxScene2d/external/libnode-v6.9.0/tools/comtypes/test/test_pump_events.py | madanagopaltcomcast/pxCore | 212 | 3322586 | <gh_stars>100-1000
import gc
import unittest
from comtypes.client import PumpEvents
class PumpEventsTest(unittest.TestCase):
def test_pump_events_doesnt_leak_cycles(self):
gc.collect()
for i in range(3):
PumpEvents(0.05)
ncycles = gc.collect()
self.assertEqual(... | 0 | 0 | 0 | 0 | 0 | 0 |
Week01/vanilla_implementations/sieve_of_eratosthenes.py | NAU-ACM/ACM-ICPC-Preparation | 856 | 3322616 | <filename>Week01/vanilla_implementations/sieve_of_eratosthenes.py
# Sieve of Eratosthenes implementation in Python
#
# Author: <NAME>
# Date: 04/11/2022
def sieve_of_eratosthenes(n):
"""
Sieve of Eratosthenes implementation;
Finding prime numbers from 2 to n (inclusive).
"""
primes = [True] * (n ... | 0 | 0 | 0 | 0 | 0 | 0 |
django_mptt_admin/tree_change_list.py | mbraak/django-mptt-admin | 230 | 3322672 | <filename>django_mptt_admin/tree_change_list.py
from django.contrib.admin.views.main import ChangeList, IGNORED_PARAMS
import django
from . import util
class TreeChangeList(ChangeList):
TREE_IGNORED_PARAMS = IGNORED_PARAMS + ("_", "node", "selected_node")
def __init__(self, request, model, model_admin, list... | 0 | 0 | 0 | 0 | 0 | 0 |
python-leetcode/laozhang/tree/leetcode_501_.py | sweeneycai/cs-summary-reflection | 227 | 3322688 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# coding=utf-8
"""
501. 二叉搜索树中的众数
"""
from typing import List
from laozhang import TreeNode
class Solution:
def findMode(self, root: TreeNode) -> List[int]:
list = []
res = {}
max = 0
def helper(root: TreeNode):
nonlocal ... | 2 | 1 | 0 | 0 | 3 | 0 |
users/tests/unit/sign_up/test_sign_up.py | Al-bambino/aws-serverless-ecommerce-platform | 758 | 3322785 | <filename>users/tests/unit/sign_up/test_sign_up.py<gh_stars>100-1000
import copy
import datetime
import json
import uuid
import pytest
from botocore import stub
from fixtures import context, lambda_module # pylint: disable=import-error,no-name-in-module
from helpers import compare_event # pylint: disable=import-error,n... | 0 | 0 | 0 | 0 | 0 | 0 |
jpype/_pyinstaller/hook-jpype.py | sefator/jpype | 531 | 3322808 | <filename>jpype/_pyinstaller/hook-jpype.py
import os
from pathlib import Path
import jpype
fspath = getattr(os, 'fspath', str)
jar_path = Path(jpype.__file__).parent.parent.joinpath('org.jpype.jar')
datas = [[fspath(jar_path), '.']]
| 0 | 0 | 0 | 0 | 0 | 0 |
dialogue-engine/test/programytest/spelling/test_base.py | cotobadesign/cotoba-agent-oss | 104 | 3322825 | <reponame>cotobadesign/cotoba-agent-oss
"""
Copyright (c) 2020 COTOBA DESIGN, Inc.
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 u... | 0 | 0 | 0 | 0 | 0 | 0 |
descarteslabs/scenes/collection.py | descarteslabs/descarteslabs-python | 167 | 3322851 | # Copyright 2018-2020 Descartes Labs.
#
# 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 ... | 1 | 24 | 1 | 2 | 28 | 0 |
krsh/config/config.py | riiid/krsh | 133 | 3322864 | <filename>krsh/config/config.py
# Copyright 2021 AIOps Squad, Riiid 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... | 0 | 0 | 0 | 0 | 0 | 0 |
resources/hid_config_test/ex4_hid_write.py | DevOath/duckyPad | 578 | 3322865 | <filename>resources/hid_config_test/ex4_hid_write.py
"""
duckyPad HID example: HID read AND write
For more details, see:
https://github.com/dekuNukem/duckyPad-profile-autoswitcher/blob/master/HID_details.md
"""
import hid
import time
def get_duckypad_path():
for device_dict in hid.enumerate():
if device_dict... | 0 | 0 | 0 | 0 | 0 | 0 |
PyObjCTest/test_nsfontdescriptor.py | Khan/pyobjc-framework-Cocoa | 132 | 3322887 |
from PyObjCTools.TestSupport import *
from AppKit import *
try:
unicode
except NameError:
unicode = str
class TestNSFontDescriptor (TestCase):
def testConstants(self):
self.assertEqual(NSFontUnknownClass, (0 << 28))
self.assertEqual(NSFontOldStyleSerifsClass, (1 << 28))
self.asser... | 0 | 0 | 0 | 0 | 0 | 0 |
hybrik/datasets/hp3d.py | uyoung-jeong/HybrIK | 287 | 3322890 | """MPI-INF-3DHP dataset."""
import copy
import json
import os
import pickle as pk
import numpy as np
import scipy.misc
import torch.utils.data as data
from hybrik.utils.bbox import bbox_clip_xyxy, bbox_xywh_to_xyxy
from hybrik.utils.pose_utils import cam2pixel_matrix, pixel2cam_matrix, reconstruction_error
from hybri... | 5 | 11 | 13 | 4 | 33 | 0 |
tests/test_models/test_common_modules.py | HypnosXC/mmaction2 | 549 | 3322930 | <reponame>HypnosXC/mmaction2
import pytest
import torch
from mmaction.models import Conv2plus1d
def test_conv2plus1d():
with pytest.raises(AssertionError):
# Length of kernel size, stride and padding must be the same
Conv2plus1d(3, 8, (2, 2))
conv_2plus1d = Conv2plus1d(3, 8, 2)
conv_2plu... | 0 | 0 | 0 | 0 | 0 | 0 |
h/security/policy/combined.py | BearerPipelineTest/h | 2,103 | 3322937 | <gh_stars>1000+
from typing import Optional
from pyramid.interfaces import ISecurityPolicy
from pyramid.request import RequestLocalCache
from zope.interface import implementer
from h.security import Identity
from h.security.policy._basic_http_auth import AuthClientPolicy
from h.security.policy._cookie import CookiePo... | 0 | 0 | 0 | 0 | 0 | 0 |
WebMirror/management/rss_parser_funcs/feed_parse_extractDsrealmCom.py | fake-name/ReadableWebProxy | 193 | 3322955 | from __future__ import annotations
def extractDsrealmCom(item) -> bool | object | None:
'''
Parser for 'dsrealm.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('Reincarnated As A Dragons Eg... | 0 | 1 | 0 | 0 | 1 | 0 |
src/tests/simian/auth/gaeserver_test.py | tristansgray/simian | 326 | 3322964 | #!/usr/bin/env python
#
# Copyright 2018 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... | 3 | 5 | 1 | 0 | 9 | 0 |
lib/deluge_client/__init__.py | 0x20Man/Watcher3 | 320 | 3322966 | <reponame>0x20Man/Watcher3
from .client import DelugeRPCClient | 0 | 0 | 0 | 0 | 0 | 0 |
modeling.py | jamespacileo/dino | 113 | 3322989 | <gh_stars>100-1000
# 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, software
# d... | 0 | 0 | 0 | 0 | 0 | 0 |
baseline/mrqa_allennlp/mrqa_predictor.py | mrqa/shared-task-2019 | 274 | 3322993 | from overrides import overrides
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.predictors.predictor import Predictor
@Predictor.register('mrqa_predictor')
class MRQAPredictor(Predictor):
def predict_json(self, json_dict: JsonDict) -> JsonDict:
if 'header' in jso... | 1 | 1 | 0 | 0 | 2 | 0 |
Python/graphs/height_of_given_tree.py | yashsahay2014/NeoAlgo | 897 | 3323004 | from __future__ import annotations
'''
Author: <NAME>
Description: Calculates the height of the given Binary Tree
Time Complexity: O(log N), Worst-Case: O(N)
Space Complexity: O(1)
Where N is the total number of nodes
'''
# Strucure of a Binary Node
class Node:
def __init__... | 0 | 1 | 0 | 2 | 3 | 0 |
recipes/Python/205126_Variant_property_allowing_one_functibe_used/recipe-205126.py | tdiprima/code | 2,023 | 3323013 | class CommonProperty(object):
"""A more flexible version of property()
Saves the name of the managed attribute and uses the saved name
in calls to the getter, setter, or destructor. This allows the
same function to be used for more than one managed variable.
As a convenience, the default function... | 0 | 0 | 0 | 0 | 0 | 0 |
test/test_gen_gfa_v2.py | PacificBiosciences/falcon3 | 216 | 3323083 | import falcon_kit.mains.gen_gfa_v2 as mod
import helpers
import pytest
import os
def test_help():
try:
mod.main(['prog', '--help'])
except SystemExit:
pass
def test_main_1(tmpdir, capsys):
# test_dir = os.path.join(helpers.get_test_data_dir(), 'gfa-1')
gfa_graph = mod.GFAGraph()
g... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_dwave_qbsolv.py | Seyrom/qbsolv | 1,018 | 3323108 | <reponame>Seyrom/qbsolv<filename>tests/test_dwave_qbsolv.py<gh_stars>1000+
import unittest
import time
import itertools
import dwave_qbsolv as qbs
import dimod
import random
alpha = dict(enumerate('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'))
class TestWrapper(unittest.TestCase):
def test_... | 0 | 0 | 0 | 0 | 0 | 0 |
platypush/backend/joystick/jstest/__init__.py | BlackLight/platypush | 228 | 3323171 | import json
import os
import re
import subprocess
import time
from typing import Optional, List
from platypush.backend import Backend
from platypush.message.event.joystick import JoystickConnectedEvent, JoystickDisconnectedEvent, JoystickStateEvent, \
JoystickButtonPressedEvent, JoystickButtonReleasedEvent, Joysti... | 5 | 6 | 0 | 2 | 13 | 0 |
NLP/EMNLP2021-SgSum/src/data_preprocess/preprocess_graphextsum_data.py | zhangyimi/Research | 1,319 | 3323202 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Baidu.com, Inc. All Rights Reserved
#
"""
File: preprocess_graphsum_data.py
Author: chenmoye(<EMAIL>)
Date: 2021-10-18 14:50
Desc:
"""
import argparse
import time
import os
import data_builder_graphextsum
def do_format_to_json(args... | 0 | 0 | 0 | 0 | 0 | 0 |
Z - Tool Box/BeRoot/Windows/BeRoot/beroot/modules/checks/system.py | dfirpaul/Active-Directory-Exploitation-Cheat-Sheet-1 | 1,290 | 3323216 | <filename>Z - Tool Box/BeRoot/Windows/BeRoot/beroot/modules/checks/system.py
# -*- coding: utf-8 -*-
import sys
import ctypes
from ctypes import wintypes
READ_CONTROL = 0x00020000
STANDARD_RIGHTS_READ = READ_CONTROL
TOKEN_QUERY = 0x0008
TOKEN_READ = (STANDARD_RIGHTS_READ | TOKEN_QUERY)
def can_get_admin_a... | 0 | 0 | 0 | 0 | 0 | 0 |
datasets/build_oxford_iiit_pet.py | Mithilesh1609/assembled-cnn | 363 | 3323262 | <filename>datasets/build_oxford_iiit_pet.py<gh_stars>100-1000
#!/usr/bin/env python
# coding=utf8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
"""
example:
CUDA_VISIBLE_DEVICES="" python build_oxford_iiit_pet.py \
--data_dir=oxford_iiit_pet \
--output_dir... | 0 | 0 | 0 | 0 | 0 | 0 |
SimRomanPot/Configuration/python/SimChargeDigiFP420_cff.py | ckamtsikis/cmssw | 852 | 3323270 | import FWCore.ParameterSet.Config as cms
#
#Set pixel digitization default in CMSSW_2_1_X
#
#
# (do not forget to include any mixing like:
# include "SimGeneral/MixingModule/data/mixNoPU.cfi"
#
# Pixel's digitization
#
from SimRomanPot.SimFP420.FP420Digi_cfi import *
| 0 | 0 | 0 | 0 | 0 | 0 |
testing/vulnerable_app/main.py | bbhunter/fuzz-lightyear | 169 | 3323278 | <reponame>bbhunter/fuzz-lightyear<filename>testing/vulnerable_app/main.py
import os
from .app import get_current_application
from .core.database import Base
from .core.database import create_engine
from .core.database import get_database_file
from .core.routes import configure_routes
def main():
app = get_curren... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/buildfarm-indexer.py | wiwa/bazel-buildfarm | 455 | 3323315 | <filename>tools/buildfarm-indexer.py<gh_stars>100-1000
from redis.client import Pipeline
from rediscluster import StrictRedisCluster
import sys
def get_cas_page(r, cursor, count):
return r.scan(
cursor=cursor,
match="ContentAddressableStorage:*",
count=count)
redis_host = None
if len(sys.a... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/test_pynab.py | bigblue/pynab | 161 | 3323350 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_pynab
----------------------------------
Tests for `pynab` module.
"""
import unittest
from pprint import pformat
from pynab.server import Server
from pynab.db import db_session
import pynab.parts
from pynab import log
import regex
from pynab.categories import ... | 0 | 2 | 0 | 0 | 2 | 0 |
experiments/models_6class_joint/make_eval_jobs_size-48-80_6class_fake_vs_real.py | aosokin/biogans | 105 | 3323372 | <gh_stars>100-1000
import os
CUR_PATH = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = os.path.join(CUR_PATH, '..', '..')
EVAL_OUTPUT_PATH = '{0}/logs_eval_6class_fake_vs_real'.format(CUR_PATH)
DATA_PATH = '{0}/data/LIN_Normalized_WT_size-48-80_6class_test_splits'.format(ROOT_PATH)
DATA_ROOT = "{0}/data/LIN_N... | 0 | 0 | 0 | 0 | 0 | 0 |
Algo and DSA/LeetCode-Solutions-master/Python/elements-in-array-after-removing-and-replacing-elements.py | Sourav692/FAANG-Interview-Preparation | 3,269 | 3323375 | # Time: O(n)
# Space: O(1)
class Solution(object):
def elementInNums(self, nums, queries) -> object:
"""
:type nums: List[int]
:type queries: List[List[int]]
:rtype: List[int]
"""
result = []
for t, i in queries:
t %= 2*len(nums)
if t... | 0 | 1 | 0 | 0 | 1 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.