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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f73de6b38f29f2a55fda3222e6771647566dab96 | 244 | py | Python | try_sum3.py | Sophie-Dai/Coding-Class-03 | ac60e9c6d9ea128155c13fd94125514397cfe44f | [
"Apache-2.0"
] | null | null | null | try_sum3.py | Sophie-Dai/Coding-Class-03 | ac60e9c6d9ea128155c13fd94125514397cfe44f | [
"Apache-2.0"
] | null | null | null | try_sum3.py | Sophie-Dai/Coding-Class-03 | ac60e9c6d9ea128155c13fd94125514397cfe44f | [
"Apache-2.0"
] | null | null | null | # -*- coding: UTF-8 -*-
num_start = 1
loops = 5
ap_step = 5
sum = 0
y = num_start
for num in range(loops):
sum += y
y += ap_step
print(sum)
sum = 0
y = num_start
for num in range(loops):
sum += y
y *= ap_step
print(sum)
| 10.166667 | 24 | 0.565574 |
num_start = 1
loops = 5
ap_step = 5
sum = 0
y = num_start
for num in range(loops):
sum += y
y += ap_step
print(sum)
sum = 0
y = num_start
for num in range(loops):
sum += y
y *= ap_step
print(sum)
| true | true |
f73de71ceaf9b50dd96686b597c06de425cb5649 | 54,323 | py | Python | zerver/tests/test_import_export.py | yasiruRathnayaka97/zulip | 2aec78e954e68f199de8d928642ff2325612c947 | [
"Apache-2.0"
] | null | null | null | zerver/tests/test_import_export.py | yasiruRathnayaka97/zulip | 2aec78e954e68f199de8d928642ff2325612c947 | [
"Apache-2.0"
] | null | null | null | zerver/tests/test_import_export.py | yasiruRathnayaka97/zulip | 2aec78e954e68f199de8d928642ff2325612c947 | [
"Apache-2.0"
] | null | null | null | import os
from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Tuple
from unittest.mock import patch
import orjson
from django.conf import settings
from django.db.models import Q
from django.utils.timezone import now as timezone_now
from zerver.lib import upload
from zerver.lib.actions import (
... | 41.563122 | 109 | 0.644994 | import os
from typing import Any, Callable, Dict, FrozenSet, List, Optional, Set, Tuple
from unittest.mock import patch
import orjson
from django.conf import settings
from django.db.models import Q
from django.utils.timezone import now as timezone_now
from zerver.lib import upload
from zerver.lib.actions import (
... | true | true |
f73de756b772563bfb53c4366c455e3be0662e8f | 141 | py | Python | pandana/utils/__init__.py | HEPonHPC/pandana | 8ee68071892f2a34b54a09ac54033f5d14d42019 | [
"Apache-2.0"
] | 2 | 2021-04-23T19:36:57.000Z | 2021-06-30T15:57:35.000Z | pandana/utils/__init__.py | HEPonHPC/pandana | 8ee68071892f2a34b54a09ac54033f5d14d42019 | [
"Apache-2.0"
] | null | null | null | pandana/utils/__init__.py | HEPonHPC/pandana | 8ee68071892f2a34b54a09ac54033f5d14d42019 | [
"Apache-2.0"
] | null | null | null | """Make everything from submodules appear at the top level.
"""
from pandana.utils.mpiutils import *
from pandana.utils.pandasutils import *
| 28.2 | 59 | 0.780142 | from pandana.utils.mpiutils import *
from pandana.utils.pandasutils import *
| true | true |
f73de7a43b3fe8640e33e83876139c4b6df893b6 | 2,158 | py | Python | pajbot/models/web_sockets.py | sgaweda/troybot | 7153c0ad387e31de57c71172893fd92c85259d1b | [
"MIT"
] | null | null | null | pajbot/models/web_sockets.py | sgaweda/troybot | 7153c0ad387e31de57c71172893fd92c85259d1b | [
"MIT"
] | 2 | 2020-02-18T03:30:30.000Z | 2020-02-18T03:31:44.000Z | pajbot/models/web_sockets.py | sgaweda/troybot | 7153c0ad387e31de57c71172893fd92c85259d1b | [
"MIT"
] | null | null | null | import logging
import random
from sqlalchemy import TEXT, INT
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from pajbot.managers.db import Base
log = logging.getLogger(__name__)
def salt_gen():
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJ... | 27.666667 | 111 | 0.68721 | import logging
import random
from sqlalchemy import TEXT, INT
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relationship
from pajbot.managers.db import Base
log = logging.getLogger(__name__)
def salt_gen():
ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJ... | true | true |
f73de873548cc15e656045753af17fe617e5347b | 401 | py | Python | test/test_situation_code.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | test/test_situation_code.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | test/test_situation_code.py | a-hacker/PyBall | ed88b28dceddf4c8b9f1370d931e4cfa74ce5fda | [
"MIT"
] | null | null | null | import pytest
from PyBall import PyBall
from PyBall.models.config import SituationCode
@pytest.fixture(scope='module')
def test_situation_codes():
pyball = PyBall()
return pyball.get_situation_codes()
def test_get_situation_codes_returns_situation_codes(test_situation_codes):
assert isinstance(test_situ... | 26.733333 | 75 | 0.812968 | import pytest
from PyBall import PyBall
from PyBall.models.config import SituationCode
@pytest.fixture(scope='module')
def test_situation_codes():
pyball = PyBall()
return pyball.get_situation_codes()
def test_get_situation_codes_returns_situation_codes(test_situation_codes):
assert isinstance(test_situ... | true | true |
f73dea1a4ea7ab8c5b58eb5f3787601ddd3117f4 | 21,919 | py | Python | shoptimizer_api/optimizers_builtin/image_link_optimizer_test.py | mitzaM/shoptimizer | 29fdea8e0b7e32fabef6a433bfb5d3b8060a4f36 | [
"Apache-2.0"
] | null | null | null | shoptimizer_api/optimizers_builtin/image_link_optimizer_test.py | mitzaM/shoptimizer | 29fdea8e0b7e32fabef6a433bfb5d3b8060a4f36 | [
"Apache-2.0"
] | null | null | null | shoptimizer_api/optimizers_builtin/image_link_optimizer_test.py | mitzaM/shoptimizer | 29fdea8e0b7e32fabef6a433bfb5d3b8060a4f36 | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2021 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | 42.396518 | 92 | 0.736302 |
import json
import time
from typing import Any, Dict, Iterable, List
from unittest import mock
import urllib.error
from absl.testing import absltest
from shoptimizer_api import constants
import flask
from shoptimizer_api.optimizers_builtin import image_link_optimizer
from shoptimizer_api.test_data impor... | true | true |
f73dec194f26d063bec326887cddf93b66f8463b | 3,302 | py | Python | codes/SOM.py | zahrag/3DHARSOM | f934d0b5786d2edac29a7a18be31fa74aafcb881 | [
"MIT"
] | null | null | null | codes/SOM.py | zahrag/3DHARSOM | f934d0b5786d2edac29a7a18be31fa74aafcb881 | [
"MIT"
] | null | null | null | codes/SOM.py | zahrag/3DHARSOM | f934d0b5786d2edac29a7a18be31fa74aafcb881 | [
"MIT"
] | null | null | null |
"""
Author: Zahra Gharaee.
This code is written for the 3D-Human-Action-Recognition Project, started March 14 2014.
"""
import numpy as np
from numpy import linalg as LA
class SOM:
def __init__(self, learning, outputsize_x, outputsize_y, inputsize, sigma, softmax_exponent, max_epoch):
self... | 28.465517 | 108 | 0.621139 |
import numpy as np
from numpy import linalg as LA
class SOM:
def __init__(self, learning, outputsize_x, outputsize_y, inputsize, sigma, softmax_exponent, max_epoch):
self.name = 'SOM'
self.learning = learning
self.outputsize_x = outputsize_x
self.outputsize_y = outputsize_y
... | true | true |
f73dede5cba7b95f066d85a6de3f25d10bd46121 | 6,700 | py | Python | pims/els_data.py | JPLMLIA/libeos | 3ad25c22159edf79d407454e32b8f07333cb57c2 | [
"Apache-2.0"
] | null | null | null | pims/els_data.py | JPLMLIA/libeos | 3ad25c22159edf79d407454e32b8f07333cb57c2 | [
"Apache-2.0"
] | null | null | null | pims/els_data.py | JPLMLIA/libeos | 3ad25c22159edf79d407454e32b8f07333cb57c2 | [
"Apache-2.0"
] | null | null | null | # Cassini CAPS ELS data reader
# Modeled after Gary's MDIS reader
# Kiri Wagstaff, 11/28/18
import os
from datetime import datetime
from collections import defaultdict
import numpy as np
from pds.core.parser import Parser
from scipy.interpolate import interp1d
GEOMFILE = os.path.join(
os.path.dirname(os.path.real... | 33.668342 | 82 | 0.602985 |
# Kiri Wagstaff, 11/28/18
import os
from datetime import datetime
from collections import defaultdict
import numpy as np
from pds.core.parser import Parser
from scipy.interpolate import interp1d
GEOMFILE = os.path.join(
os.path.dirname(os.path.realpath(__file__)),
'ref',
'geometricfactor.npz'
)
_EARRAY ... | true | true |
f73def6e2f12a1497b1f9d7e2b31b68b2acc60ee | 10,842 | py | Python | lib/loss/loss_helper.py | Shuai-Xie/openseg.pytorch | 79116a58782ccd2150f9eb9054e70cfd42fc9773 | [
"MIT"
] | 1 | 2021-07-02T11:54:57.000Z | 2021-07-02T11:54:57.000Z | lib/loss/loss_helper.py | Shuai-Xie/openseg.pytorch | 79116a58782ccd2150f9eb9054e70cfd42fc9773 | [
"MIT"
] | null | null | null | lib/loss/loss_helper.py | Shuai-Xie/openseg.pytorch | 79116a58782ccd2150f9eb9054e70cfd42fc9773 | [
"MIT"
] | null | null | null | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Donny You, RainbowSecret
## Microsoft Research
## yuyua@microsoft.com
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in the root directory of this source tree
##... | 43.542169 | 137 | 0.632356 | configer):
super().__init__()
self.configer = configer
self.thresh = self.configer.get('loss', 'params')['ohem_thresh']
self.reduction = 'elementwise_mean'
if self.configer.exists('loss', 'params') and 'ce_reduction' in self.configer.get('loss', 'params'):
self.reduct... | true | true |
f73df083c3b21548aa20ef6947039d25b38977dd | 1,918 | py | Python | dokang/utils.py | Polyconseil/dokang | b0ab3e4aabfb97adb2a2e877a42fc1896e5fcf08 | [
"BSD-3-Clause"
] | 6 | 2016-07-04T17:16:42.000Z | 2018-11-13T08:10:21.000Z | dokang/utils.py | Polyconseil/dokang | b0ab3e4aabfb97adb2a2e877a42fc1896e5fcf08 | [
"BSD-3-Clause"
] | 6 | 2016-02-23T15:08:51.000Z | 2017-01-02T11:57:45.000Z | dokang/utils.py | Polyconseil/dokang | b0ab3e4aabfb97adb2a2e877a42fc1896e5fcf08 | [
"BSD-3-Clause"
] | 5 | 2015-04-05T14:07:11.000Z | 2017-04-13T14:08:02.000Z | # -*- coding: utf-8 -*-
# Copyright (c) Polyconseil SAS. All rights reserved.
from __future__ import unicode_literals
import json
import os
import os.path
from dokang import api
from . import compat
def get_harvester(fqn):
module_fqn, function_fqn = fqn.rsplit('.', 1)
# Hack around https://bugs.python.org/... | 27.797101 | 73 | 0.650678 |
from __future__ import unicode_literals
import json
import os
import os.path
from dokang import api
from . import compat
def get_harvester(fqn):
module_fqn, function_fqn = fqn.rsplit('.', 1)
if compat.PY2 and not isinstance(module_fqn, bytes):
module_fqn = module_fqn.encode()
functio... | true | true |
f73df14d27d4c328ef0f6c514247fac68d5abf5c | 354 | py | Python | pywolf/migrations/0045_remove_villageparticipant_system_user_flg.py | tevawolf/pywolf | 94e3c26d8c3b279990624f23658e22ab00eead46 | [
"BSD-3-Clause"
] | null | null | null | pywolf/migrations/0045_remove_villageparticipant_system_user_flg.py | tevawolf/pywolf | 94e3c26d8c3b279990624f23658e22ab00eead46 | [
"BSD-3-Clause"
] | null | null | null | pywolf/migrations/0045_remove_villageparticipant_system_user_flg.py | tevawolf/pywolf | 94e3c26d8c3b279990624f23658e22ab00eead46 | [
"BSD-3-Clause"
] | null | null | null | # Generated by Django 2.1.2 on 2018-11-13 08:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pywolf', '0044_placcount_dummy_user_flg'),
]
operations = [
migrations.RemoveField(
model_name='villageparticipant',
name='s... | 19.666667 | 52 | 0.621469 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('pywolf', '0044_placcount_dummy_user_flg'),
]
operations = [
migrations.RemoveField(
model_name='villageparticipant',
name='system_user_flg',
),
]
| true | true |
f73df18cbf678db43a3d0fa1e22a44a487d2d050 | 1,023 | py | Python | droidlet/interpreter/craftassist/dummy_interpreter.py | adamlerer/droidlet | ada38d191dadcea9aba12330e35e8e7d6d1663d9 | [
"MIT"
] | null | null | null | droidlet/interpreter/craftassist/dummy_interpreter.py | adamlerer/droidlet | ada38d191dadcea9aba12330e35e8e7d6d1663d9 | [
"MIT"
] | null | null | null | droidlet/interpreter/craftassist/dummy_interpreter.py | adamlerer/droidlet | ada38d191dadcea9aba12330e35e8e7d6d1663d9 | [
"MIT"
] | null | null | null | """
Copyright (c) Facebook, Inc. and its affiliates.
"""
from typing import Tuple, Dict, Any, Optional
from droidlet.dialog.dialogue_objects import DialogueObject
from ..interpreter import ReferenceObjectInterpreter, FilterInterpreter, interpret_reference_object
from ..condition_helper import ConditionInterpreter
fro... | 34.1 | 99 | 0.69697 | from typing import Tuple, Dict, Any, Optional
from droidlet.dialog.dialogue_objects import DialogueObject
from ..interpreter import ReferenceObjectInterpreter, FilterInterpreter, interpret_reference_object
from ..condition_helper import ConditionInterpreter
from .attribute_helper import MCAttributeInterpreter
class... | true | true |
f73df2947db3f8ec07b108417c6ee280e9ec7dbd | 20,178 | py | Python | pysphere/vi_performance_manager.py | fuzzmz/vspheretools | 10890423bfbba976e3ddee61204e9eed4b73fe92 | [
"MIT"
] | 22 | 2016-05-30T15:43:44.000Z | 2022-02-06T02:56:42.000Z | pysphere/vi_performance_manager.py | fuzzmz/vspheretools | 10890423bfbba976e3ddee61204e9eed4b73fe92 | [
"MIT"
] | 7 | 2016-05-19T16:01:55.000Z | 2017-07-11T11:50:32.000Z | pysphere/vi_performance_manager.py | fuzzmz/vspheretools | 10890423bfbba976e3ddee61204e9eed4b73fe92 | [
"MIT"
] | 4 | 2018-10-12T09:47:13.000Z | 2021-06-21T01:53:51.000Z | #--
# Copyright (c) 2012, Sebastian Tello, Alejandro Lozanoff
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# th... | 47.589623 | 81 | 0.610169 |
from pysphere.resources import VimService_services as VI
from pysphere.vi_property import VIProperty
from pysphere.resources.vi_exception import VIException, VIApiException, \
UnsupportedPerfIntervalError, FaultTypes
import datetime
class EntityStatistics:
def __ini... | false | true |
f73df4096ea90bc7768f2653f74a9e39c91640a7 | 35,820 | py | Python | test_shaders.py | adrianrodriguesm/SPIRV-Cross | 1e8caa97d81a16ba6d6bd048cd5891cdef463b84 | [
"Apache-2.0"
] | 3 | 2022-03-02T08:55:54.000Z | 2022-03-23T05:56:43.000Z | test_shaders.py | adrianrodriguesm/SPIRV-Cross | 1e8caa97d81a16ba6d6bd048cd5891cdef463b84 | [
"Apache-2.0"
] | 1 | 2021-09-07T07:36:59.000Z | 2021-09-07T07:36:59.000Z | test_shaders.py | adrianrodriguesm/SPIRV-Cross | 1e8caa97d81a16ba6d6bd048cd5891cdef463b84 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python3
# Copyright 2015-2021 Arm Limited
#
# 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 ... | 39.147541 | 237 | 0.630486 |
import sys
import os
import os.path
import subprocess
import tempfile
import re
import itertools
import hashlib
import shutil
import argparse
import codecs
import json
import multiprocessing
import errno
from functools import partial
class Paths():
def __init__(self, spirv_cross, glslang, spirv_as,... | true | true |
f73df42c6e52358e430d099293f2ac6a02b6ef0d | 2,711 | py | Python | Unit-7-The-Cartpole/q_learning.py | paulfioravanti/Reinforcement-Learning-In-Motion | e09afd23b82040d76c95875b077ba0a5af517470 | [
"MIT"
] | null | null | null | Unit-7-The-Cartpole/q_learning.py | paulfioravanti/Reinforcement-Learning-In-Motion | e09afd23b82040d76c95875b077ba0a5af517470 | [
"MIT"
] | null | null | null | Unit-7-The-Cartpole/q_learning.py | paulfioravanti/Reinforcement-Learning-In-Motion | e09afd23b82040d76c95875b077ba0a5af517470 | [
"MIT"
] | null | null | null | import gym
import numpy as np
from util import plot_running_average
# pylint: disable-msg=redefined-outer-name
def max_action(estimates, state):
values = np.array([estimates[state, i] for i in range(2)])
action = np.argmax(values)
return action
def get_state(observation):
cart_x, cart_x_dot, cart_thet... | 33.469136 | 75 | 0.607156 | import gym
import numpy as np
from util import plot_running_average
def max_action(estimates, state):
values = np.array([estimates[state, i] for i in range(2)])
action = np.argmax(values)
return action
def get_state(observation):
cart_x, cart_x_dot, cart_theta, cart_theta_dot = observation
cart_x... | true | true |
f73df575c8d7a5c3b234b986925a4420b25923c6 | 1,401 | py | Python | src/app.py | taller-de-programacion-2/rest-python-flask | ff2567c204a3fb9cf3d8c7013fa5c4a0470f6501 | [
"MIT"
] | null | null | null | src/app.py | taller-de-programacion-2/rest-python-flask | ff2567c204a3fb9cf3d8c7013fa5c4a0470f6501 | [
"MIT"
] | 2 | 2021-04-22T03:07:27.000Z | 2021-06-02T00:19:49.000Z | src/app.py | taller-de-programacion-2/rest-python-flask | ff2567c204a3fb9cf3d8c7013fa5c4a0470f6501 | [
"MIT"
] | 1 | 2021-11-02T03:42:31.000Z | 2021-11-02T03:42:31.000Z | import os
from flask import Flask, escape, request, jsonify
from marshmallow import ValidationError
from flask_pymongo import PyMongo
from src.auth.auth_exception import UserExistsException, UserNotFoundException, AccessDeniedException
from src.auth.controllers.auth import auth_blueprint
import src.settings
from src.... | 23.35 | 101 | 0.748037 | import os
from flask import Flask, escape, request, jsonify
from marshmallow import ValidationError
from flask_pymongo import PyMongo
from src.auth.auth_exception import UserExistsException, UserNotFoundException, AccessDeniedException
from src.auth.controllers.auth import auth_blueprint
import src.settings
from src.... | true | true |
f73df60e449cd6eb00d2d05e8890a9778c9d095c | 4,570 | py | Python | hub/urls.py | efforia/hub | c51a5e9523e54e8cb4795a779b4e22c17599f92a | [
"MIT"
] | null | null | null | hub/urls.py | efforia/hub | c51a5e9523e54e8cb4795a779b4e22c17599f92a | [
"MIT"
] | 1 | 2020-07-02T22:47:44.000Z | 2020-07-02T22:47:44.000Z | hub/urls.py | williamlagos/hub | c51a5e9523e54e8cb4795a779b4e22c17599f92a | [
"MIT"
] | 1 | 2020-05-01T23:31:42.000Z | 2020-05-01T23:31:42.000Z | from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url as django_url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf.urls.static import static
from django.views.generic.base import TemplateView,RedirectView
fro... | 69.242424 | 142 | 0.742451 | from __future__ import unicode_literals
from django.conf import settings
from django.conf.urls import include, url as django_url
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from django.conf.urls.static import static
from django.views.generic.base import TemplateView,RedirectView
fro... | true | true |
f73df6b323b883a4881d9651e3c80ae148188dbf | 6,078 | py | Python | utility/mad_api.py | Tabbomat/MADUtilities | 74f45820bfa1864f92f2eaf20a27308bd15f35c6 | [
"MIT"
] | 2 | 2020-11-21T07:26:37.000Z | 2021-02-07T00:31:51.000Z | utility/mad_api.py | Tabbomat/MADUtilities | 74f45820bfa1864f92f2eaf20a27308bd15f35c6 | [
"MIT"
] | null | null | null | utility/mad_api.py | Tabbomat/MADUtilities | 74f45820bfa1864f92f2eaf20a27308bd15f35c6 | [
"MIT"
] | 1 | 2021-02-07T09:20:53.000Z | 2021-02-07T09:20:53.000Z | import time
from typing import Dict, List, Optional, Tuple
import requests
import utility.args
class MadObj:
def __init__(self, api, obj_id: int):
assert obj_id >= 0
self.id = obj_id
self._data = {}
self._api = api # type:Api
def _update_data(self):
raise NotImpleme... | 34.338983 | 128 | 0.58539 | import time
from typing import Dict, List, Optional, Tuple
import requests
import utility.args
class MadObj:
def __init__(self, api, obj_id: int):
assert obj_id >= 0
self.id = obj_id
self._data = {}
self._api = api
def _update_data(self):
raise NotImplementedError
... | true | true |
f73df82574b71212ffed937c7c167b4ea765bcd6 | 301 | py | Python | src/year2019/day09a.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | 10 | 2017-12-11T17:54:52.000Z | 2021-12-09T20:16:30.000Z | src/year2019/day09a.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | 260 | 2015-12-09T11:03:03.000Z | 2021-12-12T14:32:23.000Z | src/year2019/day09a.py | lancelote/advent_of_code | 06dda6ca034bc1e86addee7798bb9b2a34ff565b | [
"Unlicense"
] | null | null | null | """2019 - Day 9 Part 1: Sensor Boost."""
from src.year2019.intcode import Computer
def solve(task: str) -> int:
"""Find BOOST key code."""
computer = Computer()
computer.load_program(task)
computer.stdin.append(1) # test mode
computer.execute()
return computer.stdout.pop()
| 25.083333 | 41 | 0.664452 | from src.year2019.intcode import Computer
def solve(task: str) -> int:
computer = Computer()
computer.load_program(task)
computer.stdin.append(1)
computer.execute()
return computer.stdout.pop()
| true | true |
f73df856f61cc2ca3ec3941f6a7b4862c59e86fa | 18,652 | py | Python | wo/cli/plugins/stack_upgrade.py | searchboy-sudo/WordOps | 71926580fd396acb2535b15aafe330aa244601df | [
"MIT"
] | null | null | null | wo/cli/plugins/stack_upgrade.py | searchboy-sudo/WordOps | 71926580fd396acb2535b15aafe330aa244601df | [
"MIT"
] | null | null | null | wo/cli/plugins/stack_upgrade.py | searchboy-sudo/WordOps | 71926580fd396acb2535b15aafe330aa244601df | [
"MIT"
] | null | null | null | import os
import shutil
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.stack_pref import post_pref, pre_pref, pre_stack
from wo.core.aptget import WOAptGet
from wo.core.download import WODownload
from wo.core.extract import WOExtract
from wo.core.fileutils import WOFileUtils
from ... | 43.887059 | 79 | 0.477965 | import os
import shutil
from cement.core.controller import CementBaseController, expose
from wo.cli.plugins.stack_pref import post_pref, pre_pref, pre_stack
from wo.core.aptget import WOAptGet
from wo.core.download import WODownload
from wo.core.extract import WOExtract
from wo.core.fileutils import WOFileUtils
from ... | true | true |
f73df968619061098e13b4fa7b996adf00b27af2 | 3,540 | py | Python | grpc_demo/pi_pb2.py | ResolveWang/rpc_demo | 1585404377f13d1d366b14917c0ec0b92466f428 | [
"MIT"
] | 10 | 2019-01-15T02:32:19.000Z | 2021-04-28T07:00:30.000Z | grpc_demo/pi_pb2.py | ResolveWang/rpc_demo | 1585404377f13d1d366b14917c0ec0b92466f428 | [
"MIT"
] | null | null | null | grpc_demo/pi_pb2.py | ResolveWang/rpc_demo | 1585404377f13d1d366b14917c0ec0b92466f428 | [
"MIT"
] | 7 | 2019-02-20T15:54:24.000Z | 2022-01-05T07:44:01.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pi.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection... | 26.616541 | 260 | 0.742938 |
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db =... | true | true |
f73dfb23c6b523f62cb80af67168bb1a2d0c4d1b | 337 | py | Python | __init__.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | 1 | 2022-03-02T23:13:06.000Z | 2022-03-02T23:13:06.000Z | __init__.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | null | null | null | __init__.py | Aran-Fey/introspection | 0ce3a16688b51bdcb72c7b070d571a1004f5151b | [
"MIT"
] | null | null | null |
# fake module that resides in my lib folder and
# imports the actual implementation
from pathlib import Path
here = Path(__file__).absolute().parent
name = here.stem
import sys
sys.path.insert(0, str(here))
del sys.modules[name]
module = __import__(name)
del sys.path[0]
del Path, here, name, sys
globals().update(... | 17.736842 | 47 | 0.750742 |
from pathlib import Path
here = Path(__file__).absolute().parent
name = here.stem
import sys
sys.path.insert(0, str(here))
del sys.modules[name]
module = __import__(name)
del sys.path[0]
del Path, here, name, sys
globals().update(module.__dict__)
| true | true |
f73dfb49ca273c2cd622cca28f41629a38850154 | 992 | py | Python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_security_group_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 4 | 2016-06-17T23:25:29.000Z | 2022-03-30T22:37:45.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_security_group_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 54 | 2016-03-25T17:25:01.000Z | 2018-10-22T17:27:54.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/network_security_group_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 3 | 2016-05-03T20:49:46.000Z | 2017-10-05T21:05:27.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 ... | 35.428571 | 149 | 0.597782 |
from msrest.paging import Paged
class NetworkSecurityGroupPaged(Paged):
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[NetworkSecurityGroup]'}
}
def __init__(self, *args, **kwargs):
super(NetworkSecurityG... | true | true |
f73dfb8958d4e3f9b93c88e039c211837ce20f88 | 2,772 | py | Python | example_mariokart.py | Cuyler36/NintendoClients | d38986674ecc4dec624694649361f1f334901020 | [
"MIT"
] | null | null | null | example_mariokart.py | Cuyler36/NintendoClients | d38986674ecc4dec624694649361f1f334901020 | [
"MIT"
] | null | null | null | example_mariokart.py | Cuyler36/NintendoClients | d38986674ecc4dec624694649361f1f334901020 | [
"MIT"
] | null | null | null |
from nintendo.nex import backend, authentication, ranking, datastore
from nintendo.games import MK8
from nintendo import account
import requests
import logging
logging.basicConfig(level=logging.INFO)
#Device id can be retrieved with a call to MCP_GetDeviceId on the Wii U
#Serial number can be found on the back of th... | 30.8 | 94 | 0.772367 |
from nintendo.nex import backend, authentication, ranking, datastore
from nintendo.games import MK8
from nintendo import account
import requests
import logging
logging.basicConfig(level=logging.INFO)
DEVICE_ID = 12345678
SERIAL_NUMBER = "..."
SYSTEM_VERSION = 0x220
REGION_ID = 4
COUNTRY_ID = 94
REGION_NAME = "EUR"... | true | true |
f73dfbb3ad628d6d9456e84ab79764156db7292d | 7,508 | py | Python | mtp_noms_ops/apps/settings/views.py | uk-gov-mirror/ministryofjustice.money-to-prisoners-noms-ops | eb537fb8a8e3adc588d50af1b000402c957b32a7 | [
"MIT"
] | 3 | 2016-12-22T15:56:57.000Z | 2020-03-10T10:37:40.000Z | mtp_noms_ops/apps/settings/views.py | uk-gov-mirror/ministryofjustice.money-to-prisoners-noms-ops | eb537fb8a8e3adc588d50af1b000402c957b32a7 | [
"MIT"
] | 61 | 2016-06-10T08:37:23.000Z | 2022-01-28T12:41:29.000Z | mtp_noms_ops/apps/settings/views.py | uk-gov-mirror/ministryofjustice.money-to-prisoners-noms-ops | eb537fb8a8e3adc588d50af1b000402c957b32a7 | [
"MIT"
] | 1 | 2021-04-11T06:13:53.000Z | 2021-04-11T06:13:53.000Z | from urllib.parse import urlencode
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import SuccessURLAllowedHostsMixin
from django.shortcuts import redirect
from django.urls import reverse, reverse_lazy
from django.utils.http import is_safe_url
from django.utils.translation import get... | 39.515789 | 103 | 0.668221 | from urllib.parse import urlencode
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.views import SuccessURLAllowedHostsMixin
from django.shortcuts import redirect
from django.urls import reverse, reverse_lazy
from django.utils.http import is_safe_url
from django.utils.translation import get... | true | true |
f73dfc126fee45a0819a344377cce6d1299075ba | 623 | py | Python | sidserver/common/sql/migrate_repo/__init__.py | UTSA-ICS/sid-server | 21a09204975dc54d6cba843233708e43bf9830d0 | [
"Apache-2.0"
] | null | null | null | sidserver/common/sql/migrate_repo/__init__.py | UTSA-ICS/sid-server | 21a09204975dc54d6cba843233708e43bf9830d0 | [
"Apache-2.0"
] | null | null | null | sidserver/common/sql/migrate_repo/__init__.py | UTSA-ICS/sid-server | 21a09204975dc54d6cba843233708e43bf9830d0 | [
"Apache-2.0"
] | 1 | 2020-07-02T09:12:28.000Z | 2020-07-02T09:12:28.000Z | # Copyright 2014 Mirantis.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 ... | 34.611111 | 75 | 0.760835 |
DB_INIT_VERSION = 43
| true | true |
f73dfcc5c30ddd6aad32958b4c3f0e278dd99d4a | 852 | py | Python | classification-multi/a/a.py | fishduke/vision | 0f7914d09a293d14f5ed91fb75068d5dc521b9c9 | [
"MIT"
] | 2 | 2020-10-05T05:37:55.000Z | 2020-10-07T04:30:04.000Z | classification-multi/a/a.py | fishduke/vision | 0f7914d09a293d14f5ed91fb75068d5dc521b9c9 | [
"MIT"
] | null | null | null | classification-multi/a/a.py | fishduke/vision | 0f7914d09a293d14f5ed91fb75068d5dc521b9c9 | [
"MIT"
] | null | null | null | from bs4 import BeautifulSoup
from datetime import datetime
import requests
import time
def get_code(company_code):
url="https://finance.naver.com/item/main.nhn?code=" + company_code
result = requests.get(url)
bs_obj = BeautifulSoup(result.content, "html.parser")
return bs_obj
def get_price(company_co... | 26.625 | 70 | 0.652582 | from bs4 import BeautifulSoup
from datetime import datetime
import requests
import time
def get_code(company_code):
url="https://finance.naver.com/item/main.nhn?code=" + company_code
result = requests.get(url)
bs_obj = BeautifulSoup(result.content, "html.parser")
return bs_obj
def get_price(company_co... | true | true |
f73dfd57a69880f0c4bb2960b392d495084eec6e | 221 | py | Python | DesignPatterns/01_Facade/2_facade/__main__.py | eduardormonteiro/PythonPersonalLibrary | 561733bb8305c4e25a08f99c28b60ec77251ad67 | [
"MIT"
] | null | null | null | DesignPatterns/01_Facade/2_facade/__main__.py | eduardormonteiro/PythonPersonalLibrary | 561733bb8305c4e25a08f99c28b60ec77251ad67 | [
"MIT"
] | null | null | null | DesignPatterns/01_Facade/2_facade/__main__.py | eduardormonteiro/PythonPersonalLibrary | 561733bb8305c4e25a08f99c28b60ec77251ad67 | [
"MIT"
] | null | null | null | from get_employees import PROVIDER
from get_employees.facade_factory import FacadeFactory
def main():
facade = FacadeFactory.create_facade(PROVIDER)
facade.get_employees()
if __name__ == '__main__':
main()
| 20.090909 | 54 | 0.764706 | from get_employees import PROVIDER
from get_employees.facade_factory import FacadeFactory
def main():
facade = FacadeFactory.create_facade(PROVIDER)
facade.get_employees()
if __name__ == '__main__':
main()
| true | true |
f73e00081d066126ef18de306ea91dd146dec201 | 591 | py | Python | hazelcast/protocol/codec/multi_map_message_type.py | buraksezer/hazelcast-python-client | 4cc593ef7de994bd84fdac8331b81b309cce30a0 | [
"Apache-2.0"
] | 3 | 2020-05-01T15:01:54.000Z | 2021-01-27T14:51:45.000Z | hazelcast/protocol/codec/multi_map_message_type.py | buraksezer/hazelcast-python-client | 4cc593ef7de994bd84fdac8331b81b309cce30a0 | [
"Apache-2.0"
] | null | null | null | hazelcast/protocol/codec/multi_map_message_type.py | buraksezer/hazelcast-python-client | 4cc593ef7de994bd84fdac8331b81b309cce30a0 | [
"Apache-2.0"
] | 1 | 2020-12-01T20:00:35.000Z | 2020-12-01T20:00:35.000Z |
MULTIMAP_PUT = 0x0201
MULTIMAP_GET = 0x0202
MULTIMAP_REMOVE = 0x0203
MULTIMAP_KEYSET = 0x0204
MULTIMAP_VALUES = 0x0205
MULTIMAP_ENTRYSET = 0x0206
MULTIMAP_CONTAINSKEY = 0x0207
MULTIMAP_CONTAINSVALUE = 0x0208
MULTIMAP_CONTAINSENTRY = 0x0209
MULTIMAP_SIZE = 0x020a
MULTIMAP_CLEAR = 0x020b
MULTIMAP_VALUECOUNT = 0x020c
MUL... | 25.695652 | 39 | 0.856176 |
MULTIMAP_PUT = 0x0201
MULTIMAP_GET = 0x0202
MULTIMAP_REMOVE = 0x0203
MULTIMAP_KEYSET = 0x0204
MULTIMAP_VALUES = 0x0205
MULTIMAP_ENTRYSET = 0x0206
MULTIMAP_CONTAINSKEY = 0x0207
MULTIMAP_CONTAINSVALUE = 0x0208
MULTIMAP_CONTAINSENTRY = 0x0209
MULTIMAP_SIZE = 0x020a
MULTIMAP_CLEAR = 0x020b
MULTIMAP_VALUECOUNT = 0x020c
MUL... | true | true |
f73e0292de7fccecb6091cd3c047353f94542b75 | 4,360 | py | Python | gfootball/examples/run_multiagent_rllib.py | Ruboninov/football | 9bdb4c2ec12b4b99f9132b578f839f05e2f950a6 | [
"Apache-2.0"
] | 2 | 2021-10-31T01:06:15.000Z | 2021-11-08T09:43:23.000Z | gfootball/examples/run_multiagent_rllib.py | Ruboninov/football | 9bdb4c2ec12b4b99f9132b578f839f05e2f950a6 | [
"Apache-2.0"
] | 20 | 2021-04-14T15:48:28.000Z | 2021-04-28T14:13:57.000Z | gfootball/examples/run_multiagent_rllib.py | Ruboninov/football | 9bdb4c2ec12b4b99f9132b578f839f05e2f950a6 | [
"Apache-2.0"
] | 2 | 2020-10-27T05:06:05.000Z | 2020-12-11T20:57:48.000Z | # coding=utf-8
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... | 31.824818 | 80 | 0.659633 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import gfootball.env as football_env
import gym
import ray
from ray import tune
from ray.rllib.env.multi_agent_env import MultiAgentEnv
from ray.tune.registry import register_env... | true | true |
f73e032135d1ebb0780d1d23e6f8c1fe756a3508 | 10,999 | py | Python | netket/driver/abstract_variational_driver.py | rbktech/netket | 847e120cad48f9c92d394e2078370e452f268a3d | [
"Apache-2.0"
] | null | null | null | netket/driver/abstract_variational_driver.py | rbktech/netket | 847e120cad48f9c92d394e2078370e452f268a3d | [
"Apache-2.0"
] | 8 | 2022-01-17T17:24:53.000Z | 2022-03-28T17:31:04.000Z | netket/driver/abstract_variational_driver.py | rbktech/netket | 847e120cad48f9c92d394e2078370e452f268a3d | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 The NetKet 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 applicable ... | 34.697161 | 108 | 0.635876 |
import abc
import numbers
from functools import partial
import numpy as np
from tqdm import tqdm
import warnings
import jax
from jax.tree_util import tree_map
from netket.logging import JsonLog
from netket.utils import node_number, n_nodes
def _to_iterable(maybe_iterable):
if hasattr(maybe_itera... | true | true |
f73e035d9e970958ec45eb9000148a6761b22927 | 5,776 | py | Python | airflow/contrib/auth/backends/google_auth.py | diggzhang/airflow-dingit | 41482b83130d5815b772840681fb36eb9bfa69b9 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 1 | 2017-12-10T03:23:05.000Z | 2017-12-10T03:23:05.000Z | airflow/contrib/auth/backends/google_auth.py | diggzhang/airflow-dingit | 41482b83130d5815b772840681fb36eb9bfa69b9 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | null | null | null | airflow/contrib/auth/backends/google_auth.py | diggzhang/airflow-dingit | 41482b83130d5815b772840681fb36eb9bfa69b9 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 3 | 2017-09-05T23:23:19.000Z | 2018-02-07T23:08:03.000Z | # Copyright 2016 Ananya Mishra (am747@cornell.edu)
#
# 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 ... | 30.887701 | 85 | 0.629501 |
import flask_login
from flask_login import (current_user,
logout_user,
login_required,
login_user)
from flask import url_for, redirect, request
from flask_oauthlib.client import OAuth
from airflow import models, configuration... | true | true |
f73e03bea4c81cd549408b5d220ed96a9d999643 | 2,370 | py | Python | setup.py | xinrong-databricks/dask | d23d40b14bfe0c9d77577e86fa0bc2488b5c8092 | [
"BSD-3-Clause"
] | null | null | null | setup.py | xinrong-databricks/dask | d23d40b14bfe0c9d77577e86fa0bc2488b5c8092 | [
"BSD-3-Clause"
] | null | null | null | setup.py | xinrong-databricks/dask | d23d40b14bfe0c9d77577e86fa0bc2488b5c8092 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
import sys
from os.path import exists
from setuptools import setup
import versioneer
# NOTE: These are tested in `continuous_integration/test_imports.sh` If
# you modify these, make sure to change the corresponding line there.
extras_require = {
"array": ["numpy >= 1.18"],
"bag": [], ... | 27.241379 | 88 | 0.636287 |
import sys
from os.path import exists
from setuptools import setup
import versioneer
extras_require = {
"array": ["numpy >= 1.18"],
"bag": [],
"dataframe": ["numpy >= 1.18", "pandas >= 1.0"],
"distributed": ["distributed == 2022.01.0"],
"diagnostics": [
"bokeh >= 2.1.1",
"ji... | true | true |
f73e03e941f8e6db885abfe692d4befc04bc21f6 | 1,191 | py | Python | ocean_utils/exceptions.py | oceanprotocol/common-utils-py | f577f4762841496584e114baaec0d476e73c700e | [
"Apache-2.0"
] | null | null | null | ocean_utils/exceptions.py | oceanprotocol/common-utils-py | f577f4762841496584e114baaec0d476e73c700e | [
"Apache-2.0"
] | 2 | 2019-12-16T11:26:21.000Z | 2021-03-18T13:06:31.000Z | ocean_utils/exceptions.py | oceanprotocol/common-utils-py | f577f4762841496584e114baaec0d476e73c700e | [
"Apache-2.0"
] | null | null | null | """Exceptions for ocean_utils """
# Copyright 2018 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
class OceanInvalidContractAddress(Exception):
"""Raised when an invalid address is passed to the contract loader."""
class OceanDIDUnknownValueType(Exception):
"""Raised when a requested DI... | 25.891304 | 76 | 0.755668 |
class OceanInvalidContractAddress(Exception):
class OceanDIDUnknownValueType(Exception):
class OceanDIDAlreadyExist(Exception):
class OceanInvalidMetadata(Exception):
class OceanInvalidServiceAgreementSignature(Exception):
class OceanServiceAgreementExists(Exception):
class OceanInitializeServiceAgree... | true | true |
f73e03f42712e062871e9bdea75edb4b1cd8e4b1 | 2,107 | py | Python | tcex/threat_intelligence/mappings/group/group_types/event.py | kdeltared/tcex | 818c0d09256764f871e42d9ca5916f92d941d882 | [
"Apache-2.0"
] | null | null | null | tcex/threat_intelligence/mappings/group/group_types/event.py | kdeltared/tcex | 818c0d09256764f871e42d9ca5916f92d941d882 | [
"Apache-2.0"
] | null | null | null | tcex/threat_intelligence/mappings/group/group_types/event.py | kdeltared/tcex | 818c0d09256764f871e42d9ca5916f92d941d882 | [
"Apache-2.0"
] | null | null | null | """ThreatConnect TI Event"""
from ..group import Group
class Event(Group):
"""Unique API calls for Event API Endpoints
Valid status:
+ Escalated
+ False Positive
+ Needs Review
+ No Further Action
Args:
tcex (TcEx): An instantiated instance of TcEx object.
event_date (str... | 31.924242 | 99 | 0.615567 | from ..group import Group
class Event(Group):
def __init__(self, tcex, **kwargs):
super().__init__(tcex, sub_type='Event', api_entity='event', api_branch='events', **kwargs)
def event_date(self, event_date):
if not self.can_update():
self._tcex.handle_error(910, [self.type])
... | true | true |
f73e06194e11ecd7a8cb57365942e59471680cb6 | 3,416 | py | Python | models/R2D2_embedding.py | vardhanaleti/AdversarialQuerying | f2ed5960f345ba448eeb4c9a1f5c819c41d092da | [
"MIT"
] | 37 | 2019-10-02T23:05:54.000Z | 2022-03-03T07:41:14.000Z | models/R2D2_embedding.py | vardhanaleti/AdversarialQuerying | f2ed5960f345ba448eeb4c9a1f5c819c41d092da | [
"MIT"
] | 2 | 2020-04-28T06:09:16.000Z | 2020-11-10T14:52:58.000Z | models/R2D2_embedding.py | vardhanaleti/AdversarialQuerying | f2ed5960f345ba448eeb4c9a1f5c819c41d092da | [
"MIT"
] | 8 | 2020-02-12T11:16:51.000Z | 2021-12-08T18:02:55.000Z | import torch.nn as nn
import torch
import math
# Embedding network used in Meta-learning with differentiable closed-form solvers
# (Bertinetto et al., in submission to NIPS 2018).
# They call the ridge rigressor version as "Ridge Regression Differentiable Discriminator (R2D2)."
# Note that they use a peculiar order... | 46.162162 | 110 | 0.619731 | import torch.nn as nn
import torch
import math
def R2D2_conv_block(in_channels, out_channels, retain_activation=True, keep_prob=1.0, activation='LeakyReLU'):
block = nn.Sequential(
nn.Conv2d(in_channels, out_channels, 3, padding=1),
nn.BatchNorm2d(out_channels),
nn.MaxPool2d(2)
... | true | true |
f73e06bd2c6d28f93906747dccbf1e2f68da2bc8 | 1,741 | py | Python | aliyun-python-sdk-core/aliyunsdkcore/http/format_type.py | DataDog/aliyun-openapi-python-sdk | 5cbee29bce6416dd62f61f0c3786b1af6ea0d84f | [
"Apache-2.0"
] | 1 | 2019-05-30T03:53:33.000Z | 2019-05-30T03:53:33.000Z | aliyun-python-sdk-core/aliyunsdkcore/http/format_type.py | liusc27/aliyun-openapi-python-sdk | 5e3db3535dd21de987dc5981e71151327d5a884f | [
"Apache-2.0"
] | null | null | null | aliyun-python-sdk-core/aliyunsdkcore/http/format_type.py | liusc27/aliyun-openapi-python-sdk | 5e3db3535dd21de987dc5981e71151327d5a884f | [
"Apache-2.0"
] | 1 | 2021-02-23T11:27:54.000Z | 2021-02-23T11:27:54.000Z | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 31.654545 | 71 | 0.7444 |
__author__ = 'alex jiang'
XML = 'XML'
JSON = 'JSON'
RAW = 'RAW'
APPLICATION_FORM = 'application/x-www-form-urlencoded'
APPLICATION_XML = 'application/xml'
APPLICATION_JSON = 'application/json'
APPLICATION_OCTET_STREAM = 'application/octet-stream'
TEXT_XML = 'text/xml'
def map_format_to_accept(form... | false | true |
f73e080c7818869a738706a40df7132dc8e096cc | 914 | py | Python | django_vali/urls.py | cnanyi/django-theme-vali-admin | fc1781ebdf2dbb456ca0aa35d18e81eb62f7789d | [
"MIT"
] | 3 | 2018-06-09T09:53:26.000Z | 2020-05-02T21:47:26.000Z | django_vali/urls.py | cnanyi/django-theme-vali-admin | fc1781ebdf2dbb456ca0aa35d18e81eb62f7789d | [
"MIT"
] | 1 | 2020-02-03T05:47:59.000Z | 2020-02-03T05:47:59.000Z | django_vali/urls.py | cnanyi/django-theme-vali-admin | fc1781ebdf2dbb456ca0aa35d18e81eb62f7789d | [
"MIT"
] | 2 | 2019-03-07T20:08:17.000Z | 2020-05-02T21:47:14.000Z | """django_vali URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Clas... | 38.083333 | 79 | 0.703501 | from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import RedirectView
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^vali/', include('vali.urls')),
url(r'', RedirectView.as_view(url='/admin/'))
]
| true | true |
f73e086dea4534e4b072d209cfde8542e77f5905 | 891 | py | Python | apps/movie/schema.py | aram2726/django_graphql | b915d148b0266628b0c03d8ff8932b16cce7b844 | [
"MIT"
] | null | null | null | apps/movie/schema.py | aram2726/django_graphql | b915d148b0266628b0c03d8ff8932b16cce7b844 | [
"MIT"
] | 6 | 2020-06-05T23:08:34.000Z | 2021-06-09T18:29:09.000Z | apps/movie/schema.py | aram2726/django_graphql | b915d148b0266628b0c03d8ff8932b16cce7b844 | [
"MIT"
] | null | null | null | import graphene
from apps.movie.mutators import MovieType, CreateMovie, UpdateMovie, DeleteMovie
from .models import Movie
class MovieInput(graphene.InputObjectType):
name = graphene.String(required=True)
class MovieMutations(graphene.ObjectType):
create_movie = CreateMovie.Field()
update_movie = Updat... | 24.75 | 80 | 0.71156 | import graphene
from apps.movie.mutators import MovieType, CreateMovie, UpdateMovie, DeleteMovie
from .models import Movie
class MovieInput(graphene.InputObjectType):
name = graphene.String(required=True)
class MovieMutations(graphene.ObjectType):
create_movie = CreateMovie.Field()
update_movie = Updat... | true | true |
f73e09a9615b3bb6c931b03cb352c21f6692e13b | 575 | py | Python | Modules/fibonacci_05/fib_fn.py | MihailMarkovski/Python-Advanced-2020 | 8edea78cbe5588a409ba9bc3767861250f58c1a6 | [
"MIT"
] | 4 | 2020-09-19T13:53:19.000Z | 2020-11-01T18:34:53.000Z | Modules/fibonacci_05/fib_fn.py | MNikov/Python-Advanced-September-2020 | 1d65039de7f094d908411afffa8aee9689ab4220 | [
"MIT"
] | null | null | null | Modules/fibonacci_05/fib_fn.py | MNikov/Python-Advanced-September-2020 | 1d65039de7f094d908411afffa8aee9689ab4220 | [
"MIT"
] | null | null | null | def create_sequence(count):
sequence = [0, 1, 1]
for n in range(3, count):
next_n = sequence[n - 1] + sequence[n - 2]
sequence.append(next_n)
print(' '.join([str(x) for x in sequence]))
def locate_number(number):
x, y = 0, 1
index = 0
while x < number:
x, y = y, x + y
... | 26.136364 | 83 | 0.577391 | def create_sequence(count):
sequence = [0, 1, 1]
for n in range(3, count):
next_n = sequence[n - 1] + sequence[n - 2]
sequence.append(next_n)
print(' '.join([str(x) for x in sequence]))
def locate_number(number):
x, y = 0, 1
index = 0
while x < number:
x, y = y, x + y
... | true | true |
f73e0a124ba5a466168e06a673255479c7c19428 | 121 | py | Python | public/python/test.py | ouhaohan8023/o_ssrpanel | fc8ff285a62ee4848c0fe99dc58315a5f611bf68 | [
"MIT"
] | 1 | 2020-05-19T09:39:53.000Z | 2020-05-19T09:39:53.000Z | public/python/test.py | ouhaohan8023/o_ssrpanel | fc8ff285a62ee4848c0fe99dc58315a5f611bf68 | [
"MIT"
] | null | null | null | public/python/test.py | ouhaohan8023/o_ssrpanel | fc8ff285a62ee4848c0fe99dc58315a5f611bf68 | [
"MIT"
] | 1 | 2020-05-19T09:39:54.000Z | 2020-05-19T09:39:54.000Z | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import sys
print '参数个数为:', len(sys.argv), '个参数。'
print '参数列表:', str(sys.argv) | 20.166667 | 37 | 0.603306 |
import sys
print '参数个数为:', len(sys.argv), '个参数。'
print '参数列表:', str(sys.argv) | false | true |
f73e0a2e838f37accfc12698b815339f989010ea | 319,713 | py | Python | torch/testing/_internal/distributed/distributed_test.py | brianjo/pytorch | 3bda4ea84228587fd67eddafb1c6637c52605dae | [
"Intel"
] | 1 | 2021-06-30T22:21:28.000Z | 2021-06-30T22:21:28.000Z | torch/testing/_internal/distributed/distributed_test.py | xiezhq-hermann/pytorch | fd8004b42e2a2348ec8837e3fb524b960c1b4cdb | [
"Intel"
] | null | null | null | torch/testing/_internal/distributed/distributed_test.py | xiezhq-hermann/pytorch | fd8004b42e2a2348ec8837e3fb524b960c1b4cdb | [
"Intel"
] | null | null | null | import copy
import itertools
import math
import os
import random
import sys
import tempfile
import time
from collections import namedtuple
from contextlib import contextmanager, suppress
from datetime import timedelta
from functools import reduce
from typing import Union, NamedTuple, Callable, Any
import torch
import ... | 41.935073 | 119 | 0.539093 | import copy
import itertools
import math
import os
import random
import sys
import tempfile
import time
from collections import namedtuple
from contextlib import contextmanager, suppress
from datetime import timedelta
from functools import reduce
from typing import Union, NamedTuple, Callable, Any
import torch
import ... | true | true |
f73e0b4fe771dc6c907d03f59429e849d5a2c875 | 744 | py | Python | hard-gists/fbadce83877a36622720/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 21 | 2019-07-08T08:26:45.000Z | 2022-01-24T23:53:25.000Z | hard-gists/fbadce83877a36622720/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 5 | 2019-06-15T14:47:47.000Z | 2022-02-26T05:02:56.000Z | hard-gists/fbadce83877a36622720/snippet.py | jjhenkel/dockerizeme | eaa4fe5366f6b9adf74399eab01c712cacaeb279 | [
"Apache-2.0"
] | 17 | 2019-05-16T03:50:34.000Z | 2021-01-14T14:35:12.000Z | # for http://blender.stackexchange.com/questions/32787/example-of-creating-and-setting-a-cycles-material-node-with-the-python-api
import bpy
# get the material
mat = bpy.data.materials['Material']
# get the nodes
nodes = mat.node_tree.nodes
# clear all nodes to start clean
for node in nodes:
nodes.remove(node)
... | 28.615385 | 129 | 0.760753 |
import bpy
mat = bpy.data.materials['Material']
nodes = mat.node_tree.nodes
for node in nodes:
nodes.remove(node)
node_ani = nodes.new(type='ShaderNodeBsdfAnisotropic')
node_ani.inputs[0].default_value = (0,1,0,1)
node_ani.inputs[1].default_value = 5.0
node_ani.location = 0,0
node_output = nodes.new(t... | true | true |
f73e0d22872adeee2b55aaccaefcf80cfc40fbfe | 5,006 | py | Python | AxonImaging/Sample Scripts/automated_motion_correction_segmentation/06_get_weighted_rois_and_surrounds_JSON.py | Rylan-L/AxonImaging | 412bac9ff343edc85d8dde2d39ea5f06ebed4fd5 | [
"MIT"
] | null | null | null | AxonImaging/Sample Scripts/automated_motion_correction_segmentation/06_get_weighted_rois_and_surrounds_JSON.py | Rylan-L/AxonImaging | 412bac9ff343edc85d8dde2d39ea5f06ebed4fd5 | [
"MIT"
] | null | null | null | AxonImaging/Sample Scripts/automated_motion_correction_segmentation/06_get_weighted_rois_and_surrounds_JSON.py | Rylan-L/AxonImaging | 412bac9ff343edc85d8dde2d39ea5f06ebed4fd5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 30 17:44:42 2015
@author: junz
"""
import os
import numpy as np
import h5py
import tifffile as tf
#import allensdk_internal.brain_observatory.mask_set as mask_set
import corticalmapping.core.ImageAnalysis as ia
import corticalmapping.core.PlottingTools as pt... | 35.757143 | 119 | 0.744307 |
"""
Created on Tue Jun 30 17:44:42 2015
@author: junz
"""
import os
import numpy as np
import h5py
import tifffile as tf
import corticalmapping.core.ImageAnalysis as ia
import corticalmapping.core.PlottingTools as pt
import scipy.ndimage as ni
import matplotlib.pyplot as plt
import json
from axonim... | false | true |
f73e0f0cf3bc12365339b9389c9861feac0c5c75 | 14,741 | py | Python | depth_and_motion_learning/consistency_losses.py | egonrian/google-research | 8177adbe9ca0d7e5a9463b54581fe6dd27be0974 | [
"Apache-2.0"
] | 3 | 2021-01-18T04:46:49.000Z | 2021-03-05T09:21:40.000Z | depth_and_motion_learning/consistency_losses.py | Alfaxad/google-research | 2c0043ecd507e75e2df9973a3015daf9253e1467 | [
"Apache-2.0"
] | 7 | 2021-11-10T19:44:38.000Z | 2022-02-10T06:48:39.000Z | depth_and_motion_learning/consistency_losses.py | Alfaxad/google-research | 2c0043ecd507e75e2df9973a3015daf9253e1467 | [
"Apache-2.0"
] | 4 | 2021-02-08T10:25:45.000Z | 2021-04-17T14:46:26.000Z | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | 45.079511 | 80 | 0.703412 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow.compat.v1 as tf
from depth_and_motion_learning import resampler
from depth_and_motion_learning import transform_utils
def rgbd_consistency_loss(frame1transformed_depth,
... | true | true |
f73e1059be87d93b7cb1181cf8bdcdc9331d220d | 18,312 | py | Python | sklearn/datasets/_twenty_newsgroups.py | lacrosse91/scikit-learn | 2325b19a86bd5b6e4b0bfb4eff4ee46a3343cf65 | [
"BSD-3-Clause"
] | 27 | 2015-01-22T22:30:09.000Z | 2022-02-15T07:33:06.000Z | sklearn/datasets/_twenty_newsgroups.py | ryanyu9/scikit-learn | 2a67d88258264eb2b6dfad221be8f8d61684dcba | [
"BSD-3-Clause"
] | 6 | 2021-07-05T15:38:00.000Z | 2022-02-27T13:35:19.000Z | sklearn/datasets/_twenty_newsgroups.py | ryanyu9/scikit-learn | 2a67d88258264eb2b6dfad221be8f8d61684dcba | [
"BSD-3-Clause"
] | 25 | 2015-07-30T13:47:25.000Z | 2021-08-03T07:48:38.000Z | """Caching loader for the 20 newsgroups text classification dataset.
The description of the dataset is available on the official website at:
http://people.csail.mit.edu/jrennie/20Newsgroups/
Quoting the introduction:
The 20 Newsgroups data set is a collection of approximately 20,000
newsgroup documents... | 33.848429 | 86 | 0.647554 |
import os
from os.path import dirname, join
import logging
import tarfile
import pickle
import shutil
import re
import codecs
import numpy as np
import scipy.sparse as sp
import joblib
from . import get_data_home
from . import load_files
from ._base import _convert_data_dataframe
from ._base import _pkl_filepath
f... | true | true |
f73e116753c7d7923e9626acd3dcbd88a4c7d29a | 289 | py | Python | freq.py | soulruler01/print-the-letters-in-decreasing-order-of-frequency-using-dictionaries | 8ce55e1aefa63cceb3fe1ad709a5ac5d44f0a8c3 | [
"MIT"
] | null | null | null | freq.py | soulruler01/print-the-letters-in-decreasing-order-of-frequency-using-dictionaries | 8ce55e1aefa63cceb3fe1ad709a5ac5d44f0a8c3 | [
"MIT"
] | null | null | null | freq.py | soulruler01/print-the-letters-in-decreasing-order-of-frequency-using-dictionaries | 8ce55e1aefa63cceb3fe1ad709a5ac5d44f0a8c3 | [
"MIT"
] | null | null | null | def most_frequent(s):
dic={}
for i in s:
if i in dic:
dic[i] += 1
else:
dic[i] = 1
z = sorted(dic.items(), key = lambda x: x[1], reverse = True)
for i in z:
print(i[0]+"="+str(i[1]))
most_frequent('mississippi')
| 22.230769 | 66 | 0.449827 | def most_frequent(s):
dic={}
for i in s:
if i in dic:
dic[i] += 1
else:
dic[i] = 1
z = sorted(dic.items(), key = lambda x: x[1], reverse = True)
for i in z:
print(i[0]+"="+str(i[1]))
most_frequent('mississippi')
| true | true |
f73e12a1c014661754813b808c8c50782a8dc99d | 4,282 | py | Python | colour_datasets/loaders/jakob2019.py | colour-science/colour-datasets | 464c387c17739f08a0cceb5185f6b225872adb6c | [
"BSD-3-Clause"
] | 28 | 2019-06-15T03:07:28.000Z | 2022-03-28T14:11:51.000Z | colour_datasets/loaders/jakob2019.py | JGoldstone/colour-datasets | 8e0b52870c63c0e9b72d8b848720e0c28e0cbfa4 | [
"BSD-3-Clause"
] | 12 | 2020-03-24T17:35:36.000Z | 2021-11-09T08:49:39.000Z | colour_datasets/loaders/jakob2019.py | JGoldstone/colour-datasets | 8e0b52870c63c0e9b72d8b848720e0c28e0cbfa4 | [
"BSD-3-Clause"
] | 8 | 2019-10-27T15:00:52.000Z | 2022-01-26T15:29:38.000Z | # -*- coding: utf-8 -*-
"""
Spectral Upsampling Coefficient Tables - Jakob and Hanika (2019)
================================================================
Defines the objects implementing support for *Jakob and Hanika (2019)*
*Spectral Upsampling Coefficient Tables* dataset loading:
- :class:`colour_datasets.loa... | 27.986928 | 79 | 0.64596 |
import glob
import os
from collections import OrderedDict
from colour.recovery import LUT3D_Jakob2019
from colour_datasets.loaders import AbstractDatasetLoader
from colour_datasets.records import datasets
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2019-2021 - Colour Developers'
__license__ = '... | true | true |
f73e1317e89a0a57fb514f616b6d1a3b3eb11737 | 2,229 | py | Python | tensorflow_federated/python/core/impl/computation_impl_test.py | justin1121/federated | 117464b1c20d5890b50fc16f5fc030cf9a29ba6c | [
"Apache-2.0"
] | 5 | 2019-07-23T14:49:46.000Z | 2022-03-30T13:54:22.000Z | tensorflow_federated/python/core/impl/computation_impl_test.py | DaveKim3872/federated | 3559af64e8417ccb1b12a9d26f366b721bef021b | [
"Apache-2.0"
] | null | null | null | tensorflow_federated/python/core/impl/computation_impl_test.py | DaveKim3872/federated | 3559af64e8417ccb1b12a9d26f366b721bef021b | [
"Apache-2.0"
] | 1 | 2020-03-30T19:02:55.000Z | 2020-03-30T19:02:55.000Z | # Copyright 2018, The TensorFlow Federated Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | 37.779661 | 80 | 0.729026 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl.testing import absltest
import tensorflow as tf
from tensorflow_federated.proto.v0 import computation_pb2 as pb
from tensorflow_federated.python.core.api import computation_types
from t... | true | true |
f73e136dbb946cc2727f5e35cccc91bc6b420753 | 3,634 | py | Python | groupdocs_conversion_cloud/models/jpeg_convert_options.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python | 841d06ad3205e10e8f2726517779ac2d7c33a02a | [
"MIT"
] | 5 | 2019-11-21T04:58:45.000Z | 2021-02-05T05:22:37.000Z | groupdocs_conversion_cloud/models/jpeg_convert_options.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python | 841d06ad3205e10e8f2726517779ac2d7c33a02a | [
"MIT"
] | null | null | null | groupdocs_conversion_cloud/models/jpeg_convert_options.py | groupdocs-conversion-cloud/groupdocs-conversion-cloud-python | 841d06ad3205e10e8f2726517779ac2d7c33a02a | [
"MIT"
] | null | null | null | # coding: utf-8
# -----------------------------------------------------------------------------------
# <copyright company="Aspose Pty Ltd" file="JpegConvertOptions.py">
# Copyright (c) 2003-2021 Aspose Pty Ltd
# </copyright>
# <summary>
# Permission is hereby granted, free of charge, to any person obtaining a cop... | 34.942308 | 85 | 0.59934 |
import pprint
import re
import six
from groupdocs_conversion_cloud.models import JpgConvertOptions
class JpegConvertOptions(JpgConvertOptions):
swagger_types = {
}
attribute_map = {
}
def __init__(self, **kwargs):
base = super(JpegConvertOptions, self)
... | true | true |
f73e168829aff96aebe0833e5d64b250145dd594 | 28,598 | py | Python | mesonbuild/modules/pkgconfig.py | xggrnx/meson | af8b55d49b64e72dbefbd40d613b93f56d17b855 | [
"Apache-2.0"
] | null | null | null | mesonbuild/modules/pkgconfig.py | xggrnx/meson | af8b55d49b64e72dbefbd40d613b93f56d17b855 | [
"Apache-2.0"
] | null | null | null | mesonbuild/modules/pkgconfig.py | xggrnx/meson | af8b55d49b64e72dbefbd40d613b93f56d17b855 | [
"Apache-2.0"
] | null | null | null | # Copyright 2015 The Meson development team
# 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 ... | 48.969178 | 160 | 0.582313 |
import os
from pathlib import PurePath
from .. import build
from .. import dependencies
from ..dependencies import ThreadDependency
from .. import mesonlib
from .. import mlog
from . import ModuleReturnValue
from . import ExtensionModule
from ..interpreterbase import permittedKwargs, FeatureNew, FeatureN... | true | true |
f73e16a1f56d97d580c3491d375c2e7d693b5904 | 2,924 | py | Python | functions/socketio/stream.py | codions-forks/flask-nginx-rtmp-manager | 9088c44616a2e94f6771216af6f22c241064e321 | [
"MIT"
] | 1 | 2021-09-26T05:32:00.000Z | 2021-09-26T05:32:00.000Z | functions/socketio/stream.py | codions-forks/flask-nginx-rtmp-manager | 9088c44616a2e94f6771216af6f22c241064e321 | [
"MIT"
] | null | null | null | functions/socketio/stream.py | codions-forks/flask-nginx-rtmp-manager | 9088c44616a2e94f6771216af6f22c241064e321 | [
"MIT"
] | null | null | null | from flask_socketio import emit
from flask_security import current_user
from sqlalchemy import update
from classes.shared import db, socketio
from classes import Channel
from classes import Stream
from classes import settings
from functions import system
from functions import webhookFunc
from functions import templa... | 42.376812 | 138 | 0.718536 | from flask_socketio import emit
from flask_security import current_user
from sqlalchemy import update
from classes.shared import db, socketio
from classes import Channel
from classes import Stream
from classes import settings
from functions import system
from functions import webhookFunc
from functions import templa... | true | true |
f73e1762c143d495986eb2f7a7651c4d11930c34 | 17,681 | py | Python | sevenseconds/config/bastion.py | jonathanbeber/sevenseconds | a8ba8f5fc5f7e658a928f807ab7905b56498f12e | [
"Apache-2.0"
] | null | null | null | sevenseconds/config/bastion.py | jonathanbeber/sevenseconds | a8ba8f5fc5f7e658a928f807ab7905b56498f12e | [
"Apache-2.0"
] | null | null | null | sevenseconds/config/bastion.py | jonathanbeber/sevenseconds | a8ba8f5fc5f7e658a928f807ab7905b56498f12e | [
"Apache-2.0"
] | null | null | null | import time
import socket
import yaml
import datetime
import base64
import difflib
import botocore.exceptions
import requests
import json
from copy import deepcopy
from ..helper import info, warning, error, ActionOnExit, substitute_template_vars
from ..helper.aws import filter_subnets, associate_address, get_tag
from .... | 43.65679 | 120 | 0.580963 | import time
import socket
import yaml
import datetime
import base64
import difflib
import botocore.exceptions
import requests
import json
from copy import deepcopy
from ..helper import info, warning, error, ActionOnExit, substitute_template_vars
from ..helper.aws import filter_subnets, associate_address, get_tag
from .... | true | true |
f73e1766a6f2995af45f56ada2c106b95188b432 | 1,075 | py | Python | Math/python/leetcode69_Sqrt_x.py | wenxinjie/leetcode | c459a01040c8fe0783e15a16b8d7cca4baf4612a | [
"Apache-2.0"
] | null | null | null | Math/python/leetcode69_Sqrt_x.py | wenxinjie/leetcode | c459a01040c8fe0783e15a16b8d7cca4baf4612a | [
"Apache-2.0"
] | null | null | null | Math/python/leetcode69_Sqrt_x.py | wenxinjie/leetcode | c459a01040c8fe0783e15a16b8d7cca4baf4612a | [
"Apache-2.0"
] | null | null | null | # Implement int sqrt(int x).
# Compute and return the square root of x, where x is guaranteed to be a non-negative integer.
# Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.
# Example 1:
# Input: 4
# Output: 2
# Example 2:
# Input: 8
# Outp... | 23.888889 | 124 | 0.528372 |
class Solution:
def mySqrt(self, x):
if x == 0:
return 0
elif x < 4:
return 1
elif x < 9:
return 2
res = self.helper(x, 0, x//2)
return res
def helper(self, x, left, right):
mid = (left + right)//2
... | true | true |
f73e18208160fc1d67a3bd81f5452083e16ca14f | 7,247 | py | Python | MV3D_TF_release/lib/datasets/voc_eval.py | ZiningWang/Sparse_Pooling | a160ddf9a03ef53bad630b4ac186a8437bd0475c | [
"Unlicense"
] | 52 | 2018-08-28T03:44:51.000Z | 2022-03-23T16:00:14.000Z | MV3D_TF_release/lib/datasets/voc_eval.py | weidezhang/Sparse_Pooling | a160ddf9a03ef53bad630b4ac186a8437bd0475c | [
"Unlicense"
] | 1 | 2019-06-25T01:32:35.000Z | 2019-07-01T01:34:20.000Z | MV3D_TF_release/lib/datasets/voc_eval.py | weidezhang/Sparse_Pooling | a160ddf9a03ef53bad630b4ac186a8437bd0475c | [
"Unlicense"
] | 20 | 2018-07-31T18:17:35.000Z | 2021-07-09T08:42:06.000Z | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import xml.etree.ElementTree as ET
import os
import pickle
import numpy as np
import pdb
def pa... | 35.179612 | 78 | 0.507382 |
import xml.etree.ElementTree as ET
import os
import pickle
import numpy as np
import pdb
def parse_rec(filename):
tree = ET.parse(filename)
objects = []
for obj in tree.findall('object'):
obj_struct = {}
obj_struct['name'] = obj.find('name').text
obj_struct['pose'] = obj.find('... | true | true |
f73e196426efceb90395be40386532ec921d821d | 229 | py | Python | src/xsd_auth/forms.py | minyiky/xSACdb | 8c407e9a9da196750a66ad53613ad67c8c56e1c3 | [
"MIT"
] | 2 | 2017-08-14T14:40:17.000Z | 2019-02-07T13:10:23.000Z | src/xsd_auth/forms.py | minyiky/xSACdb | 8c407e9a9da196750a66ad53613ad67c8c56e1c3 | [
"MIT"
] | 19 | 2016-02-07T18:02:53.000Z | 2019-11-03T17:48:13.000Z | src/xsd_auth/forms.py | minyiky/xSACdb | 8c407e9a9da196750a66ad53613ad67c8c56e1c3 | [
"MIT"
] | 4 | 2015-10-19T17:24:35.000Z | 2021-05-12T07:30:32.000Z | from django import forms
from allauth.socialaccount.forms import SignupForm as SocialSignupForm
class SignupForm(SocialSignupForm):
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)
| 28.625 | 70 | 0.812227 | from django import forms
from allauth.socialaccount.forms import SignupForm as SocialSignupForm
class SignupForm(SocialSignupForm):
first_name = forms.CharField(max_length=30)
last_name = forms.CharField(max_length=30)
| true | true |
f73e19b9e95c7ed922b35ea3a9896dd6ff7155c1 | 8,635 | py | Python | uwsgi_sloth/analyzer.py | prafulbagai/uwsgi-sloth | b19b9a7e6a0b8edfdc94bfbe9f7a0030ab95db03 | [
"Apache-2.0"
] | 127 | 2015-01-02T11:57:22.000Z | 2022-03-03T02:23:54.000Z | uwsgi_sloth/analyzer.py | prafulbagai/uwsgi-sloth | b19b9a7e6a0b8edfdc94bfbe9f7a0030ab95db03 | [
"Apache-2.0"
] | 8 | 2015-06-15T12:10:13.000Z | 2019-07-21T23:01:18.000Z | uwsgi_sloth/analyzer.py | prafulbagai/uwsgi-sloth | b19b9a7e6a0b8edfdc94bfbe9f7a0030ab95db03 | [
"Apache-2.0"
] | 20 | 2015-01-06T03:27:25.000Z | 2020-09-04T03:53:46.000Z | # -*- coding: utf-8 -*-
"""Analyzer for uwsgi log"""
import re
import copy
import datetime
from uwsgi_sloth.utils import total_seconds
from uwsgi_sloth.structures import ValuesAggregation
from uwsgi_sloth.settings import FILTER_METHODS, FILTER_STATUS, LIMIT_URL_GROUPS, \
LIMIT_PER_URL_G... | 35.244898 | 106 | 0.600579 |
import re
import copy
import datetime
from uwsgi_sloth.utils import total_seconds
from uwsgi_sloth.structures import ValuesAggregation
from uwsgi_sloth.settings import FILTER_METHODS, FILTER_STATUS, LIMIT_URL_GROUPS, \
LIMIT_PER_URL_GROUP, ROOT, REALTIME_UPDATE_INTERVAL
class UWSGILo... | true | true |
f73e19e80dfde9f3b5cf491e079c74c1744a629e | 2,182 | py | Python | factors.py | w4jbm/Python-Programs | 3c7c63d3c85e58c80252809f931daab0e67b43b8 | [
"Unlicense",
"MIT"
] | 1 | 2021-07-03T00:21:04.000Z | 2021-07-03T00:21:04.000Z | factors.py | w4jbm/Python-Programs | 3c7c63d3c85e58c80252809f931daab0e67b43b8 | [
"Unlicense",
"MIT"
] | null | null | null | factors.py | w4jbm/Python-Programs | 3c7c63d3c85e58c80252809f931daab0e67b43b8 | [
"Unlicense",
"MIT"
] | null | null | null | #!/usr/bin/python3
#
# factors.py - Find the factors of a positive integer
#
# By Jim McClanahah, W4JBM (Dec 2020)
#
# Find the factors of a provided positive integer.
#
# The function is a modification of one originally
# provided by Harshit Agrawal to the geeksforgeeks.org
# website.
#
# It seems like things stop wor... | 26.609756 | 62 | 0.617782 |
import sys
import math
def primeFactors(n):
lst=[]
while n % 2 == 0:
lst.append(2)
n = n / 2
# n must be odd at this point so a skip of 2
# (i.e., i = i + 2) can be used
for i in range(3,int(math.sqrt(n))+1,2):
... | true | true |
f73e1ab59f0ad3d2ec802ec8ad2285bb719e7f38 | 1,933 | py | Python | hangman.py | KevinCardenasDev/PythonIntermedio | 022fa790ac57263df26cc44c68ea1e8b92e94cff | [
"MIT"
] | null | null | null | hangman.py | KevinCardenasDev/PythonIntermedio | 022fa790ac57263df26cc44c68ea1e8b92e94cff | [
"MIT"
] | null | null | null | hangman.py | KevinCardenasDev/PythonIntermedio | 022fa790ac57263df26cc44c68ea1e8b92e94cff | [
"MIT"
] | null | null | null | import random
NUMBERS = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
def read_file():
WORDS = []
with open("./archivos/data.txt", "r", encoding="utf-8") as f:
for line in f:
WORDS.append(line.replace("\n", ""))
return WORDS
def random_word(words):
idx = random.randint(0, len(wor... | 27.614286 | 89 | 0.475944 | import random
NUMBERS = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
def read_file():
WORDS = []
with open("./archivos/data.txt", "r", encoding="utf-8") as f:
for line in f:
WORDS.append(line.replace("\n", ""))
return WORDS
def random_word(words):
idx = random.randint(0, len(wor... | true | true |
f73e1be033d66fa151dcb1a8eede36e0edcbcf22 | 342 | py | Python | pyleecan/Methods/Machine/CondType13/comp_surface_active.py | Eomys/Pyleecan | 4d7f0cbabf0311006963e7a2f435db2ecd901118 | [
"Apache-2.0"
] | 4 | 2017-11-27T10:14:34.000Z | 2018-09-20T11:30:32.000Z | pyleecan/Methods/Machine/CondType13/comp_surface_active.py | Eomys/Pyleecan | 4d7f0cbabf0311006963e7a2f435db2ecd901118 | [
"Apache-2.0"
] | null | null | null | pyleecan/Methods/Machine/CondType13/comp_surface_active.py | Eomys/Pyleecan | 4d7f0cbabf0311006963e7a2f435db2ecd901118 | [
"Apache-2.0"
] | null | null | null | def comp_surface_active(self):
"""Compute the active surface of the conductor
Parameters
----------
self : CondType13
A CondType13 object
Returns
-------
Sact: float
Surface without insulation [m**2]
"""
Sact = self.Wwire * self.Wwire * self.Nwppc_tan * self.Nwppc... | 18 | 68 | 0.596491 | def comp_surface_active(self):
Sact = self.Wwire * self.Wwire * self.Nwppc_tan * self.Nwppc_rad
return Sact
| true | true |
f73e1be0cafcb8b796324ceebe9febe3aad4376b | 12,057 | py | Python | pvtools.py | sadams2013/pvtools | 12bd9334a1335972519c81d0c01c6308aa597c39 | [
"MIT"
] | 1 | 2020-12-23T11:11:59.000Z | 2020-12-23T11:11:59.000Z | pvtools.py | sadams2013/pvtools | 12bd9334a1335972519c81d0c01c6308aa597c39 | [
"MIT"
] | null | null | null | pvtools.py | sadams2013/pvtools | 12bd9334a1335972519c81d0c01c6308aa597c39 | [
"MIT"
] | 1 | 2021-01-05T18:37:25.000Z | 2021-01-05T18:37:25.000Z | # Import standard libraries.
import json
# Import external libraries.
import numpy as np
import pandas as pd
class dbSNP:
"""Store dbSNP data for a gene.
Parameters
----------
dbsnp_file : str
Path to a dbSNP file containing variant information.
Attributes
----------
df : pandas.... | 34.746398 | 150 | 0.562744 |
import json
import numpy as np
import pandas as pd
class dbSNP:
def __init__(self, dbsnp_file):
self.df = pd.read_table(dbsnp_file)
def get_ref(self, start, end):
try:
i = (self.df['chromStart'] == start) & (self.df['chromEnd'] == end)
result = self.df[i]['name'].val... | true | true |
f73e1c0a7688518e63f8e8d783b887280d8de5dd | 3,830 | py | Python | src/main/python/thalesians/tsa/optimization/visual.py | vishalbelsare/tsa | 203e602fe5fc95b89afb454156fc7e4faee90f2a | [
"Apache-2.0"
] | 117 | 2017-06-30T14:29:32.000Z | 2022-02-10T00:54:35.000Z | src/main/python/thalesians/tsa/optimization/visual.py | vishalbelsare/tsa | 203e602fe5fc95b89afb454156fc7e4faee90f2a | [
"Apache-2.0"
] | 2 | 2017-09-01T11:42:14.000Z | 2017-11-29T20:00:19.000Z | src/main/python/thalesians/tsa/optimization/visual.py | vishalbelsare/tsa | 203e602fe5fc95b89afb454156fc7e4faee90f2a | [
"Apache-2.0"
] | 37 | 2017-07-05T19:51:10.000Z | 2021-04-27T00:11:18.000Z | import itertools
import time
import warnings
import numpy as np
import matplotlib.colors
import matplotlib.pyplot as plt
import thalesians.tsa.checks as checks
import thalesians.tsa.numpyutils as npu
import thalesians.tsa.utils as utils
def _aggregate(aggregate_func, data, empty_aggregate):
if empty_aggregate !=... | 42.087912 | 156 | 0.609138 | import itertools
import time
import warnings
import numpy as np
import matplotlib.colors
import matplotlib.pyplot as plt
import thalesians.tsa.checks as checks
import thalesians.tsa.numpyutils as npu
import thalesians.tsa.utils as utils
def _aggregate(aggregate_func, data, empty_aggregate):
if empty_aggregate !=... | true | true |
f73e1d51694172dda5cb6550512fac7b3b4e4bd0 | 12,313 | py | Python | code/python/StocksAPIforDigitalPortals/v2/fds/sdk/StocksAPIforDigitalPortals/model/stock_notation_screener_search_data_performance_end_of_day_week1.py | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | 6 | 2022-02-07T16:34:18.000Z | 2022-03-30T08:04:57.000Z | code/python/StocksAPIforDigitalPortals/v2/fds/sdk/StocksAPIforDigitalPortals/model/stock_notation_screener_search_data_performance_end_of_day_week1.py | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | 2 | 2022-02-07T05:25:57.000Z | 2022-03-07T14:18:04.000Z | code/python/StocksAPIforDigitalPortals/v2/fds/sdk/StocksAPIforDigitalPortals/model/stock_notation_screener_search_data_performance_end_of_day_week1.py | factset/enterprise-sdk | 3fd4d1360756c515c9737a0c9a992c7451d7de7e | [
"Apache-2.0"
] | null | null | null | """
Prime Developer Trial
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from fds.sdk.S... | 45.94403 | 161 | 0.598879 |
import re
import sys
from fds.sdk.StocksAPIforDigitalPortals.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_... | true | true |
f73e1e62965a6e32a612a32cdaf83a3e565b2aba | 997 | py | Python | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 4 | 2016-06-17T23:25:29.000Z | 2022-03-30T22:37:45.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 54 | 2016-03-25T17:25:01.000Z | 2018-10-22T17:27:54.000Z | azure-mgmt-network/azure/mgmt/network/v2017_09_01/models/virtual_network_gateway_paged.py | JonathanGailliez/azure-sdk-for-python | f0f051bfd27f8ea512aea6fc0c3212ee9ee0029b | [
"MIT"
] | 3 | 2016-05-03T20:49:46.000Z | 2017-10-05T21:05:27.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 ... | 35.607143 | 151 | 0.599799 |
from msrest.paging import Paged
class VirtualNetworkGatewayPaged(Paged):
_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[VirtualNetworkGateway]'}
}
def __init__(self, *args, **kwargs):
super(VirtualNetwork... | true | true |
f73e1e875eae6a7f4616a8ff224bd7dc4e109132 | 1,487 | py | Python | projects/1-molecular-dynamics/check.py | MUYANGGUO/HPC | ab95d18d4054b892269dd439470548abd06f5512 | [
"MIT"
] | 2 | 2021-08-04T11:03:07.000Z | 2022-03-17T04:57:00.000Z | projects/1-molecular-dynamics/check.py | MUYANGGUO/HPC | ab95d18d4054b892269dd439470548abd06f5512 | [
"MIT"
] | null | null | null | projects/1-molecular-dynamics/check.py | MUYANGGUO/HPC | ab95d18d4054b892269dd439470548abd06f5512 | [
"MIT"
] | 2 | 2019-11-19T21:16:21.000Z | 2021-01-07T05:13:11.000Z |
if __name__ == "__main__":
import sys
import json
import numpy as np
firstline = sys.stdin.readline()
obj = json.loads(firstline)
Np = obj['num_points']
dt = obj['dt']
L = obj['L']
Nt = obj['num_steps']
Nint = obj['step_chunk']
k = obj['k']
d = obj['d']
gifname = ... | 29.156863 | 65 | 0.492266 |
if __name__ == "__main__":
import sys
import json
import numpy as np
firstline = sys.stdin.readline()
obj = json.loads(firstline)
Np = obj['num_points']
dt = obj['dt']
L = obj['L']
Nt = obj['num_steps']
Nint = obj['step_chunk']
k = obj['k']
d = obj['d']
gifname = ... | true | true |
f73e1ee2d8bad91d5e8f74197e5063b0b3a1bda4 | 2,460 | py | Python | app/utils.py | jkereako/flask-api-skeleton | b765f335208b93056867f8f28d072dbd42abe826 | [
"MIT"
] | 4 | 2017-09-25T09:31:57.000Z | 2021-07-28T15:57:23.000Z | app/utils.py | jkereako/flask-api-skeleton | b765f335208b93056867f8f28d072dbd42abe826 | [
"MIT"
] | null | null | null | app/utils.py | jkereako/flask-api-skeleton | b765f335208b93056867f8f28d072dbd42abe826 | [
"MIT"
] | 3 | 2016-06-30T07:28:47.000Z | 2020-10-31T15:08:16.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
utils
~~~~~
Utility methods.
I'm including this file in the skeleton because it contains methods I've
found useful.
The goal is to keep this file as lean as possible.
:author: Jeff Kereakoglow
:date: 2014-11-14
:copyright: (c) 2014 ... | 28.604651 | 78 | 0.673171 |
from flask import request
import app
def prepare_json_response(success, message, data):
response = {"meta":{"success":success, "request":request.url}}
if data:
response["data"] = data
response["meta"]["data_count"] = len(data)
if message:
response["meta"]["message"] = message
... | true | true |
f73e1f2737483267ee57033b50462b9d6e91aabe | 17,652 | py | Python | tools/perf/scripts_smoke_unittest.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | tools/perf/scripts_smoke_unittest.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2015-10-21T13:02:42.000Z | 2022-03-14T07:50:50.000Z | tools/perf/scripts_smoke_unittest.py | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | # Copyright 2015 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 __future__ import print_function
import json
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import unittest
from t... | 43.477833 | 93 | 0.669103 |
from __future__ import print_function
import json
import logging
import os
import shutil
import subprocess
import sys
import tempfile
import unittest
from telemetry import decorators
from telemetry.testing import options_for_unittests
RUNNER_SCRIPTS_DIR = os.path.join(os.path.dirname(__file__),
... | true | true |
f73e1f6241b7d6e7a26e4da5c1098b6baf09c872 | 2,873 | py | Python | tests/app_text.py | pglet/pglet-python | 31f65083d68888661d4780322c26bfc57c091e1c | [
"MIT"
] | 12 | 2021-05-01T17:49:57.000Z | 2022-02-12T21:20:56.000Z | tests/app_text.py | pglet/pglet-python | 31f65083d68888661d4780322c26bfc57c091e1c | [
"MIT"
] | 47 | 2021-01-22T18:31:22.000Z | 2022-03-24T00:17:03.000Z | tests/app_text.py | pglet/pglet-python | 31f65083d68888661d4780322c26bfc57c091e1c | [
"MIT"
] | 10 | 2021-02-08T19:13:42.000Z | 2022-03-26T10:40:20.000Z | import os
import sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import pglet
from pglet import Stack, Text
def main(page):
page.add(
Text('Squares', size='large'),
Stack(h... | 42.25 | 202 | 0.641838 | import os
import sys,inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
import pglet
from pglet import Stack, Text
def main(page):
page.add(
Text('Squares', size='large'),
Stack(h... | true | true |
f73e1f7b2a7d9a4cce3cd080e48fed5c3c089984 | 3,471 | py | Python | scripts/gan/cycle_gan/train.py | hiroyasuakada/ros_start | 10221ad2bcaefa4aaadc6c90424a3751126ac256 | [
"MIT"
] | null | null | null | scripts/gan/cycle_gan/train.py | hiroyasuakada/ros_start | 10221ad2bcaefa4aaadc6c90424a3751126ac256 | [
"MIT"
] | null | null | null | scripts/gan/cycle_gan/train.py | hiroyasuakada/ros_start | 10221ad2bcaefa4aaadc6c90424a3751126ac256 | [
"MIT"
] | null | null | null | import os
import random
import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torchvision.transforms as transforms
from torchvision.utils import make_grid
from torch.autograd import Variable
from PIL import Image
import matplotlib.pyplot as plt
from tensorboardX import Su... | 31.844037 | 106 | 0.652838 | import os
import random
import itertools
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torchvision.transforms as transforms
from torchvision.utils import make_grid
from torch.autograd import Variable
from PIL import Image
import matplotlib.pyplot as plt
from tensorboardX import Su... | true | true |
f73e20489d20cf4f5c8057aeb413fc2f1f957f89 | 3,355 | py | Python | setup.py | albert118/jaffle | 55da4d75ad3a9ca633af3865cc35b73e3406a4ef | [
"BSD-3-Clause"
] | null | null | null | setup.py | albert118/jaffle | 55da4d75ad3a9ca633af3865cc35b73e3406a4ef | [
"BSD-3-Clause"
] | null | null | null | setup.py | albert118/jaffle | 55da4d75ad3a9ca633af3865cc35b73e3406a4ef | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
# flake8: noqa
import os
from setuptools import find_packages, setup
from jaffle import __version__
long_description = '''
Jaffle is an automation tool for Python software development, which does:
- Instantiate Python applications in a Jupyter kernel and allows them to call
each other
- L... | 27.958333 | 110 | 0.653949 |
import os
from setuptools import find_packages, setup
from jaffle import __version__
long_description = '''
Jaffle is an automation tool for Python software development, which does:
- Instantiate Python applications in a Jupyter kernel and allows them to call
each other
- Launch external processes
- Combine lo... | true | true |
f73e209070dc37f7d696a0195027ea1dc8af011c | 564 | py | Python | ansible/ansiblelints/stage/LongStatement.py | KalmanMeth/defect-prediction | 0a4b549b8af5259241f41eaee77dd841e98e0064 | [
"Apache-2.0"
] | null | null | null | ansible/ansiblelints/stage/LongStatement.py | KalmanMeth/defect-prediction | 0a4b549b8af5259241f41eaee77dd841e98e0064 | [
"Apache-2.0"
] | null | null | null | ansible/ansiblelints/stage/LongStatement.py | KalmanMeth/defect-prediction | 0a4b549b8af5259241f41eaee77dd841e98e0064 | [
"Apache-2.0"
] | null | null | null | from ansiblelint import AnsibleLintRule
class LongStatement(AnsibleLintRule):
id = 'ANSIBLE0020'
descreiption = 'Keeping line in YAML file below 160 characters'
severity = 'medium'
tags = {'clarity'}
version_added = 'v1.0.0'
shortdesc = 'Keeping line in YAML file below 160 characters'
def... | 29.684211 | 67 | 0.620567 | from ansiblelint import AnsibleLintRule
class LongStatement(AnsibleLintRule):
id = 'ANSIBLE0020'
descreiption = 'Keeping line in YAML file below 160 characters'
severity = 'medium'
tags = {'clarity'}
version_added = 'v1.0.0'
shortdesc = 'Keeping line in YAML file below 160 characters'
def... | true | true |
f73e21974536b042d36ad1dd7d0bec01a5a1aed7 | 75,532 | py | Python | Bio/SeqFeature.py | rchurt/biopython | 4e9a15172ba26bae104eaa7f05819cd6d41d0da8 | [
"BSD-3-Clause"
] | 2 | 2020-06-25T12:52:03.000Z | 2020-07-11T09:47:34.000Z | Bio/SeqFeature.py | EmmanuelOwusu/biopython | 4e9a15172ba26bae104eaa7f05819cd6d41d0da8 | [
"BSD-3-Clause"
] | null | null | null | Bio/SeqFeature.py | EmmanuelOwusu/biopython | 4e9a15172ba26bae104eaa7f05819cd6d41d0da8 | [
"BSD-3-Clause"
] | null | null | null | # Copyright 2000-2003 Jeff Chang.
# Copyright 2001-2008 Brad Chapman.
# Copyright 2005-2016 by Peter Cock.
# Copyright 2006-2009 Michiel de Hoon.
# All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
#... | 34.254875 | 102 | 0.606418 |
from collections import OrderedDict
from Bio.Seq import MutableSeq, reverse_complement
class SeqFeature:
def __init__(
self,
location=None,
type="",
location_operator="",
strand=None,
id="<unknown id>",
qualifiers=None,
sub_features=Non... | true | true |
f73e22e6f2a1a6f43caad4aecd36ef7f0884eed1 | 672 | py | Python | setup.py | vinobc/ssncoe | e286cd55e31b0e61954e57e9b7f53251c3f419b7 | [
"MIT"
] | null | null | null | setup.py | vinobc/ssncoe | e286cd55e31b0e61954e57e9b7f53251c3f419b7 | [
"MIT"
] | null | null | null | setup.py | vinobc/ssncoe | e286cd55e31b0e61954e57e9b7f53251c3f419b7 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import re, ast
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
# get version from __version__ variable in it_dept_library/__init__.py
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('ssncoe/__init__... | 25.846154 | 70 | 0.730655 |
from setuptools import setup, find_packages
import re, ast
with open('requirements.txt') as f:
install_requires = f.read().strip().split('\n')
_version_re = re.compile(r'__version__\s+=\s+(.*)')
with open('ssncoe/__init__.py', 'rb') as f:
version = str(ast.literal_eval(_version_re.search(
f.read().decode('utf-... | true | true |
f73e23632950e7223ada376f90e321f85c077de0 | 462 | py | Python | requirements/docutils-0.18/test/functional/tests/math_output_mathml.py | QuentinTournier40/AnimationFreeCAD | 8eaff8356ec68b948a721b83a6888b652278db8a | [
"Apache-2.0"
] | null | null | null | requirements/docutils-0.18/test/functional/tests/math_output_mathml.py | QuentinTournier40/AnimationFreeCAD | 8eaff8356ec68b948a721b83a6888b652278db8a | [
"Apache-2.0"
] | null | null | null | requirements/docutils-0.18/test/functional/tests/math_output_mathml.py | QuentinTournier40/AnimationFreeCAD | 8eaff8356ec68b948a721b83a6888b652278db8a | [
"Apache-2.0"
] | 1 | 2022-02-03T08:03:30.000Z | 2022-02-03T08:03:30.000Z | # Source and destination file names.
test_source = "data/math.txt"
test_destination = "math_output_mathml.html"
# Keyword parameters passed to publish_file.
reader_name = "standalone"
parser_name = "rst"
writer_name = "html5"
# Settings
settings_overrides['math_output'] = 'MathML'
# local copy of default stylesheet:
... | 30.8 | 70 | 0.755411 |
test_source = "data/math.txt"
test_destination = "math_output_mathml.html"
reader_name = "standalone"
parser_name = "rst"
writer_name = "html5"
settings_overrides['math_output'] = 'MathML'
settings_overrides['stylesheet_dirs'] = ('.', 'functional/input/data')
| true | true |
f73e23f978c60ba412fc3a443cb0e1e12d71e247 | 14,516 | py | Python | hplip-3.20.3/base/g.py | Deril-Pana/wikiBlackcoinNL | 9633307f0b485c27feae5da242944adf450e8963 | [
"MIT"
] | null | null | null | hplip-3.20.3/base/g.py | Deril-Pana/wikiBlackcoinNL | 9633307f0b485c27feae5da242944adf450e8963 | [
"MIT"
] | 1 | 2021-11-20T16:33:39.000Z | 2021-11-20T16:33:39.000Z | hplip-3.20.3/base/g.py | Deril-Pana/wikiBlackcoinNL | 9633307f0b485c27feae5da242944adf450e8963 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2015 HP Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at... | 33.915888 | 146 | 0.610361 |
import sys
import os
import os.path
from .sixext import PY3
from .sixext.moves import configparser
import locale
import pwd
import stat
import re
from .codes import *
from . import logger
from . import os_utils
from .sixext import to_unicode
if PY3:
QString = type("")
def cmp(a, b):... | true | true |
f73e25089adcc007af52ac2d6b44e0e28f19a605 | 4,120 | py | Python | [Kaleido-subs]/Completed/Joshiraku [BD]/JoshirakuBD_NCED2.py | LightArrowsEXE/Encoding-Projects | 4ea96a5b25a7710f615ada5ff25949c496492b53 | [
"MIT"
] | 57 | 2019-01-31T17:32:46.000Z | 2022-03-23T05:46:51.000Z | [Kaleido-subs]/Completed/Joshiraku [BD]/JoshirakuBD_NCED2.py | LightArrowsEXE/Encoding-Projects | 4ea96a5b25a7710f615ada5ff25949c496492b53 | [
"MIT"
] | null | null | null | [Kaleido-subs]/Completed/Joshiraku [BD]/JoshirakuBD_NCED2.py | LightArrowsEXE/Encoding-Projects | 4ea96a5b25a7710f615ada5ff25949c496492b53 | [
"MIT"
] | 12 | 2019-04-30T06:16:13.000Z | 2022-03-14T16:15:07.000Z | from typing import Tuple, Union
import vapoursynth as vs
from lvsfunc.misc import source
from vardautomation import FileInfo, PresetAAC, PresetBD, VPath
from project_module import encoder as enc, flt
core = vs.core
core.num_threads = 4
# Sources
JP_NCED = FileInfo(r'BDMV/120926_JOSHIRAKU_VOL1/BDMV/STREAM/00002.m2t... | 37.798165 | 118 | 0.673301 | from typing import Tuple, Union
import vapoursynth as vs
from lvsfunc.misc import source
from vardautomation import FileInfo, PresetAAC, PresetBD, VPath
from project_module import encoder as enc, flt
core = vs.core
core.num_threads = 4
JP_NCED = FileInfo(r'BDMV/120926_JOSHIRAKU_VOL1/BDMV/STREAM/00002.m2ts', (24, ... | true | true |
f73e255f02cde90e00dbf1c2e3f6da94c3f3a1b3 | 623 | py | Python | smarthome/smarthomeproj/server/migrations/0007_auto_20210121_2155.py | nunocaseiro/smarthome-server-django | 711db6ff360061d861d9985264f753e0f7846327 | [
"Apache-2.0"
] | null | null | null | smarthome/smarthomeproj/server/migrations/0007_auto_20210121_2155.py | nunocaseiro/smarthome-server-django | 711db6ff360061d861d9985264f753e0f7846327 | [
"Apache-2.0"
] | null | null | null | smarthome/smarthomeproj/server/migrations/0007_auto_20210121_2155.py | nunocaseiro/smarthome-server-django | 711db6ff360061d861d9985264f753e0f7846327 | [
"Apache-2.0"
] | null | null | null | # Generated by Django 3.1.3 on 2021-01-21 21:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0006_auto_20210120_2320'),
]
operations = [
migrations.AddField(
model_name='sensor',
name='lux_max',
... | 25.958333 | 93 | 0.601926 |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('server', '0006_auto_20210120_2320'),
]
operations = [
migrations.AddField(
model_name='sensor',
name='lux_max',
field=models.DecimalField(blank=True, d... | true | true |
f73e261a052d28b5820e5eaf0cc2a5369ce07257 | 2,999 | py | Python | lib/prior/priorNet.py | ziyedy/category-priornet | 5aa080eeff936ce3939f0d5458a2936677c15726 | [
"MIT"
] | null | null | null | lib/prior/priorNet.py | ziyedy/category-priornet | 5aa080eeff936ce3939f0d5458a2936677c15726 | [
"MIT"
] | null | null | null | lib/prior/priorNet.py | ziyedy/category-priornet | 5aa080eeff936ce3939f0d5458a2936677c15726 | [
"MIT"
] | null | null | null | import sys
sys.path.append("../../")
import lib.gcn3d as gcn3d
import torch
import torch.nn as nn
import torch.nn.functional as F
class PriorEncoder(nn.Module):
def __init__(self, support_num: int, neighbor_num: int):
super(PriorEncoder, self).__init__()
self.neighbor_num = neighbor_num
... | 33.322222 | 80 | 0.646882 | import sys
sys.path.append("../../")
import lib.gcn3d as gcn3d
import torch
import torch.nn as nn
import torch.nn.functional as F
class PriorEncoder(nn.Module):
def __init__(self, support_num: int, neighbor_num: int):
super(PriorEncoder, self).__init__()
self.neighbor_num = neighbor_num
... | true | true |
f73e263128110e3f80e7abc4cd94cb03038c4f6a | 6,386 | py | Python | tests/test_windows_utils.py | haypo/trollius | 2df073c33c7fe8ab0ac60cad4826de730a411a8c | [
"Apache-2.0"
] | 175 | 2015-07-09T00:18:14.000Z | 2017-11-06T17:40:42.000Z | tests/test_windows_utils.py | haypo/trollius | 2df073c33c7fe8ab0ac60cad4826de730a411a8c | [
"Apache-2.0"
] | 9 | 2015-07-17T16:44:13.000Z | 2016-09-14T17:47:13.000Z | tests/test_windows_utils.py | roverdotcom/trollius | fa13a1c0182840b72faa17078eb78c8b5e5f45c4 | [
"Apache-2.0"
] | 21 | 2015-07-14T14:10:15.000Z | 2017-04-05T07:03:48.000Z | """Tests for window_utils"""
import socket
import sys
import warnings
from trollius.test_utils import unittest
if sys.platform != 'win32':
raise unittest.SkipTest('Windows only')
from trollius import _overlapped
from trollius import py33_winapi as _winapi
from trollius import test_support as support
from trolliu... | 34.896175 | 77 | 0.627153 |
import socket
import sys
import warnings
from trollius.test_utils import unittest
if sys.platform != 'win32':
raise unittest.SkipTest('Windows only')
from trollius import _overlapped
from trollius import py33_winapi as _winapi
from trollius import test_support as support
from trollius import test_utils
from trol... | true | true |
f73e26be5e8339103201e497c6e376922c92d858 | 13,682 | py | Python | django/contrib/gis/db/models/fields.py | Perlence/django | 4f7328ce8a35160d155c41d362c3d674f8ef4d2d | [
"PSF-2.0",
"BSD-3-Clause"
] | 4 | 2017-01-09T10:51:20.000Z | 2020-06-30T14:00:41.000Z | django/contrib/gis/db/models/fields.py | Perlence/django | 4f7328ce8a35160d155c41d362c3d674f8ef4d2d | [
"PSF-2.0",
"BSD-3-Clause"
] | 10 | 2016-05-19T21:54:42.000Z | 2019-08-09T15:59:50.000Z | django/contrib/gis/db/models/fields.py | Perlence/django | 4f7328ce8a35160d155c41d362c3d674f8ef4d2d | [
"PSF-2.0",
"BSD-3-Clause"
] | 2 | 2016-08-02T20:16:08.000Z | 2020-01-07T19:45:38.000Z | from collections import defaultdict, namedtuple
from django.contrib.gis import forms, gdal
from django.contrib.gis.db.models.proxy import SpatialProxy
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.geos import (
GeometryCollection, GEOSException, GEOSGeometry, LineString,
Multi... | 35.816754 | 119 | 0.656044 | from collections import defaultdict, namedtuple
from django.contrib.gis import forms, gdal
from django.contrib.gis.db.models.proxy import SpatialProxy
from django.contrib.gis.gdal.error import GDALException
from django.contrib.gis.geos import (
GeometryCollection, GEOSException, GEOSGeometry, LineString,
Multi... | true | true |
f73e27240746dece6f5e7ef28f69fcf3af24de23 | 6,361 | py | Python | mmpose/datasets/datasets/hand/freihand_dataset.py | yulong314/mmpose | cdfce789d0e48dd868c70a405a7d7f3da2b4ebe3 | [
"Apache-2.0"
] | 1 | 2021-06-01T08:21:32.000Z | 2021-06-01T08:21:32.000Z | mmpose/datasets/datasets/hand/freihand_dataset.py | yulong314/mmpose | cdfce789d0e48dd868c70a405a7d7f3da2b4ebe3 | [
"Apache-2.0"
] | null | null | null | mmpose/datasets/datasets/hand/freihand_dataset.py | yulong314/mmpose | cdfce789d0e48dd868c70a405a7d7f3da2b4ebe3 | [
"Apache-2.0"
] | 1 | 2021-06-22T06:41:45.000Z | 2021-06-22T06:41:45.000Z | # Copyright (c) OpenMMLab. All rights reserved.
import os
from collections import OrderedDict
import numpy as np
from mmpose.datasets.builder import DATASETS
from .hand_base_dataset import HandBaseDataset
@DATASETS.register_module()
class FreiHandDataset(HandBaseDataset):
"""FreiHand dataset for top-down hand p... | 34.950549 | 79 | 0.542053 |
import os
from collections import OrderedDict
import numpy as np
from mmpose.datasets.builder import DATASETS
from .hand_base_dataset import HandBaseDataset
@DATASETS.register_module()
class FreiHandDataset(HandBaseDataset):
def __init__(self,
ann_file,
img_prefix,
... | true | true |
f73e27d7863b60a730756b99681c2762cf347061 | 10,550 | py | Python | training_script/cifar10_keras_sm.py | gonsoomoon/tensorflow-workshop-for-sagemaker | 985ab3853c16f4833caeae6382ccfc4474ac8e98 | [
"MIT"
] | null | null | null | training_script/cifar10_keras_sm.py | gonsoomoon/tensorflow-workshop-for-sagemaker | 985ab3853c16f4833caeae6382ccfc4474ac8e98 | [
"MIT"
] | null | null | null | training_script/cifar10_keras_sm.py | gonsoomoon/tensorflow-workshop-for-sagemaker | 985ab3853c16f4833caeae6382ccfc4474ac8e98 | [
"MIT"
] | 1 | 2020-02-29T04:58:00.000Z | 2020-02-29T04:58:00.000Z | # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the "Software"), to deal in the Software
# without restriction, including without limitation the rights to use... | 34.933775 | 117 | 0.674123 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import logging
import os
from keras.callbacks import ModelCheckpoint
from keras.layers import Activation, Conv2D, Dense, Dropout, Flatten, MaxPooling2D, BatchNormalization
from k... | true | true |
f73e281fb75e286dad12e996fe2a93e1ad01aba4 | 683 | py | Python | vel/api/metrics/value_metric.py | cclauss/vel | 78a6a20af80ff613898d2983c83fdb223634aaad | [
"MIT"
] | null | null | null | vel/api/metrics/value_metric.py | cclauss/vel | 78a6a20af80ff613898d2983c83fdb223634aaad | [
"MIT"
] | null | null | null | vel/api/metrics/value_metric.py | cclauss/vel | 78a6a20af80ff613898d2983c83fdb223634aaad | [
"MIT"
] | null | null | null | from .base_metric import BaseMetric
class ValueMetric(BaseMetric):
""" Base class for metrics that don't have state and just calculate a simple value """
def __init__(self, name):
super().__init__(name)
self._metric_value = None
def calculate(self, data_dict):
""" Calculate valu... | 25.296296 | 90 | 0.651537 | from .base_metric import BaseMetric
class ValueMetric(BaseMetric):
def __init__(self, name):
super().__init__(name)
self._metric_value = None
def calculate(self, data_dict):
self._metric_value = self._value_function(data_dict)
def reset(self):
pass
def value(self):... | true | true |
f73e285889cb990cb1dfc381934257b27dc05fca | 227 | py | Python | examples/text_suggest_api.py | sushi-chaaaan/pya3rt | d38cb21df8e476c1268ba039c973a0a2be93df36 | [
"MIT"
] | 12 | 2017-04-28T05:07:15.000Z | 2022-03-11T08:53:30.000Z | examples/text_suggest_api.py | sushi-chaaaan/pya3rt | d38cb21df8e476c1268ba039c973a0a2be93df36 | [
"MIT"
] | 3 | 2017-04-29T09:05:44.000Z | 2019-10-31T06:51:38.000Z | examples/text_suggest_api.py | sushi-chaaaan/pya3rt | d38cb21df8e476c1268ba039c973a0a2be93df36 | [
"MIT"
] | 8 | 2018-07-12T07:23:13.000Z | 2022-03-11T08:53:33.000Z | # -*- coding: utf-8 -*-
import pya3rt
apikey = "{YOUR_API_KEY}"
client = pya3rt.TextSuggestClient(apikey)
print(client.text_suggest("馬"))
print(client.text_suggest("あき", style=1))
print(client.text_suggest("func", style=2))
| 20.636364 | 43 | 0.718062 |
import pya3rt
apikey = "{YOUR_API_KEY}"
client = pya3rt.TextSuggestClient(apikey)
print(client.text_suggest("馬"))
print(client.text_suggest("あき", style=1))
print(client.text_suggest("func", style=2))
| true | true |
f73e286a7be57a1440b0a605de9d42d36073af54 | 7,991 | py | Python | hordak/migrations/0001_initial.py | CodeBrew-LTD/django-hordak | efdfe503bf38b0a283790c5b4d27bd6bb28155e4 | [
"MIT"
] | 187 | 2016-12-12T10:58:11.000Z | 2022-03-27T08:14:19.000Z | hordak/migrations/0001_initial.py | CodeBrew-LTD/django-hordak | efdfe503bf38b0a283790c5b4d27bd6bb28155e4 | [
"MIT"
] | 62 | 2016-12-10T00:12:47.000Z | 2022-03-16T09:23:05.000Z | hordak/migrations/0001_initial.py | CodeBrew-LTD/django-hordak | efdfe503bf38b0a283790c5b4d27bd6bb28155e4 | [
"MIT"
] | 47 | 2016-12-12T11:07:31.000Z | 2022-03-15T20:30:07.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.1 on 2016-09-13 11:01
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_smalluuid.models
import mptt.fields
class Migration(migrations.Migration):
initial... | 36.824885 | 138 | 0.417845 |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_smalluuid.models
import mptt.fields
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.C... | true | true |
f73e293616698db46a21ac440b641745d4241adc | 551 | py | Python | stage1/process_demo/demo3.py | kaixiang1992/python-review | 7f4f82b453f81b47af7ab1e8f3b3d07d1d75cbe4 | [
"MIT"
] | null | null | null | stage1/process_demo/demo3.py | kaixiang1992/python-review | 7f4f82b453f81b47af7ab1e8f3b3d07d1d75cbe4 | [
"MIT"
] | null | null | null | stage1/process_demo/demo3.py | kaixiang1992/python-review | 7f4f82b453f81b47af7ab1e8f3b3d07d1d75cbe4 | [
"MIT"
] | null | null | null | """
2019/12/08 15:16
142.【Python多任务编程】使用类的方式创建子进程(进程)
"""
"""
使用类的方式创建子进程:
有些时候,你想以类的形式定义子进程的代码。那么你可以自定义一个类,让他继承自`Process`,
然后在这个类中实现run方法,以后这个子进程在执行的时候就会调用run方法中的代码。
"""
from multiprocessing import Process
import os
class zhiliao(Process):
def run(self):
print('子进程ID: %s' % os.getpid())
print('... | 17.21875 | 48 | 0.607985 |
from multiprocessing import Process
import os
class zhiliao(Process):
def run(self):
print('子进程ID: %s' % os.getpid())
print('父进程ID: %s' % os.getppid())
for x in range(0, 5):
print('子进程: %s' % x)
if __name__ == '__main__':
p = zhiliao()
p.start()
print('主进程ID: %... | true | true |
f73e29dfcb875a58615903b00ad31196b8d22a4c | 371 | py | Python | tests/__init__.py | denjas/nempy | 3581ef56b399b1578a2881e6aecf5fe25a345158 | [
"Apache-2.0"
] | 2 | 2021-08-12T19:13:11.000Z | 2021-08-16T19:53:35.000Z | tests/__init__.py | denjas/nempy | 3581ef56b399b1578a2881e6aecf5fe25a345158 | [
"Apache-2.0"
] | null | null | null | tests/__init__.py | denjas/nempy | 3581ef56b399b1578a2881e6aecf5fe25a345158 | [
"Apache-2.0"
] | null | null | null | import logging
logging.getLogger('asyncio').setLevel(logging.ERROR)
logging.getLogger('asyncio.coroutines').setLevel(logging.ERROR)
logging.getLogger('websockets').setLevel(logging.ERROR)
logging.getLogger('urllib3').setLevel(logging.ERROR)
log_format = "[%(asctime)s][%(levelname)s] %(name)s - %(message)s"
logging.ba... | 33.727273 | 66 | 0.781671 | import logging
logging.getLogger('asyncio').setLevel(logging.ERROR)
logging.getLogger('asyncio.coroutines').setLevel(logging.ERROR)
logging.getLogger('websockets').setLevel(logging.ERROR)
logging.getLogger('urllib3').setLevel(logging.ERROR)
log_format = "[%(asctime)s][%(levelname)s] %(name)s - %(message)s"
logging.ba... | true | true |
f73e2b455b2469350da91d9c9222fae224cc7c1c | 612 | py | Python | examples/my_top_tracks.py | Piteryo/spotipy | f548038aac6bd0eb4cf7ade2295c441a141880d7 | [
"MIT"
] | 1 | 2020-07-05T22:37:16.000Z | 2020-07-05T22:37:16.000Z | examples/my_top_tracks.py | Piteryo/spotipy | f548038aac6bd0eb4cf7ade2295c441a141880d7 | [
"MIT"
] | null | null | null | examples/my_top_tracks.py | Piteryo/spotipy | f548038aac6bd0eb4cf7ade2295c441a141880d7 | [
"MIT"
] | 1 | 2021-02-24T01:52:02.000Z | 2021-02-24T01:52:02.000Z | # Shows the top tracks for a user
import sys
import spotipy
from spotipy.oauth2 import SpotifyOAuth
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print("Usage: %s username" % (sys.argv[0],))
sys.exit()
scope = 'user-top-read'
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
ranges = ['... | 25.5 | 71 | 0.671569 |
import sys
import spotipy
from spotipy.oauth2 import SpotifyOAuth
if len(sys.argv) > 1:
username = sys.argv[1]
else:
print("Usage: %s username" % (sys.argv[0],))
sys.exit()
scope = 'user-top-read'
sp = spotipy.Spotify(auth_manager=SpotifyOAuth(scope=scope))
ranges = ['short_term', 'medium_term', 'long... | true | true |
f73e2b8f54d3b3fc1bcc24ef1b0f9ce11a9ce9c5 | 2,360 | py | Python | city_scrapers/spiders/det_great_lakes_water_authority.py | noahkconley/city-scrapers | 37420ce3a9295c2aac68c0fb4a957ad41394a801 | [
"MIT"
] | null | null | null | city_scrapers/spiders/det_great_lakes_water_authority.py | noahkconley/city-scrapers | 37420ce3a9295c2aac68c0fb4a957ad41394a801 | [
"MIT"
] | null | null | null | city_scrapers/spiders/det_great_lakes_water_authority.py | noahkconley/city-scrapers | 37420ce3a9295c2aac68c0fb4a957ad41394a801 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import re
import scrapy
from ics import Calendar
from city_scrapers.spider import Spider
class DetGreatLakesWaterAuthoritySpider(Spider):
name = 'det_great_lakes_water_authority'
agency_id = 'Great Lakes Water Authority'
timezone = 'America/Detroit'
allowed_domains = ['www.gl... | 38.688525 | 101 | 0.572458 |
import re
import scrapy
from ics import Calendar
from city_scrapers.spider import Spider
class DetGreatLakesWaterAuthoritySpider(Spider):
name = 'det_great_lakes_water_authority'
agency_id = 'Great Lakes Water Authority'
timezone = 'America/Detroit'
allowed_domains = ['www.glwater.org']
start_u... | true | true |
f73e2c425af73c8125b90455522e4d3fa756fb7e | 1,575 | py | Python | ch_13/src/log_catcher.py | real-slim-chadi/Python-Object-Oriented-Programming---4th-edition | 7c486866171786b620795fa33a79ec9ac9a8ba1b | [
"MIT"
] | 43 | 2021-06-03T18:39:09.000Z | 2022-03-29T20:32:13.000Z | ch_13/src/log_catcher.py | real-slim-chadi/Python-Object-Oriented-Programming---4th-edition | 7c486866171786b620795fa33a79ec9ac9a8ba1b | [
"MIT"
] | 9 | 2022-03-12T01:04:07.000Z | 2022-03-12T01:05:01.000Z | ch_13/src/log_catcher.py | real-slim-chadi/Python-Object-Oriented-Programming---4th-edition | 7c486866171786b620795fa33a79ec9ac9a8ba1b | [
"MIT"
] | 36 | 2021-06-19T07:14:09.000Z | 2022-03-12T22:17:09.000Z | """
Python 3 Object-Oriented Programming
Chapter 13. Testing Object-Oriented Programs.
"""
import json
from pathlib import Path
import socketserver
from typing import TextIO
import pickle
import struct
import sys
class LogDataCatcher(socketserver.BaseRequestHandler):
log_file: TextIO
count: int = 0
size... | 32.8125 | 87 | 0.667937 | import json
from pathlib import Path
import socketserver
from typing import TextIO
import pickle
import struct
import sys
class LogDataCatcher(socketserver.BaseRequestHandler):
log_file: TextIO
count: int = 0
size_format = ">L"
size_bytes = struct.calcsize(size_format)
def handle(self) -> None:
... | true | true |
f73e2c475e39c712227ebb0cbd85fe1f13ab6e2f | 28,082 | py | Python | satchmo/apps/product/south_migrations/0002_add_attributeoption.py | predatell/satchmo | 6ced1f845aadec240c7e433c3cbf4caca96e0d92 | [
"BSD-3-Clause"
] | 16 | 2015-03-06T14:42:27.000Z | 2019-12-23T21:37:01.000Z | satchmo/apps/product/south_migrations/0002_add_attributeoption.py | predatell/satchmo | 6ced1f845aadec240c7e433c3cbf4caca96e0d92 | [
"BSD-3-Clause"
] | null | null | null | satchmo/apps/product/south_migrations/0002_add_attributeoption.py | predatell/satchmo | 6ced1f845aadec240c7e433c3cbf4caca96e0d92 | [
"BSD-3-Clause"
] | 8 | 2015-01-28T16:02:37.000Z | 2022-03-03T21:29:40.000Z | # encoding: utf-8
import datetime
from south.db import db
from south.logger import get_logger
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'AttributeOption'
db.create_table('product_attributeoption', (
... | 77.360882 | 198 | 0.564347 |
import datetime
from south.db import db
from south.logger import get_logger
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
db.create_table('product_attributeoption', (
('name', self.gf('django.db.models.fi... | true | true |
f73e2c6aabd54cd5cd3654b6ad74b726d748e4d6 | 10,272 | py | Python | bin/dm_link.py | slimnsour/datman | 6ac4827e2ae20401eb4b048d42bdfca5db5d3de9 | [
"Apache-2.0"
] | null | null | null | bin/dm_link.py | slimnsour/datman | 6ac4827e2ae20401eb4b048d42bdfca5db5d3de9 | [
"Apache-2.0"
] | null | null | null | bin/dm_link.py | slimnsour/datman | 6ac4827e2ae20401eb4b048d42bdfca5db5d3de9 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""
Renames (links) exam zip archives by consulting a lookup table.
This program looks up the proper name in a table that lists the original exam
archive name, and the target name.
Usage:
dm_link.py [options] <study>
dm_link.py [options] <study> <zipfile>
Arguments:
<study> ... | 31.317073 | 79 | 0.628115 |
import glob
import logging
import os
import sys
from docopt import docopt
import pandas as pd
import datman.config
import datman.scanid
import datman.utils
logger = logging.getLogger(os.path.basename(__file__))
already_linked = {}
lookup = None
DRYRUN = None
def main():
global already_linked
global... | true | true |
f73e2cae7ae81dc17b787e8465ce0f4ee2ea9092 | 9,839 | py | Python | test/dynamics/solvers/test_solver_classes.py | haggaila/qiskit-dynamics | fd20314e2b591c35323782bc429d9f928fdb9a12 | [
"Apache-2.0"
] | 1 | 2022-01-21T01:47:40.000Z | 2022-01-21T01:47:40.000Z | test/dynamics/solvers/test_solver_classes.py | haggaila/qiskit-dynamics | fd20314e2b591c35323782bc429d9f928fdb9a12 | [
"Apache-2.0"
] | null | null | null | test/dynamics/solvers/test_solver_classes.py | haggaila/qiskit-dynamics | fd20314e2b591c35323782bc429d9f928fdb9a12 | [
"Apache-2.0"
] | null | null | null | # This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | 38.584314 | 96 | 0.6087 |
import numpy as np
from qiskit import QiskitError
from qiskit.quantum_info import Operator, Statevector, SuperOp, DensityMatrix
from qiskit_dynamics import Solver
from qiskit_dynamics.signals import Signal
from ..common import QiskitDynamicsTestCase, TestJaxBase
class TestSolverExceptions(QiskitDynam... | true | true |
f73e2ce5e887e2825c920dc4267da361c91f653c | 8,690 | py | Python | sentry/utils/manager.py | m0sth8/django-sentry | 1fd836d7029331aa17e2560a3be94996287ad9d3 | [
"BSD-3-Clause"
] | 1 | 2015-07-15T19:04:48.000Z | 2015-07-15T19:04:48.000Z | sentry/utils/manager.py | m0sth8/django-sentry | 1fd836d7029331aa17e2560a3be94996287ad9d3 | [
"BSD-3-Clause"
] | null | null | null | sentry/utils/manager.py | m0sth8/django-sentry | 1fd836d7029331aa17e2560a3be94996287ad9d3 | [
"BSD-3-Clause"
] | null | null | null | """
sentry.utils.manager
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import datetime
import django
import logging
import warnings
from django.db import models
from django.db.models import signals, Sum, F
from sentry.con... | 33.682171 | 125 | 0.550748 | """
sentry.utils.manager
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import datetime
import django
import logging
import warnings
from django.db import models
from django.db.models import signals, Sum, F
from sentry.con... | false | true |
f73e2eac4753b15fca94cc1f8bafaf590c205709 | 1,801 | py | Python | src/sentry/utils/auth.py | erhuabushuo/sentry | 8b3bad10155aaacfdff80910e5972e64304e880c | [
"BSD-3-Clause"
] | null | null | null | src/sentry/utils/auth.py | erhuabushuo/sentry | 8b3bad10155aaacfdff80910e5972e64304e880c | [
"BSD-3-Clause"
] | null | null | null | src/sentry/utils/auth.py | erhuabushuo/sentry | 8b3bad10155aaacfdff80910e5972e64304e880c | [
"BSD-3-Clause"
] | null | null | null | """
sentry.utils.auth
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from sentry.models import ... | 27.707692 | 88 | 0.632982 | from __future__ import absolute_import
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from sentry.models import User
def parse_auth_header(header):
return dict(map(lambda x: x.strip().split('='), header.split(' ', 1)[1].split(',')))
def get_auth_providers():
return ... | true | true |
f73e3303fffd49fcb2b65f8ed458e93f7a53a71b | 12,680 | py | Python | python_modules/dagster/dagster/core/definitions/solid_container.py | mitodl/dagster | c94cd8d0f5f67722790e8a176228aa4bdcaa0068 | [
"Apache-2.0"
] | 1 | 2021-04-30T00:19:20.000Z | 2021-04-30T00:19:20.000Z | python_modules/dagster/dagster/core/definitions/solid_container.py | mitodl/dagster | c94cd8d0f5f67722790e8a176228aa4bdcaa0068 | [
"Apache-2.0"
] | null | null | null | python_modules/dagster/dagster/core/definitions/solid_container.py | mitodl/dagster | c94cd8d0f5f67722790e8a176228aa4bdcaa0068 | [
"Apache-2.0"
] | null | null | null | from abc import ABCMeta, abstractmethod, abstractproperty
from collections import defaultdict
import six
from dagster import check
from dagster.core.errors import DagsterInvalidDefinitionError
from dagster.core.types.dagster_type import DagsterTypeKind
from .dependency import DependencyStructure, IDependencyDefinitio... | 43.129252 | 113 | 0.602681 | from abc import ABCMeta, abstractmethod, abstractproperty
from collections import defaultdict
import six
from dagster import check
from dagster.core.errors import DagsterInvalidDefinitionError
from dagster.core.types.dagster_type import DagsterTypeKind
from .dependency import DependencyStructure, IDependencyDefinitio... | true | true |
f73e341446ccc6dc420d367e1f920c64f27fe683 | 1,712 | py | Python | data_structure/lista_encadeada_simples.py | uadson/data-structure | e7c62ff732b9b89e57b9b08dfc6f777e57a52397 | [
"MIT"
] | null | null | null | data_structure/lista_encadeada_simples.py | uadson/data-structure | e7c62ff732b9b89e57b9b08dfc6f777e57a52397 | [
"MIT"
] | null | null | null | data_structure/lista_encadeada_simples.py | uadson/data-structure | e7c62ff732b9b89e57b9b08dfc6f777e57a52397 | [
"MIT"
] | null | null | null | class No:
def __init__(self, valor):
self.valor = valor
self.proximo = None
def mostra_no(self):
print(self.valor)
class ListaEncadeada:
def __init__(self):
self.primeiro = None
def insere_inicio(self, valor):
novo = No(valor)
novo.proximo = self.primeiro
self.primeiro = novo
d... | 21.4 | 43 | 0.64778 | class No:
def __init__(self, valor):
self.valor = valor
self.proximo = None
def mostra_no(self):
print(self.valor)
class ListaEncadeada:
def __init__(self):
self.primeiro = None
def insere_inicio(self, valor):
novo = No(valor)
novo.proximo = self.primeiro
self.primeiro = novo
d... | true | true |
f73e34be6608bfdd423623a778535b65b4ac14ec | 1,578 | py | Python | ResNet50 V2/resnet50_v2_model.py | Sourodip-ghosh123/Fruits-360 | f15ce919757f0a0ce057f4ba4b49ce3d5aba53e2 | [
"MIT"
] | null | null | null | ResNet50 V2/resnet50_v2_model.py | Sourodip-ghosh123/Fruits-360 | f15ce919757f0a0ce057f4ba4b49ce3d5aba53e2 | [
"MIT"
] | null | null | null | ResNet50 V2/resnet50_v2_model.py | Sourodip-ghosh123/Fruits-360 | f15ce919757f0a0ce057f4ba4b49ce3d5aba53e2 | [
"MIT"
] | null | null | null | from keras.applications.resnet_v2 import ResNet50V2
model=ResNet50V2(include_top=True, weights=None, input_tensor=None, input_shape=(100,100,3),classes=41)
model.summary()
model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
print('Compiled!')
from keras.m... | 30.346154 | 103 | 0.726869 | from keras.applications.resnet_v2 import ResNet50V2
model=ResNet50V2(include_top=True, weights=None, input_tensor=None, input_shape=(100,100,3),classes=41)
model.summary()
model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
print('Compiled!')
from keras.m... | true | true |
f73e3599db366d927da9e5c08e59a2b79e26d142 | 7,503 | py | Python | ImmoKaa/scraper.py | gandreassi/ImmoKaa | 904115e5a6f91ca78b41aebdaf4ffe3934a4c318 | [
"MIT"
] | 1 | 2021-06-08T09:12:00.000Z | 2021-06-08T09:12:00.000Z | ImmoKaa/scraper.py | gandreassi/ImmoKaa | 904115e5a6f91ca78b41aebdaf4ffe3934a4c318 | [
"MIT"
] | null | null | null | ImmoKaa/scraper.py | gandreassi/ImmoKaa | 904115e5a6f91ca78b41aebdaf4ffe3934a4c318 | [
"MIT"
] | null | null | null | from bs4 import BeautifulSoup
import urllib.request as urllib2
import random
from random import choice
import pandas as pd
import copy, time, sys, shutil, os, yaml, json
import datetime as dt
from glob import glob
import regex
class scraper():
criteria = None
df = None
df_pre = None
__verbose = Fa... | 39.078125 | 185 | 0.553645 | from bs4 import BeautifulSoup
import urllib.request as urllib2
import random
from random import choice
import pandas as pd
import copy, time, sys, shutil, os, yaml, json
import datetime as dt
from glob import glob
import regex
class scraper():
criteria = None
df = None
df_pre = None
__verbose = Fa... | true | true |
f73e35ad2b6643c1b675aee576ecf540ae03462d | 18,565 | py | Python | shaDow/utils.py | yxia-fb/shaDow-GNN | 2b867011c7084d4ed1b407e29f3ee09632fcc3dc | [
"MIT"
] | null | null | null | shaDow/utils.py | yxia-fb/shaDow-GNN | 2b867011c7084d4ed1b407e29f3ee09632fcc3dc | [
"MIT"
] | 1 | 2022-01-22T11:20:00.000Z | 2022-01-22T11:20:00.000Z | shaDow/utils.py | yxia-fb/shaDow-GNN | 2b867011c7084d4ed1b407e29f3ee09632fcc3dc | [
"MIT"
] | null | null | null | import os
import torch
import glob
import numpy as np
import scipy.sparse as sp
import yaml
from sklearn.preprocessing import StandardScaler
from shaDow.globals import git_rev, timestamp, Logger
from torch_scatter import scatter
from copy import deepcopy
from typing import List, Union
from shaDow import TRAIN, VALI... | 44.842995 | 126 | 0.605117 | import os
import torch
import glob
import numpy as np
import scipy.sparse as sp
import yaml
from sklearn.preprocessing import StandardScaler
from shaDow.globals import git_rev, timestamp, Logger
from torch_scatter import scatter
from copy import deepcopy
from typing import List, Union
from shaDow import TRAIN, VALI... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.