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 |
|---|---|---|---|---|---|---|---|---|---|---|
city-infrastructure-platform/settings.py | City-of-Helsinki/city-infrastructure-platform | 2 | 10500 | """
Django settings for city-infrastructure-platform project.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
import environ
import sentry_sdk
from djan... | """
Django settings for city-infrastructure-platform project.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
import environ
import sentry_sdk
from djan... | en | 0.671484 | Django settings for city-infrastructure-platform project. For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ # noqa: F401 # Set up .env file # one of: prod, qa, stage, tes... | 2.06058 | 2 |
test/tc/tet_tc_base_predict_multiclass.py | dumpmemory/Pytorch-NLU | 115 | 10501 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, 预测模块-多类分类
# 适配linux
import platform
import json
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
path_sys = os.path.join(path_root, "pytorch_nlu", "pyto... | # !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, 预测模块-多类分类
# 适配linux
import platform
import json
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
path_sys = os.path.join(path_root, "pytorch_nlu", "pyto... | en | 0.368585 | # !/usr/bin/python # -*- coding: utf-8 -*- # @time : 2021/7/25 19:30 # @author : Mo # @function: predict model, 预测模块-多类分类 # 适配linux # os.environ["CUDA_VISIBLE_DEVICES"] = "-1" | 2.550212 | 3 |
tests/test_create_spreadsheet_values.py | Tunous/StringSheet | 14 | 10502 | import unittest
from stringsheet.parser import create_spreadsheet_values
from stringsheet.parser import create_language_sheet_values
from stringsheet.parser import parse_resources
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.resources = parse_resources('test-resources/res')
class Create... | import unittest
from stringsheet.parser import create_spreadsheet_values
from stringsheet.parser import create_language_sheet_values
from stringsheet.parser import parse_resources
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.resources = parse_resources('test-resources/res')
class Create... | none | 1 | 2.603074 | 3 | |
libs/imgutils.py | EpicKiwi/projet-datascience | 0 | 10503 | <reponame>EpicKiwi/projet-datascience
import cv2
def img_path2array(path):
return cv2.cvtColor(cv2.imread(path, 10), cv2.COLOR_BGR2RGB)
def img_array2file(path, array):
cv2.imwrite(path, cv2.cvtColor(array, cv2.COLOR_RGB2BGR)) | import cv2
def img_path2array(path):
return cv2.cvtColor(cv2.imread(path, 10), cv2.COLOR_BGR2RGB)
def img_array2file(path, array):
cv2.imwrite(path, cv2.cvtColor(array, cv2.COLOR_RGB2BGR)) | none | 1 | 2.700488 | 3 | |
bin/nsa_fail/nsa_fail.py | changhoonhahn/SEDflow | 18 | 10504 | import os, sys
import numpy as np
from sedflow import obs as Obs
from sedflow import train as Train
from provabgs import infer as Infer
from provabgs import models as Models
####################################################
# input
####################################################
sample = sys.argv[1]
itrain... | import os, sys
import numpy as np
from sedflow import obs as Obs
from sedflow import train as Train
from provabgs import infer as Infer
from provabgs import models as Models
####################################################
# input
####################################################
sample = sys.argv[1]
itrain... | de | 0.437012 | #################################################### # input #################################################### #################################################### # compile NSA failures #################################################### # u, g, r, i, z, sigma_u, sigma_g, sigma_r, sigma_i, sigma_z, redshift # conv... | 2.056662 | 2 |
studio/gs_provider.py | NunoEdgarGFlowHub/studio | 0 | 10505 | import json
import time
import re
from .keyvalue_provider import KeyValueProvider
from .gcloud_artifact_store import GCloudArtifactStore
from .util import timeit
class GSProvider(KeyValueProvider):
def __init__(self, config, blocking_auth=True, verbose=10, store=None):
self.config = config
self.b... | import json
import time
import re
from .keyvalue_provider import KeyValueProvider
from .gcloud_artifact_store import GCloudArtifactStore
from .util import timeit
class GSProvider(KeyValueProvider):
def __init__(self, config, blocking_auth=True, verbose=10, store=None):
self.config = config
self.b... | none | 1 | 2.145688 | 2 | |
gslib/tests/test_ls.py | MikeJeffrey/gsutil | 0 | 10506 | <filename>gslib/tests/test_ls.py
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | <filename>gslib/tests/test_ls.py
# -*- coding: utf-8 -*-
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licens... | en | 0.894952 | # -*- coding: utf-8 -*- # Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require... | 1.770328 | 2 |
onadata/libs/utils/audit.py | ubpd/kobocat | 0 | 10507 | # coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
HOME_ACCESSED = "home-accessed"
| # coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
HOME_ACCESSED = "home-accessed"
| en | 0.833554 | # coding: utf-8 | 1.033237 | 1 |
places/management/commands/load_places.py | aevtikheev/dvmn-yandex-afisha | 0 | 10508 | import logging
from urllib.parse import unquote, urlparse
from pathlib import PurePosixPath
import requests
from requests.exceptions import ReadTimeout, ConnectionError, HTTPError
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from places.models import Place, Image
... | import logging
from urllib.parse import unquote, urlparse
from pathlib import PurePosixPath
import requests
from requests.exceptions import ReadTimeout, ConnectionError, HTTPError
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from places.models import Place, Image
... | none | 1 | 2.192505 | 2 | |
gslib/utils/ls_helper.py | dickmao/gsutil | 1 | 10509 | # -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | # -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | en | 0.76106 | # -*- coding: utf-8 -*- # Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require... | 1.453304 | 1 |
app/config/cnMysql.py | itay-moav/rahl_commander | 1 | 10510 | <filename>app/config/cnMysql.py
'''
Created on Dec 28, 2021
@author: Itay
Abstracting the DB connection piece
'''
import mysql.connector as My
from app import logging as L
from app import exceptions as exceptions
class Connection():
'''
Abstracting the actions on a DB
'''
def __init__(self, connectio... | <filename>app/config/cnMysql.py
'''
Created on Dec 28, 2021
@author: Itay
Abstracting the DB connection piece
'''
import mysql.connector as My
from app import logging as L
from app import exceptions as exceptions
class Connection():
'''
Abstracting the actions on a DB
'''
def __init__(self, connectio... | en | 0.859796 | Created on Dec 28, 2021 @author: Itay Abstracting the DB connection piece Abstracting the actions on a DB | 2.794736 | 3 |
src/detector/pre_process_test_data.py | DomGonthier/PecheFantome | 0 | 10511 | import os
from tqdm import tqdm
import cv2
import numpy as np
#pre process test data:
path = "raw_test_data/"
list_width = []
list_height = []
list_image = []
def pre_process():
print("analyze images")
for Files in tqdm(os.listdir(path)):
if "jpg" in Files:
#print(Files)
img = ... | import os
from tqdm import tqdm
import cv2
import numpy as np
#pre process test data:
path = "raw_test_data/"
list_width = []
list_height = []
list_image = []
def pre_process():
print("analyze images")
for Files in tqdm(os.listdir(path)):
if "jpg" in Files:
#print(Files)
img = ... | en | 0.481555 | #pre process test data: #print(Files) #print(width) #print(height) #print(image) # image dimension needs to be a multiple of 16 # image needs to be squared #print("delta height",delta_height) #print("delta width",delta_width) #list_image.append(pad_img) | 2.852944 | 3 |
tensorflow/python/training/localhost_cluster_performance_test.py | connectthefuture/tensorflow | 101 | 10512 | # Copyright 2016 The TensorFlow 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 applica... | # Copyright 2016 The TensorFlow 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 applica... | en | 0.838423 | # Copyright 2016 The TensorFlow 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 applica... | 1.793451 | 2 |
extractor/util.py | bcskda/vk-archive-deepercopy | 1 | 10513 | import functools
import glob
import itertools
import logging
import os
from progressbar import progressbar
import re
import requests
from typing import List
class ValueSingleDispatch:
def __init__(self):
self._handlers = dict()
def register(self, key):
def decorator(fn: callable):
... | import functools
import glob
import itertools
import logging
import os
from progressbar import progressbar
import re
import requests
from typing import List
class ValueSingleDispatch:
def __init__(self):
self._handlers = dict()
def register(self, key):
def decorator(fn: callable):
... | en | 0.871351 | Glob and sort alpahnumerically. Limitations: exactly one `*', no `?', file names with single extention. Generator # TODO statistics by extention | 2.470792 | 2 |
setup.py | gillins/pyshepseg | 5 | 10514 | <reponame>gillins/pyshepseg
#Copyright 2021 <NAME> and <NAME>. All rights reserved.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without restriction,
#including without limitation the ri... | #Copyright 2021 <NAME> and <NAME>. All rights reserved.
#
#Permission is hereby granted, free of charge, to any person
#obtaining a copy of this software and associated documentation
#files (the "Software"), to deal in the Software without restriction,
#including without limitation the rights to use, copy, modify,
... | en | 0.738971 | #Copyright 2021 <NAME> and <NAME>. All rights reserved. # #Permission is hereby granted, free of charge, to any person #obtaining a copy of this software and associated documentation #files (the "Software"), to deal in the Software without restriction, #including without limitation the rights to use, copy, modify, #mer... | 1.792206 | 2 |
src/utils.py | daochenzha/SimTSC | 23 | 10515 | import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def read_dataset_from_npy(path):
""" Read dataset from .npy file
"""
data = np.load(path, allow_pickle=True)
return data[()]['X'], data[()]['y'], data[()]['train_idx'], data[()]['test_idx']
def read_dataset... | import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def read_dataset_from_npy(path):
""" Read dataset from .npy file
"""
data = np.load(path, allow_pickle=True)
return data[()]['X'], data[()]['y'], data[()]['train_idx'], data[()]['test_idx']
def read_dataset... | en | 0.738589 | Read dataset from .npy file Read univariate dataset from UCR # znorm # add a dimension to make it multivariate with one dimension Read multivariate dataset # znorm Read the raw time-series | 2.8779 | 3 |
mpinterfaces/mat2d/friction/analysis.py | yw-fang/MPInterfaces | 56 | 10516 | <filename>mpinterfaces/mat2d/friction/analysis.py
from __future__ import print_function, division, unicode_literals
import os
import warnings
import numpy as np
from scipy import interpolate
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from pymatgen.io.vasp.outputs import Vasprun
from py... | <filename>mpinterfaces/mat2d/friction/analysis.py
from __future__ import print_function, division, unicode_literals
import os
import warnings
import numpy as np
from scipy import interpolate
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
from pymatgen.io.vasp.outputs import Vasprun
from py... | en | 0.736389 | Calculate the "corrugation factor" for a 2D material. The corrugation factor is defined as the sum of the outer hemispheres of ionic radii of the atoms on the material's top and bottom surfaces, divided by the planar area of the whole unit cell's 001 plane. Top and bottom corrugation factors are ret... | 2.956871 | 3 |
aiopylimit/tests/test_aiopylimit.py | zealotous/aiopylimit | 4 | 10517 | from aiopylimit import AIOPyRateLimit
from aiopylimit import AIOPyRateLimitException
import asynctest
import asyncio
class TestPyLimit(asynctest.TestCase):
async def test_exception(self):
limit = AIOPyRateLimit(10, 10)
await self.assertAsyncRaises(AIOPyRateLimitException,
... | from aiopylimit import AIOPyRateLimit
from aiopylimit import AIOPyRateLimitException
import asynctest
import asyncio
class TestPyLimit(asynctest.TestCase):
async def test_exception(self):
limit = AIOPyRateLimit(10, 10)
await self.assertAsyncRaises(AIOPyRateLimitException,
... | none | 1 | 2.396283 | 2 | |
bookworm/platform_services/_win32/tesseract_download.py | mush42/bookworm | 18 | 10518 | # coding: utf-8
import sys
import shutil
import requests
import wx
from pathlib import Path
from urllib.parse import urljoin, urlsplit
from tempfile import TemporaryFile
from zipfile import ZipFile
from bookworm import typehints as t
from bookworm import app
from bookworm.http_tools import RemoteJsonResource, HttpReso... | # coding: utf-8
import sys
import shutil
import requests
import wx
from pathlib import Path
from urllib.parse import urljoin, urlsplit
from tempfile import TemporaryFile
from zipfile import ZipFile
from bookworm import typehints as t
from bookworm import app
from bookworm.http_tools import RemoteJsonResource, HttpReso... | en | 0.568374 | # coding: utf-8 # Translators: title of a messagebox # Translators: content of a messagebox # Translators: title of a messagebox | 2.226008 | 2 |
python/plugins/processing/algs/grass7/ext/v_proj.py | dyna-mis/Hilabeling | 0 | 10519 | # -*- coding: utf-8 -*-
"""
***************************************************************************
v_proj.py
---------
Date : November 2017
Copyright : (C) 2017 by <NAME>
Email : medspx at medspx dot fr
*************************************************... | # -*- coding: utf-8 -*-
"""
***************************************************************************
v_proj.py
---------
Date : November 2017
Copyright : (C) 2017 by <NAME>
Email : medspx at medspx dot fr
*************************************************... | en | 0.614673 | # -*- coding: utf-8 -*- *************************************************************************** v_proj.py --------- Date : November 2017 Copyright : (C) 2017 by <NAME> Email : medspx at medspx dot fr ******************************************************... | 1.890194 | 2 |
examples/diode/gmsh_diode2d.py | QuantumOfMoose/devsim | 0 | 10520 | <filename>examples/diode/gmsh_diode2d.py
# Copyright 2013 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | <filename>examples/diode/gmsh_diode2d.py
# Copyright 2013 Devsim LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | en | 0.806307 | # Copyright 2013 Devsim LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s... | 2.442997 | 2 |
python/astro_imaging/config.py | taranu/astro_imaging | 0 | 10521 | <reponame>taranu/astro_imaging
from dataclasses import dataclass
import os
path_base_default = os.getenv('ASTRO_IMAGING_DATA_PATH', default='./')
@dataclass
class Paths:
base: str = path_base_default
catalogs: str = None
images: str = None
def __post_init__(self):
if self.catalogs is None:
... | from dataclasses import dataclass
import os
path_base_default = os.getenv('ASTRO_IMAGING_DATA_PATH', default='./')
@dataclass
class Paths:
base: str = path_base_default
catalogs: str = None
images: str = None
def __post_init__(self):
if self.catalogs is None:
self.catalogs = os.p... | none | 1 | 2.544549 | 3 | |
AT.py | MTandHJ/roboc | 8 | 10522 | <reponame>MTandHJ/roboc
#!/usr/bin/env python
from typing import Tuple
import argparse
from src.loadopts import *
METHOD = "RobOC-AT"
SAVE_FREQ = 5
PRINT_FREQ = 20
FMT = "{description}={scale}-{leverage}" \
"={learning_policy}-{optimizer}-{lr}" \
"={attack}-{epsilon:.4f}-{stepsize}-{steps}" \
... | #!/usr/bin/env python
from typing import Tuple
import argparse
from src.loadopts import *
METHOD = "RobOC-AT"
SAVE_FREQ = 5
PRINT_FREQ = 20
FMT = "{description}={scale}-{leverage}" \
"={learning_policy}-{optimizer}-{lr}" \
"={attack}-{epsilon:.4f}-{stepsize}-{steps}" \
"={batch_size}={trans... | en | 0.685364 | #!/usr/bin/env python # for orthogonal classifier # adversarial training settings # basic settings # the model and other settings for training # load the dataset # load the optimizer and learning_policy # generate the path for logging information and saving parameters # set the attack | 2.463921 | 2 |
notesapp/api_v1/models.py | kampkelly/drf_template | 0 | 10523 | from django.db import models
# Create your models here.
class CommonFieldsMixin(models.Model):
"""Add created_at and updated_at fields."""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
"""Define metadata options.... | from django.db import models
# Create your models here.
class CommonFieldsMixin(models.Model):
"""Add created_at and updated_at fields."""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
"""Define metadata options.... | en | 0.82233 | # Create your models here. Add created_at and updated_at fields. Define metadata options. | 2.411068 | 2 |
src/main_TS_tsconv_jma.py | inoue0406/radarJMA | 6 | 10524 | # seq2seq LSTM (no-convolutional model) for time series prediction
import numpy as np
import torch
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import pandas as pd
import h5py
import os
import sys
import json
import time
import pdb
from jma_timeseries_dataset import... | # seq2seq LSTM (no-convolutional model) for time series prediction
import numpy as np
import torch
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import pandas as pd
import h5py
import os
import sys
import json
import time
import pdb
from jma_timeseries_dataset import... | en | 0.730113 | # seq2seq LSTM (no-convolutional model) for time series prediction #params, "+str(p.numel())+"\n") # parse command-line options # create result dir # generic log file # model information # prepare scaler for data # loading datasets #tstdata = next(iter(train_dataset)) # lstm seq2seq model # Use pretrained weights for t... | 2.293006 | 2 |
bell2014/energy/prob_abs_s.py | dmaugis/intrinsic | 134 | 10525 | <gh_stars>100-1000
import numpy as np
class ProbAbsoluteShading(object):
def __init__(self, params):
self.params = params
def cost(self, s_nz):
if self.params.abs_shading_weight:
if self.params.abs_shading_log:
return self.params.abs_shading_weight * \
... | import numpy as np
class ProbAbsoluteShading(object):
def __init__(self, params):
self.params = params
def cost(self, s_nz):
if self.params.abs_shading_weight:
if self.params.abs_shading_log:
return self.params.abs_shading_weight * \
np.abs(np.l... | none | 1 | 2.583698 | 3 | |
onemsdk/parser/tag.py | mvnm/onemsdk | 0 | 10526 | import inspect
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Union, Type, Optional, Dict, Any
from pydantic import BaseModel
from onemsdk.exceptions import NodeTagMismatchException, ONEmSDKException
from .node import Node
__all__ = ['Tag', 'HeaderTag', 'FooterTag', 'Br... | import inspect
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Union, Type, Optional, Dict, Any
from pydantic import BaseModel
from onemsdk.exceptions import NodeTagMismatchException, ONEmSDKException
from .node import Node
__all__ = ['Tag', 'HeaderTag', 'FooterTag', 'Br... | en | 0.845596 | # standard HTML5 input values # not standard # standard HTML5 attributes # only for type="hidden" # not standard # Add a temporary \n for help # Do not include header # Do not include footer # Remove the temporary \n # Note that boolean attributes in HTML are evaluated to True if they are # present (their actual value ... | 2.379118 | 2 |
backend/syntax/rule.py | austinmarsray/Ccompiler | 0 | 10527 | class Sign:
"""
符号
"""
def __init__(self, sign_type, sign_str='', sign_line=-1):
"""
构造
:param sign_type: 符号的类型
:param sign_str: 符号的内容(可以为空)
:param sign_line: 符号所在行数(可以为空)
"""
self.type = sign_type
self.str = sign_str
self.line = si... | class Sign:
"""
符号
"""
def __init__(self, sign_type, sign_str='', sign_line=-1):
"""
构造
:param sign_type: 符号的类型
:param sign_str: 符号的内容(可以为空)
:param sign_line: 符号所在行数(可以为空)
"""
self.type = sign_type
self.str = sign_str
self.line = si... | en | 0.301673 | 符号 构造 :param sign_type: 符号的类型 :param sign_str: 符号的内容(可以为空) :param sign_line: 符号所在行数(可以为空) 是不是终结符 :return: True/False 是不是非终结符 :return: True/False 是不是空字 :return: True/False 产生式 产生式左边 :param left_type: 产生式左边的符号类型 :param right_types: 产生式右边的符号类型列表 :para... | 3.613135 | 4 |
redash/models.py | slachiewicz/redash | 1 | 10528 | import json
import hashlib
import logging
import os
import threading
import time
import datetime
import itertools
import peewee
from passlib.apps import custom_app_context as pwd_context
from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase
from flask.ext.login import UserMixin, Anonymo... | import json
import hashlib
import logging
import os
import threading
import time
import datetime
import itertools
import peewee
from passlib.apps import custom_app_context as pwd_context
from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase
from flask.ext.login import UserMixin, Anonymo... | en | 0.87251 | # Handler for post_save operations. Overriding if needed. # TODO: this should be cached. # TODO: cache this as weel # The following logic is needed for cases like the following: # - The query scheduled to run at 23:59. # - The scheduler wakes up at 00:01. # - Using naive implementation of comparing timestamps, it will ... | 2.006425 | 2 |
xclib/classifier/ova.py | sushantsondhi/pyxclib | 4 | 10529 | <reponame>sushantsondhi/pyxclib<gh_stars>1-10
import numpy as np
import time
import logging
from .base import BaseClassifier
import scipy.sparse as sp
from ._svm import train_one
from functools import partial
from ..utils import sparse
from ..data import data_loader
from ._svm import train_one, _get_liblinear_solver_ty... | import numpy as np
import time
import logging
from .base import BaseClassifier
import scipy.sparse as sp
from ._svm import train_one
from functools import partial
from ..utils import sparse
from ..data import data_loader
from ._svm import train_one, _get_liblinear_solver_type
from joblib import Parallel, delayed
from .... | en | 0.667662 | One-vs-all classifier for sparse or dense data (suitable for large label set) Parameters: ----------- solver: str, optional, default='liblinear' solver to use loss: str, optional, default='squared_hinge' loss to optimize, - hinge - squared_hinge C: float, optiona... | 2.291935 | 2 |
ipgroup_test.py | RyPeck/python-ipgroup | 1 | 10530 | #!/usr/bin/env python3
import ipaddress
import random
import unittest
import ipgroup
class TestGroupIPs(unittest.TestCase):
def setUp(self):
pass
def test_group(self):
IPs = ["127.0.0.1",
"127.0.1.1",
"127.1.1.1",
"127.1.0.1",
"127... | #!/usr/bin/env python3
import ipaddress
import random
import unittest
import ipgroup
class TestGroupIPs(unittest.TestCase):
def setUp(self):
pass
def test_group(self):
IPs = ["127.0.0.1",
"127.0.1.1",
"127.1.1.1",
"127.1.0.1",
"127... | en | 0.850628 | #!/usr/bin/env python3 'Random' test # Small Netblock so we don't do over 2**10 hosts to test with # So out sample size is never bigger than the population of hosts 'Random' test # Small Netblock so we don't do over 2**10 hosts to test with # So out sample size is never bigger than the population of hosts Tests totalAd... | 3.237244 | 3 |
progress.py | PsiLupan/calcprogress | 2 | 10531 | from dataclasses import dataclass
from pickle import FALSE
from dol import Dol
from asm_section_list import AsmSection, AsmSectionType
@dataclass
class Slice:
start: int
end: int
def size(self) -> int:
assert self.end > self.start
return self.end - self.start
def contains_section(self... | from dataclasses import dataclass
from pickle import FALSE
from dol import Dol
from asm_section_list import AsmSection, AsmSectionType
@dataclass
class Slice:
start: int
end: int
def size(self) -> int:
assert self.end > self.start
return self.end - self.start
def contains_section(self... | en | 0.613135 | # Sum up code/data in ASM # Dol sizes # Decompiled sizes # Percentages # Dol sizes # Decompiled sizes # Percentages | 2.561798 | 3 |
main_qm9.py | maxxxzdn/en_flows | 0 | 10532 | <filename>main_qm9.py
import utils
import argparse
import wandb
from os.path import join
from qm9 import dataset
from qm9 import losses
from qm9.models import get_optim, get_model
from flows.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked
import torch
import time
import pick... | <filename>main_qm9.py
import utils
import argparse
import wandb
from os.path import join
from qm9 import dataset
from qm9 import losses
from qm9.models import get_optim, get_model
from flows.utils import assert_mean_zero_with_mask, remove_mean_with_mask,\
assert_correctly_masked
import torch
import time
import pick... | en | 0.746269 | # Log all args to wandb # Retrieve QM9 dataloaders # Create EGNN flow # Add large value that will be flushed. # Get data # Get data # transform batch through flow # standard nll from forward KL | 1.786914 | 2 |
vise/tests/util/test_string.py | kumagai-group/vise | 16 | 10533 | <reponame>kumagai-group/vise<gh_stars>10-100
# -*- coding: utf-8 -*-
# Copyright (c) 2021. Distributed under the terms of the MIT License.
from vise.util.string import numbers_to_lowercases
def test_numbers_to_lowercases():
assert numbers_to_lowercases("Mg2") == "Mg₂" | # -*- coding: utf-8 -*-
# Copyright (c) 2021. Distributed under the terms of the MIT License.
from vise.util.string import numbers_to_lowercases
def test_numbers_to_lowercases():
assert numbers_to_lowercases("Mg2") == "Mg₂" | en | 0.829111 | # -*- coding: utf-8 -*- # Copyright (c) 2021. Distributed under the terms of the MIT License. | 3.421526 | 3 |
code/ch_02_foundations/_02_noneness.py | SuppMonkey/write.pythonic.code | 679 | 10534 | <filename>code/ch_02_foundations/_02_noneness.py<gh_stars>100-1000
def find_accounts(search_text):
# perform search...
if not db_is_available:
return None
# returns a list of account IDs
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print("Error: DB ... | <filename>code/ch_02_foundations/_02_noneness.py<gh_stars>100-1000
def find_accounts(search_text):
# perform search...
if not db_is_available:
return None
# returns a list of account IDs
return db_search(search_text)
accounts = find_accounts('python')
if accounts is None:
print("Error: DB ... | en | 0.702773 | # perform search... # returns a list of account IDs | 3.078994 | 3 |
pupa/tests/importers/test_base_importer.py | influence-usa/pupa | 0 | 10535 | <reponame>influence-usa/pupa<filename>pupa/tests/importers/test_base_importer.py
import os
import json
import shutil
import tempfile
import mock
import pytest
from opencivicdata.models import Person
from pupa.scrape import Person as ScrapePerson
from pupa.scrape import Organization as ScrapeOrganization
from pupa.impor... | import os
import json
import shutil
import tempfile
import mock
import pytest
from opencivicdata.models import Person
from pupa.scrape import Person as ScrapePerson
from pupa.scrape import Organization as ScrapeOrganization
from pupa.importers.base import omnihash, BaseImporter
from pupa.importers import PersonImporter... | en | 0.906481 | # string # list # set # dict w/ set and tuple as well # write out some temp data to filesystem # simply ensure that import directory calls import_data with all dicts # import_data should be called once # kind of hacky, get the total list of args passed in # 2 args only, make sure a and b are in there # clean up datadir... | 2.150662 | 2 |
packaging/bdist_trinoadmin.py | wgzhao/trino-admin | 0 | 10536 | <filename>packaging/bdist_trinoadmin.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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.... | <filename>packaging/bdist_trinoadmin.py<gh_stars>0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 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.... | en | 0.80077 | #!/usr/bin/env python # -*- coding: utf-8 -*- # # 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.599458 | 2 |
2020-05-month-long-challenge/day22.py | jkbockstael/leetcode | 0 | 10537 | <filename>2020-05-month-long-challenge/day22.py<gh_stars>0
#!/usr/bin/env python3
# Day 22: Sort Characters By Frequency
#
# Given a string, sort it in decreasing order based on the frequency of
# characters.
import collections
class Solution:
def frequencySort(self, s: str) -> str:
return "".join(map(
... | <filename>2020-05-month-long-challenge/day22.py<gh_stars>0
#!/usr/bin/env python3
# Day 22: Sort Characters By Frequency
#
# Given a string, sort it in decreasing order based on the frequency of
# characters.
import collections
class Solution:
def frequencySort(self, s: str) -> str:
return "".join(map(
... | en | 0.820876 | #!/usr/bin/env python3 # Day 22: Sort Characters By Frequency # # Given a string, sort it in decreasing order based on the frequency of # characters. # Tests | 4.05423 | 4 |
loc.py | relax-space/pandas-first | 0 | 10538 | <gh_stars>0
'''
说明: loc和iloc有几个功能
1. 可以获取一行或者多行数据
2. 可以获取1列或多列数据
3. 可以获取某个单元格的数据
对应dataframe来说, 在不指定index和columns的情况下,iloc和loc一样
区别在于,iloc根据索引下标取值, loc根据索引值取值
'''
import numpy as np
import pandas as pd
def test_1():
# 按行取值
pf = pd.DataFrame([[1, 2], [3, 4]])
iloc_0 = pf.iloc[0]
loc_0 = pf.loc[0]
... | '''
说明: loc和iloc有几个功能
1. 可以获取一行或者多行数据
2. 可以获取1列或多列数据
3. 可以获取某个单元格的数据
对应dataframe来说, 在不指定index和columns的情况下,iloc和loc一样
区别在于,iloc根据索引下标取值, loc根据索引值取值
'''
import numpy as np
import pandas as pd
def test_1():
# 按行取值
pf = pd.DataFrame([[1, 2], [3, 4]])
iloc_0 = pf.iloc[0]
loc_0 = pf.loc[0]
assert pd.Se... | zh | 0.949569 | 说明: loc和iloc有几个功能 1. 可以获取一行或者多行数据 2. 可以获取1列或多列数据 3. 可以获取某个单元格的数据 对应dataframe来说, 在不指定index和columns的情况下,iloc和loc一样 区别在于,iloc根据索引下标取值, loc根据索引值取值 # 按行取值 # 看看下面的区别,索引下标和索引值的区别 # 按列取值 # 按单元格取值 # loc 和iloc 区别, 当设置index或columns参数后 # 第一行 # 第一列 | 3.179134 | 3 |
checkproject/runner.py | perror/checkproject | 0 | 10539 | <gh_stars>0
"""Runner to discover, run and collect the results of all the checks."""
def import_module(module_path):
"""Import a Python file as a module in the current context.
@param module_path: Path to the Python file.
@return: A reference to the module once loaded.
"""
import os
import s... | """Runner to discover, run and collect the results of all the checks."""
def import_module(module_path):
"""Import a Python file as a module in the current context.
@param module_path: Path to the Python file.
@return: A reference to the module once loaded.
"""
import os
import sys
modu... | en | 0.735106 | Runner to discover, run and collect the results of all the checks. Import a Python file as a module in the current context. @param module_path: Path to the Python file. @return: A reference to the module once loaded. # Running a Python 3.5+ version # Running a Python <= 3.4 version # Running a Python 2 versio... | 2.917383 | 3 |
neutron_fwaas/extensions/firewall_v2.py | sapcc/neutron-fwaas | 0 | 10540 | # Copyright (c) 2016 Mirantis, 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 w... | # Copyright (c) 2016 Mirantis, 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 w... | en | 0.831802 | # Copyright (c) 2016 Mirantis, 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 w... | 1.312046 | 1 |
model_hub/model_hub/mmdetection/utils.py | gh-determined-ai/determined | 0 | 10541 | <filename>model_hub/model_hub/mmdetection/utils.py
"""
Various utility functions for using mmdetection in Determined that may be useful
even if not using the provided MMDetTrial.
build_fp16_loss_scaler is large derived from the original mmcv code at
https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/opti... | <filename>model_hub/model_hub/mmdetection/utils.py
"""
Various utility functions for using mmdetection in Determined that may be useful
even if not using the provided MMDetTrial.
build_fp16_loss_scaler is large derived from the original mmcv code at
https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/opti... | en | 0.77003 | Various utility functions for using mmdetection in Determined that may be useful even if not using the provided MMDetTrial. build_fp16_loss_scaler is large derived from the original mmcv code at https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/optimizer.py mmcv is covered by the Apache 2.0 License. Co... | 2.209423 | 2 |
gcloud/datastores/tests/STUB_test_bigquery.py | pantheon-ci-bot/etl-framework | 2 | 10542 | <filename>gcloud/datastores/tests/STUB_test_bigquery.py
"""tests bigquery client"""
import unittest
from gcloud.datastores.bigquery import BigqueryClient
class BigqueryClientTestCases(unittest.TestCase):
"""stuff"""
@classmethod
def setUpClass(cls):
cls.project_id = 'test'
cls.dataset_i... | <filename>gcloud/datastores/tests/STUB_test_bigquery.py
"""tests bigquery client"""
import unittest
from gcloud.datastores.bigquery import BigqueryClient
class BigqueryClientTestCases(unittest.TestCase):
"""stuff"""
@classmethod
def setUpClass(cls):
cls.project_id = 'test'
cls.dataset_i... | en | 0.725039 | tests bigquery client stuff # Create a dataset and table (this indirectly tests create and delete) # Remove table and dataset (this indirectly tests create and delete) | 2.729877 | 3 |
filter_hash.py | mbougarne/python-algos | 0 | 10543 | <gh_stars>0
fruits = ["orange", "banana", "apple", "avocado", "kiwi", "apricot",
"cherry", "grape", "coconut", "lemon", "mango", "peach",
"pear", "strawberry", "pineapple", "apple", "orange", "pear",
"grape", "banana"
]
filters = dict()
for key in fruits:
filters[key] =... | fruits = ["orange", "banana", "apple", "avocado", "kiwi", "apricot",
"cherry", "grape", "coconut", "lemon", "mango", "peach",
"pear", "strawberry", "pineapple", "apple", "orange", "pear",
"grape", "banana"
]
filters = dict()
for key in fruits:
filters[key] = 1
result =... | none | 1 | 3.431828 | 3 | |
teste/knn.py | joandesonandrade/nebulosa | 0 | 10544 | <filename>teste/knn.py
from sklearn import preprocessing
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#Abrindo o dados como Dataframe
dados = pd.read_csv('dados/001.csv')
#Iniciando o método para binanizar as classe sim=1; não=0
pre = preprocessing.LabelBinarizer()
#Binazirando a classe jo... | <filename>teste/knn.py
from sklearn import preprocessing
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#Abrindo o dados como Dataframe
dados = pd.read_csv('dados/001.csv')
#Iniciando o método para binanizar as classe sim=1; não=0
pre = preprocessing.LabelBinarizer()
#Binazirando a classe jo... | pt | 0.784644 | #import matplotlib.pyplot as plt #Abrindo o dados como Dataframe #Iniciando o método para binanizar as classe sim=1; não=0 #Binazirando a classe jogou, e atribuíndo a uma matriz n-dimencional #colunas = ['A', 'B', 'C'] # print(pd.DataFrame(X, columns=colunas, dtype=np.int32)) # print(pd.DataFrame(y, columns=['Classe'],... | 3.274144 | 3 |
components/google-cloud/tests/container/experimental/gcp_launcher/test_batch_prediction_job_remote_runner.py | m-mayran/pipelines | 0 | 10545 | <filename>components/google-cloud/tests/container/experimental/gcp_launcher/test_batch_prediction_job_remote_runner.py
# Copyright 2021 The Kubeflow 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 ... | <filename>components/google-cloud/tests/container/experimental/gcp_launcher/test_batch_prediction_job_remote_runner.py
# Copyright 2021 The Kubeflow 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 ... | en | 0.819758 | # Copyright 2021 The Kubeflow 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 applicabl... | 1.714203 | 2 |
rotypes/Windows/Storage/Streams/__init__.py | Gliese129/ArknightsAutoHelper | 18 | 10546 | from ctypes import c_uint32, c_void_p, string_at
from rotypes.idldsl import define_winrt_com_method, GUID
from rotypes.inspectable import IInspectable, IUnknown
@GUID('905a0fef-bc53-11df-8c49-001e4fc686da')
class IBufferByteAccess(IUnknown):
pass
@GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA')
class IBuffer(IIns... | from ctypes import c_uint32, c_void_p, string_at
from rotypes.idldsl import define_winrt_com_method, GUID
from rotypes.inspectable import IInspectable, IUnknown
@GUID('905a0fef-bc53-11df-8c49-001e4fc686da')
class IBufferByteAccess(IUnknown):
pass
@GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA')
class IBuffer(IIns... | none | 1 | 2.051599 | 2 | |
simple_playgrounds/playground.py | Asjidkalam/simple-playgrounds | 0 | 10547 | # -*- coding: utf-8 -*-
""" Playground documentation.
Module defining Playground Base Class
"""
import os
from abc import ABC
import yaml
import pymunk
from .utils import PositionAreaSampler
from .utils.definitions import SPACE_DAMPING, CollisionTypes, SceneElementTypes
# pylint: disable=unused-argument
# pylint:... | # -*- coding: utf-8 -*-
""" Playground documentation.
Module defining Playground Base Class
"""
import os
from abc import ABC
import yaml
import pymunk
from .utils import PositionAreaSampler
from .utils.definitions import SPACE_DAMPING, CollisionTypes, SceneElementTypes
# pylint: disable=unused-argument
# pylint:... | en | 0.811134 | # -*- coding: utf-8 -*- Playground documentation. Module defining Playground Base Class # pylint: disable=unused-argument # pylint: disable=line-too-long Playground is a Base Class that manages the physical simulation. Playground manages the interactions between Agents and Scene Elements. Attributes: ... | 2.794216 | 3 |
UEManifestReader/classes/FManifestData.py | ryryburge/UEManifestReader | 0 | 10548 | <filename>UEManifestReader/classes/FManifestData.py
# -*- coding: utf-8 -*-
import zlib
from UEManifestReader.enums import *
from UEManifestReader.classes.FCustomFields import FCustomFields
from UEManifestReader.classes.FManifestMeta import FManifestMeta
from UEManifestReader.classes.FChunkDataList import FChunkDataLi... | <filename>UEManifestReader/classes/FManifestData.py
# -*- coding: utf-8 -*-
import zlib
from UEManifestReader.enums import *
from UEManifestReader.classes.FCustomFields import FCustomFields
from UEManifestReader.classes.FManifestMeta import FManifestMeta
from UEManifestReader.classes.FChunkDataList import FChunkDataLi... | en | 0.776341 | # -*- coding: utf-8 -*- # FManifestData - The public interface to load/saving manifest files. # Read the Manifest Header # If we are loading an old format, defer to the old code! # Compression format selection - we only have one right now. # Fill the array with loaded data. # DataSizeCompressed always equals the size o... | 2.095841 | 2 |
Python/module.py | minjibyeongho/KOSA-Pytorch | 2 | 10549 | <reponame>minjibyeongho/KOSA-Pytorch
#module.py
def hello():
print("Hello!")
#if __name__=="__main__":
# print(__name__) | #module.py
def hello():
print("Hello!")
#if __name__=="__main__":
# print(__name__) | ar | 0.094354 | #module.py #if __name__=="__main__": # print(__name__) | 2.05883 | 2 |
data_utils.py | algoprog/Quin | 47 | 10550 | import csv
import json
import pickle
import logging
import re
import pandas
import gzip
import os
import numpy as np
from random import randint, random
from tqdm import tqdm
from retriever.dense_retriever import DenseRetriever
from models.tokenization import tokenize
from typing import Union, List
class InputExampl... | import csv
import json
import pickle
import logging
import re
import pandas
import gzip
import os
import numpy as np
from random import randint, random
from tqdm import tqdm
from retriever.dense_retriever import DenseRetriever
from models.tokenization import tokenize
from typing import Union, List
class InputExampl... | en | 0.646983 | Structure for one input example with texts, the label and a unique id Creates one InputExample with the given texts, guid and label str.strip() is called on both texts. :param guid id for the example :param texts the texts for the example :param label ... | 2.484442 | 2 |
hc/accounts/migrations/0025_remove_member_team.py | opsct/healthchecks | 0 | 10551 | <gh_stars>0
# Generated by Django 2.1.5 on 2019-01-22 08:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0024_auto_20190119_1540'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='team'... | # Generated by Django 2.1.5 on 2019-01-22 08:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('accounts', '0024_auto_20190119_1540'),
]
operations = [
migrations.RemoveField(
model_name='member',
name='team',
),... | en | 0.714565 | # Generated by Django 2.1.5 on 2019-01-22 08:33 | 1.374321 | 1 |
openstack-dashboard/openstack_dashboard/api/proxy.py | foruy/openflow-multiopenstack | 1 | 10552 | <filename>openstack-dashboard/openstack_dashboard/api/proxy.py
from django.conf import settings
#from proxyclient.v2 import client as proxy_client
from openstack_dashboard.utils import proxy_client
def proxyclient(request):
management_url = getattr(settings, 'MANAGEMENT_URL')
conn = proxy_client.Client(reque... | <filename>openstack-dashboard/openstack_dashboard/api/proxy.py
from django.conf import settings
#from proxyclient.v2 import client as proxy_client
from openstack_dashboard.utils import proxy_client
def proxyclient(request):
management_url = getattr(settings, 'MANAGEMENT_URL')
conn = proxy_client.Client(reque... | en | 0.484683 | #from proxyclient.v2 import client as proxy_client # #def logout(request): # _proxy(request).logout(request.user.id) #cg # | 2.029726 | 2 |
tfl_data.py | dongyan1024/overtime | 9 | 10553 | <reponame>dongyan1024/overtime<filename>tfl_data.py<gh_stars>1-10
import overtime as ot
times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55']
tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times)
| import overtime as ot
times = ['14:00','14:05', '14:10', '14:15', '14:20', '14:25', '14:30', '14:35', '14:40', '14:45', '14:50', '14:55']
tfl_data = ot.TflInput(['victoria', 'central', 'bakerloo', 'piccadilly'], ['inbound', 'outbound'], times) | none | 1 | 2.16247 | 2 | |
apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py | opendatacube/odc-tools | 29 | 10554 | <filename>apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py<gh_stars>10-100
import json
from pathlib import Path
import click
import datacube
from datacube.index.hl import Doc2Dataset
from odc.apps.dc_tools.utils import (
index_update_dataset,
update_if_exists,
allow_unsafe,
transform_stac,
)
from ._stac imp... | <filename>apps/dc_tools/odc/apps/dc_tools/fs_to_dc.py<gh_stars>10-100
import json
from pathlib import Path
import click
import datacube
from datacube.index.hl import Doc2Dataset
from odc.apps.dc_tools.utils import (
index_update_dataset,
update_if_exists,
allow_unsafe,
transform_stac,
)
from ._stac imp... | en | 0.822704 | # Do the STAC Transform if it's flagged | 2.131879 | 2 |
scripts/fullizer.py | stijm/jazzjackrabbit2 | 5 | 10555 | <gh_stars>1-10
"""
WARNING:
Using this script outside any server except one with IP 127.0.0.1 means risking getting
an instant and permanent ban, anywhere you use it.
The script was created *ONLY FOR LOCAL* testing purposes.
NEVER, NEVER, *NEVER* run it in an online multiplayer server.
At least unless you're a... | """
WARNING:
Using this script outside any server except one with IP 127.0.0.1 means risking getting
an instant and permanent ban, anywhere you use it.
The script was created *ONLY FOR LOCAL* testing purposes.
NEVER, NEVER, *NEVER* run it in an online multiplayer server.
At least unless you're a dumb freak.
""... | en | 0.880217 | WARNING: Using this script outside any server except one with IP 127.0.0.1 means risking getting an instant and permanent ban, anywhere you use it. The script was created *ONLY FOR LOCAL* testing purposes. NEVER, NEVER, *NEVER* run it in an online multiplayer server. At least unless you're a dumb freak. | 2.283888 | 2 |
setup.py | pranithk/gluster-georep-tools | 0 | 10556 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
gluster-georep-tools.setup.py
:copyright: (c) 2016 by <NAME>
:license: MIT, see LICENSE for more details.
"""
from setuptools import setup
setup(
name="gluster-georep-tools",
version="0.2",
packages=["gluster_georep_tools",
"gluster_georep... | # -*- coding: utf-8 -*-
"""
gluster-georep-tools.setup.py
:copyright: (c) 2016 by <NAME>
:license: MIT, see LICENSE for more details.
"""
from setuptools import setup
setup(
name="gluster-georep-tools",
version="0.2",
packages=["gluster_georep_tools",
"gluster_georep_tools.statu... | en | 0.754054 | # -*- coding: utf-8 -*- gluster-georep-tools.setup.py :copyright: (c) 2016 by <NAME> :license: MIT, see LICENSE for more details. Gluster Geo-replication Tools | 1.035642 | 1 |
docs/_downloads/dbc5873471dad3c21022112121cbd008/tensorboard_profiler_tutorial.py | woojinsong/PyTorch-tutorials-kr | 221 | 10557 | """
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... | """
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... | en | 0.722221 | PyTorch Profiler With TensorBoard ==================================== This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler to detect performance bottlenecks of the model. Introduction ------------ PyTorch 1.8 includes an updated profiler API capable of recording the CPU side operations as w... | 2.962076 | 3 |
imgtoch/__init__.py | hrpzcf/imgtoch | 0 | 10558 | # coding: utf-8
from .__utils__ import grayscaleOf, makeImage, sortByGrayscale
NAME = "imgtoch"
VERSIONNUM = 0, 2, 3
VERSION = ".".join(map(str, VERSIONNUM))
AUTHOR = "hrpzcf"
EMAIL = "<EMAIL>"
WEBSITE = "https://gitee.com/hrpzcf/imgtoch"
__all__ = ["grayscaleOf", "makeImage", "sortByGrayscale"]
| # coding: utf-8
from .__utils__ import grayscaleOf, makeImage, sortByGrayscale
NAME = "imgtoch"
VERSIONNUM = 0, 2, 3
VERSION = ".".join(map(str, VERSIONNUM))
AUTHOR = "hrpzcf"
EMAIL = "<EMAIL>"
WEBSITE = "https://gitee.com/hrpzcf/imgtoch"
__all__ = ["grayscaleOf", "makeImage", "sortByGrayscale"]
| en | 0.833554 | # coding: utf-8 | 1.599772 | 2 |
packages/gradient_boosting_model/gradient_boosting_model/processing/validation.py | g-nightingale/testing-and-monitoring-ml-deployments | 99 | 10559 | import typing as t
from gradient_boosting_model.config.core import config
import numpy as np
import pandas as pd
from marshmallow import fields, Schema, ValidationError
class HouseDataInputSchema(Schema):
Alley = fields.Str(allow_none=True)
BedroomAbvGr = fields.Integer()
BldgType = fields.Str()
Bsm... | import typing as t
from gradient_boosting_model.config.core import config
import numpy as np
import pandas as pd
from marshmallow import fields, Schema, ValidationError
class HouseDataInputSchema(Schema):
Alley = fields.Str(allow_none=True)
BedroomAbvGr = fields.Integer()
BldgType = fields.Str()
Bsm... | en | 0.469698 | Check model inputs for na values and filter. Check model inputs for unprocessable values. # convert syntax error field names (beginning with numbers) # set many=True to allow passing in a list # replace numpy nans so that Marshmallow can validate | 2.223641 | 2 |
pyplan_engine/classes/IOEngine.py | jorgedouglas71/pyplan-ide | 17 | 10560 |
class IOEngine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def updateInputs(self, names):
# remove prior outputs
for input... |
class IOEngine(object):
def __init__(self, node):
self.node = node
self.inputs = []
self.outputs = []
def release(self):
self.inputs = None
self.outputs = None
self.node = None
def updateInputs(self, names):
# remove prior outputs
for input... | en | 0.305924 | # remove prior outputs | 2.97548 | 3 |
RLBotPack/JoeyBot/CSharpPythonAgent/CSharpPythonAgent.py | RLMarvin/RLBotPack | 13 | 10561 | import os
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.base_dotnet_agent import BaseDotNetAgent
from rlbot.parsing.custom_config import ConfigHeader, ConfigObject
class DotNetBot(BaseDotNetAgent):
def get_port_file_path(self):
# Look for a port.cfg file in the same direct... | import os
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.base_dotnet_agent import BaseDotNetAgent
from rlbot.parsing.custom_config import ConfigHeader, ConfigObject
class DotNetBot(BaseDotNetAgent):
def get_port_file_path(self):
# Look for a port.cfg file in the same direct... | en | 0.889596 | # Look for a port.cfg file in the same directory as THIS python file. | 2.059436 | 2 |
v3_experiments.py | runekaagaard/workflows | 0 | 10562 | <filename>v3_experiments.py<gh_stars>0
# coding=utf-8
import inspect
from functools import wraps
def listify(func_s):
if callable(func_s):
return [func_s]
else:
return func_s
def parse_conditions(condition_s, args, kwargs, title):
err_msg = unicode(title) + u" nr. {} failed: {}"
for ... | <filename>v3_experiments.py<gh_stars>0
# coding=utf-8
import inspect
from functools import wraps
def listify(func_s):
if callable(func_s):
return [func_s]
else:
return func_s
def parse_conditions(condition_s, args, kwargs, title):
err_msg = unicode(title) + u" nr. {} failed: {}"
for ... | en | 0.916802 | # coding=utf-8 Pre is before. Post is after. Very important: x must be 2! | 2.553414 | 3 |
externals/binaryen/test/emscripten/tools/distill_asm.py | caokun8008/ckeos | 40 | 10563 | <reponame>caokun8008/ckeos<gh_stars>10-100
'''
Gets the core asm module out of an emscripten output file.
By default it adds a ';' to end the
var asm = ...
statement. You can add a third param to customize that. If the third param is 'swap-in', it will emit code to swap this asm module in, instead of the default o... | '''
Gets the core asm module out of an emscripten output file.
By default it adds a ';' to end the
var asm = ...
statement. You can add a third param to customize that. If the third param is 'swap-in', it will emit code to swap this asm module in, instead of the default one.
XXX this probably doesn't work with cl... | en | 0.66968 | Gets the core asm module out of an emscripten output file. By default it adds a ';' to end the var asm = ... statement. You can add a third param to customize that. If the third param is 'swap-in', it will emit code to swap this asm module in, instead of the default one. XXX this probably doesn't work with closur... | 2.457035 | 2 |
apex/contrib/conv_bias_relu/conv_bias_relu.py | XL-Kong/Painter_GAN | 0 | 10564 | import torch
import pdb
from torch.autograd import gradcheck
import fused_conv_bias_relu
class ConvBiasReLU_(torch.autograd.Function):
@staticmethod
@torch.cuda.amp.custom_fwd(cast_inputs=torch.half)
def forward(ctx, x, weight, bias, padding, stride):
outputs = fused_conv_bias_relu.forward([x, wei... | import torch
import pdb
from torch.autograd import gradcheck
import fused_conv_bias_relu
class ConvBiasReLU_(torch.autograd.Function):
@staticmethod
@torch.cuda.amp.custom_fwd(cast_inputs=torch.half)
def forward(ctx, x, weight, bias, padding, stride):
outputs = fused_conv_bias_relu.forward([x, wei... | none | 1 | 2.46043 | 2 | |
data-structures/trees/trees/trees.py | bayan-alkhatib/data-structures-and-algorithms-401 | 0 | 10565 | class Node:
def __init__(self,value):
self.value=value
self.left=None
self.right=None
class Binary_Tree:
def __init__(self):
self.root = None
def pre_order(self):
""" root-left-right """
try:
self.values=[]
if self.ro... | class Node:
def __init__(self,value):
self.value=value
self.left=None
self.right=None
class Binary_Tree:
def __init__(self):
self.root = None
def pre_order(self):
""" root-left-right """
try:
self.values=[]
if self.ro... | en | 0.294704 | root-left-right left-node-right left-right-node add value to binery tree | 4.051388 | 4 |
ironic_inspector/cmd/dbsync.py | namnx228/ironic-inspector | 31 | 10566 | <gh_stars>10-100
# Copyright 2015 Cisco Systems
# 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 ... | # Copyright 2015 Cisco Systems
# 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 applicable law... | en | 0.846956 | # Copyright 2015 Cisco Systems # 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 applicable law... | 2.100114 | 2 |
trabalhoaqui/comp_perguntas/valida.py | EmanoelG/jogodaforca | 1 | 10567 | from jogo import desenha_jogo
from random import randint
import sys
def input_cria_usuario():
usuario = dict()
usuario['nome'] = input('Informe o seu nome: ')
usuario['pontos'] = 0
usuario['desafiado'] = False
return usuario
def comeco(j1, j2):
j1 = 1
j2 = 2
n= randint(j1,j2)
... | from jogo import desenha_jogo
from random import randint
import sys
def input_cria_usuario():
usuario = dict()
usuario['nome'] = input('Informe o seu nome: ')
usuario['pontos'] = 0
usuario['desafiado'] = False
return usuario
def comeco(j1, j2):
j1 = 1
j2 = 2
n= randint(j1,j2)
... | en | 0.255283 | # mexi a aqui #recebe as letras acertadass e depois verifica se a palavra esta completa ## e aqui \033[35m _____ ___ ___ ___ _______ / ___| / | / |/ | | ____| | | / | / /| /| | | |__ | | _ / /| | / / |__/ | | | __| | |_... | 3.24493 | 3 |
DesksReminder/Desks/accounts_desk.py | flopezag/fiware-management-scripts | 0 | 10568 | <reponame>flopezag/fiware-management-scripts
from datetime import date, datetime
from DesksReminder.Basics.dataFinder import Data
from DesksReminder.Basics.nickNames import ContactBook
from Config.settings import JIRA_URL
__author__ = '<NAME>'
class AccountsDesk:
def __init__(self):
self.contactBook = Co... | from datetime import date, datetime
from DesksReminder.Basics.dataFinder import Data
from DesksReminder.Basics.nickNames import ContactBook
from Config.settings import JIRA_URL
__author__ = '<NAME>'
class AccountsDesk:
def __init__(self):
self.contactBook = ContactBook()
def open(self):
mess... | none | 1 | 2.531706 | 3 | |
scripts/ip2hex.py | Kidlike/dotfiles | 0 | 10569 | #!/usr/bin/python
import sys
import re
def iptohex(ip):
octets = ip.split('.')
hex_octets = []
for octet in octets:
if int(octet) < 16:
hex_octets.append('0' + hex(int(octet))[2:])
else:
hex_octets.append(hex(int(oc... | #!/usr/bin/python
import sys
import re
def iptohex(ip):
octets = ip.split('.')
hex_octets = []
for octet in octets:
if int(octet) < 16:
hex_octets.append('0' + hex(int(octet))[2:])
else:
hex_octets.append(hex(int(oc... | ru | 0.258958 | #!/usr/bin/python | 3.20201 | 3 |
src/models/CVX_weighted.py | DanqingZ/social-DCM | 14 | 10570 | <reponame>DanqingZ/social-DCM
import random
import numpy as np
import numpy.linalg as LA
import scipy as spy
import time
from itertools import *
import sys
import cvxpy as cvx
from random import randint
import numpy as np
import random
from scipy.sparse import csc_matrix
from scipy import sparse as sp
import networkx a... | import random
import numpy as np
import numpy.linalg as LA
import scipy as spy
import time
from itertools import *
import sys
import cvxpy as cvx
from random import randint
import numpy as np
import random
from scipy.sparse import csc_matrix
from scipy import sparse as sp
import networkx as nx
class CVX_weighted:
def... | none | 1 | 2.162183 | 2 | |
experiments/colorization_cINN/data.py | jlmaccal/FrEIA | 0 | 10571 | <reponame>jlmaccal/FrEIA
import sys
import glob
from os.path import join
from multiprocessing import Pool
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, color
from PIL import Image, ImageEnhance
import torch
from torch.utils.data import Dataset, DataLoader, TensorDataset
import torch.nn.fun... | import sys
import glob
from os.path import join
from multiprocessing import Pool
import numpy as np
import matplotlib.pyplot as plt
from skimage import io, color
from PIL import Image, ImageEnhance
import torch
from torch.utils.data import Dataset, DataLoader, TensorDataset
import torch.nn.functional as F
import torch... | en | 0.778123 | multiprocessing wrapper for applying the joint bilateral filter given an Nx1xWxH Tensor L and an Nx2xwxh Tensor ab, normalized accoring to offsets and scales above, upsample the ab channels and combine with L, and form an RGB image. norm: If false, assume that L, ab are not normalized and already in the corr... | 2.456857 | 2 |
utils/editor.py | tien1504/idinvert_pytorch | 415 | 10572 | <reponame>tien1504/idinvert_pytorch
# python 3.7
"""Utility functions for image editing from latent space."""
import os.path
import numpy as np
__all__ = [
'parse_indices', 'interpolate', 'mix_style',
'get_layerwise_manipulation_strength', 'manipulate', 'parse_boundary_list'
]
def parse_indices(obj, min_val... | # python 3.7
"""Utility functions for image editing from latent space."""
import os.path
import numpy as np
__all__ = [
'parse_indices', 'interpolate', 'mix_style',
'get_layerwise_manipulation_strength', 'manipulate', 'parse_boundary_list'
]
def parse_indices(obj, min_val=None, max_val=None):
"""Parses in... | en | 0.794306 | # python 3.7 Utility functions for image editing from latent space. Parses indices. If the input is a list or tuple, this function has no effect. The input can also be a string, which is either a comma separated list of numbers 'a, b, c', or a dash separated range 'a - c'. Space in the string will be ignored.... | 3.312094 | 3 |
venv/lib/python3.8/site-packages/pyls/_version.py | Retraces/UkraineBot | 2 | 10573 | /home/runner/.cache/pip/pool/24/e8/39/183700a0b2d2a9545f3da2571d82b53df290aab3a51dc229b113d16e6c | /home/runner/.cache/pip/pool/24/e8/39/183700a0b2d2a9545f3da2571d82b53df290aab3a51dc229b113d16e6c | none | 1 | 0.659773 | 1 | |
pymoo/util/normalization.py | Electr0phile/pymoo | 1 | 10574 | import numpy as np
def denormalize(x, x_min, x_max):
if x_max is None:
_range = 1
else:
_range = (x_max - x_min)
return x * _range + x_min
def normalize(x, x_min=None, x_max=None, return_bounds=False, estimate_bounds_if_none=True):
# if the bounds should be estimated if none do it... | import numpy as np
def denormalize(x, x_min, x_max):
if x_max is None:
_range = 1
else:
_range = (x_max - x_min)
return x * _range + x_min
def normalize(x, x_min=None, x_max=None, return_bounds=False, estimate_bounds_if_none=True):
# if the bounds should be estimated if none do it... | en | 0.757756 | # if the bounds should be estimated if none do it for both # if they are still none set them to default to avoid exception # calculate the denominator # we can not divide by zero -> plus small epsilon # normalize the actual values # return with or without bounds # standardize | 3.560162 | 4 |
alembic/versions/92235b77ea53_check_new.py | go-lab/appcomposer | 1 | 10575 | """Check new
Revision ID: 92235b77ea53
Revises: 381fdb66ec27
Create Date: 2017-10-14 02:38:51.007307
"""
# revision identifiers, used by Alembic.
revision = '92235b77ea53'
down_revision = '381fdb66ec27'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pl... | """Check new
Revision ID: 92235b77ea53
Revises: 381fdb66ec27
Create Date: 2017-10-14 02:38:51.007307
"""
# revision identifiers, used by Alembic.
revision = '92235b77ea53'
down_revision = '381fdb66ec27'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pl... | en | 0.383329 | Check new Revision ID: 92235b77ea53 Revises: 381fdb66ec27 Create Date: 2017-10-14 02:38:51.007307 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # op.create_unique_constraint(None, 'ActiveTranslationMessages', ['bundle_id', 'key']) # op.create_unique_cons... | 1.413148 | 1 |
build/lib/adb_utils/adb_utils.py | christopherferreira3/Python-ADB-Tools | 0 | 10576 | <reponame>christopherferreira3/Python-ADB-Tools
import subprocess
import os
def get_connected_devices() -> list:
"""
Returns a list of tuples containing the Device name and the android Version
:return:
"""
devices = []
devices_output = subprocess.check_output(["adb", "devices"]).decode("utf-8"... | import subprocess
import os
def get_connected_devices() -> list:
"""
Returns a list of tuples containing the Device name and the android Version
:return:
"""
devices = []
devices_output = subprocess.check_output(["adb", "devices"]).decode("utf-8").strip("List of devices attached").split("\n")
... | en | 0.657022 | Returns a list of tuples containing the Device name and the android Version :return: Installs an APK file into a device. The app installed with the -r option so the apk gets replaced it exists or installed if it doenst :param apk_path: Path for the APK :param device: Device name :return: True if s... | 3.251069 | 3 |
tests/unit/test_cl61d.py | griesche/cloudnetpy-1 | 1 | 10577 | import glob
import os
import sys
from tempfile import TemporaryDirectory
import netCDF4
import numpy as np
import numpy.ma as ma
from all_products_fun import Check
from lidar_fun import LidarFun
from cloudnetpy import concat_lib
from cloudnetpy.instruments import ceilo2nc
SCRIPT_PATH = os.path.dirname(os.path.realpa... | import glob
import os
import sys
from tempfile import TemporaryDirectory
import netCDF4
import numpy as np
import numpy.ma as ma
from all_products_fun import Check
from lidar_fun import LidarFun
from cloudnetpy import concat_lib
from cloudnetpy.instruments import ceilo2nc
SCRIPT_PATH = os.path.dirname(os.path.realpa... | none | 1 | 2.188504 | 2 | |
tests/functions/test_count.py | athre0z/clickhouse-sqlalchemy | 1 | 10578 | <reponame>athre0z/clickhouse-sqlalchemy<filename>tests/functions/test_count.py
from sqlalchemy import Column, func
from clickhouse_sqlalchemy import types, Table
from tests.testcase import (
BaseAbstractTestCase, HttpSessionTestCase, NativeSessionTestCase,
)
class CountTestCaseBase(BaseAbstractTestCase):
def... | from sqlalchemy import Column, func
from clickhouse_sqlalchemy import types, Table
from tests.testcase import (
BaseAbstractTestCase, HttpSessionTestCase, NativeSessionTestCase,
)
class CountTestCaseBase(BaseAbstractTestCase):
def create_table(self):
metadata = self.metadata()
return Table(
... | none | 1 | 2.541463 | 3 | |
scripts/commands/html/actions/search.py | stevekineeve88/orb | 0 | 10579 | import click
import requests
from bs4 import BeautifulSoup
from modules.Word.managers.DictionaryManager import DictionaryManager
import re
@click.command()
@click.option('--url', help='URL to fetch from')
@click.pass_context
def search(ctx, url):
dictionary_manager: DictionaryManager = ctx.obj[DictionaryManager]
... | import click
import requests
from bs4 import BeautifulSoup
from modules.Word.managers.DictionaryManager import DictionaryManager
import re
@click.command()
@click.option('--url', help='URL to fetch from')
@click.pass_context
def search(ctx, url):
dictionary_manager: DictionaryManager = ctx.obj[DictionaryManager]
... | none | 1 | 3.023552 | 3 | |
asf_search/constants/DATASET/__init__.py | jhkennedy/Discovery-asf_search | 0 | 10580 | """Datasets to be used in search and related functions"""
from .DATASET import * | """Datasets to be used in search and related functions"""
from .DATASET import * | en | 0.807085 | Datasets to be used in search and related functions | 1.009309 | 1 |
cell2cell/plotting/cci_plot.py | ckmah/cell2cell | 16 | 10581 | # -*- coding: utf-8 -*-
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from cell2cell.clustering import compute_linkage
from cell2cell.preprocessing.manipulate_dataframes import check_symmetry
from cell2cell.plotting.aesthetics import map_col... | # -*- coding: utf-8 -*-
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from cell2cell.clustering import compute_linkage
from cell2cell.preprocessing.manipulate_dataframes import check_symmetry
from cell2cell.plotting.aesthetics import map_col... | en | 0.65346 | # -*- coding: utf-8 -*- Generates a clustermap (heatmap + dendrograms from a hierarchical clustering) based on CCI scores of cell-cell pairs. Parameters ---------- interaction_space : cell2cell.core.interaction_space.InteractionSpace Interaction space that contains all a distance matrix after r... | 2.608508 | 3 |
var/spack/repos/builtin.mock/packages/gnuconfig/package.py | jeanbez/spack | 0 | 10582 | <reponame>jeanbez/spack
# 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)
import os
from spack.package import *
class Gnuconfig(Package):
"""
The GNU config.gues... | # 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)
import os
from spack.package import *
class Gnuconfig(Package):
"""
The GNU config.guess and config.sub scripts... | en | 0.764101 | # 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) The GNU config.guess and config.sub scripts versioned by timestamp. This package can be used as a build dependency for ... | 2.031506 | 2 |
mp4box/parsing/ctts.py | abhijeetbhagat/mp4box | 7 | 10583 | <filename>mp4box/parsing/ctts.py
from mp4box.box import CompositionTimeToSampleBox
def parse_ctts(reader, my_size):
version = reader.read32()
box = CompositionTimeToSampleBox(my_size, version, 0)
box.entry_count = reader.read32()
for _ in range(0, box.entry_count):
box.sample_count.app... | <filename>mp4box/parsing/ctts.py
from mp4box.box import CompositionTimeToSampleBox
def parse_ctts(reader, my_size):
version = reader.read32()
box = CompositionTimeToSampleBox(my_size, version, 0)
box.entry_count = reader.read32()
for _ in range(0, box.entry_count):
box.sample_count.app... | none | 1 | 2.519025 | 3 | |
MsLightweaverManager.py | Goobley/MsLightweaver | 0 | 10584 | <filename>MsLightweaverManager.py
import pickle
import numpy as np
import matplotlib.pyplot as plt
from lightweaver.rh_atoms import H_6_atom, C_atom, O_atom, OI_ord_atom, Si_atom, Al_atom, Fe_atom, FeI_atom, MgII_atom, N_atom, Na_atom, S_atom, CaII_atom
from lightweaver.atmosphere import Atmosphere, ScaleType
from ligh... | <filename>MsLightweaverManager.py
import pickle
import numpy as np
import matplotlib.pyplot as plt
from lightweaver.rh_atoms import H_6_atom, C_atom, O_atom, OI_ord_atom, Si_atom, Al_atom, Fe_atom, FeI_atom, MgII_atom, N_atom, Na_atom, S_atom, CaII_atom
from lightweaver.atmosphere import Atmosphere, ScaleType
from ligh... | en | 0.512253 | # from HydroWeno.Simulation import Grid # from HydroWeno.Advector import Advector # from HydroWeno.BCs import zero_grad_bc # from HydroWeno.Weno import reconstruct_weno_nm_z # https://stackoverflow.com/a/21901260 # NOTE(cmo): This data needs to be in (mu, toObs) order, i.e. mu[0] # down, mu[0] up, mu[1] down... # self.... | 1.567876 | 2 |
common/writeExcel.py | lixiaofeng1993/DjangoBlog | 0 | 10585 | <filename>common/writeExcel.py
# coding:utf-8
from openpyxl import load_workbook
import openpyxl
from openpyxl.styles import Font, colors
def copy_excel(cese_path, report_path):
"""
复制测试用例到report_path
:param cese_path:
:param report_path:
:return:
"""
wb2 = openpyxl.Workbook()
wb2.save... | <filename>common/writeExcel.py
# coding:utf-8
from openpyxl import load_workbook
import openpyxl
from openpyxl.styles import Font, colors
def copy_excel(cese_path, report_path):
"""
复制测试用例到report_path
:param cese_path:
:param report_path:
:return:
"""
wb2 = openpyxl.Workbook()
wb2.save... | zh | 0.753338 | # coding:utf-8 复制测试用例到report_path :param cese_path: :param report_path: :return: # 在设置的路径下创建一个excel文件 # 读取数据 # 获取第一个sheet页 # 最大行数 # 最大列数 # chr(97)='a' # ASCII字符,excel文件的列 a b c # 单元格编号 # 获取测试用例单元格数据 # 赋值到测试结果单元格 # 保存数据 # 关闭excel 修改excel数据 # 激活sheet 写入数据,如(2,3,"hello"),第二行第三列写入数据"hello\ # 判断值为错误时添加字体样式 # cop... | 3.153886 | 3 |
test/cts/tool/CTSConverter/src/nn/specs/V1_1/depthwise_conv2d_float_weights_as_inputs_relaxed.mod.py | zhaoming0/webml-polyfill | 255 | 10586 | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | #
# Copyright (C) 2018 The Android Open Source Project
#
# 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 la... | en | 0.738481 | # # Copyright (C) 2018 The Android Open Source Project # # 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 la... | 2.004025 | 2 |
jina/executors/evaluators/rank/recall.py | sdsd0101/jina | 2 | 10587 | from typing import Sequence, Any
from jina.executors.evaluators.rank import BaseRankingEvaluator
from jina.executors.evaluators.decorators import as_aggregator
class RecallEvaluator(BaseRankingEvaluator):
"""A :class:`RecallEvaluator` evaluates the Precision of the search.
It computes how many of the firs... | from typing import Sequence, Any
from jina.executors.evaluators.rank import BaseRankingEvaluator
from jina.executors.evaluators.decorators import as_aggregator
class RecallEvaluator(BaseRankingEvaluator):
"""A :class:`RecallEvaluator` evaluates the Precision of the search.
It computes how many of the firs... | en | 0.892907 | A :class:`RecallEvaluator` evaluates the Precision of the search. It computes how many of the first given `eval_at` groundtruth are found in the matches " :param eval_at: k at which evaluation is performed " :param matches_ids: the matched document identifiers from the request as matched by jina ... | 2.558999 | 3 |
tests/schema_mapping/structures/example5.py | danny-vayu/typedpy | 0 | 10588 | <reponame>danny-vayu/typedpy
from typedpy import Array, DoNotSerialize, Structure, mappers
class Foo(Structure):
i: int
s: str
_serialization_mapper = {"i": "j", "s": "name"}
class Example5(Foo):
a: Array
_serialization_mapper = [{"j": DoNotSerialize}, mappers.TO_LOWERCASE] | from typedpy import Array, DoNotSerialize, Structure, mappers
class Foo(Structure):
i: int
s: str
_serialization_mapper = {"i": "j", "s": "name"}
class Example5(Foo):
a: Array
_serialization_mapper = [{"j": DoNotSerialize}, mappers.TO_LOWERCASE] | none | 1 | 2.683804 | 3 | |
src/semantic_parsing_with_constrained_lm/eval.py | microsoft/semantic_parsing_with_constrained_lm | 17 | 10589 | <filename>src/semantic_parsing_with_constrained_lm/eval.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import dataclasses
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Generic, List, Optional, Sequence, TypeVar
from semantic_parsing_with_co... | <filename>src/semantic_parsing_with_constrained_lm/eval.py
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import dataclasses
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Generic, List, Optional, Sequence, TypeVar
from semantic_parsing_with_co... | en | 0.870753 | # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # TODO: Replcae this with a more flexible function suited to each domain Used to measure goodness of model results compared to the ground truth. Stateful over the duration of an experiment run. Uses `target` and the model predictions `pred` t... | 2.38833 | 2 |
irrigation_control/irrigation_control_py3/common_irrigation_chains_py3.py | bopopescu/docker_images_a | 2 | 10590 | <reponame>bopopescu/docker_images_a
class Check_Excessive_Current(object):
def __init__(self,chain_name,cf,handlers,irrigation_io,irrigation_hash_control,get_json_object):
self.get_json_object = get_json_object
cf.define_chain(chain_name, False )
#cf.insert.log("check_excessive_c... | class Check_Excessive_Current(object):
def __init__(self,chain_name,cf,handlers,irrigation_io,irrigation_hash_control,get_json_object):
self.get_json_object = get_json_object
cf.define_chain(chain_name, False )
#cf.insert.log("check_excessive_current")
cf.insert.assert_functi... | en | 0.163252 | #cf.insert.log("check_excessive_current") #print("check excessive current") #TBD | 2.227896 | 2 |
lib/surface/spanner/operations/list.py | google-cloud-sdk-unofficial/google-cloud-sdk | 2 | 10591 | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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 requir... | # -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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 requir... | en | 0.585801 | # -*- coding: utf-8 -*- # # Copyright 2016 Google LLC. 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 requir... | 1.665355 | 2 |
pgmpy/tests/test_models/test_SEM.py | predictive-analytics-lab/pgmpy | 0 | 10592 | <filename>pgmpy/tests/test_models/test_SEM.py
import os
import unittest
import numpy as np
import networkx as nx
import numpy.testing as npt
from pgmpy.models import SEM, SEMGraph, SEMAlg
class TestSEM(unittest.TestCase):
def test_from_graph(self):
self.demo = SEM.from_graph(
ebunch=[
... | <filename>pgmpy/tests/test_models/test_SEM.py
import os
import unittest
import numpy as np
import networkx as nx
import numpy.testing as npt
from pgmpy.models import SEM, SEMGraph, SEMAlg
class TestSEM(unittest.TestCase):
def test_from_graph(self):
self.demo = SEM.from_graph(
ebunch=[
... | en | 0.784806 | # %load model.lav # measurement model ind60 =~ x1 + x2 + x3 dem60 =~ y1 + y2 + y3 + y4 dem65 =~ y5 + y6 + y7 + y8 # regressions dem60 ~ ind60 dem65 ~... | 2.488555 | 2 |
data_scripts/translation.py | wangcongcong123/transection | 4 | 10593 | # coding=utf-8
# This script is finished following HF's datasets' template:
# https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py
# More examples as references to write a customized dataset can be found here:
# https://github.com/huggingface/datasets/tree/master/datasets
from __future__... | # coding=utf-8
# This script is finished following HF's datasets' template:
# https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py
# More examples as references to write a customized dataset can be found here:
# https://github.com/huggingface/datasets/tree/master/datasets
from __future__... | en | 0.732061 | # coding=utf-8 # This script is finished following HF's datasets' template: # https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py # More examples as references to write a customized dataset can be found here: # https://github.com/huggingface/datasets/tree/master/datasets \ \ customize da... | 2.868339 | 3 |
utils/chat_formatting.py | lyricalpaws/snekbot | 13 | 10594 | import itertools
from typing import Sequence, Iterator
# Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py
def error(text: str) -> str:
"""Get text prefixed with an error emoji.
Returns
-------
str
The new message.
"""
return "... | import itertools
from typing import Sequence, Iterator
# Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py
def error(text: str) -> str:
"""Get text prefixed with an error emoji.
Returns
-------
str
The new message.
"""
return "... | en | 0.567807 | # Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py Get text prefixed with an error emoji. Returns ------- str The new message. Get text prefixed with a warning emoji. Returns ------- str The new message. Get text prefixed... | 3.424588 | 3 |
strategy/trade/strategymargintrade.py | firebird631/siis | 0 | 10595 | # @date 2018-12-28
# @author <NAME>, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# Strategy trade for margin with multiples positions.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Tuple
if TYPE_CHECKING:
from trader.trader import Trader
... | # @date 2018-12-28
# @author <NAME>, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# Strategy trade for margin with multiples positions.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Tuple
if TYPE_CHECKING:
from trader.trader import Trader
... | en | 0.849229 | # @date 2018-12-28 # @author <NAME>, All rights reserved without prejudices. # @license Copyright (c) 2018 Dream Overflow # Strategy trade for margin with multiples positions. Specialization for margin trading. This type of trade is related to margin trading market, allowing or not hedging, where there is a p... | 2.41375 | 2 |
src/pyramid_debugtoolbar_api_sqlalchemy/__init__.py | jvanasco/pyramid_debugtoolbar_api_sqla | 0 | 10596 | <gh_stars>0
# local
from .panels import SqlalchemyCsvDebugPanel
__VERSION__ = "0.3.1"
# ==============================================================================
def includeme(config):
"""
Pyramid hook to install this debugtoolbar plugin.
Update your ENVIRONMENT.ini file
debugtoolbar.in... | # local
from .panels import SqlalchemyCsvDebugPanel
__VERSION__ = "0.3.1"
# ==============================================================================
def includeme(config):
"""
Pyramid hook to install this debugtoolbar plugin.
Update your ENVIRONMENT.ini file
debugtoolbar.includes = pyr... | en | 0.311987 | # local # ============================================================================== Pyramid hook to install this debugtoolbar plugin. Update your ENVIRONMENT.ini file debugtoolbar.includes = pyramid_debugtoolbar_api_sqlalchemy # ========================================================================... | 1.979528 | 2 |
ultron/utilities/zlib_engine.py | wangjiehui11235/ultron | 4 | 10597 | <filename>ultron/utilities/zlib_engine.py
# -*- coding: utf-8 -*-
import os,os.path
import zipfile
def zip_compress(dir_name, zip_filename):
filelist = []
if os.path.isfile(dir_name):
filelist.append(dir_name)
else :
for root, dirs, files in os.walk(dir_name):
for name in files... | <filename>ultron/utilities/zlib_engine.py
# -*- coding: utf-8 -*-
import os,os.path
import zipfile
def zip_compress(dir_name, zip_filename):
filelist = []
if os.path.isfile(dir_name):
filelist.append(dir_name)
else :
for root, dirs, files in os.walk(dir_name):
for name in files... | en | 0.769321 | # -*- coding: utf-8 -*- | 2.810631 | 3 |
scripts/instances2inventory.py | TipaZloy/coda-automation | 0 | 10598 | <gh_stars>0
#!/usr/bin/env python3
import boto
import boto.ec2
import sys
from pprint import pprint
from collections import defaultdict
output = defaultdict(lambda: [])
comments = defaultdict(lambda: {})
skip_region_strings = ['us-gov', 'cn-', 'ca-']
#skip_region_strings = ['us-gov', 'cn-', 'ca-', 'eu-', 'ap-']
if... | #!/usr/bin/env python3
import boto
import boto.ec2
import sys
from pprint import pprint
from collections import defaultdict
output = defaultdict(lambda: [])
comments = defaultdict(lambda: {})
skip_region_strings = ['us-gov', 'cn-', 'ca-']
#skip_region_strings = ['us-gov', 'cn-', 'ca-', 'eu-', 'ap-']
if len(sys.arg... | en | 0.085329 | #!/usr/bin/env python3 #skip_region_strings = ['us-gov', 'cn-', 'ca-', 'eu-', 'ap-'] | 2.644648 | 3 |
selfdrive/crash.py | darknight111/openpilot3 | 19 | 10599 | """Install exception handler for process crash."""
from selfdrive.swaglog import cloudlog
from selfdrive.version import version
import sentry_sdk
from sentry_sdk.integrations.threading import ThreadingIntegration
def capture_exception(*args, **kwargs) -> None:
cloudlog.error("crash", exc_info=kwargs.get('exc_info',... | """Install exception handler for process crash."""
from selfdrive.swaglog import cloudlog
from selfdrive.version import version
import sentry_sdk
from sentry_sdk.integrations.threading import ThreadingIntegration
def capture_exception(*args, **kwargs) -> None:
cloudlog.error("crash", exc_info=kwargs.get('exc_info',... | en | 0.776766 | Install exception handler for process crash. # https://github.com/getsentry/sentry-python/issues/291 | 2.036558 | 2 |