max_stars_repo_path stringlengths 3 269 | max_stars_repo_name stringlengths 4 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.05M | score float64 0.23 5.13 | int_score int64 0 5 |
|---|---|---|---|---|---|---|
Python/ComplexPaths02/src/main/MainModule01.py | tduoth/JsObjects | 22 | 21000 | <gh_stars>10-100
'''
Created on May 26, 2012
@author: Charlie
'''
class MainModule01(object):
def __init__(self):
pass | 1.164063 | 1 |
examples/image_dataset_create.py | praekelt/feersum-nlu-api-wrappers | 9 | 21001 | <filename>examples/image_dataset_create.py
""" Example: Shows how to create and use an image dataset. """
import urllib3
import feersum_nlu
from feersum_nlu.rest import ApiException
from examples import feersumnlu_host, feersum_nlu_auth_token
# from feersum_nlu_util import image_utils
# Configure API key ... | 2.859375 | 3 |
tests/test_resource_base.py | neteler/actinia_statistic_plugin | 3 | 21002 | # -*- coding: utf-8 -*-
import atexit
import os
import signal
import time
from flask_restful import Api
from actinia_core.testsuite import ActiniaTestCaseBase, URL_PREFIX
from actinia_core.core.common.config import global_config
from actinia_core.core.common.app import flask_app, flask_api
from actinia_statistic_plugin... | 1.914063 | 2 |
interpreter/code/tests/test_basic.py | yunkai123/my-500lines-notes | 0 | 21003 | <gh_stars>0
""" Byterund 的基本测试"""
import vmtest
class It(vmtest.VmTestCase):
def test1(self):
self.assert_ok("""\
class Thing(object):
@staticmethod
def smeth(x):
print(x)
@classmethod
def cmeth(cls, x):
... | 3.03125 | 3 |
core/recc/compile/future.py | bogonets/answer | 3 | 21004 | # -*- coding: utf-8 -*-
from importlib import import_module
def get_annotations_compiler_flag() -> int:
future = import_module("__future__")
assert future is not None
annotations = getattr(future, "annotations")
assert annotations is not None
compiler_flag = getattr(annotations, "compiler_flag")
... | 2.375 | 2 |
genesis/objects/integrate.py | leifdenby/uclales-extractor | 0 | 21005 | <gh_stars>0
import os
import warnings
import xarray as xr
import numpy as np
# forget about using dask for now, dask_ndmeasure takes a huge amount of memory
# try:
# # raise ImportError
# # import dask_ndmeasure as ndimage
# # register a progressbar so we can see progress of dask'ed operations with xarray
# from dask... | 2 | 2 |
current_console.py | jonasitzmann/ann-numpy | 0 | 21006 | <filename>current_console.py
from ann import *
x, y = utils.get_mnist_samples(100)
m = Model(x[0].shape)
m.add(Conv2D())
m.add(MaxPooling())
m.add(Flatten())
m.add(Dense(15))
m.add(Dense(10, a_func='sigmoid'))
| 2.640625 | 3 |
scripts/addon/generate_all.py | mozilla-releng/staging-mozilla-vpn-client | 0 | 21007 | #! /usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import hashlib
import json
import os
import subprocess
import sys
parser = argp... | 2.171875 | 2 |
meson_test.py | tp-m/meson | 0 | 21008 | <reponame>tp-m/meson<gh_stars>0
#!/usr/bin/env python3
# Copyright 2013-2015 The Meson development team
# 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... | 1.976563 | 2 |
2020/d05_1.py | PaulWichser/adventofcode | 0 | 21009 | <reponame>PaulWichser/adventofcode
import fileimp
# divide rows 0-127
# F = lower half
# B = upper half
# divide columns 0-7
# R = upper half
# L = lower half
# seat ID = row * 8 + col
# list of IDs
# max list
def idcalc(list):
seats = []
for i in list:
row = ''
col = ''
for j ... | 3.53125 | 4 |
src/morphforge/simulation/neuron/core/neuronsimulationenvironment.py | mikehulluk/morphforge | 1 | 21010 | <gh_stars>1-10
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Copyright (c) 2012 <NAME>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following condition... | 1.28125 | 1 |
news_topic_modeling_service/backfill.py | rishavgiri6/News4U | 2 | 21011 | import os
import sys
# import common package in parent directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
import mongodb_client
import news_topic_modeling_service_client
if __name__ == '__main__':
db = mongodb_client.get_db()
cursor = db['news'].find({})
count = 0
for ... | 2.0625 | 2 |
server/imagemagick-server/server.py | brygga-dev/workdir2 | 0 | 21012 | from http.server import BaseHTTPRequestHandler,HTTPServer
from socketserver import ThreadingMixIn
import threading
import subprocess
import urllib.parse
# todo: factor out common server stuff
# todo: these should probably have limited
# access to files, so something like only
# uploads dir may be good.
# then there i... | 2.46875 | 2 |
uberlearner/main/api/authentication.py | Uberlearner/uberlearner | 1 | 21013 | from tastypie.authentication import SessionAuthentication
class UberAuthentication(SessionAuthentication):
"""
Handles authentication for the course resources.
"""
def is_authenticated(self, request, **kwargs):
if request.method == 'GET':
return True
else:
return... | 2.484375 | 2 |
libs/yowsup/yowsup/yowsup/layers/axolotl/__init__.py | akshitpradhan/TomHack | 22 | 21014 | from .layer_send import AxolotlSendLayer
from .layer_control import AxolotlControlLayer
from .layer_receive import AxolotlReceivelayer
| 1.09375 | 1 |
accounts/models.py | MrEscape54/CRM | 0 | 21015 | <gh_stars>0
from django.db import models
from django.urls import reverse
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.core.validators import RegexValidator
from core import utils
from core.models import User
from contacts.models import Contact
... | 2.1875 | 2 |
Courses/HSEPython/8 week/5.py | searayeah/sublime-snippets | 0 | 21016 | <reponame>searayeah/sublime-snippets<filename>Courses/HSEPython/8 week/5.py
from functools import reduce
print(reduce(lambda x, y: x * (y**5), list(map(int, input().split())), 1))
| 2.90625 | 3 |
ros/src/twist_controller/twist_controller.py | SunshengGu/CarND-capstone-team-roboturtles | 0 | 21017 | <reponame>SunshengGu/CarND-capstone-team-roboturtles<gh_stars>0
from yaw_controller import YawController
from pid import PID
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, wheel_base, steer_ratio,max_lat_accel,max_steer_angle, accel_limit,decel_limit):
self.y... | 2.640625 | 3 |
samples/cordic/cordic_golden.py | hj424/heterocl | 236 | 21018 | <reponame>hj424/heterocl
import numpy as np
golden = np.array([
[100.0, 100.0],
[206.226840616, 179.610387213],
[1190.25124092, 1197.15702025],
[1250.76639667, 1250.3933971],
[1261.76760093, 1250.17718583],
[1237.4846285, 1237.56490579],
[1273.56730356, 1266.82141705],
[1272.899992, 1259.9258911... | 2.03125 | 2 |
src/game_client/conf.py | adapiekarska/network-pong | 2 | 21019 | """
User configuration file for the client.
"""
SERVER_ADDRESS = "127.0.0.1"
SERVER_PORT = 50000
| 1.414063 | 1 |
build/lib/Element/Element.py | sunnyyukaige/APP_automation_core | 0 | 21020 | <gh_stars>0
from selenium.common.exceptions import WebDriverException, NoSuchElementException
from Element.Waitor import Waitor
from Element.Find import Find
from Utilitys.WaitUtils import WaitUtils
class Element(Find):
def __init__(self, driver):
Find.__init__(self)
self.driver = driver
... | 2.65625 | 3 |
config/settings/prd.py | zhenghuihu/django-skeleton | 0 | 21021 | <filename>config/settings/prd.py
'''
production setting
'''
# include all base settings
from .base import * # pylint: disable=W0401,W0614
# include credentials (not included in repo)
from . import credentials as crd # pylint: disable=W0401,W0611
# disable debugging
DEBUG = False
# =================... | 1.796875 | 2 |
8. str_range/test_solution.py | dcragusa/WeeklyPythonExerciseB2 | 0 | 21022 | from solution import str_range
def test_same_start_end():
r = str_range('a', 'a')
assert iter(r) == r
assert ''.join(list(r)) == 'a'
def test_simple():
r = str_range('a', 'c')
assert ''.join(list(r)) == 'abc'
def test_simple_with_step():
r = str_range('a', 'c', 2)
assert ''.join(list(r... | 3.125 | 3 |
acs_test_suites/OTC/libs/pyunit/testlib/graphics/display_metrics_report_impl.py | wangji1/test-framework-and-suites-for-android | 8 | 21023 | <reponame>wangji1/test-framework-and-suites-for-android
'''
Copyright (C) 2018 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/LICENSE-2.0
?
Unles... | 2.015625 | 2 |
Anchors/Find and Replace in Anchor Names.py | juandelperal/Glyphs-Scripts | 0 | 21024 | #MenuTitle: Find And Replace In Anchor Names
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from builtins import str
__doc__="""
Replaces strings in anchor names of all selected glyphs.
"""
import vanilla
class SearchAndReplaceInAnchorNames( object ):
def __init__( self ):... | 3.15625 | 3 |
Python3/Coursera/003_quadratic_roots/solution.py | neon1ks/Study | 0 | 21025 | <reponame>neon1ks/Study<gh_stars>0
import sys
import math
if __name__ == '__main__':
a = int(sys.argv[1])
b = int(sys.argv[2])
c = int(sys.argv[3])
d = b * b - 4 * a * c
x1 = (-b + math.sqrt(d)) / (2 * a)
x2 = (-b - math.sqrt(d)) / (2 * a)
print(int(x1))
print(int(x2))
| 2.875 | 3 |
bigstream/features.py | wangyuhan01/bigstream | 14 | 21026 | <reponame>wangyuhan01/bigstream<gh_stars>10-100
import numpy as np
from fishspot.filter import white_tophat
from fishspot.detect import detect_spots_log
def blob_detection(
image,
min_blob_radius,
max_blob_radius,
**kwargs,
):
"""
"""
wth = white_tophat(image, max_blob_radius)
spots =... | 2.59375 | 3 |
.ycm_extra_conf.py | zaucy/bazel-compilation-database | 1 | 21027 | #!/usr/bin/python
# Copyright 2018 GRAIL, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | 2.015625 | 2 |
djasana/migrations/0007_alter_task_completed.py | dosoulwork/django-asana | 10 | 21028 | <filename>djasana/migrations/0007_alter_task_completed.py<gh_stars>1-10
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-29 17:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djasana', '0006_adds... | 1.242188 | 1 |
src/StatifyStats.py | beng92/Statify | 1 | 21029 | <reponame>beng92/Statify
'''
x Total plays
x Total artists
x Total unique songs
Average song per artist
x Favourite track
Favourite artist (by plays or time)
Favourite album (req. api)
Average/total/unique plays per range
Average/total/unique artists per range
Average/total time listened per range
Favouri... | 1.851563 | 2 |
web/src/yasg.py | Mikhail-Gorelov/chat_microservice | 1 | 21030 | <reponame>Mikhail-Gorelov/chat_microservice
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.urls import path
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
from rest_framework import permissions
from rest_framework.authentication import Ses... | 2 | 2 |
src/train.py | mohamedkeid/feed-forward-style-transfer | 92 | 21031 | <reponame>mohamedkeid/feed-forward-style-transfer
#!/usr/bin/python
"""
Author: <NAME> (<EMAIL>)
Description: trains a generative model for stylizing an unseen image input with a particular style
Args:
train: path to image with style to learn
"""
import argparse
import os
import tensorflow as tf... | 2.796875 | 3 |
xsnake/main.py | wcgbg/kids-keyboard | 0 | 21032 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import glob
import os
import pygame
import random
import subprocess
import time
import maze_map
MIN_MARGIN = 32
PROGRESS_BAR_HEIGHT = 8
SELF_DIR = os.path.dirname(os.path.realpath(__file__))
class Game:
def __init__(self, map_size: int, maze: bool... | 2.65625 | 3 |
flaskmodel/flask_book_project.py | JennyHan2016/ProxyPool | 0 | 21033 | from flask import Flask, render_template, flash,request,redirect,url_for
from flask_sqlalchemy import SQLAlchemy
from flaskmodel.config import *
from flask_wtf import FlaskForm
from wtforms import StringField,SubmitField
from wtforms.validators import DataRequired
app = Flask(__name__)
# 创建数据库连接
db = SQLAlchemy(app)
... | 2.546875 | 3 |
examples/simple_rest_nt.py | rob-blackbourn/bareASGI-tutorial | 1 | 21034 | <gh_stars>1-10
import asyncio
import json
from hypercorn.asyncio import serve
from hypercorn.config import Config
from bareasgi import Application, text_reader, text_writer
import bareutils.header as header
async def get_info(scope, info, matches, content):
accept = header.find(b'accept', scope['headers'])
i... | 2.34375 | 2 |
memory/build_memory.py | ngowilliam1/more-contrastive | 70 | 21035 | from .mem_bank import RGBMem, CMCMem
from .mem_moco import RGBMoCo, CMCMoCo
def build_mem(opt, n_data):
if opt.mem == 'bank':
mem_func = RGBMem if opt.modal == 'RGB' else CMCMem
memory = mem_func(opt.feat_dim, n_data,
opt.nce_k, opt.nce_t, opt.nce_m)
elif opt.mem == '... | 2.28125 | 2 |
Aves2/Aves2/celery.py | jd-aig/aves2 | 3 | 21036 | <filename>Aves2/Aves2/celery.py
# -*- coding:utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
from celery.schedules import crontab
# from celery_once import QueueOnce
# set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO... | 2.03125 | 2 |
hwtHls/ssa/translation/fromAst/astToSsa.py | Nic30/hwtHls | 8 | 21037 | from typing import Union, List, Optional, Tuple, Set
from hwt.hdl.operator import Operator
from hwt.hdl.operatorDefs import AllOps
from hwt.hdl.portItem import HdlPortItem
from hwt.hdl.statements.assignmentContainer import HdlAssignmentContainer
from hwt.hdl.statements.codeBlockContainer import HdlStmCodeBlockContaine... | 1.828125 | 2 |
pyvultr/v2/load_balance.py | luxiaba/pyvultr | 4 | 21038 | <reponame>luxiaba/pyvultr
from dataclasses import dataclass
from functools import partial
from typing import Dict, List, Optional
from urllib.parse import urljoin
from pyvultr.utils import BaseDataclass, VultrPagination, get_only_value, merge_args
from .base import BaseVultrV2, command
from .enums import LoadBalanceA... | 2.546875 | 3 |
test/test_k_apaxiaaans.py | ivanlyon/exercises | 0 | 21039 | import io
import unittest
from unittest.mock import patch
from kattis import k_apaxiaaans
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input_1(self):
'''Run and a... | 3 | 3 |
kata/Greeting My Friends [Arrays].py | DJO3/code_wars | 0 | 21040 | """
We give you an Array of friend's list.
Write a function called greeting_for_all_friends that takes one argument, friends.
This method takes an array of friends name and return a greeting messages Array.
Message sample: for the friend "Bilal" we get "Hello, Bilal!"
Rules:
If the argument is null, the method sho... | 4.46875 | 4 |
tests/test_transforms.py | rushyaP/pytorchvideo | 1 | 21041 | <reponame>rushyaP/pytorchvideo
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import unittest
from collections import Counter
import numpy as np
import torch
from pytorchvideo.data.utils import thwc_to_cthw
from pytorchvideo.transforms import (
ApplyTransformToKey,
Normalize,
OpSa... | 2.171875 | 2 |
udacity-program_self_driving_car_engineer_v1.0/project04-lane_detection_advanced/project/full_pipeline.py | linksdl/futuretec-project-self_driving_cars_projects | 0 | 21042 | """
# !/usr/bin/env python
# -*- coding: utf-8 -*-
@Time : 2022/2/24 20:12
@Author : <EMAIL>
@ProjectName : udacity-program_self_driving_car_engineer_v1.0_source.0
@File : full_pipeline.py
"""
import numpy as np
import cv2
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
im... | 2.9375 | 3 |
pyblaze/nn/data/__init__.py | Greenroom-Robotics/pyblaze | 20 | 21043 | import pyblaze.nn.data.extensions
from .noise import NoiseDataset, LabeledNoiseDataset
from .zip import ZipDataLoader
from .transform import TransformDataset
| 1.21875 | 1 |
main.py | MokkoFm/autoposting-comic-books | 0 | 21044 | <filename>main.py
import requests
import os
import random
from dotenv import load_dotenv
import sys
def get_response(url, payload):
try:
response = requests.get(url, params=payload)
response.raise_for_status()
except requests.HTTPError:
sys.stderr.write("Error with URL\n")
return ... | 3.015625 | 3 |
google-cloud-sdk/platform/gsutil/gslib/commands/notification.py | KaranToor/MA450 | 1 | 21045 | <reponame>KaranToor/MA450<gh_stars>1-10
# -*- coding: utf-8 -*-
# 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... | 1.75 | 2 |
src/mecanum_robot_gazebo/src/tool/pingpong_utils.py | diddytpq/Predict-Tennisball-LandingPoint | 0 | 21046 | <reponame>diddytpq/Predict-Tennisball-LandingPoint<filename>src/mecanum_robot_gazebo/src/tool/pingpong_utils.py
import rospy
import sys
from gazebo_msgs.srv import *
from geometry_msgs.msg import *
import tf.transformations as tft
import numpy as np
import math
import roslib
from std_msgs.msg import Empty as EmptyMsg
f... | 2.28125 | 2 |
kirbyClass.py | mattuff/KirbyCalculus | 1 | 21047 | <filename>kirbyClass.py
from crossingClass import *
from joinClass import *
from strandClass import *
from componentClass import *
class Kirby:
def __init__(self,crossings,joins):
self.crossings=crossings
self.joins=joins
strands=[] #makes list of strands
for c in crossings:
for i ... | 2.921875 | 3 |
projects/migrations/0017_project_status_isvalidated.py | joatuapp/joatu-django | 10 | 21048 | <reponame>joatuapp/joatu-django
# Generated by Django 2.0.3 on 2018-03-26 01:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0016_auto_20180325_2116'),
]
operations = [
migrations.AddField(
model_name='project... | 1.585938 | 2 |
ps1/ps1_3.py | collin-li/mitx-6.00.1x | 0 | 21049 | # PROBLEM
#
# Assume s is a string of lower case characters.
#
# Write a program that prints the longest substring of s in which the letters
# occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your
# program should print:
#
# 'Longest substring in alphabetical order is: beggh'
#
# In case of ti... | 4.28125 | 4 |
bib2web/mandatory_fields.py | Juvawa/bib2web | 0 | 21050 | <reponame>Juvawa/bib2web
mandatory = \
{
'article' : ['ENTRYTYPE', 'ID', 'author', 'title', 'journal', 'year', 'volume'],
'book' : ['ENTRYTYPE', 'ID', 'title', 'publisher', 'year'],
'booklet' : ['ENTRYTYPE', 'ID', 'title', 'year'],
'conference' : ['ENTRYTYPE', 'ID', 'author', 'title', 'booktitle', 'publisher',... | 1.5 | 2 |
trainAndTest/processOneFold_sm.py | rsanchezgarc/BIPSPI | 5 | 21051 | <reponame>rsanchezgarc/BIPSPI<filename>trainAndTest/processOneFold_sm.py
from __future__ import print_function
import itertools
import sys, os
import inspect
import numpy as np
from joblib import load as joblib_load
from .resultsManager import ResultsManager
#from .classifiers.randomForest import trainMethod, predict... | 2.4375 | 2 |
manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py | openstack/manila-tempest-plugin | 9 | 21052 | <filename>manila_tempest_tests/tests/api/admin/test_snapshot_export_locations_negative.py
# Copyright (c) 2017 <NAME>, 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 th... | 1.773438 | 2 |
gateway/spvtable.py | trinity-project/trinity | 60 | 21053 | """Author: Trinity Core Team
MIT License
Copyright (c) 2018 Trinity
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,... | 1.820313 | 2 |
src/apps/startposes/models/__init__.py | sanderland/katago-server | 27 | 21054 | <filename>src/apps/startposes/models/__init__.py<gh_stars>10-100
from .startpos import StartPos, StartPosCumWeightOnly
| 1.226563 | 1 |
python/chronos/test/bigdl/chronos/autots/test_tspipeline.py | joan726/BigDL | 3 | 21055 | <filename>python/chronos/test/bigdl/chronos/autots/test_tspipeline.py<gh_stars>1-10
#
# Copyright 2016 The BigDL 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.ap... | 1.890625 | 2 |
src/app/QKeithleySweep.py | mwchalmers/QKeithleyControl | 6 | 21056 | # ---------------------------------------------------------------------------------
# QKeithleySweep -> QVisaApplication
# Copyright (C) 2019 <NAME>
# github: https://github.com/mesoic
# email: <EMAIL>
# ---------------------------------------------------------------------------------
#
# Permission is hereby grant... | 1.273438 | 1 |
tests/fields/test_render.py | jpsca/pforms | 2 | 21057 | <reponame>jpsca/pforms<gh_stars>1-10
import proper_forms.fields as f
def test_render_attrs():
field = f.Text()
attrs = {
"id": "text1",
"classes": "myclass",
"data_id": 1,
"checked": True,
"ignore": False,
}
assert (
str(field.render_attrs(**attrs))
... | 2.53125 | 3 |
gerber.py | BetaPollux/gerbex | 0 | 21058 | #!/usr/bin/python3
# RS-274X per standard Revision 2021.02
import re
import copy
import numpy as np
import vertices
# TODO replace all vertices with outline class
# Meant for extracting substrings only
# Cast to int or float will catch invalid strings
RE_INT = r'[+-]?[0-9]+'
RE_DEC = r'[+-]?[0-9\.]+?'
EXPOSURE_ON... | 2.328125 | 2 |
angrmanagement/ui/menus/disasm_insn_context_menu.py | yuzeming/angr-management | 474 | 21059 | from functools import partial
from typing import Callable
from typing import TYPE_CHECKING
from ...config import Conf
from .menu import Menu, MenuEntry, MenuSeparator
if TYPE_CHECKING:
from ...ui.views.disassembly_view import DisassemblyView
class DisasmInsnContextMenu(Menu):
"""
Dissembly Instruction's ... | 2.28125 | 2 |
src/panoptes/pocs/base.py | sarumanplaysguitar/POCS | 0 | 21060 | from requests.exceptions import ConnectionError
from panoptes.pocs import __version__
from panoptes.utils.database import PanDB
from panoptes.utils.config import client
from panoptes.pocs.utils.logger import get_logger
from panoptes.pocs import hardware
# Global database.
PAN_DB_OBJ = None
class PanBase(object):
... | 2.390625 | 2 |
src/metarl/envs/multi_env_wrapper.py | icml2020submission6857/metarl | 2 | 21061 | """A wrapper env that handles multiple tasks from different envs.
Useful while training multi-task reinforcement learning algorithms.
It provides observations augmented with one-hot representation of tasks.
"""
import random
import akro
import gym
import numpy as np
def round_robin_strategy(num_tasks, last_task=No... | 3.09375 | 3 |
MyNewHandTracking.py | Hai-Hoang-88/HandTracking | 0 | 21062 | <filename>MyNewHandTracking.py<gh_stars>0
import cv2
import mediapipe as mp
import time
import HandTracking_module as htm
# initiate time
pTime = 0
cTime = 0
cap = cv2.VideoCapture(0) # 0 is internal camera, while 1 is external camera
detector = htm.handDetector()
while True:
success, img = cap.read()
... | 2.765625 | 3 |
exercises/en/solution_07_23.py | hfboyce/MCL-DSCI-571-machine-learning | 1 | 21063 | import numpy as np
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from sklearn.model_selection import train_test_split, cross_validate
from sklearn.preprocessing import OneHotEncoder, StandardScaler, OrdinalEncoder
from sklearn.impute import SimpleImputer
from sklearn... | 3.015625 | 3 |
src/algorithm/__init__.py | ShogoAkiyama/metaworld.pytorch | 0 | 21064 | <filename>src/algorithm/__init__.py
from .sac import SAC
from .eval import EvalAlgorithm
| 1.132813 | 1 |
Parallel_POD/online_svd_parallel.py | Romit-Maulik/Tutorials-Demos-Practice | 8 | 21065 | import numpy as np
np.random.seed(10)
import matplotlib.pyplot as plt
from mpi4py import MPI
# For shared memory deployment: `export OPENBLAS_NUM_THREADS=1`
# Method of snapshots
def generate_right_vectors(A):
'''
A - Snapshot matrix - shape: NxS
returns V - truncated right singular vectors
'''
ne... | 2.25 | 2 |
joboffers/models.py | Devecoop/pyarweb | 1 | 21066 | import html
import json
import re
from datetime import date
from autoslug import AutoSlugField
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MinLengthValidator
from django.db.models.aggregates import Count
from django.db import models
fr... | 1.835938 | 2 |
lib/networks/ResNet101_HICO.py | zhihou7/VCL | 29 | 21067 | <reponame>zhihou7/VCL<gh_stars>10-100
# --------------------------------------------------------
# Tensorflow VCL
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>, based on code from Transferable-Interactiveness-Network, <NAME>, <NAME> and <NAME>
# -----------------------------------------... | 1.84375 | 2 |
nova_powervm/tests/virt/powervm/test_mgmt.py | openstack/nova-powervm | 24 | 21068 | # Copyright 2015, 2017 IBM Corp.
#
# 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... | 1.679688 | 2 |
tools.py | fairuzap97/psgan | 29 | 21069 | <filename>tools.py
# -*- coding: utf-8 -*-
import sys, os
from time import time
def create_dir(folder):
'''
creates a folder, if necessary
'''
if not os.path.exists(folder):
os.makedirs(folder)
class TimePrint(object):
'''
Simple convenience class to print who long it takes between s... | 3.5 | 4 |
models/catch_event.py | THM-MA/XSDATA-waypoint | 0 | 21070 | from dataclasses import dataclass
from .t_catch_event import TCatchEvent
__NAMESPACE__ = "http://www.omg.org/spec/BPMN/20100524/MODEL"
@dataclass
class CatchEvent(TCatchEvent):
class Meta:
name = "catchEvent"
namespace = "http://www.omg.org/spec/BPMN/20100524/MODEL"
| 2 | 2 |
jarviscli/plugins/advice_giver.py | hugofpaiva/Jarvis | 0 | 21071 | import random
from plugin import plugin
ANSWERS = [
"No",
"Yes",
"You Can Do It!",
"I Cant Help You",
"Sorry To hear That, But You Must Forget :(",
"Keep It Up!",
"Nice",
"Dont Do It Ever Again",
"I Like It, Good Job",
"I Am Not Certain",
"Too Bad For You, Try To Find Something Else To Do And Enj... | 3.4375 | 3 |
PaddleRec/text_matching_on_quora/models/sse.py | suytingwan/models | 5 | 21072 | <gh_stars>1-10
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | 2.140625 | 2 |
pelicanconf.py | ChrisAD/attack-website | 9 | 21073 | #!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import json
import uuid
import sys
# import plugins
PLUGIN_PATHS = ['plugins']
PLUGINS = ['assets']
AUTHOR = 'MITRE'
SITENAME = 'ATT&CK'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'America/New_York'
DEFAULT_LANG = 'en'
THEME = '... | 2.015625 | 2 |
playbooks/roles/configure-vlan-for-ucsm-baremetal/configure_vlan_on_ucsm_bm.py | CiscoSystems/project-config-third-party | 2 | 21074 | import argparse
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf
from ucsmsdk.mometa.fabric.FabricVlan import FabricVlan
parser = argparse.ArgumentParser()
parser.add_argument('ucsm_ip')
parser.add_argument('username')
parser.add_argument('password')
parser.add_argument('... | 2.390625 | 2 |
test/propagation_warn_only_test.py | lechat/jenkinsflow | 0 | 21075 | # Copyright (c) 2012 - 2015 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from pytest import raises
from jenkinsflow.flow import serial, parallel, FailedChildJobException, FailedChildJobsException, Propagation, BuildResult
from .framework import api_select
from .framewo... | 1.703125 | 2 |
RestPy/ixnetwork_restpy/testplatform/sessions/ixnetwork/vport/interface/dhcpv4discoveredinfo/dhcpv4discoveredinfo.py | ralfjon/IxNetwork | 0 | 21076 |
# Copyright 1997 - 2018 by IXIA Keysight
#
# 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, p... | 1.679688 | 2 |
ThreeBotPackages/radicaleserver/radicale/config.py | jimbertools/jumpscaleX_threebot | 0 | 21077 | <reponame>jimbertools/jumpscaleX_threebot<filename>ThreeBotPackages/radicaleserver/radicale/config.py
# This file is part of Radicale Server - Calendar Server
# Copyright © 2008-2017 <NAME>
# Copyright © 2008 <NAME>
# Copyright © 2008 <NAME>
# Copyright © 2017-2019 Unrud <<EMAIL>>
#
# This library is free software: you... | 2.078125 | 2 |
code_hashers/attendant.py | ksajan/iis-ms-del | 2 | 21078 | class ParkingLot:
def __init__(self, username, latitude, longitude, totalSpace, costHour):
self.username = username
self.latitude = latitude
self.longitude = longitude
self.totalSpace = totalSpace
self.availableSpace = totalSpace
self.costHour = costHour
def getS... | 3.09375 | 3 |
release/stubs.min/Autodesk/Revit/DB/Structure/__init___parts/AnalyticalModelStick.py | htlcnn/ironpython-stubs | 182 | 21079 | class AnalyticalModelStick(AnalyticalModel,IDisposable):
"""
An element that represents a stick in the structural analytical model.
Could be one of beam,brace or column type.
"""
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def GetAlignmentMethod(self,selector):
"""
GetA... | 2.734375 | 3 |
projects/nano_det/net/header.py | yunshangyue71/mycodes | 0 | 21080 | import torch
from torch import nn
from net.init_net import xavier_init
from net.basic_cnn import DWConvBnReluPool
"""
DW-DW-PW
"""
class Head(nn.Module):
def __init__(self,reg_max = 8, #defalut =8个bbox,用于分布, general focal loss format
inChannels = 96, #
clsOutChannels = 7):
... | 2.40625 | 2 |
hard-gists/1191457/snippet.py | jjhenkel/dockerizeme | 21 | 21081 | #!/usr/bin/env python
import urllib
import sys
import json
from mwlib import parser
from mwlib.refine import compat
if __name__ == "__main__":
params = urllib.urlencode({
"format": "json",
"action": "query",
"prop": "revisions",
"rvprop": "content",
"titles": "ISO_3166-1",
"rvsection": "4",
})
wc = urll... | 2.890625 | 3 |
ECC_main/platform/slack.py | dongh9508/ECC-main | 2 | 21082 | <filename>ECC_main/platform/slack.py
from .platformBase import PlatformBase
from django.http import HttpResponse, JsonResponse
from ECC_main.baseRequest import BaseRequest
import ECC_main.settings
import threading
import requests
class Slack(PlatformBase):
def slash_command(request, func):
token = re... | 2.171875 | 2 |
Classes/ex17.py | oDallas/PythomBR | 1 | 21083 | <filename>Classes/ex17.py
""""
Crie uma Fazenda de Bichinhos instanciando vários objetos bichinho e mantendo o controle deles através de uma lista.
Imite o funcionamento do programa básico, mas ao invés de exigis que o usuário tome conta de um único bichinho,
exija que ele tome conta da fazenda inteira. Cada opção do m... | 2.234375 | 2 |
train.py | Thanh-Hoo/Custom_train_PanNet | 0 | 21084 | '''
THis is the main training code.
'''
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set GPU id at the very begining
import argparse
import random
import math
import numpy as np
import torch
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torch.nn.functional as F
from torch.m... | 2.171875 | 2 |
bioprocs/scripts/chipseq/pPeakToRegPotential.py | pwwang/biopipen | 2 | 21085 | <filename>bioprocs/scripts/chipseq/pPeakToRegPotential.py
import math, gzip
peakfile = "{{peakfile}}"
genefile = "{{genefile}}"
arg_inst = {{args.signal | repr}}
arg_gf = "{{args.genefmt}}"
arg_pf = "{{args.peakfmt}}"
arg_wd = int({{args.window | repr}})
d0 = arg_wd / 2
assert (isinstance(arg_inst, bool))
... | 2.1875 | 2 |
parsifal/reviews/migrations/0014_auto_20150710_1445.py | michelav/parsifal | 1 | 21086 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('library', '0011_auto_20150706_0957'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | 1.757813 | 2 |
lua_protobuf/generator.py | JoJo2nd/lua-protobuf | 0 | 21087 | <reponame>JoJo2nd/lua-protobuf
# Copyright 2011 <NAME>
#
# 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 applicab... | 1.375 | 1 |
autoimpute/AutoImpute.py | milescsmith/AutoImpute | 0 | 21088 | <reponame>milescsmith/AutoImpute<filename>autoimpute/AutoImpute.py<gh_stars>0
import os
import numpy as np
import scipy.io
import tensorflow as tf
from sklearn.metrics import mean_absolute_error, mean_squared_error
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def autoimpute(data: str, debug: bool = True, debug_display_st... | 2.921875 | 3 |
began/train.py | imironhead/ml_gan | 8 | 21089 | <filename>began/train.py
"""
"""
import began
import glob
import os
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
def sanity_check():
"""
"""
if not os.path.isdir(FLAGS.portraits_dir_path):
raise Exception('invalid portraits directory')
def build_dataset_reader():
"""
"""
path... | 2.453125 | 2 |
custom/abt/reports/tests/test_fixture_utils.py | dimagilg/commcare-hq | 471 | 21090 | import doctest
from nose.tools import assert_equal, assert_true
from corehq.apps.fixtures.models import (
FieldList,
FixtureDataItem,
FixtureItemField,
)
from custom.abt.reports import fixture_utils
from custom.abt.reports.fixture_utils import (
dict_values_in,
fixture_data_item_to_dict,
)
def t... | 2.1875 | 2 |
test/test_edit_contact.py | Lenchik13/Testing | 0 | 21091 | <reponame>Lenchik13/Testing
from model.contact import Contact
import random
def test_edit_contact(app, db, check_ui):
app.open_home_page()
if app.contact.count() == 0:
app.contact.create(Contact(firstname="Contact", lastname="", nickname="",
address="", company="", home=""... | 2.671875 | 3 |
Source Codes Testing/list1.py | urstrulykkr/Python | 0 | 21092 | <reponame>urstrulykkr/Python
lst1=list()
lst1.append('K')
lst1.append('A')
lst2=['U', 'S', 'H', 'I', 'K']
print(lst1+lst2)
print(lst2[0] +lst2[1]+lst1[1])
for i in lst1+lst2:
print(i)
| 3.375 | 3 |
sintel_GANs/flow_cgan_sintel_ssim_uv.py | tanlinc/opticalFlowGAN | 1 | 21093 | import os, sys
sys.path.append(os.getcwd())
import time
import numpy as np
import tensorflow as tf
import tflib as lib
import tflib.ops.linear
import tflib.ops.conv2d
import tflib.ops.batchnorm
import tflib.ops.deconv2d
import tflib.save_images
import tflib.plot
import tflib.flow_handler as fh
import tflib.SINTELdata... | 2.140625 | 2 |
Development/Scripts/sobel_edge_regular.py | simonsimon006/tensorflow-wavelets | 0 | 21094 | <filename>Development/Scripts/sobel_edge_regular.py
import cv2
# Read the original image
img = cv2.imread('../input/LennaGrey.png', 1)
# Display original image
cv2.imshow('Original', img)
cv2.waitKey(0)
# Convert to graycsale
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Blur the image for better edge detection
... | 3.46875 | 3 |
src/python/pants/backend/terraform/target_types.py | danxmoran/pants | 0 | 21095 | # Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.engine.rules import collect_rules
from pants.engine.target import (
COMMON_TARGET_FIELDS,
Dependen... | 2.15625 | 2 |
src/mdns_client/util.py | bgamari/micropython-mdns | 22 | 21096 | <filename>src/mdns_client/util.py
import struct
import uasyncio
from mdns_client.constants import REPEAT_TYPE_FLAG, TYPE_CNAME, TYPE_MX, TYPE_NS, TYPE_PTR, TYPE_SOA, TYPE_SRV
def dotted_ip_to_bytes(ip: str) -> bytes:
"""
Convert a dotted IPv4 address string into four bytes, with
some sanity checks
"... | 2.921875 | 3 |
algorithms/selection_sort.py | maneeshd/Algorithms-and-DataStructures | 0 | 21097 | """
@author: <NAME>
@date: 11-Jul-17
@intepreter: Python 3.6
Worst Case Analysis: Selection Sort -> O(n^2)
"""
from timeit import Timer, default_timer
from random import shuffle
ARR = list()
def selection_sort(data):
"""Selection sort implementation"""
for i in range(len(data)):
min_pos = i
... | 3.921875 | 4 |
image_repo/migrations/0002_auto_20210505_1448.py | elena-kolomeets/Django-Repo | 0 | 21098 | <gh_stars>0
# Generated by Django 3.2 on 2021-05-05 12:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('image_repo', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='image',
name='colors',
... | 1.710938 | 2 |
ToricLearning/ising.py | danielfreeman11/thermal-toric-code | 6 | 21099 | <filename>ToricLearning/ising.py
"""
Ising model one-shot dynamics simulation.
From <NAME> (2016 http://arxiv.org/abs/1603.05005)
"""
import logging
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
#import isingutils.py
import random
from random import choice
import copy
... | 2.4375 | 2 |