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 |
|---|---|---|---|---|---|---|
6.爬取豆瓣排行榜电影数据(含GUI界面版)/main.py | shengqiangzhang/examples-of-web-crawlers | 12,023 | 2800 | <reponame>shengqiangzhang/examples-of-web-crawlers
# -*- coding:utf-8 -*-
from uiObject import uiObject
# main入口
if __name__ == '__main__':
ui = uiObject()
ui.ui_process() | 1.453125 | 1 |
photos/models.py | eude313/vault | 0 | 2801 | from django.db import models
from cloudinary.models import CloudinaryField
# Create your models here.
class Category(models.Model):
name = models.CharField( max_length=200, null=False, blank=False )
def __str__(self):
return self.name
class Photo(models.Model):
category = models.ForeignKey(... | 2.375 | 2 |
server/djangoapp/restapis.py | christiansencq/ibm_capstone | 0 | 2802 | <reponame>christiansencq/ibm_capstone
import requests
import json
# import related models here
from .models import CarDealer, DealerReview
from requests.auth import HTTPBasicAuth
import logging
logger = logging.getLogger(__name__)
# Create a `get_request` to make HTTP GET requests
# e.g., response = requests.get(url,... | 2.640625 | 3 |
examples/python/upload.py | oslokommune/okdata-data-uploader | 0 | 2803 | import logging
from configparser import ConfigParser
from sdk.data_uploader import DataUploader
logging.basicConfig(level=logging.INFO)
log = logging.getLogger()
config = ConfigParser()
config.read("config.ini")
#####
# Datasets to be added to metadata API
datasetData = {
"title": "Test",
"description": "Tes... | 2.28125 | 2 |
doc/examples.py | Enerccio/mahjong | 254 | 2804 | <gh_stars>100-1000
from mahjong.hand_calculating.hand import HandCalculator
from mahjong.meld import Meld
from mahjong.hand_calculating.hand_config import HandConfig, OptionalRules
from mahjong.shanten import Shanten
from mahjong.tile import TilesConverter
calculator = HandCalculator()
# useful helper
def print_hand... | 2.21875 | 2 |
src/infi/mount_utils/solaris/mounter.py | Infinidat/mount-utils | 0 | 2805 | from ..base.mounter import MounterMixin, execute_mount
class SolarisMounterMixin(MounterMixin):
def _get_fstab_path(self):
return "/etc/fstab"
def _get_entry_format(self, entry):
return entry.get_format_solaris()
def mount_entry(self, entry):
args = ["-F", entry.get_typename(), en... | 2.15625 | 2 |
sdk/python/pulumi_oci/database/get_external_non_container_database.py | EladGabay/pulumi-oci | 5 | 2806 | <reponame>EladGabay/pulumi-oci
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence,... | 1.492188 | 1 |
setup.py | xmedius/xmedius-mailrelayserver | 0 | 2807 | from setuptools import setup
from setuptools.command.install import install
class PostInstallCommand(install):
user_options = install.user_options + [
('noservice', None, None),
]
def initialize_options(self):
install.initialize_options(self)
self.noservice = None
def finalize... | 1.914063 | 2 |
143.py | tsbxmw/leetcode | 0 | 2808 | # 143. 重排链表
# 给定一个单链表 L:L0→L1→…→Ln-1→Ln ,
# 将其重新排列后变为: L0→Ln→L1→Ln-1→L2→Ln-2→…
# 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。
# 示例 1:
# 给定链表 1->2->3->4, 重新排列为 1->4->2->3.
# 示例 2:
# 给定链表 1->2->3->4->5, 重新排列为 1->5->2->4->3.
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# ... | 3.734375 | 4 |
CraftProtocol/NBT/NBTTagList.py | Toranktto/CraftProtocol | 21 | 2809 | #!/usr/bin/env python
from CraftProtocol.NBT.NBTBase import NBTBase
from CraftProtocol.NBT.NBTProvider import NBTProvider
from CraftProtocol.StreamIO import StreamIO
class NBTTagList(NBTBase):
TYPE_ID = 0x09
def __init__(self, tag_type, values=None):
NBTBase.__init__(self)
if values is None... | 2.125 | 2 |
examples/0b02b172-ad67-449b-b4a2-ff645b28c508.py | lapaniku/GAS | 37 | 2810 | <reponame>lapaniku/GAS<gh_stars>10-100
# This program was generated by "Generative Art Synthesizer"
# Generation date: 2021-11-28 09:21:40 UTC
# GAS change date: 2021-11-28 09:20:21 UTC
# GAS md5 hash: ad55481e87ca5a7e9a8e92cd336d1cad
# Python version: 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.19... | 2.328125 | 2 |
onmt/bin/build_vocab.py | comydream/OpenNMT-py | 1 | 2811 | #!/usr/bin/env python
"""Get vocabulary coutings from transformed corpora samples."""
from onmt.utils.logging import init_logger
from onmt.utils.misc import set_random_seed, check_path
from onmt.utils.parse import ArgumentParser
from onmt.opts import dynamic_prepare_opts
from onmt.inputters.corpus import build_vocab
fr... | 2.625 | 3 |
schools3/ml/experiments/feat_pruning_experiment.py | dssg/mlpolicylab_fall20_schools3_public | 0 | 2812 | <filename>schools3/ml/experiments/feat_pruning_experiment.py
import numpy as np
import pandas as pd
from schools3.ml.experiments.models_experiment import ModelsExperiment
from schools3.data.base.cohort import Cohort
from schools3.config import main_config
from schools3.config import global_config
from schools3.data.dat... | 2.5625 | 3 |
network/dataset/image_loading.py | imsb-uke/podometric_u_net | 0 | 2813 | import os
import numpy as np
from skimage.io import imread
def get_file_count(paths, image_format='.tif'):
total_count = 0
for path in paths:
try:
path_list = [_ for _ in os.listdir(path) if _.endswith(image_format)]
total_count += len(path_list)
except OSError:
... | 2.828125 | 3 |
series/simple/numeric_series.py | kefir/snakee | 0 | 2814 | from typing import Optional, Callable
try: # Assume we're a sub-module in a package.
from series import series_classes as sc
from utils import numeric as nm
except ImportError: # Apparently no higher-level package has been imported, fall back to a local import.
from .. import series_classes as sc
fro... | 2.375 | 2 |
app/internal/module/video/database.py | kuropengin/SHINtube-video-api | 0 | 2815 | import glob
import pathlib
from .filemanager import filemanager_class
class database_class(filemanager_class):
def __init__(self):
filemanager_class.__init__(self)
async def update_info(self, year, cid, vid, title, explanation):
# 既存のjsonを読み込み
json_file = "/".join([self.video_dir, str... | 2.71875 | 3 |
python/OpenGeoTile.py | scoofy/open-geotiling | 0 | 2816 | <gh_stars>0
from openlocationcode import openlocationcode as olc
from enum import Enum
import math, re
class TileSize(Enum):
''' An area of 20° x 20°. The side length of this tile varies with its location on the globe,
but can be up to approximately 2200km. Tile addresses will be 2 characters long.'''
... | 3 | 3 |
deep-rl/lib/python2.7/site-packages/OpenGL/arrays/arraydatatype.py | ShujaKhalid/deep-rl | 87 | 2817 | """Array data-type implementations (abstraction points for GL array types"""
import ctypes
import OpenGL
from OpenGL.raw.GL import _types
from OpenGL import plugins
from OpenGL.arrays import formathandler, _arrayconstants as GL_1_1
from OpenGL import logs
_log = logs.getLog( 'OpenGL.arrays.arraydatatype' )
from OpenG... | 2.46875 | 2 |
tensorflow_probability/python/build_defs.bzl | jbergmanster/probability | 0 | 2818 | <filename>tensorflow_probability/python/build_defs.bzl
# Copyright 2019 The TensorFlow Probability 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/licen... | 1.75 | 2 |
src/wikidated/wikidata/wikidata_dump.py | lschmelzeisen/wikidata-history-analyzer | 6 | 2819 | <filename>src/wikidated/wikidata/wikidata_dump.py<gh_stars>1-10
#
# Copyright 2021 <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
#
... | 2.203125 | 2 |
tcapygen/layoutgen.py | Ahrvo-Trading-Systems/tcapy | 189 | 2820 | from __future__ import division, print_function
__author__ = 'saeedamen' # <NAME> / <EMAIL>
#
# Copyright 2017 Cuemacro Ltd. - http//www.cuemacro.com / @cuemacro
#
# See the License for the specific language governing permissions and limitations under the License.
#
## Web server components
import dash_core_compone... | 2.265625 | 2 |
tests/molecular/molecules/molecule/fixtures/cof/periodic_kagome.py | andrewtarzia/stk | 21 | 2821 | import pytest
import stk
from ...case_data import CaseData
@pytest.fixture(
scope='session',
params=(
lambda name: CaseData(
molecule=stk.ConstructedMolecule(
topology_graph=stk.cof.PeriodicKagome(
building_blocks=(
stk.BuildingB... | 1.882813 | 2 |
projects/MAE/utils/weight_convert.py | Oneflow-Inc/libai | 55 | 2822 | <reponame>Oneflow-Inc/libai
# coding=utf-8
# Copyright 2021 The OneFlow Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | 1.460938 | 1 |
dthm4kaiako/events/__init__.py | taskmaker1/dthm4kaiako | 3 | 2823 | """Module for events application."""
| 1.09375 | 1 |
spot/level1.py | K0gata/SGLI_Python_output_tool | 1 | 2824 | <filename>spot/level1.py
import numpy as np
import logging
from decimal import Decimal, ROUND_HALF_UP
from abc import ABC, abstractmethod, abstractproperty
from spot.utility import bilin_2d
from spot.config import PROJ_TYPE
# =============================
# Level-1 template class
# =============================
cla... | 2.171875 | 2 |
168. Excel Sheet Column Title.py | Alvin1994/leetcode-python3- | 0 | 2825 | class Solution:
# @return a string
def convertToTitle(self, n: int) -> str:
capitals = [chr(x) for x in range(ord('A'), ord('Z')+1)]
result = []
while n > 0:
result.insert(0, capitals[(n-1)%len(capitals)])
n = (n-1) % len(capitals)
# result.reverse()
... | 3.53125 | 4 |
devil/devil/utils/cmd_helper.py | Martijnve23/catapult | 1,894 | 2826 | <gh_stars>1000+
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A wrapper for subprocess to make calling shell commands easier."""
import codecs
import logging
import os
import pipes
import select
i... | 2.359375 | 2 |
services/server/server/apps/checkout/migrations/0001_initial.py | AyanSamanta23/moni-moni | 0 | 2827 | <filename>services/server/server/apps/checkout/migrations/0001_initial.py
# Generated by Django 4.0.2 on 2022-02-26 15:52
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
nam... | 1.757813 | 2 |
api/to_astm.py | urchinpro/L2-forms | 0 | 2828 | <filename>api/to_astm.py
import itertools
from astm import codec
from collections import defaultdict
from django.utils import timezone
import directions.models as directions
import directory.models as directory
import api.models as api
import simplejson as json
def get_astm_header() -> list:
return ['H|\\^&', Non... | 2.265625 | 2 |
test/unit/test_som_rom_parser.py | CospanDesign/nysa | 15 | 2829 | #!/usr/bin/python
import unittest
import json
import sys
import os
import string
sys.path.append(os.path.join(os.path.dirname(__file__),
os.pardir,
os.pardir))
from nysa.cbuilder import sdb_component as sdbc
from nysa.cbuilder import sdb_object_model as som
... | 2.171875 | 2 |
src/TF-gui/tftrain.py | jeetsagar/turbojet | 0 | 2830 | #!python3
import os
import pandas as pd
import tensorflow as tf
from tensorflow.keras import layers
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
# gpu_devices = tf.config.experimental.list_physical_devices("GPU")
# for device in gpu_devices:
# tf.config.experimental.set_memory_growth(device, True)
def trainModel... | 2.546875 | 3 |
library/kong_api.py | sebastienc/ansible-kong-module | 34 | 2831 | <reponame>sebastienc/ansible-kong-module<filename>library/kong_api.py<gh_stars>10-100
#!/usr/bin/python
DOCUMENTATION = '''
---
module: kong
short_description: Configure a Kong API Gateway
'''
EXAMPLES = '''
- name: Register a site
kong:
kong_admin_uri: http://127.0.0.1:8001/apis/
name: "Mockbin"
tage... | 2.078125 | 2 |
src/compas_plotters/artists/lineartist.py | XingxinHE/compas | 0 | 2832 | <reponame>XingxinHE/compas<filename>src/compas_plotters/artists/lineartist.py
from compas_plotters.artists import Artist
from matplotlib.lines import Line2D
from compas.geometry import intersection_line_box_xy
__all__ = ['LineArtist']
class LineArtist(Artist):
""""""
zorder = 1000
def __init__(self, l... | 2.59375 | 3 |
plot2d_artificial_dataset1_silvq.py | manome/python-silvq | 0 | 2833 | # -*- encoding: utf8 -*-
import numpy as np
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from lvq import SilvqModel
from lvq.utils import plot2d
def main():
# Load dataset
dataset = np.loadtxt('data/artificial_dataset1.csv', delimiter=',')
x = dataset[:... | 3.296875 | 3 |
classification_experiments/Fine-Tuned-ResNet-50/Fine-Tuned-ResNet-50.py | ifr1m/hyper-kvasir | 38 | 2834 | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
#Importing all required libraries
# In[ ]:
from __future__ import absolute_import, division, print_function, unicode_literals
# In[ ]:
#Checking for correct cuda and tf versions
from tensorflow.python.platform import build_info as tf_build_info
print(tf_build_in... | 2.46875 | 2 |
tools/android/android_tools.gyp | SlimKatLegacy/android_external_chromium_org | 2 | 2835 | <reponame>SlimKatLegacy/android_external_chromium_org
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
# Intermediate target grouping the android tools needed to run native
# un... | 1.164063 | 1 |
test/functional/fantasygold_opcall.py | FantasyGold/FantasyGold-Core | 13 | 2836 | <reponame>FantasyGold/FantasyGold-Core
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
from test_framework.test_framework import BitcoinTestFramework
fro... | 1.914063 | 2 |
intake_sklearn/source.py | AlbertDeFusco/intake-sklearn | 1 | 2837 | <reponame>AlbertDeFusco/intake-sklearn<gh_stars>1-10
from intake.source.base import DataSource, Schema
import joblib
import fsspec
import sklearn
import re
from . import __version__
class SklearnModelSource(DataSource):
container = 'python'
name = 'sklearn'
version = __version__
partition_access = Fal... | 2.203125 | 2 |
jedi/evaluate/dynamic.py | hatamov/jedi | 0 | 2838 | """
One of the really important features of |jedi| is to have an option to
understand code like this::
def foo(bar):
bar. # completion here
foo(1)
There's no doubt wheter bar is an ``int`` or not, but if there's also a call
like ``foo('str')``, what would happen? Well, we'll just show both. Because
th... | 3.734375 | 4 |
steamcheck/views.py | moird/linux-game-report | 0 | 2839 | from steamcheck import app
from flask import jsonify, render_template
import os
import steamapi
import json
@app.route('/')
def index():
return render_template("index.html")
@app.route('/report/<name>')
def report(name=None):
"""
This will generate the report based on the users Steam ID. Returns JSON
... | 2.6875 | 3 |
validator/delphi_validator/run.py | benjaminysmith/covidcast-indicators | 0 | 2840 | <reponame>benjaminysmith/covidcast-indicators<filename>validator/delphi_validator/run.py
# -*- coding: utf-8 -*-
"""Functions to call when running the tool.
This module should contain a function called `run_module`, that is executed
when the module is run with `python -m delphi_validator`.
"""
from delphi_utils import... | 2.109375 | 2 |
datasets/validation_folders.py | zenithfang/supervised_dispnet | 39 | 2841 | import torch.utils.data as data
import numpy as np
from imageio import imread
from path import Path
import pdb
def crawl_folders(folders_list):
imgs = []
depth = []
for folder in folders_list:
current_imgs = sorted(folder.files('*.jpg'))
current_depth = []
fo... | 2.71875 | 3 |
secretpy/ciphers/rot18.py | tigertv/crypt | 51 | 2842 | <gh_stars>10-100
#!/usr/bin/python
from .rot13 import Rot13
import secretpy.alphabets as al
class Rot18:
"""
The Rot18 Cipher
"""
__rot13 = Rot13()
def __init__(self):
alphabet = al.ENGLISH
half = len(alphabet) >> 1
self.__alphabet = alphabet[:half] + al.DECIMAL[:5] + alp... | 3.609375 | 4 |
pysaurus/database/special_properties.py | notoraptor/pysaurus | 0 | 2843 | <reponame>notoraptor/pysaurus
from abc import abstractmethod
from pysaurus.database.properties import PropType
from pysaurus.database.video import Video
class SpecialPropType(PropType):
__slots__ = ()
@abstractmethod
def get(self, video: Video):
raise NotImplementedError()
class PropError(Spec... | 2.5 | 2 |
patrole_tempest_plugin/rbac_utils.py | openstack/patrole | 14 | 2844 | # Copyright 2017 AT&T Corporation.
# 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... | 2.109375 | 2 |
core/my_widgets/drug_picker.py | kimera1999/pmpktn | 0 | 2845 | from initialize import *
from core.db.db_func import query_linedrug_list
import os
import wx
class DrugPopup(wx.ComboPopup):
def __init__(self, parent):
super().__init__()
self.lc = None
self.mv = parent.mv
self.init_d_l = query_linedrug_list(self.mv.sess).all()
self.d_l =... | 2.109375 | 2 |
em Python/Roteiro4/Roteiro4__grafos.py | GuilhermeEsdras/Grafos | 0 | 2846 | <reponame>GuilhermeEsdras/Grafos<gh_stars>0
from Roteiro4.Roteiro4__funcoes import Grafo
class Grafos:
# Grafo da Paraíba
paraiba = Grafo(['J', 'C', 'E', 'P', 'M', 'T', 'Z'])
for aresta in ['J-C', 'C-E', 'C-E', 'C-P', 'C-P', 'C-M', 'C-T', 'M-T', 'T-Z']:
paraiba.adicionaAresta(aresta)
... | 2.5 | 2 |
fuzzybee/joboard/views.py | youtaya/knight | 0 | 2847 | <filename>fuzzybee/joboard/views.py
# -*- coding: utf-8 -*-
from django.shortcuts import get_object_or_404, render_to_response, render
from django.http import HttpResponseRedirect, HttpResponse
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from joboard.models import Factory
from job... | 1.953125 | 2 |
flask/app.py | yatsu/react-flask-graphql-example | 21 | 2848 | from flask import Flask
from flask_cors import CORS
from flask_graphql import GraphQLView
from schema import Schema
def create_app(**kwargs):
app = Flask(__name__)
app.debug = True
app.add_url_rule(
'/graphql',
view_func=GraphQLView.as_view('graphql', schema=Schema, **kwargs)
)
ret... | 2.15625 | 2 |
mortgagetvm/mortgageOptions.py | AndrewChap/mortgagetvm | 0 | 2849 | # Factory-like class for mortgage options
class MortgageOptions:
def __init__(self,kind,**inputOptions):
self.set_default_options()
self.set_kind_options(kind = kind)
self.set_input_options(**inputOptions)
def set_default_options(self):
self.optionList = dict()
self.optionList['commonDefaul... | 2.953125 | 3 |
DD/Terrain.py | CodingBullywug/DDreshape | 2 | 2850 | from DD.utils import PoolByteArray2NumpyArray, NumpyArray2PoolByteArray
from DD.Entity import Entity
import numpy as np
class Terrain(Entity):
def __init__(self, json, width, height, scale=4, terrain_types=4):
super(Terrain, self).__init__(json)
self._scale = scale
self.terrain_types = terr... | 2.40625 | 2 |
bluesky/tests/utils.py | AbbyGi/bluesky | 43 | 2851 | <reponame>AbbyGi/bluesky<filename>bluesky/tests/utils.py<gh_stars>10-100
from collections import defaultdict
import contextlib
import tempfile
import sys
import threading
import asyncio
@contextlib.contextmanager
def _print_redirect():
old_stdout = sys.stdout
try:
fout = tempfile.TemporaryFile(mode="w... | 2.125 | 2 |
cli/check_json.py | MJJojo97/openslides-backend | 0 | 2852 | import json
import sys
from openslides_backend.models.checker import Checker, CheckException
def main() -> int:
files = sys.argv[1:]
if not files:
print("No files specified.")
return 1
possible_modes = tuple(f"--{mode}" for mode in Checker.modes)
modes = tuple(mode[2:] for mode in p... | 2.8125 | 3 |
utils/mgmt.py | robinagist/manic | 2 | 2853 | <filename>utils/mgmt.py
from utils.data import load_memfile_configs
from utils.server import plain_response
from sanic import response
def get_mappedfile_configs():
cfgs = load_memfile_configs()
return response.json(plain_response(cfgs, 0), status=200)
def created_mapped_file():
pass
def delete_mapped... | 1.84375 | 2 |
datasets/medicalImage.py | UpCoder/YNe | 0 | 2854 | # -*- coding=utf-8 -*-
import SimpleITK as itk
import pydicom
import numpy as np
from PIL import Image, ImageDraw
import gc
from skimage.morphology import disk, dilation
import nipy
import os
from glob import glob
import scipy
import cv2
from xml.dom.minidom import Document
typenames = ['CYST', 'FNH', 'HCC', 'HEM', 'M... | 2.328125 | 2 |
setup.py | marcus-luck/zohoreader | 1 | 2855 | from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='zohoreader',
version='0.1',
description='A simple reader for zoho projects API to get all projects, users and timereports',
long_description=readme(),
classifiers=[
'Devel... | 1.296875 | 1 |
web/repositories.bzl | Ubehebe/rules_webtesting | 0 | 2856 | <gh_stars>0
# Copyright 2016 Google 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 agreed to... | 1.609375 | 2 |
code/tools/run_viz_single_task.py | santomon/taskonomy | 789 | 2857 | <gh_stars>100-1000
from __future__ import absolute_import, division, print_function
import argparse
import importlib
import itertools
import time
from multiprocessing import Pool
import numpy as np
import os
import pdb
import pickle
import subprocess
import sys
import tensorflow as tf
import tensorflow.contrib.slim... | 1.953125 | 2 |
stratum/portage/build_defs.bzl | cholve/stratum | 267 | 2858 | <reponame>cholve/stratum<filename>stratum/portage/build_defs.bzl
# Copyright 2018 Google LLC
# Copyright 2018-present Open Networking Foundation
# SPDX-License-Identifier: Apache-2.0
"""A portable build system for Stratum P4 switch stack.
To use this, load() this file in a BUILD file, specifying the symbols needed.
... | 2.015625 | 2 |
src/genie/libs/parser/ios/tests/test_show_platform.py | miuvlad/genieparser | 0 | 2859 | <filename>src/genie/libs/parser/ios/tests/test_show_platform.py
#!/bin/env python
import unittest
from unittest.mock import Mock
from pyats.topology import Device
from genie.metaparser.util.exceptions import SchemaEmptyParserError,\
SchemaMissingKeyError
from genie.libs.parser.i... | 1.585938 | 2 |
autumn/projects/covid_19/sri_lanka/sri_lanka/project.py | emmamcbryde/AuTuMN-1 | 0 | 2860 | <filename>autumn/projects/covid_19/sri_lanka/sri_lanka/project.py
import numpy as np
from autumn.calibration.proposal_tuning import perform_all_params_proposal_tuning
from autumn.core.project import Project, ParameterSet, load_timeseries, build_rel_path, get_all_available_scenario_paths, \
use_tuned_proposal_sds
fr... | 1.859375 | 2 |
Analytics/resources/themes/test_subthemes.py | thanosbnt/SharingCitiesDashboard | 4 | 2861 | import unittest
from http import HTTPStatus
from unittest import TestCase
import bcrypt
from flask.ctx import AppContext
from flask.testing import FlaskClient
from app import create_app
from models.theme import Theme, SubTheme
from models.users import Users
class TestSubTemes(TestCase):
"""
Unittest for the... | 2.75 | 3 |
selfdrive/sensord/rawgps/structs.py | TC921/openpilot | 0 | 2862 | from struct import unpack_from, calcsize
LOG_GNSS_POSITION_REPORT = 0x1476
LOG_GNSS_GPS_MEASUREMENT_REPORT = 0x1477
LOG_GNSS_CLOCK_REPORT = 0x1478
LOG_GNSS_GLONASS_MEASUREMENT_REPORT = 0x1480
LOG_GNSS_BDS_MEASUREMENT_REPORT = 0x1756
LOG_GNSS_GAL_MEASUREMENT_REPORT = 0x1886
LOG_GNSS_OEMDRE_MEASUREMENT_REPORT = 0x14DE
... | 1.679688 | 2 |
python2.7libs/hammer_tools/content_browser.py | anvdev/Hammer-Tools | 19 | 2863 | from __future__ import print_function
try:
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
except ImportError:
from PySide2.QtWidgets import *
from PySide2.QtGui import *
from PySide2.QtCore import *
import hou
from hammer_tools.utils import createAction
d... | 2.375 | 2 |
rt-thread/applications/server/udp_sender.py | luhuadong/stm32f769-disco-demo | 0 | 2864 | #!/usr/bin/python3
"""
UDP sender
"""
import socket
import time
import sys
smsg = b'\xaa\x08\xfe\x00\xc9\xe6\x5f\xee'
def main():
ip_port = ('192.168.3.188', 8888)
if len(sys.argv) < 2:
port = 8888
else:
port = int(sys.argv[1])
# 1. 创建 udp 套接字
udp_socket = socket.socket(s... | 2.8125 | 3 |
yudzuki/role.py | LunaProject-Discord/yudzuki.py | 6 | 2865 | <gh_stars>1-10
__all__ = (
"Role",
)
class Role:
def __init__(self, data):
self.data = data
self._update(data)
def _get_json(self):
return self.data
def __repr__(self):
return (
f"<Role id={self.id} name={self.name}>"
)
def __str__... | 2.65625 | 3 |
jassen/django/project/project/urls.py | cabilangan112/intern-drf-blog | 0 | 2866 | """project URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based... | 2.640625 | 3 |
deep-learning-app/src/models/__init__.py | everbrez/Deep-Learning-based-Chemical-Graphics-Analysis-Platform | 1 | 2867 | <reponame>everbrez/Deep-Learning-based-Chemical-Graphics-Analysis-Platform
print('init') | 0.820313 | 1 |
chemmltoolkit/tensorflow/callbacks/variableScheduler.py | Andy-Wilkinson/ChemMLToolk | 1 | 2868 | <reponame>Andy-Wilkinson/ChemMLToolk
import tensorflow as tf
class VariableScheduler(tf.keras.callbacks.Callback):
"""Schedules an arbitary variable during training.
Arguments:
variable: The variable to modify the value of.
schedule: A function that takes an epoch index (integer, indexed
... | 3.3125 | 3 |
join_peaks.py | nijibabulu/chip_tools | 0 | 2869 | #! /usr/bin/env python
import os
import sys
import math
import csv
import collections
import docopt
import peakzilla_qnorm_mapq_patched as pz
__doc__ = '''
Usage: join_peaks.py [options] PEAKS CHIP INPUT [ (PEAKS CHIP INPUT) ... ]
This script finds peaks in common between multiple ChIP experiments determined
by pe... | 2.859375 | 3 |
django_town/rest_swagger/views.py | uptown/django-town | 0 | 2870 | <filename>django_town/rest_swagger/views.py
from django_town.rest import RestApiView, rest_api_manager
from django_town.http import http_json_response
from django_town.cache.utlis import SimpleCache
from django_town.oauth2.swagger import swagger_authorizations_data
from django_town.social.oauth2.permissions import OAut... | 2.125 | 2 |
components/dash-core-components/tests/integration/dropdown/test_dynamic_options.py | mastermind88/dash | 0 | 2871 | from dash import Dash, Input, Output, dcc, html
from dash.exceptions import PreventUpdate
def test_dddo001_dynamic_options(dash_dcc):
dropdown_options = [
{"label": "New York City", "value": "NYC"},
{"label": "Montreal", "value": "MTL"},
{"label": "San Francisco", "value": "SF"},
]
... | 2.515625 | 3 |
Server.py | dipghoshraj/live-video-streming-with-web-socket | 3 | 2872 | <filename>Server.py<gh_stars>1-10
import cv2
import io
import socket
import struct
import time
import pickle
import zlib
client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client_socket.connect(('127.0.0.1', 8485))
connection = client_socket.makefile('wb')
cam = cv2.VideoCapture("E:/songs/Attention <NAME... | 2.609375 | 3 |
hal/agent/tf2_utils.py | gunpowder78/google-research | 1 | 2873 | <reponame>gunpowder78/google-research
# coding=utf-8
# Copyright 2022 The Google Research 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/LICEN... | 2.65625 | 3 |
wolk/logger_factory.py | Wolkabout/WolkConnect-Python- | 6 | 2874 | <reponame>Wolkabout/WolkConnect-Python-<gh_stars>1-10
"""LoggerFactory Module."""
# Copyright 2020 WolkAbout Technology s.r.o.
#
# 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
#
# ... | 2.609375 | 3 |
raw.py | andre-marcos-perez/data-pipeline-demo | 3 | 2875 | import json
import gzip
import requests
from datetime import datetime
import pendulum
import boto3
from botocore.exceptions import ClientError
from util.log import Log
from settings.aws_settings import AWSSettings
from settings.telegram_settings import TelegramSettings
def lambda_handler(event: dict, context: dict)... | 2.109375 | 2 |
v2_hier/site_stat.py | ruslan-ok/ruslan | 0 | 2876 | """Collecting statistics of site visits."""
import collections
from datetime import datetime
from functools import reduce
from django.utils.translation import gettext_lazy as _
from hier.models import IPInfo, AccessLog, SiteStat
from v2_hier.utils import APPS
def get_site_stat(user):
"""Processing a new portion of... | 2.578125 | 3 |
cli/pcluster/utils.py | mkosmo/cfncluster | 1 | 2877 | <gh_stars>1-10
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
# the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.... | 2.0625 | 2 |
thinkutils_plus/eventbus/sample/myeventbus.py | ThinkmanWang/thinkutils_plus | 0 | 2878 | __author__ = 'Xsank'
import time
from thinkutils_plus.eventbus.eventbus import EventBus
from myevent import GreetEvent
from myevent import ByeEvent
from mylistener import MyListener
if __name__=="__main__":
eventbus=EventBus()
eventbus.register(MyListener())
ge=GreetEvent('world')
be=ByeEvent('world'... | 2.109375 | 2 |
tools/telemetry/telemetry/core/platform/android_device_unittest.py | kjthegod/chromium | 1 | 2879 | <filename>tools/telemetry/telemetry/core/platform/android_device_unittest.py
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry import benchmark
from telemetry.core import brow... | 2.09375 | 2 |
logger.py | bekaaa/xgboost_tuner | 0 | 2880 | <reponame>bekaaa/xgboost_tuner<gh_stars>0
#! /usr/bin/env python
import logging
#---------------------------------------
class logger :
'''
A ready to use logging class.
All you need to do is set an object with the parameters (log_filename, directory to save it)
then whenever you want to add text, type obj.add("so... | 2.640625 | 3 |
baselines/prep_baseline.py | lessleslie/slm-code-generation | 64 | 2881 | import json
import multiprocessing as mp
import re
from argparse import ArgumentParser
from enum import Enum, auto
import javalang
from functools import partial
PRED_TOKEN = 'PRED'
modifiers = ['public', 'private', 'protected', 'static']
class TargetType(Enum):
seq = auto()
tree = auto()
@staticmethod
... | 2.4375 | 2 |
var/spack/repos/builtin/packages/r-multicool/package.py | varioustoxins/spack | 0 | 2882 | <gh_stars>0
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RMulticool(RPackage):
"""Permutations of multisets in cool-lex order
A se... | 1.601563 | 2 |
updatetranslations.py | erincerys/ergo | 1,122 | 2883 | <reponame>erincerys/ergo<gh_stars>1000+
#!/usr/bin/env python3
# updatetranslations.py
#
# tl;dr this script updates our translation file with the newest, coolest strings we've added!
# it manually searches the source code, extracts strings and then updates the language files.
# Written in 2018 by <NAME> <<EMAIL>>
#
#... | 2.1875 | 2 |
processing_tools/number_of_tenants.py | apanda/modeling | 3 | 2884 | <filename>processing_tools/number_of_tenants.py<gh_stars>1-10
import sys
from collections import defaultdict
def Process (fnames):
tenant_time = defaultdict(lambda: defaultdict(lambda: 0.0))
tenant_run = defaultdict(lambda: defaultdict(lambda:0))
for fname in fnames:
f = open(fname)
for l i... | 2.609375 | 3 |
pyfisher/mpi.py | borisbolliet/pyfisher | 7 | 2885 | from __future__ import print_function
import numpy as np
import os,sys,time
"""
Copied from orphics.mpi
"""
try:
disable_mpi_env = os.environ['DISABLE_MPI']
disable_mpi = True if disable_mpi_env.lower().strip() == "true" else False
except:
disable_mpi = False
"""
Use the below cleanup stuff only for inte... | 2.28125 | 2 |
ebay.py | SpironoZeppeli/Magic-The-Scannening | 0 | 2886 | <reponame>SpironoZeppeli/Magic-The-Scannening
import requests
import urllib.request
import urllib.parse
import PIL
import re
import configparser
import json
from PIL import Image
from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
from yaml import load
from PyQt5.QtWidgets im... | 2.609375 | 3 |
bot/exts/github/github.py | v1nam/gurkbot | 24 | 2887 | import typing
from bot.constants import BOT_REPO_URL
from discord import Embed
from discord.ext import commands
from discord.ext.commands.cooldowns import BucketType
from . import _issues, _profile, _source
class Github(commands.Cog):
"""
Github Category cog, which contains commands related to github.
... | 2.6875 | 3 |
log/slack_sender.py | SmashKs/BarBarian | 0 | 2888 | <gh_stars>0
from slackclient import SlackClient
from external import SLACK_API_KEY
class SlackBot:
API_CHAT_MSG = 'chat.postMessage'
BOT_NAME = 'News Bot'
DEFAULT_CHANNEL = 'news_notification'
def __new__(cls, *p, **k):
if '_the_instance' not in cls.__dict__:
cls._the_instance = ... | 2.5625 | 3 |
src/pytezos/block/forge.py | miracle2k/pytezos | 98 | 2889 | from typing import Any, Dict, List, Tuple
from pytezos.michelson.forge import forge_array, forge_base58, optimize_timestamp
def bump_fitness(fitness: Tuple[str, str]) -> Tuple[str, str]:
if len(fitness) == 0:
major = 0
minor = 1
else:
major = int.from_bytes(bytes.fromhex(fitness[0]), ... | 2.296875 | 2 |
python/paddle/fluid/tests/unittests/test_roi_pool_op.py | jichangjichang/Paddle | 9 | 2890 | # Copyright (c) 2018 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 required by app... | 1.953125 | 2 |
testproject/testapp/tests/__init__.py | movermeyer/django-firestone | 1 | 2891 | <reponame>movermeyer/django-firestone
from test_proxy import *
from test_serializers import *
from test_deserializers import *
from test_exceptions import *
from test_authentication import *
from test_whole_flow import *
from test_handlers_metaclass_magic import *
from test_handlers_serialize_to_python import *
f... | 1.585938 | 2 |
Day20.py | SheepiCagio/Advent-of-Code-2021 | 0 | 2892 | <gh_stars>0
import numpy as np
raw = open("inputs/20.txt","r").readlines()
input_array= [(i.replace('\n', '').replace('.','0').replace('#', '1')) for i in raw]
test_raw = open("inputs/20_test.txt","r").readlines()
test_array= [(i.replace('\n', '').replace('.','0').replace('#', '1')) for i in test_raw]
def addLayerZer... | 2.578125 | 3 |
questions/53349623/main.py | sesu089/stackoverflow | 302 | 2893 | <gh_stars>100-1000
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
class Demo(QtWidgets.QWidget):
def __init__(self):
super(Demo, self).__init__()
self.button = QtWidgets.QPushButton()
self.label = QtWidgets.QLabel(alignment=QtCore.Qt.AlignCenter)
self.combo = QtWidgets.QCom... | 2.390625 | 2 |
tests/test_error_descriptions_from_raises.py | iterait/apistrap | 6 | 2894 | import pytest
from apistrap.flask import FlaskApistrap
from apistrap.schemas import ErrorResponse
@pytest.fixture()
def app_with_raises(app):
oapi = FlaskApistrap()
@app.route("/", methods=["GET"])
def view():
"""
Something something.
:raises KeyError: KeyError description
... | 2.4375 | 2 |
projects/api/UsersApi.py | chamathshashika/projects-python-wrappers | 0 | 2895 | <reponame>chamathshashika/projects-python-wrappers
#$Id$
from projects.util.ZohoHttpClient import ZohoHttpClient
from projects.api.Api import Api
from projects.parser.UsersParser import UsersParser
base_url = Api().base_url
zoho_http_client = ZohoHttpClient()
parser = UsersParser()
class UsersApi:
"""Users Api c... | 2.765625 | 3 |
useless/tuck_arms.py | leader1313/Baxter_teleoperation_system | 0 | 2896 | #!/usr/bin/env python
# Copyright (c) 2013-2015, Rethink Robotics
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# ... | 1.539063 | 2 |
django-system/src/tsm_api/serializers.py | Deepak-Kharah/ioe-project | 0 | 2897 | <filename>django-system/src/tsm_api/serializers.py
from rest_framework import serializers
from .models import Measurement
class MeasurementSerializer(serializers.ModelSerializer):
class Meta:
model = Measurement
fields = '__all__'
| 1.492188 | 1 |
src/GalaxyDynamicsFromVc/units.py | pabferde/galaxy_dynamics_from_Vc | 0 | 2898 | <gh_stars>0
_Msun_kpc3_to_GeV_cm3_factor = 0.3/8.0e6
def Msun_kpc3_to_GeV_cm3(value):
return value*_Msun_kpc3_to_GeV_cm3_factor
| 1.382813 | 1 |
Python/leetcode.031.next-permutation.py | tedye/leetcode | 4 | 2899 | <reponame>tedye/leetcode<gh_stars>1-10
class Solution(object):
def nextPermutation(self, nums):
"""
:type nums: List[int]
:rtype: void Do not return anything, modify nums in-place instead.
"""
if not nums: return
n = len(nums)-1
while n > 0 and nums[n-1] >= nu... | 3.203125 | 3 |