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 |
|---|---|---|---|---|---|---|---|---|---|---|
test/dialect/mssql/test_compiler.py | gujun4990/sqlalchemy | 1 | 1000 | # -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | # -*- encoding: utf-8
from sqlalchemy.testing import eq_, is_
from sqlalchemy import schema
from sqlalchemy.sql import table, column, quoted_name
from sqlalchemy.dialects import mssql
from sqlalchemy.dialects.mssql import mxodbc
from sqlalchemy.testing import fixtures, AssertsCompiledSQL
from sqlalchemy import sql
from... | en | 0.627861 | # -*- encoding: utf-8 #other].newval FROM [#other] " #other].sym)", #other].newval FROM [schema].sometable, " #other] WHERE [schema].sometable.sym = [#other].sym", # TODO: not supported yet. # def test_delete_from_hint(self): # t = table('sometable', column('somecolumn')) # t2 = table('othertable', column('someco... | 2.290347 | 2 |
sdk/python/pulumi_kubernetes/coordination/v1/_inputs.py | polivbr/pulumi-kubernetes | 277 | 1001 | <reponame>polivbr/pulumi-kubernetes
# coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... ... | # coding=utf-8
# *** WARNING: this file was generated by pulumigen. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
from ... import me... | en | 0.821102 | # coding=utf-8 # *** WARNING: this file was generated by pulumigen. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** LeaseSpec is a specification of a Lease. :param pulumi.Input[str] acquire_time: acquireTime is a time when the current lease was acquired. :param pulum... | 2.218299 | 2 |
Components/Align All Components.py | davidtahim/Glyphs-Scripts | 1 | 1002 | <reponame>davidtahim/Glyphs-Scripts<filename>Components/Align All Components.py
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # a... | All Components.py
#MenuTitle: Align All Components
# -*- coding: utf-8 -*-
__doc__="""
Fakes auto-alignment in glyphs that cannot be auto-aligned.
"""
import GlyphsApp
thisFont = Glyphs.font # frontmost font
thisFontMaster = thisFont.selectedFontMaster # active master
thisFontMasterID = thisFont.selectedFontMaster.id... | en | 0.720896 | #MenuTitle: Align All Components # -*- coding: utf-8 -*- Fakes auto-alignment in glyphs that cannot be auto-aligned. # frontmost font # active master # active master # active layers of selected glyphs # suppresses UI updates in Font View # begin undo grouping # end undo grouping # re-enables UI updates in Font View | 2.222466 | 2 |
SC101Lecture_code/SC101_week4/draw_basic.py | Jewel-Hong/SC-projects | 0 | 1003 | <gh_stars>0
#!/usr/bin/env python3
"""
Stanford CS106AP
TK Drawing Lecture Exercises
Courtesy of <NAME>
"""
import tkinter as tk
# provided function, this code is complete
def make_canvas(width, height):
"""
Creates and returns a drawing canvas
of the given int size, ready for drawing.
"""
top =... | #!/usr/bin/env python3
"""
Stanford CS106AP
TK Drawing Lecture Exercises
Courtesy of <NAME>
"""
import tkinter as tk
# provided function, this code is complete
def make_canvas(width, height):
"""
Creates and returns a drawing canvas
of the given int size, ready for drawing.
"""
top = tk.Tk()
... | en | 0.591082 | #!/usr/bin/env python3 Stanford CS106AP TK Drawing Lecture Exercises Courtesy of <NAME> # provided function, this code is complete Creates and returns a drawing canvas of the given int size, ready for drawing. # hack so (0, 0) works correctly #告訴電腦不要關掉視窗 | 4.216308 | 4 |
audio/audio_server.py | artigianitecnologici/marrtino_apps | 0 | 1004 | <reponame>artigianitecnologici/marrtino_apps<gh_stars>0
# Only PCM 16 bit wav 44100 Hz - Use audacity or sox to convert audio files.
# WAV generation
# Synth
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bip.wav synth 0.25 sine 800
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wa... | # Only PCM 16 bit wav 44100 Hz - Use audacity or sox to convert audio files.
# WAV generation
# Synth
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bip.wav synth 0.25 sine 800
# sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bop.wav synth 0.25 sine 400
# Voices
# pico2wave -l "... | en | 0.434947 | # Only PCM 16 bit wav 44100 Hz - Use audacity or sox to convert audio files. # WAV generation # Synth # sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bip.wav synth 0.25 sine 800 # sox -n --no-show-progress -G --channels 1 -r 44100 -b 16 -t wav bop.wav synth 0.25 sine 400 # Voices # pico2wave -l "it-IT... | 2.702163 | 3 |
torchvision/datasets/kinetics.py | sh1doy/vision | 0 | 1005 | from .video_utils import VideoClips
from .utils import list_dir
from .folder import make_dataset
from .vision import VisionDataset
class Kinetics400(VisionDataset):
"""
`Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_
dataset.
Kinetics-400 is an action recogn... | from .video_utils import VideoClips
from .utils import list_dir
from .folder import make_dataset
from .vision import VisionDataset
class Kinetics400(VisionDataset):
"""
`Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_
dataset.
Kinetics-400 is an action recogn... | en | 0.755225 | `Kinetics-400 <https://deepmind.com/research/open-source/open-source-datasets/kinetics/>`_ dataset. Kinetics-400 is an action recognition video dataset. This dataset consider every video as a collection of video clips of fixed size, specified by ``frames_per_clip``, where the step in frames between eac... | 2.997312 | 3 |
venv/lib/python2.7/site-packages/sphinx/builders/qthelp.py | CharleyFarley/ovvio | 0 | 1006 | <reponame>CharleyFarley/ovvio<gh_stars>0
# -*- coding: utf-8 -*-
"""
sphinx.builders.qthelp
~~~~~~~~~~~~~~~~~~~~~~
Build input files for the Qt collection generator.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
im... | # -*- coding: utf-8 -*-
"""
sphinx.builders.qthelp
~~~~~~~~~~~~~~~~~~~~~~
Build input files for the Qt collection generator.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
import re
import codecs
import posixpath
from os impo... | en | 0.47655 | # -*- coding: utf-8 -*- sphinx.builders.qthelp ~~~~~~~~~~~~~~~~~~~~~~ Build input files for the Qt collection generator. :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. # Qt Help Collection Project (.qhcp). # Is the input file for the help colle... | 1.534639 | 2 |
scripts/scrape_sciencedirect_urls.py | UWPRG/BETO2020 | 4 | 1007 | """
This code is used to scrape ScienceDirect of publication urls and write them to
a text file in the current directory for later use.
"""
import selenium
from selenium import webdriver
import numpy as np
import pandas as pd
import bs4
from bs4 import BeautifulSoup
import time
from sklearn.utils import shuffle
def s... | """
This code is used to scrape ScienceDirect of publication urls and write them to
a text file in the current directory for later use.
"""
import selenium
from selenium import webdriver
import numpy as np
import pandas as pd
import bs4
from bs4 import BeautifulSoup
import time
from sklearn.utils import shuffle
def s... | en | 0.859525 | This code is used to scrape ScienceDirect of publication urls and write them to a text file in the current directory for later use. This method finds all the publication result web elements on the webpage. Parameters ---------- driver (Selenium webdriver object) : Instance of the webdriver class e.g. ... | 3.517263 | 4 |
superset/typing.py | GodelTech/superset | 7 | 1008 | <filename>superset/typing.py<gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, V... | <filename>superset/typing.py<gh_stars>1-10
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, V... | en | 0.861476 | # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u... | 1.830433 | 2 |
log_system_information.py | ibaiGorordo/depthai | 476 | 1009 | #!/usr/bin/env python3
import json
import platform
def make_sys_report(anonymous=False, skipUsb=False, skipPackages=False):
def get_usb():
try:
import usb.core
except ImportError:
yield "NoLib"
return
speeds = ["Unknown", "Low", "Full", "High", "Super",... | #!/usr/bin/env python3
import json
import platform
def make_sys_report(anonymous=False, skipUsb=False, skipPackages=False):
def get_usb():
try:
import usb.core
except ImportError:
yield "NoLib"
return
speeds = ["Unknown", "Low", "Full", "High", "Super",... | en | 0.157268 | #!/usr/bin/env python3 #0{6}x}" | 2.375755 | 2 |
patch.py | silverhikari/romtools | 5 | 1010 | """
Utils for creating xdelta patches.
"""
import logging
from subprocess import check_output, CalledProcessError
from shutil import copyfile
from os import remove, path
class PatchChecksumError(Exception):
def __init__(self, message, errors):
super(PatchChecksumError, self).__init__(message)
class Patc... | """
Utils for creating xdelta patches.
"""
import logging
from subprocess import check_output, CalledProcessError
from shutil import copyfile
from os import remove, path
class PatchChecksumError(Exception):
def __init__(self, message, errors):
super(PatchChecksumError, self).__init__(message)
class Patc... | en | 0.818789 | Utils for creating xdelta patches. # TODO: Abstract out the need for "edited" by just copying the original # file. # Need to have this absolute path for xdelta3 to be found. # self.xdelta_path = 'xdelta3' | 2.712859 | 3 |
enigma.py | fewieden/Enigma-Machine | 1 | 1011 | from rotor import Rotor
import sys
import getopt
class Enigma:
def __init__(self, key, rotors):
self.key = list(key)
self.rotors = []
for i in range(0, len(rotors)):
self.rotors.append(Rotor(self.key[i], rotors[i]))
def encrypt(self, word):
cipher = ''
for ... | from rotor import Rotor
import sys
import getopt
class Enigma:
def __init__(self, key, rotors):
self.key = list(key)
self.rotors = []
for i in range(0, len(rotors)):
self.rotors.append(Rotor(self.key[i], rotors[i]))
def encrypt(self, word):
cipher = ''
for ... | none | 1 | 3.332155 | 3 | |
andersoncd/group.py | idc9/andersoncd | 0 | 1012 | <gh_stars>0
import time
import numpy as np
from scipy import sparse
from numba import njit
from numpy.linalg import norm
from scipy.sparse.linalg import svds
from andersoncd.lasso import dual_lasso
def primal_grp(R, w, alpha, grp_size):
return (0.5 * norm(R) ** 2 + alpha *
norm(w.reshape(-1, grp_siz... | import time
import numpy as np
from scipy import sparse
from numba import njit
from numpy.linalg import norm
from scipy.sparse.linalg import svds
from andersoncd.lasso import dual_lasso
def primal_grp(R, w, alpha, grp_size):
return (0.5 * norm(R) ** 2 + alpha *
norm(w.reshape(-1, grp_size), axis=1).... | en | 0.554324 | Block soft-thresholding of vector x at level u. Solve the GroupLasso with BCD/ISTA/FISTA, eventually with extrapolation. Groups are contiguous, of size grp_size. Objective: norm(y - Xw, ord=2)**2 / 2 + alpha * sum_g ||w_{[g]}||_2 TODO: filled docstring Parameters: algo: string 'bcd', ... | 2.50816 | 3 |
textattack/search_methods/greedy_word_swap_wir.py | dheerajrav/TextAttack | 0 | 1013 | """
Greedy Word Swap with Word Importance Ranking
===================================================
When WIR method is set to ``unk``, this is a reimplementation of the search
method from the paper: Is BERT Really Robust?
A Strong Baseline for Natural Language Attack on Text Classification and
Entailment by Jin et... | """
Greedy Word Swap with Word Importance Ranking
===================================================
When WIR method is set to ``unk``, this is a reimplementation of the search
method from the paper: Is BERT Really Robust?
A Strong Baseline for Natural Language Attack on Text Classification and
Entailment by Jin et... | en | 0.84834 | Greedy Word Swap with Word Importance Ranking =================================================== When WIR method is set to ``unk``, this is a reimplementation of the search method from the paper: Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailment by Jin et. al... | 3.480391 | 3 |
lemur/deployment/service.py | rajatsharma94/lemur | 1,656 | 1014 | from lemur import database
def rotate_certificate(endpoint, new_cert):
"""
Rotates a certificate on a given endpoint.
:param endpoint:
:param new_cert:
:return:
"""
# ensure that certificate is available for rotation
endpoint.source.plugin.update_endpoint(endpoint, new_cert)
endpo... | from lemur import database
def rotate_certificate(endpoint, new_cert):
"""
Rotates a certificate on a given endpoint.
:param endpoint:
:param new_cert:
:return:
"""
# ensure that certificate is available for rotation
endpoint.source.plugin.update_endpoint(endpoint, new_cert)
endpo... | en | 0.742726 | Rotates a certificate on a given endpoint. :param endpoint: :param new_cert: :return: # ensure that certificate is available for rotation | 2.659303 | 3 |
pype/celery.py | h2020-westlife-eu/VRE | 1 | 1015 | # coding: utf-8
# Copyright Luna Technology 2015
# <NAME> <<EMAIL>>
from __future__ import absolute_import
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings')
from django.conf import settings
from ce... | # coding: utf-8
# Copyright Luna Technology 2015
# <NAME> <<EMAIL>>
from __future__ import absolute_import
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'pype.settings')
from django.conf import settings
from ce... | en | 0.452112 | # coding: utf-8 # Copyright Luna Technology 2015 # <NAME> <<EMAIL>> # Set the default Django settings module for the 'celery' program | 1.950382 | 2 |
train/general_train_example/1_parse.py | ss433s/sosweety | 0 | 1016 | <reponame>ss433s/sosweety<gh_stars>0
import os, sys
import json
# 获取当前路径, 通过anchor文件获取项目root路径
this_file_path = os.path.split(os.path.realpath(__file__))[0]
this_path = this_file_path
root_path = this_file_path
while this_path:
if os.path.exists(os.path.join(this_path, 'sosweety_root_anchor.py')):
... | import os, sys
import json
# 获取当前路径, 通过anchor文件获取项目root路径
this_file_path = os.path.split(os.path.realpath(__file__))[0]
this_path = this_file_path
root_path = this_file_path
while this_path:
if os.path.exists(os.path.join(this_path, 'sosweety_root_anchor.py')):
root_path = this_path
break... | zh | 0.723552 | # 获取当前路径, 通过anchor文件获取项目root路径 # print(par_path) # 解析出parse result file # 打开语料文件 | 2.661856 | 3 |
ruleex/hypinv/model.py | rohancode/ruleex_modified | 18 | 1017 | from gtrain import Model
import numpy as np
import tensorflow as tf
class NetForHypinv(Model):
"""
Implementaion of the crutial function for the HypINV algorithm.
Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv
"""
def __init__(self, weights):
self... | from gtrain import Model
import numpy as np
import tensorflow as tf
class NetForHypinv(Model):
"""
Implementaion of the crutial function for the HypINV algorithm.
Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv
"""
def __init__(self, weights):
self... | en | 0.76152 | Implementaion of the crutial function for the HypINV algorithm. Warning: Do not use this class but implement its subclass, for example see FCNetForHypinv #(going to be filled in build_for_eval method) # tf variable for inversion (going to be filled in build method) # list of tf tensorf for each class of softmax cla... | 2.678129 | 3 |
py_tdlib/constructors/get_chat_member.py | Mr-TelegramBot/python-tdlib | 24 | 1018 | from ..factory import Method
class getChatMember(Method):
chat_id = None # type: "int53"
user_id = None # type: "int32"
| from ..factory import Method
class getChatMember(Method):
chat_id = None # type: "int53"
user_id = None # type: "int32"
| en | 0.680838 | # type: "int53" # type: "int32" | 1.783623 | 2 |
src/phrase_manager/phrase_manager.py | Franco7Scala/GeneratingNaturalLanguageAdversarialExamplesThroughParticleFiltering | 0 | 1019 | import numpy
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from src.support import support
class PhraseManager:
def __init__(self, configuration):
self.train_phrases, self.train_labels = self._read_train_phrases()
self.test_phrases, self.test_labels = se... | import numpy
from keras.preprocessing import sequence
from keras.preprocessing.text import Tokenizer
from src.support import support
class PhraseManager:
def __init__(self, configuration):
self.train_phrases, self.train_labels = self._read_train_phrases()
self.test_phrases, self.test_labels = se... | zh | 0.222189 | #$%^&*~`+-=<>()[]{}" | 2.799546 | 3 |
setup.py | fonar/paypalhttp_python | 0 | 1020 | from setuptools import setup
version = "1.0.0"
long_description = """
PayPalHttp is a generic http client designed to be used with code-generated projects.
"""
setup(
name="paypalhttp",
long_description=long_description,
version=version,
author="PayPal",
packages=["paypalhttp", "paypalhttp/testu... | from setuptools import setup
version = "1.0.0"
long_description = """
PayPalHttp is a generic http client designed to be used with code-generated projects.
"""
setup(
name="paypalhttp",
long_description=long_description,
version=version,
author="PayPal",
packages=["paypalhttp", "paypalhttp/testu... | en | 0.881423 | PayPalHttp is a generic http client designed to be used with code-generated projects. | 1.432238 | 1 |
ooobuild/csslo/xml/__init__.py | Amourspirit/ooo_uno_tmpl | 0 | 1021 | <reponame>Amourspirit/ooo_uno_tmpl<filename>ooobuild/csslo/xml/__init__.py
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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... | # coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http: // www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | en | 0.84533 | # coding: utf-8 # # Copyright 2022 :Barry-Thomas-Paul: Moss # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http: // www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab... | 0.985062 | 1 |
bluebottle/tasks/migrations/0012_merge.py | terrameijar/bluebottle | 10 | 1022 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-27 15:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0011_auto_20160919_1508'),
('tasks', '0011_auto_20160920_1019'),
]
operatio... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-09-27 15:35
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('tasks', '0011_auto_20160919_1508'),
('tasks', '0011_auto_20160920_1019'),
]
operatio... | en | 0.816639 | # -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-09-27 15:35 | 1.359037 | 1 |
bat_train/evaluate.py | bgotthold-usgs/batdetect | 59 | 1023 | import numpy as np
from sklearn.metrics import roc_curve, auc
def compute_error_auc(op_str, gt, pred, prob):
# classification error
pred_int = (pred > prob).astype(np.int)
class_acc = (pred_int == gt).mean() * 100.0
# ROC - area under curve
fpr, tpr, thresholds = roc_curve(gt, pred)
roc_auc ... | import numpy as np
from sklearn.metrics import roc_curve, auc
def compute_error_auc(op_str, gt, pred, prob):
# classification error
pred_int = (pred > prob).astype(np.int)
class_acc = (pred_int == gt).mean() * 100.0
# ROC - area under curve
fpr, tpr, thresholds = roc_curve(gt, pred)
roc_auc ... | en | 0.859889 | # classification error # ROC - area under curve #return class_acc, roc_auc # pascal'12 way # this filters out predictions and gt that are close to the end # this is a bit messy because of the shapes of gt_pos_o nms_pos, nms_prob, and gt_pos are lists of numpy arrays specifying detection position, detection probabil... | 2.289709 | 2 |
azure-mgmt/tests/test_mgmt_network.py | SUSE/azure-sdk-for-python | 2 | 1024 | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | # coding: utf-8
#-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#---------------------------------------------------------------------... | en | 0.374711 | # coding: utf-8 #------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-----------------------------------------------------------------------... | 2.002497 | 2 |
Networks/Threading/server.py | polbebe/PinkPanther | 0 | 1025 | import gym
import gym.spaces as spaces
import sys
import socket
from _thread import *
import os
import numpy as np
import pandas as pd
import math as m
import time
import random
class NetEnv(gym.Env):
def __init__(self):
# Robot State values that will be bounced with client
self.robot_state = None
self.p... | import gym
import gym.spaces as spaces
import sys
import socket
from _thread import *
import os
import numpy as np
import pandas as pd
import math as m
import time
import random
class NetEnv(gym.Env):
def __init__(self):
# Robot State values that will be bounced with client
self.robot_state = None
self.p... | en | 0.608003 | # Robot State values that will be bounced with client # Socket Conneciton # MAC find WiFi IP - ipconfig getifaddr en0 # Port to listen on (non-privileged ports are > 1023) # Set up Socket # Wait for client[s] to join socket # Construct MAIN SERVER object # WALK | 2.706968 | 3 |
backend/app/app/db/session.py | zhkuo24/full-stack-fastapi-demo | 7 | 1026 | <reponame>zhkuo24/full-stack-fastapi-demo<gh_stars>1-10
# -*- coding: utf-8 -*-
# @File : session.py
# @Author : zhkuo
# @Time : 2021/1/3 9:12 下午
# @Desc :
from sqlalchemy import create_engine
# from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from app.core.config import settin... | # -*- coding: utf-8 -*-
# @File : session.py
# @Author : zhkuo
# @Time : 2021/1/3 9:12 下午
# @Desc :
from sqlalchemy import create_engine
# from sqlalchemy.orm import scoped_session
from sqlalchemy.orm import sessionmaker
from app.core.config import settings
"""
参考:
https://www.osgeo.cn/sqlalchemy/orm/session_... | zh | 0.566068 | # -*- coding: utf-8 -*- # @File : session.py # @Author : zhkuo # @Time : 2021/1/3 9:12 下午 # @Desc : # from sqlalchemy.orm import scoped_session 参考: https://www.osgeo.cn/sqlalchemy/orm/session_basics.html https://landybird.github.io/python/2020/03/02/fastapi%E4%B8%8Easgi(5)/ 处理session的不同方法 https://github.com/tiang... | 2.236844 | 2 |
src/tkdialog/dialog.py | KosukeMizuno/tkdialog | 0 | 1027 | <reponame>KosukeMizuno/tkdialog
from pathlib import Path
import pickle
import tkinter as tk
import tkinter.filedialog
def open_dialog(**opt):
"""Parameters
----------
Options will be passed to `tkinter.filedialog.askopenfilename`.
See also tkinter's document.
Followings are example of frequently u... | from pathlib import Path
import pickle
import tkinter as tk
import tkinter.filedialog
def open_dialog(**opt):
"""Parameters
----------
Options will be passed to `tkinter.filedialog.askopenfilename`.
See also tkinter's document.
Followings are example of frequently used options.
- filetypes=[(l... | en | 0.471591 | Parameters ---------- Options will be passed to `tkinter.filedialog.askopenfilename`. See also tkinter's document. Followings are example of frequently used options. - filetypes=[(label, ext), ...] - label: str - ext: str, semicolon separated extentions - initialdir: str, default... | 3.816662 | 4 |
cinder/tests/unit/fake_group_snapshot.py | lightsey/cinder | 571 | 1028 | <filename>cinder/tests/unit/fake_group_snapshot.py
# Copyright 2016 EMC 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/LICE... | <filename>cinder/tests/unit/fake_group_snapshot.py
# Copyright 2016 EMC 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/LICE... | en | 0.849286 | # Copyright 2016 EMC 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... | 1.984656 | 2 |
src/tree_visualizer.py | szymanskir/msi | 0 | 1029 | <gh_stars>0
import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def display_resolution_tree(resolution_tree: nx.classes.DiGraph):
_draw_resolution_tree_(resolution_tree)
plt.show()
def _draw_resolution_tree_(tree: nx.classes.DiGraph, enable_edge_label... | import matplotlib.pyplot as plt
import networkx as nx
from networkx.drawing.nx_agraph import graphviz_layout
def display_resolution_tree(resolution_tree: nx.classes.DiGraph):
_draw_resolution_tree_(resolution_tree)
plt.show()
def _draw_resolution_tree_(tree: nx.classes.DiGraph, enable_edge_labels: bool = Tr... | ceb | 0.193587 | # graph # nodes labels # edge labels | 2.779868 | 3 |
setup.py | SilicalNZ/canvas | 7 | 1030 | <filename>setup.py
import setuptools
setuptools.setup(
name = 'sili-canvas',
version = '0.0.1',
license = 'MIT',
url = 'https://github.com/SilicalNZ/canvas',
description = 'A series of easy to use classes to perform complex 2D array transformations',
long_description = '',
author = 'Silica... | <filename>setup.py
import setuptools
setuptools.setup(
name = 'sili-canvas',
version = '0.0.1',
license = 'MIT',
url = 'https://github.com/SilicalNZ/canvas',
description = 'A series of easy to use classes to perform complex 2D array transformations',
long_description = '',
author = 'Silica... | none | 1 | 1.09542 | 1 | |
tests/viz_tests.py | theoretical-olive/incubator-superset | 2 | 1031 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | en | 0.793424 | # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u... | 1.613453 | 2 |
chord_sim/modules/taskqueue.py | ryogrid/FunnelKVS | 8 | 1032 | # coding:utf-8
from typing import Dict, List, Optional, cast, TYPE_CHECKING
from .chord_util import ChordUtil, InternalControlFlowException, NodeIsDownedExceptiopn
if TYPE_CHECKING:
from .chord_node import ChordNode
class TaskQueue:
JOIN_PARTIAL = "join_partial"
def __init__(self, existing_node : 'Chor... | # coding:utf-8
from typing import Dict, List, Optional, cast, TYPE_CHECKING
from .chord_util import ChordUtil, InternalControlFlowException, NodeIsDownedExceptiopn
if TYPE_CHECKING:
from .chord_node import ChordNode
class TaskQueue:
JOIN_PARTIAL = "join_partial"
def __init__(self, existing_node : 'Chor... | ja | 0.433391 | # coding:utf-8 # キュー内の最初のタスクを実行する # 処理が失敗した場合は先頭に戻す # try: #self.existing_node.stabilizer.partial_join_op() # ret.err_code == ErrorCode.InternalControlFlowException_CODE # 実行に失敗したため再実行すべく先頭に戻す # except (InternalControlFlowException, NodeIsDownedExceptiopn): # # 実行に失敗したため再実行すべく先頭に戻す # self.tqueue.insert(0, task_... | 2.503346 | 3 |
surname_rnn/surname/containers.py | sudarshan85/nlpbook | 0 | 1033 | #!/usr/bin/env python
import pandas as pd
from pathlib import Path
from torch.utils.data import DataLoader
class ModelContainer(object):
def __init__(self, model, optimizer, loss_fn, scheduler=None):
self.model = model
self.optimizer = optimizer
self.loss_fn = loss_fn
self.scheduler = scheduler
cl... | #!/usr/bin/env python
import pandas as pd
from pathlib import Path
from torch.utils.data import DataLoader
class ModelContainer(object):
def __init__(self, model, optimizer, loss_fn, scheduler=None):
self.model = model
self.optimizer = optimizer
self.loss_fn = loss_fn
self.scheduler = scheduler
cl... | ru | 0.26433 | #!/usr/bin/env python | 2.512421 | 3 |
AudioLib/__init__.py | yNeshy/voice-change | 11 | 1034 | <reponame>yNeshy/voice-change
from AudioLib.AudioEffect import AudioEffect
| from AudioLib.AudioEffect import AudioEffect | none | 1 | 1.095718 | 1 | |
programs/buck_logging.py | lakshmi2005/buck | 1 | 1035 | #!/usr/bin/env python
from __future__ import print_function
import logging
import os
def setup_logging():
# Set log level of the messages to show.
level_name = os.environ.get('BUCK_WRAPPER_LOG_LEVEL', 'INFO')
level_name_to_level = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
... | #!/usr/bin/env python
from __future__ import print_function
import logging
import os
def setup_logging():
# Set log level of the messages to show.
level_name = os.environ.get('BUCK_WRAPPER_LOG_LEVEL', 'INFO')
level_name_to_level = {
'CRITICAL': logging.CRITICAL,
'ERROR': logging.ERROR,
... | en | 0.571718 | #!/usr/bin/env python # Set log level of the messages to show. | 2.48726 | 2 |
CONTENT/DS-n-Algos/ALGO/__PYTHON/celeb.py | Web-Dev-Collaborative/DS-ALGO-OFFICIAL | 11 | 1036 | <reponame>Web-Dev-Collaborative/DS-ALGO-OFFICIAL<gh_stars>10-100
def orangesRotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
... | def orangesRotting(elemnts):
if not elemnts or len(elemnts) == 0:
return 0
n = len(elemnts)
m = len(elemnts[0])
rotten = []
for i in range(n):
for j in range(m):
if elemnts[i][j] == 2:
rotten.append((i, j))
mins = 0
def dfs(rotten):
... | none | 1 | 3.190263 | 3 | |
official/cv/c3d/src/c3d_model.py | leelige/mindspore | 77 | 1037 | <gh_stars>10-100
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | # Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | en | 0.773489 | # Copyright 2021 Huawei Technologies Co., Ltd # # 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... | 2.194841 | 2 |
blmath/geometry/apex.py | metabolize/blmath | 6 | 1038 | <filename>blmath/geometry/apex.py
import numpy as np
from blmath.numerics import vx
def apex(points, axis):
'''
Find the most extreme point in the direction of the axis provided.
axis: A vector, which is an 3x1 np.array.
'''
coords_on_axis = points.dot(axis)
return points[np.argmax(coords_on_... | <filename>blmath/geometry/apex.py
import numpy as np
from blmath.numerics import vx
def apex(points, axis):
'''
Find the most extreme point in the direction of the axis provided.
axis: A vector, which is an 3x1 np.array.
'''
coords_on_axis = points.dot(axis)
return points[np.argmax(coords_on_... | en | 0.844847 | Find the most extreme point in the direction of the axis provided. axis: A vector, which is an 3x1 np.array. Find the list of vertices that preceed inflection points in a curve. The curve is differentiated with respect to the coordinate system defined by axis and span. axis: A vector representing the vert... | 3.336087 | 3 |
examples/client/main.py | TheFarGG/Discode | 3 | 1039 | <filename>examples/client/main.py<gh_stars>1-10
import os
import discode
TOKEN = os.environ.get("TOKEN")
# The token from the developer portal.
client = discode.Client(token=TOKEN, intents=discode.Intents.default())
@client.on_event("ready")
async def on_ready():
print(client.user, "is ready!")
# The ready l... | <filename>examples/client/main.py<gh_stars>1-10
import os
import discode
TOKEN = os.environ.get("TOKEN")
# The token from the developer portal.
client = discode.Client(token=TOKEN, intents=discode.Intents.default())
@client.on_event("ready")
async def on_ready():
print(client.user, "is ready!")
# The ready l... | en | 0.878153 | # The token from the developer portal. # The ready listener gets fired when the bot/client is completely ready for use. # The message_create listener is fired whenever a message is sent to any channel that the bot has access to. | 2.883483 | 3 |
timm/models/layers/__init__.py | kkahatapitiya/pytorch-image-models | 0 | 1040 | <reponame>kkahatapitiya/pytorch-image-models<filename>timm/models/layers/__init__.py
from .activations import *
from .adaptive_avgmax_pool import \
adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
from .blur_pool import BlurPool2d
from .classifier import ClassifierHead, cre... | from .activations import *
from .adaptive_avgmax_pool import \
adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d
from .blur_pool import BlurPool2d
from .classifier import ClassifierHead, create_classifier
from .cond_conv2d import CondConv2d, get_condconv_initializer
from .co... | none | 1 | 1.188306 | 1 | |
riccipy/metrics/bondi_2.py | cjayross/riccipy | 4 | 1041 | """
Name: Bondi
References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964)
Coordinates: Spherical
Symmetry: Spherical
Notes: Outgoing Coordinates
"""
from sympy import Function, diag, sin, symbols
coords = symbols("r v theta phi", real=True)
variables = ()
functions = symbols("C M", cls=Function)
r, v, th, ph = co... | """
Name: Bondi
References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964)
Coordinates: Spherical
Symmetry: Spherical
Notes: Outgoing Coordinates
"""
from sympy import Function, diag, sin, symbols
coords = symbols("r v theta phi", real=True)
variables = ()
functions = symbols("C M", cls=Function)
r, v, th, ph = co... | en | 0.444131 | Name: Bondi References: Bondi, Proc. Roy. Soc. Lond. A, v282, p303, (1964) Coordinates: Spherical Symmetry: Spherical Notes: Outgoing Coordinates | 2.56227 | 3 |
cfgov/ask_cfpb/tests/test_views.py | atuggle/cfgov-refresh | 0 | 1042 | from __future__ import unicode_literals
import json
from django.apps import apps
from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import Http404, HttpRequest, QueryDict
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.wagtailcore.models i... | from __future__ import unicode_literals
import json
from django.apps import apps
from django.core.urlresolvers import NoReverseMatch, reverse
from django.http import Http404, HttpRequest, QueryDict
from django.test import TestCase, override_settings
from django.utils import timezone
from wagtail.wagtailcore.models i... | none | 1 | 1.835064 | 2 | |
setup.py | bcongdon/instapaper-to-sqlite | 1 | 1043 | import os
from setuptools import setup
VERSION = "0.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="instapaper-to-sqlite",
description="Save data from In... | import os
from setuptools import setup
VERSION = "0.2"
def get_long_description():
with open(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "README.md"),
encoding="utf8",
) as fp:
return fp.read()
setup(
name="instapaper-to-sqlite",
description="Save data from In... | en | 0.372843 | [console_scripts] instapaper-to-sqlite=instapaper_to_sqlite.cli:cli #egg=pyinstapaper", | 1.815798 | 2 |
pybm/commands/compare.py | nicholasjng/pybm | 12 | 1044 | from typing import List
from pybm import PybmConfig
from pybm.command import CLICommand
from pybm.config import get_reporter_class
from pybm.exceptions import PybmError
from pybm.reporters import BaseReporter
from pybm.status_codes import ERROR, SUCCESS
from pybm.util.path import get_subdirs
class CompareCommand(CLI... | from typing import List
from pybm import PybmConfig
from pybm.command import CLICommand
from pybm.config import get_reporter_class
from pybm.exceptions import PybmError
from pybm.reporters import BaseReporter
from pybm.status_codes import ERROR, SUCCESS
from pybm.util.path import get_subdirs
class CompareCommand(CLI... | en | 0.611329 | Report benchmark results from specified sources. # add builder-specific options into the group # TODO: Parse run to fit schema # TODO: Make this dynamic to support other run identifiers | 2.284367 | 2 |
dddm/recoil_rates/halo.py | JoranAngevaare/dddm | 0 | 1045 | """
For a given detector get a WIMPrate for a given detector (not taking into
account any detector effects
"""
import numericalunits as nu
import wimprates as wr
import dddm
export, __all__ = dddm.exporter()
@export
class SHM:
"""
class used to pass a halo model to the rate computation
must cont... | """
For a given detector get a WIMPrate for a given detector (not taking into
account any detector effects
"""
import numericalunits as nu
import wimprates as wr
import dddm
export, __all__ = dddm.exporter()
@export
class SHM:
"""
class used to pass a halo model to the rate computation
must cont... | en | 0.77652 | For a given detector get a WIMPrate for a given detector (not taking into account any detector effects class used to pass a halo model to the rate computation must contain: :param v_esc -- escape velocity (multiplied by units) :param rho_dm -- density in mass/volume of dark matter at the Earth (... | 3.039083 | 3 |
picket/rvae/train_eval_models.py | rekords-uw/Picket | 10 | 1046 | <filename>picket/rvae/train_eval_models.py<gh_stars>1-10
#!/usr/bin/env python3
import torch
from torch import optim
import torch.nn.functional as F
import argparse
from sklearn.metrics import mean_squared_error
import numpy as np
import json
from . import utils
from .model_utils import get_pi_exact_vec, rnn_vae_for... | <filename>picket/rvae/train_eval_models.py<gh_stars>1-10
#!/usr/bin/env python3
import torch
from torch import optim
import torch.nn.functional as F
import argparse
from sklearn.metrics import mean_squared_error
import numpy as np
import json
from . import utils
from .model_utils import get_pi_exact_vec, rnn_vae_for... | en | 0.607189 | #!/usr/bin/env python3 ## first foward-pass # get pi, saves to q_params (with no_grad) # NOTE: rolls out iterations through time and bprops # if args.cuda_on: # model.cpu() # get pi # SEQ-VAE #with torch.no_grad(): #Getting scores and clean component if neededin_aux_samples # VAE models only (no w's or pi's) # gene... | 1.990102 | 2 |
setup.py | nopipifish/bert4keras | 1 | 1047 | <gh_stars>1-10
#! -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='bert4keras',
version='0.8.4',
description='an elegant bert4keras',
long_description='bert4keras: https://github.com/bojone/bert4keras',
license='Apache License 2.0',
url='https://github.com/bojone/... | #! -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='bert4keras',
version='0.8.4',
description='an elegant bert4keras',
long_description='bert4keras: https://github.com/bojone/bert4keras',
license='Apache License 2.0',
url='https://github.com/bojone/bert4keras',
... | en | 0.4885 | #! -*- coding: utf-8 -*- | 1.18325 | 1 |
sztuczna_inteligencja/3-lab/backtrackingSolve.py | Magikis/Uniwersity | 12 | 1048 | <reponame>Magikis/Uniwersity
# import cProfile
# import pstats
# import io
from picture import *
# pr = cProfile.Profile()
# pr.enable()
def out(p):
for i in range(2):
print([len(x) for x in p.perms[i]])
if __name__ == '__main__':
p = Picture()
p.genPerms()
p.detuctAll()
p.backtrackLoop... | # import cProfile
# import pstats
# import io
from picture import *
# pr = cProfile.Profile()
# pr.enable()
def out(p):
for i in range(2):
print([len(x) for x in p.perms[i]])
if __name__ == '__main__':
p = Picture()
p.genPerms()
p.detuctAll()
p.backtrackLoop()
p.saveOtput()
# pr... | en | 0.15282 | # import cProfile # import pstats # import io # pr = cProfile.Profile() # pr.enable() # pr.disable() # s = io.StringIO() # sortby = 'cumulative' # ps = pstats.Stats(pr, stream=s).sort_stats(sortby) # ps.print_stats() # print(s.getvalue()) | 2.426964 | 2 |
benchmark/generate_examples_strprose.py | HALOCORE/SynGuar | 1 | 1049 | # imports
import os
import json
import subprocess
abs_join = lambda p1, p2 : os.path.abspath(os.path.join(p1, p2))
# constants
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
SEED_RELPATH = "./strprose/example_files/_seeds.json"
SEED_FULLPATH = abs_join(SCRIPT_DIR, SEED_RELPATH)
SEED_INFO = None
with open(SEE... | # imports
import os
import json
import subprocess
abs_join = lambda p1, p2 : os.path.abspath(os.path.join(p1, p2))
# constants
SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
SEED_RELPATH = "./strprose/example_files/_seeds.json"
SEED_FULLPATH = abs_join(SCRIPT_DIR, SEED_RELPATH)
SEED_INFO = None
with open(SEE... | en | 0.626271 | # imports # constants # methods | 2.052783 | 2 |
mmtbx/regression/tls/tst_u_tls_vs_u_ens_03.py | rimmartin/cctbx_project | 0 | 1050 | from __future__ import division
from mmtbx.tls import tools
import math
import time
pdb_str_1 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C
"""... | from __future__ import division
from mmtbx.tls import tools
import math
import time
pdb_str_1 = """
CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1
ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C
ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C
"""... | de | 0.063873 | CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1 ATOM 1 CA THR A 6 0.000 0.000 0.000 1.00 0.00 C ATOM 1 CA THR B 6 3.000 0.000 0.000 1.00 0.00 C CRYST1 10.000 10.000 10.000 90.00 90.00 90.00 P1 ATOM 1 CA THR A 6 0.000 0.000... | 2.206007 | 2 |
elliesite/context_processors.py | davidkartuzinski/ellieplatformsite | 1 | 1051 | import sys
from django.urls import resolve
def global_vars(request):
return {
'GLOBAL_TWITTER_ACCOUNT': '@open_apprentice',
'ORGANIZATION_NAME': 'Open Apprentice Foundation',
'ORGANIZATION_WEBSITE': 'https://openapprentice.org',
'ORGANIZATION_LOGO': '/static/img/ellie/open-apprenti... | import sys
from django.urls import resolve
def global_vars(request):
return {
'GLOBAL_TWITTER_ACCOUNT': '@open_apprentice',
'ORGANIZATION_NAME': 'Open Apprentice Foundation',
'ORGANIZATION_WEBSITE': 'https://openapprentice.org',
'ORGANIZATION_LOGO': '/static/img/ellie/open-apprenti... | en | 0.626559 | # relative URL with pre /, # relative URL with pre / | 1.916213 | 2 |
tools/train_net_step.py | va1shn9v/Detectron.pytorch | 0 | 1052 | """ Training script for steps_with_decay policy"""
import argparse
import os
import sys
import pickle
import resource
import traceback
import logging
from collections import defaultdict
import numpy as np
import yaml
import torch
from torch.autograd import Variable
import torch.nn as nn
import cv2
cv2.setNumThreads(0... | """ Training script for steps_with_decay policy"""
import argparse
import os
import sys
import pickle
import resource
import traceback
import logging
from collections import defaultdict
import numpy as np
import yaml
import torch
from torch.autograd import Variable
import torch.nn as nn
import cv2
cv2.setNumThreads(0... | en | 0.641127 | Training script for steps_with_decay policy # pytorch issue 1355: possible deadlock in dataloader # pylint: disable=unused-import # Set up logging and load config options # RuntimeError: received 0 items of ancdata. Issue: pytorch/pytorch#973 Parse input arguments # Optimization # These options has the highest prioity ... | 2.034208 | 2 |
Lib/site-packages/astroid/brain/brain_numpy_core_multiarray.py | punithmadaiahkumar/try-django | 4 | 1053 | # Copyright (c) 2019-2020 hippo91 <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
"""Astr... | # Copyright (c) 2019-2020 hippo91 <<EMAIL>>
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Copyright (c) 2021 <NAME> <<EMAIL>>
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
"""Astr... | en | 0.430921 | # Copyright (c) 2019-2020 hippo91 <<EMAIL>> # Copyright (c) 2020 <NAME> <<EMAIL>> # Copyright (c) 2021 <NAME> <<EMAIL>> # Copyright (c) 2021 <NAME> <<EMAIL>> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/main/LICENSE Astroid ho... | 2.037677 | 2 |
tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py | bernardocuteri/wasp | 19 | 1054 | <filename>tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py
input = """
2 18 3 0 3 19 20 21
1 1 1 0 18
2 23 3 0 3 19 24 25
1 1 2 1 21 23
3 5 21 19 20 24 25 0 0
6 0 5 5 21 19 20 24 25 1 1 1 1 1
0
21 a
19 b
20 c
24 d
25 e
28 f
0
B+
0
B-
1
0
1
"""
output = """
COST 1@1
"""
| <filename>tests/asp/weakConstraints/testcase13.bug.weakconstraints.gringo.test.py
input = """
2 18 3 0 3 19 20 21
1 1 1 0 18
2 23 3 0 3 19 24 25
1 1 2 1 21 23
3 5 21 19 20 24 25 0 0
6 0 5 5 21 19 20 24 25 1 1 1 1 1
0
21 a
19 b
20 c
24 d
25 e
28 f
0
B+
0
B-
1
0
1
"""
output = """
COST 1@1
"""
| en | 0.131559 | 2 18 3 0 3 19 20 21 1 1 1 0 18 2 23 3 0 3 19 24 25 1 1 2 1 21 23 3 5 21 19 20 24 25 0 0 6 0 5 5 21 19 20 24 25 1 1 1 1 1 0 21 a 19 b 20 c 24 d 25 e 28 f 0 B+ 0 B- 1 0 1 COST 1@1 | 1.482631 | 1 |
whoPay.py | susurigirl/susuri | 0 | 1055 | <reponame>susurigirl/susuri
import random
names_string = input("내기를 할 친구들의 이름을 적습니다. 콤마(,)로 분리해서 적습니다.\n")
names = names_string.split(",")
print(names)
n = random.randint(0, len(names))
print(f"오늘 커피는 {names[n]}가 쏩니다!")
| import random
names_string = input("내기를 할 친구들의 이름을 적습니다. 콤마(,)로 분리해서 적습니다.\n")
names = names_string.split(",")
print(names)
n = random.randint(0, len(names))
print(f"오늘 커피는 {names[n]}가 쏩니다!") | none | 1 | 3.271936 | 3 | |
jp.atcoder/abc056/arc070_b/26725094.py | kagemeka/atcoder-submissions | 1 | 1056 | import sys
import typing
import numpy as np
def solve(a: np.ndarray, k: int) -> typing.NoReturn:
n = len(a)
def compute_dp(a: np.ndarray) -> np.ndarray:
dp = np.zeros((n + 1, k), np.bool8)
dp[0, 0] = True
for i in range(n):
dp[i + 1] = dp[i].copy()
... | import sys
import typing
import numpy as np
def solve(a: np.ndarray, k: int) -> typing.NoReturn:
n = len(a)
def compute_dp(a: np.ndarray) -> np.ndarray:
dp = np.zeros((n + 1, k), np.bool8)
dp[0, 0] = True
for i in range(n):
dp[i + 1] = dp[i].copy()
... | none | 1 | 2.560931 | 3 | |
MicroPython_BUILD/components/micropython/esp32/modules_examples/mqtt_example.py | FlorianPoot/MicroPython_ESP32_psRAM_LoBo | 838 | 1057 | import network
def conncb(task):
print("[{}] Connected".format(task))
def disconncb(task):
print("[{}] Disconnected".format(task))
def subscb(task):
print("[{}] Subscribed".format(task))
def pubcb(pub):
print("[{}] Published: {}".format(pub[0], pub[1]))
def datacb(msg):
print("[{}] Data arrived... | import network
def conncb(task):
print("[{}] Connected".format(task))
def disconncb(task):
print("[{}] Disconnected".format(task))
def subscb(task):
print("[{}] Subscribed".format(task))
def pubcb(pub):
print("[{}] Published: {}".format(pub[0], pub[1]))
def datacb(msg):
print("[{}] Data arrived... | en | 0.572812 | # secure connection requires more memory and may not work # mqtts = network.mqtt("eclipse", "mqtts//iot.eclipse.org", cleansession=True, connected_cb=conncb, disconnected_cb=disconncb, subscribed_cb=subscb, published_cb=pubcb, data_cb=datacb) # wsmqtt = network.mqtt("eclipse", "ws://iot.eclipse.org:80/ws", cleansession... | 2.630414 | 3 |
mlb/game/migrations/0009_game_game_type.py | atadams/mlb | 0 | 1058 | <filename>mlb/game/migrations/0009_game_game_type.py
# Generated by Django 2.2.8 on 2019-12-14 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0008_auto_20191214_1019'),
]
operations = [
migrations.AddField(
mo... | <filename>mlb/game/migrations/0009_game_game_type.py
# Generated by Django 2.2.8 on 2019-12-14 19:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0008_auto_20191214_1019'),
]
operations = [
migrations.AddField(
mo... | en | 0.819783 | # Generated by Django 2.2.8 on 2019-12-14 19:07 | 1.924083 | 2 |
backend/main/chapters/c06_lists.py | Vman45/futurecoder | 0 | 1059 | # flake8: NOQA E501
import ast
import random
from textwrap import dedent
from typing import List
from main.exercises import generate_list, generate_string
from main.text import ExerciseStep, MessageStep, Page, Step, VerbatimStep, search_ast
from main.utils import returns_stdout
class IntroducingLists(Page):
clas... | # flake8: NOQA E501
import ast
import random
from textwrap import dedent
from typing import List
from main.exercises import generate_list, generate_string
from main.text import ExerciseStep, MessageStep, Page, Step, VerbatimStep, search_ast
from main.utils import returns_stdout
class IntroducingLists(Page):
clas... | en | 0.890156 | # flake8: NOQA E501 It's time to learn about a powerful new type of value called lists. Here's an example: __program_indented__ A list is a *sequence* (an ordered collection/container) of any number of values. The values are often referred to as *elements*. They can be anything: numbers, strings, booleans, even lists!... | 4.351239 | 4 |
redisSeed.py | bigmacd/miscPython | 0 | 1060 | <filename>redisSeed.py
import time
import redis
import json
import argparse
""" Follows the StackExchange best practice for creating a work queue.
Basically push a task and publish a message that a task is there."""
def PushTask(client, queue, task, topic):
client.lpush(queue, task)
client.publish(to... | <filename>redisSeed.py
import time
import redis
import json
import argparse
""" Follows the StackExchange best practice for creating a work queue.
Basically push a task and publish a message that a task is there."""
def PushTask(client, queue, task, topic):
client.lpush(queue, task)
client.publish(to... | en | 0.893846 | Follows the StackExchange best practice for creating a work queue. Basically push a task and publish a message that a task is there. | 3.079389 | 3 |
app/celery.py | TIHLDE/Lepton | 7 | 1061 | <reponame>TIHLDE/Lepton<filename>app/celery.py
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
app = Celery("app")
# Using a string here me... | from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
# set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "app.settings")
app = Celery("app")
# Using a string here means the worker doesn't have to serialize
# the ... | en | 0.726035 | # set the default Django settings module for the 'celery' program. # Using a string here means the worker doesn't have to serialize # the configuration object to child processes. # - namespace='CELERY' means all celery-related configuration keys # should have a `CELERY_` prefix. # Load task modules from all registere... | 2.127441 | 2 |
src/garage/core/__init__.py | researchai/unsupervised_meta_rl | 1 | 1062 | <reponame>researchai/unsupervised_meta_rl<filename>src/garage/core/__init__.py
from garage.core.serializable import Serializable
from garage.core.parameterized import Parameterized # noqa: I100
__all__ = ['Serializable', 'Parameterized']
| from garage.core.serializable import Serializable
from garage.core.parameterized import Parameterized # noqa: I100
__all__ = ['Serializable', 'Parameterized'] | it | 0.251484 | # noqa: I100 | 1.181267 | 1 |
formidable/forms/boundfield.py | jayvdb/django-formidable | 0 | 1063 | <reponame>jayvdb/django-formidable
from django.forms import forms
class FormatBoundField(forms.BoundField):
"""
The format field skips the rendering with the label attribute
in the form level (i.e => form.as_p() doesn't have to generate any label
for format field).
This boundfield has this main go... | from django.forms import forms
class FormatBoundField(forms.BoundField):
"""
The format field skips the rendering with the label attribute
in the form level (i.e => form.as_p() doesn't have to generate any label
for format field).
This boundfield has this main goal.
"""
def __init__(self,... | en | 0.846475 | The format field skips the rendering with the label attribute in the form level (i.e => form.as_p() doesn't have to generate any label for format field). This boundfield has this main goal. # This attribute is used to generate (or not) the final label # with html tags. We force the label to None to avoid th... | 3.10656 | 3 |
algorithm_training/abc87.py | hirotosuzuki/algorithm_training | 0 | 1064 | <filename>algorithm_training/abc87.py
class TaskA:
def run(self):
V, A, B, C = map(int, input().split())
pass
class TaskB:
def run(self):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for a in range(A+1):
... | <filename>algorithm_training/abc87.py
class TaskA:
def run(self):
V, A, B, C = map(int, input().split())
pass
class TaskB:
def run(self):
A = int(input())
B = int(input())
C = int(input())
X = int(input())
counter = 0
for a in range(A+1):
... | none | 1 | 3.518348 | 4 | |
serveur/serveurDroit.py | PL4typus/SysNetProject17 | 0 | 1065 | <gh_stars>0
#!/usr/bin/python
import socket,sys,os
TCP_IP = '127.0.0.1'
TCP_PORT = 6262
BUFFER_SIZE = 1024
s= socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((TCP_IP,TCP_PORT))
s.listen(5)
conn, addr = s.accept()
print('Connection entrante :', addr)
data = conn.recv(BUFFER_SIZE)
if data == "m" :
os.... | #!/usr/bin/python
import socket,sys,os
TCP_IP = '127.0.0.1'
TCP_PORT = 6262
BUFFER_SIZE = 1024
s= socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind((TCP_IP,TCP_PORT))
s.listen(5)
conn, addr = s.accept()
print('Connection entrante :', addr)
data = conn.recv(BUFFER_SIZE)
if data == "m" :
os.popen("chmod... | ru | 0.258958 | #!/usr/bin/python | 2.827497 | 3 |
BE/common/helpers.py | kosior/ngLearn-1 | 1 | 1066 | <gh_stars>1-10
from rest_framework_jwt.utils import jwt_decode_handler
from users.models import User
from users.serializers import UserSerializer
def jwt_response_payload_handler(token, user=None, request=None):
return {
'token': token,
'user': UserSerializer(user, context={'request': request}).d... | from rest_framework_jwt.utils import jwt_decode_handler
from users.models import User
from users.serializers import UserSerializer
def jwt_response_payload_handler(token, user=None, request=None):
return {
'token': token,
'user': UserSerializer(user, context={'request': request}).data
}
def... | none | 1 | 2.370829 | 2 | |
src/finn/util/basic.py | quetric/finn-base-1 | 0 | 1067 | <reponame>quetric/finn-base-1
# Copyright (c) 2020 Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# ... | # Copyright (c) 2020 Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the f... | en | 0.787186 | # Copyright (c) 2020 Xilinx, Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list of conditions and the f... | 1.055288 | 1 |
mainmenu.py | jeffrypaul37/Hospital-Management-System | 0 | 1068 | <reponame>jeffrypaul37/Hospital-Management-System
from tkinter import *
from tkcalendar import Calendar
from datetime import datetime
from datetime import date
import tkinter as tk
from tkinter import ttk
from tkinter.messagebox import askyesno
import re
import sqlite3
import tkinter.messagebox
import pan... | from tkinter import *
from tkcalendar import Calendar
from datetime import datetime
from datetime import date
import tkinter as tk
from tkinter import ttk
from tkinter.messagebox import askyesno
import re
import sqlite3
import tkinter.messagebox
import pandas as pd
import pandas as pd
import datetime
... | es | 0.202099 | #root.geometry("1200x720+0+0") | 3.159347 | 3 |
chia_tea/discord/commands/test_wallets.py | Tea-n-Tech/chia-tea | 6 | 1069 | <gh_stars>1-10
import os
import tempfile
import unittest
from datetime import datetime
from google.protobuf.json_format import ParseDict
from ...monitoring.MonitoringDatabase import MonitoringDatabase
from ...protobuf.generated.computer_info_pb2 import ADD, UpdateEvent
from ...protobuf.generated.monitoring_service_pb... | import os
import tempfile
import unittest
from datetime import datetime
from google.protobuf.json_format import ParseDict
from ...monitoring.MonitoringDatabase import MonitoringDatabase
from ...protobuf.generated.computer_info_pb2 import ADD, UpdateEvent
from ...protobuf.generated.monitoring_service_pb2 import DataUp... | en | 0.319929 | # no failure # display online harvester | 2.202382 | 2 |
render/PC_Normalisation.py | sun-pyo/OcCo | 158 | 1070 | <reponame>sun-pyo/OcCo<gh_stars>100-1000
# Copyright (c) 2020. <NAME>, <EMAIL>
import os, open3d, numpy as np
File_ = open('ModelNet_flist_short.txt', 'w')
if __name__ == "__main__":
root_dir = "../data/ModelNet_subset/"
for root, dirs, files in os.walk(root_dir, topdown=False):
for file in files:
... | # Copyright (c) 2020. <NAME>, <EMAIL>
import os, open3d, numpy as np
File_ = open('ModelNet_flist_short.txt', 'w')
if __name__ == "__main__":
root_dir = "../data/ModelNet_subset/"
for root, dirs, files in os.walk(root_dir, topdown=False):
for file in files:
if '.ply' in file:
... | en | 0.794379 | # Copyright (c) 2020. <NAME>, <EMAIL> # we found divided by (2*maxR) has best rendered visualisation results | 2.290562 | 2 |
pymatgen/apps/battery/insertion_battery.py | adozier/pymatgen | 18 | 1071 | <filename>pymatgen/apps/battery/insertion_battery.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module is used for analysis of materials with potential application as
intercalation batteries.
"... | <filename>pymatgen/apps/battery/insertion_battery.py
# coding: utf-8
# Copyright (c) Pymatgen Development Team.
# Distributed under the terms of the MIT License.
from __future__ import division, unicode_literals
"""
This module is used for analysis of materials with potential application as
intercalation batteries.
"... | en | 0.802017 | # coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. This module is used for analysis of materials with potential application as intercalation batteries. A set of topotactically related compounds, with different amounts of a single element, e.g. TiO2 and LiTiO... | 2.740684 | 3 |
python/GafferUI/ColorSwatchPlugValueWidget.py | ddesmond/gaffer | 561 | 1072 | ##########################################################################
#
# Copyright (c) 2013, <NAME>. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | ##########################################################################
#
# Copyright (c) 2013, <NAME>. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the f... | en | 0.761642 | ########################################################################## # # Copyright (c) 2013, <NAME>. All rights reserved. # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the f... | 0.931251 | 1 |
NewsPaperD7(final)/NewsPaper/News/migrations/0001_initial.py | GregTMJ/django-files | 1 | 1073 | <reponame>GregTMJ/django-files<gh_stars>1-10
# Generated by Django 3.2 on 2021-04-15 18:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependenc... | # Generated by Django 3.2 on 2021-04-15 18:05
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... | en | 0.821169 | # Generated by Django 3.2 on 2021-04-15 18:05 | 1.927609 | 2 |
osh/cmd_exec_test.py | rhencke/oil | 1 | 1074 | #!/usr/bin/env python
# Copyright 2016 <NAME>. 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
"""
cmd_exec_test.py: Tests ... | #!/usr/bin/env python
# Copyright 2016 <NAME>. 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
"""
cmd_exec_test.py: Tests ... | en | 0.606068 | #!/usr/bin/env python # Copyright 2016 <NAME>. 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 cmd_exec_test.py: Tests for ... | 2.343828 | 2 |
blitz_api/migrations/0020_auto_20190529_1200.py | MelanieFJNR/Blitz-API | 3 | 1075 | # Generated by Django 2.0.8 on 2019-05-29 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blitz_api', '0019_merge_20190524_1719'),
]
operations = [
migrations.AlterField(
model_name='exportmedia',
name='fil... | # Generated by Django 2.0.8 on 2019-05-29 16:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blitz_api', '0019_merge_20190524_1719'),
]
operations = [
migrations.AlterField(
model_name='exportmedia',
name='fil... | en | 0.766548 | # Generated by Django 2.0.8 on 2019-05-29 16:00 | 1.370309 | 1 |
archiveis/__init__.py | palewire/archiveis | 6 | 1076 | #!/usr/bin/env python
from .api import capture
__version__ = "0.0.7"
__all__ = ("capture",)
| #!/usr/bin/env python
from .api import capture
__version__ = "0.0.7"
__all__ = ("capture",)
| ru | 0.26433 | #!/usr/bin/env python | 0.981557 | 1 |
temp/discrete_a2c_agent.py | linklab/link_rl | 0 | 1077 | <filename>temp/discrete_a2c_agent.py
import numpy as np
import torch
import torch.nn.functional as F
from codes.d_agents.a0_base_agent import float32_preprocessor
from codes.d_agents.on_policy.on_policy_agent import OnPolicyAgent
from codes.e_utils import rl_utils, replay_buffer
from codes.d_agents.actions import Prob... | <filename>temp/discrete_a2c_agent.py
import numpy as np
import torch
import torch.nn.functional as F
from codes.d_agents.a0_base_agent import float32_preprocessor
from codes.d_agents.on_policy.on_policy_agent import OnPolicyAgent
from codes.e_utils import rl_utils, replay_buffer
from codes.d_agents.actions import Prob... | ko | 0.441276 | # Lucky Episode에서 얻어낸 batch를 통해 학습할 때와, Unlucky Episode에서 얻어낸 batch를 통해 학습할 때마다 NN의 파라미터들이 # 서로 다른 방향으로 반복적으로 휩쓸려가듯이 학습이 됨 --> Gradients의 Variance가 매우 큼 # states_v.shape: (32, 3) # actions_v.shape: (32, 1) # target_action_values_v.shape: (32,) # Critic Optimization #nn_utils.clip_grad_norm_(self.model.base.critic.param... | 2.282231 | 2 |
edmundbotadder/cogs/webhook.py | thebeanogamer/edmund-botadder | 0 | 1078 | <filename>edmundbotadder/cogs/webhook.py
from discord.ext.commands import Bot, Cog
class Webhook(Cog):
"""
Webhook functionality
"""
def __init__(self, bot: Bot):
self.bot = bot
def setup(bot):
bot.add_cog(Webhook(bot)) | <filename>edmundbotadder/cogs/webhook.py
from discord.ext.commands import Bot, Cog
class Webhook(Cog):
"""
Webhook functionality
"""
def __init__(self, bot: Bot):
self.bot = bot
def setup(bot):
bot.add_cog(Webhook(bot)) | en | 0.75131 | Webhook functionality | 2.29705 | 2 |
apps/core/forms.py | allexvissoci/djangoecommerce | 0 | 1079 | <reponame>allexvissoci/djangoecommerce
from django import forms
from django.core.mail import send_mail
from django.conf import settings
class ContactForm(forms.Form):
name = forms.CharField(label='Nome', required=True)
email = forms.EmailField(label='E-mail')
message = forms.CharField(label='Mensagem', w... | from django import forms
from django.core.mail import send_mail
from django.conf import settings
class ContactForm(forms.Form):
name = forms.CharField(label='Nome', required=True)
email = forms.EmailField(label='E-mail')
message = forms.CharField(label='Mensagem', widget=forms.Textarea(),
... | none | 1 | 2.181726 | 2 | |
Fchat/Gui/AddFriendWidget.py | jamesaxl/FreeSnake | 2 | 1080 | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk
class AddFriendWidget(Gtk.Box):
def __init__(self, main_window, fchat_prv, friend_list):
Gtk.Box.__init__(self, spacing=7, orientation = Gtk.Orientation.VERTICAL)
self.fchat_prv = fchat_prv
self.main_window... | import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gio, Gtk, Gdk
class AddFriendWidget(Gtk.Box):
def __init__(self, main_window, fchat_prv, friend_list):
Gtk.Box.__init__(self, spacing=7, orientation = Gtk.Orientation.VERTICAL)
self.fchat_prv = fchat_prv
self.main_window... | none | 1 | 2.33376 | 2 | |
python01/game.py | liyan2013/hogwarts | 0 | 1081 | <filename>python01/game.py
import random
def game():
# 我的血量
my_hp = 1000
# 敌人的血量
enemy_hp = 1000
while True:
# 我受到随机的攻击,减少血量
my_hp = my_hp - random.randint(0, 50)
# 敌人收到随机的攻击,减少血量
enemy_hp = enemy_hp - random.randint(0, 50)
if my_hp <= 0:
# 如果我... | <filename>python01/game.py
import random
def game():
# 我的血量
my_hp = 1000
# 敌人的血量
enemy_hp = 1000
while True:
# 我受到随机的攻击,减少血量
my_hp = my_hp - random.randint(0, 50)
# 敌人收到随机的攻击,减少血量
enemy_hp = enemy_hp - random.randint(0, 50)
if my_hp <= 0:
# 如果我... | zh | 0.982836 | # 我的血量 # 敌人的血量 # 我受到随机的攻击,减少血量 # 敌人收到随机的攻击,减少血量 # 如果我此时的血量<=0,则敌人赢了 # 退出循环 # 如果敌人此时的血量<=0,则我赢了 # 跳出循环 | 3.649637 | 4 |
petstore/api/api_response.py | andrii-grytsenko/io.swagger.petstore3.testing | 0 | 1082 | from enum import Enum
class ApiResponseType(Enum):
error = "Error"
warning = "Warning"
info = "Info"
ok = "OK"
too_busy = "Too busy"
class ApiResponse:
def __init__(self, code: int, response_type: ApiResponseType, message):
self.code = code
self.type = response_type
s... | from enum import Enum
class ApiResponseType(Enum):
error = "Error"
warning = "Warning"
info = "Info"
ok = "OK"
too_busy = "Too busy"
class ApiResponse:
def __init__(self, code: int, response_type: ApiResponseType, message):
self.code = code
self.type = response_type
s... | none | 1 | 3.35275 | 3 | |
test/integration/component/test_browse_templates2.py | ycyun/ablestack-cloud | 1,131 | 1083 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | en | 0.890466 | # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u... | 1.644213 | 2 |
tests/components/ozw/test_websocket_api.py | pcaston/core | 1 | 1084 | """Test OpenZWave Websocket API."""
from unittest.mock import patch
from openzwavemqtt.const import (
ATTR_CODE_SLOT,
ATTR_LABEL,
ATTR_OPTIONS,
ATTR_POSITION,
ATTR_VALUE,
ValueType,
)
from openpeerpower.components.ozw.const import ATTR_CONFIG_PARAMETER
from openpeerpower.components.ozw.lock im... | """Test OpenZWave Websocket API."""
from unittest.mock import patch
from openzwavemqtt.const import (
ATTR_CODE_SLOT,
ATTR_LABEL,
ATTR_OPTIONS,
ATTR_POSITION,
ATTR_VALUE,
ValueType,
)
from openpeerpower.components.ozw.const import ATTR_CONFIG_PARAMETER
from openpeerpower.components.ozw.lock im... | en | 0.440866 | Test OpenZWave Websocket API. Test the ozw websocket api. # Test instance list # Test network status # Test node status # Test node statistics # Test node metadata # Test network statistics # Test get nodes # Test get config parameters # Test set config parameter # Test OZW Instance not found error # Test OZW Node not ... | 2.011395 | 2 |
tests/test_formatters.py | samueljacques-qc/notification-utils | 0 | 1085 | <filename>tests/test_formatters.py
import pytest
from flask import Markup
from notifications_utils.formatters import (
unlink_govuk_escaped,
notify_email_markdown,
notify_letter_preview_markdown,
notify_plain_text_email_markdown,
sms_encode,
formatted_list,
strip_dvla_markup,
strip_pipe... | <filename>tests/test_formatters.py
import pytest
from flask import Markup
from notifications_utils.formatters import (
unlink_govuk_escaped,
notify_email_markdown,
notify_letter_preview_markdown,
notify_plain_text_email_markdown,
sms_encode,
formatted_list,
strip_dvla_markup,
strip_pipe... | en | 0.418613 | #fragment", #005ea5;" href="{}">{}</a>'.format(url, url) #0B0C0C;">' #005ea5;" href="http://example.com">http://example.com</a>' #005ea5;" href="http://example.com">http://example.com</a>)' #0B0C0C;">' #0B0C0C;">' #0B0C0C;">' #005ea5;" href="http://example.com/?token=">' https://example.com"onclick="alert('hi') <a styl... | 2.453898 | 2 |
ProgramFlow/functions/banner.py | kumarvgit/python3 | 0 | 1086 | <reponame>kumarvgit/python3
def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
... | def banner_text(text):
screen_width = 80
if len(text) > screen_width - 4:
print("EEK!!")
print("THE TEXT IS TOO LONG TO FIT IN THE SPECIFIED WIDTH")
if text == "*":
print("*" * screen_width)
else:
centred_text = text.center(screen_width - 4)
output_string = "**{0... | none | 1 | 3.437649 | 3 | |
Adafruit_BluefruitLE/interfaces/__init__.py | acoomans/Adafruit_Python_BluefruitLE | 415 | 1087 | <reponame>acoomans/Adafruit_Python_BluefruitLE
from .provider import Provider
from .adapter import Adapter
from .device import Device
from .gatt import GattService, GattCharacteristic, GattDescriptor
| from .provider import Provider
from .adapter import Adapter
from .device import Device
from .gatt import GattService, GattCharacteristic, GattDescriptor | none | 1 | 1.150187 | 1 | |
axju/generic/__init__.py | axju/axju | 0 | 1088 | from axju.generic.basic import BasicWorker
from axju.generic.execution import ExecutionWorker
from axju.generic.template import TemplateWorker
| from axju.generic.basic import BasicWorker
from axju.generic.execution import ExecutionWorker
from axju.generic.template import TemplateWorker
| none | 1 | 1.135159 | 1 | |
objectstoreSiteMover.py | nikmagini/pilot | 13 | 1089 | <filename>objectstoreSiteMover.py<gh_stars>10-100
#!/usr/bin/env python
# Copyright European Organization for Nuclear Research (CERN)
#
# 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:/... | <filename>objectstoreSiteMover.py<gh_stars>10-100
#!/usr/bin/env python
# Copyright European Organization for Nuclear Research (CERN)
#
# 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:/... | en | 0.460393 | #!/usr/bin/env python # Copyright European Organization for Nuclear Research (CERN) # # 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 # # Authors: #... | 1.988285 | 2 |
codigos_videos/Exemplo_2.py | Miguel-mmf/Biblioteca_Dash_em-Python | 1 | 1090 | <filename>codigos_videos/Exemplo_2.py
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube
# Não deixe de assistir o víde... | <filename>codigos_videos/Exemplo_2.py
# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube
# Não deixe de assistir o víde... | pt | 0.963063 | # +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ # Esse arquivo possui algumas modificações em relação ao arquivo apresentado no vídeo do YouTube # Não deixe de assistir o vídeo e estudar pela documentação ofical D... | 2.342692 | 2 |
Lab 2/javaccflab/formatter.py | tochanenko/MetaProgramming | 0 | 1091 | import re
import datetime
from javaccflab.lexer import parse
from javaccflab.java_token import TokenType, Token, update_token_value
class Formatter:
def __init__(self, files):
self.__files = files
self.__file = None
self.__tokens = []
self.__to_fix = dict()
def process(self):
... | import re
import datetime
from javaccflab.lexer import parse
from javaccflab.java_token import TokenType, Token, update_token_value
class Formatter:
def __init__(self, files):
self.__files = files
self.__file = None
self.__tokens = []
self.__to_fix = dict()
def process(self):
... | en | 0.713412 | # Fix start comment # Fix class comment # Fix comments for methods and fields | 2.737288 | 3 |
src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py | zangobot/secml | 63 | 1092 | <filename>src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py
"""
.. module:: CAttackEvasionPGDExp
:synopsis: Evasion attack using Projected Gradient Descent.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from secml.adv.attacks.evasion import CAttackEvasionPGDLS
class CAttackEvasionPGDExp(CAttackEvasionPGDLS):
... | <filename>src/secml/adv/attacks/evasion/c_attack_evasion_pgd_exp.py
"""
.. module:: CAttackEvasionPGDExp
:synopsis: Evasion attack using Projected Gradient Descent.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from secml.adv.attacks.evasion import CAttackEvasionPGDLS
class CAttackEvasionPGDExp(CAttackEvasionPGDLS):
... | en | 0.648279 | .. module:: CAttackEvasionPGDExp :synopsis: Evasion attack using Projected Gradient Descent. .. moduleauthor:: <NAME> <<EMAIL>> Evasion attacks using Projected Gradient Descent with Exponential line search. This class implements the maximum-confidence evasion attacks proposed in: - https://arxiv.org/abs/... | 2.589593 | 3 |
mail_log_parser/data_manager.py | kinteriq/mail-log-parser | 0 | 1093 | import sqlite3
class ManageData:
def __init__(self, queue_tracker_db, email_tracker_db, delivery_tracker_db):
self.queue_tracker_db = queue_tracker_db
self.email_tracker_db = email_tracker_db
self.delivery_tracker_db = delivery_tracker_db
def manage_queue_tracker(self, fields):
... | import sqlite3
class ManageData:
def __init__(self, queue_tracker_db, email_tracker_db, delivery_tracker_db):
self.queue_tracker_db = queue_tracker_db
self.email_tracker_db = email_tracker_db
self.delivery_tracker_db = delivery_tracker_db
def manage_queue_tracker(self, fields):
... | en | 0.868238 | Receive one of the following located groups as <fields>: [('ID', <id>), ('client_email', <email>)]; [('ID', <id>), ('receivers', <email>), ('status', <status>)]; [('ID', <id>)]; and manage the <queue_tracker_db> accordingly. Retrieve client's email from the <queue_tracker_db>... | 3.244016 | 3 |
Util/training_util.py | lychenyoko/content-aware-gan-compression | 47 | 1094 | import math
def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01):
noise = torch.randn_like(fake_img) / math.sqrt(
fake_img.shape[2] * fake_img.shape[3]
)
grad, = autograd.grad(
outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True
)
path_lengths = tor... | import math
def g_path_regularize(fake_img, latents, mean_path_length, decay=0.01):
noise = torch.randn_like(fake_img) / math.sqrt(
fake_img.shape[2] * fake_img.shape[3]
)
grad, = autograd.grad(
outputs=(fake_img * noise).sum(), inputs=latents, create_graph=True
)
path_lengths = tor... | none | 1 | 2.236061 | 2 | |
app/configs/development_settings.py | DIS-SIN/FlaskShell | 0 | 1095 | <gh_stars>0
######################################################## FLASK SETTINGS ##############################################################
#Variable used to securly sign cookies
##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD
SECRET_KEY = "dev"
############... | ######################################################## FLASK SETTINGS ##############################################################
#Variable used to securly sign cookies
##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD
SECRET_KEY = "dev"
########################... | de | 0.431103 | ######################################################## FLASK SETTINGS ############################################################## #Variable used to securly sign cookies ##THIS IS SET IN DEV ENVIRONMENT FOR CONVENIENCE BUT SHOULD BE SET AS AN ENVIRONMENT VARIABLE IN PROD ############################################... | 1.637819 | 2 |
autoarray/structures/grids/two_d/grid_2d_util.py | caoxiaoyue/PyAutoArray | 0 | 1096 | import numpy as np
from typing import Tuple, Union, Optional
from autoarray.structures.arrays.two_d import array_2d_util
from autoarray.geometry import geometry_util
from autoarray import numba_util
from autoarray.mask import mask_2d_util
@numba_util.jit()
def grid_2d_centre_from(grid_2d_slim: np.ndarray) ... | import numpy as np
from typing import Tuple, Union, Optional
from autoarray.structures.arrays.two_d import array_2d_util
from autoarray.geometry import geometry_util
from autoarray import numba_util
from autoarray.mask import mask_2d_util
@numba_util.jit()
def grid_2d_centre_from(grid_2d_slim: np.ndarray) ... | en | 0.828641 | Returns the centre of a grid from a 1D grid.
Parameters
----------
grid_2d_slim
The 1D grid of values which are mapped to a 2D array.
Returns
-------
(float, float)
The (y,x) central coordinates of the grid. For a sub-grid, every unmasked pixel of its 2D mask with sha... | 3.040674 | 3 |
Proxies/Proxies.py | crown-prince/proxies | 2 | 1097 | # coding: utf-8
import requests, math
import gevent
from gevent.queue import Queue
from gevent import monkey; monkey.patch_all()
from pyquery import PyQuery
class Proxies():
def __init__(self):
self.domestic_gn_url = 'http://www.kuaidaili.com/free/inha/{0}/'
self.domestic_pt_url = 'http://www.kuai... | # coding: utf-8
import requests, math
import gevent
from gevent.queue import Queue
from gevent import monkey; monkey.patch_all()
from pyquery import PyQuery
class Proxies():
def __init__(self):
self.domestic_gn_url = 'http://www.kuaidaili.com/free/inha/{0}/'
self.domestic_pt_url = 'http://www.kuai... | zh | 0.830123 | # coding: utf-8 quantity: 数量 type: 类型 1.国内高匿代理 2.国内普通代理 3.国外高匿代理 4.国外普通代理 # 判断类型 # 国内高匿代理 # 国内普通代理 # 国外高匿代理 # 国外普通代理 # 获取所需要的页面URL # 处理所有URL,开启2个协程 | 2.616231 | 3 |
parallelformers/policies/base/auto.py | Oaklight/parallelformers | 454 | 1098 | <filename>parallelformers/policies/base/auto.py
# Copyright 2021 TUNiB 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 ... | <filename>parallelformers/policies/base/auto.py
# Copyright 2021 TUNiB 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 ... | en | 0.796603 | # Copyright 2021 TUNiB inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw... | 1.617586 | 2 |
main/upper_air_humidity.py | RyosukeDTomita/gcmPlot | 0 | 1099 | # coding: utf-8
"""
Name: upper_air_humidity.py
Make upper level weather chart.
Usage: python3 upper_air_humidity.py --file <ncfile>
Author: <NAME>
Date: 2022/01/07
"""
import argparse
from ncmagics import fetchtime, japanmap, meteotool
def parse_args() -> dict:
"""parse_args.
set file path.
Args:
... | # coding: utf-8
"""
Name: upper_air_humidity.py
Make upper level weather chart.
Usage: python3 upper_air_humidity.py --file <ncfile>
Author: <NAME>
Date: 2022/01/07
"""
import argparse
from ncmagics import fetchtime, japanmap, meteotool
def parse_args() -> dict:
"""parse_args.
set file path.
Args:
... | en | 0.204079 | # coding: utf-8 Name: upper_air_humidity.py Make upper level weather chart. Usage: python3 upper_air_humidity.py --file <ncfile> Author: <NAME> Date: 2022/01/07 parse_args. set file path. Args: Returns: dict: output_name. Args: ncfile (str): ncfile isobaric_surface (int): i... | 3.184491 | 3 |