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 |
|---|---|---|---|---|---|---|
zun/tests/unit/common/test_rpc.py | wanghuiict/zun | 83 | 19600 | <gh_stars>10-100
# Copyright 2017 OpenStack Foundation
# 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
#... | 2.078125 | 2 |
skidl/Pin.py | arjenroodselaar/skidl | 0 | 19601 | <filename>skidl/Pin.py
# -*- coding: utf-8 -*-
# MIT license
#
# Copyright (C) 2018 by XESS Corp.
#
# 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 lim... | 1.890625 | 2 |
Project1/cl1_p1_wsd.py | Sanghyun-Hong/NLPProjects | 0 | 19602 | <reponame>Sanghyun-Hong/NLPProjects<filename>Project1/cl1_p1_wsd.py
import numpy as np
import operator
# SHHONG: custom modules imported
import json
import random
import itertools
from math import pow, log
from collections import Counter
import os
import sys
sys.stdout = open(os.devnull, 'w')
"""
CMSC723 / INST725 / ... | 2.9375 | 3 |
Week 7 Web pages/Task05.py | retverd/python_hse | 0 | 19603 | <reponame>retverd/python_hse<filename>Week 7 Web pages/Task05.py
# Мы сохранили страницу с википедии про языки программирования и сохранили по адресу
# https://stepik.org/media/attachments/lesson/209717/1.html
#
# Скачайте её с помощью скрипта на Питоне и посчитайте, какой язык упоминается чаще Python или C++ (ответ до... | 3.046875 | 3 |
tests/test_bio/test_cell.py | jfaccioni/clovars | 0 | 19604 | <gh_stars>0
import unittest
from unittest import mock
from unittest.mock import MagicMock
from clovars.abstract import Circle
from clovars.bio import Cell, Treatment
from clovars.scientific import ConstantCellSignal, CellSignal, GaussianCellSignal, Gaussian
from clovars.utils import SimulationError
from tests import N... | 2.9375 | 3 |
nutsml/examples/pytorch_/mnist/mlp_train.py | maet3608/nuts-ml | 39 | 19605 | """
.. module:: cnn_train
:synopsis: Example nuts-ml pipeline for training a MLP on MNIST
"""
import torch
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
import nutsflow as nf
import nutsml as nm
import numpy as np
from nutsml.network import PytorchNetwork
from utils import downl... | 3.484375 | 3 |
get_image.py | DanielJamesEvans/spectrophotometer_code | 3 | 19606 | <reponame>DanielJamesEvans/spectrophotometer_code<filename>get_image.py
"""This code contains functions called by gui.py.
This software is licensed under the MIT license.
"""
import time
from picamera.array import PiRGBArray
from picamera import PiCamera
from gpiozero import LED
import numpy as np
from PIL import ... | 3.15625 | 3 |
rave_ec/Lib/ec_mcgill.py | DanielMichelson/drqc_article | 0 | 19607 | <gh_stars>0
'''
Copyright (C) 2016 The Crown (i.e. Her Majesty the Queen in Right of Canada)
This file is an add-on to RAVE.
RAVE is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the Li... | 1.554688 | 2 |
product/migrations/0001_initial.py | dnetochaves/e-commerce | 0 | 19608 | # Generated by Django 3.1.4 on 2020-12-27 15:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(... | 1.835938 | 2 |
src/python/setup.py | Basasuya/tsne-cuda | 2 | 19609 | <filename>src/python/setup.py
from setuptools import setup
setup(
name='tsnecuda',
version='2.1.0',
author='<NAME>., <NAME>., <NAME>.',
author_email='<EMAIL>',
packages=['tsnecuda', 'tsnecuda.test'],
package_data={'tsnecuda': ['libtsnecuda.so']},
scripts=[],
url='https://github.com/Cann... | 1.109375 | 1 |
src/python/pants/goal/initialize_reporting.py | WamBamBoozle/pants | 0 | 19610 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import errno
import ... | 1.859375 | 2 |
ResolvePageSwitcher.py | IgorRidanovic/DaVinciResolve-PageSwitcher | 17 | 19611 | <filename>ResolvePageSwitcher.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# DaVinci Resolve scripting proof of concept. Resolve page external switcher.
# Local or TCP/IP control mode.
# Refer to Resolve V15 public beta 2 scripting API documentation for host setup.
# Copyright 2018 <NAME>, www.hdhead.com
from Py... | 2.09375 | 2 |
Make Data Files.py | micitz/Dune_Aspect_Ratio_XB_Paper | 0 | 19612 | """
All the data sources are scattered around the D drive, this script
organizes it and consolidates it into the "Data" subfolder in the
"Chapter 2 Dune Aspect Ratio" folder.
<NAME>, 5/6/2020
"""
import shutil as sh
import pandas as pd
import numpy as np
import os
# Set the data directory to save files ... | 2.859375 | 3 |
counter-test-applications/lr100000/linear-regr-100k.py | EsperLiu/vPython | 1 | 19613 | def end_of_import():
return 0
def end_of_init():
return 0
def end_of_computing():
return 0
import numpy as np
from sklearn.linear_model import LinearRegression
end_of_import()
X = np.array(range(0,100000)).reshape(-1, 1)
# y = 2x + 3
y = np.dot(X, 2) + 3
end_of_init()
reg = LinearRegression().fit(X, y)... | 2.84375 | 3 |
python/bitcoin/ch04/04_08.py | gangserver/py_test | 0 | 19614 | import requests
url = "https://api.korbit.co.kr/v1/ticker/detailed?currency_pair=btc_krw"
r = requests.get(url)
bitcoin = r.json()
print(bitcoin)
print(type(bitcoin))
print(bitcoin['last'])
print(bitcoin['bid'])
print(bitcoin['ask'])
print(bitcoin['volume'])
| 2.828125 | 3 |
jackselect/indicator.py | SpotlightKid/jack-select | 12 | 19615 | <gh_stars>10-100
"""A convenience class for a GTK 3 system tray indicator."""
from pkg_resources import resource_filename
import gi
gi.require_version('Gtk', '3.0') # noqa
from gi.repository import Gtk
from gi.repository.GdkPixbuf import Pixbuf
class Indicator:
"""This class defines a standard GTK3 system tray... | 2.359375 | 2 |
myaxf/migrations/0011_minebtns_is_used.py | Pyrans/test1806 | 0 | 19616 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-11-06 01:54
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('myaxf', '0010_minebtns'),
]
operations = [
migrations.AddField(
... | 1.578125 | 2 |
components/PyTorch/pytorch-kfp-components/setup.py | nostro-im/pipelines | 2,860 | 19617 | <reponame>nostro-im/pipelines
#!/usr/bin/env/python3
#
# Copyright (c) Facebook, Inc. and its affiliates.
# 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.65625 | 2 |
generate_pipelines.py | phorne-uncharted/d3m-primitives | 0 | 19618 | """
Utility to get generate all submission pipelines for all primitives.
This script assumes that `generate_annotations.py` has already been run.
"""
import os
import subprocess
import shutil
import fire
from kf_d3m_primitives.data_preprocessing.data_cleaning.data_cleaning_pipeline import DataCleaningPipeline
from... | 1.96875 | 2 |
gorynych/ontologies/gch/edges/basic/__init__.py | vurmux/gorynych | 0 | 19619 | __all__ = [
"aggregation",
"association",
"composition",
"connection",
"containment",
"dependency",
"includes",
"membership",
"ownership",
"responsibility",
"usage"
] | 1.125 | 1 |
square.py | chriswilson1982/black-and-white | 0 | 19620 | <filename>square.py
# coding: utf-8
"""Square module.
Represents the squares on the game grid.
"""
from scene import *
from common import *
import sound
class Square (SpriteNode):
"""Represents the squares on the game grid.
Main properties are their row and column (used for path calculation) and state (corr... | 3.75 | 4 |
coocurrence_loader.py | miselico/KGlove | 2 | 19621 | <gh_stars>1-10
import pathlib
from struct import unpack
from typing import BinaryIO, List, Optional, Tuple, cast
import numpy as np
import scipy.sparse
def _read_little_endian_crec(file: BinaryIO
) -> Optional[Tuple[int, int, float]]:
le_int = file.read(16)
# https://docs.python.... | 2.703125 | 3 |
api_app/migrations/0001_initial.py | DurkinDevelopment/coinbase_api | 0 | 19622 | # Generated by Django 3.2.12 on 2022-02-15 02:57
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SpotPrice',
fields=[
('id', models.BigAuto... | 1.6875 | 2 |
Kalender/views.py | RamonvdW/nhb-apps | 1 | 19623 | # -*- coding: utf-8 -*-
# Copyright (c) 2021 <NAME>.
# All rights reserved.
# Licensed under BSD-3-Clause-Clear. See LICENSE file for details.
from django.views.generic import View
from django.urls import reverse
from django.http import HttpResponseRedirect
from Functie.rol import Rollen, rol_get_huidige
from .vie... | 2.28125 | 2 |
profile.py | giswqs/Depression-filling-1D | 1 | 19624 | <filename>profile.py
import os
import numpy as np
# class for depression
class Depression:
def __init__(self, id, width, depth, area, pour_elev, min_elev, points, internal_pts):
self.id = id
self.width = width
self.depth = depth
self.area = area
self.pour_elev = pour_elev
... | 3.40625 | 3 |
data/make_joint_comp_inc_data.py | gcunhase/StackedDeBERT | 32 | 19625 | import argparse
import os
import csv
import random
from utils import ensure_dir, get_project_path
from collections import defaultdict
# POS-tag for irrelevant tag selection
import nltk
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
__author__ = "<NAME>"
def write_tsv(intention_dir_path, filenam... | 2.625 | 3 |
recipes/models.py | JakubKoralewski/django-recipes | 0 | 19626 | <gh_stars>0
from typing import List, Dict, Union
from django.db import models
# Create your models here.
# https://en.wikipedia.org/wiki/Cooking_weights_and_measures
class AmountType(models.TextChoices):
GRAMS = ('g', 'grams')
KILOGRAMS = ('kg', 'kilograms')
MILLILITERS = ('ml', 'milliliters')
TABLE_SPOONS = ('... | 2.546875 | 3 |
zoneh/conf.py | RaminAT/zoneh | 8 | 19627 | <filename>zoneh/conf.py
"""Config module."""
import json
import logging
import os
from zoneh.exceptions import ConfigError
_log = logging.getLogger(__name__)
_CONFIG_FILE = 'config.json'
def _load_config():
"""Load telegram and filters configuration from config file."""
if not os.path.isfile(_CONFIG_FILE):... | 2.734375 | 3 |
mlogger.py | morris178/mqtt-data-logger | 0 | 19628 | ###demo code provided by <NAME> at www.steves-internet-guide.com
##email <EMAIL>
###Free to use for any purpose
"""
implements data logging class
"""
import time, os, json, logging
###############
class m_logger(object):
"""Class for logging data to a file. You can set the maximim bunber
of messages i... | 3.4375 | 3 |
ptools/lipytools/little_methods.py | piteren/ptools_module | 0 | 19629 | """
2018 (c) piteren
some little methods (but frequently used) for Python
"""
from collections import OrderedDict
import csv
import inspect
import json
import os
import pickle
import random
import shutil
import string
import time
from typing import List, Callable, Any, Optional
# prepares function parameters... | 3.296875 | 3 |
tests/test.py | zephenryus/botw-grass | 1 | 19630 | <reponame>zephenryus/botw-grass
import filecmp
import hashlib
import json
import grass
def grass_to_json():
"""
Tests reading of grass file and exports data as a json file
"""
data = grass.read_grass("assets/5000000000.grass.extm")
print("Saving file output/5000000000.grass.extm.json...")
wi... | 2.875 | 3 |
Control/control_common.py | TomE8/drones | 14 | 19631 |
class AxisIndex(): #TODO: read this value from config file
LEFT_RIGHT=0
FORWARD_BACKWARDS=1
ROTATE=2
UP_DOWN=3
class ButtonIndex():
TRIGGER = 0
SIDE_BUTTON = 1
HOVERING = 2
EXIT = 10
class ThresHold():
SENDING_TIME = 0.5 | 2.109375 | 2 |
tests/LayoutTest.py | lakhman/restructuredWeb | 2 | 19632 | <filename>tests/LayoutTest.py
# -*- coding: utf-8 -*-
from .BaseTest import BaseTest
class LayoutTest(BaseTest):
def test_layout_switch(self):
"""
Test layout switch
"""
self.do_component_fixture_test_with_real_sphinx('layout', 'layout')
def test_layout_multiple(self):
... | 2.046875 | 2 |
.leetcode/16.3-sum-closest.2.py | KuiyuanFu/PythonLeetCode | 0 | 19633 | # @lc app=leetcode id=16 lang=python3
#
# [16] 3Sum Closest
#
# https://leetcode.com/problems/3sum-closest/description/
#
# algorithms
# Medium (46.33%)
# Likes: 3080
# Dislikes: 169
# Total Accepted: 570.4K
# Total Submissions: 1.2M
# Testcase Example: '[-1,2,1,-4]\n1'
#
# Given an array nums of n integers and ... | 3.765625 | 4 |
test/test_functions/test_michalewicz.py | carefree0910/botorch | 0 | 19634 | #! /usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import unittest
import torch
from botorch.test_functions.michalewicz import (
GLOBAL_MAXIMIZER,
GLOBAL_MAXIMUM,
neg_michalewicz,
)
class TestNegMichalewicz(unittest.TestCase):
def test_single_eval_neg_mic... | 2.53125 | 3 |
example_scripts/write_mztab_result.py | gavswe/pyqms | 23 | 19635 | <reponame>gavswe/pyqms
#!/usr/bin/env python3
# encoding: utf-8
"""
pyQms
-----
Python module for fast and accurate mass spectrometry data quantification
:license: MIT, see LICENSE.txt for more details
Authors:
* <NAME>.
* <NAME>.
* <NAME>.
* <NAME>.
* <NA... | 2.734375 | 3 |
dbservice/dbprovider/MessageDAO.py | artyomche9/digest_bot | 11 | 19636 | from decimal import Decimal
from typing import List, Any
from common.Enums import SortingType
from models import Message
from .engine import db_engine, DBEngine
class MessageDAO:
def __init__(self, engine: DBEngine):
self.engine = engine
@staticmethod
def __make_insert_values_from_messages_array... | 2.265625 | 2 |
Chapter09/fuzzing.py | firebitsbr/Penetration-Testing-with-Shellcode | 30 | 19637 | #!/usr/bin/python
import socket
import sys
junk = 'A'*500
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
connect = s.connect(('192.168.129.128',21))
s.recv(1024)
s.send('USER '+junk+'\r\n')
| 2.1875 | 2 |
017. Letter Combinations of a Phone Number.py | youhusky/Facebook_Prepare | 6 | 19638 | <filename>017. Letter Combinations of a Phone Number.py
# Given a digit string, return all possible letter combinations that the number could represent.
# A mapping of digit to letters (just like on the telephone buttons) is given below.
# Input:Digit string "23"
# Output: ["ad", "ae", "af", "bd", "be", "bf", "cd",... | 3.921875 | 4 |
FreeBSD/bsd_netstats_poller.py | failedrequest/telegraf-plugins | 0 | 19639 | <filename>FreeBSD/bsd_netstats_poller.py
#!/usr/bin/env python3
# 3/21/2021
# Updated for python3
# A Simple sysctl to telegraf plugin for freebsd's netstats ip info
from freebsd_sysctl import Sysctl as sysctl
import subprocess as sp
import re
import json
import sys
import pprint as pp
hostname = sysctl("kern.hostna... | 2.546875 | 3 |
ixnetwork_restpy/testplatform/sessions/ixnetwork/topology/packetinlist_10d8adb40e4e05f4b37904f2c6428ca9.py | OpenIxia/ixnetwork_restpy | 20 | 19640 | <filename>ixnetwork_restpy/testplatform/sessions/ixnetwork/topology/packetinlist_10d8adb40e4e05f4b37904f2c6428ca9.py
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... | 1.625 | 2 |
Python/Phani.py | baroood/Hacktoberfest-2k17 | 28 | 19641 | a = input("Enter the first number")
b = input("Enter the second number")
print('the sum is',a+b)
| 3.71875 | 4 |
servicecatalog_factory/constants_test.py | micwha/aws-service-catalog-factory | 0 | 19642 | <filename>servicecatalog_factory/constants_test.py
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from pytest import fixture
@fixture
def sut():
from servicecatalog_factory import constants
return constants
def test_bootstrap_stack_name(sut)... | 2.140625 | 2 |
django/contrib/contenttypes/tests/models.py | benjaoming/django | 2 | 19643 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlquote
class ConcreteModel(models.Model):
name = models.CharField(max_length=10)
class ProxyModel(ConcreteModel):
class Meta:
proxy = True
@python_2_unicode_compatible
class F... | 2.40625 | 2 |
tests/unit/utils/test_docker.py | springborland/salt | 1 | 19644 | <reponame>springborland/salt<filename>tests/unit/utils/test_docker.py<gh_stars>1-10
# -*- coding: utf-8 -*-
"""
tests.unit.utils.test_docker
============================
Test the funcs in salt.utils.docker and salt.utils.docker.translate
"""
# Import Python Libs
from __future__ import absolute_import, print_function, ... | 2.296875 | 2 |
utils/middleware.py | DavidRoldan523/elenas_test | 0 | 19645 | from django.http import HttpResponse
from django.utils.deprecation import MiddlewareMixin
class HealthCheckMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
if request.META["PATH_INFO"] == "/health-check/":
return HttpRespo... | 2.046875 | 2 |
bot/exts/evergreen/catify.py | chincholikarsalil/sir-lancebot | 0 | 19646 | import random
from contextlib import suppress
from typing import Optional
from discord import AllowedMentions, Embed, Forbidden
from discord.ext import commands
from bot.constants import Cats, Colours, NEGATIVE_REPLIES
from bot.utils import helpers
class Catify(commands.Cog):
"""Cog for the catify command."""
... | 2.90625 | 3 |
data/ebmnlp/stream.py | bepnye/tf_ner | 0 | 19647 | import os
import data_utils
from pathlib import Path
top_path = Path(os.path.dirname(os.path.abspath(__file__)))
EBM_NLP = Path('/Users/ben/Desktop/ebm_nlp/repo/ebm_nlp_2_00/')
NO_LABEL = '0'
def overwrite_tags(new_tags, tags):
for i, t in enumerate(new_tags):
if t != NO_LABEL:
tags[i] = t
def get_tags(d... | 2.40625 | 2 |
Kernels/Research/FFT/config/fft.py | WoodData/EndpointAI | 190 | 19648 | #
#
# Copyright (C) 2010-2021 ARM Limited or its affiliates. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
# 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
#
# www.apache.org/lice... | 2.328125 | 2 |
classification/resnetOnnx_inference_dynamicInput.py | SahilChachra/Onnx-Deposit | 0 | 19649 | '''
This inference script takes in images of dynamic size
Runs inference in batch
** In this images have been resized but not need for this script
'''
import onnx
import onnxruntime as ort
import numpy as np
import cv2
from imagenet_classlist import get_class
import os
model_path = 'resnet18.onnx'
model = onnx.load(... | 2.578125 | 3 |
demo/Master/TaskMaker.py | build2last/JOCC | 0 | 19650 | # coding:utf-8
import time
import MySQLdb
import conf
import Server
# Another way to load data to MySQL:
# load data infile "C://ProgramData/MySQL/MySQL Server 5.7/Uploads/track_info_url_0_part0.txt" ignore into table develop.task(mid, url);
# doing: load data infile "C://ProgramData/MySQL/MySQL Server 5.7/Uploads/tr... | 2.796875 | 3 |
Inclass/python/sort_order_testing/sort_order.py | chenchuw/EC602-Design-by-Software | 0 | 19651 | #!/Users/francischen/opt/anaconda3/bin/python
#pythons sorts are STABLE: order is the same as original in tie.
# sort: key, reverse
q = ['two','twelve','One','3']
#sort q, result being a modified list. nothing is returned
q.sort()
print(q)
q = ['two','twelve','One','3',"this has lots of t's"]
q.sort(reverse=True)
pr... | 4.21875 | 4 |
bhinneka/utils.py | kangfend/scrapy-bhinneka | 1 | 19652 | <reponame>kangfend/scrapy-bhinneka<gh_stars>1-10
from bhinneka.settings import BASE_URL
def get_absolute_url(path):
return BASE_URL + path
| 1.601563 | 2 |
tests/test_vsan/vars.py | wardy3/mdssdk | 4 | 19653 | <reponame>wardy3/mdssdk
import logging
import random
log = logging.getLogger(__name__)
reserved_id = [4079, 4094]
boundary_id = [0, 4095]
# No need to have end=4094 as there are some inbetween vsans reserved for fport-channel-trunk
def get_random_id(start=2, end=400):
return random.randint(start, end)
| 2.125 | 2 |
testing_ideas/try_pymed_package/try_pymed_and_ss_api.py | hschilling/data-collection-and-prep | 0 | 19654 | <filename>testing_ideas/try_pymed_package/try_pymed_and_ss_api.py
# Use the pymed package to call the PubMed API to get lots of papers from, in this case, JEB
from pymed import PubMed
import pandas as pd
import requests
_REQUESTS_TIMEOUT = 3.0
df_jeb = pd.DataFrame(columns=['title', 'abstract'])
df_jeb = df_jeb.conv... | 2.4375 | 2 |
simple_functions/__init__.py | JihaoXin/ci_acse1 | 0 | 19655 | from .functions1 import my_sum, factorial
from .constants import pi
from .print import myprint
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
| 1.429688 | 1 |
tools/build_defs/native_tools/tool_access.bzl | slsyy/rules_foreign_cc | 0 | 19656 | <filename>tools/build_defs/native_tools/tool_access.bzl<gh_stars>0
# buildifier: disable=module-docstring
load(":native_tools_toolchain.bzl", "access_tool")
def get_cmake_data(ctx):
return _access_and_expect_label_copied("@rules_foreign_cc//tools/build_defs:cmake_toolchain", ctx, "cmake")
def get_ninja_data(ctx):... | 1.8125 | 2 |
tests/test_model.py | jakehadar/py-snake | 0 | 19657 | # -*- coding: utf-8 -*-
import sys
import pytest
from snake.common import Frame, Point, BoundaryCollision, SelfCollision
from snake.config import GameConfig
from snake.model import SnakeModel
@pytest.fixture
def config():
config = GameConfig()
config.solid_walls = True
config.initial_food_count = 0
... | 2.78125 | 3 |
gallery/photo/urls.py | andyjohn23/django-photo | 0 | 19658 | <reponame>andyjohn23/django-photo<filename>gallery/photo/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name="index"),
path('category/<category>/', views.CategoryListView.as_view(), name="category"),
path('search/', views.image_search, name='image-search'),
] | 2.015625 | 2 |
book2/s4_ex2.py | Felipe-Tommaselli/Python4everbody_Michigan | 0 | 19659 | <gh_stars>0
fname = input("Enter file name: ")
if len(fname) < 1 : fname = "mbox-short.txt"
list = list()
f = open(fname)
count = 0
for line in f:
line = line.rstrip()
list = line.split()
if list == []: continue
elif list[0].lower() == 'from':
count += 1
print(list[1])
pr... | 3.703125 | 4 |
fedsimul/models/mnist/mclr.py | cshjin/fedsimul | 11 | 19660 | import numpy as np
import tensorflow as tf
from tqdm import trange
from fedsimul.utils.model_utils import batch_data
from fedsimul.utils.tf_utils import graph_size
from fedsimul.utils.tf_utils import process_grad
class Model(object):
'''
This is the tf model for the MNIST dataset with multiple class learner ... | 2.390625 | 2 |
angr_ctf/solutions/06_angr_symbolic_dynamic_memory.py | Hamz-a/angr_playground | 0 | 19661 | <filename>angr_ctf/solutions/06_angr_symbolic_dynamic_memory.py
import angr
import claripy
path_to_bin = "../binaries/06_angr_symbolic_dynamic_memory"
# Find callback
def good_job(state):
# Get the output of the state
stdout = state.posix.dumps(1)
# If the program echo'ed "Good Job." then we've found a g... | 2.5625 | 3 |
run.py | JonLMyers/MetroTransitAPI | 0 | 19662 | """ Runs the server """
from aaxus import app
app.run()
| 1.054688 | 1 |
ConjugateGardient_Python.py | rohitj559/HPC_MPI-project | 0 | 19663 | <filename>ConjugateGardient_Python.py
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 6 20:36:02 2018
@author: Rohit
"""
# =============================================================================
# import numpy as np
# a = np.array([5,4])[np.newaxis]
# print(a)
# print(a.T)
#
# function [x] = conjgrad(A, b, x)
... | 2.90625 | 3 |
examples/applications/agritrop-indexing/training_agritrop_baseline.py | Ing-David/sentence-transformers | 0 | 19664 | import argparse
import logging
import math
from pathlib import Path
import torch.multiprocessing as mp
import os
from datetime import datetime
import nltk
import pandas as pd
import transformers
from torch import nn
import torch.distributed
from torch._C._distributed_c10d import HashStore
from torch.utils.data import... | 2.015625 | 2 |
src/utils/file_manipulation.py | SashiniHansika/Relationship-Identifying-Module | 0 | 19665 | <gh_stars>0
# open input text scenario
import xml.etree.ElementTree as ET
import os
PATH = "G:\\FYP\\FYP-ER-Relationships-Module\\data"
text_file = open(PATH+"\\input_text.txt", "r")
if text_file.mode == 'r':
# Read the scenario and covert that text file into lowercase
input_text_load = text_file.read()
... | 3.046875 | 3 |
tests/tensorflow/pruning/test_tensor_processor.py | MaximProshin/nncf | 136 | 19666 | <reponame>MaximProshin/nncf<gh_stars>100-1000
import pytest
import tensorflow as tf
from nncf.tensorflow.tensor import TFNNCFTensor
from nncf.tensorflow.pruning.tensor_processor import TFNNCFPruningTensorProcessor
@pytest.mark.parametrize('device', ("CPU", 'GPU'))
def test_create_tensor(device):
if not tf.config... | 2.171875 | 2 |
src/bot/botstates/TriviaBot.py | malmgrens4/TwIOTch | 0 | 19667 | <reponame>malmgrens4/TwIOTch
from twitchio.dataclasses import Message
from typing import Dict, Callable
from datetime import datetime
from dataclasses import dataclass
from src.bot.gameobservers.Observer import Observer
from src.bot.gameobservers.Subject import Subject
from src.bot.botstates.BotState import BotState
f... | 2.515625 | 3 |
playing1.py | bert386/rpi-monitor-cam-led | 0 | 19668 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Description:
Todo:
"""
import os
import sys
import logging
from collections import deque
from base_state import BaseState
class Playing1stState(BaseState):
""""""
def __init__(self, state_controller):
super().__init__(state_controller, self.in_state)
... | 2.21875 | 2 |
script/isort.py | zhoumjane/devops_backend | 53 | 19669 | # -*- coding: utf-8 -*-
import time, random
def isort(i_list):
for i in range(1, len(i_list)):
for j in range(i,0, -1):
if i_list[j] < i_list[j-1]:
i_list[j], i_list[j-1] = i_list[j-1], i_list[j]
else:
break
if __name__ == "__main__":
alist = []
... | 3.4375 | 3 |
test/test_estim/test_scalarnl.py | Ryandry1st/vampyre | 59 | 19670 | <gh_stars>10-100
"""
test_relu.py: Test suite for the ReLU estimator class :class:ReLUEstim`
"""
from __future__ import print_function
from __future__ import division
import unittest
import numpy as np
# Add the path to the vampyre package and import it
import env
env.add_vp_path()
import vampyre as vp
def logist... | 2.75 | 3 |
tests/live/test_client_auth.py | denibertovic/stormpath-sdk-python | 0 | 19671 | <filename>tests/live/test_client_auth.py
"""Live tests of client authentication against the Stormpath service API."""
from os import environ
from stormpath.client import Client
from stormpath.error import Error
from .base import LiveBase
class TestAuth(LiveBase):
def test_basic_authentication_succeeds(self):
... | 2.484375 | 2 |
languages/python/software_engineering_logging4.py | Andilyn/learntosolveit | 136 | 19672 | <filename>languages/python/software_engineering_logging4.py
import logging
logger1 = logging.getLogger('package1.module1')
logger2 = logging.getLogger('package1.module2')
logging.basicConfig(level=logging.WARNING)
logger1.warning('This is a warning message')
logger2.warning('This is a another warning message')
| 2.15625 | 2 |
py/foreman/tests/testdata/test_command/pkg1/build.py | clchiou/garage | 3 | 19673 | <reponame>clchiou/garage<filename>py/foreman/tests/testdata/test_command/pkg1/build.py
from pathlib import Path
from foreman import define_parameter, rule, get_relpath
import foreman
if __name__ != 'pkg1':
raise AssertionError(__name__)
if not __file__.endswith('foreman/tests/testdata/test_command/pkg1/build.p... | 2.4375 | 2 |
python/pyarrow/tests/test_dataset.py | maxburke/arrow | 0 | 19674 | <reponame>maxburke/arrow<gh_stars>0
# 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 ... | 1.71875 | 2 |
stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/markup.py | zhi-xianwei/learn_python3_spider | 9,953 | 19675 | <filename>stackoverflow/venv/lib/python3.6/site-packages/scrapy/utils/markup.py
"""
Transitional module for moving to the w3lib library.
For new code, always import from w3lib.html instead of this module
"""
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
from w3lib.html import *
warnings.war... | 1.429688 | 1 |
scripts/option_normal_model.py | jcoffi/FuturesAndOptionsTradingSimulation | 14 | 19676 | <reponame>jcoffi/FuturesAndOptionsTradingSimulation
#IMPORT log and sqrt FROM math MODULE
from math import log, sqrt, exp
#IMPORT date AND timedelta FOR HANDLING EXPIRY TIMES
from datetime import date, timedelta
#IMPORT SciPy stats MODULE
from scipy import stats
def asian_vol_factor(valDate,startDate,endDate):
#VA... | 2.421875 | 2 |
code/tasks/VNLA/oracle.py | Chucooleg/vnla | 0 | 19677 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import math
import networkx as nx
import functools
import scipy.stats
import random
import sys
import copy
import numpy as np
import torch
import utils
try:
sys.path.append('/opt/MatterSim/build/') # local docker or Philly
im... | 2.46875 | 2 |
unit-tests/controller.py | HimariO/VideoSum | 0 | 19678 | import tensorflow as tf
import numpy as np
import unittest
from dnc.controller import BaseController
class DummyController(BaseController):
def network_vars(self):
self.W = tf.Variable(tf.truncated_normal([self.nn_input_size, 64]))
self.b = tf.Variable(tf.zeros([64]))
def network_op(self, X):... | 2.625 | 3 |
movies/movies/spiders/douban.py | Devon-pku/repso | 0 | 19679 | # -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.loader import ItemLoader
from scrapy.loader.processors import Join, MapCompose
from scrapy.spiders import CrawlSpider, Rule
from movies.items import MoviesItem
class DoubanSpider(CrawlSpider):
name = 'douban'
allowed_domains ... | 2.828125 | 3 |
CatFaultDetection/LSTM/Test_LSTM.py | jonlwowski012/UGV-Wheel-Slip-Detection-Using-LSTM-and-DNN | 0 | 19680 | <reponame>jonlwowski012/UGV-Wheel-Slip-Detection-Using-LSTM-and-DNN
import numpy as np
from scipy.misc import imread, imsave, imresize
from keras.models import model_from_json
from os.path import join
import matplotlib.pyplot as plt
import pandas as pd
import time
def shuffler(filename):
df = pd.read_csv(filename, he... | 2.921875 | 3 |
examples/spring_system.py | tkoziara/parmec | 0 | 19681 | # find parmec path
import os, sys
def where(program):
for path in os.environ["PATH"].split(os.pathsep):
if os.path.exists(os.path.join(path, program)):
return path
return None
path = where('parmec4')
if path == None:
print 'ERROR: parmec4 not found in PATH!'
print ' Download and compile parmec;'... | 2.5625 | 3 |
api/weibo/api/api.py | Eurkon/api | 5 | 19682 | # -*- coding: utf-8 -*-
# @Author : Eurkon
# @Date : 2021/6/9 17:13
from api.weibo.api.top import weibo_top | 1.140625 | 1 |
leds.py | sthysel/pyboard-play | 0 | 19683 | <gh_stars>0
import pyb
import random
leds = [pyb.LED(i) for i in range(1, 5)]
blue_led = pyb.LED(4)
def fanfare(delay=200):
def switch_all(on=True):
for led in leds:
if on:
led.on()
else:
led.off()
for i in range(4):
switch_all(on=True... | 2.75 | 3 |
main.py | droher/diachronic | 3 | 19684 | import json
import os
import shutil
import urllib.request
import traceback
import logging
import psutil
from collections import defaultdict
from typing import List, Dict, Tuple
from multiprocessing import Semaphore, Pool
from subprocess import Popen, PIPE
from datetime import datetime, timedelta
from lxml import etree... | 2.3125 | 2 |
sasehack/models.py | ritwik19/Prosper | 2 | 19685 |
class FollowupEvent:
def __init__(self, name, data=None):
self.name = name
self.data = data
class Response:
def __init__(self, text=None, followup_event=None):
self.speech = text
self.display_text = text
self.followup_event = followup_event
class UserInput:
def _... | 2.6875 | 3 |
apps/core/helpers.py | tarvitz/icu | 1 | 19686 | <reponame>tarvitz/icu
# coding: utf-8
#
import re
import os
from django.conf import settings
from django.shortcuts import (
render_to_response, get_object_or_404 as _get_object_or_404,
redirect)
from django.http import HttpResponse, HttpResponseRedirect
from django.template import RequestContext
from django.con... | 2.15625 | 2 |
Python/Numpy/Shape and Reshape/shape_and_reshape.py | brianchiang-tw/HackerRank | 2 | 19687 | <filename>Python/Numpy/Shape and Reshape/shape_and_reshape.py
import numpy as np
from typing import List
def reshpare_to_square_matrix( seq:List)->None:
square_matrix = np.array( seq )
# reshpae to square matrix
square_matrix.shape = (3,3)
return square_matrix
if __name__ == '__main__':
int_se... | 3.984375 | 4 |
figures_in_paper/Fig3/ParticleSimulations/Fig3_particle_simulation_10-3.py | tstepien/moth-mating | 0 | 19688 | <gh_stars>0
import numpy as np
import time
import csv
import multiprocessing
import os
from numba import njit
@njit()
def timestep(dist):
t1 = 1e-5
t2 = 1e-2
k = 1
timestep = (t2-t1)*np.tanh(k*dist)+t1
return timestep
@njit()
def random_walk(m,d,t,R,rt):
time = 0
#set up random IC on circl... | 2.609375 | 3 |
tests/core/test_factory.py | pdwaggoner/datar | 0 | 19689 | import inspect
import pytest
import numpy as np
from datar.core.backends.pandas import Categorical, DataFrame, Series
from datar.core.backends.pandas.testing import assert_frame_equal
from datar.core.backends.pandas.core.groupby import SeriesGroupBy
from datar.core.factory import func_factory
from datar.core.tibble im... | 2.46875 | 2 |
worker/resources/Twitch.py | fga-eps-mds/2018.2-GamesBI_Importadores | 1 | 19690 | <reponame>fga-eps-mds/2018.2-GamesBI_Importadores<filename>worker/resources/Twitch.py
import requests
from functools import reduce
import operator
from urllib.parse import quote
import time
TWITCH_HEADER = {'Client-ID': 'nhnlqt9mgdmkf9ls184tt1nd753472',
'Accept': 'application/json'}
class Twitch(obj... | 2.734375 | 3 |
maas/plugins/neutron_service_check.py | claco/rpc-openstack | 0 | 19691 | <filename>maas/plugins/neutron_service_check.py
#!/usr/bin/env python
# Copyright 2014, Rackspace US, 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/licen... | 2.0625 | 2 |
integration-test/797-add-missing-boundaries.py | nextzen/vector-datasource | 1 | 19692 | from . import FixtureTest
class AddMissingBoundaries(FixtureTest):
def test_statistical(self):
# NE data - no OSM elements
# boundary between NV and CA is _also_ a "statistical" boundary
self.load_fixtures([
'file://integration-test/fixtures/'
'ne_10m_admin_1_states... | 2.1875 | 2 |
flask/app/views.py | Ivche1337/Dodgerino-Game | 1 | 19693 | <filename>flask/app/views.py<gh_stars>1-10
import os
from flask import render_template
from flask_sqlalchemy import SQLAlchemy
from app import app
FILE_PATH = "/home/ivche/dev/Dodgerino-Game/highscores.db"
print(FILE_PATH)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+FILE_PATH
app.config['SQLALCHEMY_TRACK_MO... | 2.359375 | 2 |
mds/files.py | VilledeMontreal/mds-provider | 0 | 19694 | <reponame>VilledeMontreal/mds-provider<filename>mds/files.py
"""
Work with MDS Provider data in JSON files.
"""
import csv
import datetime
import hashlib
import json
import os
import pathlib
import urllib
import requests
import pandas as pd
from .encoding import JsonEncoder
from .providers import Provider
from .sche... | 2.40625 | 2 |
App/neon_ann_stitch.py | weecology/NEON_crown_maps | 0 | 19695 | import os
import rasterio
import argparse
from PIL import Image
import subprocess
import pathlib
import shutil
from glob import glob
from numba import njit, prange
from OpenVisus import *
### Configuration
ext_name = ".tif"
dtype = "uint8[3]"
limit = 1000
###--------------
@njit(parallel=True)
def... | 2.40625 | 2 |
scooby/plugins/processtime/__init__.py | zetaab/django-scooby-profiler | 9 | 19696 | <gh_stars>1-10
from .plugin import ProcessTimePlugin
| 1.101563 | 1 |
data_creation/generate_cosmology_data.py | kstoreyf/emu-fight | 3 | 19697 | #!/usr/bin/env python3
"""
Created on Tue Sep 1 2020
@author: kstoreyf
"""
import numpy as np
import nbodykit
import pandas as pd
import pickle
from nbodykit import cosmology
def main():
save_fn = '../data/cosmology_train.pickle'
x = generate_training_parameters(n_train=1000)
y, extra_input = generate_... | 2.59375 | 3 |
handlers/checkers/highway/track.py | n0s0r0g/perfect_OSM | 4 | 19698 | <gh_stars>1-10
from handlers.simplehandler import SimpleHandler
_NO_SURFACE = {
'title': 'Не указано покрытие дороги',
'help_text': """Для highway=track не задано покрытие (surface).
Объективные параметры:
- surface - тип покрытия
Субьективные параметры:
- surface:grade - оценка качества относительно типа по... | 2.484375 | 2 |
job_title_processing/ressources_txt/FR/cleaner/job.py | OnlineJobVacanciesESSnetBigData/JobTitleProcessing_FR | 3 | 19699 | <filename>job_title_processing/ressources_txt/FR/cleaner/job.py
# -*- coding: utf-8 -*-
jobwords = [
'nan',
'temps plein', 'temps complet', 'mi temps', 'temps partiel', # Part / Full time
'cherche', # look for
'urgent','rapidement', 'futur',
'job', 'offre', # Job offer
... | 1.851563 | 2 |