hexsha stringlengths 40 40 | size int64 2 1.02M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 245 | max_stars_repo_name stringlengths 6 130 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 245 | max_issues_repo_name stringlengths 6 130 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 245 | max_forks_repo_name stringlengths 6 130 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 2 1.02M | avg_line_length float64 1 958k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 2
classes | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1c443dbe02aa3601a4b584eb0b5bc976480a3a4d | 4,034 | py | Python | devine.py | noutcha/devine | 3a7d6767f9032d1b988efa4104adb3a5eca97c39 | [
"MIT"
] | null | null | null | devine.py | noutcha/devine | 3a7d6767f9032d1b988efa4104adb3a5eca97c39 | [
"MIT"
] | null | null | null | devine.py | noutcha/devine | 3a7d6767f9032d1b988efa4104adb3a5eca97c39 | [
"MIT"
] | null | null | null | """
Prémière version du jeu Deviner.
On crée une fenêtre simple qui demande à l'utilisateur de deviner le nombre secret.
Avec une possibilité de guide en indiquant si le nombre choisi est plus grand
ou plus petit que le nombre secret
source d'inspiration: https://pythonfaqfr.readthedocs.io/en/latest/prog_ev... | 33.616667 | 143 | 0.683689 |
from random import randint
import tkinter as tk #ici importation avec renommage, #from tkinter import * à éviter
from tkinter.messagebox import *
# On defini notre fonction de traitement
def user_recup_choix(event):
nbre_choisi = int(reponse.get()) # on recupère la reponse de l'user
reponse.delete(0... | true | true |
1c443dc6a22ecc7fee90d76acd68cbc1bacd1fb9 | 19,705 | py | Python | includes/BOLTS/freecad/extrusions/profiles.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | includes/BOLTS/freecad/extrusions/profiles.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | includes/BOLTS/freecad/extrusions/profiles.py | codysandahl/3dprinting | 98d588864e5ba5826c7ed16959aa7b1040a760b3 | [
"MIT"
] | null | null | null | # **************************************************************************************
# * *
# * BOLTS - Open Library of Technical Specifications *
# * ... | 29.279346 | 98 | 0.489267 |
import math
import Part
from FreeCAD import Vector
from DraftGeomUtils import fillet as draft_fillet
def vslot20x20(
params,
document
):
name = params["name"]
le = params["l"]
symmetry = [
(0, 0, False, False, False, False),
(0, 0, True, True, Fa... | true | true |
1c4441ebc66c0b0b71ab468deeaecf28874f330c | 6,448 | py | Python | tools/repl_test.py | zoosky/deno | 020898762fa081113608504ab5012b2b27c70668 | [
"MIT"
] | 3 | 2020-07-08T11:32:22.000Z | 2020-07-10T11:34:25.000Z | tools/repl_test.py | zoosky/deno | 020898762fa081113608504ab5012b2b27c70668 | [
"MIT"
] | null | null | null | tools/repl_test.py | zoosky/deno | 020898762fa081113608504ab5012b2b27c70668 | [
"MIT"
] | null | null | null | # Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import os
import shutil
from subprocess import CalledProcessError, PIPE, Popen
import sys
import time
from test_util import DenoTestCase, run_tests
class TestRepl(DenoTestCase):
def input(self, *lines, **kwargs):
exit_ = kwargs.pop... | 34.297872 | 78 | 0.559088 |
import os
import shutil
from subprocess import CalledProcessError, PIPE, Popen
import sys
import time
from test_util import DenoTestCase, run_tests
class TestRepl(DenoTestCase):
def input(self, *lines, **kwargs):
exit_ = kwargs.pop("exit", True)
sleep_ = kwargs.pop("sleep", 0)
env_ = kwa... | true | true |
1c4441f790e3934fdb9d9e916372990dbd0cc4c5 | 1,505 | py | Python | src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py | elinor-fung/coreclr | c1801e85024add717f518feb6a9caed60d54500f | [
"MIT"
] | 8 | 2020-01-15T11:09:15.000Z | 2021-08-25T08:54:55.000Z | src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py | elinor-fung/coreclr | c1801e85024add717f518feb6a9caed60d54500f | [
"MIT"
] | 3 | 2018-01-03T00:57:25.000Z | 2018-10-05T16:17:52.000Z | src/ToolBox/SOS/tests/t_cmd_bpmd_module_function_iloffset.py | elinor-fung/coreclr | c1801e85024add717f518feb6a9caed60d54500f | [
"MIT"
] | 1 | 2020-11-17T14:55:53.000Z | 2020-11-17T14:55:53.000Z | # Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
import lldb
import re
import testutils as test
# bpmd <module name> <managed function name> [<il offset>]
def runSce... | 31.354167 | 79 | 0.710299 |
import lldb
import re
import testutils as test
def runScenario(assembly, debugger, target):
process = target.GetProcess()
res = lldb.SBCommandReturnObject()
ci = debugger.GetCommandInterpreter()
test.stop_in_main(debugger, assembly)
ci.HandleCommand("bpmd " + assembly + " Test.Un... | true | true |
1c44426edb5f00a1194a178579284f2e8d2aa873 | 1,626 | py | Python | scripts/iclr_2018/rl_size.py | alcinos/dps | 5467db1216e9f9089376d2c71f524ced2382e4f6 | [
"Apache-2.0"
] | null | null | null | scripts/iclr_2018/rl_size.py | alcinos/dps | 5467db1216e9f9089376d2c71f524ced2382e4f6 | [
"Apache-2.0"
] | null | null | null | scripts/iclr_2018/rl_size.py | alcinos/dps | 5467db1216e9f9089376d2c71f524ced2382e4f6 | [
"Apache-2.0"
] | null | null | null | import numpy as np
import os
import clify
import argparse
from config import rl_config as config
config.update(
image_shape_grid=(3, 3),
reductions="sum",
)
grid = [dict(n_train=1, do_train=False)] + [dict(n_train=x) for x in 2**np.arange(0, 18, 2)]
parser = argparse.ArgumentParser()
parser.add_argument("--... | 26.225806 | 92 | 0.682657 | import numpy as np
import os
import clify
import argparse
from config import rl_config as config
config.update(
image_shape_grid=(3, 3),
reductions="sum",
)
grid = [dict(n_train=1, do_train=False)] + [dict(n_train=x) for x in 2**np.arange(0, 18, 2)]
parser = argparse.ArgumentParser()
parser.add_argument("--... | true | true |
1c444325429659bd2cf13dac06eb07c96a0b5de1 | 2,456 | py | Python | pcdet/models/model_utils/model_nms_utils.py | collector-m/ST3D | 720e04aa3dc4bb95ac336171b240b6c3130144e5 | [
"Apache-2.0"
] | null | null | null | pcdet/models/model_utils/model_nms_utils.py | collector-m/ST3D | 720e04aa3dc4bb95ac336171b240b6c3130144e5 | [
"Apache-2.0"
] | null | null | null | pcdet/models/model_utils/model_nms_utils.py | collector-m/ST3D | 720e04aa3dc4bb95ac336171b240b6c3130144e5 | [
"Apache-2.0"
] | null | null | null | import torch
from ...ops.iou3d_nms import iou3d_nms_utils
def class_agnostic_nms(box_scores, box_preds, nms_config, score_thresh=None):
src_box_scores = box_scores
if score_thresh is not None:
scores_mask = (box_scores >= score_thresh)
box_scores = box_scores[scores_mask]
box_preds = b... | 37.212121 | 116 | 0.661645 | import torch
from ...ops.iou3d_nms import iou3d_nms_utils
def class_agnostic_nms(box_scores, box_preds, nms_config, score_thresh=None):
src_box_scores = box_scores
if score_thresh is not None:
scores_mask = (box_scores >= score_thresh)
box_scores = box_scores[scores_mask]
box_preds = b... | true | true |
1c4445883af2eafcd549de66e969b087215c7666 | 2,335 | py | Python | _matplotlibsettings.py | WillemWybo/Electrical_compartmentalization_in_neurons | 1ff297be97412ff40042485479b78148fba11c27 | [
"MIT"
] | null | null | null | _matplotlibsettings.py | WillemWybo/Electrical_compartmentalization_in_neurons | 1ff297be97412ff40042485479b78148fba11c27 | [
"MIT"
] | null | null | null | _matplotlibsettings.py | WillemWybo/Electrical_compartmentalization_in_neurons | 1ff297be97412ff40042485479b78148fba11c27 | [
"MIT"
] | null | null | null | import matplotlib
# matplotlib.use("Agg")
import matplotlib.pyplot as pl
import matplotlib.animation as manimation
from matplotlib.gridspec import GridSpec
from matplotlib.patches import Rectangle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib import rc, rcParams
from mpl_toolkits.mplot3d impor... | 31.133333 | 83 | 0.65182 | import matplotlib
import matplotlib.pyplot as pl
import matplotlib.animation as manimation
from matplotlib.gridspec import GridSpec
from matplotlib.patches import Rectangle
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib import rc, rcParams
from mpl_toolkits.mplot3d import Axes3D
from matplotli... | true | true |
1c4445b06c65961d851d7965795b569e737f3f68 | 256 | py | Python | image_resize.py | cristianoc20/Rebar_Detection | 8a1cf22bc82c5998376cc034c9a7317401d5b2e3 | [
"MIT"
] | 58 | 2020-03-07T16:40:20.000Z | 2022-03-31T08:57:05.000Z | image_resize.py | JackySnake/Rebar_Detection | 8a1cf22bc82c5998376cc034c9a7317401d5b2e3 | [
"MIT"
] | 13 | 2020-03-08T11:00:58.000Z | 2022-03-12T00:17:59.000Z | image_resize.py | JackySnake/Rebar_Detection | 8a1cf22bc82c5998376cc034c9a7317401d5b2e3 | [
"MIT"
] | 17 | 2020-03-09T09:22:33.000Z | 2022-02-23T09:20:18.000Z | import glob as gb #导入glob模块
import cv2
import os
# 返回该路径下所有的 jpg 文件的路径
img_path = gb.glob("./data/test_dataset/*.jpg")
for path in img_path:
(filepath, tempfilename) = os.path.split(path)
(filename, extension) = os.path.splitext(tempfilename)
| 23.272727 | 58 | 0.71875 | import glob as gb
import cv2
import os
img_path = gb.glob("./data/test_dataset/*.jpg")
for path in img_path:
(filepath, tempfilename) = os.path.split(path)
(filename, extension) = os.path.splitext(tempfilename)
| true | true |
1c44481706e54082a191a60d87d3f384cd42fec6 | 10,802 | py | Python | vn/generator.py | Jemesson/nlp-conceptual-model | 26ad7249be4ccb3863c0852738eaa8b6ddcf63f3 | [
"MIT"
] | null | null | null | vn/generator.py | Jemesson/nlp-conceptual-model | 26ad7249be4ccb3863c0852738eaa8b6ddcf63f3 | [
"MIT"
] | null | null | null | vn/generator.py | Jemesson/nlp-conceptual-model | 26ad7249be4ccb3863c0852738eaa8b6ddcf63f3 | [
"MIT"
] | 1 | 2021-11-02T03:41:17.000Z | 2021-11-02T03:41:17.000Z | import os
from lang.owlprefix import PREFIX_DICT
from vn.utility import t, is_i, tab, is_comment, occurence_list, is_us
from jinja2 import FileSystemLoader, Environment
class Generator:
def __init__(self, classes, relationships, onto=True, is_long=None):
self.classes = classes
self.relationships ... | 33.339506 | 131 | 0.552861 | import os
from lang.owlprefix import PREFIX_DICT
from vn.utility import t, is_i, tab, is_comment, occurence_list, is_us
from jinja2 import FileSystemLoader, Environment
class Generator:
def __init__(self, classes, relationships, onto=True, is_long=None):
self.classes = classes
self.relationships ... | true | true |
1c4449b854f1469faa313a012269b7964208ff55 | 1,128 | py | Python | scrapy/utils/console.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 1 | 2015-04-01T20:02:08.000Z | 2015-04-01T20:02:08.000Z | scrapy/utils/console.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 2 | 2021-12-13T20:51:32.000Z | 2022-02-11T03:47:35.000Z | scrapy/utils/console.py | emschorsch/scrapy | acb7bad1ff4037b4a613ac94e2d3357bf92bdb8f | [
"BSD-3-Clause"
] | 1 | 2017-11-09T20:33:59.000Z | 2017-11-09T20:33:59.000Z |
def start_python_console(namespace=None, noipython=False):
"""Start Python console binded to the given namespace. If IPython is
available, an IPython console will be started instead, unless `noipython`
is True. Also, tab completion will be used on Unix systems.
"""
if namespace is None:
nam... | 36.387097 | 78 | 0.585106 |
def start_python_console(namespace=None, noipython=False):
if namespace is None:
namespace = {}
try:
try:
if noipython:
raise ImportError
import IPython
try:
IPython.embed(user_ns=namespace)
except AttributeError:
... | true | true |
1c4449dad8f315ea5b5f73b491c6a3fecb29e786 | 2,948 | py | Python | datasets/generate_synthia_label_info.py | JDAI-CV/FADA | a1c6403963184a3427eda68cc94b03ff6143368a | [
"Apache-2.0"
] | 120 | 2020-07-20T02:23:02.000Z | 2022-03-31T02:21:31.000Z | datasets/generate_synthia_label_info.py | JDAI-CV/FADA | a1c6403963184a3427eda68cc94b03ff6143368a | [
"Apache-2.0"
] | 27 | 2020-07-29T02:55:52.000Z | 2022-03-12T08:03:42.000Z | datasets/generate_synthia_label_info.py | JDAI-CV/FADA | a1c6403963184a3427eda68cc94b03ff6143368a | [
"Apache-2.0"
] | 25 | 2020-08-01T06:11:08.000Z | 2022-02-19T07:26:57.000Z | import argparse
import os
import math
import numpy as np
import pickle
from PIL import Image
from tqdm import tqdm
import imageio
from multiprocessing import Pool
parser = argparse.ArgumentParser(description="Generate label stat info")
parser.add_argument("-d",
"--datadir",
default="",
help="pa... | 27.811321 | 108 | 0.578019 | import argparse
import os
import math
import numpy as np
import pickle
from PIL import Image
from tqdm import tqdm
import imageio
from multiprocessing import Pool
parser = argparse.ArgumentParser(description="Generate label stat info")
parser.add_argument("-d",
"--datadir",
default="",
help="pa... | true | true |
1c444a39822bf470342e8467d1ba5fb4a3c7f873 | 1,765 | py | Python | conversations/migrations/0001_initial.py | alstn2468/Django_Airbnb_Clone | eeb61e4a36320a0b269d96f47cc6755dbc4c40f8 | [
"MIT"
] | 5 | 2019-11-26T00:34:24.000Z | 2021-01-04T06:04:48.000Z | conversations/migrations/0001_initial.py | alstn2468/Django_Airbnb_Clone | eeb61e4a36320a0b269d96f47cc6755dbc4c40f8 | [
"MIT"
] | 3 | 2021-06-09T19:05:40.000Z | 2021-09-08T01:49:01.000Z | conversations/migrations/0001_initial.py | alstn2468/Django_Airbnb_Clone | eeb61e4a36320a0b269d96f47cc6755dbc4c40f8 | [
"MIT"
] | 6 | 2019-11-24T11:47:09.000Z | 2021-08-16T20:21:35.000Z | # Generated by Django 2.2.5 on 2019-12-22 12:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Conversation",
fields=[
... | 30.431034 | 72 | 0.420397 |
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Conversation",
fields=[
(
"id",
... | true | true |
1c444b23a8f36b78e2011034fb20d666cb5720f3 | 2,548 | py | Python | perfil/models.py | KleuberJacob/Ecommerce-utilizando-Python-Django-e-Bootstrap4 | acf2239d408f26eb223a1fe1c03046fcf62d6733 | [
"MIT"
] | 41 | 2019-08-20T06:55:51.000Z | 2022-03-23T09:59:27.000Z | perfil/models.py | KleuberJacob/Ecommerce-utilizando-Python-Django-e-Bootstrap4 | acf2239d408f26eb223a1fe1c03046fcf62d6733 | [
"MIT"
] | 8 | 2021-03-18T21:29:25.000Z | 2022-01-13T01:32:24.000Z | perfil/models.py | KleuberJacob/Ecommerce-utilizando-Python-Django-e-Bootstrap4 | acf2239d408f26eb223a1fe1c03046fcf62d6733 | [
"MIT"
] | 31 | 2020-03-12T00:01:48.000Z | 2022-03-24T23:47:10.000Z | from django.db import models
from django.contrib.auth.models import User
from django.forms import ValidationError
import re
from utils.validacpf import valida_cpf
class Perfil(models.Model):
usuario = models.OneToOneField(User, on_delete=models.CASCADE,
verbose_name='Usuário')
... | 30.698795 | 79 | 0.522763 | from django.db import models
from django.contrib.auth.models import User
from django.forms import ValidationError
import re
from utils.validacpf import valida_cpf
class Perfil(models.Model):
usuario = models.OneToOneField(User, on_delete=models.CASCADE,
verbose_name='Usuário')
... | true | true |
1c444b57f31d894a5b389fd5e3836439e26bac0b | 1,248 | py | Python | test/echoVarsNotify.py | tigerfarm/work | 4e5a17496ec32306538b100bbef8811daf598700 | [
"MIT"
] | 2 | 2021-04-11T22:58:35.000Z | 2021-09-23T10:54:56.000Z | test/echoVarsNotify.py | tigerfarm/work | 4e5a17496ec32306538b100bbef8811daf598700 | [
"MIT"
] | null | null | null | test/echoVarsNotify.py | tigerfarm/work | 4e5a17496ec32306538b100bbef8811daf598700 | [
"MIT"
] | null | null | null | print "+++ Echo environment variables."
import os
# ------------------------------------------------------------------------------
# Get your account SID and auth token from https://twilio.com/console.
account_sid = os.environ.get("ACCOUNT_SID")
auth_token = os.environ.get("AUTH_TOKEN")
print "+ ACCOUNT_SID =", account... | 41.6 | 80 | 0.668269 | print "+++ Echo environment variables."
import os
account_sid = os.environ.get("ACCOUNT_SID")
auth_token = os.environ.get("AUTH_TOKEN")
print "+ ACCOUNT_SID =", account_sid
print "+ AUTH_TOKEN =", auth_token
accountPhoneNumber = os.environ.get("ACCOUNT_PHONE_NUMBER")
print "+ ACCOUNT_PHONE_NUMBER =", accountPhoneNum... | false | true |
1c444b8125c72d4ac5a956840cbcad32199c8ff1 | 1,592 | py | Python | Notes/apps/users/models.py | Mi-As/Lists-RestApi | eea238f9fc5fda4b992f33dd2c7a4725a74849bb | [
"MIT"
] | 1 | 2020-10-31T20:15:21.000Z | 2020-10-31T20:15:21.000Z | Notes/apps/users/models.py | Mi-As/Note-RestApi | eea238f9fc5fda4b992f33dd2c7a4725a74849bb | [
"MIT"
] | null | null | null | Notes/apps/users/models.py | Mi-As/Note-RestApi | eea238f9fc5fda4b992f33dd2c7a4725a74849bb | [
"MIT"
] | null | null | null | from werkzeug.security import check_password_hash, generate_password_hash
import uuid
from ... import db
# import like this bc: https://stackoverflow.com/questions/43576422/sqlalchemy-flask-class-is-not-defined
from ..notes import models as notes
from ...authentication import models as authenticaton
from . import ser... | 31.84 | 105 | 0.748744 | from werkzeug.security import check_password_hash, generate_password_hash
import uuid
from ... import db
from ..notes import models as notes
from ...authentication import models as authenticaton
from . import services
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
public_id = db.Column(db.St... | true | true |
1c444c981f33c32abead959c04c03ffa08190e74 | 9,358 | py | Python | robotiq_3f_gripper_control/nodes/Robotiq3FGripperStatusListener.py | atyshka/robotiq | 99bd09d1bccf3464b99c5f2470c691607adbb7b6 | [
"BSD-2-Clause"
] | null | null | null | robotiq_3f_gripper_control/nodes/Robotiq3FGripperStatusListener.py | atyshka/robotiq | 99bd09d1bccf3464b99c5f2470c691607adbb7b6 | [
"BSD-2-Clause"
] | 1 | 2021-09-01T23:52:16.000Z | 2021-09-01T23:52:16.000Z | robotiq_3f_gripper_control/nodes/Robotiq3FGripperStatusListener.py | UTNuclearRobotics/robotiq | 66213b3845e2b9e2ad9463157ee710698f479f72 | [
"BSD-2-Clause"
] | 1 | 2018-09-21T07:42:55.000Z | 2018-09-21T07:42:55.000Z | #!/usr/bin/env python
# Software License Agreement (BSD License)
#
# Copyright (c) 2012, Robotiq, 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... | 40.336207 | 211 | 0.641163 |
"""@package docstring
Command-line interface for receiving and interpreting the status of a 3F gripper gripper.
This serves as an example for receiving messages from the 'Robotiq3FGripperRobotInput' topic using the 'Robotiq3FGripper_robot_input' msg type and interpreting the corres... | false | true |
1c444cea01536e9894e87342726ed2edcb74d0f2 | 6,369 | py | Python | fitapp/south_migrations/0002_auto__add_timeseriesdatatype__add_unique_timeseriesdatatype_category_r.py | evansnj/django-fitbit-old2 | 87f4aa389ab9ea2f63fa41aa4d3bbb3f55cd78ac | [
"Apache-2.0"
] | null | null | null | fitapp/south_migrations/0002_auto__add_timeseriesdatatype__add_unique_timeseriesdatatype_category_r.py | evansnj/django-fitbit-old2 | 87f4aa389ab9ea2f63fa41aa4d3bbb3f55cd78ac | [
"Apache-2.0"
] | null | null | null | fitapp/south_migrations/0002_auto__add_timeseriesdatatype__add_unique_timeseriesdatatype_category_r.py | evansnj/django-fitbit-old2 | 87f4aa389ab9ea2f63fa41aa4d3bbb3f55cd78ac | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
# Safe User import for Django < 1.5
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_mo... | 52.636364 | 182 | 0.594756 |
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError:
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label = '%s.%s' % (User._meta.app_label,... | true | true |
1c444d318a36178d6e5513e846e17f7a823e3ccb | 931 | py | Python | esphome/components/binary_sensor/homeassistant.py | pi4homez/esphome | 697e9b0c28bb690719fa1d16ca8198ce5fd1d2be | [
"MIT"
] | 5 | 2019-04-14T09:43:29.000Z | 2021-07-17T06:36:44.000Z | esphome/components/binary_sensor/homeassistant.py | pi4homez/esphome | 697e9b0c28bb690719fa1d16ca8198ce5fd1d2be | [
"MIT"
] | null | null | null | esphome/components/binary_sensor/homeassistant.py | pi4homez/esphome | 697e9b0c28bb690719fa1d16ca8198ce5fd1d2be | [
"MIT"
] | 4 | 2019-07-08T08:58:44.000Z | 2021-12-18T21:56:22.000Z | import voluptuous as vol
from esphome.components import binary_sensor
import esphome.config_validation as cv
from esphome.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME
from esphome.cpp_generator import Pvariable
from esphome.cpp_types import App
DEPENDENCIES = ['api']
HomeassistantBinarySensor = binary_sensor.bina... | 34.481481 | 94 | 0.762621 | import voluptuous as vol
from esphome.components import binary_sensor
import esphome.config_validation as cv
from esphome.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME
from esphome.cpp_generator import Pvariable
from esphome.cpp_types import App
DEPENDENCIES = ['api']
HomeassistantBinarySensor = binary_sensor.bina... | true | true |
1c444d5e1dda6613ae5959af1930b90d1660a982 | 4,000 | py | Python | notebooks/parameter_tuning_ex_02.py | castorfou/scikit-learn-mooc | 235748eff57409eb17d8355024579c6df44c0563 | [
"CC-BY-4.0"
] | 1 | 2021-05-25T07:29:44.000Z | 2021-05-25T07:29:44.000Z | notebooks/parameter_tuning_ex_02.py | castorfou/scikit-learn-mooc | 235748eff57409eb17d8355024579c6df44c0563 | [
"CC-BY-4.0"
] | null | null | null | notebooks/parameter_tuning_ex_02.py | castorfou/scikit-learn-mooc | 235748eff57409eb17d8355024579c6df44c0563 | [
"CC-BY-4.0"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # 📝 Exercise M3.01
#
# The goal is to write an exhaustive search to find the best parameters
# combination maximizing the model statistical performance.
#
# Here we use a small subset of the Adult Census dataset to make to code
# fast to execute. Once your code works on the s... | 30.30303 | 124 | 0.72 |
t pandas as pd
from sklearn.model_selection import train_test_split
adult_census = pd.read_csv("../datasets/adult-census.csv")
target_name = "class"
target = adult_census[target_name]
data = adult_census.drop(columns=[target_name, "education-num"])
data_train, data_test, target_train, target_test = train_test_sp... | true | true |
1c444d99a421ed03ab656d5c6c2d5a7c3d4e9f61 | 1,979 | py | Python | exercises/en/test_02_07a.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | null | null | null | exercises/en/test_02_07a.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 88 | 2020-12-04T06:56:51.000Z | 2021-05-10T22:02:45.000Z | exercises/en/test_02_07a.py | UBC-MDS/exploratory-data-viz | 83b704ce10d1ff5e10bfd4cdfa872ac52993fd54 | [
"CC-BY-4.0"
] | 4 | 2021-01-13T09:30:57.000Z | 2021-08-03T20:49:31.000Z | def test():
# Here we can either check objects created in the solution code, or the
# string value of the solution, available as __solution__. A helper for
# printing formatted messages is available as __msg__. See the testTemplate
# in the meta.json for details.
# If an assertion fails, the message... | 98.95 | 241 | 0.738757 | def test():
assert not fuel_efficiency is None, "Your answer does not exist. Have you passed in the correct variable?"
assert type(fuel_efficiency) == type(alt.Chart()), "Your answer is not an Altair Chart object. Check to make sure that you have assigned an alt.Chart object to fuel_ef... | true | true |
1c444da6a8b80e2466802ae61d8ef26911df5b78 | 3,644 | py | Python | caffe2/python/operator_test/fc_operator_test.py | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | 1 | 2019-07-21T02:13:22.000Z | 2019-07-21T02:13:22.000Z | caffe2/python/operator_test/fc_operator_test.py | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | null | null | null | caffe2/python/operator_test/fc_operator_test.py | DavidKo3/mctorch | 53ffe61763059677978b4592c8b2153b0c15428f | [
"BSD-3-Clause"
] | null | null | null | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core
from hypothesis import assume, given, settings, HealthCheck
import caffe2.python.hypothesis_test_util a... | 35.038462 | 83 | 0.570801 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.proto import caffe2_pb2
from caffe2.python import core
from hypothesis import assume, given, settings, HealthCheck
import caffe2.python.hypothesis_test_util a... | true | true |
1c444db0233ca5c275f3a1c2a5a0e92f86e9e40a | 6,119 | py | Python | toolkitui.py | thebirdsbeak/morse_trainer | 2cc5277de066703218bc2277532a7a9b985a5b92 | [
"MIT"
] | null | null | null | toolkitui.py | thebirdsbeak/morse_trainer | 2cc5277de066703218bc2277532a7a9b985a5b92 | [
"MIT"
] | null | null | null | toolkitui.py | thebirdsbeak/morse_trainer | 2cc5277de066703218bc2277532a7a9b985a5b92 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'toolkitui.ui'
#
# Created by: PyQt5 UI code generator 5.15.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, Qt... | 71.151163 | 280 | 0.708776 |
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
... | true | true |
1c444de510c835bf1a3b57ad6b627da2b0e5f8d3 | 18,760 | py | Python | tensorflow/python/ops/gradients_test.py | topsun888/tensorflow | bad7c50b9dc9789ad7dd0a62daca40b7269841ed | [
"Apache-2.0"
] | 2 | 2017-10-14T09:13:27.000Z | 2017-10-26T18:34:28.000Z | tensorflow/python/ops/gradients_test.py | kiliczsh/tensorflow | f49aca4532c155597c669cf2189f211cafbebf96 | [
"Apache-2.0"
] | 1 | 2021-04-12T03:51:59.000Z | 2021-04-12T03:51:59.000Z | tensorflow/python/ops/gradients_test.py | kiliczsh/tensorflow | f49aca4532c155597c669cf2189f211cafbebf96 | [
"Apache-2.0"
] | 5 | 2018-02-27T00:34:23.000Z | 2022-02-28T16:38:08.000Z | # Copyright 2015 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... | 37.89899 | 81 | 0.646375 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import warnings
import numpy as np
import tensorflow as tf
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework im... | true | true |
1c444e381a5528baf355eff89d4e5396f0231430 | 42,894 | py | Python | Lib/test/test_time.py | gdebirka/cpython | b18fd54f8c27e4b2aac222e75ac58aa85e5a7988 | [
"0BSD"
] | 1 | 2022-01-22T22:34:08.000Z | 2022-01-22T22:34:08.000Z | Lib/test/test_time.py | gdebirka/cpython | b18fd54f8c27e4b2aac222e75ac58aa85e5a7988 | [
"0BSD"
] | 2 | 2022-02-06T01:15:13.000Z | 2022-03-01T10:04:24.000Z | Lib/test/test_time.py | gdebirka/cpython | b18fd54f8c27e4b2aac222e75ac58aa85e5a7988 | [
"0BSD"
] | 2 | 2021-09-07T13:43:49.000Z | 2021-12-19T08:34:56.000Z | from test import support
from test.support import warnings_helper
import decimal
import enum
import locale
import math
import platform
import sys
import sysconfig
import time
import threading
import unittest
try:
import _testcapi
except ImportError:
_testcapi = None
from test.support import skip_if_buggy_ucrt_... | 37.892226 | 108 | 0.582739 | from test import support
from test.support import warnings_helper
import decimal
import enum
import locale
import math
import platform
import sys
import sysconfig
import time
import threading
import unittest
try:
import _testcapi
except ImportError:
_testcapi = None
from test.support import skip_if_buggy_ucrt_... | true | true |
1c444ef4cd29e04ad3311978e8ac577fb7bda338 | 629 | py | Python | extras/makeDepPopulation.py | augustodn/COVID-19_Ar | 4911b52cd979ab346eaf9e716883500d392bfb01 | [
"MIT"
] | null | null | null | extras/makeDepPopulation.py | augustodn/COVID-19_Ar | 4911b52cd979ab346eaf9e716883500d392bfb01 | [
"MIT"
] | null | null | null | extras/makeDepPopulation.py | augustodn/COVID-19_Ar | 4911b52cd979ab346eaf9e716883500d392bfb01 | [
"MIT"
] | 1 | 2020-09-29T11:58:12.000Z | 2020-09-29T11:58:12.000Z | from openpyxl import load_workbook
filename = 'poblacion_dpto.csv'
csvFN = open(filename, 'w')
wb = load_workbook('poblacion_dpto.xlsx')
ws = wb['Sheet1']
csvFN.write('in1,nombre,pob_total\n')
for row in ws.values:
try:
if 'AREA' in row[0]:
indecCode = row[0][7:]
name = row[1]
... | 23.296296 | 66 | 0.585056 | from openpyxl import load_workbook
filename = 'poblacion_dpto.csv'
csvFN = open(filename, 'w')
wb = load_workbook('poblacion_dpto.xlsx')
ws = wb['Sheet1']
csvFN.write('in1,nombre,pob_total\n')
for row in ws.values:
try:
if 'AREA' in row[0]:
indecCode = row[0][7:]
name = row[1]
... | true | true |
1c444fd9aef9620eaa7ffa85c445148e8fcc02e6 | 15,493 | py | Python | scripts/.ipynb_checkpoints/gdal_functions-checkpoint.py | Thomas-Brd/3D_landslide_detection | 95ec6fc4dd013ecc7c3c8cb22dbbbc8712467830 | [
"CC-BY-3.0"
] | 1 | 2022-02-15T09:56:34.000Z | 2022-02-15T09:56:34.000Z | scripts/.ipynb_checkpoints/gdal_functions-checkpoint.py | Thomas-Brd/3D_landslide_detection | 95ec6fc4dd013ecc7c3c8cb22dbbbc8712467830 | [
"CC-BY-3.0"
] | null | null | null | scripts/.ipynb_checkpoints/gdal_functions-checkpoint.py | Thomas-Brd/3D_landslide_detection | 95ec6fc4dd013ecc7c3c8cb22dbbbc8712467830 | [
"CC-BY-3.0"
] | 3 | 2020-09-17T13:22:07.000Z | 2021-11-06T14:14:54.000Z | # coding: utf-8
# Thomas Bernard
# fonctions utilisant gdal
from osgeo import gdal
import ogr, osr
import numpy as np
#import rasterio
#from rasterio.plot import show
import subprocess
import os
import matplotlib.pyplot as plt
#import scripts.eros_function as eros
def read_tif_file(path_to_file):
ds = gdal.Ope... | 46.525526 | 328 | 0.684825 |
from osgeo import gdal
import ogr, osr
import numpy as np
import subprocess
import os
import matplotlib.pyplot as plt
def read_tif_file(path_to_file):
ds = gdal.Open(path_to_file)
gt = ds.GetGeoTransform()
proj = ds.GetProjection()
band= ds.GetRasterBand(1)
mask = band.GetNoDataValue()
... | true | true |
1c444fedb8ca59daf57a90006b988852221217fd | 14,700 | py | Python | third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/CompoundDescriptors.py | Ivy286/cluster_basedfps | 7fc216537f570436f008ea567c137d03ba2b6d81 | [
"WTFPL"
] | 9 | 2019-04-23T01:46:12.000Z | 2021-08-16T07:07:12.000Z | third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/CompoundDescriptors.py | Ivy286/cluster_basedfps | 7fc216537f570436f008ea567c137d03ba2b6d81 | [
"WTFPL"
] | null | null | null | third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/CompoundDescriptors.py | Ivy286/cluster_basedfps | 7fc216537f570436f008ea567c137d03ba2b6d81 | [
"WTFPL"
] | 5 | 2016-09-21T03:47:48.000Z | 2019-07-30T22:17:35.000Z | #
# Copyright (C) 2001,2002 greg Landrum and Rational Discovery LLC
#
""" descriptor calculator for compounds defined by a composition alone
(only the composition is required)
"""
from __future__ import print_function
from rdkit import RDConfig
from rdkit.utils import chemutils
import os
from rdkit.Dbase.DbConnect... | 30.625 | 96 | 0.644014 |
from __future__ import print_function
from rdkit import RDConfig
from rdkit.utils import chemutils
import os
from rdkit.Dbase.DbConnection import DbConnect
from rdkit.ML.Descriptors import Parser,Descriptors
from rdkit.six.moves import xrange
countOptions = [('NVAL','total number of valence electrons'),
... | true | true |
1c44505dd302e64a42b635bedc36746e9c6b4531 | 3,825 | py | Python | dali/test/python/test_RN50_external_source_parallel_data.py | awolant/DALI | ace3e0bee44b7b10cdf7255ec02e143646c68ce1 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2019-05-31T14:00:58.000Z | 2019-05-31T14:00:58.000Z | dali/test/python/test_RN50_external_source_parallel_data.py | Shruti-Raj-Vansh-Singh/DALI | e7df0b255c59a118843bfe3ecaf317d7ee1ed6bb | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2021-06-11T17:05:37.000Z | 2021-06-23T03:45:04.000Z | dali/test/python/test_RN50_external_source_parallel_data.py | Shruti-Raj-Vansh-Singh/DALI | e7df0b255c59a118843bfe3ecaf317d7ee1ed6bb | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | 36.778846 | 102 | 0.603399 |
from test_utils import AverageMeter
import os
import argparse
import time
import cv2
import numpy as np
from nvidia.dali.plugin.base_iterator import LastBatchPolicy
from test_RN50_external_source_parallel_utils import (
parse_test_arguments, external_source_parallel_pipeline, external_source_pipeli... | true | true |
1c44516c6c2cb62d2ea46dd638986291034ed6e1 | 367 | py | Python | payeezy_python/example/Dependancy/requests-master/requests/packages/urllib3/util/response.py | Dylfin/payeezy_direct_API | d0ec010dd265421ddc002e665221312178e2b0fe | [
"MIT"
] | 76 | 2015-04-28T18:50:16.000Z | 2022-03-21T18:52:44.000Z | payeezy_python/example/Dependancy/requests-master/requests/packages/urllib3/util/response.py | Dylfin/payeezy_direct_API | d0ec010dd265421ddc002e665221312178e2b0fe | [
"MIT"
] | 17 | 2015-07-15T17:46:41.000Z | 2022-03-01T19:14:48.000Z | payeezy_python/example/Dependancy/requests-master/requests/packages/urllib3/util/response.py | Dylfin/payeezy_direct_API | d0ec010dd265421ddc002e665221312178e2b0fe | [
"MIT"
] | 149 | 2015-04-13T04:51:09.000Z | 2021-07-06T14:16:20.000Z | def is_fp_closed(obj):
"""
Checks whether a given file-like object is closed.
:param obj:
The file-like object to check.
"""
if hasattr(obj, 'fp'):
# Object is a container for another file-like object that gets released
# on exhaustion (e.g. HTTPResponse)
r... | 26.214286 | 80 | 0.60218 | def is_fp_closed(obj):
if hasattr(obj, 'fp'):
return obj.fp is None
return obj.closed
| true | true |
1c4452faf589fe4cf63d1a0d78c548ac6bdf060e | 11,373 | py | Python | train_plain_bert_dot4_con.py | playing-code/fairseq2 | ac97b18c0aecca9eb36146492a1e95e521cb345a | [
"MIT"
] | null | null | null | train_plain_bert_dot4_con.py | playing-code/fairseq2 | ac97b18c0aecca9eb36146492a1e95e521cb345a | [
"MIT"
] | null | null | null | train_plain_bert_dot4_con.py | playing-code/fairseq2 | ac97b18c0aecca9eb36146492a1e95e521cb345a | [
"MIT"
] | null | null | null | import json
import pickle
import numpy as np
import random
# from fairseq.data import Dictionary
import sys
import torch
import argparse
import os
from model_plain_bert_dot4 import Plain_bert
from fairseq.models.roberta import RobertaModel
from utils_sample import NewsIterator
from utils_sample import cal_metric
impor... | 32.401709 | 187 | 0.62578 | import json
import pickle
import numpy as np
import random
import sys
import torch
import argparse
import os
from model_plain_bert_dot4 import Plain_bert
from fairseq.models.roberta import RobertaModel
from utils_sample import NewsIterator
from utils_sample import cal_metric
import utils_sample as utils
import t... | true | true |
1c44534ae52d49a685a8b666effb3e998f3d5f6a | 667 | py | Python | survey_api/reports/serializers/__init__.py | OpenStackweb/openstack-survey-api | 6ede5d0521d9055cff0adb939db2d11a216336f5 | [
"Apache-2.0"
] | null | null | null | survey_api/reports/serializers/__init__.py | OpenStackweb/openstack-survey-api | 6ede5d0521d9055cff0adb939db2d11a216336f5 | [
"Apache-2.0"
] | 3 | 2020-02-11T23:49:55.000Z | 2021-06-10T21:13:14.000Z | survey_api/reports/serializers/__init__.py | OpenStackweb/openstack-survey-api | 6ede5d0521d9055cff0adb939db2d11a216336f5 | [
"Apache-2.0"
] | null | null | null | """
* Copyright 2019 OpenStack Foundation
* 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 ... | 44.466667 | 75 | 0.772114 |
from .survey_serializer import SurveySerializer, SurveyTemplateSerializer
| true | true |
1c445417358840223a835234f4a381e0ad420f0e | 1,217 | py | Python | facebook_business/adobjects/serverside/http_service_interface.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 576 | 2018-05-01T19:09:32.000Z | 2022-03-31T11:45:11.000Z | facebook_business/adobjects/serverside/http_service_interface.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 217 | 2018-05-03T07:31:59.000Z | 2022-03-29T14:19:52.000Z | facebook_business/adobjects/serverside/http_service_interface.py | MyrikLD/facebook-python-business-sdk | a53c8ba0e8f7d0b41b385c60089f6ba00fa5c814 | [
"CNRI-Python"
] | 323 | 2018-05-01T20:32:26.000Z | 2022-03-29T07:05:12.000Z | # Copyright 2014 Facebook, Inc.
# You are hereby granted a non-exclusive, worldwide, royalty-free license to
# use, copy, modify, and distribute this software in source code or binary
# form for use in connection with the web services and APIs provided by
# Facebook.
# As with any software that integrates with the Fa... | 45.074074 | 76 | 0.775678 |
from abc import ABC, abstractmethod
class HttpServiceInterface(ABC):
@abstractmethod
def execute(self, url, method, request_options, headers, params):
pass
| true | true |
1c445579769606123b574a4f2d84e40782cbfb99 | 904 | py | Python | pcat2py/class/20eb7da0-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY | 937c3b365cdc5ac69b78f59070be0a21bdb53db0 | [
"MIT"
] | null | null | null | pcat2py/class/20eb7da0-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY | 937c3b365cdc5ac69b78f59070be0a21bdb53db0 | [
"MIT"
] | null | null | null | pcat2py/class/20eb7da0-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY | 937c3b365cdc5ac69b78f59070be0a21bdb53db0 | [
"MIT"
] | null | null | null | #!/usr/bin/python
################################################################################
# 20eb7da0-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | 25.828571 | 80 | 0.53208 | false | true | |
1c4456f331c5f34771a86f26632a47558e095202 | 3,198 | py | Python | systran_storages/bin/storages_cli.py | nguyendc-systran/storages | d31a18953ce9ce3d9b791f94b02837bfa156cb1a | [
"MIT"
] | null | null | null | systran_storages/bin/storages_cli.py | nguyendc-systran/storages | d31a18953ce9ce3d9b791f94b02837bfa156cb1a | [
"MIT"
] | 1 | 2019-12-11T15:44:34.000Z | 2019-12-11T15:44:34.000Z | systran_storages/bin/storages_cli.py | nguyenhn-systran/storages | d0f2a3b2b217313cca0980a43865811135e3f6a3 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
from systran_storages import StorageClient
import argparse
import json
import six
import os
import logging
from datetime import datetime
def resolvedpath(path):
fields = path.split(':')
if not len(fields) == 2 or not fields[1].startswith('/'):
raise argparse.Arg... | 38.071429 | 101 | 0.642276 |
from systran_storages import StorageClient
import argparse
import json
import six
import os
import logging
from datetime import datetime
def resolvedpath(path):
fields = path.split(':')
if not len(fields) == 2 or not fields[1].startswith('/'):
raise argparse.ArgumentError("incorrect storage path: ... | true | true |
1c44575a4ea6fbb81f6c44d4ca1a80d7726a22b8 | 3,002 | py | Python | research/rebar/download_data.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 82,518 | 2016-02-05T12:07:23.000Z | 2022-03-31T23:09:47.000Z | research/rebar/download_data.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 9,021 | 2016-03-08T01:02:05.000Z | 2022-03-31T08:06:35.000Z | research/rebar/download_data.py | 873040/Abhishek | 2ddd716e66bc5cc6e6f0787508dd07da0e02e75a | [
"Apache-2.0"
] | 54,341 | 2016-02-06T17:19:55.000Z | 2022-03-31T10:27:44.000Z | # Copyright 2017 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 a... | 33.355556 | 116 | 0.70453 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import urllib
import gzip
import os
import config
import struct
import numpy as np
import cPickle as pickle
import datasets
MNIST_URL = 'see README'
MNIST_BINARIZED_URL = 'see README'
OMNIGLOT_... | true | true |
1c44589d3c730e035ab6ff91365665923d59240b | 241 | py | Python | gc.py | rundekugel/micropythonemu | d135f7389f1f13fe33dda58778958ea74680fdbc | [
"MIT"
] | null | null | null | gc.py | rundekugel/micropythonemu | d135f7389f1f13fe33dda58778958ea74680fdbc | [
"MIT"
] | null | null | null | gc.py | rundekugel/micropythonemu | d135f7389f1f13fe33dda58778958ea74680fdbc | [
"MIT"
] | null | null | null | # dummy lib
"""
dummy library gc to emulate esp8266 micropython on a PC with python3
uncomplete
2022 by lifesim.de
"""
from gc import *
def mem_alloc():
return 1000
def mem_free():
return -1
def threshold(a):
return -1
#eof
| 12.05 | 68 | 0.684647 |
from gc import *
def mem_alloc():
return 1000
def mem_free():
return -1
def threshold(a):
return -1
| true | true |
1c4459fbff634a63bf3eb4a631d67077bb257f72 | 5,415 | py | Python | zerver/tests/test_realm_filters.py | kenclary/zulip | 0267ba54b286a783dbde9a31d8ee2a0971671f73 | [
"Apache-2.0"
] | 2 | 2021-09-01T17:44:28.000Z | 2021-09-01T18:09:51.000Z | zerver/tests/test_realm_filters.py | kenclary/zulip | 0267ba54b286a783dbde9a31d8ee2a0971671f73 | [
"Apache-2.0"
] | 1 | 2021-03-24T12:50:52.000Z | 2021-03-24T13:11:42.000Z | zerver/tests/test_realm_filters.py | kenclary/zulip | 0267ba54b286a783dbde9a31d8ee2a0971671f73 | [
"Apache-2.0"
] | null | null | null | import re
from zerver.lib.actions import do_add_realm_filter
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmFilter, get_realm
class RealmFilterTest(ZulipTestCase):
def test_list(self) -> None:
self.login("iago")
realm = get_realm("zulip")
do_add_realm_fil... | 46.282051 | 98 | 0.628994 | import re
from zerver.lib.actions import do_add_realm_filter
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import RealmFilter, get_realm
class RealmFilterTest(ZulipTestCase):
def test_list(self) -> None:
self.login("iago")
realm = get_realm("zulip")
do_add_realm_fil... | true | true |
1c445a8d09e9a4ab77e1462718f5caec6da3dc69 | 1,404 | py | Python | provy/more/centos/utils/hostname.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | 15 | 2015-01-28T15:49:28.000Z | 2021-09-02T18:49:46.000Z | provy/more/centos/utils/hostname.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | null | null | null | provy/more/centos/utils/hostname.py | timgates42/provy | ca3d5e96a2210daf3c1fd4b96e047efff152db14 | [
"MIT"
] | 3 | 2016-12-05T07:08:11.000Z | 2021-12-26T04:31:05.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Roles in this namespace are meant to provide hostname utilities methods within CentOS distributions.
'''
from fabric.contrib.files import sed
from fabric.api import settings, hide
from provy.core import Role
class HostNameRole(Role):
def ensure_hostname(self, hostna... | 27 | 100 | 0.590456 |
from fabric.contrib.files import sed
from fabric.api import settings, hide
from provy.core import Role
class HostNameRole(Role):
def ensure_hostname(self, hostname):
if hostname == self.execute('hostname'):
return False
path = '/etc/sysconfig/network'
file = self.read_r... | true | true |
1c445ac0474100a6d6ada83425a4ce570d51ea83 | 17,999 | py | Python | csdmpy/helper_functions.py | DeepanshS/csdmpy | ae8d20dd09f217bb462af67a3145bb6fcb025def | [
"BSD-3-Clause"
] | 7 | 2020-01-04T20:46:08.000Z | 2021-05-26T21:09:25.000Z | csdmpy/helper_functions.py | deepanshs/csdmpy | bd4e138b10694491113b10177a89305697f1752c | [
"BSD-3-Clause"
] | 16 | 2021-06-09T06:28:27.000Z | 2022-03-01T18:12:33.000Z | csdmpy/helper_functions.py | deepanshs/csdmpy | bd4e138b10694491113b10177a89305697f1752c | [
"BSD-3-Clause"
] | 1 | 2020-01-03T17:04:16.000Z | 2020-01-03T17:04:16.000Z | # -*- coding: utf-8 -*-
"""Helper functions."""
from copy import deepcopy
from warnings import warn
import matplotlib.projections as proj
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.image import NonUniformImage
__author__ = "Deepansh J. Srivastava"
__email__ = "srivastava.89@osu.edu"
scalar =... | 32.198569 | 88 | 0.583755 |
from copy import deepcopy
from warnings import warn
import matplotlib.projections as proj
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.image import NonUniformImage
__author__ = "Deepansh J. Srivastava"
__email__ = "srivastava.89@osu.edu"
scalar = ["scalar", "vector_1", "pixel_1", "matrix_1_1"... | true | true |
1c445c09aba76bb2eb69badc9bf601edb0a0fe02 | 6,321 | py | Python | build/PureCloudPlatformClientV2/models/dialer_contactlist_config_change_contact_phone_number_column.py | cjohnson-ctl/platform-client-sdk-python | 38ce53bb8012b66e8a43cc8bd6ff00cf6cc99100 | [
"MIT"
] | 10 | 2019-02-22T00:27:08.000Z | 2021-09-12T23:23:44.000Z | libs/PureCloudPlatformClientV2/models/dialer_contactlist_config_change_contact_phone_number_column.py | rocketbot-cl/genesysCloud | dd9d9b5ebb90a82bab98c0d88b9585c22c91f333 | [
"MIT"
] | 5 | 2018-06-07T08:32:00.000Z | 2021-07-28T17:37:26.000Z | libs/PureCloudPlatformClientV2/models/dialer_contactlist_config_change_contact_phone_number_column.py | rocketbot-cl/genesysCloud | dd9d9b5ebb90a82bab98c0d88b9585c22c91f333 | [
"MIT"
] | 6 | 2020-04-09T17:43:07.000Z | 2022-02-17T08:48:05.000Z | # coding: utf-8
"""
Copyright 2016 SmartBear Software
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... | 30.244019 | 126 | 0.63376 |
from pprint import pformat
from six import iteritems
import re
import json
from ..utils import sanitize_for_serialization
class DialerContactlistConfigChangeContactPhoneNumberColumn(object):
def __init__(self):
self.swagger_types = {
'column_name': 'str',
'type': 'str',
... | true | true |
1c445c41e477e8613eedb82276ff8ae651e83f36 | 2,123 | py | Python | stanCode_projects/boggle game solver/sierpinski.py | KevinCheng713/stanCode_project | 0b2ba48be20c1737426d40eb941e8640b15acfe8 | [
"MIT"
] | null | null | null | stanCode_projects/boggle game solver/sierpinski.py | KevinCheng713/stanCode_project | 0b2ba48be20c1737426d40eb941e8640b15acfe8 | [
"MIT"
] | null | null | null | stanCode_projects/boggle game solver/sierpinski.py | KevinCheng713/stanCode_project | 0b2ba48be20c1737426d40eb941e8640b15acfe8 | [
"MIT"
] | null | null | null | """
File: sierpinski.py
Name: 鄭凱元
---------------------------
This file recursively prints the Sierpinski triangle on GWindow.
The Sierpinski triangle is a fractal described in 1915 by Waclaw Sierpinski.
It is a self similar structure that occurs at different levels of iterations.
"""
from campy.graphics.gwindow impor... | 37.245614 | 104 | 0.747527 |
from campy.graphics.gwindow import GWindow
from campy.graphics.gobjects import GLine
from campy.gui.events.timer import pause
ORDER = 6
LENGTH = 600
UPPER_LEFT_X = 150
UPPER_LEFT_Y = 100
WINDOW_WIDTH = 950
WINDOW_HEIGHT = 700
window = GWindow(width=WI... | true | true |
1c445c8ccc4933db31ddfcff4f2af668f7348e6b | 12,255 | py | Python | pyscf/pbc/cc/eom_kccsd_rhf_ip.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | 2 | 2019-05-28T05:25:56.000Z | 2019-11-09T02:16:43.000Z | pyscf/pbc/cc/eom_kccsd_rhf_ip.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | 2 | 2019-09-16T17:58:31.000Z | 2019-09-22T17:26:01.000Z | pyscf/pbc/cc/eom_kccsd_rhf_ip.py | crisely09/pyscf | cb92f7974bd9c87c0ef5b2b52abf5d3219b3d6b6 | [
"Apache-2.0"
] | 1 | 2019-11-09T02:13:16.000Z | 2019-11-09T02:13:16.000Z | #!/usr/bin/env python
# Copyright 2014-2018 The PySCF Developers. 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
#
# U... | 38.416928 | 115 | 0.548919 |
from pyscf.lib import logger, linalg_helper, einsum
from pyscf.lib.parameters import LARGE_DENOM
from pyscf.pbc.lib.kpts_helper import VectorSplitter, VectorComposer
from pyscf.pbc.mp.kmp2 import padding_k_idx
import numpy as np
import time
def iter_12(cc, k):
o, v = padding_k_idx(cc, kind="sp... | true | true |
1c445cab1f264bc0cde511b0887a73c7ef7e0b55 | 2,571 | py | Python | dizoo/smac/config/smac_10m11m_masac_config.py | davide97l/DI-engine | d48c93bcd5c07c29f2ce4ac1b7756b8bc255c423 | [
"Apache-2.0"
] | 1 | 2022-03-21T16:15:39.000Z | 2022-03-21T16:15:39.000Z | dizoo/smac/config/smac_10m11m_masac_config.py | jiaruonan/DI-engine | 268d77db3cb54401b2cfc83e2bc3ec87c31e7b83 | [
"Apache-2.0"
] | null | null | null | dizoo/smac/config/smac_10m11m_masac_config.py | jiaruonan/DI-engine | 268d77db3cb54401b2cfc83e2bc3ec87c31e7b83 | [
"Apache-2.0"
] | null | null | null | from easydict import EasyDict
agent_num = 10
collector_env_num = 8
evaluator_env_num = 8
special_global_state = True
SMAC_10m11m_masac_default_config = dict(
exp_name='smac_10m11m_masac_seed0',
env=dict(
map_name='10m_vs_11m',
difficulty=7,
reward_only_positive=True,
mirror_opp... | 27.063158 | 91 | 0.597044 | from easydict import EasyDict
agent_num = 10
collector_env_num = 8
evaluator_env_num = 8
special_global_state = True
SMAC_10m11m_masac_default_config = dict(
exp_name='smac_10m11m_masac_seed0',
env=dict(
map_name='10m_vs_11m',
difficulty=7,
reward_only_positive=True,
mirror_opp... | true | true |
1c445d0779c6f3b76f6736904e9cf3bc52dc1ec8 | 906 | py | Python | paddleseg/models/layers/__init__.py | JamesLim-sy/PaddleSeg | f8cfb80f543a52599d1588026e71f069b702b781 | [
"Apache-2.0"
] | 4,708 | 2019-08-26T13:54:39.000Z | 2022-03-31T16:01:53.000Z | paddleseg/models/layers/__init__.py | JamesLim-sy/PaddleSeg | f8cfb80f543a52599d1588026e71f069b702b781 | [
"Apache-2.0"
] | 1,083 | 2019-09-12T02:57:24.000Z | 2022-03-31T13:30:30.000Z | paddleseg/models/layers/__init__.py | JamesLim-sy/PaddleSeg | f8cfb80f543a52599d1588026e71f069b702b781 | [
"Apache-2.0"
] | 1,046 | 2019-08-26T22:05:01.000Z | 2022-03-30T14:09:28.000Z | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | 43.142857 | 110 | 0.791391 |
from .layer_libs import ConvBNReLU, ConvBN, SeparableConvBNReLU, DepthwiseConvBN, AuxLayer, SyncBatchNorm, JPU
from .activation import Activation
from .pyramid_pool import ASPPModule, PPModule
from .attention import AttentionBlock
from .nonlocal2d import NonLocal2D
from .wrap_functions import *
| true | true |
1c445ea6c0a52c6c28514c9caff9783dfe75ea10 | 18,183 | py | Python | tests/sc/test_scans.py | allenmichael/pyTenable | 8372cfdf3ced99de50227f6fbb37d6db2b26291e | [
"MIT"
] | null | null | null | tests/sc/test_scans.py | allenmichael/pyTenable | 8372cfdf3ced99de50227f6fbb37d6db2b26291e | [
"MIT"
] | null | null | null | tests/sc/test_scans.py | allenmichael/pyTenable | 8372cfdf3ced99de50227f6fbb37d6db2b26291e | [
"MIT"
] | null | null | null | import pytest
from tenable.errors import APIError, UnexpectedValueError
from ..checker import check
def test_schedule_constructor_type_typeerror(sc):
with pytest.raises(TypeError):
sc.scans._schedule_constructor({'type': 1})
def test_schedule_constructor_type_unexpected_value(sc):
with pytest.raise... | 32.644524 | 105 | 0.665512 | import pytest
from tenable.errors import APIError, UnexpectedValueError
from ..checker import check
def test_schedule_constructor_type_typeerror(sc):
with pytest.raises(TypeError):
sc.scans._schedule_constructor({'type': 1})
def test_schedule_constructor_type_unexpected_value(sc):
with pytest.raise... | true | true |
1c445eaf4b2ea2fc8a00bd7b0b9e80eef01719f8 | 1,179 | py | Python | pytglib/api/functions/set_sticker_set_thumbnail.py | iTeam-co/pytglib | e5e75e0a85f89b77762209b32a61b0a883c0ae61 | [
"MIT"
] | 6 | 2019-10-30T08:57:27.000Z | 2021-02-08T14:17:43.000Z | pytglib/api/functions/set_sticker_set_thumbnail.py | iTeam-co/python-telegram | e5e75e0a85f89b77762209b32a61b0a883c0ae61 | [
"MIT"
] | 1 | 2021-08-19T05:44:10.000Z | 2021-08-19T07:14:56.000Z | pytglib/api/functions/set_sticker_set_thumbnail.py | iTeam-co/python-telegram | e5e75e0a85f89b77762209b32a61b0a883c0ae61 | [
"MIT"
] | 5 | 2019-12-04T05:30:39.000Z | 2021-05-21T18:23:32.000Z |
from ..utils import Object
class SetStickerSetThumbnail(Object):
"""
Sets a sticker set thumbnail; for bots only. Returns the sticker set
Attributes:
ID (:obj:`str`): ``SetStickerSetThumbnail``
Args:
user_id (:obj:`int`):
Sticker set owner
name (:obj:`str`):
... | 28.756098 | 177 | 0.625106 |
from ..utils import Object
class SetStickerSetThumbnail(Object):
ID = "setStickerSetThumbnail"
def __init__(self, user_id, name, thumbnail, extra=None, **kwargs):
self.extra = extra
self.user_id = user_id
self.name = name
self.thumbnail = thumbnail
@staticmethod
... | true | true |
1c445eb15f606a0339ceffedf26e0ebbcac914b2 | 1,036 | py | Python | sagemaker-debugger/model_specific_realtime_analysis/cnn_class_activation_maps/entry_point/custom_hook.py | jerrypeng7773/amazon-sagemaker-examples | c5ddecce1f739a345465b9a38b064983a129141d | [
"Apache-2.0"
] | 2,610 | 2020-10-01T14:14:53.000Z | 2022-03-31T18:02:31.000Z | sagemaker-debugger/model_specific_realtime_analysis/cnn_class_activation_maps/entry_point/custom_hook.py | jerrypeng7773/amazon-sagemaker-examples | c5ddecce1f739a345465b9a38b064983a129141d | [
"Apache-2.0"
] | 1,959 | 2020-09-30T20:22:42.000Z | 2022-03-31T23:58:37.000Z | sagemaker-debugger/model_specific_realtime_analysis/cnn_class_activation_maps/entry_point/custom_hook.py | jerrypeng7773/amazon-sagemaker-examples | c5ddecce1f739a345465b9a38b064983a129141d | [
"Apache-2.0"
] | 2,052 | 2020-09-30T22:11:46.000Z | 2022-03-31T23:02:51.000Z | import smdebug.pytorch as smd
import torch
from smdebug.core.modes import ModeKeys
class CustomHook(smd.Hook):
# register input image for backward pass, to get image gradients
def image_gradients(self, image):
image.register_hook(self.backward_hook("image"))
def forward_hook(self, module, inputs... | 38.37037 | 103 | 0.696911 | import smdebug.pytorch as smd
import torch
from smdebug.core.modes import ModeKeys
class CustomHook(smd.Hook):
def image_gradients(self, image):
image.register_hook(self.backward_hook("image"))
def forward_hook(self, module, inputs, outputs):
module_name = self.module_maps[module]
... | true | true |
1c445f46b78f84e0666b4e389bddb6811327d7dd | 14,259 | py | Python | doc/conf.py | sunilkrdeep/LearningApacheSpark | 2aed1d06630eb17a5b6515658f15e29955a208bd | [
"MIT"
] | 213 | 2017-09-25T05:49:50.000Z | 2022-03-01T15:26:26.000Z | doc/conf.py | sunilkrdeep/LearningApacheSpark | 2aed1d06630eb17a5b6515658f15e29955a208bd | [
"MIT"
] | 4 | 2019-05-06T09:15:34.000Z | 2021-10-15T07:47:40.000Z | doc/conf.py | sunilkrdeep/LearningApacheSpark | 2aed1d06630eb17a5b6515658f15e29955a208bd | [
"MIT"
] | 92 | 2019-03-03T23:17:24.000Z | 2022-03-23T22:25:14.000Z | # -*- coding: utf-8 -*-
#############################################################################
# I heavily borrowed, modified and used the configuration in conf.py of Theano
# package project. I will keep all the comments from Theano team and the
# coryright of this file belongs to Theano team.
# reference:
#... | 37.822281 | 96 | 0.580125 |
ntities.
html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
#html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
#html_additional_pages = {}
# If false, no module index is generated.
#html_use_modindex = True
#... | true | true |
1c445f905b74048639cccb3e88f2f31191f6f596 | 151 | py | Python | print_quotient.py | gsandoval49/stp | b56e778101d29732adc4629e101cccf290dcb9e9 | [
"Apache-2.0"
] | null | null | null | print_quotient.py | gsandoval49/stp | b56e778101d29732adc4629e101cccf290dcb9e9 | [
"Apache-2.0"
] | null | null | null | print_quotient.py | gsandoval49/stp | b56e778101d29732adc4629e101cccf290dcb9e9 | [
"Apache-2.0"
] | null | null | null | # Create a program that takes two variables, divides them,
# and prints the quotient.
x = 42
y = 2
if x == 42:
if y == 2:
print (x // y)
| 15.1 | 58 | 0.576159 |
x = 42
y = 2
if x == 42:
if y == 2:
print (x // y)
| true | true |
1c4460629d5ab0bb165c86640050ec517f98b099 | 645 | py | Python | .venv/bin/rst2pseudoxml.py | WealtHawk-prod/WH_Utils | 713b464a4a0971c8d5bc9bebc2e68f129ec65a4c | [
"Apache-2.0"
] | null | null | null | .venv/bin/rst2pseudoxml.py | WealtHawk-prod/WH_Utils | 713b464a4a0971c8d5bc9bebc2e68f129ec65a4c | [
"Apache-2.0"
] | null | null | null | .venv/bin/rst2pseudoxml.py | WealtHawk-prod/WH_Utils | 713b464a4a0971c8d5bc9bebc2e68f129ec65a4c | [
"Apache-2.0"
] | null | null | null | #!/Users/mcclainthiel/Desktop/WH/WH_Utils2/.venv/bin/python3.9
# $Id: rst2pseudoxml.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
A minimal front end to the Docutils Publisher, producing pseudo-XML.
"""
try:
... | 26.875 | 73 | 0.744186 |
try:
import locale
locale.setlocale(locale.LC_ALL, '')
except:
pass
from docutils.core import publish_cmdline, default_description
description = ('Generates pseudo-XML from standalone reStructuredText '
'sources (for testing purposes). ' + default_description)
publish_cmdline(desc... | true | true |
1c4460c9572f72b3583be0b06bb5fb540edd3e8f | 6,720 | py | Python | std/pytorch/02-mid/05.py | quantapix/qnarre.com | f51d5945c20ef8182c4aa11f1b407d064c190c70 | [
"MIT"
] | null | null | null | std/pytorch/02-mid/05.py | quantapix/qnarre.com | f51d5945c20ef8182c4aa11f1b407d064c190c70 | [
"MIT"
] | null | null | null | std/pytorch/02-mid/05.py | quantapix/qnarre.com | f51d5945c20ef8182c4aa11f1b407d064c190c70 | [
"MIT"
] | null | null | null | import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple, deque
from itertools import count
from PIL import Image
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transfo... | 29.217391 | 94 | 0.67381 | import gym
import math
import random
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from collections import namedtuple, deque
from itertools import count
from PIL import Image
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torchvision.transfo... | true | true |
1c44615358567d6477f3746171bffef3935d9cc3 | 36,393 | py | Python | tools/serve/serve.py | karlcow/wpt | e48be6d08b272744fe6d1d28e91a5808cf92fb68 | [
"BSD-3-Clause"
] | null | null | null | tools/serve/serve.py | karlcow/wpt | e48be6d08b272744fe6d1d28e91a5808cf92fb68 | [
"BSD-3-Clause"
] | null | null | null | tools/serve/serve.py | karlcow/wpt | e48be6d08b272744fe6d1d28e91a5808cf92fb68 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import print_function
import abc
import argparse
import json
import logging
import os
import platform
import signal
import socket
import subprocess
import sys
import threading
import time
import traceback
from six.moves import urllib
import uuid
from collections import defaultd... | 35.890533 | 141 | 0.577666 |
from __future__ import print_function
import abc
import argparse
import json
import logging
import os
import platform
import signal
import socket
import subprocess
import sys
import threading
import time
import traceback
from six.moves import urllib
import uuid
from collections import defaultdict, OrderedDict
from i... | true | true |
1c44615cab2746c171e94d3955b5d0b53fc86e1b | 1,605 | py | Python | Vision/oneflow_face/utils/losses.py | mls1999725/models | 77b3a9d727cb7cf3a14a75d8fdb0d17bb411bd02 | [
"Apache-2.0"
] | 43 | 2021-06-03T09:07:08.000Z | 2022-03-31T15:21:48.000Z | Vision/oneflow_face/utils/losses.py | mls1999725/models | 77b3a9d727cb7cf3a14a75d8fdb0d17bb411bd02 | [
"Apache-2.0"
] | 64 | 2021-05-31T10:34:06.000Z | 2022-01-17T03:44:58.000Z | Vision/oneflow_face/utils/losses.py | mls1999725/models | 77b3a9d727cb7cf3a14a75d8fdb0d17bb411bd02 | [
"Apache-2.0"
] | 37 | 2021-07-04T03:13:18.000Z | 2022-03-25T07:30:47.000Z | import oneflow as flow
from oneflow import nn
def get_loss(name):
if name == "cosface":
return CosFace()
elif name == "arcface":
return ArcFace()
else:
raise ValueError()
class CrossEntropyLoss_sbp(nn.Module):
def __init__(self):
super(CrossEntropyLoss_sbp, self).__in... | 25.078125 | 83 | 0.586293 | import oneflow as flow
from oneflow import nn
def get_loss(name):
if name == "cosface":
return CosFace()
elif name == "arcface":
return ArcFace()
else:
raise ValueError()
class CrossEntropyLoss_sbp(nn.Module):
def __init__(self):
super(CrossEntropyLoss_sbp, self).__in... | true | true |
1c44621189b941c48d02923714b5af63f0aad611 | 9,678 | py | Python | info/modules/news/views.py | wangjinyu124419/xinjing | 205dd890b5d0baeae5935dfe24bd0208808e7e2b | [
"MIT"
] | null | null | null | info/modules/news/views.py | wangjinyu124419/xinjing | 205dd890b5d0baeae5935dfe24bd0208808e7e2b | [
"MIT"
] | null | null | null | info/modules/news/views.py | wangjinyu124419/xinjing | 205dd890b5d0baeae5935dfe24bd0208808e7e2b | [
"MIT"
] | null | null | null | import logging
from flask import abort
from flask import g
from flask import request
from flask import session, jsonify
from info import constants, db
from info import response_code
from info.models import User, News,Comment, CommentLike
from info.utils.comment import user_login_data
from . import blue_news
from flask... | 29.238671 | 106 | 0.656851 | import logging
from flask import abort
from flask import g
from flask import request
from flask import session, jsonify
from info import constants, db
from info import response_code
from info.models import User, News,Comment, CommentLike
from info.utils.comment import user_login_data
from . import blue_news
from flask... | true | true |
1c44627afca4e7d3f07b38ceb7c7b9103a678669 | 1,590 | py | Python | FluentPython/pythonic_object/vector2d.py | xu6148152/Binea_Python_Project | d943eb5f4685d08f080b372dcf1a7cbd5d63efed | [
"MIT"
] | null | null | null | FluentPython/pythonic_object/vector2d.py | xu6148152/Binea_Python_Project | d943eb5f4685d08f080b372dcf1a7cbd5d63efed | [
"MIT"
] | null | null | null | FluentPython/pythonic_object/vector2d.py | xu6148152/Binea_Python_Project | d943eb5f4685d08f080b372dcf1a7cbd5d63efed | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- encoding: utf-8 -*-
from array import array
import math
class Vector2d:
__slots__ = ('__x', '__y')
typecode = 'd'
def __init__(self, x, y):
self.__x = x
self.__y = y
def __repr__(self):
class_name = type(self).__name__
return '{}({!r}, {... | 22.714286 | 78 | 0.561635 |
from array import array
import math
class Vector2d:
__slots__ = ('__x', '__y')
typecode = 'd'
def __init__(self, x, y):
self.__x = x
self.__y = y
def __repr__(self):
class_name = type(self).__name__
return '{}({!r}, {!r})'.format(class_name, *self)
def __str_... | true | true |
1c4462df77242b80107f725e68f97cb39f16c436 | 1,408 | py | Python | setup.py | penguinstampede/shippo-python-client | d21366d959d22ff301947072346479c287bf0f51 | [
"MIT"
] | 101 | 2015-10-10T18:44:36.000Z | 2022-01-26T03:54:27.000Z | setup.py | penguinstampede/shippo-python-client | d21366d959d22ff301947072346479c287bf0f51 | [
"MIT"
] | 47 | 2015-08-07T21:13:50.000Z | 2022-03-08T18:48:16.000Z | setup.py | penguinstampede/shippo-python-client | d21366d959d22ff301947072346479c287bf0f51 | [
"MIT"
] | 71 | 2015-10-31T01:54:09.000Z | 2022-02-17T22:43:30.000Z | import os
import sys
import warnings
from setuptools import setup
version_contents = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f:
exec(f.read(), version_contents)
setup(
name='shippo',
version=version_contents['VERSION... | 33.52381 | 77 | 0.620028 | import os
import sys
import warnings
from setuptools import setup
version_contents = {}
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "shippo", "version.py"), encoding="utf-8") as f:
exec(f.read(), version_contents)
setup(
name='shippo',
version=version_contents['VERSION... | true | true |
1c4462e887341137a81c3efd2fa98f4ce8952bfa | 2,882 | py | Python | tensorpack/models/layer_norm.py | myelintek/tensorpack | fcbf5869d78cf7f3b59c46318b6c883a7ea12056 | [
"Apache-2.0"
] | 3 | 2017-12-02T16:49:42.000Z | 2018-11-04T16:53:44.000Z | tensorpack/models/layer_norm.py | dongzhuoyao/tensorpack | 78bcf6053172075a761eac90ab22f0b631b272a0 | [
"Apache-2.0"
] | 6 | 2020-01-28T23:03:24.000Z | 2022-02-10T01:21:18.000Z | tensorpack/models/layer_norm.py | wdings/Mask-RCNN | 8d5ae5cc2cfcf2e4e53b4d1064ac9e727f736d09 | [
"Apache-2.0"
] | 5 | 2017-11-15T14:46:27.000Z | 2018-11-04T16:54:06.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: layer_norm.py
# Author: Yuxin Wu <ppwwyyxxc@gmail.com>
import tensorflow as tf
from .common import layer_register
__all__ = ['LayerNorm', 'InstanceNorm']
@layer_register()
def LayerNorm(x, epsilon=1e-5, use_bias=True, use_scale=True, data_format='NHWC'):
"""... | 33.126437 | 90 | 0.630812 |
import tensorflow as tf
from .common import layer_register
__all__ = ['LayerNorm', 'InstanceNorm']
@layer_register()
def LayerNorm(x, epsilon=1e-5, use_bias=True, use_scale=True, data_format='NHWC'):
shape = x.get_shape().as_list()
ndims = len(shape)
assert ndims in [2, 4]
mean, var = tf.nn.mom... | true | true |
1c4462e988a95308633ced6d419f8d86daa04317 | 6,331 | py | Python | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_percentile_operations.py | santosh02iiit/azure-cli-extensions | 24247cfa19e2a5894937f19e17fbdc8308b28ef6 | [
"MIT"
] | 1 | 2021-08-03T18:32:54.000Z | 2021-08-03T18:32:54.000Z | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_percentile_operations.py | santosh02iiit/azure-cli-extensions | 24247cfa19e2a5894937f19e17fbdc8308b28ef6 | [
"MIT"
] | 4 | 2020-09-07T12:56:24.000Z | 2021-02-04T12:19:20.000Z | src/cosmosdb-preview/azext_cosmosdb_preview/vendored_sdks/azure_mgmt_cosmosdb/operations/_percentile_operations.py | santosh02iiit/azure-cli-extensions | 24247cfa19e2a5894937f19e17fbdc8308b28ef6 | [
"MIT"
] | 2 | 2021-09-22T08:25:32.000Z | 2021-09-24T06:55:31.000Z | # 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.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | 49.077519 | 202 | 0.660559 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport impor... | true | true |
1c44634315c59aaee3c879a33d1c2528c3e083a0 | 2,915 | py | Python | twentysecond.py | MSQFuersti/aoc2020 | f5e163c426a6c481d645ace2cc8af7c493306291 | [
"MIT"
] | null | null | null | twentysecond.py | MSQFuersti/aoc2020 | f5e163c426a6c481d645ace2cc8af7c493306291 | [
"MIT"
] | null | null | null | twentysecond.py | MSQFuersti/aoc2020 | f5e163c426a6c481d645ace2cc8af7c493306291 | [
"MIT"
] | null | null | null | import csv
import copy
def getCsv(txtFileName='twentysecond.txt'):
with open(txtFileName) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=' ')
return list(csv_reader)
def parseCardDecks(csvFile):
playerOne = []
playerTwo = []
isFirst = True
for row in csvFile:
i... | 28.861386 | 100 | 0.633276 | import csv
import copy
def getCsv(txtFileName='twentysecond.txt'):
with open(txtFileName) as csv_file:
csv_reader = csv.reader(csv_file, delimiter=' ')
return list(csv_reader)
def parseCardDecks(csvFile):
playerOne = []
playerTwo = []
isFirst = True
for row in csvFile:
i... | true | true |
1c44638e5289159fd6642dbde2d28bf744b91d3c | 72 | py | Python | apriori_python/__init__.py | ablarry/apriori_python | c460d6bf87848a2823923dca720df6183bd334cc | [
"MIT"
] | 41 | 2020-10-25T15:03:58.000Z | 2022-03-18T02:43:27.000Z | apriori_python/__init__.py | ablarry/apriori_python | c460d6bf87848a2823923dca720df6183bd334cc | [
"MIT"
] | 1 | 2021-05-18T07:53:05.000Z | 2021-05-21T19:09:42.000Z | apriori_python/__init__.py | ablarry/apriori_python | c460d6bf87848a2823923dca720df6183bd334cc | [
"MIT"
] | 22 | 2020-12-13T13:34:21.000Z | 2022-02-05T19:36:57.000Z | from apriori_python.apriori import *
from apriori_python.utils import * | 36 | 37 | 0.833333 | from apriori_python.apriori import *
from apriori_python.utils import * | true | true |
1c44646f843cea9fb6ce2b8eab0852efc6aca10c | 299 | py | Python | ex003.py | rezende-marcus/PythonExercicios | 82deed6e10c1bb47ac63a3a8889d56582ab7a718 | [
"MIT"
] | null | null | null | ex003.py | rezende-marcus/PythonExercicios | 82deed6e10c1bb47ac63a3a8889d56582ab7a718 | [
"MIT"
] | null | null | null | ex003.py | rezende-marcus/PythonExercicios | 82deed6e10c1bb47ac63a3a8889d56582ab7a718 | [
"MIT"
] | null | null | null | # n1 = input('Digite um valor: ')
# n2 = input('Digite outro valor: ')
# s = n1 + n2
# print('A soma entre {} e {} é igual a {}!'.format(n1, n2, s))
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
s = n1 + n2
print('A soma entre {} e {} é igual a {}!'.format(n1, n2, s)) | 37.375 | 63 | 0.568562 |
n1 = int(input('Digite um valor: '))
n2 = int(input('Digite outro valor: '))
s = n1 + n2
print('A soma entre {} e {} é igual a {}!'.format(n1, n2, s)) | true | true |
1c446470ca7bdbc10b3f8ec6dcaba559b291e735 | 4,849 | py | Python | twext/internet/fswatch.py | troglodyne/ccs-twistedextensions | 1b43cb081ba68ae310140a9e853e041cd6362625 | [
"Apache-2.0"
] | 23 | 2016-08-14T07:20:27.000Z | 2021-11-08T09:47:45.000Z | twext/internet/fswatch.py | DalavanCloud/ccs-twistedextensions | 2c4046df88873dcf33fba7840ed90e4238dcbec7 | [
"Apache-2.0"
] | 2 | 2016-12-15T17:51:49.000Z | 2019-05-12T15:59:03.000Z | twext/internet/fswatch.py | DalavanCloud/ccs-twistedextensions | 2c4046df88873dcf33fba7840ed90e4238dcbec7 | [
"Apache-2.0"
] | 20 | 2016-08-17T06:51:00.000Z | 2022-03-26T11:55:56.000Z | ##
# Copyright (c) 2013-2017 Apple 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 l... | 29.932099 | 76 | 0.622603 |
import os
from zope.interface import Interface
from twisted.internet import reactor
from twisted.python.log import Logger
try:
from select import (
kevent, KQ_FILTER_VNODE, KQ_EV_ADD, KQ_EV_ENABLE,
KQ_EV_CLEAR, KQ_NOTE_DELETE, KQ_NOTE_RENAME, KQ_EV_EOF
)
kqueueSupported = Tru... | true | true |
1c44647222191c391e494faa2f304c10eae6fbf7 | 9,471 | py | Python | bluesky_browser/viewer/viewer.py | EliotGann/bluesky-browser | e86e259c21d6dbeb781f32de8485f706b3b17bdc | [
"BSD-3-Clause"
] | null | null | null | bluesky_browser/viewer/viewer.py | EliotGann/bluesky-browser | e86e259c21d6dbeb781f32de8485f706b3b17bdc | [
"BSD-3-Clause"
] | null | null | null | bluesky_browser/viewer/viewer.py | EliotGann/bluesky-browser | e86e259c21d6dbeb781f32de8485f706b3b17bdc | [
"BSD-3-Clause"
] | null | null | null | import collections
import enum
from functools import partial
import itertools
import logging
from event_model import RunRouter, Filler
from intake_bluesky.core import parse_handler_registry
from qtpy.QtCore import Signal, QThread
from qtpy.QtWidgets import (
QAction,
QActionGroup,
QInputDialog,
QVBoxLa... | 35.339552 | 109 | 0.629606 | import collections
import enum
from functools import partial
import itertools
import logging
from event_model import RunRouter, Filler
from intake_bluesky.core import parse_handler_registry
from qtpy.QtCore import Signal, QThread
from qtpy.QtWidgets import (
QAction,
QActionGroup,
QInputDialog,
QVBoxLa... | true | true |
1c44648c4b45e9fcff2f7d4448d645a78980e555 | 261 | py | Python | apps/splash/api/serializers.py | Kpaubert/onlineweb4 | 9ac79f163bc3a816db57ffa8477ea88770d97807 | [
"MIT"
] | 32 | 2017-02-22T13:38:38.000Z | 2022-03-31T23:29:54.000Z | apps/splash/api/serializers.py | Kpaubert/onlineweb4 | 9ac79f163bc3a816db57ffa8477ea88770d97807 | [
"MIT"
] | 694 | 2017-02-15T23:09:52.000Z | 2022-03-31T23:16:07.000Z | apps/splash/api/serializers.py | Kpaubert/onlineweb4 | 9ac79f163bc3a816db57ffa8477ea88770d97807 | [
"MIT"
] | 35 | 2017-09-02T21:13:09.000Z | 2022-02-21T11:30:30.000Z | from rest_framework.serializers import ModelSerializer
from apps.splash.models import SplashEvent
class SplashEventSerializer(ModelSerializer):
class Meta:
model = SplashEvent
fields = ("id", "title", "content", "start_time", "end_time")
| 26.1 | 69 | 0.731801 | from rest_framework.serializers import ModelSerializer
from apps.splash.models import SplashEvent
class SplashEventSerializer(ModelSerializer):
class Meta:
model = SplashEvent
fields = ("id", "title", "content", "start_time", "end_time")
| true | true |
1c4465651a88a27dd1226447cce30e3be39112c4 | 687 | py | Python | src/cms/utils/translation_utils.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | null | null | null | src/cms/utils/translation_utils.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | 5 | 2021-02-10T02:41:20.000Z | 2022-03-12T00:56:56.000Z | src/cms/utils/translation_utils.py | mckinly/cms-django | c9995a3bfab6ee2d02f2406a7f83cf91b7ccfcca | [
"Apache-2.0"
] | null | null | null | """
This module contains helpers for the translation process.
"""
from django.utils.text import format_lazy
def ugettext_many_lazy(*strings):
"""
This function is a wrapper for :func:`django.utils.text.format_lazy` for the special case that the given strings
should be concatenated with a space in between.... | 32.714286 | 117 | 0.726346 | from django.utils.text import format_lazy
def ugettext_many_lazy(*strings):
fstring = ("{} " * len(strings)).strip()
return format_lazy(fstring, *strings)
| true | true |
1c4465c58914ba00924c3db332f745c7350c02b5 | 5,321 | py | Python | sandbox/mixed_poisson_hypre_2d.py | MiroK/fenics_ii | 58c41f0e8dba720962830395851e081b057269cc | [
"MIT"
] | 10 | 2017-06-22T21:05:17.000Z | 2020-09-25T08:36:59.000Z | sandbox/mixed_poisson_hypre_2d.py | MiroK/fenics_ii | 58c41f0e8dba720962830395851e081b057269cc | [
"MIT"
] | 2 | 2018-04-14T08:43:59.000Z | 2018-09-19T14:51:46.000Z | sandbox/mixed_poisson_hypre_2d.py | MiroK/fenics_ii | 58c41f0e8dba720962830395851e081b057269cc | [
"MIT"
] | 6 | 2018-04-13T20:33:53.000Z | 2020-09-25T08:37:01.000Z | from dolfin import *
from petsc4py import PETSc
from mpi4py import MPI as pyMPI
from sympy.printing import ccode
import sympy as sp
import numpy as np
from block import block_assemble, block_mat
from block.iterative import MinRes
from block.algebraic.petsc import LU, LumpedInvDiag
from block.block_base import block_ba... | 28.454545 | 85 | 0.577147 | from dolfin import *
from petsc4py import PETSc
from mpi4py import MPI as pyMPI
from sympy.printing import ccode
import sympy as sp
import numpy as np
from block import block_assemble, block_mat
from block.iterative import MinRes
from block.algebraic.petsc import LU, LumpedInvDiag
from block.block_base import block_ba... | true | true |
1c4465f3d1f0ed123bf563d4a6cfd6d59515b5f0 | 25,549 | py | Python | 1115201800312_project3/main.py | TollisK/AI-Berkley-CS188-Solutions | 61de22110afdee9c60d00a0c6f612a50db5997d4 | [
"MIT"
] | 1 | 2022-01-09T17:33:26.000Z | 2022-01-09T17:33:26.000Z | 1115201800312_project3/main.py | TollisK/AI-Berkley-CS188-Solutions | 61de22110afdee9c60d00a0c6f612a50db5997d4 | [
"MIT"
] | null | null | null | 1115201800312_project3/main.py | TollisK/AI-Berkley-CS188-Solutions | 61de22110afdee9c60d00a0c6f612a50db5997d4 | [
"MIT"
] | null | null | null | import itertools
import random
import re
import string
from collections import defaultdict, Counter
from functools import reduce
from operator import eq, neg
import time
# from sortedcontainers import SortedSet
import search
from utils import argmin_random_tie, count, first, extend
variables = []
doma... | 37.682891 | 137 | 0.594309 | import itertools
import random
import re
import string
from collections import defaultdict, Counter
from functools import reduce
from operator import eq, neg
import time
import search
from utils import argmin_random_tie, count, first, extend
variables = []
domains = {}
domtemp = {}
template = []
co... | true | true |
1c4466253e969a18fb0c6d7010f4d599e9cba409 | 598 | py | Python | aulas/aula34/pessoa.py | Biguelini/Curso-Python-3 | 0b5df350f5901262927b11b6f2b9b215176808ff | [
"MIT"
] | null | null | null | aulas/aula34/pessoa.py | Biguelini/Curso-Python-3 | 0b5df350f5901262927b11b6f2b9b215176808ff | [
"MIT"
] | null | null | null | aulas/aula34/pessoa.py | Biguelini/Curso-Python-3 | 0b5df350f5901262927b11b6f2b9b215176808ff | [
"MIT"
] | null | null | null | from random import randint
class Pessoa:
ano_atual = 2021
def __init__(self, nome,idade):
self.nome = nome
self.idade = idade
def get_ano_nascimento(self):
print(self.ano_atual - self.idade)
@classmethod
def por_ano_nascimento(cls, nome, ano_nascimento):
id... | 26 | 54 | 0.645485 | from random import randint
class Pessoa:
ano_atual = 2021
def __init__(self, nome,idade):
self.nome = nome
self.idade = idade
def get_ano_nascimento(self):
print(self.ano_atual - self.idade)
@classmethod
def por_ano_nascimento(cls, nome, ano_nascimento):
id... | true | true |
1c4466dc29d29af161d0a6e91e4f0ea8538ec7f8 | 649 | py | Python | tests/Test_Deque.py | p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | [
"MIT"
] | 4,461 | 2019-01-13T02:06:25.000Z | 2022-03-31T11:50:11.000Z | tests/Test_Deque.py | p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | [
"MIT"
] | 66 | 2019-01-17T10:36:21.000Z | 2022-02-22T21:29:30.000Z | tests/Test_Deque.py | p-christ/Deep-Reinforcement-Learning-PyTorch-Algorithms | 135d3e2e06bbde2868047d738e3fc2d73fd8cc93 | [
"MIT"
] | 1,051 | 2019-01-13T17:30:49.000Z | 2022-03-31T03:33:00.000Z | from utilities.data_structures.Deque import Deque
from utilities.data_structures.Node import Node
def test_Deque_initialisation():
deque = Deque(2, 1)
assert all(deque.deque == [Node(0, (None,)), Node(0, (None,))])
def test_Deque_adding_elements():
deque = Deque(2, 1)
deque.add_element_to_deque(3, ... | 25.96 | 67 | 0.671803 | from utilities.data_structures.Deque import Deque
from utilities.data_structures.Node import Node
def test_Deque_initialisation():
deque = Deque(2, 1)
assert all(deque.deque == [Node(0, (None,)), Node(0, (None,))])
def test_Deque_adding_elements():
deque = Deque(2, 1)
deque.add_element_to_deque(3, ... | true | true |
1c4467414998af56816a2597349b7bc99489b16f | 899 | py | Python | tests/virtualenv_test.py | lsst-sqre/neophile | 0923bd5b58851af13c09f73a05b1a2882434b437 | [
"MIT"
] | null | null | null | tests/virtualenv_test.py | lsst-sqre/neophile | 0923bd5b58851af13c09f73a05b1a2882434b437 | [
"MIT"
] | 23 | 2020-07-17T23:27:44.000Z | 2022-03-21T19:39:19.000Z | tests/virtualenv_test.py | lsst-sqre/neophile | 0923bd5b58851af13c09f73a05b1a2882434b437 | [
"MIT"
] | null | null | null | """Tests for the VirtualEnv class."""
from __future__ import annotations
from typing import TYPE_CHECKING
from neophile.virtualenv import VirtualEnv
if TYPE_CHECKING:
from pathlib import Path
def test_provided_env(tmp_path: Path) -> None:
"""Test virtualenv execution with an env parameter."""
venv_pat... | 26.441176 | 69 | 0.657397 |
from __future__ import annotations
from typing import TYPE_CHECKING
from neophile.virtualenv import VirtualEnv
if TYPE_CHECKING:
from pathlib import Path
def test_provided_env(tmp_path: Path) -> None:
venv_path = tmp_path / "venv"
venv = VirtualEnv(venv_path)
result = venv.run(
["/bin/sh",... | true | true |
1c4468ba33418923dca05c70f0096dda2c4a0a8d | 1,953 | py | Python | src/SlowSort.py | LC-John/Sorting | c34ab338a910a12def0db426495a97b5170b971b | [
"MIT"
] | 6 | 2018-12-19T02:33:10.000Z | 2020-10-31T07:59:37.000Z | src/SlowSort.py | LC-John/Sorting | c34ab338a910a12def0db426495a97b5170b971b | [
"MIT"
] | null | null | null | src/SlowSort.py | LC-John/Sorting | c34ab338a910a12def0db426495a97b5170b971b | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 23 13:55:02 2018
@author: zhanghuangzhao
"""
import numpy
import copy
import os, shutil
import imageio
import matplotlib.pyplot as plt
size = 8
arr = None
def SlowSort(a, idx_begin, idx_end, reverse=False):
a = copy.deepcopy(a)
... | 27.125 | 98 | 0.578597 |
import numpy
import copy
import os, shutil
import imageio
import matplotlib.pyplot as plt
size = 8
arr = None
def SlowSort(a, idx_begin, idx_end, reverse=False):
a = copy.deepcopy(a)
proc = []
if idx_begin >= idx_end:
return a, proc
idx_mid = int(numpy.floor((idx_begin+... | true | true |
1c446903979e95fbda6b6f8fa1fb9b6a5d5810b9 | 421 | py | Python | migrations/192-remove-old-aoa-stats.py | storagebot/kitsune | 613ba2ca09104f330ab77088b452391169096249 | [
"BSD-3-Clause"
] | 2 | 2019-08-19T17:08:47.000Z | 2019-10-05T11:37:02.000Z | migrations/192-remove-old-aoa-stats.py | taliasman/kitsune | f8085205eef143011adb4c52d1f183da06c1c58e | [
"BSD-3-Clause"
] | null | null | null | migrations/192-remove-old-aoa-stats.py | taliasman/kitsune | f8085205eef143011adb4c52d1f183da06c1c58e | [
"BSD-3-Clause"
] | null | null | null | from django.conf import settings
from sumo.redis_utils import redis_client, RedisError
from customercare.cron import get_customercare_stats
try:
print "Removing old data"
redis = redis_client(name='default')
redis.delete(settings.CC_TOP_CONTRIB_CACHE_KEY)
print "Collecting new data."
get_customer... | 24.764706 | 53 | 0.764846 | from django.conf import settings
from sumo.redis_utils import redis_client, RedisError
from customercare.cron import get_customercare_stats
try:
print "Removing old data"
redis = redis_client(name='default')
redis.delete(settings.CC_TOP_CONTRIB_CACHE_KEY)
print "Collecting new data."
get_customer... | false | true |
1c44692d32c53253146a108f2c5bcf7a2cb3f282 | 1,112 | py | Python | website/backend/webserver/api/views/templates.py | ModelFlow/modelflow | c2b720b2da8bb17462baff5c00bbe942644474b0 | [
"MIT"
] | 6 | 2020-07-28T19:58:28.000Z | 2021-05-01T18:51:37.000Z | website/backend/webserver/api/views/templates.py | ModelFlow/modelflow | c2b720b2da8bb17462baff5c00bbe942644474b0 | [
"MIT"
] | 81 | 2020-07-30T07:08:10.000Z | 2021-07-28T02:17:43.000Z | website/backend/webserver/api/views/templates.py | ModelFlow/modelflow | c2b720b2da8bb17462baff5c00bbe942644474b0 | [
"MIT"
] | null | null | null | from django.http import JsonResponse
from ..models import Template, Scenario
# NOTE: I think this can be deleted and be replaced by django rest framework
def get_templates_metadata(request):
"""
Get the templates for a project from a lookup on the scenario id. This
is because we only have access to the s... | 39.714286 | 88 | 0.705935 | from django.http import JsonResponse
from ..models import Template, Scenario
def get_templates_metadata(request):
scenario_id = request.GET.get('scenario_id', None)
if not scenario_id:
return JsonResponse({'error': 'Need to provide scenario_id'})
scenario = Scenario.objects.filter(id=int(scenari... | true | true |
1c44698371ca5ba90c2733e4531b2202c0837f98 | 1,910 | py | Python | contrib/devtools/check-doc.py | Masternode-Hype-Coin-Exchange/MHCE | ddf6f6dc95162721dccf17cc674af421035b78f6 | [
"MIT"
] | 1 | 2021-09-04T04:24:38.000Z | 2021-09-04T04:24:38.000Z | contrib/devtools/check-doc.py | Masternode-Hype-Coin-Exchange/MHCE | ddf6f6dc95162721dccf17cc674af421035b78f6 | [
"MIT"
] | null | null | null | contrib/devtools/check-doc.py | Masternode-Hype-Coin-Exchange/MHCE | ddf6f6dc95162721dccf17cc674af421035b78f6 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @... | 42.444444 | 299 | 0.690052 |
'''
This checks if all command line args are documented.
Return value is 0 to indicate no error.
Author: @MarcoFalke
'''
from subprocess import check_output
import re
FOLDER_GREP = 'src'
FOLDER_TEST = 'src/test/'
CMD_ROOT_DIR = '`git rev-parse --show-toplevel`/%s' % FOLDER_GREP
CMD_GREP_ARGS = r"egrep -r -I '(ma... | false | true |
1c44698c1a36059851b7d59d1a9db5fef3c470ba | 294 | py | Python | body/testbody.py | sherry0429/TornadoLayer | c58f3bbd9f409fd8506f30d3002499b294ff7303 | [
"Apache-2.0"
] | null | null | null | body/testbody.py | sherry0429/TornadoLayer | c58f3bbd9f409fd8506f30d3002499b294ff7303 | [
"Apache-2.0"
] | null | null | null | body/testbody.py | sherry0429/TornadoLayer | c58f3bbd9f409fd8506f30d3002499b294ff7303 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Copyright (C) 2017 tianyou pan <sherry0429 at SOAPython>
"""
from tornado_layer import BaseHttpBody
class TestMessageBody(BaseHttpBody):
data = "i am test data"
def __init__(self, url, method):
super(TestMessageBody, self).__init__(url, method)
| 19.6 | 58 | 0.687075 |
from tornado_layer import BaseHttpBody
class TestMessageBody(BaseHttpBody):
data = "i am test data"
def __init__(self, url, method):
super(TestMessageBody, self).__init__(url, method)
| true | true |
1c446a89bba32565bdf40122d1a561b1a162328f | 438 | py | Python | molsysmt/tools/mdanalysis_Universe/to_molsysmt_Trajectory.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | molsysmt/tools/mdanalysis_Universe/to_molsysmt_Trajectory.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | molsysmt/tools/mdanalysis_Universe/to_molsysmt_Trajectory.py | dprada/molsysmt | 83f150bfe3cfa7603566a0ed4aed79d9b0c97f5d | [
"MIT"
] | null | null | null | def to_molsysmt_Trajectory(item, selection='all', frame_indices='all', syntaxis='MolSysMT'):
from molsysmt.tools.mdanalysis_Universe import is_mdanalysis_Universe
from molsysmt.basic import convert
if not is_mdanalysis_Universe(item):
raise ValueError
tmp_item = convert(item, to_form='molsysm... | 31.285714 | 92 | 0.755708 | def to_molsysmt_Trajectory(item, selection='all', frame_indices='all', syntaxis='MolSysMT'):
from molsysmt.tools.mdanalysis_Universe import is_mdanalysis_Universe
from molsysmt.basic import convert
if not is_mdanalysis_Universe(item):
raise ValueError
tmp_item = convert(item, to_form='molsysm... | true | true |
1c446b141031895ba08007681fefd9346f8b0dac | 999 | py | Python | deployment/util_code/doc2vec_vectorizer.py | XC-Li/FiscalNote_Project | a8343f22156f619f2c8fe9102e6df684d1b4c97f | [
"MIT"
] | 1 | 2019-08-26T01:48:02.000Z | 2019-08-26T01:48:02.000Z | deployment/util_code/doc2vec_vectorizer.py | XC-Li/FiscalNote_Project | a8343f22156f619f2c8fe9102e6df684d1b4c97f | [
"MIT"
] | null | null | null | deployment/util_code/doc2vec_vectorizer.py | XC-Li/FiscalNote_Project | a8343f22156f619f2c8fe9102e6df684d1b4c97f | [
"MIT"
] | 1 | 2021-02-12T14:57:41.000Z | 2021-02-12T14:57:41.000Z | """By: Xiaochi (George) Li: github.com/XC-Li"""
from gensim.models.doc2vec import Doc2Vec
import numpy as np
from scipy.sparse import hstack as sparse_hstack
class D2V(object):
def __init__(self, file):
self.model = Doc2Vec.load(file)
def fit(self, X):
pass
def transform(self, X):
... | 24.975 | 56 | 0.620621 | from gensim.models.doc2vec import Doc2Vec
import numpy as np
from scipy.sparse import hstack as sparse_hstack
class D2V(object):
def __init__(self, file):
self.model = Doc2Vec.load(file)
def fit(self, X):
pass
def transform(self, X):
temp = []
for speech in X:
... | true | true |
1c446ba5c4b308ca1c5d968bc183ff8711ec453b | 323 | py | Python | appengine/predator/frontend/handlers/fracas_result_feedback.py | mcgreevy/chromium-infra | 09064105713603f7bf75c772e8354800a1bfa256 | [
"BSD-3-Clause"
] | 1 | 2018-01-02T05:47:07.000Z | 2018-01-02T05:47:07.000Z | appengine/predator/frontend/handlers/fracas_result_feedback.py | mcgreevy/chromium-infra | 09064105713603f7bf75c772e8354800a1bfa256 | [
"BSD-3-Clause"
] | null | null | null | appengine/predator/frontend/handlers/fracas_result_feedback.py | mcgreevy/chromium-infra | 09064105713603f7bf75c772e8354800a1bfa256 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from frontend.handlers.result_feedback import ResultFeedback
class FracasResultFeedback(ResultFeedback):
@property
def client(self):
return 'fraca... | 24.846154 | 72 | 0.780186 |
from frontend.handlers.result_feedback import ResultFeedback
class FracasResultFeedback(ResultFeedback):
@property
def client(self):
return 'fracas'
| true | true |
1c446c08fda3e987130a4789309ad6cc490f6da8 | 3,132 | py | Python | modeling/net.py | cpratim/DALI-Data-Challenge | ad0d6d048abb240dd2316ff70590606bd2d8c44f | [
"MIT"
] | null | null | null | modeling/net.py | cpratim/DALI-Data-Challenge | ad0d6d048abb240dd2316ff70590606bd2d8c44f | [
"MIT"
] | null | null | null | modeling/net.py | cpratim/DALI-Data-Challenge | ad0d6d048abb240dd2316ff70590606bd2d8c44f | [
"MIT"
] | null | null | null | import os
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
from tqdm import tqdm
import numpy as np
from sklearn.preprocessing import (
StandardScaler,
MinMaxScaler,
)
from sklearn.pipeline import Pipeline
from gplearn.genetic import SymbolicTransformer
import pickle
... | 25.884298 | 104 | 0.590996 | import os
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
from tqdm import tqdm
import numpy as np
from sklearn.preprocessing import (
StandardScaler,
MinMaxScaler,
)
from sklearn.pipeline import Pipeline
from gplearn.genetic import SymbolicTransformer
import pickle
... | true | true |
1c446c1a6bc3489b11c669948577e7a3ca162f01 | 222 | py | Python | crispy_shifty/__init__.py | proleu/crispy_shifty | 87393581a67cbeda287f858a8860145b6ccb5768 | [
"MIT"
] | 4 | 2022-01-11T23:40:12.000Z | 2022-03-03T00:42:57.000Z | crispy_shifty/__init__.py | proleu/crispy_shifty | 87393581a67cbeda287f858a8860145b6ccb5768 | [
"MIT"
] | null | null | null | crispy_shifty/__init__.py | proleu/crispy_shifty | 87393581a67cbeda287f858a8860145b6ccb5768 | [
"MIT"
] | null | null | null | # TODO smart sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) type thing?
# import sys
# from pathlib import Path
#
# # As PosixPath
# sys.path.append(Path(__file__).parent ) #.parent.parent) might be better
| 31.714286 | 87 | 0.734234 | true | true | |
1c446c2f5aac664a71d64849454ca09648c92f8f | 776 | py | Python | test/dao/test_userInfoDao.py | clarkchen/tiflask | 7dee6d2de85b9b15eb233d2e4dfcda218ab4c65b | [
"Apache-2.0"
] | null | null | null | test/dao/test_userInfoDao.py | clarkchen/tiflask | 7dee6d2de85b9b15eb233d2e4dfcda218ab4c65b | [
"Apache-2.0"
] | null | null | null | test/dao/test_userInfoDao.py | clarkchen/tiflask | 7dee6d2de85b9b15eb233d2e4dfcda218ab4c65b | [
"Apache-2.0"
] | null | null | null | from unittest import TestCase
from tiflask.dao import UserInfoDao
class TestUserInfoDao(TestCase):
def test_get_user_article_relation(self):
dao = UserInfoDao()
phone = "18500195632"
user_info = dao.get_user_base_info(phone)
# print (user_info.phone)
self.assertIsNotNone(u... | 31.04 | 67 | 0.679124 | from unittest import TestCase
from tiflask.dao import UserInfoDao
class TestUserInfoDao(TestCase):
def test_get_user_article_relation(self):
dao = UserInfoDao()
phone = "18500195632"
user_info = dao.get_user_base_info(phone)
self.assertIsNotNone(user_info.phone)
u... | true | true |
1c446ceb8906235f5651b60a7e78a640259e6170 | 300 | py | Python | problems/remove-duplicates-from-sorted-array/solution-1.py | MleMoe/LeetCode-1 | 14f275ba3c8079b820808da17c4952fcf9c8253c | [
"MIT"
] | 2 | 2021-03-25T01:58:55.000Z | 2021-08-06T12:47:13.000Z | problems/remove-duplicates-from-sorted-array/solution-1.py | MleMoe/LeetCode-1 | 14f275ba3c8079b820808da17c4952fcf9c8253c | [
"MIT"
] | 3 | 2019-08-27T13:25:42.000Z | 2021-08-28T17:49:34.000Z | problems/remove-duplicates-from-sorted-array/solution-1.py | MleMoe/LeetCode-1 | 14f275ba3c8079b820808da17c4952fcf9c8253c | [
"MIT"
] | 1 | 2021-08-14T08:49:39.000Z | 2021-08-14T08:49:39.000Z | class Solution:
def removeDuplicates(self, nums: [int]) -> int:
if len(nums) == 0:
return 0
order = 0
for i in range(1, len(nums)):
if nums[order] != nums[i]:
order += 1
nums[order] = nums[i]
return order + 1 | 30 | 51 | 0.453333 | class Solution:
def removeDuplicates(self, nums: [int]) -> int:
if len(nums) == 0:
return 0
order = 0
for i in range(1, len(nums)):
if nums[order] != nums[i]:
order += 1
nums[order] = nums[i]
return order + 1 | true | true |
1c446cffc3bb328dbe5a01254b5550c010eec188 | 686 | py | Python | lists.py | emersonnobre/python-basics | e4e4f17b83661e210e5379005d85364b09587593 | [
"MIT"
] | null | null | null | lists.py | emersonnobre/python-basics | e4e4f17b83661e210e5379005d85364b09587593 | [
"MIT"
] | null | null | null | lists.py | emersonnobre/python-basics | e4e4f17b83661e210e5379005d85364b09587593 | [
"MIT"
] | null | null | null | friends = ["Murilo", "Duda", "Rebecca"]
polymorfism = [1, False, "some text"]
numbers = [1, 34, 2, 1, 0, 34, 4, 100, 98]
#Funções para listas
friends.extend(polymorfism) # adiciona um array no final do array
friends.append("Carlinhos") # adiciona um valor na última posição do array
friends.insert(1, "Doja") # adicion... | 40.352941 | 106 | 0.739067 | friends = ["Murilo", "Duda", "Rebecca"]
polymorfism = [1, False, "some text"]
numbers = [1, 34, 2, 1, 0, 34, 4, 100, 98]
friends.extend(polymorfism)
friends.append("Carlinhos")
friends.insert(1, "Doja")
friends.remove("Carlinhos")
friends.pop()
friends.extend( [1, 1] )
numbers.sort()
print(friends.count(1))
p... | true | true |
1c446d50915880d40f75c0a9bd8a6895bafc7d5a | 1,725 | py | Python | python2.7/skeleton.py | XlogicX/Learn | 96e4b13bbc8c2589d6bf41e24e6d0857c172e3e6 | [
"MIT"
] | 43 | 2015-06-05T19:14:46.000Z | 2022-01-31T20:25:46.000Z | python2.7/skeleton.py | tuxxy/Learn | 96e4b13bbc8c2589d6bf41e24e6d0857c172e3e6 | [
"MIT"
] | null | null | null | python2.7/skeleton.py | tuxxy/Learn | 96e4b13bbc8c2589d6bf41e24e6d0857c172e3e6 | [
"MIT"
] | 9 | 2015-09-07T18:31:41.000Z | 2022-02-02T06:39:06.000Z | #/usr/bin/python
#This is our subroutine at the beggining of script
def check_length( value ):
length = len(value) #pythons length function
if (length > 30): #comparison
print "You didn't follow the rules, enter a line that is less than 30 characters:\n"
return "FAIL"
else:
return
print "Welcome to our exa... | 37.5 | 97 | 0.723478 |
def check_length( value ):
length = len(value)
if (length > 30):
print "You didn't follow the rules, enter a line that is less than 30 characters:\n"
return "FAIL"
else:
return
print "Welcome to our example python script"
print "please enter your file name: "
filename = raw_input() #Get input
txtfile... | false | true |
1c446d71885ae3d23a95f291c3dfb10fe99cb957 | 53,754 | py | Python | astropy/coordinates/transformations.py | REMeyer/astropy | 28c49fb618538a01812e586cd07bccdf0591a6c6 | [
"BSD-3-Clause"
] | null | null | null | astropy/coordinates/transformations.py | REMeyer/astropy | 28c49fb618538a01812e586cd07bccdf0591a6c6 | [
"BSD-3-Clause"
] | null | null | null | astropy/coordinates/transformations.py | REMeyer/astropy | 28c49fb618538a01812e586cd07bccdf0591a6c6 | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This module contains a general framework for defining graphs of transformations
between coordinates, suitable for either spatial coordinates or more generalized
coordinate systems.
The fundamental idea is that each class is a node in the transformati... | 40.47741 | 109 | 0.602392 |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import heapq
import inspect
import subprocess
from warnings import warn
from abc import ABCMeta, abstractmethod
from collections import defaultdict, OrderedDict
import numpy as np
from .. import units as ... | true | true |
1c446d85e9321da7a48cf104ae990269b5592a7d | 1,266 | py | Python | sdk/relay/azure-mgmt-relay/azure/mgmt/relay/models/operation_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 8 | 2021-01-13T23:44:08.000Z | 2021-03-17T10:13:36.000Z | sdk/relay/azure-mgmt-relay/azure/mgmt/relay/models/operation_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 226 | 2019-07-24T07:57:21.000Z | 2019-10-15T01:07:24.000Z | sdk/relay/azure-mgmt-relay/azure/mgmt/relay/models/operation_py3.py | iscai-msft/azure-sdk-for-python | 83715b95c41e519d5be7f1180195e2fba136fc0f | [
"MIT"
] | 2 | 2020-05-21T22:51:22.000Z | 2020-05-26T20:53:01.000Z | # 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.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | 31.65 | 76 | 0.584518 |
from msrest.serialization import Model
class Operation(Model):
_validation = {
'name': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(self, *, display=N... | true | true |
1c446daa36eb0e4b3800e1664e4e66ac001cceea | 72,230 | py | Python | pybind/slxos/v17r_2_00/mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v17r_2_00/mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v17r_2_00/mpls_config/router/mpls/mpls_cmds_holder/lsp/secondary_path/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | 94.914586 | 756 | 0.734944 |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from d... | true | true |
1c446db459b8ff21bcf05a909d7da4d5e1444764 | 2,724 | py | Python | panzoto/portal.py | yangliu2/panzoto | 86fb0e6ab26a682b360dd45394f894fa03b5d433 | [
"MIT"
] | null | null | null | panzoto/portal.py | yangliu2/panzoto | 86fb0e6ab26a682b360dd45394f894fa03b5d433 | [
"MIT"
] | null | null | null | panzoto/portal.py | yangliu2/panzoto | 86fb0e6ab26a682b360dd45394f894fa03b5d433 | [
"MIT"
] | null | null | null | from pathlib import Path
import pickle
from rich.table import Table
from rich import box
from rich.console import Console
from typing import Callable, Dict
import panzoto.config as CFG
from panzoto.matrix import Matrix
from panzoto.utils import load_matrix, log_output, timer
class Portal():
def __init__(self):
... | 30.954545 | 69 | 0.579295 | from pathlib import Path
import pickle
from rich.table import Table
from rich import box
from rich.console import Console
from typing import Callable, Dict
import panzoto.config as CFG
from panzoto.matrix import Matrix
from panzoto.utils import load_matrix, log_output, timer
class Portal():
def __init__(self):
... | true | true |
1c446e092f59a795f8241b05d24a122a84ab3529 | 100 | py | Python | app/domain/exceptions.py | globocom/enforcement | 004ff545d6d61b95b555d9981525510496862b3e | [
"BSD-3-Clause"
] | 7 | 2020-11-08T18:02:26.000Z | 2021-10-15T21:40:35.000Z | app/domain/exceptions.py | globocom/enforcement | 004ff545d6d61b95b555d9981525510496862b3e | [
"BSD-3-Clause"
] | 19 | 2020-11-19T20:57:20.000Z | 2021-09-03T14:53:34.000Z | app/domain/exceptions.py | globocom/enforcement-service | 004ff545d6d61b95b555d9981525510496862b3e | [
"BSD-3-Clause"
] | 3 | 2020-10-03T02:40:34.000Z | 2020-10-19T10:17:06.000Z |
class EnforcementInvalidException(Exception):
pass
class SecretNotFound(Exception):
pass
| 12.5 | 45 | 0.77 |
class EnforcementInvalidException(Exception):
pass
class SecretNotFound(Exception):
pass
| true | true |
1c446e1ef19c9f608c436ef3bdb84329213f98ad | 1,496 | py | Python | tests/json/test_jsonexportfile.py | aaronater10/sfconfig | f1ebd0a4dc5e6ec235d30b0ef1540fb65422729a | [
"MIT"
] | null | null | null | tests/json/test_jsonexportfile.py | aaronater10/sfconfig | f1ebd0a4dc5e6ec235d30b0ef1540fb65422729a | [
"MIT"
] | null | null | null | tests/json/test_jsonexportfile.py | aaronater10/sfconfig | f1ebd0a4dc5e6ec235d30b0ef1540fb65422729a | [
"MIT"
] | null | null | null | # jsonexportfile - Tests
from src import sfcparse
from os import remove, path
import time
test_file_path = './tests/test_files/json/'
file_delay_timer = 0.5
################################################################
# TESTS
# 1. JSON Data Export - Exporting json file data and test attributes
def test1_json_f... | 32.521739 | 100 | 0.661096 |
from src import sfcparse
from os import remove, path
import time
test_file_path = './tests/test_files/json/'
file_delay_timer = 0.5
| true | true |
1c446eff4ecb46549266af14ca2384810a90480b | 29,182 | py | Python | tempest/api/network/test_networks.py | xavpaice/tempest | 958bd694df27511e0346d799876fe49331b8145c | [
"Apache-2.0"
] | null | null | null | tempest/api/network/test_networks.py | xavpaice/tempest | 958bd694df27511e0346d799876fe49331b8145c | [
"Apache-2.0"
] | null | null | null | tempest/api/network/test_networks.py | xavpaice/tempest | 958bd694df27511e0346d799876fe49331b8145c | [
"Apache-2.0"
] | null | null | null | # Copyright 2012 OpenStack Foundation
# 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 requ... | 44.964561 | 79 | 0.628675 |
import itertools
import netaddr
import six
from tempest_lib import exceptions as lib_exc
from tempest.api.network import base
from tempest.common import custom_matchers
from tempest.common.utils import data_utils
from tempest import config
from tempest import test
CONF = config.CONF
class NetworksTes... | true | true |
1c446f764905e7f9cd9f67b56684fdeee3bc714c | 5,348 | py | Python | crossover_finder.py | nbergam2021/ICESat_data_analysis_tools | 46f4132d2b34efe9a21470cdbaddf195301cfcd3 | [
"MIT"
] | 1 | 2019-11-27T20:41:31.000Z | 2019-11-27T20:41:31.000Z | crossover_finder.py | nbergam2021/ICESat_data_analysis_tools | 46f4132d2b34efe9a21470cdbaddf195301cfcd3 | [
"MIT"
] | null | null | null | crossover_finder.py | nbergam2021/ICESat_data_analysis_tools | 46f4132d2b34efe9a21470cdbaddf195301cfcd3 | [
"MIT"
] | null | null | null | #crossover_finder.py
import numpy as np
import pandas as pd
import scipy.stats as stats
import glob
import os
import sys
def solve(line_list, box):
# input: [slope, intersect, other_stuff]
# output: [ [], [], [], [] ]
# Group slopes, compare lines within each group
# box is list of top bottom left rig... | 40.515152 | 150 | 0.619484 |
import numpy as np
import pandas as pd
import scipy.stats as stats
import glob
import os
import sys
def solve(line_list, box):
intersects = []
for i in line_list:
for j in line_list:
if i != j and i[0]*j[0] < 0:
intersects.ap... | true | true |
1c446fd421650543e773be63c70c4dc902f1eb7a | 78,556 | py | Python | Lib/logging/__init__.py | KrishnaSai2020/cpython | 07923f32b16ba39165a58a5f47e807ca04ae17aa | [
"CNRI-Python-GPL-Compatible"
] | 2 | 2020-06-22T07:22:12.000Z | 2020-09-29T06:33:22.000Z | Lib/logging/__init__.py | jugmac00/cpython | 2c2a4f3d8545784c6e4ca8128bfc706916080712 | [
"CNRI-Python-GPL-Compatible"
] | null | null | null | Lib/logging/__init__.py | jugmac00/cpython | 2c2a4f3d8545784c6e4ca8128bfc706916080712 | [
"CNRI-Python-GPL-Compatible"
] | null | null | null | # Copyright 2001-2019 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | 35.433469 | 106 | 0.588637 |
import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
from string import Template
from string import Formatter as StrFormatter
__all__ = ['BASIC_FORMAT', 'BufferingFormatter', 'CRITICAL', 'DEBUG', 'ERROR',
'FATAL', 'FileHandler', 'Filter', 'Formatter', 'Handler', 'IN... | true | true |
1c446fe63b5d182b69d71768d1bb0b75c5c60426 | 3,049 | py | Python | scripts/util.py | TheCharlatan/vialectrum | c54cd9aa08835db985d77ead9d91a00d66afa4b0 | [
"MIT"
] | null | null | null | scripts/util.py | TheCharlatan/vialectrum | c54cd9aa08835db985d77ead9d91a00d66afa4b0 | [
"MIT"
] | null | null | null | scripts/util.py | TheCharlatan/vialectrum | c54cd9aa08835db985d77ead9d91a00d66afa4b0 | [
"MIT"
] | null | null | null | import select, time, queue
# import vialectrum as electrum
from vialectrum import Connection, Interface, SimpleConfig
from vialectrum.network import parse_servers
from collections import defaultdict
# electrum.util.set_verbosity(1)
def get_interfaces(servers, timeout=10):
'''Returns a map of servers to connected ... | 36.297619 | 94 | 0.653329 | import select, time, queue
from vialectrum import Connection, Interface, SimpleConfig
from vialectrum.network import parse_servers
from collections import defaultdict
def get_interfaces(servers, timeout=10):
socket_queue = queue.Queue()
config = SimpleConfig()
connecting = {}
for server in servers:
... | true | true |
1c447221d6f4f975dfff9f8ae842a6682412100a | 8,187 | py | Python | cuegui/tests/FrameMonitorTree_tests.py | srbhss/OpenCue | c0b8aeab0ea324c3c46541d98b4a968230c668eb | [
"Apache-2.0"
] | null | null | null | cuegui/tests/FrameMonitorTree_tests.py | srbhss/OpenCue | c0b8aeab0ea324c3c46541d98b4a968230c668eb | [
"Apache-2.0"
] | 2 | 2019-10-02T23:58:20.000Z | 2020-03-30T19:18:48.000Z | cuegui/tests/FrameMonitorTree_tests.py | srbhss/OpenCue | c0b8aeab0ea324c3c46541d98b4a968230c668eb | [
"Apache-2.0"
] | null | null | null | # Copyright (c) 2018 Sony Pictures Imageworks 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... | 39.360577 | 113 | 0.702333 |
import mock
import unittest
import PySide2.QtCore
import PySide2.QtGui
import PySide2.QtTest
import PySide2.QtWidgets
import cuegui.Constants
import cuegui.FrameMonitor
import cuegui.FrameMonitorTree
import cuegui.Main
import cuegui.plugins.MonitorJobDetailsPlugin
import cuegui.Style
import opencue.com... | true | true |
1c4472d59ef9d2f4b7feaa9217800ab5af98d094 | 54,950 | py | Python | lib/spack/llnl/util/filesystem.py | BenCasses/spack | 912dcd320a1ec624cc12986a4c0dd881276c925b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | lib/spack/llnl/util/filesystem.py | BenCasses/spack | 912dcd320a1ec624cc12986a4c0dd881276c925b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | lib/spack/llnl/util/filesystem.py | BenCasses/spack | 912dcd320a1ec624cc12986a4c0dd881276c925b | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import collections
import errno
import hashlib
import glob
import grp
import itertools
import numbers
import os
import pwd
... | 31.836616 | 79 | 0.60091 |
import collections
import errno
import hashlib
import glob
import grp
import itertools
import numbers
import os
import pwd
import re
import shutil
import stat
import sys
import tempfile
from contextlib import contextmanager
import six
from llnl.util import tty
from llnl.util.lang import dedupe, memoized
from spack... | true | true |
1c44735ee29ae80ebb1e9d736322620b52449d80 | 3,087 | py | Python | pkg/suggestion/v1alpha1/NAS_Reinforcement_Learning/Operation.py | terrytangyuan/katib | 5a7a144a1b33e05466174edd721803349622aabc | [
"Apache-2.0"
] | 6 | 2019-04-26T05:24:45.000Z | 2020-03-16T15:54:23.000Z | pkg/suggestion/v1alpha1/NAS_Reinforcement_Learning/Operation.py | terrytangyuan/katib | 5a7a144a1b33e05466174edd721803349622aabc | [
"Apache-2.0"
] | 30 | 2019-04-27T01:49:00.000Z | 2021-02-01T08:52:32.000Z | pkg/suggestion/v1alpha1/NAS_Reinforcement_Learning/Operation.py | terrytangyuan/katib | 5a7a144a1b33e05466174edd721803349622aabc | [
"Apache-2.0"
] | 4 | 2019-05-07T04:53:07.000Z | 2020-10-21T09:10:26.000Z | import itertools
import numpy as np
from pkg.api.v1alpha1.python import api_pb2
class Operation(object):
def __init__(self, opt_id, opt_type, opt_params):
self.opt_id = opt_id
self.opt_type = opt_type
self.opt_params = opt_params
def get_dict(self):
opt_dict = dict()
... | 40.090909 | 86 | 0.597344 | import itertools
import numpy as np
from pkg.api.v1alpha1.python import api_pb2
class Operation(object):
def __init__(self, opt_id, opt_type, opt_params):
self.opt_id = opt_id
self.opt_type = opt_type
self.opt_params = opt_params
def get_dict(self):
opt_dict = dict()
... | true | true |
1c4473c0e901afb9b524c273d6a5357d7d60c679 | 2,825 | py | Python | src/nspyre/gui/widgets/views.py | AlexBourassa/nspyre | d254af09c7c8377552e85dba6f60b150fbb8da2e | [
"MIT"
] | 8 | 2019-12-06T14:49:34.000Z | 2020-07-03T18:46:45.000Z | src/nspyre/gui/widgets/views.py | nspyre-org/nspyre | d254af09c7c8377552e85dba6f60b150fbb8da2e | [
"BSD-3-Clause"
] | 31 | 2020-09-21T21:01:06.000Z | 2021-12-10T03:27:26.000Z | src/nspyre/gui/widgets/views.py | NSpyre-Dev/nspyre | d254af09c7c8377552e85dba6f60b150fbb8da2e | [
"BSD-3-Clause"
] | 4 | 2020-10-07T23:58:13.000Z | 2022-03-01T15:22:34.000Z | class View:
"""Some Views for plotting."""
def __init__(self, f, plot_type):
self.update_fun = f
self.type = plot_type
self.init_formatters = dict()
self.update_formatters = dict()
def add_formatter(self, formatter):
if formatter.type == 'init':
self.ini... | 41.544118 | 138 | 0.692389 | class View:
def __init__(self, f, plot_type):
self.update_fun = f
self.type = plot_type
self.init_formatters = dict()
self.update_formatters = dict()
def add_formatter(self, formatter):
if formatter.type == 'init':
self.init_formatters[formatter.handled_clas... | true | true |
1c4473f0c25ec1b733d34e3f0547784dd273bf3a | 38,712 | py | Python | python/ccxt/coinmate.py | Dan-krm/ccxt | 2ed8b7b8598e2934559822d81a8d14885b4d4ad3 | [
"MIT"
] | null | null | null | python/ccxt/coinmate.py | Dan-krm/ccxt | 2ed8b7b8598e2934559822d81a8d14885b4d4ad3 | [
"MIT"
] | null | null | null | python/ccxt/coinmate.py | Dan-krm/ccxt | 2ed8b7b8598e2934559822d81a8d14885b4d4ad3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from cc... | 41.850811 | 155 | 0.517901 |
ge import Exchange
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationError
from ccxt.base.errors import ArgumentsRequired
from ccxt.base.errors import InsufficientFunds
from ccxt.base.errors import InvalidOrder
from ccxt.base.errors import OrderNotFound
from ccxt.base.errors impor... | true | true |
1c447420694ed8036a9668092025459314e6c7cc | 51,718 | py | Python | cardinal_pythonlib/extract_text.py | bopopescu/pythonlib | 9c2187d6092ba133342ca3374eb7c86f9d296c30 | [
"Apache-2.0"
] | null | null | null | cardinal_pythonlib/extract_text.py | bopopescu/pythonlib | 9c2187d6092ba133342ca3374eb7c86f9d296c30 | [
"Apache-2.0"
] | null | null | null | cardinal_pythonlib/extract_text.py | bopopescu/pythonlib | 9c2187d6092ba133342ca3374eb7c86f9d296c30 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# cardinal_pythonlib/extract_text.py
"""
===============================================================================
Original code copyright (C) 2009-2020 Rudolf Cardinal (rudolf@pobox.com).
This file is part of cardinal_pythonlib.
Licensed under the Apache License, Version 2.0... | 32.857687 | 118 | 0.56899 |
import argparse
from io import StringIO
import io
import logging
import os
import re
import shutil
import subprocess
import sys
import textwrap
from typing import (
BinaryIO, Dict, Generator, Iterable, Iterator, List, Optional, Union,
)
from xml.etree import ElementTree as ElementTree
import zipfile
... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.