max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_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() | # -*- coding:utf-8 -*-
from uiObject import uiObject
# main入口
if __name__ == '__main__':
ui = uiObject()
ui.ui_process() | zh | 0.450421 | # -*- coding:utf-8 -*- # main入口 | 1.003967 | 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(... | 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(... | en | 0.963489 | # Create your models here. | 2.372454 | 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,... | 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, params=params, headers={'Content-Type... | en | 0.446107 | # import related models here # Create a `get_request` to make HTTP GET requests # e.g., response = requests.get(url, params=params, headers={'Content-Type': 'application/json'}, # auth=HTTPBasicAuth('apikey', api_key)) # Create a `post_request` to make HTTP POST requests # e.g., resp... | 2.487169 | 2 |
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... | 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... | en | 0.789355 | ##### # Datasets to be added to metadata API ###### # The dataset* variables are optional, if these are set in config.ini this script will # not run the relevant DataUploader function # To upload with curl: cmd = upload.curl("tmp3.zip") # Max upload size for now is 5GB | 2.279253 | 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... | 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_result(hand_result... | de | 0.776076 | # useful helper #################################################################### # Tanyao hand by ron # #################################################################### # we had to use all 14 tiles in that array ######################################################... | 2.355716 | 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... | 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... | none | 1 | 2.152988 | 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,... | # 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, Union, overload
from .. import... | en | 0.693311 | # 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! *** A collection of values returned by getExternalNonContainerDatabase. The character set of the external database. The [OCID](https://docs.... | 1.654502 | 2 |
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... | 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... | none | 1 | 1.914 | 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):
# ... | # 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):
# ... | zh | 0.467177 | # 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): # self.val = x # ... | 3.728364 | 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... | #!/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... | ru | 0.26433 | #!/usr/bin/env python | 2.129056 | 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... | # 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.1900 64 bit (AMD64)]
# For more informat... | en | 0.601262 | # 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.1900 64 bit (AMD64)] # For more information v... | 2.283936 | 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... | #!/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... | en | 0.871826 | #!/usr/bin/env python Get vocabulary coutings from transformed corpora samples. Apply transforms to samples of specified data and build vocab from it. Transforms that need vocab will be disabled in this. Built vocab is saved in plain text format as following and can be pass as `-src_vocab` (and `-tgt_vocab... | 2.6296 | 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... | <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... | en | 0.930169 | # an experiment that trains models with subsets of the features according to their permutation importance rank # like SingleDatasetExperiment, this works on a specific grade | 2.546182 | 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:
... | 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:
... | en | 0.490656 | # Function to load image # img = np.roll(img, shift=1, axis=2) # CHECK IMAGE FORMAT # Function to load mask # print(msk, msk.shape) | 2.82606 | 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... | 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... | en | 0.813764 | # Assume we're a sub-module in a package. # Apparently no higher-level package has been imported, fall back to a local import. # @deprecated | 2.367053 | 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... | 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... | ja | 0.897194 | # 既存のjsonを読み込み # jsonの更新 # jsonの書き込み # 既存のjsonを読み込み # 画質の追加 # jsonの書き込み # プレイリストに書き込み # 既存のjsonを読み込み # 画質の追加 # jsonの書き込み # 既存のjsonを読み込み # 画質の追加 # jsonの書き込み | 2.714126 | 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.'''
... | 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.'''
GLOBAL = (2,... | en | 0.813351 | 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. An area of 1° x 1°. The side length of this tile varies with its location on the globe, but can be up to approximately 110km. Tile ad... | 3.147942 | 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... | """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... | en | 0.664448 | Array data-type implementations (abstraction points for GL array types # Python-coded version Lookup of handler for given value No array-type handler for type %s.%s (value: %s) registered Fast-path lookup for output handler object Unable to find any output handler at all (not even ctypes/numpy ones!) Register this clas... | 2.465229 | 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... | <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... | en | 0.729919 | # 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/licenses/LICENSE-2.0 # # Unless required by applicable law o... | 1.739457 | 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
#
... | <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
#
... | en | 0.832599 | # # 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 # # Unless required by applicable law or agreed to in writing, sof... | 2.194141 | 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... | 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... | en | 0.419409 | # <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 ## Date/time components #############################################################################... | 2.260981 | 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... | 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... | none | 1 | 1.879869 | 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... | # 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/LICENSE-2.0
#
# Unless require... | en | 0.79656 | # 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/LICENSE-2.0 # # Unless require... | 1.724788 | 2 |
dthm4kaiako/events/__init__.py | taskmaker1/dthm4kaiako | 3 | 2823 | """Module for events application."""
| """Module for events application."""
| en | 0.848727 | Module for events application. | 1.087641 | 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... | <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... | en | 0.367162 | # ============================= # Level-1 template class # ============================= # Return uint16 type data if the product is QA_flag or Line_tai93 # Validate # Convert DN to physical value # Get attrs set # Get unit # ============================= # Level-1 map-projection class # ============================= ... | 2.174064 | 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()
... | 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()
... | el | 0.054074 | # @return a string # result.reverse() | 3.531184 | 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... | # 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
import signal
imp... | en | 0.836196 | # 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. # Cache the string-escape codec to ensure subprocess can find it # later. Return value doe... | 2.454651 | 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... | <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... | en | 0.850642 | # Generated by Django 4.0.2 on 2022-02-26 15:52 | 1.751985 | 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... | <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... | none | 1 | 2.264713 | 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
... | #!/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
... | da | 0.069062 | #!/usr/bin/python Unit test SDB Tree def test_simple_rom(self): rom_in = ROM1 som = parse_rom_image(rom_in) rom_out = generate_rom_image(som) rom_out = sdbc.convert_rom_to_32bit_buffer(rom_out) self.assertEqual(rom_in, rom_out) #print "Found Dionysus" #rom_in = ROM2 #print_sdb_ro... | 2.165167 | 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... | #!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... | en | 0.639206 | #!python3 # gpu_devices = tf.config.experimental.list_physical_devices("GPU") # for device in gpu_devices: # tf.config.experimental.set_memory_growth(device, True) # accuracy at given epoch # Things done on beginning of epoch. # things done on end of the epoch | 2.538388 | 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... | #!/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"
taget_url: "http://mockbin.com"
request_host: "mockbin.com"
state: present
- ... | en | 0.579579 | #!/usr/bin/python --- module: kong short_description: Configure a Kong API Gateway - name: Register a site kong: kong_admin_uri: http://127.0.0.1:8001/apis/ name: "Mockbin" taget_url: "http://mockbin.com" request_host: "mockbin.com" state: present - name: Delete a site kong: kong_admi... | 2.311579 | 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... | 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, line, draw_points=False, draw_as_segment=False, linewidth=1.0, linestyle='solid... | none | 1 | 2.650954 | 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[:... | # -*- 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[:... | en | 0.795133 | # -*- encoding: utf8 -*- # Load dataset # Split dataset into training set and test set # Generating model # Training the model # Predict the response for test dataset # Evaluating the model # Plot prediction results and prototypes | 3.303898 | 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... | #!/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... | en | 0.699921 | #!/usr/bin/env python # coding: utf-8 # In[ ]: #Importing all required libraries # In[ ]: # In[ ]: #Checking for correct cuda and tf versions # 9.0 in v1.10.0 # 7 in v1.10.0 # In[ ]: # In[ ]: # In[ ]: # In[ ]: # In[ ]: #Train and test data folder # In[ ]: # In[ ]: #count how many images are there # In[ ]: # In[ ]: #get... | 2.465904 | 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... | # 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
# unittests and instrumentation test apks.
{
'ta... | en | 0.85756 | # 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. # Intermediate target grouping the android tools needed to run native # unittests and instrumentation test apks. | 1.2835 | 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... | #!/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
from test_framework.util import *
from tes... | en | 0.736731 | #!/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. # 61bc221a counter() # 61bc221a counter() # 61bc221a counter() # Select as input a tx which has at least 5... | 2.020485 | 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... | 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 = False
def __init__(self, urlpath, storage_options=N... | en | 0.645498 | Parameters ---------- urlpath: str, location of model pkl file Either the absolute or relative path to the file or URL to be opened. Some examples: - ``{{ CATALOG_DIR }}/models/model.pkl`` - ``s3://some-bucket/models/model.pkl`` | 2.113229 | 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... | """
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... | en | 0.879129 | 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 that's... | 3.719317 | 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
... | 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
... | en | 0.884436 | This will generate the report based on the users Steam ID. Returns JSON :param name: Steam ID (either numerical ID or vanity url: steamcommunity.com/id/moird :return: Json object that contains listing of all linux games and general information about them: { "steamuser": "real steam name", "... | 2.675109 | 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... | # -*- 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 read_params
from .validate import Validator
def run_module():
"""Run the validator... | en | 0.790166 | # -*- 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`. Run the validator as a module. | 2.404209 | 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... | 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... | en | 0.736474 | A sequence data loader where the files are arranged in this way: root/scene_1/0000000.jpg root/scene_1/0000000.npy root/scene_1/0000001.jpg root/scene_1/0000001.npy .. root/scene_2/0000000.jpg root/scene_2/0000000.npy . transform functions must ta... | 2.707672 | 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... | #!/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] + alphabet[half:] + al... | en | 0.423472 | #!/usr/bin/python The Rot18 Cipher Encryption method :param text: Text to encrypt :param key: is not used :param alphabet: is not used :type text: string :type key: integer :type alphabet: string :return: text :rtype: string Decryption method :pa... | 3.706856 | 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... | 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(SpecialPropType):
__slots__ = ... | none | 1 | 2.626792 | 3 | |
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... | # 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... | en | 0.774662 | # 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.100171 | 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 =... | 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 =... | none | 1 | 2.094506 | 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)
... | 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)
# --- #
# Grafo Completo
grafo... | en | 0.646492 | # Grafo da Paraíba # --- # # Grafo Completo # --- # # K3 # --- # | 2.638725 | 3 |
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... | <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... | en | 0.575574 | # -*- coding: utf-8 -*- #save factory in model #save in public server: leancloud and baidu #print respone.read() # save in Baidu Map #print str(req) #print respone.read() | 1.949445 | 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... | 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... | none | 1 | 2.149721 | 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... | # 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... | en | 0.959709 | # Factory-like class for mortgage options # how much you are paying for the house # Mortgage annual interest rate # Mortgage length (in years) # Percentage of house cost paid upfront # Amount of money you have before purchase # Annual rate of return of savings # Annual rate of inflation - NOT IMPLEMENTED # Annual rate ... | 2.940657 | 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... | 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... | none | 1 | 2.397592 | 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... | 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+", encoding="utf-8")
sys.stdout = fout
yield fout
fi... | none | 1 | 2.368826 | 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... | 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... | none | 1 | 2.814673 | 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... | <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... | none | 1 | 1.839647 | 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... | # -*- 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... | en | 0.266009 | # -*- coding=utf-8 -*- # 读取文件序列 # 将DICOM序列转化成MHD文件 # 读取单个DICOM文件 # 读取mhd文件 # 保存mhd文件 # 根据文件名返回期项名 # 读取DICOM文件中包含的病例ID信息 # 返回病灶类型和ID的字典类型的数据 key是typename value是typeid # 返回病灶类型ID和名称的字典类型的数据 key是typeid value是typename # 根据病灶类型的ID返回类型的字符串 # 根据病灶类型的name返回id的字符串 # 填充图像 # image.show() 返回进行kernel操作的5个模版 (1个是正常的dilated操作,还有四个是分别... | 2.326783 | 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... | 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... | none | 1 | 1.287505 | 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... | # 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 in writing,... | en | 0.790899 | # 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 in writing,... | 1.472682 | 1 |
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... | 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 as slim
import thr... | en | 0.200263 | # Disabe # Restore # Force Print # task = '{f}__{t}__{hs}'.format(f=task_from, t=task_to, hs=args.hs) ############## Load Configs ############## ############## Set Up Inputs ############## # tf.logging.set_verbosity( tf.logging.INFO ) # is_training determines whether to use train/validaiton # utils.print_start_info( cf... | 2.039172 | 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.
... | # 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.
The public symbols are the macros:
decorate(path)
sc_cc_lib ... | en | 0.780401 | # 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. The public symbols are the macros: decorate(path) sc_cc_lib ... | 2.059658 | 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... | <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... | en | 0.671614 | #!/bin/env python \ ROM: Bootstrap program is IOSv \ Cisco IOS Software, IOSv Software (VIOS-ADVENTERPRISEK9-M), Version 15.6(3)M2, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2017 by Cisco Systems, Inc. Compiled Wed 29-Mar-17 14:... | 1.581451 | 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... | <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... | en | 0.55141 | # Load and configure model parameters. #scenario_paths = [build_rel_path(f"params/scenario-{i}.yml") for i in range(7, 9)] #scenario_params = [baseline_params.update(p) for p in scenario_paths] # Dispersion parameters based on targets # Regional parameters # Detection #VoC # Load proposal sds from yml file # use_tuned_... | 1.866327 | 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... | 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... | en | 0.818775 | Unittest for the creation, renaming and deleting of Themes Setup a FlaskClient for testing, creates an admin user and creates the authorization header for requests to the Flask Client and a dummy theme Create flask testing client :return: FlaskClient for tests and AppContext Create SubTheme for tests ... | 2.745936 | 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
... | 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
... | en | 0.658996 | uint8_t version; uint32_t f_count; uint8_t glonass_cycle_number; uint16_t glonass_number_of_days; uint32_t milliseconds; float time_bias; float clock_time_uncertainty; float clock_frequency_bias; float clock_frequency_uncertainty; uint8_t sv_count; uint8_t sv_id; int8_t frequency_index; uint8_t ob... | 1.676742 | 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... | 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... | de | 0.430901 | # Type hint # Type hint # Type hint # Type hint # Type hint # Type hint # Type hint # Type hint | 2.365036 | 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... | #!/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... | ja | 0.145463 | #!/usr/bin/python3 UDP sender # 1. 创建 udp 套接字 # 2. 绑定本地信息 # 3. 接收发送的数据 #loop = 10 #while loop > 0: #loop = loop -1 #recv_data = udp_socket.recvfrom(1024) #print(recv_data.decode('gbk')) #print(recv_data.decode('utf-8')) #print('.', end=' ') #data = recv_data.decode('utf-8') #print('0x%x'%data) # 7. 关闭套接字 | 2.811073 | 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__... | __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__(self):
... | none | 1 | 2.673772 | 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... | """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... | en | 0.554183 | 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 vi... | 2.630597 | 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') | print('init') | none | 1 | 0.890087 | 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
... | 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
from 0) and current variable ... | en | 0.741493 | 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 from 0) and current variable value as input and returns a new value to assign to the variable as output.... | 3.341411 | 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... | #! /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... | en | 0.604821 | #! /usr/bin/env python Usage: join_peaks.py [options] PEAKS CHIP INPUT [ (PEAKS CHIP INPUT) ... ] This script finds peaks in common between multiple ChIP experiments determined by peakzilla. For each ChIP experiment, input a PEAKS file as otuput by peakzilla, and 2 BED files (CHIP and INPUT) as input to peakzilla. Th... | 2.845151 | 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... | <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... | none | 1 | 2.123836 | 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"},
]
... | 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"},
]
... | en | 0.623679 | # Get the inner input used for search value. # Focus on the input to open the options menu # No options to be found with `x` in them, should show the empty message. # Should show all options. # Searching for `on` | 2.509241 | 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... | <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... | en | 0.415691 | # data = zlib.compress(pickle.dumps(frame, 0)) | 2.598694 | 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... | # 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/LICENSE-2.0
#
# Unless required by applicab... | en | 0.748091 | # 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/LICENSE-2.0 # # Unless required by applicab... | 2.935197 | 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
#
# ... | """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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | en | 0.734271 | 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re... | 2.832719 | 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)... | 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)... | none | 1 | 2.110344 | 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... | """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... | en | 0.900021 | Collecting statistics of site visits. Processing a new portion of log file records. The site applications that users have visited and information about their IP addresses will be shown. #Determining the last previously processed log file entry # New records # Save last processed log record #raise Exception(last_re... | 2.577343 | 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.... | # 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.txt" file accom... | en | 0.753448 | # 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.txt" file accom... | 2.053934 | 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'... | __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'... | none | 1 | 2.095896 | 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... | <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... | en | 0.920644 | # 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. # pick one | 2.088356 | 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... | #! /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("some text").
The function obj.close() is no... | en | 0.445403 | #! /usr/bin/env python #--------------------------------------- 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("some text"). The function obj.close() is not important, I just added it for cove... | 3.269851 | 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
... | 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
... | en | 0.647066 | # Find words in a string. Order matters! [A-Z]+(?=[A-Z][a-z]) | # All upper case before a capitalized word [A-Z]?[a-z]+ | # Capitalized words / all lower case [A-Z]+ | # All upper case \d+ | # Numbers _ | \" | .+ #examples = [process_line(target_type, max_targets, max_nodes, line) for lin... | 2.429056 | 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... | # 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 set of tools t... | en | 0.817994 | # 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) Permutations of multisets in cool-lex order A set of tools to permute multisets without loops or hash tables and to ... | 1.624227 | 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>>
#
#... | #!/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>>
#
# To the extent possible under law, the a... | en | 0.766039 | #!/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>> # # To the extent possible under law, the au... | 2.355673 | 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... | <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... | en | 0.335122 | #print "%d %d %f"%(k, runs[k], machines[k]/float(runs[k])) | 2.593889 | 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... | 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... | en | 0.77272 | Copied from orphics.mpi Use the below cleanup stuff only for intel-mpi! If you use it on openmpi, you will have no traceback for errors causing hours of endless confusion and frustration! - Sincerely, past frustrated Mat # From Sigurd's enlib.mpi: # Uncaught exceptions don't cause mpi to abort. This can lead to thousan... | 2.279789 | 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... | 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 import QMessageBox
class EbaySeller:
def ... | en | 0.87393 | # Resize card # Upload to PictShare # Fix using regular expression, may not be needed at a later date # Upload to ebay # Display card info in CLI | 2.744117 | 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.
... | 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.
... | en | 0.795427 | Github Category cog, which contains commands related to github. Commands: ├ profile Fetches a user's GitHub information. ├ issue Command to retrieve issue(s) from a GitHub repository. └ source Displays information about the bot's source code. Commands for Github. Fetche... | 2.681815 | 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 = ... | 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 = object.__new... | none | 1 | 2.625916 | 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]), ... | 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]), ... | none | 1 | 2.29234 | 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... | # 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... | en | 0.854024 | # 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.950215 | 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... | 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 *
from test_handlers_is_method_allowed im... | none | 1 | 1.567973 | 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... | 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 addLayerZero(grid):
#if... | pl | 0.181603 | #if sum(np.asarray(grid)[:,0]) > 0: #if sum(np.asarray(grid)[0,:]) > 0: # if sum(np.asarray(grid)[:,-1]) > 0: # if sum(np.asarray(grid)[-1,:]) > 0: #if sum(np.asarray(grid)[:,0]) > 0: #if sum(np.asarray(grid)[0,:]) > 0: # if sum(np.asarray(grid)[:,-1]) > 0: # if sum(np.asarray(grid)[-1,:]) > 0: #pictureEnhancer(test_ar... | 2.710834 | 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... | 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.QComboBox(self)
... | none | 1 | 2.491554 | 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
... | 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
... | en | 0.508582 | Something something. :raises KeyError: KeyError description Something something. :raises KeyError: KeyError description | 2.437352 | 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... | #$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 class is used to
1.Get all the users in th... | en | 0.678647 | #$Id$ Users Api class is used to 1.Get all the users in the given project. Initialize Users api using user's authtoken and portal id. Args: authtoken(str): User's authtoken. portal_id(str): User's portal id. Get all the users in the given project. Args: pr... | 2.814191 | 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,
# ... | #!/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,
# ... | en | 0.737285 | #!/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.540211 | 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__'
| <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__'
| none | 1 | 1.487343 | 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
| _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 | none | 1 | 1.38297 | 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... | 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] >= nums[n]:
n -= 1
t = n... | en | 0.370268 | :type nums: List[int] :rtype: void Do not return anything, modify nums in-place instead. | 3.380309 | 3 |