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 |
|---|---|---|---|---|---|---|---|---|---|---|
src/bookmaker/__init__.py | fossabot/BookMaker | 0 | 6620851 | <reponame>fossabot/BookMaker<filename>src/bookmaker/__init__.py<gh_stars>0
"""Python package using PEP 517 hooks
"""
import sys
import os
import subprocess
from pathlib import Path # if you haven't already done so
file = Path(__file__).resolve()
try:
sys.path.append(str(file.parents[1]))
print(f'Allow the imp... | """Python package using PEP 517 hooks
"""
import sys
import os
import subprocess
from pathlib import Path # if you haven't already done so
file = Path(__file__).resolve()
try:
sys.path.append(str(file.parents[1]))
print(f'Allow the import to look in {str(file.parents[1])}')
from src.bookmaker.about import... | en | 0.702258 | Python package using PEP 517 hooks # if you haven't already done so # print('returncode:', completed.returncode) # Run if called directly | 2.363304 | 2 |
src/test.py | dhruvramani/Space-Debris | 0 | 6620852 | <filename>src/test.py<gh_stars>0
import os
import gc
import torch
import argparse
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
from models import *
from dataset import SpaceDataset
from utils import progress_bar
device = 'cuda' if torch.cu... | <filename>src/test.py<gh_stars>0
import os
import gc
import torch
import argparse
import numpy as np
import torch.nn.functional as F
from torch.autograd import Variable
import torch.backends.cudnn as cudnn
from models import *
from dataset import SpaceDataset
from utils import progress_bar
device = 'cuda' if torch.cu... | en | 0.451212 | matplotlib.image.imsave('../save/plots/input/sequences.png', sequences[0]) matplotlib.image.imsave('../save/plots/output/stylized_sequences.png', out[0]) aud_res = reconstruction(sequences[0], phase) out_res = reconstruction(out[0], phase[:, :-3]) librosa.output.write_wav("../save/plots/input/raw_sequen... | 2.173452 | 2 |
{{ cookiecutter.repository_name }}/{{ cookiecutter.project_name }}/auth/resources.py | cyrilrbt/cookiecutter-flask-mongorest | 1 | 6620853 | from flask_mongorest.resources import Resource
from {{ cookiecutter.project_name }}.auth.documents import User, UserSchema
from {{ cookiecutter.project_name }}.auth import jwt_for
class SimpleUserResource(Resource):
document = User
fields = ['id', 'email']
class RegistrationUserResource(Resource):
docum... | from flask_mongorest.resources import Resource
from {{ cookiecutter.project_name }}.auth.documents import User, UserSchema
from {{ cookiecutter.project_name }}.auth import jwt_for
class SimpleUserResource(Resource):
document = User
fields = ['id', 'email']
class RegistrationUserResource(Resource):
docum... | none | 1 | 2.264137 | 2 | |
src/api_ai.py | coders-creed/botathon | 1 | 6620854 | <reponame>coders-creed/botathon
# -*- coding: utf-8 -*-
# @Author: karthik
# @Date: 2016-12-11 08:41:49
# @Last Modified by: karthik
# @Last Modified time: 2016-12-11 09:02:22
from api.ai import Agent
DEVELOPER_ACCESS_TOKEN = "3f4bc676dfb04ecba1d42f3f8a6ffe54"
ai = agent = Agent(
'',
'',
DEVELOPER... | # -*- coding: utf-8 -*-
# @Author: karthik
# @Date: 2016-12-11 08:41:49
# @Last Modified by: karthik
# @Last Modified time: 2016-12-11 09:02:22
from api.ai import Agent
DEVELOPER_ACCESS_TOKEN = "3f4bc676dfb04ecba1d42f3f8a6ffe54"
ai = agent = Agent(
'',
'',
DEVELOPER_ACCESS_TOKEN,
)
response = age... | en | 0.653183 | # -*- coding: utf-8 -*- # @Author: karthik # @Date: 2016-12-11 08:41:49 # @Last Modified by: karthik # @Last Modified time: 2016-12-11 09:02:22 | 1.934541 | 2 |
icbd/compiler/benchmarks/modified/hax.py | kmod/icbd | 7 | 6620855 | <reponame>kmod/icbd<filename>icbd/compiler/benchmarks/modified/hax.py
fmin = min
max = max
min = min
abs = abs
def ftoi(d):
return int(d)
def itof(n):
return 1.0 * n
| fmin = min
max = max
min = min
abs = abs
def ftoi(d):
return int(d)
def itof(n):
return 1.0 * n | none | 1 | 2.383971 | 2 | |
core/config.py | DCZYewen/NullDCZHFS | 1 | 6620856 | import os
import json
conf_path = "config.json"
base_config = {
"server": {
"request_timeout": 10,
"daemon": True,
"loop_debug": False,
"handler": {"*": ["core.urls"]}
},
"http": {
"host": "",
"port": 80,
"is_enable": True,
"rewrite_only": Fa... | import os
import json
conf_path = "config.json"
base_config = {
"server": {
"request_timeout": 10,
"daemon": True,
"loop_debug": False,
"handler": {"*": ["core.urls"]}
},
"http": {
"host": "",
"port": 80,
"is_enable": True,
"rewrite_only": Fa... | none | 1 | 2.236655 | 2 | |
src/clearskies/column_types/string_test.py | cmancone/clearskies | 4 | 6620857 | import unittest
from .string import String
class StringTest(unittest.TestCase):
def test_is_allowed_operator(self):
string = String()
for operator in ['=', 'LIKE']:
self.assertTrue(string.is_allowed_operator(operator))
for operator in ['==', '<=>']:
self.assertFalse... | import unittest
from .string import String
class StringTest(unittest.TestCase):
def test_is_allowed_operator(self):
string = String()
for operator in ['=', 'LIKE']:
self.assertTrue(string.is_allowed_operator(operator))
for operator in ['==', '<=>']:
self.assertFalse... | none | 1 | 3.70321 | 4 | |
remimi/sensors/paseudo_camera.py | xiong-jie-y/remimi | 23 | 6620858 | import os
import glob
from remimi.monodepth.ken3d.depthestim import Ken3DDepthEstimator
from remimi.monodepth.dpt import DPTDepthEstimator
# from remimi.monodepth.adabin import InferenceHelper
from remimi.segmentation.rgb_segmentation import SemanticSegmenter
import torch
import cv2
import argparse
import numpy as np
i... | import os
import glob
from remimi.monodepth.ken3d.depthestim import Ken3DDepthEstimator
from remimi.monodepth.dpt import DPTDepthEstimator
# from remimi.monodepth.adabin import InferenceHelper
from remimi.segmentation.rgb_segmentation import SemanticSegmenter
import torch
import cv2
import argparse
import numpy as np
i... | en | 0.263209 | # from remimi.monodepth.adabin import InferenceHelper # if model_name == "dpt": # self.depth_estimator = DPTDepthEstimator(debug) # elif model_name == "ken3d": # self.depth_estimator = Ken3DDepthEstimator(debug=debug) # self.depth_estimator = InferenceHelper() # self.semantic_segmentater = semantic_segmenter # ... | 2.125669 | 2 |
2015/08_01/nips15.py | pschulam/Notebook | 0 | 6620859 | <filename>2015/08_01/nips15.py
import numpy as np
import os
from scipy.stats import multivariate_normal
from scipy.misc import logsumexp
from mypy.bsplines import universal_basis
from mypy.models import softmax
from mypy.util import as_row, as_col
class NipsModel:
def __init__(self, b, B, W, basis_param, kernel... | <filename>2015/08_01/nips15.py
import numpy as np
import os
from scipy.stats import multivariate_normal
from scipy.misc import logsumexp
from mypy.bsplines import universal_basis
from mypy.models import softmax
from mypy.util import as_row, as_col
class NipsModel:
def __init__(self, b, B, W, basis_param, kernel... | none | 1 | 1.941129 | 2 | |
generators/campaigns_generator.py | caroljunq/create-retail-mock-data | 0 | 6620860 | <reponame>caroljunq/create-retail-mock-data
# This is dataset is composed by default campaigns, but you can change or add/remove them in the config.
import json
import pandas as pd
import random
# reading config
with open('../config.json') as data:
config = json.load(data)
# setting up variables
out_path = config... | # This is dataset is composed by default campaigns, but you can change or add/remove them in the config.
import json
import pandas as pd
import random
# reading config
with open('../config.json') as data:
config = json.load(data)
# setting up variables
out_path = config["output_path_files"]
outfile = config["camp... | en | 0.856008 | # This is dataset is composed by default campaigns, but you can change or add/remove them in the config. # reading config # setting up variables # adding "no campaign" # creating a data frame with the final results # columns names aka header # writing file | 2.977647 | 3 |
exercicios/Lista2/Q16.py | AlexandrePeBrito/CursoUdemyPython | 0 | 6620861 | #Usando switch, escreva um programa que leia um inteiro
#entre 1 e 12 e imprima o mês correspondente a este numero.
#Isto é, janeiro se 1, fevereiro se 2, e assim por diante.
num=int(input("Informe um numero inteiro(entre 1 e 12): "))
if(num==1):
print("Janeiro")
elif(num==2):
print("Fevereiro")
elif(num==3):... | #Usando switch, escreva um programa que leia um inteiro
#entre 1 e 12 e imprima o mês correspondente a este numero.
#Isto é, janeiro se 1, fevereiro se 2, e assim por diante.
num=int(input("Informe um numero inteiro(entre 1 e 12): "))
if(num==1):
print("Janeiro")
elif(num==2):
print("Fevereiro")
elif(num==3):... | pt | 0.966794 | #Usando switch, escreva um programa que leia um inteiro #entre 1 e 12 e imprima o mês correspondente a este numero. #Isto é, janeiro se 1, fevereiro se 2, e assim por diante. | 3.87355 | 4 |
project/vision_backend/tests/tasks/test_classify.py | beijbom/coralnet | 31 | 6620862 | <filename>project/vision_backend/tests/tasks/test_classify.py
from unittest import mock
from django.core.cache import cache
from django.db import IntegrityError
from django.test import override_settings
from django.test.utils import patch_logger
import numpy as np
import spacer.config as spacer_config
from accounts.u... | <filename>project/vision_backend/tests/tasks/test_classify.py
from unittest import mock
from django.core.cache import cache
from django.db import IntegrityError
from django.test import override_settings
from django.test.utils import patch_logger
import numpy as np
import spacer.config as spacer_config
from accounts.u... | en | 0.910465 | Classify an image where all points are unannotated. # Image without annotations # Process feature extraction results + classify image # Score count per point should be label count or 5, # whichever is less. (In this case it's label count) When there are more than 5 labels, score count should be capped to 5. # Increase ... | 2.487229 | 2 |
train_las.py | HappyBall/asr_guided_tacotron | 5 | 6620863 | '''
modified from:
https://www.github.com/kyubyong/tacotron
'''
import os
import sys
import numpy as np
from hyperparams import Hyperparams as hp
import tensorflow as tf
from tqdm import tqdm
from utils import *
from graph import Graph
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string("keep_train", "False", "keep... | '''
modified from:
https://www.github.com/kyubyong/tacotron
'''
import os
import sys
import numpy as np
from hyperparams import Hyperparams as hp
import tensorflow as tf
from tqdm import tqdm
from utils import *
from graph import Graph
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string("keep_train", "False", "keep... | en | 0.442212 | modified from: https://www.github.com/kyubyong/tacotron #sv = tf.train.Supervisor(las_logdir=hp.las_logdir, save_summaries_secs=60, save_model_secs=0) #while 1: #lr = hp.las_lr #_, gs = sess.run([g.train_op, g.global_step]) #_, gs, l = sess.run([g.train_op, g.global_step, g.loss], feed_dict={g.lr:lr}) # Write checkpoin... | 2.033066 | 2 |
pipe/tools/houtools/rollback/rollback.py | htinney/byupipe | 5 | 6620864 | <filename>pipe/tools/houtools/rollback/rollback.py
import hou
import os
# from PySide2 import QtGui, QtWidgets, QtCore
import pipe.gui.quick_dialogs as qd
import pipe.gui.select_from_list as sfl
from pipe.tools.houtools.utils.utils import *
from pipe.tools.houtools.importer.importer import Importer
from pipe.am.proje... | <filename>pipe/tools/houtools/rollback/rollback.py
import hou
import os
# from PySide2 import QtGui, QtWidgets, QtCore
import pipe.gui.quick_dialogs as qd
import pipe.gui.select_from_list as sfl
from pipe.tools.houtools.utils.utils import *
from pipe.tools.houtools.importer.importer import Importer
from pipe.am.proje... | en | 0.7796 | # from PySide2 import QtGui, QtWidgets, QtCore # make the list a list of strings, not tuples # source_path = self.node.type().sourcePath() # print("source path: ", source_path) # definition = self.get_definition_by_department(selected_file) # If there is a material node, put the modify node in between material and geo.... | 2.436257 | 2 |
afm/scripts/modeling/output/__init__.py | nerdneilsfield/2D-3D-pose-tracking | 288 | 6620865 | <reponame>nerdneilsfield/2D-3D-pose-tracking
from .output import build_output_method | from .output import build_output_method | none | 1 | 1.097726 | 1 | |
musicbotv2/plugins/play.py | dabolink/MusicBot | 0 | 6620866 | <gh_stars>0
import asyncio
import logging
import re
import time
import traceback
from musicbot import _func_, _get_variable, exceptions, factory
from musicbot.bot import MusicBot
from musicbot.constructs import Response
from musicbot.opus_loader import load_opus_lib
from musicbot.utils import fixg, ftimedelta
load_op... | import asyncio
import logging
import re
import time
import traceback
from musicbot import _func_, _get_variable, exceptions, factory
from musicbot.bot import MusicBot
from musicbot.constructs import Response
from musicbot.opus_loader import load_opus_lib
from musicbot.utils import fixg, ftimedelta
load_opus_lib()
log... | en | 0.909881 | Usage: {command_prefix}play song_link {command_prefix}play text to search for {command_prefix}play spotify_uri Adds the song to the playlist. If a link is not provided, the first result from a youtube search is added to the queue. If enabled in the config, ... | 2.541734 | 3 |
scratch/trial.py | JackBurdick/calcatrix | 0 | 6620867 | <gh_stars>0
from calcatrix.devices.multiview import MultiView # pylint: disable=import-error
from calcatrix.functions.photo import take_photo # pylint: disable=import-error
DIR_PIN = 27
STEP_PIN = 17
LOC_PIN = 26
ENABLE_PIN = 22
BOUND_A_PIN = 23
BOUND_B_PIN = 25
ROTATE_PINS = [21, 20, 16, 12]
init_config = {
"ro... | from calcatrix.devices.multiview import MultiView # pylint: disable=import-error
from calcatrix.functions.photo import take_photo # pylint: disable=import-error
DIR_PIN = 27
STEP_PIN = 17
LOC_PIN = 26
ENABLE_PIN = 22
BOUND_A_PIN = 23
BOUND_B_PIN = 25
ROTATE_PINS = [21, 20, 16, 12]
init_config = {
"rotate": {"pin... | en | 0.608543 | # pylint: disable=import-error # pylint: disable=import-error # filepath is the location to store, init, if true will initialize the cart # from the saved filepath, if present # data = {"marker_positions": [], "current_position": 0} | 2.27896 | 2 |
tests/test_utils/test_kernel.py | schmidtjonathan/probfindiff | 3 | 6620868 | <gh_stars>1-10
"""Test for kernel functionality."""
import functools
import jax
import jax.numpy as jnp
import pytest
import pytest_cases
from probfindiff.utils import autodiff, kernel, kernel_zoo
def case_exponentiated_quadratic():
k = lambda x, y: jnp.exp(-(x - y).dot(x - y))
return kernel.batch_gram(k)... | """Test for kernel functionality."""
import functools
import jax
import jax.numpy as jnp
import pytest
import pytest_cases
from probfindiff.utils import autodiff, kernel, kernel_zoo
def case_exponentiated_quadratic():
k = lambda x, y: jnp.exp(-(x - y).dot(x - y))
return kernel.batch_gram(k)[0]
def case_... | en | 0.872861 | Test for kernel functionality. | 2.278377 | 2 |
R2.py | glosophy/Time-Series | 0 | 6620869 | <gh_stars>0
def R2(y_hat, y_true):
'''Calculates R^2'''
mean = np.mean(y_true)
numerator = []
denominator = []
for i in y_hat:
num = (i - mean) ** 2
numerator.append(num)
for j in y_true:
den = (j - mean) ** 2
denominator.append(den)
R2 = np.sum(numerator)... | def R2(y_hat, y_true):
'''Calculates R^2'''
mean = np.mean(y_true)
numerator = []
denominator = []
for i in y_hat:
num = (i - mean) ** 2
numerator.append(num)
for j in y_true:
den = (j - mean) ** 2
denominator.append(den)
R2 = np.sum(numerator) / np.sum(de... | en | 0.684595 | Calculates R^2 | 3.224249 | 3 |
jaxopt/_src/objectives.py | mblondel/jaxopt | 0 | 6620870 | # Copyright 2021 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2021 Google 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | en | 0.737061 | # Copyright 2021 Google 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ... | 2.224108 | 2 |
template_problem_[code]/solution.py | alexandrustoica/leetcode | 0 | 6620871 | from typing import List
class Foo:
def foo(self):
pass
if __name__ == '__main__':
pass
| from typing import List
class Foo:
def foo(self):
pass
if __name__ == '__main__':
pass
| none | 1 | 1.735726 | 2 | |
message_recall/user_retriever.py | google/googleapps-message-recall | 12 | 6620872 | <gh_stars>10-100
# 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 required by a... | # 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 required by applicable law or ... | en | 0.782797 | # 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 required by applicable law or ... | 2.279559 | 2 |
agtc/code_generation/type_engine.py | PetarMihalj/AGT | 10 | 6620873 | <reponame>PetarMihalj/AGT<filename>agtc/code_generation/type_engine.py
import sys
from typing import Dict, List, Tuple
from enum import Enum
from . import type_system as ts
from .recursive_logger import RecursiveLogger
from . import inference_errors as ierr
from .scope_manager import GlobalScopeManager
class Typing... | import sys
from typing import Dict, List, Tuple
from enum import Enum
from . import type_system as ts
from .recursive_logger import RecursiveLogger
from . import inference_errors as ierr
from .scope_manager import GlobalScopeManager
class TypingContext:
def __init__(self, func_defs, struct_defs):
self.f... | en | 0.608905 | # cache inspection and modificaiton # function generators invocation # func definition resolution # decision # cache inspection and modificaiton # concrete generators invocation # struct definition resolution # decision | 2.050972 | 2 |
kirsche/utils/semanticscholar.py | kausalflow/kirsche | 4 | 6620874 | <gh_stars>1-10
import json
from kirsche.utils.web import get_page_content
from loguru import logger
def get_paper_info(paper_id: list, API_BASE=None) -> list:
"""
Get paper info from Semantic Scholar API
:param paper_id: list of paper ids
:param API_BASE: base url for the API, default is semanticsch... | import json
from kirsche.utils.web import get_page_content
from loguru import logger
def get_paper_info(paper_id: list, API_BASE=None) -> list:
"""
Get paper info from Semantic Scholar API
:param paper_id: list of paper ids
:param API_BASE: base url for the API, default is semanticscholar
"""
... | en | 0.696112 | Get paper info from Semantic Scholar API :param paper_id: list of paper ids :param API_BASE: base url for the API, default is semanticscholar # Get paper info from Semantic Scholar API | 2.491072 | 2 |
francis/tasks/genshin.py | trantinan2512/Francis | 0 | 6620875 | import json
import re
from datetime import datetime
import bs4
import discord
from pytz import timezone
from .webspiders import WebSpider
class GenshinCrawler():
def __init__(self, bot):
self.bot = bot
self.news_spider = WebSpider(self.bot, 'site_genshin')
self.site_url = 'https://gens... | import json
import re
from datetime import datetime
import bs4
import discord
from pytz import timezone
from .webspiders import WebSpider
class GenshinCrawler():
def __init__(self, bot):
self.bot = bot
self.news_spider = WebSpider(self.bot, 'site_genshin')
self.site_url = 'https://gens... | en | 0.680792 | # fetch content data # try to auto-publish the message # save to drive and print the result title | 2.538759 | 3 |
tests/rules/eicar_rule_test.py | twaldear/binaryalert | 1,324 | 6620876 | <reponame>twaldear/binaryalert<gh_stars>1000+
"""Test the correctness of the EICAR YARA rule."""
import os
import unittest
import yara
THIS_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) # Directory containing this file.
EICAR_RULE_FILE = os.path.join(THIS_DIRECTORY, '..', '..', 'rules', 'public', 'eicar.ya... | """Test the correctness of the EICAR YARA rule."""
import os
import unittest
import yara
THIS_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) # Directory containing this file.
EICAR_RULE_FILE = os.path.join(THIS_DIRECTORY, '..', '..', 'rules', 'public', 'eicar.yara')
EICAR_TXT_FILE = os.path.join(THIS_DIRECT... | en | 0.756195 | Test the correctness of the EICAR YARA rule. # Directory containing this file. Verify that the EICAR rules file matches only the expected string. Compile the EICAR YARA rule. Should match the exact EICAR string. Trailing whitespace is allowed after the EICAR string. No match for eicar_av_test if EICAR string is not the... | 3.049201 | 3 |
tests/datasource/test_new_datasource_with_runtime_data_connector_pandas_execution_engine.py | andyjessen/great_expectations | 0 | 6620877 | <gh_stars>0
from typing import Any, Dict, List, Union
import pandas as pd
import pytest
from great_expectations.execution_engine.pandas_batch_data import PandasBatchData
try:
sqlalchemy = pytest.importorskip("sqlalchemy")
except ImportError:
sqlalchemy = None
import great_expectations.exceptions as ge_excep... | from typing import Any, Dict, List, Union
import pandas as pd
import pytest
from great_expectations.execution_engine.pandas_batch_data import PandasBatchData
try:
sqlalchemy = pytest.importorskip("sqlalchemy")
except ImportError:
sqlalchemy = None
import great_expectations.exceptions as ge_exceptions
from g... | en | 0.799695 | class_name: Datasource execution_engine: class_name: PandasExecutionEngine data_connectors: test_runtime_data_connector: class_name: RuntimeDataConnector batch_identifiers: - pipeline_stage_name - airflow_run_id - custom_k... | 2.299028 | 2 |
socfaker/products.py | priamai/soc-faker | 122 | 6620878 | class Products(object):
"""The Products class is the main entrypoint for all product related data within soc-faker
Returns:
Products: A class which contains properties about different security products
"""
@property
def azure(self):
"""Azure class contains properties related to Az... | class Products(object):
"""The Products class is the main entrypoint for all product related data within soc-faker
Returns:
Products: A class which contains properties about different security products
"""
@property
def azure(self):
"""Azure class contains properties related to Az... | en | 0.842968 | The Products class is the main entrypoint for all product related data within soc-faker Returns: Products: A class which contains properties about different security products Azure class contains properties related to Azure products Returns: Azure: Microsoft Azure object containing pro... | 2.736951 | 3 |
tests/unit/test_version_utils.py | medmunds/tox-gh-matrix | 0 | 6620879 | <gh_stars>0
import re
import sys
import pytest
from tox.interpreters import InterpreterInfo
from tox_gh_matrix.version_utils import (
basepython_to_gh_python_version,
format_version_info,
interpreter_info_to_version,
python_version_to_prerelease_spec,
)
@pytest.mark.parametrize(
"basepython,expe... | import re
import sys
import pytest
from tox.interpreters import InterpreterInfo
from tox_gh_matrix.version_utils import (
basepython_to_gh_python_version,
format_version_info,
interpreter_info_to_version,
python_version_to_prerelease_spec,
)
@pytest.mark.parametrize(
"basepython,expected",
[... | en | 0.801185 | # tox default basepython # only N.M version supported # only N.M version supported # non-sys.executable absolute path # Unclear how to specify pypy range, so don't: # These forms aren't currently handled: # (InterpreterInfo constructor has changed required kwargs # over time, in ways which aren't relevant to this plugi... | 2.33638 | 2 |
build/lib/Xethru_radar/test_lib.py | Justgo13/sensor_library | 0 | 6620880 | import unittest
import Xethru_radar.X4_parser as parser
class TestParser(unittest.TestCase):
def test_iq(self):
"""
Method to test if .dat binary file was converted successfully to .csv file with in-phase and quadrature
components together.
:return:
1
"""
... | import unittest
import Xethru_radar.X4_parser as parser
class TestParser(unittest.TestCase):
def test_iq(self):
"""
Method to test if .dat binary file was converted successfully to .csv file with in-phase and quadrature
components together.
:return:
1
"""
... | en | 0.940952 | Method to test if .dat binary file was converted successfully to .csv file with in-phase and quadrature components together. :return: 1 Method to test if .dat binary file was converted successfully to .csv file with in-phase and quadrature component separated. :return: ... | 2.956188 | 3 |
karma/bot/management/commands/start_bot.py | justinas/upkarma | 2 | 6620881 | <filename>karma/bot/management/commands/start_bot.py
from django.core.management.base import BaseCommand, CommandError
import logging
import traceback
import sys
import time
from karma.bot.core import Bot
from karma.utils import get_redis_client
class Command(BaseCommand):
def handle(self, *args, **options):
... | <filename>karma/bot/management/commands/start_bot.py
from django.core.management.base import BaseCommand, CommandError
import logging
import traceback
import sys
import time
from karma.bot.core import Bot
from karma.utils import get_redis_client
class Command(BaseCommand):
def handle(self, *args, **options):
... | en | 0.396919 | # TODO: assume 0 instead? dangerous | 2.009487 | 2 |
Chapter 06 - Files and Exceptions/Assignments/6.1 Introduction to File Input and Output/51223.py | EllisBarnes00/COP-1000 | 0 | 6620882 | <reponame>EllisBarnes00/COP-1000
input = open("rawdata", "r")
datum = int(input.read())
input.close() | input = open("rawdata", "r")
datum = int(input.read())
input.close() | none | 1 | 2.581396 | 3 | |
pylogging/log_levels.py | ansrivas/pylogging | 13 | 6620883 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Module to set log level."""
import logging
from future.utils import raise_with_traceback as rwt
class LogLevel(object):
"""Log levels definition."""
levels = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,... | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Module to set log level."""
import logging
from future.utils import raise_with_traceback as rwt
class LogLevel(object):
"""Log levels definition."""
levels = {
'DEBUG': logging.DEBUG,
'INFO': logging.INFO,
'WARNING': logging.WARNING,... | en | 0.707826 | # !/usr/bin/env python # -*- coding: utf-8 -*- Module to set log level. Log levels definition. Get log level from a string. | 2.751249 | 3 |
src/gam/utils.py | GAM-team/GAM | 102 | 6620884 | import datetime
import re
import sys
import time
from hashlib import md5
from html.entities import name2codepoint
from html.parser import HTMLParser
import importlib
import json
import dateutil.parser
import types
from gam import controlflow
from gam import fileutils
from gam import transport
from gam.var import *
c... | import datetime
import re
import sys
import time
from hashlib import md5
from html.entities import name2codepoint
from html.parser import HTMLParser
import importlib
import json
import dateutil.parser
import types
from gam import controlflow
from gam import fileutils
from gam import transport
from gam.var import *
c... | en | 0.724253 | Lazily import a module, mainly to avoid pulling in large dependencies. `contrib`, and `ffmpeg` are examples of modules that are large and not always needed, and this allows them to only be loaded when they are used. # The lint error here is incorrect. # pylint: disable=super-on-old-class # Import the target module... | 2.490111 | 2 |
Lib/site-packages/qutebrowser/qutebrowser.py | fochoao/cpython | 0 | 6620885 | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 <NAME> (The Compiler) <<EMAIL>>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ei... | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2021 <NAME> (The Compiler) <<EMAIL>>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ei... | en | 0.76171 | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2014-2021 <NAME> (The Compiler) <<EMAIL>> # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eith... | 2.016862 | 2 |
deeplearning EX/Ex2.py | deliciousYSH/Misc.Code | 0 | 6620886 | import torch as t
import torchvision as tv
import torchvision.transforms as transforms
from torchvision.transforms import ToPILImage
from torch import nn
import torch as t
from torch.nn import functional as F
from torch import optim
show = ToPILImage() # 可以把Tensor转成Image,方便可视化
t.set_num_threads(8)
# 第一次运行程序torchvi... | import torch as t
import torchvision as tv
import torchvision.transforms as transforms
from torchvision.transforms import ToPILImage
from torch import nn
import torch as t
from torch.nn import functional as F
from torch import optim
show = ToPILImage() # 可以把Tensor转成Image,方便可视化
t.set_num_threads(8)
# 第一次运行程序torchvi... | zh | 0.916323 | # 可以把Tensor转成Image,方便可视化 # 第一次运行程序torchvision会自动下载CIFAR-10数据集, # 大约100M,需花费一定的时间, # 如果已经下载有CIFAR-10,可通过root参数指定 # 定义对数据的预处理 # 转为Tensor # 归一化 # 训练集 # 测试集 # (data + 1) / 2是为了还原被归一化的数据 实现子module: Residual Block 实现主module:ResNet34 ResNet34 包含多个layer,每个layer又包含多个residual block 用子module来实现residual block,用_make_layer函... | 2.672476 | 3 |
acs_test_suites/OTC/libs/testlib/scripts/relay/relay_steps.py | wangji1/test-framework-and-suites-for-android | 0 | 6620887 | <filename>acs_test_suites/OTC/libs/testlib/scripts/relay/relay_steps.py<gh_stars>0
#!/usr/bin/env python
"""
Copyright (C) 2018 Intel Corporation
?
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
?
h... | <filename>acs_test_suites/OTC/libs/testlib/scripts/relay/relay_steps.py<gh_stars>0
#!/usr/bin/env python
"""
Copyright (C) 2018 Intel Corporation
?
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
?
h... | en | 0.684016 | #!/usr/bin/env python Copyright (C) 2018 Intel Corporation ? Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at ? http://www.apache.org/licenses/LICENSE-2.0 ? Unless required by applicable law or agreed... | 1.629307 | 2 |
src/behavior_tree_learning/core/sbt/py_tree.py | dgerod/behavior_tree_learning | 7 | 6620888 | <reponame>dgerod/behavior_tree_learning
import time
import py_trees as pt
from behavior_tree_learning.core.sbt.world import World
from behavior_tree_learning.core.sbt.behavior_tree import BehaviorTreeStringRepresentation
from behavior_tree_learning.core.sbt.node_factory import BehaviorNodeFactory
class ExecutionParam... | import time
import py_trees as pt
from behavior_tree_learning.core.sbt.world import World
from behavior_tree_learning.core.sbt.behavior_tree import BehaviorTreeStringRepresentation
from behavior_tree_learning.core.sbt.node_factory import BehaviorNodeFactory
class ExecutionParameters:
def __init__(self, max_ticks... | en | 0.907158 | Returns bt string (actually a list) from py tree root by cleaning the ascii tree from py trees Not complete or beautiful by any means but works for many trees Recursive function to generate the tree from a string # Node is a control node or decorator with children - add subtree via string and then add t... | 2.188058 | 2 |
eds/openmtc-gevent/server/openmtc-scl/src/openmtc_scl/plugins_eu_projects/device_emulator/__init__.py | piyush82/elastest-device-emulator-service | 0 | 6620889 | <reponame>piyush82/elastest-device-emulator-service<filename>eds/openmtc-gevent/server/openmtc-scl/src/openmtc_scl/plugins_eu_projects/device_emulator/__init__.py
from aplus import Promise
from futile.logging import LoggerMixin
from openmtc_server.Plugin import Plugin
from openmtc_etsi.exc import OpenMTCError
from geve... | from aplus import Promise
from futile.logging import LoggerMixin
from openmtc_server.Plugin import Plugin
from openmtc_etsi.exc import OpenMTCError
from gevent.server import DatagramServer, StreamServer
from openmtc_scl.platform.gevent.ServerRack import GEventServerRack
from openmtc_etsi.scl import CreateRequestIndicat... | en | 0.463983 | #"coap://localhost:24000/m2m/applications/ScalableDynamicApp/containers/ImportantData/contentInstances/" #Sample default Message # Create Dummy Message of size "data_size" # getsizeof of empty msg is :: 48 -- > getsizeof(dumps({"key":msg})) is 48 # Sending message #for i in range(nb_devices): | 1.793812 | 2 |
fabricio/docker/image.py | theoden-dd/fabricio | 291 | 6620890 | <filename>fabricio/docker/image.py
import json
import warnings
import docker.auth
import docker.utils
import six
from functools import partial
import fabricio
from fabricio import utils
class ImageError(fabricio.Error):
pass
class ImageNotFoundError(ImageError):
pass
class Registry(six.text_type):
... | <filename>fabricio/docker/image.py
import json
import warnings
import docker.auth
import docker.utils
import six
from functools import partial
import fabricio
from fabricio import utils
class ImageError(fabricio.Error):
pass
class ImageNotFoundError(ImageError):
pass
class Registry(six.text_type):
... | en | 0.398863 | # TODO 'latest' is unnecessary # descriptor's cache # tag can override image registry, name and/or digest # pragma: no cover # default options | 2.291646 | 2 |
cbl/maybe_type.py | Commodoreprime/Command-Block-Assembly | 223 | 6620891 | from .containers import Parameter, Temporary, DelegatedWrite
from .native_type import NativeType, as_var
from .cbl_type import CBLType, CBLTypeInstance
from .struct_type import StructuredType
from .function_type import IntrinsicCallable
import cmd_ir.instructions as i
class MaybeType(NativeType):
def __init__(se... | from .containers import Parameter, Temporary, DelegatedWrite
from .native_type import NativeType, as_var
from .cbl_type import CBLType, CBLTypeInstance
from .struct_type import StructuredType
from .function_type import IntrinsicCallable
import cmd_ir.instructions as i
class MaybeType(NativeType):
def __init__(se... | en | 0.780529 | # return _var if we are not wrapped # There is support for valvar being elided e.g. when we are # an NBT property of a struct, use that property as valvar. # But we don't test for this yet # take on the real underlying type if it's a single type # Otherwise we wrap it in NBT # Default constructor # Constructor with val... | 1.994265 | 2 |
bin/dbm/droplet_rise.py | ChrisBarker-NOAA/tamoc | 18 | 6620892 | <filename>bin/dbm/droplet_rise.py
"""
Insoluble fluid particles
=========================
Use the ``TAMOC`` ``DBM`` to specify an oil droplet that cannot dissolve
(e.g., a dead, heavy oil with negligible dissolution) and calculate all of its
properties in deepwater conditions.
In particular, this script demonstrate... | <filename>bin/dbm/droplet_rise.py
"""
Insoluble fluid particles
=========================
Use the ``TAMOC`` ``DBM`` to specify an oil droplet that cannot dissolve
(e.g., a dead, heavy oil with negligible dissolution) and calculate all of its
properties in deepwater conditions.
In particular, this script demonstrate... | en | 0.530127 | Insoluble fluid particles ========================= Use the ``TAMOC`` ``DBM`` to specify an oil droplet that cannot dissolve (e.g., a dead, heavy oil with negligible dissolution) and calculate all of its properties in deepwater conditions. In particular, this script demonstrates the methods: * `dbm.InsolublePartic... | 2.381535 | 2 |
tests/test_RNA_folding.py | wlqqlz/rna-folding | 1 | 6620893 | <reponame>wlqqlz/rna-folding<gh_stars>1-10
# Copyright 2021 D-Wave Systems
#
# 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... | # Copyright 2021 D-Wave Systems
#
# 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 writin... | en | 0.852665 | # Copyright 2021 D-Wave Systems # # 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 writin... | 2.149547 | 2 |
webapp/videobank/views.py | jtallieu/djambalaya | 0 | 6620894 | <filename>webapp/videobank/views.py
# Create your views here.
from django.shortcuts import render
import logging
log = logging.getLogger('videobank.webapp')
def main(request):
log.info('Handling index view: {}'.format(request))
return render(request, "vms/home.html")
| <filename>webapp/videobank/views.py
# Create your views here.
from django.shortcuts import render
import logging
log = logging.getLogger('videobank.webapp')
def main(request):
log.info('Handling index view: {}'.format(request))
return render(request, "vms/home.html")
| en | 0.968116 | # Create your views here. | 1.746537 | 2 |
template.py | randcodeclips/cli_template | 0 | 6620895 | import sys
def helloWorld(args, params):
to = 'World'
if params['variables']['to'] != '':
to = params['variables']['to']
text = 'Hello, {}'.format(to)
if params['toggle']['excited']:
text += '!'
print(text)
commands = {
'hello': {
'function': helloWorld,
'comm... | import sys
def helloWorld(args, params):
to = 'World'
if params['variables']['to'] != '':
to = params['variables']['to']
text = 'Hello, {}'.format(to)
if params['toggle']['excited']:
text += '!'
print(text)
commands = {
'hello': {
'function': helloWorld,
'comm... | en | 0.471528 | For more details about command use: \ {args[0]} <command> --help | 3.014738 | 3 |
programming/leetcode/may_challenge/JewelsAndStonesAlternate.py | vamsitallapudi/Coderefer-Python-Projects | 1 | 6620896 | <filename>programming/leetcode/may_challenge/JewelsAndStonesAlternate.py
print("aA".count)
| <filename>programming/leetcode/may_challenge/JewelsAndStonesAlternate.py
print("aA".count)
| none | 1 | 1.812582 | 2 | |
tests/utils.py | consbio/python-databasin | 2 | 6620897 | import datetime
import dateutil.parser
from dateutil.tz import tzlocal
from django.core.signing import base64_hmac
from django.utils.crypto import constant_time_compare
def make_api_key_callback(response, key):
class AuthenticationError(Exception):
pass
def callback(request, context):
if not... | import datetime
import dateutil.parser
from dateutil.tz import tzlocal
from django.core.signing import base64_hmac
from django.utils.crypto import constant_time_compare
def make_api_key_callback(response, key):
class AuthenticationError(Exception):
pass
def callback(request, context):
if not... | none | 1 | 2.442657 | 2 | |
tubee/routes/api_subscription.py | tomy0000000/Tubee | 8 | 6620898 | <filename>tubee/routes/api_subscription.py
from flask import Blueprint, abort, jsonify
from flask_login import current_user, login_required
from tubee.forms import SubscriptionForm, SubscriptionTagForm
api_subscription_blueprint = Blueprint("api_subscription", __name__)
@api_subscription_blueprint.route("/add", met... | <filename>tubee/routes/api_subscription.py
from flask import Blueprint, abort, jsonify
from flask_login import current_user, login_required
from tubee.forms import SubscriptionForm, SubscriptionTagForm
api_subscription_blueprint = Blueprint("api_subscription", __name__)
@api_subscription_blueprint.route("/add", met... | en | 0.643304 | Add a new subscription Remove a new subscription Add a tag to subscription Remove a tag from subscription | 2.462349 | 2 |
echolab2/instruments/util/tag_data.py | nlauffenburger/pyEcholab | 20 | 6620899 | <reponame>nlauffenburger/pyEcholab
# coding=utf-8
# National Oceanic and Atmospheric Administration (NOAA)
# Alaskan Fisheries Science Center (AFSC)
# Resource Assessment and Conservation Engineering (RACE)
# Midwater Assessment and Conservation Engineering (MACE)
# THIS SOFTWARE AND ITS DOCUMENTATIO... | # coding=utf-8
# National Oceanic and Atmospheric Administration (NOAA)
# Alaskan Fisheries Science Center (AFSC)
# Resource Assessment and Conservation Engineering (RACE)
# Midwater Assessment and Conservation Engineering (MACE)
# THIS SOFTWARE AND ITS DOCUMENTATION ARE CONSIDERED TO BE IN THE PUBLI... | en | 0.552099 | # coding=utf-8 # National Oceanic and Atmospheric Administration (NOAA) # Alaskan Fisheries Science Center (AFSC) # Resource Assessment and Conservation Engineering (RACE) # Midwater Assessment and Conservation Engineering (MACE) # THIS SOFTWARE AND ITS DOCUMENTATION ARE CONSIDERED TO BE IN THE PUBLIC ... | 2.720488 | 3 |
topobank/manager/migrations/0025_alter_topography_instrument_parameters.py | ContactEngineering/TopoBank | 3 | 6620900 | <gh_stars>1-10
# Generated by Django 3.2.7 on 2021-09-17 14:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manager', '0024_auto_20210804_1426'),
]
operations = [
migrations.AlterField(
model_name='topography',
... | # Generated by Django 3.2.7 on 2021-09-17 14:30
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('manager', '0024_auto_20210804_1426'),
]
operations = [
migrations.AlterField(
model_name='topography',
name='instrum... | en | 0.826268 | # Generated by Django 3.2.7 on 2021-09-17 14:30 | 1.401939 | 1 |
svbrdf/module_svbrdf.py | ywjleft/SVBRDF_from_Video | 1 | 6620901 | import tensorflow as tf
import numpy as np
#Convolution implementation
def conv_down(batch_input, out_channels, stride=2, filterSize=3, initScale = 0.02, useXavier=False, paddingSize = 1, useBias=False, normKernel=True):
with tf.variable_scope("conv"):
in_height, in_width, in_channels = [batch_input.get_s... | import tensorflow as tf
import numpy as np
#Convolution implementation
def conv_down(batch_input, out_channels, stride=2, filterSize=3, initScale = 0.02, useXavier=False, paddingSize = 1, useBias=False, normKernel=True):
with tf.variable_scope("conv"):
in_height, in_width, in_channels = [batch_input.get_s... | en | 0.691573 | #Convolution implementation # [BO] Scaling factor. # [BkkIO] Scale output feature maps. #SYMMETRIC # [BO] Scaling factor. # [BkkIO] Scale output feature maps. #SYMMETRIC # adding these together creates the leak part and linear part # then cancels them out by subtracting/adding an absolute value term # leak: a*x/2 - a*a... | 2.367182 | 2 |
data/preprocess.py | Real-Silverywing/pytorch_classification | 0 | 6620902 | import os
import glob
import sys
sys.path.append("..")
import cfg
import random
if __name__ == '__main__':
traindata_path = cfg.BASE + r'\train'
labels = os.listdir(traindata_path)
valdata_path = cfg.BASE + r'\test'
##写train.txt文件
txtpath = cfg.BASE+r'/'
print(labels)
if os.path.exi... | import os
import glob
import sys
sys.path.append("..")
import cfg
import random
if __name__ == '__main__':
traindata_path = cfg.BASE + r'\train'
labels = os.listdir(traindata_path)
valdata_path = cfg.BASE + r'\test'
##写train.txt文件
txtpath = cfg.BASE+r'/'
print(labels)
if os.path.exi... | zh | 0.494068 | ##写train.txt文件 #print(imglist) #可能会出现浪费样本,但是保证val和test不冲突 # print(img + ' ' + str(index)) # print(img + ' ' + str(index)) | 2.507757 | 3 |
robot-server/robot_server/robot/calibration/check/session.py | fakela/opentrons | 0 | 6620903 | <filename>robot-server/robot_server/robot/calibration/check/session.py
import typing
import logging
from uuid import uuid4
from enum import Enum
from dataclasses import dataclass
from robot_server.robot.calibration.session import CalibrationSession, \
CalibrationException, HEIGHT_SAFETY_BUFFER
from opentrons.types... | <filename>robot-server/robot_server/robot/calibration/check/session.py
import typing
import logging
from uuid import uuid4
from enum import Enum
from dataclasses import dataclass
from robot_server.robot.calibration.session import CalibrationSession, \
CalibrationException, HEIGHT_SAFETY_BUFFER
from opentrons.types... | en | 0.914189 | A set of endpoints that can be used to create a session for any robot calibration tasks such as checking your calibration data, performing mount offset or a robot deck transform. Handle a client command :param name: Name of the command :param data: Data supplied in command :return: None whether... | 2.412326 | 2 |
chatroom/migrations/0007_auto_20160106_0538.py | sonicyang/chiphub | 0 | 6620904 | <filename>chatroom/migrations/0007_auto_20160106_0538.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0008_auto_20151216_0932'),
('chatroom', '0006_auto_20160106_0503'),... | <filename>chatroom/migrations/0007_auto_20160106_0538.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0008_auto_20151216_0932'),
('chatroom', '0006_auto_20160106_0503'),... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.695996 | 2 |
ocimatic/ui.py | OCIoficial/ocimatic | 0 | 6620905 | <gh_stars>0
import re
import sys
from contextlib import contextmanager
from typing import (Any, Callable, Iterable, Iterator, List, NamedTuple, Optional, TextIO, TypeVar,
Union, cast)
from colorama import Fore, Style
import ocimatic
RESET = Style.RESET_ALL
BOLD = Style.BRIGHT
RED = Fore.RED
GREEN... | import re
import sys
from contextlib import contextmanager
from typing import (Any, Callable, Iterable, Iterator, List, NamedTuple, Optional, TextIO, TypeVar,
Union, cast)
from colorama import Fore, Style
import ocimatic
RESET = Style.RESET_ALL
BOLD = Style.BRIGHT
RED = Fore.RED
GREEN = Fore.GREE... | en | 0.864012 | Print header for task Header for a generic group of works Header for a group of works involving a contest Header for a group of works involving a solution | 2.324144 | 2 |
rename_era5_grib.py | jiangleads/EC- | 35 | 6620906 | #coding=utf-8
from __future__ import print_function
import traceback
import sys
from eccodes import *
#判断字符串Str是否包含序列SubStrList中的每一个子字符串
def IsSubString(SubStrList,Str):
flag=True
for substr in SubStrList:
if not(substr in Str):
flag=False
return flag
#获取当前目录所有指定类型的文件
... | #coding=utf-8
from __future__ import print_function
import traceback
import sys
from eccodes import *
#判断字符串Str是否包含序列SubStrList中的每一个子字符串
def IsSubString(SubStrList,Str):
flag=True
for substr in SubStrList:
if not(substr in Str):
flag=False
return flag
#获取当前目录所有指定类型的文件
... | zh | 0.160193 | #coding=utf-8 #判断字符串Str是否包含序列SubStrList中的每一个子字符串 #获取当前目录所有指定类型的文件 #print FileList #print FileNames #返回指定类型的文件名 #默认直接返回所有文件名 #对文件名排序 #print FileList ## 'Ni', ## 'Nj', ## 'latitudeOfFirstGridPointInDegrees', ## 'longitudeOfFirstGridPointInDegrees', ## 'latitudeOfLastGridPointInDegrees',... | 2.68376 | 3 |
binilla/widgets/field_widgets/simple_image_frame.py | delan/binilla | 1 | 6620907 | import weakref
import threadsafe_tkinter as tk
from binilla.widgets.field_widgets import container_frame
class SimpleImageFrame(container_frame.ContainerFrame):
tag = None
image_frame = None
display_frame_cls = type(None)
def __init__(self, *args, **kwargs):
container_frame.ContainerFrame.__... | import weakref
import threadsafe_tkinter as tk
from binilla.widgets.field_widgets import container_frame
class SimpleImageFrame(container_frame.ContainerFrame):
tag = None
image_frame = None
display_frame_cls = type(None)
def __init__(self, *args, **kwargs):
container_frame.ContainerFrame.__... | none | 1 | 2.255701 | 2 | |
projecteuler/023_non_abundant_sums.py | vikasmunshi/euler | 0 | 6620908 | <gh_stars>0
#!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
https://projecteuler.net/problem=23
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example,
the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect ... | #!/usr/bin/env python3.8
# -*- coding: utf-8 -*-
"""
https://projecteuler.net/problem=23
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example,
the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.
A n... | en | 0.945586 | #!/usr/bin/env python3.8 # -*- coding: utf-8 -*- https://projecteuler.net/problem=23 A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A numbe... | 4.145688 | 4 |
app/py/webconfig.py | tbor8080/pyhongo | 0 | 6620909 | # /usr/bin/env python
# -*- coding: utf-8 -*-
import os,sys,json
from py.webapp import *
class WebAppConfig(Database,WebAppInFlask):
"""
FlaskApp Class
- setDatabase
- setFramework
(sample code)
#====================================================================... | # /usr/bin/env python
# -*- coding: utf-8 -*-
import os,sys,json
from py.webapp import *
class WebAppConfig(Database,WebAppInFlask):
"""
FlaskApp Class
- setDatabase
- setFramework
(sample code)
#====================================================================... | de | 0.212331 | # /usr/bin/env python # -*- coding: utf-8 -*- FlaskApp Class - setDatabase - setFramework (sample code) #===================================================================================== def main(): framework=WebAppFrameWork() ... | 2.624188 | 3 |
docs/conf.py | trickeydan/zoloto | 0 | 6620910 | <filename>docs/conf.py
from typing import List
import zoloto
project = "Zoloto"
copyright = "2020, <NAME>" # noqa: A001
author = "<NAME>"
release = zoloto.__version__
extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.vie... | <filename>docs/conf.py
from typing import List
import zoloto
project = "Zoloto"
copyright = "2020, <NAME>" # noqa: A001
author = "<NAME>"
release = zoloto.__version__
extensions = [
"sphinx.ext.autodoc",
"sphinx_autodoc_typehints",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx.ext.vie... | en | 0.6669 | # noqa: A001 # type: List[str] # This is the most recent version with intersphinx support. # type: List[str] | 1.822977 | 2 |
devstack/components/keystone.py | hagleitn/Openstack-Devstack2 | 1 | 6620911 | <gh_stars>1-10
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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:... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012 Yahoo! 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.or... | en | 0.840016 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (C) 2012 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org... | 1.750474 | 2 |
trainer.py | suifengwangshi/MotifC | 0 | 6620912 | <reponame>suifengwangshi/MotifC<gh_stars>0
import os
import math
import datetime
import numpy as np
import os.path as osp
from utils import plotandsave, label_accuracy_score
from sklearn.metrics import roc_auc_score, average_precision_score
import torch
class Trainer(object):
"""build a trainer"""
def __ini... | import os
import math
import datetime
import numpy as np
import os.path as osp
from utils import plotandsave, label_accuracy_score
from sklearn.metrics import roc_auc_score, average_precision_score
import torch
class Trainer(object):
"""build a trainer"""
def __init__(self, model, optimizer, criterion, devi... | en | 0.809954 | build a trainer training the model # set training mode during the training process # self.LR_policy.step() # for cosine learning strategy # 是否加入进化信息需要进行修改 # validation and save the model with higher accuracy validate the performance of the trained model. build a trainer training the model # set training mode during the... | 2.386212 | 2 |
pysrc/torchfcts.py | juliusbierk/simultant | 0 | 6620913 | <reponame>juliusbierk/simultant
import inspect
import time
import traceback
import torch
from silly import sillyode
from torch import sin, cos, exp, tensor, sqrt, asin, acos, ones, zeros, linspace, logspace, arange, \
eye, zeros_like, ones_like, heaviside, cat, hstack, vstack, gather, nonzero, reshape, squeeze, tak... | import inspect
import time
import traceback
import torch
from silly import sillyode
from torch import sin, cos, exp, tensor, sqrt, asin, acos, ones, zeros, linspace, logspace, arange, \
eye, zeros_like, ones_like, heaviside, cat, hstack, vstack, gather, nonzero, reshape, squeeze, take, \
transpose, unsqueeze, a... | none | 1 | 2.151812 | 2 | |
tensorflow/python/distribute/experimental/rpc/rpc_ops.py | neochristou/tensorflow | 4 | 6620914 | # Copyright 2021 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 2021 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.683424 | # Copyright 2021 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.703 | 2 |
tutorials/walkthrough/mnist_DPriv_mt_scratch.py | Mtroglia/privacy | 0 | 6620915 | <reponame>Mtroglia/privacy<filename>tutorials/walkthrough/mnist_DPriv_mt_scratch.py
# Copyright 2019, The TensorFlow 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://w... | # Copyright 2019, The TensorFlow 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 or agreed t... | en | 0.573166 | # Copyright 2019, The TensorFlow 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 or agreed t... | 2.334743 | 2 |
cs-pound.py | Tesshin/CS-Pound-async | 0 | 6620916 | # -------------------- IMPORTS --------------------
import aiohttp
import asyncio
from datetime import datetime, timedelta
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import hashlib
import io
import json
import logging
import lxml.html
import math
import os
from PIL import Image... | # -------------------- IMPORTS --------------------
import aiohttp
import asyncio
from datetime import datetime, timedelta
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import hashlib
import io
import json
import logging
import lxml.html
import math
import os
from PIL import Image... | en | 0.714358 | # -------------------- IMPORTS -------------------- # -------------------- VARIABLES -------------------- # The time the script started running # Prefix to call CS Pound Discord Bot # CS Pound Discord Bot version # Get tokens from tokens.txt file # Cooldown of Auto Remind # Current hash of help.json # Current hash of a... | 2.542197 | 3 |
tests/test_randvars/test_arithmetic/test_constant.py | fxbriol/probnum | 1 | 6620917 | """Tests for random variable arithmetic for constants."""
import operator
from typing import Callable
import numpy as np
import pytest
from probnum import randvars
@pytest.mark.parametrize(
"op",
[
operator.add,
operator.sub,
operator.mul,
operator.truediv,
operator.f... | """Tests for random variable arithmetic for constants."""
import operator
from typing import Callable
import numpy as np
import pytest
from probnum import randvars
@pytest.mark.parametrize(
"op",
[
operator.add,
operator.sub,
operator.mul,
operator.truediv,
operator.f... | en | 0.74962 | Tests for random variable arithmetic for constants. | 2.829098 | 3 |
tests/testapp/permissions.py | yezyilomo/drf-guard | 7 | 6620918 | <reponame>yezyilomo/drf-guard<gh_stars>1-10
from rest_framework import permissions
class IsSelfUser(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
return obj == request.user
class IsAd... | from rest_framework import permissions
class IsSelfUser(permissions.BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
def has_object_permission(self, request, view, obj):
return obj == request.user
class IsAdminUser(permissions.BasePermission):
"""... | en | 0.887285 | Custom permission to only allow owners of an object to edit it. Custom permission to check if user is admin Custom permission to check if user is admin | 2.876518 | 3 |
src/main/python/hdfs_storage_client.py | eark-project/dm-hdfs-storage-client | 0 | 6620919 | import requests
SERVER_PROTOCOL_PREFIX = 'http://'
SERVER_NAME = '192.168.3.11/dm-hdfs-storage'
SERVER_HDFS = SERVER_PROTOCOL_PREFIX + SERVER_NAME + '/hsink/fileresource'
FILE_RESOURCE = SERVER_HDFS + '/files/{0}'
def copy_to_hdfs(local_path):
with open(local_path, 'r') as f:
filename = local_path.rparti... | import requests
SERVER_PROTOCOL_PREFIX = 'http://'
SERVER_NAME = '192.168.3.11/dm-hdfs-storage'
SERVER_HDFS = SERVER_PROTOCOL_PREFIX + SERVER_NAME + '/hsink/fileresource'
FILE_RESOURCE = SERVER_HDFS + '/files/{0}'
def copy_to_hdfs(local_path):
with open(local_path, 'r') as f:
filename = local_path.rparti... | en | 0.27024 | #hdfs_path = copy_to_hdfs('some_aip.tar') #print(hdfs_path) #if (hdfs_path != ""): # copy_from_hdfs(hdfs_path, 'local') | 2.972229 | 3 |
imread/tests/test_jpeg.py | luispedro/imread | 51 | 6620920 | <reponame>luispedro/imread
import pytest
import numpy as np
from imread import imread, imsave
from . import file_path
import glob
_filename = 'imread_testing_file.jpg'
@pytest.fixture(autouse=True)
def _remove_files():
yield
from os import unlink
from glob import glob
filelist = glob("*.jpg")
for ... | import pytest
import numpy as np
from imread import imread, imsave
from . import file_path
import glob
_filename = 'imread_testing_file.jpg'
@pytest.fixture(autouse=True)
def _remove_files():
yield
from os import unlink
from glob import glob
filelist = glob("*.jpg")
for f in filelist:
try:... | none | 1 | 2.264919 | 2 | |
assignment_02/src/q5.py | BhekimpiloNdhlela/TW324NumericalMethods | 1 | 6620921 | #!/usr/bin/python
def newton_method_sys(fxy, j0, j1, debug=True):
xn = zeros((2, 9)) #store itteration results for x^[n + 1]
jx = zeros((2, 2)) #store currant itteration jacobian inverse
fx = zeros((2, 1)) #store the results of the f(x^[n]) for a particular itteration
sx = zeros((2, 1))
... | #!/usr/bin/python
def newton_method_sys(fxy, j0, j1, debug=True):
xn = zeros((2, 9)) #store itteration results for x^[n + 1]
jx = zeros((2, 2)) #store currant itteration jacobian inverse
fx = zeros((2, 1)) #store the results of the f(x^[n]) for a particular itteration
sx = zeros((2, 1))
... | en | 0.611834 | #!/usr/bin/python #store itteration results for x^[n + 1] #store currant itteration jacobian inverse #store the results of the f(x^[n]) for a particular itteration | 3.259489 | 3 |
fonts/analysisunigram.py | anuragaroraaa/Sentiment-Analysis-of-Online-Reviews | 0 | 6620922 | import pickle
import re
import nltk
pos=negat=neu=0
def get_words_in_tweet(tweet):
wordList = re.sub("[^\w]", " ",tweet).split()
# print wordList
return wordList
def get_word_features(wordlist):
wordlist = nltk.FreqDist(wordlist)
word_features = wordlist.keys()
return word_features
def extract_feat... | import pickle
import re
import nltk
pos=negat=neu=0
def get_words_in_tweet(tweet):
wordList = re.sub("[^\w]", " ",tweet).split()
# print wordList
return wordList
def get_word_features(wordlist):
wordlist = nltk.FreqDist(wordlist)
word_features = wordlist.keys()
return word_features
def extract_feat... | en | 0.41179 | # print wordList | 2.981697 | 3 |
test/test_plug.py | piotrostr/disco_py | 0 | 6620923 | from discum import Plug
def test_plug_works():
plug = Plug()
assert plug.api_key
assert plug.url
res = plug.hello()
assert res == "eyo"
def test_plug_gets_and_returns_users():
plug = Plug()
user = plug.get_user()
assert user
assert user["token"]
res_code = plug.return_user(us... | from discum import Plug
def test_plug_works():
plug = Plug()
assert plug.api_key
assert plug.url
res = plug.hello()
assert res == "eyo"
def test_plug_gets_and_returns_users():
plug = Plug()
user = plug.get_user()
assert user
assert user["token"]
res_code = plug.return_user(us... | none | 1 | 2.277151 | 2 | |
src/rogerthat/bizz/maps/poi/models.py | goubertbrent/oca-backend | 0 | 6620924 | # -*- coding: utf-8 -*-
# Copyright 2021 Green Valley NV
#
# 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 l... | # -*- coding: utf-8 -*-
# Copyright 2021 Green Valley NV
#
# 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 l... | en | 0.787287 | # -*- coding: utf-8 -*- # Copyright 2021 Green Valley NV # # 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 l... | 2.016236 | 2 |
src/pytk/factory/model/softmax.py | bigblindbais/pytk | 0 | 6620925 | <gh_stars>0
from .model import Model
import numpy as np
import numpy.random as rnd
from scipy.misc import logsumexp
import string
class Softmax(Model):
def __init__(self, *yfactories, cond=None):
super().__init__(*yfactories, cond=cond)
self.xshape = tuple(f.nitems for f in self.xfactories)
... | from .model import Model
import numpy as np
import numpy.random as rnd
from scipy.misc import logsumexp
import string
class Softmax(Model):
def __init__(self, *yfactories, cond=None):
super().__init__(*yfactories, cond=cond)
self.xshape = tuple(f.nitems for f in self.xfactories)
self.ysh... | en | 0.324309 | # NOTE np.prod would return float 1.0 if xshape is empty # subscripts for np.einsum # precomputed once # self.params = np.zeros(self.shape) # self.params = 2 * rnd.normal(size=self.shape) # self.params = 3 * (.5 - rnd.random_sample(self.shape)) # NOTE Not currently being used # keeps dimensions when indexing # Assumes... | 2.302471 | 2 |
src/db_util.py | restaumatic/scheduled-psql-script-runner | 3 | 6620926 | import psycopg2
def make_conn(host, db, user, password):
conn = None
try:
conn = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s'" % (db, user, host, password))
except:
print("ERROR: make_conn - unable to connect to the database")
return conn
def fetch_data(conn, quer... | import psycopg2
def make_conn(host, db, user, password):
conn = None
try:
conn = psycopg2.connect("dbname='%s' user='%s' host='%s' password='%s'" % (db, user, host, password))
except:
print("ERROR: make_conn - unable to connect to the database")
return conn
def fetch_data(conn, quer... | none | 1 | 3.287677 | 3 | |
netbox_ipmi_ovh/forms.py | sanecz/netbox-ipmi-ovh-plugin | 7 | 6620927 | from django import forms
from utilities.forms import BootstrapMixin
from netbox_ipmi_ovh.models import Ipmi
class UserIpmiCfgForm(BootstrapMixin, forms.ModelForm):
ssh_key_name = forms.CharField(
label="SSH key name",
help_text="Name of the ssh key added in the OVH Manager",
max_length=100... | from django import forms
from utilities.forms import BootstrapMixin
from netbox_ipmi_ovh.models import Ipmi
class UserIpmiCfgForm(BootstrapMixin, forms.ModelForm):
ssh_key_name = forms.CharField(
label="SSH key name",
help_text="Name of the ssh key added in the OVH Manager",
max_length=100... | none | 1 | 2.401164 | 2 | |
009_Motor/main.py | DaliSummer/MindstormsEV3_py | 0 | 6620928 | <gh_stars>0
#!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor, InfraredSensor
from pybricks.parameters import Port, Stop, Direction, Button
from pybricks.tools import wait
from pybricks.media.ev3dev import Font
def printMotor(motor, screen):
screen.print('... | #!/usr/bin/env pybricks-micropython
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor, InfraredSensor
from pybricks.parameters import Port, Stop, Direction, Button
from pybricks.tools import wait
from pybricks.media.ev3dev import Font
def printMotor(motor, screen):
screen.print('speed: ', mo... | en | 0.518597 | #!/usr/bin/env pybricks-micropython # Initialize IR sensor # Initialize motors | 2.653939 | 3 |
DH2URDF/dh2urdf.py | UTHAI-Humanoid/UTHAI-Tools | 1 | 6620929 | #!/usr/bin/env python3
from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree
import numpy as np
from math import pi, atan2, sqrt
# <NAME> to URDF converter
def DHMat(theta, d, a, alpha):
cos_theta = np.cos(theta)
sin_theta = np.sin(theta)
cos_alpha = np.cos(alpha)
sin_alpha = np... | #!/usr/bin/env python3
from xml.etree.ElementTree import Element, SubElement, Comment, ElementTree
import numpy as np
from math import pi, atan2, sqrt
# <NAME> to URDF converter
def DHMat(theta, d, a, alpha):
cos_theta = np.cos(theta)
sin_theta = np.sin(theta)
cos_alpha = np.cos(alpha)
sin_alpha = np... | en | 0.21347 | #!/usr/bin/env python3 # <NAME> to URDF converter | 3.040612 | 3 |
simp_py_examples/course/t301.py | kcfkwok2003/Simp_py | 0 | 6620930 | # t301.py
from machine import Pin
from simp_py import tft
p21= Pin(21, Pin.IN)
while True:
if p21.value()==0:
tft.tft.text(0,100," on")
else:
tft.tft.text(0,100,"off")
time.sleep(0.1)
| # t301.py
from machine import Pin
from simp_py import tft
p21= Pin(21, Pin.IN)
while True:
if p21.value()==0:
tft.tft.text(0,100," on")
else:
tft.tft.text(0,100,"off")
time.sleep(0.1)
| none | 1 | 2.50604 | 3 | |
fake.py | ECMGIU/ReportSubmission | 0 | 6620931 | import random
from faker import Faker
from app import db, Report, Team
NUM_REPORTS = 40
fake = Faker()
teams = [
Team(name='Domestic Equity', manager='pwgould', color='red'),
Team(name='International Equity', manager='spsahoo', color='yellow'),
Team(name='Sustainable Investing', manager='madamann', col... | import random
from faker import Faker
from app import db, Report, Team
NUM_REPORTS = 40
fake = Faker()
teams = [
Team(name='Domestic Equity', manager='pwgould', color='red'),
Team(name='International Equity', manager='spsahoo', color='yellow'),
Team(name='Sustainable Investing', manager='madamann', col... | none | 1 | 2.574309 | 3 | |
dds/core/migrations/0005_systemuser_is_active.py | htrueman/data-delivery-system | 0 | 6620932 | # Generated by Django 2.0.1 on 2018-01-31 20:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20180131_2007'),
]
operations = [
migrations.AddField(
model_name='systemuser',
name='is_active',
... | # Generated by Django 2.0.1 on 2018-01-31 20:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_auto_20180131_2007'),
]
operations = [
migrations.AddField(
model_name='systemuser',
name='is_active',
... | en | 0.79464 | # Generated by Django 2.0.1 on 2018-01-31 20:31 | 1.654783 | 2 |
models/TextCNN.py | VascoLopes/Text-Classification | 1 | 6620933 | <gh_stars>1-10
# _*_ coding: utf-8 _*_
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
from sklearn.metrics import f1_score
class TextCNN(nn.Module):
# Based on Convolutional Neural Networks for Sentence Classification
# https://arxiv.org/abs/1408.5882
... | # _*_ coding: utf-8 _*_
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.nn import functional as F
from sklearn.metrics import f1_score
class TextCNN(nn.Module):
# Based on Convolutional Neural Networks for Sentence Classification
# https://arxiv.org/abs/1408.5882
def __init_... | en | 0.708233 | # _*_ coding: utf-8 _*_ # Based on Convolutional Neural Networks for Sentence Classification # https://arxiv.org/abs/1408.5882 # might be 0.2 #fixed_length = 50 #self.maxpools = [nn.MaxPool2d((fixed_length+1-i,1)) for i in filter_sizes] # might have maxpoll | 2.966756 | 3 |
minigest/fisco/apps.py | ctrlmaniac/minigest | 0 | 6620934 | <gh_stars>0
from django.apps import AppConfig
class FiscoConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "minigest.fisco"
verbose_name = "Fisco"
| from django.apps import AppConfig
class FiscoConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "minigest.fisco"
verbose_name = "Fisco" | none | 1 | 1.166226 | 1 | |
exporters/export_formatter/base_export_formatter.py | scrapinghub/exporters | 41 | 6620935 | <filename>exporters/export_formatter/base_export_formatter.py
from exporters.pipeline.base_pipeline_item import BasePipelineItem
class BaseExportFormatter(BasePipelineItem):
file_extension = None
item_separator = '\n'
def __init__(self, options, metadata=None):
super(BaseExportFormatter, self)._... | <filename>exporters/export_formatter/base_export_formatter.py
from exporters.pipeline.base_pipeline_item import BasePipelineItem
class BaseExportFormatter(BasePipelineItem):
file_extension = None
item_separator = '\n'
def __init__(self, options, metadata=None):
super(BaseExportFormatter, self)._... | none | 1 | 2.274693 | 2 | |
tjtestingpythonpackaging/bird.py | tjlee0909/tj-testing-python-packaging | 0 | 6620936 | class Bird(object):
def __init__(self):
pass
def tweet(self):
print "Bird sound!"
| class Bird(object):
def __init__(self):
pass
def tweet(self):
print "Bird sound!"
| none | 1 | 2.527458 | 3 | |
tests/test_empty.py | ondevice/ondevice-client | 2 | 6620937 | from unittest import TestCase
class EmptyTest(TestCase):
def testMinimalRockerfile(self):
return True
| from unittest import TestCase
class EmptyTest(TestCase):
def testMinimalRockerfile(self):
return True
| none | 1 | 2.151135 | 2 | |
tools/orb_stats.py | clarencedglee/circleci-orbs | 44 | 6620938 | <filename>tools/orb_stats.py
from typing import Dict, Optional
import json
import datetime
import urllib.request
def datadog_metric(name: str, value, tags: Optional[Dict] = None) -> Dict:
if tags is None:
tags = {}
return json.dumps({
'm': name,
'v': value,
'e': int(datetime.... | <filename>tools/orb_stats.py
from typing import Dict, Optional
import json
import datetime
import urllib.request
def datadog_metric(name: str, value, tags: Optional[Dict] = None) -> Dict:
if tags is None:
tags = {}
return json.dumps({
'm': name,
'v': value,
'e': int(datetime.... | en | 0.273735 | ") { name, statistics { last30DaysBuildCount, last30DaysOrganizationCount, last30DaysProjectCount } } } | 2.460191 | 2 |
scripts/vector.py | Hopson97/AppleFall | 14 | 6620939 | <gh_stars>10-100
import graphics as gfx
import math
'''
Vector mathematics
'''
def distance(x1, y1, x2, y2):
'''Returns distance between two points'''
dx = abs(x1 - x2)
dy = abs(y1 - y2)
return math.sqrt(dx ** 2 + dy ** 2)
def distanceBetween(p1, p2):
'''Returns distance between two points'''
... | import graphics as gfx
import math
'''
Vector mathematics
'''
def distance(x1, y1, x2, y2):
'''Returns distance between two points'''
dx = abs(x1 - x2)
dy = abs(y1 - y2)
return math.sqrt(dx ** 2 + dy ** 2)
def distanceBetween(p1, p2):
'''Returns distance between two points'''
dx = abs(p1.x - ... | en | 0.890354 | Vector mathematics Returns distance between two points Returns distance between two points Returns a normilised version of the vector passed in Returns dx, dy between two points | 3.911316 | 4 |
envdsys/envdatasystem/migrations/0003_auto_20210226_1835.py | NOAA-PMEL/envDataSystem | 1 | 6620940 | <reponame>NOAA-PMEL/envDataSystem<gh_stars>1-10
# Generated by Django 3.1.7 on 2021-02-26 18:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('envdatasystem', '0002_auto_20210226_1815'),
]
operations = [
... | # Generated by Django 3.1.7 on 2021-02-26 18:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('envdatasystem', '0002_auto_20210226_1815'),
]
operations = [
migrations.AlterModelOptions(
name... | en | 0.820508 | # Generated by Django 3.1.7 on 2021-02-26 18:35 | 1.679599 | 2 |
fast.py | mavi0/upgraded-rotary-telephone | 1 | 6620941 | import time
import configparser
import iperf3
import json
import logging
from subprocess import check_output
from datetime import datetime
from time import sleep
## TO DO: also save json files to unique file, for logs. ALSO retry iperf when can't connect
config = configparser.ConfigParser()
time = datetime.now()
conf... | import time
import configparser
import iperf3
import json
import logging
from subprocess import check_output
from datetime import datetime
from time import sleep
## TO DO: also save json files to unique file, for logs. ALSO retry iperf when can't connect
config = configparser.ConfigParser()
time = datetime.now()
conf... | en | 0.672012 | ## TO DO: also save json files to unique file, for logs. ALSO retry iperf when can't connect # print(check_output("fast", shell=True, stderr=subprocess.STDOUT)) # download = check_output("fast") | 2.441532 | 2 |
Apr_17.py | keiraaaaa/Leetcode | 0 | 6620942 | '''
#########################
# 64. Minimum Path Sum
#########################
class Solution:
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if not grid:
return 0
for i in range(len(grid)):
for j in range (len(grid... | '''
#########################
# 64. Minimum Path Sum
#########################
class Solution:
def minPathSum(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
if not grid:
return 0
for i in range(len(grid)):
for j in range (len(grid... | en | 0.46745 | ######################### # 64. Minimum Path Sum ######################### class Solution: def minPathSum(self, grid): """ :type grid: List[List[int]] :rtype: int """ if not grid: return 0 for i in range(len(grid)): for j in range (len(grid[0])... | 3.651648 | 4 |
dayone2joplin.py | brandonlou/DayOne2Joplin | 7 | 6620943 | #!/usr/local/bin/python3
import datetime, json, os, pathlib, sys, textwrap, uuid
# Check for less than two arguments passed.
def check_arguments() -> None:
if len(sys.argv) < 3:
print("Usage: python3 dayone2joplin.py [source dir] [target dir]")
exit()
def get_source_json() -> str:
cwd = os.g... | #!/usr/local/bin/python3
import datetime, json, os, pathlib, sys, textwrap, uuid
# Check for less than two arguments passed.
def check_arguments() -> None:
if len(sys.argv) < 3:
print("Usage: python3 dayone2joplin.py [source dir] [target dir]")
exit()
def get_source_json() -> str:
cwd = os.g... | en | 0.626028 | #!/usr/local/bin/python3 # Check for less than two arguments passed. # Get current working directory. # Use first argument. # Get current working directory. # Use second argument. # Create directory if it doesn't exist. # Remove dashes # Get current date and time. # Set entry contents to empty string if not available. ... | 2.91457 | 3 |
resumeparser/api/migrations/0003_auto_20170410_1053.py | jaffyadhav/django-resume-parser | 0 | 6620944 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-10 10:53
from __future__ import unicode_literals
from django.db import migrations, models
import resumeparser.utils.validator
class Migration(migrations.Migration):
dependencies = [
('api', '0002_resumearchive'),
]
operations = [
... | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-10 10:53
from __future__ import unicode_literals
from django.db import migrations, models
import resumeparser.utils.validator
class Migration(migrations.Migration):
dependencies = [
('api', '0002_resumearchive'),
]
operations = [
... | en | 0.806483 | # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-04-10 10:53 | 1.721109 | 2 |
shrdr/types.py | Skielex/shrdr | 2 | 6620945 | """Module with shrdr template type mappings."""
capacity_types_lookup = {
'int16': 'CapInt16',
'int32': 'CapInt32',
'int64': 'CapInt64',
'float32': 'CapFloat32',
'float64': 'CapFloat64',
}
arc_index_types_lookup = {
'uint32': 'ArcIdxUInt32',
'uint64': 'ArcIdxUInt64',
}
node_index_types_lo... | """Module with shrdr template type mappings."""
capacity_types_lookup = {
'int16': 'CapInt16',
'int32': 'CapInt32',
'int64': 'CapInt64',
'float32': 'CapFloat32',
'float64': 'CapFloat64',
}
arc_index_types_lookup = {
'uint32': 'ArcIdxUInt32',
'uint64': 'ArcIdxUInt64',
}
node_index_types_lo... | en | 0.708946 | Module with shrdr template type mappings. | 1.609921 | 2 |
recognize.py | maxwnewcomer/OpenCVFacialRecognition | 0 | 6620946 | <reponame>maxwnewcomer/OpenCVFacialRecognition
import numpy as np
import argparse
import imutils
import pickle
import cv2
import os
def recognize(imagePath, detectorPath, embeddingsPath, recognizerPath, label, confidenceLim):
print('[INFO] loading face detector...')
protoPath = os.path.sep.join([detectorPath, ... | import numpy as np
import argparse
import imutils
import pickle
import cv2
import os
def recognize(imagePath, detectorPath, embeddingsPath, recognizerPath, label, confidenceLim):
print('[INFO] loading face detector...')
protoPath = os.path.sep.join([detectorPath, "deploy.prototxt"])
modelPath = os.path.sep... | en | 0.57371 | # show the output image | 2.631193 | 3 |
formatic/walkers/class_injection_walker.py | welchbj/formatic | 2 | 6620947 | """Implementation of ClassInjectionWalker."""
from __future__ import annotations
from typing import (
Iterator,
List,
Optional,
Set)
from .abstract_injection_walker import (
AbstractInjectionWalker)
from .attribute_injection_walker import (
AttributeInjectionWalker)
from .doc_string_injection... | """Implementation of ClassInjectionWalker."""
from __future__ import annotations
from typing import (
Iterator,
List,
Optional,
Set)
from .abstract_injection_walker import (
AbstractInjectionWalker)
from .attribute_injection_walker import (
AttributeInjectionWalker)
from .doc_string_injection... | en | 0.795145 | Implementation of ClassInjectionWalker. An injection walker for recovering class source code and other data. Recover the class's __name__. Recover the class's __module__ name. Recover the class's __doc__. Walk the class's base classes via __bases__. Walk the class's attrs, funcs, and other fields via __dict__. # below ... | 2.644445 | 3 |
cvax/models/yolo/blocks.py | toru34/cvax | 0 | 6620948 | import jax.nn as nn
from nmax import Module
from cvax.modules import Conv2d, BatchNorm2d
class YOLOConvBlock(Module):
conv: Module
bn: Module
def __init__(self,
key,
kernel_shape: tuple[int, int, int, int],
stride: int = 1,
batch_norm: bool = True,
activation: bo... | import jax.nn as nn
from nmax import Module
from cvax.modules import Conv2d, BatchNorm2d
class YOLOConvBlock(Module):
conv: Module
bn: Module
def __init__(self,
key,
kernel_shape: tuple[int, int, int, int],
stride: int = 1,
batch_norm: bool = True,
activation: bo... | ru | 0.116921 | # TODO: add activation option | 2.349079 | 2 |
utils.py | Leroll/torch-models | 6 | 6620949 | from time import time
import torch
import random
import numpy as np
import os
from pypinyin import lazy_pinyin
import jieba
def time_cost(func):
def wrapper(*arg, **kargs):
t0 = time()
res = func(*arg, **kargs)
t1 = time()
print(f'[{func.__name__}] cost {t1 - t0:.2f}s')
ret... | from time import time
import torch
import random
import numpy as np
import os
from pypinyin import lazy_pinyin
import jieba
def time_cost(func):
def wrapper(*arg, **kargs):
t0 = time()
res = func(*arg, **kargs)
t1 = time()
print(f'[{func.__name__}] cost {t1 - t0:.2f}s')
ret... | zh | 0.936917 | 交换字典的 key-value, 得到 value-key 的新字典 需保证value无重复项 # k-v 反转字典 config类 让pytorch训练过程可复现,固定各种随机化的操作。 # seed # 禁止hash随机化 # https://pytorch.org/docs/stable/notes/randomness.html # cudnn那边,使用相同的算法,而不是经过benchmark后在几个中选取最快的。 # torch内部一些方法使用确定型的算法,具体list见函数文档 # torch.use_deterministic_algorithms(True) # 当上述cudnn使用同一算法时,有可能算法本身... | 2.522186 | 3 |
exo_changelog/loader.py | marfyl/django-changelog | 3 | 6620950 | from __future__ import unicode_literals
import os
import sys
from importlib import import_module
from django.apps import apps
from django.utils import six
from .graph import ChangeGraph
from .recorder import ChangeRecorder
from .exceptions import (
AmbiguityError, BadChangeError, InconsistentChangeHistory,
... | from __future__ import unicode_literals
import os
import sys
from importlib import import_module
from django.apps import apps
from django.utils import six
from .graph import ChangeGraph
from .recorder import ChangeRecorder
from .exceptions import (
AmbiguityError, BadChangeError, InconsistentChangeHistory,
... | en | 0.900939 | Loads changes files from disk, and their status from the database. Change files are expected to live in the "changelog" directory of an app. Their names are entirely unimportant from a code perspective, but will probably follow the 1234_name.py convention. On initialization, this class will scan those... | 2.237036 | 2 |