max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 7 115 | max_stars_count int64 101 368k | id stringlengths 2 8 | content stringlengths 6 1.03M |
|---|---|---|---|---|
benchmarks/scaling/debug_hooks.py | Pandinosaurus/KungFu | 291 | 11097492 | <filename>benchmarks/scaling/debug_hooks.py
import os
import time
import numpy as np
from kungfu._utils import (_log_event, _since_proc_start, one_based_range,
show_duration)
from kungfu.tensorflow.ops import all_reduce
import tensorflow as tf
def _cluster_size():
if os.getenv('KUNGFU... |
tests/scenarios/test_using_make_with_custom_config.py | LaudateCorpus1/holodeck | 518 | 11097523 | import random
import holodeck
def test_using_make_with_custom_config():
"""
Validate that we can use holodeck.make with a custom configuration instead
of loading it from a config file
"""
conf = {"name": "test_randomization", "agents": []}
# pick a random world from the installed packages
... |
src/plugins_/cfcs/di.py | jcberquist/sublimetext-cfml | 130 | 11097525 | <filename>src/plugins_/cfcs/di.py
import sublime
import sublime_plugin
from . import cfcs, documentation
from ...cfml_view import CfmlView
class CfmlDiPropertyCommand(sublime_plugin.TextCommand):
def run(self, edit, property_name=None):
pt = self.view.sel()[0].begin()
if not self.view.match_sele... |
PythonClient/computer_vision/weather.py | jeyong/AirSim | 6,115 | 11097575 | <reponame>jeyong/AirSim<filename>PythonClient/computer_vision/weather.py
import setup_path
import airsim
client = airsim.VehicleClient()
client.confirmConnection()
client.simEnableWeather(True)
airsim.wait_key('Press any key to enable rain at 25%')
client.simSetWeatherParameter(airsim.WeatherParameter.Rain, 0.25);... |
zippy/edu.uci.python.test/src/tests/mm2d_random_naive_5.py | lucapele/pele-c | 319 | 11097577 |
"""
# 3x3 matrix
X = [[12,7,3],
[4 ,5,6],
[7 ,8,9]]
# 3x4 matrix
Y = [[5,8,1,2],
[6,7,3,0],
[4,5,9,1]]
# result is 3x4
result = [[0,0,0,0],
[0,0,0,0],
[0,0,0,0]]
"""
import sys, time, random
# N = int(sys.argv[1])
N = 5
X = [[random.randint(0,1000) for i in range(N)] for j in range(... |
bin/lib/cdn.py | dbabokin/infra | 135 | 11097592 | import hashlib
import logging
import mimetypes
import os
import shutil
import tarfile
from base64 import b64encode
from concurrent import futures
from datetime import datetime
from pathlib import Path
from tempfile import mkdtemp
from lib.amazon import botocore, s3_client, force_lazy_init
logger = logging.getLogger('... |
src/automation/azext_automation/manual/_help.py | haroonf/azure-cli-extensions | 207 | 11097597 | <gh_stars>100-1000
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------... |
cx_Freeze/samples/ctypes/test_ctypes.py | lexa/cx_Freeze | 358 | 11097602 | import ctypes
print("Hello", ctypes.__name__)
|
floyd/model/credentials.py | longhuei/floyd-cli | 162 | 11097611 | <gh_stars>100-1000
from marshmallow import Schema, fields, post_load
from floyd.model.base import BaseModel
class CredentialsSchema(Schema):
"""
Floyd credentials schema
"""
username = fields.Str()
password = fields.Str()
@post_load
def make_credentials(self, data):
return Creden... |
python/ase/scripts/speak.py | vlinhd11/vlinhd11-android-scripting | 2,293 | 11097667 | """Speak user generated text."""
__author__ = '<NAME> <<EMAIL>>'
__copyright__ = 'Copyright (c) 2009, Google Inc.'
__license__ = 'Apache License, Version 2.0'
import android
droid = android.Android()
message = droid.getInput('TTS', 'What would you like to say?').result
droid.ttsSpeak(message)
|
pandas/check-in-ranges/main.py | whitmans-max/python-examples | 140 | 11097678 | <reponame>whitmans-max/python-examples<gh_stars>100-1000
# date: 2019.07.30
# https://stackoverflow.com/questions/57261926/get-all-items-from-dfs-column-that-are-within-a-range-using-ranges-iterable
import pandas as pd
df = pd.DataFrame([
['c1', 137674167],
['c2', 2166178],
['c3', 268],
... |
sphinx_source_files/update_doc_page_deprecated.py | caoliheng/open-dynamic-robot-initiative.github.io | 149 | 11097688 | <gh_stars>100-1000
#! /usr/bin/python
from os import path, mkdir, walk
import re
import shutil
import treep.treep_git
import treep.files
import rospkg
from bs4 import BeautifulSoup
import re
def get_ros_install_share_path():
"""
Use rospack to get the path to the installation folder (supposed sourced)
"""... |
kashgari/types.py | SharpKoi/Kashgari | 2,422 | 11097741 | <gh_stars>1000+
# encoding: utf-8
# author: BrikerMan
# contact: <EMAIL>
# blog: https://eliyar.biz
# file: types.py
# time: 3:54 下午
from typing import List, Union, Tuple
TextSamplesVar = List[List[str]]
NumSamplesListVar = List[List[int]]
LabelSamplesVar = Union[TextSamplesVar, List[str]]
ClassificationLabelVar =... |
pluribus/games/short_deck/player.py | keithlee96/pluribus-poker-AI | 113 | 11097742 | from pluribus.poker.player import Player
from pluribus.poker.pot import Pot
class ShortDeckPokerPlayer(Player):
"""Inherits from Player which will interface easily with the PokerEngine.
This class should manage the state of the players personal pot, and the
private cards that are dealt to the player. Als... |
setup.py | oplatek/ALI | 329 | 11097749 | <reponame>oplatek/ALI<filename>setup.py
from setuptools import find_packages, setup
setup(
name='ali',
version='0.1.0',
description='Code for the "Adversarially Learned Inference" paper',
long_description='Code for the "Adversarially Learned Inference" paper',
url='https://github.com/IshmaelBelghaz... |
Packs/PaloAltoNetworks_PAN_OS_EDL_Management/Integrations/PaloAltoNetworks_PAN_OS_EDL_Management/PaloAltoNetworks_PAN_OS_EDL_Management_test.py | diCagri/content | 799 | 11097751 | import pytest
from CommonServerPython import *
def test_get_external_file_too_many_new_lines(mocker):
"""
Given:
- an invalid file content with too many newlines
When:
- running edl_get_external_file_command
Then:
- Verify that an appropriate error message is shown to the user
-... |
allennlp_models/rc/dataset_readers/record_reader.py | xinzhel/allennlp-models | 402 | 11097765 | <reponame>xinzhel/allennlp-models
"""
Dataset reader for SuperGLUE's Reading Comprehension with Commonsense Reasoning task (Zhang Et
al. 2018).
Reader Implemented by <NAME>
"""
import logging
from typing import Dict, List, Optional, Iterable, Union, Tuple, Any
from pathlib import Path
from allennlp.common.util import ... |
plan2explore/control/batch_env.py | sarthak268/plan2explore | 189 | 11097769 | # Copyright 2019 The Dreamer Authors. Copyright 2020 Plan2Explore 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... |
crankycoin/models/block.py | Rajatkalsotra/crankycoin | 162 | 11097779 | <reponame>Rajatkalsotra/crankycoin
import codecs
import hashlib
import json
import time
import pyscrypt
from crankycoin.models.transaction import Transaction
from crankycoin.models.errors import InvalidTransactions
from crankycoin import config
class BlockHeader(object):
def __init__(self, previous_hash, merkle... |
Src/StdLib/Lib/site-packages/win32comext/internet/inetcon.py | cwensley/ironpython2 | 1,078 | 11097797 | <gh_stars>1000+
INET_E_USE_DEFAULT_PROTOCOLHANDLER = -2146697199 # _HRESULT_TYPEDEF_(0x800C0011L)
INET_E_USE_DEFAULT_SETTING = -2146697198 # _HRESULT_TYPEDEF_(0x800C0012L)
INET_E_DEFAULT_ACTION = INET_E_USE_DEFAULT_PROTOCOLHANDLER
INET_E_QUERYOPTION_UNKNOWN = -2146697197 # _HRESULT_TYPEDEF_(0x800C0013L)
INET_E_REDIRECT... |
scripts/external_libs/scapy-2.4.3/scapy/contrib/automotive/obd/obd.py | timgates42/trex-core | 956 | 11097803 | # flake8: noqa: F405
# This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) <NAME> <<EMAIL>>
# Copyright (C) <NAME> <<EMAIL>>
# This program is published under a GPLv2 license
# scapy.contrib.description = On Board Diagnostic Protocol (OBD-II)
# scapy.contrib.stat... |
websockets/handlers/stash_responder_blocking_wsh.py | meyerweb/wpt | 14,668 | 11097809 | #!/usr/bin/python
import json
import threading
import wptserve.stash
from mod_pywebsocket import msgutil
address, authkey = wptserve.stash.load_env_config()
path = "/stash_responder_blocking"
stash = wptserve.stash.Stash(path, address=address, authkey=authkey)
cv = threading.Condition()
def handle_set(key, value):
... |
aws_lambda_builders/workflows/ruby_bundler/workflow.py | eldritchideen/aws-lambda-builders | 180 | 11097849 | <reponame>eldritchideen/aws-lambda-builders
"""
Ruby Bundler Workflow
"""
import logging
from aws_lambda_builders.workflow import BaseWorkflow, Capability
from aws_lambda_builders.actions import CopySourceAction, CopyDependenciesAction, CleanUpAction
from .actions import RubyBundlerInstallAction, RubyBundlerVendorActi... |
allennlp_models/vision/dataset_readers/gqa.py | gabeorlanski/allennlp-models | 402 | 11097863 | from os import PathLike
from typing import (
Dict,
Union,
Optional,
Tuple,
Iterable,
)
import json
import os
from overrides import overrides
import torch
from torch import Tensor
from allennlp.common.file_utils import cached_path
from allennlp.common.lazy import Lazy
from allennlp.data.vocabulary ... |
app/utils/get_list_of_app_exceptions_for_frontend.py | AmitArie/abstracting-fastapi-services | 224 | 11097873 | from utils.app_exceptions import AppException
print([e for e in dir(AppException) if "__" not in e])
# ['FooCreateItem', 'FooGetItem', 'FooItemRequiresAuth']
|
ahk/window.py | scslmd/ahk | 502 | 11097885 | <reponame>scslmd/ahk
import ast
import asyncio
import collections
from contextlib import suppress
import warnings
from types import CoroutineType
from ahk.script import ScriptEngine, AsyncScriptEngine
from ahk.utils import escape_sequence_replace, make_logger, async_filter
logger = make_logger(__name__)
class Window... |
softlearning/policies/uniform_policy_test.py | limash/softlearning | 920 | 11097900 | <reponame>limash/softlearning<filename>softlearning/policies/uniform_policy_test.py<gh_stars>100-1000
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
import tree
from softlearning import policies
from softlearning.policies.uniform_policy import Conti... |
beta_rec/data/__init__.py | mengzaiqiao/TVBR | 126 | 11097904 | <filename>beta_rec/data/__init__.py
"""Data Module."""
from .base_data import BaseData
__all__ = ["BaseData"]
|
smbprotocol/exceptions.py | allblue147/CVE-2020-0796-PoC | 306 | 11097905 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, <NAME> (@jborean93) <<EMAIL>>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
import binascii
import errno
import ntpath
import os
import socket
from collections import (
OrderedDict,
)
from smbprotocol import (
Dialects,
)
... |
machina/apps/forum_member/models.py | BrendaH/django-machina | 572 | 11097942 | <gh_stars>100-1000
"""
Forum member models
===================
This module defines models provided by the ``forum_member`` application.
"""
from machina.apps.forum_member.abstract_models import AbstractForumProfile
from machina.core.db.models import model_factory
ForumProfile = model_factory(AbstractFo... |
froide/campaign/migrations/0003_campaign_ident.py | xenein/froide | 198 | 11097952 | <filename>froide/campaign/migrations/0003_campaign_ident.py
# Generated by Django 2.1.7 on 2019-03-09 12:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("campaign", "0002_auto_20190309_1241"),
]
operations = [
migrations.AddField(
... |
tests/framework/RunFailures/codeFailer.py | rinelson456/raven | 159 | 11097970 | <gh_stars>100-1000
# Copyright 2017 Battelle Energy Alliance, 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 applica... |
xtune/src/pequod/model/roberta.py | aimore-globality/unilm | 5,129 | 11097974 | <reponame>aimore-globality/unilm
import torch
from torch import nn
from torch.nn import CrossEntropyLoss
from transformers.modeling_bert import BertPreTrainedModel, BertForQuestionAnswering
from transformers.modeling_roberta import RobertaModel
class RobertaForQuestionAnswering(BertPreTrainedModel):
base_model_pr... |
algorithms/recursion/Fibonacci-Series-by-python.py | yashaswiadyalu/python | 204 | 11097975 |
### Program to calculate fibonacci series
def fibo(n): // function to calculate fibonacci series
if(n == 0):
return 0
elif(n == 1):
return 1
else:
return(fibo(n-1) + fibo(n-2))
num = int(input("Enter a number: ")) // enter number upto which you want to calculate fibonacci series
fo... |
devito/finite_differences/finite_difference.py | guaacoelho/devito | 199 | 11098028 | <gh_stars>100-1000
from sympy import sympify
from devito.finite_differences.differentiable import EvalDerivative
from devito.finite_differences.tools import (numeric_weights, symbolic_weights, left,
right, generate_indices, centered, direct,
... |
airflow/providers/apache/hive/example_dags/example_twitter_dag.py | ChaseKnowlden/airflow | 15,947 | 11098040 | #
# 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
# "License"); you may not... |
examples/xor_5C.py | Liblor/arybo | 223 | 11098051 | <reponame>Liblor/arybo<gh_stars>100-1000
from arybo.lib import MBA
import arybo.lib.mba_exprs as EX
import sys
use_exprs = False
if len(sys.argv) >= 2:
use_exprs = int(sys.argv[1])
def f(x):
v0 = x*0xe5 + 0xF7
v0 = v0&0xFF
v3 = (((((v0*0x26)+0x55)&0xFE)+(v0*0xED)+0xD6)&0xFF )
v4 = ((((((- (v3*0x2)... |
namedtuple__typing__example/main.py | DazEB2/SimplePyScripts | 117 | 11098116 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])
# # TypeError: __new__() missing 2 required positional arguments: 'x' and 'y'
# p = Point()
# print(p)
p = Point(1, 2)
print(p) # Point(x=1, y=2)
print(p._a... |
python/tvm/topi/nn/loss.py | XiaoSong9905/tvm | 4,640 | 11098149 | # 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
# "License"); you may not u... |
pyNastran/dev/bdf_vectorized/cards/elements/spring/celas1.py | ACea15/pyNastran | 293 | 11098164 | from numpy import array, zeros, unique, searchsorted, where, arange
from pyNastran.dev.bdf_vectorized.cards.elements.spring.spring_element import SpringElement
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.field_writer_16 import print_card_16
from pyNastran.bdf.bdf_interface.assign_type imp... |
tests/test_minimum_version.py | oprypin/copier | 438 | 11098190 | <filename>tests/test_minimum_version.py
import warnings
import pytest
from packaging.version import Version
from plumbum import local
from plumbum.cmd import git
import copier
from copier.errors import (
OldTemplateWarning,
UnknownCopierVersionWarning,
UnsupportedVersionError,
)
from .helpers import buil... |
scripts/agglomDemo.py | vipavlovic/pyprobml | 4,895 | 11098199 | <filename>scripts/agglomDemo.py
# Agglomerative Clustering Demo
# Author: <NAME>
import superimport
import numpy as np
from scipy.cluster.hierarchy import dendrogram, linkage
import matplotlib.pyplot as plt
import pyprobml_utils as pml
X = np.array([[1,2],
[2.5,4.5],
[2,2],
[4,1.5],
[4,2.5],])
label... |
gamY/extract_equations.py | gemal/MAKRO | 1,018 | 11098200 | <reponame>gemal/MAKRO
import os
import sys
import csv
import gamY
import re
import textwrap
def main():
"""
Read model from gamY pickle
Translate Equations to Gekko format
Export equations to csv file
"""
file_path = "../model/saved/model" # sys.argv[1]
file_dir, file_name = os.path.split(file_path)
... |
accessories/TV.py | jerr0328/HAP-python | 462 | 11098206 | from pyhap.accessory import Accessory
from pyhap.const import CATEGORY_TELEVISION
class TV(Accessory):
category = CATEGORY_TELEVISION
NAME = 'Sample TV'
SOURCES = {
'HDMI 1': 3,
'HDMI 2': 3,
'HDMI 3': 3,
}
def __init__(self, *args, **kwargs):
super(TV, self).__in... |
llvmpy/src/TargetTransformInfo.py | KennethNielsen/llvmpy | 140 | 11098214 | from binding import *
from src.namespace import llvm
from src.Pass import ImmutablePass
if LLVM_VERSION >= (3, 3):
llvm.includes.add('llvm/Analysis/TargetTransformInfo.h')
else:
llvm.includes.add('llvm/TargetTransformInfo.h')
TargetTransformInfo = llvm.Class(ImmutablePass)
ScalarTargetTransformInfo = llvm.Cla... |
vae/standalone/vae_mmd_celeba_lightning.py | vipavlovic/pyprobml | 4,895 | 11098228 | """
Author: <NAME>
Please run the following command before running the script
wget -q https://raw.githubusercontent.com/sayantanauddy/vae_lightning/main/data.py
or curl https://raw.githubusercontent.com/sayantanauddy/vae_lightning/main/data.py > data.py
Then, make sure to get your kaggle.json from kaggle.com then ru... |
pdbr/middlewares/django.py | giladbarnea/pdbr | 222 | 11098283 | <reponame>giladbarnea/pdbr
import sys
from django.conf import settings
from django.core.exceptions import MiddlewareNotUsed
from pdbr.__main__ import post_mortem
class PdbrMiddleware:
def __init__(self, get_response):
if not settings.DEBUG:
raise MiddlewareNotUsed()
self.get_response... |
alipay/aop/api/domain/AlipayFinancialnetAuthPaymentNotifyModel.py | antopen/alipay-sdk-python-all | 213 | 11098288 | <reponame>antopen/alipay-sdk-python-all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayFinancialnetAuthPaymentNotifyModel(object):
def __init__(self):
self._basic_amount = None
self._benefit_amount = None
self._b... |
tensorflow_datasets/core/proto/feature_generated_pb2.py | justHungryMan/datasets | 3,380 | 11098291 | # coding=utf-8
# Copyright 2021 The TensorFlow Datasets 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
kafka/tools/protocol/requests/join_group_v1.py | akashvacher/kafka-tools | 578 | 11098299 | # 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
# "License"); you may not u... |
config/patient_otp_token.py | gigincg/care | 189 | 11098300 | <filename>config/patient_otp_token.py
from rest_framework_simplejwt.tokens import Token
from datetime import timedelta
class PatientToken(Token):
lifetime = timedelta(hours=1)
token_type = "patient_login"
|
pylibs/lmdb_util/__init__.py | leoshine/Spherical_Regression | 133 | 11098322 | <gh_stars>100-1000
"""
@Author : <NAME>
"""
from basic.common import env
from .imagedata_lmdb import ImageData_lmdb
|
examples/00-mapdl-examples/3d_plate_thermal.py | RGPATCHI/pymapdl | 194 | 11098329 | """
.. _ref_3d_plate_thermal:
Basic Thermal Analysis with pyMAPDL
-----------------------------------
This example demonstrates how you can use MAPDL to create a plate,
impose thermal boundary conditions, solve, and plot it all within
pyMAPDL.
First, start MAPDL as a service and disable all but error messages.
"""
... |
thespian/system/systemBase.py | dendron2000/Thespian | 210 | 11098368 | '''The systemBase provides the base class implementation for standard
system Base implementations. This systemBase itself is not intended
to be instantiated as the regular Thespian System Base, but instead it
provides a base class that should be subclassed by the various System
Base implementations.
'''
import loggi... |
analysis_engine.py | pbiernat/ripr | 338 | 11098381 | '''
This code should encapsulate product specific API's so that they
can be accessed in other components cleanly.
'''
# Try to import stuff.
try:
from binaryninja import *
except:
print ("[!!] Not running in Binary Ninja")
try:
import r2pipe
except:
print ("[!!] Not running in Radare2")
impo... |
recipes/Python/578557_Pythlist_files_their_path_folders/recipe-578557.py | tdiprima/code | 2,023 | 11098383 | # Required module
import os
# Function for getting files from a folder
def fetchFiles(pathToFolder, flag, keyWord):
''' fetchFiles() requires three arguments: pathToFolder, flag and keyWord
flag must be 'STARTS_WITH' or 'ENDS_WITH'
keyWord is a string to search the file's name
Be careful, the keyWord is case ... |
evaluate/previous_works/Utils/SpherePad.py | Syniez/Joint_360depth | 167 | 11098389 | import os
import sys
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from .Equirec2Cube import Equirec2Cube
class SpherePad(nn.Module):
def __init__(self, pad_size):
super(SpherePad, self).__init__()
self.pad_size = pad_size
... |
tests/unit/test_metadata.py | ajw0100/professional-services-data-validator | 167 | 11098439 | # 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, ... |
gen_partial_dataset.py | LT1st/ReID_Alined_beginer | 370 | 11098481 | import cv2
import os
import numpy as np
data_root = "/home/csc302/workspace/luohao/code/AlignedReID/data/market1501/query"
gen_root = "/home/csc302/workspace/luohao/code/AlignedReID/data/market1501_partial/query"
def random_crop(img, sample_rate=0.6):
h,w = img.shape[:2]
sh = np.random.randint(sample_rate*h, ... |
freight/models/user.py | armandomeeuwenoord/freight | 562 | 11098518 | <filename>freight/models/user.py
from datetime import datetime
from sqlalchemy import Column, DateTime, Integer, String
from freight.config import db
class User(db.Model):
__tablename__ = "user"
id = Column(Integer, primary_key=True)
name = Column(String(200), nullable=False, unique=True)
date_creat... |
get_search_data.py | Solitarliy/GenshinMapAutoMarkTools | 167 | 11098535 | <gh_stars>100-1000
import os
import re
from fuzzywuzzy import process
from xpinyin import Pinyin
base_dir = os.path.dirname(os.path.abspath(__file__))
name_list=[]
def listname():
global name_list
if len(name_list):
return name_list;
file_name = os.listdir(r'{0}\data'.format(base... |
code/Evaluation/evaluation.py | INK-USC/DS-RelationExtraction | 156 | 11098548 | <filename>code/Evaluation/evaluation.py
__author__ = 'xiang'
import sys
from collections import defaultdict
def find_none_index(file_name):
with open(file_name) as f:
for line in f:
entry = line.strip('\r\n').split('\t')
if entry[0] == 'None':
return int(entry[1])
... |
py-server/src/controller/__init__.py | Jonnytoshen/wind-layer | 285 | 11098550 | <reponame>Jonnytoshen/wind-layer
from src.app import app
import src.controller.index
import src.controller.process
# app.register_blueprint(index, url_prefix='/')
|
tests/test_dfp_get_orders.py | Pubmatic-Dhruv-Sonone/dfp-prebid-setup | 111 | 11098574 | <reponame>Pubmatic-Dhruv-Sonone/dfp-prebid-setup
#!/usr/bin/env python
from unittest import TestCase
from mock import MagicMock, Mock, patch
import dfp.get_orders
@patch('googleads.ad_manager.AdManagerClient.LoadFromStorage')
class DFPServiceTests(TestCase):
def test_get_all_orders(self, mock_dfp_client):
""... |
terrascript/data/gridscale/gridscale.py | mjuenema/python-terrascript | 507 | 11098635 | # terrascript/data/gridscale/gridscale.py
# Automatically generated by tools/makecode.py (24-Sep-2021 15:17:40 UTC)
import terrascript
class gridscale_backup_list(terrascript.Data):
pass
class gridscale_backupschedule(terrascript.Data):
pass
class gridscale_firewall(terrascript.Data):
pass
class gri... |
beanie/odm/operators/find/__init__.py | yo-mo/beanie | 574 | 11098641 | from abc import ABC
from beanie.odm.operators import BaseOperator
class BaseFindOperator(BaseOperator, ABC):
...
|
test/clustering/test_pqkmeans.py | Hi-king/pqkmeans | 224 | 11098659 | import unittest
import pqkmeans
import numpy
import collections
import pickle
class TestPQKMeans(unittest.TestCase):
def data_source(self, n: int):
for i in range(n):
yield [i * 100] * 6
def setUp(self):
# Train PQ encoder
self.encoder = pqkmeans.encoder.PQEncoder(num_subd... |
data_structures/queues/tests/test_array_based_queue.py | vinta/fuck-coding-interviews | 590 | 11098665 | <reponame>vinta/fuck-coding-interviews
# coding: utf-8
import unittest
from data_structures.queues.array_based_queue import ArrayBasedQueue
class TestCase(unittest.TestCase):
def setUp(self):
self.queue = ArrayBasedQueue()
def test_enqueue(self):
self.queue.enqueue(0)
self.queue.enqu... |
deepy/layers/maxout.py | uaca/deepy | 260 | 11098689 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import theano.tensor as T
from . import NeuralLayer
from dense import Dense
class Maxout(NeuralLayer):
"""
Maxout activation unit.
- http://arxiv.org/pdf/1302.4389.pdf
"""
def __init__(self, output_dim=None, num_pieces=4, init=None, linear_transform=T... |
slybot/slybot/randomproxy.py | rmdes/portia-dashboard | 223 | 11098709 | # Copyright (C) 2013 by <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... |
setup.py | Jaykingamez/evennia | 1,544 | 11098726 | import os
import sys
from setuptools import setup, find_packages
os.chdir(os.path.dirname(os.path.realpath(__file__)))
VERSION_PATH = os.path.join("evennia", "VERSION.txt")
OS_WINDOWS = os.name == "nt"
def get_requirements():
"""
To update the requirements for Evennia, edit the requirements.txt file.
""... |
mxnet/test/gen_py_json.py | yaozhang2016/deepwater | 317 | 11098740 | <gh_stars>100-1000
import mxnet as mx
import importlib
for name in ["alexnet", "googlenet", "inception-bn", "inception-v3", "lenet", "mlp", "resnet", "vgg"]:
net = importlib.import_module("symbol_" + name).get_symbol(10)
net.save("symbol_" + name + "-py.json")
name = "unet"
net = importlib.import_module("symb... |
tests/fixers/test_utils_encoding.py | barseghyanartur/django-upgrade | 284 | 11098743 | from __future__ import annotations
from django_upgrade.data import Settings
from tests.fixers.tools import check_noop, check_transformed
settings = Settings(target_version=(3, 0))
def test_no_deprecated_alias():
check_noop(
"""\
from django.utils.encoding import something
something("yad... |
habitat_baselines/motion_planning/mp_spaces.py | jturner65/habitat-api | 489 | 11098756 | import os
import os.path as osp
from abc import ABC, abstractmethod
from typing import Any, Dict, Iterable, List, Tuple, Union
import numpy as np
from PIL import Image
from habitat.tasks.rearrange.rearrange_sim import RearrangeSim
from habitat.tasks.rearrange.utils import IkHelper
from habitat_baselines.motion_planni... |
test_protocol/megaface/face_cropper/crop_eye.py | weihaoxie/FaceX-Zoo | 1,329 | 11098766 | <reponame>weihaoxie/FaceX-Zoo
"""
@author: <NAME>
@date: 20201014
@contact: <EMAIL>
"""
import os
import cv2
def crop_facescrub(facescrub_root, facescrub_img_list, target_folder):
facescrub_img_list_buf = open(facescrub_img_list)
line = facescrub_img_list_buf.readline().strip()
while line:
image_p... |
examples/multitag_web_scraper.py | dimanil/fast_request | 857 | 11098790 | from faster_than_requests import scraper2
print(scraper2(["https://nim-lang.org", "https://nim-lang.org"], list_of_tags=["h1", "a"], case_insensitive=False, deduplicate_urls=False))
|
files-to-c-arrays.py | suraj-testing2/Toilet_Video_games | 146 | 11098802 | <filename>files-to-c-arrays.py
#!/usr/bin/env python
# Copyright 2013 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/L... |
dependency.py | pbiernat/ripr | 338 | 11098810 | <reponame>pbiernat/ripr
'''
Code in this file deals with finding data and/or other code that must be
included in the emulation environment for the target code to be able to run
properly.
'''
from .analysis_engine import aengine as ae
# Try to import stuff.
try:
from binaryninja import *
except:
pr... |
scripts/reader/train.py | rajarshd/Multi-Step-Reasoning | 122 | 11098814 | #!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Main DrQA reader training script."""
import socket
import argparse
import torch
import numpy as np
import j... |
hypergan/modules/no_op.py | limberc/HyperGAN | 889 | 11098842 | <filename>hypergan/modules/no_op.py
import torch.nn as nn
class NoOp(nn.Module):
def __init__(self):
super(NoOp, self).__init__()
def forward(self, x):
return x
|
test cases/common/150 reserved targets/runtarget/echo.py | kira78/meson | 4,047 | 11098924 | <gh_stars>1000+
#!/usr/bin/env python3
import sys
if len(sys.argv) > 1:
print(sys.argv[1])
|
buildroot/support/testing/tests/package/test_python_pytest.py | superm1/operating-system | 349 | 11098934 | <gh_stars>100-1000
import os
from tests.package.test_python import TestPythonPackageBase
class TestPythonPy3Pytest(TestPythonPackageBase):
__test__ = True
config = TestPythonPackageBase.config + \
"""
BR2_PACKAGE_PYTHON3=y
BR2_PACKAGE_PYTHON_PYTEST=y
"""
sample_scripts = [... |
planet/api/exceptions.py | karrabatcheller/planet-client-python | 210 | 11098955 | <filename>planet/api/exceptions.py
# Copyright 2015 Planet Labs, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
snippets/ch09/graph.py | megtatehh/atap | 360 | 11098968 | <gh_stars>100-1000
#!/usr/bin/env python3
import heapq
import collections
import seaborn as sns
import networkx as nx
import matplotlib.pyplot as plt
from operator import itemgetter
from entities import pairs
from reader import PickledCorpusReader
def graph(corpus):
# Create an undirected graph
G = nx.Grap... |
poco/drivers/unity3d/test/tutorial/overview.py | HBoPRC/Poco | 1,444 | 11098974 | <gh_stars>1000+
# coding=utf-8
import time
from poco.drivers.unity3d.test.tutorial.case import TutorialCase
class OverviewTutorial(TutorialCase):
def runTest(self):
self.poco('btn_start').click()
time.sleep(1)
self.poco(textMatches='drag.*').click()
time.sleep(1)
shell =... |
examples/pybullet/examples/vr_kuka_setup.py | stolk/bullet3 | 158 | 11099003 | <reponame>stolk/bullet3<filename>examples/pybullet/examples/vr_kuka_setup.py
import pybullet as p
import time
#p.connect(p.UDP,"192.168.86.100")
cid = p.connect(p.SHARED_MEMORY)
if (cid < 0):
p.connect(p.GUI)
p.resetSimulation()
#disable rendering during loading makes it much faster
p.configureDebugVisualizer(p.COV_... |
core/csrc/fps/setup.py | AlbertoRemus/GDR_Net | 132 | 11099011 | <filename>core/csrc/fps/setup.py<gh_stars>100-1000
import os
from cffi import FFI
os.system(
"gcc -shared src/farthest_point_sampling.cpp -c -o src/farthest_point_sampling.cpp.o -fopenmp -fPIC -O2 -std=c++11"
)
ffibuilder = FFI()
with open(os.path.join(os.path.dirname(__file__), "src/ext.h")) as f:
ffibuild... |
chainer_chemistry/dataset/preprocessors/base_preprocessor.py | pfnet/chainerchem | 184 | 11099033 | <filename>chainer_chemistry/dataset/preprocessors/base_preprocessor.py<gh_stars>100-1000
"""
Preprocessor supports feature extraction for each model (network)
"""
class BasePreprocessor(object):
"""Base class for preprocessor"""
def __init__(self):
pass
def process(self, filepath):
pass
|
eval/eval_exp.py | urasakikeisuke/rigidmask | 138 | 11099041 | <filename>eval/eval_exp.py
import glob
import os
import sys
sys.path.insert(0,os.getcwd())
import numpy as np
from matplotlib import pyplot as plt
from utils.flowlib import read_flow, flow_to_image
from utils.util_flow import write_flow, readPFM
import cv2
import pdb
import PIL.Image as Image
from dataloader.robloader... |
tools/autograd/templates/annotated_fn_args.py | deltabravozulu/pytorch | 206 | 11099094 | <gh_stars>100-1000
"""
This file is needed for generating procedural tests required for
testing __torch_function__. See tests/test_overrides.py.
"""
# flake8: noqa
import torch
annotated_args = {
${annotated_args}
}
|
src/genie/libs/parser/iosxe/tests/ShowNetconfYangDatastores/cli/equal/golden_output_expected.py | balmasea/genieparser | 204 | 11099130 | expected_output = {
'datastores': {
'names': [
'running',
'candidate'
]
}
}
|
problems/20/problem_20.py | r1cc4rdo/daily_coding_problem | 158 | 11099141 | <filename>problems/20/problem_20.py
def coding_problem_20(list_a, list_b):
"""
Given two singly linked lists that intersect at some point, find the intersecting node.
Do this in O(M + N) time (where M and N are the lengths of the lists) and constant space.
For example, given A = 3 -> 7 -> 8 -> 10 -> 1 a... |
tests/conftest.py | Itsindigo/rele | 183 | 11099149 | import concurrent
import decimal
import json
from unittest.mock import MagicMock, patch
import pytest
from google.cloud.pubsub_v1 import PublisherClient
from google.cloud.pubsub_v1.exceptions import TimeoutError
from rele import Publisher
from rele.client import Subscriber
from rele.config import Config
from rele.mid... |
PyEngine3D/OpenGLContext/Shader.py | ubuntunux/PyEngine3D | 121 | 11099150 | # reference - http://www.labri.fr/perso/nrougier/teaching/opengl
import codecs
import configparser
from collections import OrderedDict
import copy
import os
import re
import traceback
import uuid
from OpenGL.GL import *
from PyEngine3D.Common import logger
from PyEngine3D.Utilities import GetClassName, Attributes, Lo... |
backdoors/access/ssh_key.py | mehrdad-shokri/backdoorme | 796 | 11099188 | from backdoors.backdoor import *
class SSHKey(Backdoor):
prompt = Fore.RED + "(sshkey) " + Fore.BLUE + ">> " + Fore.RESET
def __init__(self, core):
cmd.Cmd.__init__(self)
self.intro = GOOD + "Using ssh keys backdoor..."
self.core = core
self.options = {
}
... |
admintools/decorators.py | goztrk/django-htk | 206 | 11099234 | # Django Imports
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
def company_officer_required(view_func):
"""Decorator for views that require access by company officer or staff user
"""
@login_required
def wrapped_view(request, *args, **kwa... |
xnu-4903.241.1/tools/lldbmacros/kauth.py | DogeCoding/iOSCompiledRuntime | 672 | 11099281 | <filename>xnu-4903.241.1/tools/lldbmacros/kauth.py<gh_stars>100-1000
""" Please make sure you read the README file COMPLETELY BEFORE reading anything below.
It is very critical that you read coding guidelines in Section E in README file.
"""
from xnu import *
from utils import *
# Macro: walkkauthcache
@lldb_comm... |
atlas/testing/acceptance/cleanup.py | DeepLearnI/atlas | 296 | 11099284 |
from common.cleanup import cleanup |
tools/tpm2_pkcs11/tpm2_ptool.py | shearl/tpm2-pkcs11 | 155 | 11099298 | <gh_stars>100-1000
# SPDX-License-Identifier: BSD-2-Clause
from .command import commandlet
# These imports are required to add the commandlet even though they appear unused
# Store level commands
from .commandlets_store import InitCommand # pylint: disable=unused-import # noqa
from .commandlets_store import DestroyCo... |
src/gino/aiocontextvars.py | maestro-1/gino | 1,376 | 11099310 | <filename>src/gino/aiocontextvars.py<gh_stars>1000+
import asyncio
import contextvars
import sys
import types
def patch_asyncio():
"""Patches asyncio to support :mod:`contextvars`.
This is automatically called when :mod:`gino` is imported. If Python version is 3.7
or greater, this function is a no-op.
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.