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 417k | max_line_length int64 1 987k | alphanum_fraction float64 0 1 | content_no_comment stringlengths 0 1.01M | is_comment_constant_removed bool 1
class | is_sharp_comment_removed bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f7588e8e67b4b563b51c867f87215811f02b9129 | 888 | py | Python | userbot/modules/help.py | Davotsutsuki/jembot | f107d345b25af04dda7e2c647c06d135290da1f2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/help.py | Davotsutsuki/jembot | f107d345b25af04dda7e2c647c06d135290da1f2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | userbot/modules/help.py | Davotsutsuki/jembot | f107d345b25af04dda7e2c647c06d135290da1f2 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
"""Userbot help command"""
from userbot import CMD_HELP
from userbot.events import register
@register(outgoing=True,... | 32.888889 | 101 | 0.619369 |
from userbot import CMD_HELP
from userbot.events import register
@register(outgoing=True, pattern="^.tolong(?: |$)(.*)")
async def help(event):
args = event.pattern_match.group(1).lower()
if args:
if args in CMD_HELP:
await event.edit(str(CMD_HELP[args]))
else:
aw... | true | true |
f7588f9831b205911cfc6947c1635fc66ee469d0 | 1,879 | py | Python | tests/test_commands.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null | tests/test_commands.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null | tests/test_commands.py | justengel/pybk8500 | 6a9748033c783a0081ec391359067dfb9dc83760 | [
"MIT"
] | null | null | null |
def test_names_to_values():
import pybk8500
cmd = pybk8500.CommandStatus(status=0x90)
assert cmd.status == 'Checksum incorrect'
assert cmd[3] == 0x90
cmd = pybk8500.CommandStatus(status='Parameter incorrect')
assert cmd.status == 'Parameter incorrect'
assert cmd[3] == 0xA0
cmd = pybk8... | 29.359375 | 73 | 0.646088 |
def test_names_to_values():
import pybk8500
cmd = pybk8500.CommandStatus(status=0x90)
assert cmd.status == 'Checksum incorrect'
assert cmd[3] == 0x90
cmd = pybk8500.CommandStatus(status='Parameter incorrect')
assert cmd.status == 'Parameter incorrect'
assert cmd[3] == 0xA0
cmd = pybk8... | true | true |
f7588fed95772828447244f7b051a54c93e9fc51 | 2,935 | py | Python | v1.0.0.test/toontown/building/DistributedTrophyMgrAI.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-01T15:46:43.000Z | 2021-07-23T16:26:48.000Z | v1.0.0.test/toontown/building/DistributedTrophyMgrAI.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 1 | 2019-06-29T03:40:05.000Z | 2021-06-13T01:15:16.000Z | v1.0.0.test/toontown/building/DistributedTrophyMgrAI.py | TTOFFLINE-LEAK/ttoffline | bb0e91704a755d34983e94288d50288e46b68380 | [
"MIT"
] | 4 | 2019-07-28T21:18:46.000Z | 2021-02-25T06:37:25.000Z | from operator import itemgetter
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.toonbase import TTLocalizer
class DistributedTrophyMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTro... | 35.792683 | 86 | 0.58569 | from operator import itemgetter
from direct.directnotify import DirectNotifyGlobal
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from toontown.toonbase import TTLocalizer
class DistributedTrophyMgrAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedTro... | true | true |
f7589058c5f5335de99e25040ea928e9c5ef8809 | 119 | py | Python | tests/handler.py | liranbg/nuclio-jupyter | f355fbdd9a2a5eca46443de4cc691b6da54c19c9 | [
"Apache-2.0"
] | null | null | null | tests/handler.py | liranbg/nuclio-jupyter | f355fbdd9a2a5eca46443de4cc691b6da54c19c9 | [
"Apache-2.0"
] | null | null | null | tests/handler.py | liranbg/nuclio-jupyter | f355fbdd9a2a5eca46443de4cc691b6da54c19c9 | [
"Apache-2.0"
] | null | null | null | def handler(context, event):
context.logger.info('This is an unstructured log')
return 'Hello, from Nuclio :]'
| 29.75 | 54 | 0.697479 | def handler(context, event):
context.logger.info('This is an unstructured log')
return 'Hello, from Nuclio :]'
| true | true |
f7589174dd71f66343df9fc9bf22ff6ab60067da | 14,873 | py | Python | numba/dppl/ocl/oclimpl.py | DrTodd13/numba | de35af55d295f1677cca76646691d8c51c79d3cf | [
"BSD-2-Clause"
] | null | null | null | numba/dppl/ocl/oclimpl.py | DrTodd13/numba | de35af55d295f1677cca76646691d8c51c79d3cf | [
"BSD-2-Clause"
] | null | null | null | numba/dppl/ocl/oclimpl.py | DrTodd13/numba | de35af55d295f1677cca76646691d8c51c79d3cf | [
"BSD-2-Clause"
] | null | null | null | from __future__ import print_function, absolute_import, division
import operator
from functools import reduce
from llvmlite import ir
from llvmlite.llvmpy.core import Type
import llvmlite.llvmpy.core as lc
import llvmlite.binding as ll
from numba.core.imputils import Registry
from numba.core import cgutils, types
fr... | 36.542998 | 110 | 0.625227 | from __future__ import print_function, absolute_import, division
import operator
from functools import reduce
from llvmlite import ir
from llvmlite.llvmpy.core import Type
import llvmlite.llvmpy.core as lc
import llvmlite.binding as ll
from numba.core.imputils import Registry
from numba.core import cgutils, types
fr... | true | true |
f75891ce997283d3d63380144ab48b4a432e1c0e | 276 | py | Python | MECboard/migrations/0006_merge_20190722_1723.py | HwangToLee/MEC | 656cc1b72a15fd546ddc59825e51a4782683276c | [
"MIT"
] | 1 | 2019-07-18T15:43:12.000Z | 2019-07-18T15:43:12.000Z | MECboard/migrations/0006_merge_20190722_1723.py | HwangToLee/MEC | 656cc1b72a15fd546ddc59825e51a4782683276c | [
"MIT"
] | null | null | null | MECboard/migrations/0006_merge_20190722_1723.py | HwangToLee/MEC | 656cc1b72a15fd546ddc59825e51a4782683276c | [
"MIT"
] | 6 | 2019-07-17T07:59:14.000Z | 2019-09-12T04:08:37.000Z | # Generated by Django 2.2.3 on 2019-07-22 08:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('MECboard', '0004_merge_20190722_1200'),
('MECboard', '0005_auto_20190722_1610'),
]
operations = [
]
| 18.4 | 49 | 0.652174 |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('MECboard', '0004_merge_20190722_1200'),
('MECboard', '0005_auto_20190722_1610'),
]
operations = [
]
| true | true |
f75891f1a0eb3bee8f326bdb5e59d332d2b32be4 | 91,244 | py | Python | lib/galaxy/selenium/navigates_galaxy.py | itisAliRH/galaxy | b3b693ea0788f773442c8481472a87f43ccb10d7 | [
"CC-BY-3.0"
] | null | null | null | lib/galaxy/selenium/navigates_galaxy.py | itisAliRH/galaxy | b3b693ea0788f773442c8481472a87f43ccb10d7 | [
"CC-BY-3.0"
] | 6 | 2021-11-11T20:57:49.000Z | 2021-12-10T15:30:33.000Z | lib/galaxy/selenium/navigates_galaxy.py | itisAliRH/galaxy | b3b693ea0788f773442c8481472a87f43ccb10d7 | [
"CC-BY-3.0"
] | null | null | null | """A mixing that extends a HasDriver class with Galaxy-specific utilities.
Implementer must provide a self.build_url method to target Galaxy.
"""
import collections
import contextlib
import random
import string
import time
from abc import abstractmethod
from functools import (
partial,
wraps,
)
from typing im... | 43.888408 | 196 | 0.69792 |
import collections
import contextlib
import random
import string
import time
from abc import abstractmethod
from functools import (
partial,
wraps,
)
from typing import (
Any,
cast,
Dict,
Optional,
Union,
)
import requests
import yaml
from selenium.webdriver.common.keys import Keys
from se... | true | true |
f75891f60378cb97a03f5b77287652bbf6c996ec | 137 | py | Python | 3.Python/Jcupzz.py | tony21122000/Learn-Coding | 11862f3a372069693bd381b1f99063d95d3b2b65 | [
"MIT"
] | 54 | 2020-10-01T07:06:36.000Z | 2021-10-21T03:24:30.000Z | 3.Python/Jcupzz.py | tony21122000/Learn-Coding | 11862f3a372069693bd381b1f99063d95d3b2b65 | [
"MIT"
] | 19 | 2020-10-01T13:04:55.000Z | 2020-10-27T06:10:52.000Z | 3.Python/Jcupzz.py | tony21122000/Learn-Coding | 11862f3a372069693bd381b1f99063d95d3b2b65 | [
"MIT"
] | 97 | 2020-10-01T07:07:17.000Z | 2021-10-21T03:25:20.000Z | name, age = "Jacob Ranjit", 19
username = "Jcupzz"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
| 27.4 | 68 | 0.635036 | name, age = "Jacob Ranjit", 19
username = "Jcupzz"
print ('Hello!')
print("Name: {}\nAge: {}\nUsername: {}".format(name, age, username))
| true | true |
f758933ac6ae472adc87934328c6e2ce4429dabf | 1,852 | py | Python | tldevice/tl_cmd_devinfo.py | stefanvanherwijnen/tio-python | cb929e03edae975631debd52ca71c3264bff5f53 | [
"MIT"
] | 9 | 2017-12-21T16:21:49.000Z | 2021-12-02T20:48:03.000Z | tldevice/tl_cmd_devinfo.py | stefanvanherwijnen/tio-python | cb929e03edae975631debd52ca71c3264bff5f53 | [
"MIT"
] | 5 | 2018-12-14T22:06:08.000Z | 2021-09-30T17:33:53.000Z | tldevice/tl_cmd_devinfo.py | stefanvanherwijnen/tio-python | cb929e03edae975631debd52ca71c3264bff5f53 | [
"MIT"
] | 4 | 2017-12-27T12:46:34.000Z | 2020-06-05T17:14:34.000Z | """
..
Copyright: 2017 Twinleaf LLC
Author: kornack@twinleaf.com
OriginalDate: March 2017
"""
import struct
import yaml
import tio
from .tl_cmd_conf import *
class TwinleafDevFirmwareInfoController(object):
def __init__(self, dev):
self._dev = dev
def hash(self):
return self._dev._tio.rpc('de... | 22.313253 | 85 | 0.697084 |
import struct
import yaml
import tio
from .tl_cmd_conf import *
class TwinleafDevFirmwareInfoController(object):
def __init__(self, dev):
self._dev = dev
def hash(self):
return self._dev._tio.rpc('dev.firmware.hash').decode('utf-8')
def serial(self):
return self._dev._tio.rpc('dev.firmware.serial'... | true | true |
f758941ce19276e6c94082152cb7326398485237 | 5,309 | py | Python | recipes/harfbuzz/all/conanfile.py | rockandsalt/conan-center-index | d739adcec3e4dd4c250eff559ceb738e420673dd | [
"MIT"
] | 1 | 2020-01-31T22:47:14.000Z | 2020-01-31T22:47:14.000Z | recipes/harfbuzz/all/conanfile.py | rockandsalt/conan-center-index | d739adcec3e4dd4c250eff559ceb738e420673dd | [
"MIT"
] | 3 | 2020-05-05T11:27:44.000Z | 2022-02-28T20:19:50.000Z | recipes/harfbuzz/all/conanfile.py | rockandsalt/conan-center-index | d739adcec3e4dd4c250eff559ceb738e420673dd | [
"MIT"
] | 1 | 2020-10-12T10:45:13.000Z | 2020-10-12T10:45:13.000Z | from conans import ConanFile, CMake, tools
import functools
import os
required_conan_version = ">=1.33.0"
class HarfbuzzConan(ConanFile):
name = "harfbuzz"
description = "HarfBuzz is an OpenType text shaping engine."
topics = ("opentype", "text", "engine")
url = "https://github.com/conan-io/conan-cen... | 37.652482 | 91 | 0.6246 | from conans import ConanFile, CMake, tools
import functools
import os
required_conan_version = ">=1.33.0"
class HarfbuzzConan(ConanFile):
name = "harfbuzz"
description = "HarfBuzz is an OpenType text shaping engine."
topics = ("opentype", "text", "engine")
url = "https://github.com/conan-io/conan-cen... | true | true |
f75895abe98727abc0e936f3555c787511e3b2b2 | 22,961 | py | Python | automl/google/cloud/automl_v1beta1/proto/image_pb2.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | null | null | null | automl/google/cloud/automl_v1beta1/proto/image_pb2.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | null | null | null | automl/google/cloud/automl_v1beta1/proto/image_pb2.py | DaveCheez/google-cloud-python | fc03d4d41f13e9d13db7206438163b3a471fdabd | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/cloud/automl_v1beta1/proto/image.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 messa... | 39.316781 | 1,361 | 0.665781 |
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
... | true | true |
f75896634b1e8432182af0da5e08fc24a9ab4ddc | 571 | py | Python | scripts/MI06A_Residuals_generate.py | alanlegoallec/Age_Sex_and_Medical_Images | d2b57bef1484360e129e9e2c97d4ae535c68e9c9 | [
"MIT"
] | null | null | null | scripts/MI06A_Residuals_generate.py | alanlegoallec/Age_Sex_and_Medical_Images | d2b57bef1484360e129e9e2c97d4ae535c68e9c9 | [
"MIT"
] | 4 | 2021-08-25T15:13:50.000Z | 2022-02-09T23:58:01.000Z | scripts/MI06A_Residuals_generate.py | alanlegoallec/Age_Sex_and_Medical_Images | d2b57bef1484360e129e9e2c97d4ae535c68e9c9 | [
"MIT"
] | null | null | null | import sys
from MI_Classes import ResidualsGenerate
# Default parameters
if len(sys.argv) != 4:
print('WRONG NUMBER OF INPUT PARAMETERS! RUNNING WITH DEFAULT SETTINGS!\n')
sys.argv = ['']
sys.argv.append('Age') # target
sys.argv.append('test') # fold
sys.argv.append('eids') # pred_type
# Option... | 24.826087 | 99 | 0.726795 | import sys
from MI_Classes import ResidualsGenerate
if len(sys.argv) != 4:
print('WRONG NUMBER OF INPUT PARAMETERS! RUNNING WITH DEFAULT SETTINGS!\n')
sys.argv = ['']
sys.argv.append('Age')
sys.argv.append('test')
sys.argv.append('eids')
debug_mode = False
Residuals_Generate = ResidualsG... | true | true |
f758988c86a5e081219ab492b385e94aaa9cbb4d | 347 | py | Python | pdpython_model/generic_model/agents.py | seifely/pdpython | 41410ca2807509caf32794bef57e7e210dcbce6f | [
"MIT"
] | null | null | null | pdpython_model/generic_model/agents.py | seifely/pdpython | 41410ca2807509caf32794bef57e7e210dcbce6f | [
"MIT"
] | null | null | null | pdpython_model/generic_model/agents.py | seifely/pdpython | 41410ca2807509caf32794bef57e7e210dcbce6f | [
"MIT"
] | null | null | null | from mesa import Agent
class Gagent(Agent):
def __init__(self, pos, model, stepcount=0, score=0):
super().__init__(pos, model)
self.pos = pos
self.stepCount = stepcount
self.score = score
def some_function(self):
a = 2 + 2
return a
def step(self):
... | 21.6875 | 57 | 0.587896 | from mesa import Agent
class Gagent(Agent):
def __init__(self, pos, model, stepcount=0, score=0):
super().__init__(pos, model)
self.pos = pos
self.stepCount = stepcount
self.score = score
def some_function(self):
a = 2 + 2
return a
def step(self):
... | true | true |
f758989aca66e4330626b937802f4518caac9d6f | 24,667 | py | Python | userbot/plugins/admin.py | goodmeow/xtrauserbot | ca3dcba6bc70042026a53c1860150a2de7363072 | [
"MIT"
] | null | null | null | userbot/plugins/admin.py | goodmeow/xtrauserbot | ca3dcba6bc70042026a53c1860150a2de7363072 | [
"MIT"
] | null | null | null | userbot/plugins/admin.py | goodmeow/xtrauserbot | ca3dcba6bc70042026a53c1860150a2de7363072 | [
"MIT"
] | null | null | null | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.c (the "License");
# you may not use this file except in compliance with the License.
"""
Userbot module to help you manage a group
"""
from asyncio import sleep
from os import remove
from telethon import ... | 32.456579 | 114 | 0.607208 |
from asyncio import sleep
from os import remove
from telethon import events
from datetime import datetime
from telethon.tl.functions.channels import EditBannedRequest
from telethon.tl.types import ChatBannedRights
from telethon.errors import (BadRequestError, ChatAdminRequiredError,
... | true | true |
f75898c1b1aeba9d25e88d00e24cfe8fdf0c4995 | 397 | py | Python | end2you/data_provider/audio_provider.py | tfyd/myEnd2you | 455d5404a19dd4867cb5db4f30705041d425d2b3 | [
"BSD-3-Clause"
] | null | null | null | end2you/data_provider/audio_provider.py | tfyd/myEnd2you | 455d5404a19dd4867cb5db4f30705041d425d2b3 | [
"BSD-3-Clause"
] | null | null | null | end2you/data_provider/audio_provider.py | tfyd/myEnd2you | 455d5404a19dd4867cb5db4f30705041d425d2b3 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
from .provider import BaseProvider
from pathlib import Path
from torch import is_tensor
class AudioProvider(BaseProvider):
"""Provides the data for the audio modality."""
def __init__(self, *args, **kwargs):
self.modality = 'audio'
super().__init__(*args, **kwargs)
... | 23.352941 | 51 | 0.667506 | import numpy as np
from .provider import BaseProvider
from pathlib import Path
from torch import is_tensor
class AudioProvider(BaseProvider):
def __init__(self, *args, **kwargs):
self.modality = 'audio'
super().__init__(*args, **kwargs)
def process_input(self, data, labels):
... | true | true |
f75899682710b825a4a2780808cc8edb60bc6d6a | 107 | py | Python | tests/environment.py | linkml/linkml-csv | faab3ce6921d5558b2c552ad09077a0821d15b00 | [
"CC0-1.0"
] | 2 | 2021-08-05T16:00:35.000Z | 2021-08-22T22:47:14.000Z | tests/environment.py | linkml/linkml-csv | faab3ce6921d5558b2c552ad09077a0821d15b00 | [
"CC0-1.0"
] | 1 | 2021-08-09T17:57:15.000Z | 2021-08-22T23:47:08.000Z | tests/environment.py | linkml/linkml-csv | faab3ce6921d5558b2c552ad09077a0821d15b00 | [
"CC0-1.0"
] | null | null | null | from linkml_runtime.tests.support.test_environment import TestEnvironment
env = TestEnvironment(__file__)
| 26.75 | 73 | 0.869159 | from linkml_runtime.tests.support.test_environment import TestEnvironment
env = TestEnvironment(__file__)
| true | true |
f7589a6813f3fa809d8540f35e8880008b918d13 | 12,266 | py | Python | docs_en/conf.py | yatendra-dev/WeBASE-Doc | f97b4866673932408f82495301a1a2fec814a41b | [
"Apache-2.0"
] | null | null | null | docs_en/conf.py | yatendra-dev/WeBASE-Doc | f97b4866673932408f82495301a1a2fec814a41b | [
"Apache-2.0"
] | null | null | null | docs_en/conf.py | yatendra-dev/WeBASE-Doc | f97b4866673932408f82495301a1a2fec814a41b | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Test documentation build configuration file, created by
# sphinx-quickstart on Sat Feb 7 20:09:23 2015.
#
# This file is execfile() with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... | 32.109948 | 89 | 0.7158 |
import sys
import os
import sphinx_rtd_theme
from recommonmark.transform import AutoStructify
DOC_SOURCES_DIR = os.path.dirname(os.path.abspath(__file__))
PROJECT_ROOT_DIR = os.path.dirname(os.path.abspath(DOC_SOURCES_DIR))
sys.path.insert(0, DOC_SOURCES_DIR)
print('PROJECT_ROOT_DIR:', PROJECT_ROOT_DI... | true | true |
f7589a83da7e256b5379c1e77db6465a7ce77a57 | 919 | py | Python | aylien/nlp_tools/migrations/0003_auto_20180129_0300.py | jijyisme/senior-project-backend | a86c1335dcfeef30e6fef0a4695549e931efba36 | [
"MIT"
] | null | null | null | aylien/nlp_tools/migrations/0003_auto_20180129_0300.py | jijyisme/senior-project-backend | a86c1335dcfeef30e6fef0a4695549e931efba36 | [
"MIT"
] | null | null | null | aylien/nlp_tools/migrations/0003_auto_20180129_0300.py | jijyisme/senior-project-backend | a86c1335dcfeef30e6fef0a4695549e931efba36 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2018-01-29 03:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nlp_tools', '0002_auto_20180127_1231'),
]
operations = [
migrations.CreateM... | 27.029412 | 114 | 0.556039 |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nlp_tools', '0002_auto_20180127_1231'),
]
operations = [
migrations.CreateModel(
name='TaggedToken',
fields=[
... | true | true |
f7589aa01a2b358b42ca2b6ea897139b6f26887c | 17,126 | py | Python | openpyxl_templates/table_sheet/columns.py | bonashen/openpyxl-templates | 76ab0f15e7423f61f0873383f64210d91b75ac4b | [
"MIT"
] | 1 | 2018-03-03T15:30:38.000Z | 2018-03-03T15:30:38.000Z | openpyxl_templates/table_sheet/columns.py | bonashen/openpyxl-templates | 76ab0f15e7423f61f0873383f64210d91b75ac4b | [
"MIT"
] | null | null | null | openpyxl_templates/table_sheet/columns.py | bonashen/openpyxl-templates | 76ab0f15e7423f61f0873383f64210d91b75ac4b | [
"MIT"
] | null | null | null | from datetime import date, datetime, timedelta, time
from types import FunctionType
from collections import Iterable
from openpyxl.cell import WriteOnlyCell
from openpyxl.formatting import Rule
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.datavalidation import DataValidation
from openpyxl_temp... | 31.714815 | 117 | 0.645393 | from datetime import date, datetime, timedelta, time
from types import FunctionType
from collections import Iterable
from openpyxl.cell import WriteOnlyCell
from openpyxl.formatting import Rule
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.datavalidation import DataValidation
from openpyxl_temp... | true | true |
f7589ad1cdc47e10cf3a55bab4cb4ece44c8b8c8 | 1,278 | py | Python | solutions/11. Container With Most Water.py | JacopoPan/leetcode-top100-liked-questions | 03dc05f087d05805d54b7585ce740338f3128833 | [
"MIT"
] | null | null | null | solutions/11. Container With Most Water.py | JacopoPan/leetcode-top100-liked-questions | 03dc05f087d05805d54b7585ce740338f3128833 | [
"MIT"
] | null | null | null | solutions/11. Container With Most Water.py | JacopoPan/leetcode-top100-liked-questions | 03dc05f087d05805d54b7585ce740338f3128833 | [
"MIT"
] | null | null | null | """
Runtime: 6200 ms, faster than 5.01% of Python3 online submissions for Container With Most Water.
Memory Usage: 27.5 MB, less than 57.22% of Python3 online submissions for Container With Most Water.
"""
from typing import List
from typing import Optional
class Solution:
def maxArea(self, height: List[int]) -> i... | 31.170732 | 100 | 0.50939 | from typing import List
from typing import Optional
class Solution:
def maxArea(self, height: List[int]) -> int:
i = 0
j = len(height) - 1
used_min_vert = min(height[i], height[j])
max_water = (j - i) * used_min_vert
while i+1 != j:
if height[i] > height[j]:
... | true | true |
f7589adac7d2683e0661e59cfec0ac79e5a3b194 | 8,515 | py | Python | growth/too/tests/test_gcn.py | shreyasahasram08/growth-too-marshal | f3fbf0043b50d3ffe56e6b4e06b0c1472fc10220 | [
"MIT"
] | 14 | 2019-04-16T19:31:30.000Z | 2020-08-18T21:34:54.000Z | growth/too/tests/test_gcn.py | shreyasahasram08/growth-too-marshal | f3fbf0043b50d3ffe56e6b4e06b0c1472fc10220 | [
"MIT"
] | 86 | 2019-04-16T20:43:04.000Z | 2021-04-23T16:16:39.000Z | growth/too/tests/test_gcn.py | shreyasahasram08/growth-too-marshal | f3fbf0043b50d3ffe56e6b4e06b0c1472fc10220 | [
"MIT"
] | 11 | 2019-04-16T18:41:53.000Z | 2020-04-21T13:22:13.000Z | import datetime
from unittest import mock
from astropy import time
from astropy import units as u
import gcn
import lxml.etree
import numpy as np
import pkg_resources
import pytest
from .. import models
from ..jinja import btoa
from ..flask import app
from ..gcn import handle, listen
from . import mock_download_file
... | 37.183406 | 122 | 0.670112 | import datetime
from unittest import mock
from astropy import time
from astropy import units as u
import gcn
import lxml.etree
import numpy as np
import pkg_resources
import pytest
from .. import models
from ..jinja import btoa
from ..flask import app
from ..gcn import handle, listen
from . import mock_download_file
... | true | true |
f7589aea8cf6c95303af76d7eb36a4671e93322e | 2,236 | py | Python | goza/chart.py | zgongaware/gonzo | 290eae429eb115793cdac3d0be69a064eb73f9a2 | [
"MIT"
] | null | null | null | goza/chart.py | zgongaware/gonzo | 290eae429eb115793cdac3d0be69a064eb73f9a2 | [
"MIT"
] | null | null | null | goza/chart.py | zgongaware/gonzo | 290eae429eb115793cdac3d0be69a064eb73f9a2 | [
"MIT"
] | null | null | null | import matplotlib.pyplot as plt
class Chart:
"""
Chart class to create and format a basic pyplot figure
"""
def __init__(self, title=None, xlabel=None, ylabel=None, figsize=None):
self.title = title if title else "Unnamed Chart"
self.xlabel = xlabel if xlabel else "X-Axis"
sel... | 27.604938 | 80 | 0.586315 | import matplotlib.pyplot as plt
class Chart:
def __init__(self, title=None, xlabel=None, ylabel=None, figsize=None):
self.title = title if title else "Unnamed Chart"
self.xlabel = xlabel if xlabel else "X-Axis"
self.ylabel = ylabel if ylabel else "Y-Axis"
self.figsize = figsize if... | true | true |
f7589d336f437dac17cfdf63d145d977ba77f7d1 | 1,189 | py | Python | elmoformanylangs/modules/lstm.py | luomou97/ELMoForManyLangs | 3e97600baa3a4dde229c1e78c513785e7d50e8e1 | [
"MIT"
] | null | null | null | elmoformanylangs/modules/lstm.py | luomou97/ELMoForManyLangs | 3e97600baa3a4dde229c1e78c513785e7d50e8e1 | [
"MIT"
] | null | null | null | elmoformanylangs/modules/lstm.py | luomou97/ELMoForManyLangs | 3e97600baa3a4dde229c1e78c513785e7d50e8e1 | [
"MIT"
] | null | null | null | from __future__ import absolute_import
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import copy
# \ref page 4, layers=2, forward + backward, concat[forward_projection, backward_projection]
class LstmbiLm(nn.Module):
de... | 42.464286 | 147 | 0.652649 | from __future__ import absolute_import
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import copy
class LstmbiLm(nn.Module):
def __init__(self, config, use_cuda=False):
super(LstmbiLm, self).__init__()
self.conf... | true | true |
f7589dd3a3896fe1626d48356000851b4a5f4060 | 1,401 | py | Python | py300/py300To90.py | metacogpe/python | f7b2bcd0fae9ae9899399e3a314ffea3955896b0 | [
"Apache-2.0"
] | null | null | null | py300/py300To90.py | metacogpe/python | f7b2bcd0fae9ae9899399e3a314ffea3955896b0 | [
"Apache-2.0"
] | null | null | null | py300/py300To90.py | metacogpe/python | f7b2bcd0fae9ae9899399e3a314ffea3955896b0 | [
"Apache-2.0"
] | null | null | null | # 별 표현식
a, b = (1,2)
print(a,b)
#위와 달리 갯수가 맞지 않을 경우
a, b, *c = (0,1,2,3,4,5)
print(a)
print(b)
print(c) # 리스트로 반영
scores = [8.8,8.9,8.7,9.2,9.3,9.7,9.9,9.5,7.8,9.4]
*valid_score, a, b = scores
print(valid_score) # a = 7.8, b = 9.4 이외는 valid_scoreㄷ
# 체조 점수 구하기 : 최고/최저 제거
scores = [8.8,8.9,8.7,9.2,9.3,9.7,9.9,9.5,7.... | 17.734177 | 54 | 0.552463 |
a, b = (1,2)
print(a,b)
a, b, *c = (0,1,2,3,4,5)
print(a)
print(b)
print(c)
scores = [8.8,8.9,8.7,9.2,9.3,9.7,9.9,9.5,7.8,9.4]
*valid_score, a, b = scores
print(valid_score)
scores = [8.8,8.9,8.7,9.2,9.3,9.7,9.9,9.5,7.8,9.4]
scores.sort()
a, *score, b = scores
print(a); print(score); print(b)
print(sum(score)... | true | true |
f7589e98f4151e504de1806f639692af4578dc31 | 45,640 | py | Python | src/transformers/adapters/model_mixin.py | rahuln/adapter-transformers | ac3284547064686d31b95e5e1b078447a2199779 | [
"Apache-2.0"
] | null | null | null | src/transformers/adapters/model_mixin.py | rahuln/adapter-transformers | ac3284547064686d31b95e5e1b078447a2199779 | [
"Apache-2.0"
] | null | null | null | src/transformers/adapters/model_mixin.py | rahuln/adapter-transformers | ac3284547064686d31b95e5e1b078447a2199779 | [
"Apache-2.0"
] | null | null | null | import logging
import os
import warnings
from abc import ABC, abstractmethod
from collections import defaultdict
from os.path import join
from typing import Iterable, List, Optional, Tuple, Union
import torch
from torch import nn
from .composition import AdapterCompositionBlock, Fuse, Stack, parse_composition
from .c... | 43.466667 | 138 | 0.648751 | import logging
import os
import warnings
from abc import ABC, abstractmethod
from collections import defaultdict
from os.path import join
from typing import Iterable, List, Optional, Tuple, Union
import torch
from torch import nn
from .composition import AdapterCompositionBlock, Fuse, Stack, parse_composition
from .c... | true | true |
f7589ec59305385fd588db3bf65f7dd9122397e9 | 1,150 | py | Python | donations/migrations/0001_initial.py | gauravuttarkar/SoftwareEngineering | 23c6e58176fcb27031f9095a1090c2f72602a3f6 | [
"MIT"
] | null | null | null | donations/migrations/0001_initial.py | gauravuttarkar/SoftwareEngineering | 23c6e58176fcb27031f9095a1090c2f72602a3f6 | [
"MIT"
] | 3 | 2020-06-05T20:14:46.000Z | 2021-06-10T21:20:45.000Z | donations/migrations/0001_initial.py | gauravuttarkar/SoftwareEngineering | 23c6e58176fcb27031f9095a1090c2f72602a3f6 | [
"MIT"
] | null | null | null | # Generated by Django 2.0.9 on 2019-04-07 12:27
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('events', '0008_auto_20190407_1227'),
migrations.sw... | 38.333333 | 134 | 0.626957 |
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('events', '0008_auto_20190407_1227'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | true | true |
f7589ef57c259c64eb79c5be58bbd5a5519d409e | 3,841 | py | Python | deep_lynx/models/import_data_type_mapping_response.py | idaholab/Deep-Lynx-Python-Package | 99927cc877eba8e2ee396feec807da1c48c64893 | [
"MIT"
] | 3 | 2021-06-16T20:34:41.000Z | 2021-06-16T23:54:36.000Z | deep_lynx/models/import_data_type_mapping_response.py | idaholab/Deep-Lynx-Python-Package | 99927cc877eba8e2ee396feec807da1c48c64893 | [
"MIT"
] | null | null | null | deep_lynx/models/import_data_type_mapping_response.py | idaholab/Deep-Lynx-Python-Package | 99927cc877eba8e2ee396feec807da1c48c64893 | [
"MIT"
] | null | null | null | # coding: utf-8
"""
Deep Lynx
The construction of megaprojects has consistently demonstrated challenges for project managers in regard to meeting cost, schedule, and performance requirements. Megaproject construction challenges are common place within megaprojects with many active projects in the United State... | 45.188235 | 1,455 | 0.659203 |
import pprint
import re
import six
class ImportDataTypeMappingResponse(object):
swagger_types = {
}
attribute_map = {
}
def __init__(self):
self.discriminator = None
def to_dict(self):
result = {}
for attr, _ in six.iteritems(self.swagger_types):
... | true | true |
f758a0266e22fe747734759c8c9a4a79eb91dd79 | 1,017 | py | Python | qtrader/simulation/aaft.py | aaron8tang/qtrader | 9bd50fd173c7b55707e91d75985055bbe8664548 | [
"Apache-2.0"
] | 381 | 2017-10-25T19:17:04.000Z | 2021-03-02T08:46:53.000Z | qtrader/simulation/aaft.py | 362115815/qtrader | e5c1e175e19b20381f9140fb76c30ad5cb81f01c | [
"Apache-2.0"
] | 3 | 2018-02-13T23:19:40.000Z | 2018-12-03T22:50:58.000Z | qtrader/simulation/aaft.py | 362115815/qtrader | e5c1e175e19b20381f9140fb76c30ad5cb81f01c | [
"Apache-2.0"
] | 145 | 2017-10-25T19:17:06.000Z | 2021-02-15T04:54:08.000Z | import numpy as np
import pandas as pd
def AAFT(df, random=np.random.uniform, random_state=None):
"""Amplitude Adjusted Fourier Transform Baseline Generator."""
# set random seed
np.random.seed(random_state)
# Operate on numpy.ndarray
ts = df.values
# 2d time-series format
_ts = ts.reshape... | 32.806452 | 66 | 0.621436 | import numpy as np
import pandas as pd
def AAFT(df, random=np.random.uniform, random_state=None):
np.random.seed(random_state)
ts = df.values
_ts = ts.reshape(len(ts), -1)
if len(_ts) % 2 != 0:
_ts = _ts[1:, :]
ts_gen = np.empty_like(_ts)
for i, tsi in enumerat... | true | true |
f758a0841dac4dadda94c987656ab56b6bc17fbb | 1,749 | py | Python | cd4ml/model_tracking/validation_metrics.py | camila-contreras/CD4ML-Scenarios | 806f812990c7cf33b5f78456f0065012b5b4cd35 | [
"MIT"
] | 1 | 2021-07-17T19:31:31.000Z | 2021-07-17T19:31:31.000Z | cd4ml/model_tracking/validation_metrics.py | camila-contreras/CD4ML-Scenarios | 806f812990c7cf33b5f78456f0065012b5b4cd35 | [
"MIT"
] | 1 | 2020-11-02T21:15:23.000Z | 2020-11-02T21:15:23.000Z | cd4ml/model_tracking/validation_metrics.py | camila-contreras/CD4ML-Scenarios | 806f812990c7cf33b5f78456f0065012b5b4cd35 | [
"MIT"
] | 2 | 2020-04-15T14:05:42.000Z | 2021-04-29T13:24:20.000Z | from sklearn import metrics
import numpy as np
import logging
logger = logging.getLogger(__name__)
# TODO: add others
# TODO: add ability to include generic functions
def r2_score(true_target, prediction):
# R2 metric
return metrics.r2_score(y_true=true_target, y_pred=prediction)
def rms_score(true_target,... | 30.684211 | 78 | 0.722699 | from sklearn import metrics
import numpy as np
import logging
logger = logging.getLogger(__name__)
def r2_score(true_target, prediction):
return metrics.r2_score(y_true=true_target, y_pred=prediction)
def rms_score(true_target, prediction):
return np.sqrt(((prediction - true_target)**2).mean())... | true | true |
f758a0915034fa55f3fab47778de2ca357299ec5 | 1,647 | py | Python | src/nxrefine/plugins/refine/new_sample.py | rayosborn/nxpeaks | a90367b4ab84a5ce7b435f71beb35726c753fcc4 | [
"BSD-3-Clause-Clear"
] | 1 | 2022-01-07T11:29:17.000Z | 2022-01-07T11:29:17.000Z | src/nxrefine/plugins/refine/new_sample.py | rayosborn/nxpeaks | a90367b4ab84a5ce7b435f71beb35726c753fcc4 | [
"BSD-3-Clause-Clear"
] | 1 | 2022-03-29T14:52:07.000Z | 2022-03-29T15:25:54.000Z | src/nxrefine/plugins/refine/new_sample.py | axmas-anl/nxrefine | 6f5f53f955737c6f306d566b0a24ad1067089142 | [
"BSD-3-Clause-Clear"
] | null | null | null | # -----------------------------------------------------------------------------
# Copyright (c) 2015-2021, NeXpy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING, distributed with this software.
# -------------------------------------------------... | 33.612245 | 79 | 0.55677 |
import os
from nexpy.gui.datadialogs import GridParameters, NXDialog
from nexpy.gui.utils import report_error
from nexusformat.nexus import NeXusError
def show_dialog():
try:
dialog = SampleDialog()
dialog.show()
except NeXusError as error:
report_error("Defining New Sample", ... | true | true |
f758a09dd7b97cf144f01015e9aa6d844d946ba6 | 10,699 | py | Python | aws/amazonia/amazonia/classes/amz_api_gateway.py | linz/Geodesy-Web-Services | d2f52a5beed179f817cbf8040e6c85b623c97fb9 | [
"BSD-3-Clause"
] | 2 | 2018-06-19T04:05:19.000Z | 2020-07-17T02:31:31.000Z | aws/amazonia/amazonia/classes/amz_api_gateway.py | linz/Geodesy-Web-Services | d2f52a5beed179f817cbf8040e6c85b623c97fb9 | [
"BSD-3-Clause"
] | null | null | null | aws/amazonia/amazonia/classes/amz_api_gateway.py | linz/Geodesy-Web-Services | d2f52a5beed179f817cbf8040e6c85b623c97fb9 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/python3
from troposphere import Ref, Join, GetAtt, Output, ImportValue, Export
from troposphere.apigateway import Deployment
from troposphere.apigateway import RestApi, Resource, MethodResponse, IntegrationResponse, Integration, Method
from troposphere.awslambda import Permission
class ApiGateway(object):... | 41.792969 | 121 | 0.627629 |
from troposphere import Ref, Join, GetAtt, Output, ImportValue, Export
from troposphere.apigateway import Deployment
from troposphere.apigateway import RestApi, Resource, MethodResponse, IntegrationResponse, Integration, Method
from troposphere.awslambda import Permission
class ApiGateway(object):
def __init__(... | true | true |
f758a114092aa4404fc002b0d22c22cc4227068a | 1,723 | py | Python | examples/daal4py/dbscan_spmd.py | yumorozov/scikit-learn-intelex | 7a39c0a0e208b49f209168b01fb50206f962175f | [
"Apache-2.0"
] | 1 | 2021-12-24T16:53:01.000Z | 2021-12-24T16:53:01.000Z | examples/daal4py/dbscan_spmd.py | yumorozov/scikit-learn-intelex | 7a39c0a0e208b49f209168b01fb50206f962175f | [
"Apache-2.0"
] | null | null | null | examples/daal4py/dbscan_spmd.py | yumorozov/scikit-learn-intelex | 7a39c0a0e208b49f209168b01fb50206f962175f | [
"Apache-2.0"
] | null | null | null | #===============================================================================
# Copyright 2014 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.o... | 33.784314 | 89 | 0.630876 |
import daal4py as d4p
import numpy as np
def main(method='defaultDense'):
infile = "./data/batch/dbscan_dense.csv"
epsilon = 0.04
minObservations = 45
data = np.loadtxt(infile, delimiter=',')
rpp = int(data.shape[0] / d4p.num_procs())
data = data[rpp * d4p.my_procid()... | true | true |
f758a230a9aa92c8e43ee79986d4f4999229544c | 53,523 | py | Python | awx/main/models/unified_jobs.py | devops786/awx-demo | 5ebb8a15628865e5ddd2f39ccb29e19387782205 | [
"Apache-2.0"
] | 1 | 2018-09-03T19:09:55.000Z | 2018-09-03T19:09:55.000Z | awx/main/models/unified_jobs.py | devops786/awx-demo | 5ebb8a15628865e5ddd2f39ccb29e19387782205 | [
"Apache-2.0"
] | 1 | 2020-04-09T08:43:28.000Z | 2020-04-09T08:43:28.000Z | awx/main/models/unified_jobs.py | devops786/awx-demo | 5ebb8a15628865e5ddd2f39ccb29e19387782205 | [
"Apache-2.0"
] | 2 | 2018-09-03T19:10:02.000Z | 2019-06-12T07:07:16.000Z | # Copyright (c) 2015 Ansible, Inc.
# All Rights Reserved.
# Python
from StringIO import StringIO
import json
import logging
import os
import re
import subprocess
import tempfile
from collections import OrderedDict
# Django
from django.conf import settings
from django.db import models, connection
from django.core.exce... | 38.203426 | 160 | 0.61723 |
from StringIO import StringIO
import json
import logging
import os
import re
import subprocess
import tempfile
from collections import OrderedDict
from django.conf import settings
from django.db import models, connection
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.translation import uget... | true | true |
f758a2b7c3f4f1b6754dc5040a4449e83048a77a | 4,224 | py | Python | third_party/coriander/src/CLBlast/scripts/database/database.py | pint1022/tensorflow | 92e437b36ae58ea22910dbed67e2c238c869c09f | [
"Apache-2.0"
] | 2 | 2019-04-15T23:07:00.000Z | 2020-03-11T16:09:02.000Z | third_party/coriander/src/CLBlast/scripts/database/database.py | pint1022/tensorflow | 92e437b36ae58ea22910dbed67e2c238c869c09f | [
"Apache-2.0"
] | null | null | null | third_party/coriander/src/CLBlast/scripts/database/database.py | pint1022/tensorflow | 92e437b36ae58ea22910dbed67e2c238c869c09f | [
"Apache-2.0"
] | 2 | 2020-03-04T13:59:48.000Z | 2020-03-09T13:11:45.000Z | #!/usr/bin/env python
# This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This file follows the
# PEP8 Python style guide and uses a max-width of 120 characters per line.
#
# Author(s):
# Cedric Nugteren <www.cedricnugteren.nl>
import sys
import os.path
import glob
import a... | 40.228571 | 119 | 0.718513 |
import sys
import os.path
import glob
import argparse
import database.io as io
import database.db as db
import database.clblast as clblast
import database.bests as bests
import database.defaults as defaults
DATABASE_SERVER_URL = "http://www.cedricnugteren.nl/tuning/clblast.json"
VENDOR_TRANSLATION_TABLE = ... | true | true |
f758a2d1f094d7516db009344fd0d4597cfaa539 | 3,577 | py | Python | basic/string1.py | felipetac/google-python-exercises | 1756657240c7db709a8a58d5d05193e857678a4c | [
"Apache-2.0"
] | null | null | null | basic/string1.py | felipetac/google-python-exercises | 1756657240c7db709a8a58d5d05193e857678a4c | [
"Apache-2.0"
] | null | null | null | basic/string1.py | felipetac/google-python-exercises | 1756657240c7db709a8a58d5d05193e857678a4c | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already se... | 31.9375 | 80 | 0.659212 |
# http://code.google.com/edu/languages/google-python-class/
# Basic string exercises
# Fill in the code for the functions below. main() is already set up
# to call the functions with a few different inputs,
# printing 'OK' when each function is correct.
# The starter code for each function includes a 'return'
# ... | true | true |
f758a34607b4fa1680d5bf14f931c0049e5731d9 | 2,574 | py | Python | fedml_api/model/cv/darts/utils.py | Alex-Roudjiat/Federated-ML-AI-Federated-ML- | 8ccc24cf2c01b868988f5d5bd65f1666cf5526bc | [
"Apache-2.0"
] | 1,120 | 2020-07-22T02:30:52.000Z | 2022-03-31T08:10:44.000Z | fedml_api/model/cv/darts/utils.py | Alex-Roudjiat/Federated-ML-AI-Federated-ML- | 8ccc24cf2c01b868988f5d5bd65f1666cf5526bc | [
"Apache-2.0"
] | 113 | 2020-07-27T03:48:09.000Z | 2022-03-30T03:25:56.000Z | fedml_api/model/cv/darts/utils.py | Alex-Roudjiat/Federated-ML-AI-Federated-ML- | 8ccc24cf2c01b868988f5d5bd65f1666cf5526bc | [
"Apache-2.0"
] | 381 | 2020-07-22T06:12:57.000Z | 2022-03-30T18:38:35.000Z | import os
import shutil
import numpy as np
import torch
from torch.autograd import Variable
class AvgrageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.avg = 0
self.sum = 0
self.cnt = 0
def update(self, val, n=1):
self.sum += val * n
... | 25.485149 | 109 | 0.602564 | import os
import shutil
import numpy as np
import torch
from torch.autograd import Variable
class AvgrageMeter(object):
def __init__(self):
self.reset()
def reset(self):
self.avg = 0
self.sum = 0
self.cnt = 0
def update(self, val, n=1):
self.sum += val * n
... | true | true |
f758a36287d57cffd941254c9101499537620f17 | 12,312 | py | Python | src/pretalx/orga/views/review.py | oxinabox/pretalx | aa8cb810addd3f6f3fd6e7557497a04a51653413 | [
"Apache-2.0"
] | null | null | null | src/pretalx/orga/views/review.py | oxinabox/pretalx | aa8cb810addd3f6f3fd6e7557497a04a51653413 | [
"Apache-2.0"
] | null | null | null | src/pretalx/orga/views/review.py | oxinabox/pretalx | aa8cb810addd3f6f3fd6e7557497a04a51653413 | [
"Apache-2.0"
] | null | null | null | from django.contrib import messages
from django.db import transaction
from django.db.models import Count, Exists, OuterRef, Q
from django.shortcuts import get_object_or_404, redirect
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.views.generic imp... | 38 | 189 | 0.620045 | from django.contrib import messages
from django.db import transaction
from django.db.models import Count, Exists, OuterRef, Q
from django.shortcuts import get_object_or_404, redirect
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
from django.views.generic imp... | true | true |
f758a3cd64e8bac5d7062865554471fc3adbed5c | 14,097 | py | Python | python_modules/libraries/dagstermill/dagstermill/solids.py | wingyplus/dagster | 1771b49f58c62141628da6a767516d3dcb9637d6 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagstermill/dagstermill/solids.py | wingyplus/dagster | 1771b49f58c62141628da6a767516d3dcb9637d6 | [
"Apache-2.0"
] | null | null | null | python_modules/libraries/dagstermill/dagstermill/solids.py | wingyplus/dagster | 1771b49f58c62141628da6a767516d3dcb9637d6 | [
"Apache-2.0"
] | null | null | null | import copy
import os
import pickle
import uuid
import nbformat
import papermill
import six
from papermill.engines import papermill_engines
from papermill.iorw import load_notebook_node, write_ipynb
from papermill.parameterize import _find_first_tagged_cell_index
from dagster import (
AssetMaterialization,
Ev... | 42.718182 | 146 | 0.64645 | import copy
import os
import pickle
import uuid
import nbformat
import papermill
import six
from papermill.engines import papermill_engines
from papermill.iorw import load_notebook_node, write_ipynb
from papermill.parameterize import _find_first_tagged_cell_index
from dagster import (
AssetMaterialization,
Ev... | true | true |
f758a3d1b5f6c6c6a74f9fe582cef2f60178bfc2 | 897 | py | Python | examples/linear_regression_plot.py | alexbarcelo/dislib | 989f81f235ae30b17410a8d805df258c7d931b38 | [
"Apache-2.0"
] | 36 | 2018-10-22T19:21:14.000Z | 2022-03-22T12:10:01.000Z | examples/linear_regression_plot.py | alexbarcelo/dislib | 989f81f235ae30b17410a8d805df258c7d931b38 | [
"Apache-2.0"
] | 329 | 2018-11-22T18:04:57.000Z | 2022-03-18T01:26:55.000Z | examples/linear_regression_plot.py | alexbarcelo/dislib | 989f81f235ae30b17410a8d805df258c7d931b38 | [
"Apache-2.0"
] | 21 | 2019-01-10T11:46:39.000Z | 2022-03-17T12:59:45.000Z | import numpy as np
from pylab import scatter, plot, show
import dislib as ds
from dislib.regression import LinearRegression
def main():
"""
Linear regression example with plot
"""
# Example data
x = np.array([1000, 4000, 5000, 4500, 3000, 4000, 9000, 11000, 15000,
12000, 7000, ... | 25.628571 | 73 | 0.605351 | import numpy as np
from pylab import scatter, plot, show
import dislib as ds
from dislib.regression import LinearRegression
def main():
x = np.array([1000, 4000, 5000, 4500, 3000, 4000, 9000, 11000, 15000,
12000, 7000, 3000])
y = np.array([9914, 40487, 54324, 50044, 34719, 42551, 9487... | true | true |
f758a4f692475b93f48e89fdb3c84d8b81706425 | 832 | py | Python | travis_aws_key_rotate.py | gebn/travis-aws-key-rotate | 520576bf7d7607f786320e659ea8caefb68b693d | [
"MIT"
] | null | null | null | travis_aws_key_rotate.py | gebn/travis-aws-key-rotate | 520576bf7d7607f786320e659ea8caefb68b693d | [
"MIT"
] | 1 | 2018-02-20T01:04:44.000Z | 2018-02-20T01:04:44.000Z | travis_aws_key_rotate.py | gebn/travis-aws-key-rotate | 520576bf7d7607f786320e659ea8caefb68b693d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
import logging
import os
import trawsate
logger = logging.getLogger(__name__)
logging.getLogger('boto3').setLevel(logging.INFO)
logging.getLogger('botocore').setLevel(logging.INFO)
logging.getLogger('urllib3').setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)
_TRAVIS_ACCESS_TOKEN = os.en... | 27.733333 | 75 | 0.716346 |
import logging
import os
import trawsate
logger = logging.getLogger(__name__)
logging.getLogger('boto3').setLevel(logging.INFO)
logging.getLogger('botocore').setLevel(logging.INFO)
logging.getLogger('urllib3').setLevel(logging.INFO)
logger.setLevel(logging.DEBUG)
_TRAVIS_ACCESS_TOKEN = os.environ['TRAVIS_ACCESS_TO... | true | true |
f758a59780503e88ef8d21698f3fe033ef9a5a93 | 7,258 | py | Python | scripts/python/blend_sat/ncvdefs.py | OSADP/Pikalert-Vehicle-Data-Translator- | 295da604408f6f13af0301b55476a81311459386 | [
"Apache-2.0"
] | 2 | 2020-06-03T15:59:50.000Z | 2020-12-21T11:11:57.000Z | scripts/python/blend_sat/ncvdefs.py | OSADP/Pikalert-Vehicle-Data-Translator- | 295da604408f6f13af0301b55476a81311459386 | [
"Apache-2.0"
] | null | null | null | scripts/python/blend_sat/ncvdefs.py | OSADP/Pikalert-Vehicle-Data-Translator- | 295da604408f6f13af0301b55476a81311459386 | [
"Apache-2.0"
] | 2 | 2019-10-02T06:47:23.000Z | 2020-02-02T18:32:23.000Z | #!/usr/bin/env python
#
# File containing standard definitions for various things
#
# File suffixes or extensions
ADDS_SUFFIX = "bin"
ASC_SUFFIX = "asc"
BUFR_SUFFIX = "bufr"
EPL_SUFFIX = "epl"
GINI_SUFFIX = "gini"
GRB_SUFFIX = "grb"
GRB2_SUFFIX = "grb2"
GZIP_SUFFIX = "gz"
HDF_SUFFIX = "h5"
NC_SUFFIX = "nc"
NETCDF_SUF... | 46.229299 | 118 | 0.539267 |
ADDS_SUFFIX = "bin"
ASC_SUFFIX = "asc"
BUFR_SUFFIX = "bufr"
EPL_SUFFIX = "epl"
GINI_SUFFIX = "gini"
GRB_SUFFIX = "grb"
GRB2_SUFFIX = "grb2"
GZIP_SUFFIX = "gz"
HDF_SUFFIX = "h5"
NC_SUFFIX = "nc"
NETCDF_SUFFIX = "nc"
PKL_SUFFIX = "pkl"
PYL_SUFFIX = "pyl"
Ascii = "ascii"
Grib = "grib"
Grib2 = "grib2"
Hdf = "hdf"
... | true | true |
f758a5ca710442733604415e64f9bd6c165753d7 | 3,109 | py | Python | examples/python/real_time_insights.py | JeffreyLuu/apexe3-api | 081da51370e8b01b1e8169e4137a99636ea71866 | [
"MIT"
] | null | null | null | examples/python/real_time_insights.py | JeffreyLuu/apexe3-api | 081da51370e8b01b1e8169e4137a99636ea71866 | [
"MIT"
] | null | null | null | examples/python/real_time_insights.py | JeffreyLuu/apexe3-api | 081da51370e8b01b1e8169e4137a99636ea71866 | [
"MIT"
] | null | null | null | '''
/**
* real_time_insights.py
*
* Streams a real-time insights for the supplied pair
* An example of the real-time insights is available here:
* https://app.ae3platform.com/insights
*
* Disclaimer:
* APEX:E3 is a financial technology company based in the United Kingdom https://www.apexe3.com
*
* None of... | 34.164835 | 95 | 0.616919 | import sys
sys.path.append('..')
from apexe3.apexe3 import initialise
from apexe3.apexe3 import initialise_stream
from apexe3.apexe3 import initialise_insights_for_pair
import pandas as pd
base = 'btc'
quote = 'usdt'
def process_spread(event):
print('Best spreads for ' + str(base) +' '+ str(quote))
table=pd... | true | true |
f758a6638bd3d3e99a3123d81b4e81e8b19203d5 | 11,575 | py | Python | src/discriminator/instance.py | Ravi-0809/question-generation | 9065a3b47293b8a69a0548af1f6bedd4a4aa7f9c | [
"MIT"
] | 212 | 2018-08-15T11:06:35.000Z | 2021-11-21T10:21:55.000Z | src/discriminator/instance.py | Ravi-0809/question-generation | 9065a3b47293b8a69a0548af1f6bedd4a4aa7f9c | [
"MIT"
] | 44 | 2018-10-15T12:50:31.000Z | 2020-11-13T18:02:03.000Z | src/discriminator/instance.py | Ravi-0809/question-generation | 9065a3b47293b8a69a0548af1f6bedd4a4aa7f9c | [
"MIT"
] | 51 | 2018-08-17T18:17:43.000Z | 2021-03-04T06:14:52.000Z | import sys,json,time,os
sys.path.insert(0, "/Users/tom/Dropbox/msc-ml/project/src/")
sys.path.insert(0, "/cs/student/msc/ml/2017/thosking/dev/msc-project/src/")
import tensorflow as tf
import numpy as np
import discriminator.config
from discriminator.model import Model
from discriminator.prepro import convert_to_feat... | 38.712375 | 160 | 0.623067 | import sys,json,time,os
sys.path.insert(0, "/Users/tom/Dropbox/msc-ml/project/src/")
sys.path.insert(0, "/cs/student/msc/ml/2017/thosking/dev/msc-project/src/")
import tensorflow as tf
import numpy as np
import discriminator.config
from discriminator.model import Model
from discriminator.prepro import convert_to_feat... | true | true |
f758a8147e484ea7566933dbc130e20625fa989e | 14,673 | py | Python | spyder/plugins/editor/widgets/tests/test_editorsplitter.py | seryj/spyder | acea4f501c1a04d57b02e5e817708a69b503f430 | [
"MIT"
] | 1 | 2019-07-17T00:20:41.000Z | 2019-07-17T00:20:41.000Z | spyder/plugins/editor/widgets/tests/test_editorsplitter.py | sixteentons/spyder | ae9513879e0dc9b6909e065e304c00a04179a0ec | [
"MIT"
] | null | null | null | spyder/plugins/editor/widgets/tests/test_editorsplitter.py | sixteentons/spyder | ae9513879e0dc9b6909e065e304c00a04179a0ec | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Tests for EditorSplitter class in editor.py
"""
# Standard library imports
try:
from unittest.mock import Mock
import pathlib
except ImportError:
from mock import Mock # Python 2
im... | 34.935714 | 82 | 0.669665 |
try:
from unittest.mock import Mock
import pathlib
except ImportError:
from mock import Mock
import pathlib2 as pathlib
import os
import os.path as osp
from functools import partial
import pytest
from qtpy.QtCore import Qt
from spyder.plugins.editor.widgets.editor import EditorStack, Edit... | true | true |
f758a843fc039717ae670fa32efe9c70e73354d7 | 277 | py | Python | vehicle_management/vehicle_management/doctype/vehicle_owner_contract/test_vehicle_owner_contract.py | muirawachanga/vehicle | 1025f99ecab14d27485584f540e9630bfcb50c0f | [
"MIT"
] | null | null | null | vehicle_management/vehicle_management/doctype/vehicle_owner_contract/test_vehicle_owner_contract.py | muirawachanga/vehicle | 1025f99ecab14d27485584f540e9630bfcb50c0f | [
"MIT"
] | null | null | null | vehicle_management/vehicle_management/doctype/vehicle_owner_contract/test_vehicle_owner_contract.py | muirawachanga/vehicle | 1025f99ecab14d27485584f540e9630bfcb50c0f | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Bituls Company Limited and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
# test_records = frappe.get_test_records('Owner Contract')
class TestOwnerContract(unittest.TestCase):
pass
| 19.785714 | 61 | 0.761733 |
from __future__ import unicode_literals
import unittest
class TestOwnerContract(unittest.TestCase):
pass
| true | true |
f758a88799406090a7e2b0f4fe6dbd4aa9ec2992 | 369 | py | Python | Python/04_Sets/001_Introduction_to_Sets.py | drbuche/HackerRank | f956e29409f8af90025d04482149ec16b4f83622 | [
"MIT"
] | 1 | 2020-09-05T21:56:48.000Z | 2020-09-05T21:56:48.000Z | Python/04_Sets/001_Introduction_to_Sets.py | drbuche/HackerRank | f956e29409f8af90025d04482149ec16b4f83622 | [
"MIT"
] | null | null | null | Python/04_Sets/001_Introduction_to_Sets.py | drbuche/HackerRank | f956e29409f8af90025d04482149ec16b4f83622 | [
"MIT"
] | null | null | null | # Problem : https://www.hackerrank.com/challenges/py-introduction-to-sets/problem
# Score : 10 points(MAX)
def average(arr):
return (sum(set(arr))) / (len(set(arr))) # apenas divida a soma de um set pelo seu número de elementos
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split... | 30.75 | 107 | 0.658537 |
def average(arr):
return (sum(set(arr))) / (len(set(arr)))
if __name__ == '__main__':
n = int(input())
arr = list(map(int, input().split()))
result = average(arr)
print(result)
| true | true |
f758a99d8401b2ae72ce089944b62d8b00bdc0be | 4,475 | py | Python | benchmark/startQiskit_Class3399.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_Class3399.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_Class3399.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=46
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_... | 34.960938 | 140 | 0.648492 |
import cirq
import qiskit
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_xor(s: str, t: str) -> str:
l... | true | true |
f758aa75d701602a3ea0f45c382ea03ae2d44a1d | 16,051 | py | Python | Jumpscale/clients/git/GitClient.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | null | null | null | Jumpscale/clients/git/GitClient.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | null | null | null | Jumpscale/clients/git/GitClient.py | Dinaamagdy/jumpscale_core | dec5d42e368ab2b5b2e40837b71d27a59cb501ab | [
"Apache-2.0"
] | null | null | null | from Jumpscale import j
import git
import copy
JSBASE = j.application.jsbase_get_class()
class GitClient(JSBASE):
"""
Client of git services, has all git related operations like push, pull, ...
"""
def __init__(self, baseDir, check_path=True): # NOQA
if baseDir==None or baseDir.strip()=="":... | 31.721344 | 125 | 0.54682 | from Jumpscale import j
import git
import copy
JSBASE = j.application.jsbase_get_class()
class GitClient(JSBASE):
def __init__(self, baseDir, check_path=True):
if baseDir==None or baseDir.strip()=="":
raise RuntimeError("basedir cannot be empty")
baseDir_org=copy.copy(baseDir)
... | true | true |
f758aca726f3d42e1f2b8313c2a96882950c5608 | 314 | py | Python | doc/customizing_guide/scripts/coord_convert.py | areza7/glue | 42b68baec522b257e70a2f902c151233a0414720 | [
"BSD-3-Clause"
] | null | null | null | doc/customizing_guide/scripts/coord_convert.py | areza7/glue | 42b68baec522b257e70a2f902c151233a0414720 | [
"BSD-3-Clause"
] | null | null | null | doc/customizing_guide/scripts/coord_convert.py | areza7/glue | 42b68baec522b257e70a2f902c151233a0414720 | [
"BSD-3-Clause"
] | null | null | null | from glue.config import link_function
@link_function(info="Celsius to Fahrenheit",
output_labels=['F'])
def celsius2farhenheit(c):
return c * 9. / 5. + 32
@link_function(info="Fahrenheit to Celsius",
output_labels=['C'])
def farhenheit2celsius(f):
return (f - 32) * 5. / 9.
| 26.166667 | 44 | 0.633758 | from glue.config import link_function
@link_function(info="Celsius to Fahrenheit",
output_labels=['F'])
def celsius2farhenheit(c):
return c * 9. / 5. + 32
@link_function(info="Fahrenheit to Celsius",
output_labels=['C'])
def farhenheit2celsius(f):
return (f - 32) * 5. / 9.
| true | true |
f758ae42f199d6476077c532e3c8a80bee045533 | 45,584 | py | Python | code/client/munkilib/updatecheck/analyze.py | ca-ecuad-macadmins/munki | ddc456b5c766dd1ec03b3631b953c486a9f848c8 | [
"Apache-2.0"
] | 2,536 | 2015-01-03T18:11:06.000Z | 2022-03-29T09:06:02.000Z | code/client/munkilib/updatecheck/analyze.py | ca-ecuad-macadmins/munki | ddc456b5c766dd1ec03b3631b953c486a9f848c8 | [
"Apache-2.0"
] | 639 | 2015-01-09T02:42:46.000Z | 2022-03-31T14:41:28.000Z | code/client/munkilib/updatecheck/analyze.py | ca-ecuad-macadmins/munki | ddc456b5c766dd1ec03b3631b953c486a9f848c8 | [
"Apache-2.0"
] | 439 | 2015-01-05T18:09:53.000Z | 2022-03-28T17:15:04.000Z | # encoding: utf-8
#
# Copyright 2009-2021 Greg Neagle.
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | 44.60274 | 80 | 0.602668 |
from __future__ import absolute_import, print_function
import datetime
import os
from . import catalogs
from . import compare
from . import download
from . import installationstate
from . import manifestutils
from . import unused_software
from .. import display
from .. import fetch
from .. import info... | true | true |
f758af5f982ca00ece4ee66b8ec4c9848d2da3cb | 58,934 | py | Python | python/mxnet/optimizer.py | ijkguo/mxnet | c7667126163c0d90c5cfab19579272ea714cf949 | [
"Apache-2.0"
] | 4 | 2016-07-01T00:20:33.000Z | 2018-01-26T12:19:06.000Z | python/mxnet/optimizer.py | ijkguo/mxnet | c7667126163c0d90c5cfab19579272ea714cf949 | [
"Apache-2.0"
] | 6 | 2018-06-21T17:08:26.000Z | 2018-08-09T17:58:08.000Z | python/mxnet/optimizer.py | ijkguo/mxnet | c7667126163c0d90c5cfab19579272ea714cf949 | [
"Apache-2.0"
] | 3 | 2016-07-19T15:36:21.000Z | 2018-03-19T01:27:52.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... | 38.468668 | 129 | 0.618251 |
import logging
import math
import pickle
import warnings
import numpy
from .base import py_str
from .ndarray import (NDArray, zeros, clip, sqrt, cast, maximum, abs as NDabs)
from .ndarray import (sgd_update, sgd_mom_update, adam_update, rmsprop_update, rmspropalex_update,
mp_sgd... | true | true |
f758b0c60a3c795bf8bae04b36a4baa6a53ba62f | 274 | py | Python | ch_5/plot_w.py | ProhardONE/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | 51 | 2016-04-05T16:56:11.000Z | 2022-02-08T00:08:47.000Z | ch_5/plot_w.py | zhangxiao921207/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | null | null | null | ch_5/plot_w.py | zhangxiao921207/python_primer | 211e37c1f2fd169269fc4f3c08e8b7e5225f2ad0 | [
"MIT"
] | 47 | 2016-05-02T07:51:37.000Z | 2022-02-08T01:28:15.000Z | # Exercise 5.35
# Author: Noah Waterfield Price
import numpy as np
import matplotlib.pyplot as plt
def f(x):
r = np.zeros(len(x))
r[x < 0] = -x[x < 0] - 5
r[x >= 0] = x[x >= 0] - 5
return abs(r)
x = np.linspace(-10, 10, 101)
plt.plot(x, f(x))
plt.show()
| 16.117647 | 31 | 0.562044 |
import numpy as np
import matplotlib.pyplot as plt
def f(x):
r = np.zeros(len(x))
r[x < 0] = -x[x < 0] - 5
r[x >= 0] = x[x >= 0] - 5
return abs(r)
x = np.linspace(-10, 10, 101)
plt.plot(x, f(x))
plt.show()
| true | true |
f758b1cb23ba19b776dd92e691f5c878c0fd8cb1 | 485 | py | Python | setup.py | iparshin/schematic-file-converter | 3d4dfaa1544a8aebff3b9f9f646a20bf27dad9c3 | [
"Apache-2.0"
] | 1 | 2016-09-05T17:18:33.000Z | 2016-09-05T17:18:33.000Z | setup.py | iparshin/schematic-file-converter | 3d4dfaa1544a8aebff3b9f9f646a20bf27dad9c3 | [
"Apache-2.0"
] | null | null | null | setup.py | iparshin/schematic-file-converter | 3d4dfaa1544a8aebff3b9f9f646a20bf27dad9c3 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
from setuptools import setup, find_packages
packages = ['upconvert.' + p for p in find_packages('upconvert', exclude=['test', 'test*', '*.t'])]
packages.append('upconvert')
setup(
name='python-upconvert',
maintainer='Upverter Inc.',
maintainer_email='opensource@upverter.com',
ve... | 26.944444 | 99 | 0.68866 |
from setuptools import setup, find_packages
packages = ['upconvert.' + p for p in find_packages('upconvert', exclude=['test', 'test*', '*.t'])]
packages.append('upconvert')
setup(
name='python-upconvert',
maintainer='Upverter Inc.',
maintainer_email='opensource@upverter.com',
version='0.3',
desc... | true | true |
f758b34d9f8ef6e9eea83cc041aff609a483d2b2 | 14,426 | py | Python | cimcb_lite/model/BaseModel.py | KevinMMendez/cimcb_lite | 1e6cf7137cd04d6be4ad1ba6fd317077ace08ee8 | [
"MIT"
] | 1 | 2019-03-19T13:18:56.000Z | 2019-03-19T13:18:56.000Z | cimcb_lite/model/BaseModel.py | KevinMMendez/cimcb_lite | 1e6cf7137cd04d6be4ad1ba6fd317077ace08ee8 | [
"MIT"
] | 1 | 2019-03-24T11:04:39.000Z | 2019-03-26T03:54:51.000Z | cimcb_lite/model/BaseModel.py | KevinMMendez/cimcb_lite | 1e6cf7137cd04d6be4ad1ba6fd317077ace08ee8 | [
"MIT"
] | 2 | 2019-03-23T08:03:33.000Z | 2019-05-08T06:12:53.000Z | from abc import ABC, abstractmethod, abstractproperty
import numpy as np
import pandas as pd
import scipy
from bokeh.layouts import widgetbox, gridplot, column, row, layout
from bokeh.models import HoverTool, Band
from bokeh.models.widgets import DataTable, Div, TableColumn
from bokeh.models.annotations import Title
fr... | 50.440559 | 398 | 0.623943 | from abc import ABC, abstractmethod, abstractproperty
import numpy as np
import pandas as pd
import scipy
from bokeh.layouts import widgetbox, gridplot, column, row, layout
from bokeh.models import HoverTool, Band
from bokeh.models.widgets import DataTable, Div, TableColumn
from bokeh.models.annotations import Title
fr... | true | true |
f758b351d7ace4694a08331d47668db95f7c7ca6 | 1,115 | py | Python | dvc/utils/pager.py | jheister/dvc | 69db63dfba42ff0b32356df362d764daebb0e728 | [
"Apache-2.0"
] | 1 | 2021-06-18T19:36:13.000Z | 2021-06-18T19:36:13.000Z | dvc/utils/pager.py | jheister/dvc | 69db63dfba42ff0b32356df362d764daebb0e728 | [
"Apache-2.0"
] | 82 | 2021-05-04T02:40:05.000Z | 2022-03-31T03:14:04.000Z | dvc/utils/pager.py | andreyferriyan/dvc | daf07451f8e8f3e76a791c696b0ea175e8ed3ac1 | [
"Apache-2.0"
] | null | null | null | """Draws DAG in ASCII."""
import logging
import os
import pydoc
import sys
from rich.pager import Pager
from dvc.env import DVC_PAGER
from dvc.utils import format_link
logger = logging.getLogger(__name__)
DEFAULT_PAGER = "less"
DEFAULT_PAGER_FORMATTED = (
f"{DEFAULT_PAGER} --chop-long-lines --clear-screen --R... | 19.910714 | 75 | 0.661883 |
import logging
import os
import pydoc
import sys
from rich.pager import Pager
from dvc.env import DVC_PAGER
from dvc.utils import format_link
logger = logging.getLogger(__name__)
DEFAULT_PAGER = "less"
DEFAULT_PAGER_FORMATTED = (
f"{DEFAULT_PAGER} --chop-long-lines --clear-screen --RAW-CONTROL-CHARS"
)
def ... | true | true |
f758b372cfb93f2e61a296509832eb4c3873e01d | 2,166 | py | Python | airbyte-integrations/connectors/source-talkdesk-explore/source_talkdesk_explore/source.py | onaio/airbyte | 38302e82a25f1b66742c3febfbff0668556920f2 | [
"MIT"
] | 22 | 2020-08-27T00:47:20.000Z | 2020-09-17T15:39:39.000Z | airbyte-integrations/connectors/source-talkdesk-explore/source_talkdesk_explore/source.py | onaio/airbyte | 38302e82a25f1b66742c3febfbff0668556920f2 | [
"MIT"
] | 116 | 2020-08-27T01:11:27.000Z | 2020-09-19T02:47:52.000Z | airbyte-integrations/connectors/source-talkdesk-explore/source_talkdesk_explore/source.py | onaio/airbyte | 38302e82a25f1b66742c3febfbff0668556920f2 | [
"MIT"
] | 1 | 2020-09-15T06:10:01.000Z | 2020-09-15T06:10:01.000Z | #
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
from typing import Any, List, Mapping, Tuple
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
fro... | 42.470588 | 144 | 0.713296 |
from typing import Any, List, Mapping, Tuple
from airbyte_cdk.logger import AirbyteLogger
from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import TokenAuthenticator
from .streams import Calls, Contacts, RingAttempts, StudioFlo... | true | true |
f758b378ab95d346820eece26b219f9fe9e593fc | 833 | py | Python | Python/xml2csv.py | lonelycoder2004/hacktoberfest2020-3 | b481f995ea1a8c25aa4e467d43b334e118025a8b | [
"MIT"
] | 71 | 2020-10-06T05:53:59.000Z | 2021-11-27T03:14:42.000Z | Python/xml2csv.py | lonelycoder2004/hacktoberfest2020-3 | b481f995ea1a8c25aa4e467d43b334e118025a8b | [
"MIT"
] | 92 | 2020-10-05T19:18:14.000Z | 2021-10-09T04:35:16.000Z | Python/xml2csv.py | lonelycoder2004/hacktoberfest2020-3 | b481f995ea1a8c25aa4e467d43b334e118025a8b | [
"MIT"
] | 572 | 2020-10-05T20:11:28.000Z | 2021-10-10T16:28:29.000Z | import xml.etree.ElementTree as ET
from tkinter.filedialog import askopenfilename
import os
import csv
def readFile(filename):
if not os.path.exists(filename): return
tree = ET.parse(filename)
root = tree.getroot()
#############################################
dict_keys = []
dict_keys = [item for item in input... | 21.921053 | 72 | 0.629052 | import xml.etree.ElementTree as ET
from tkinter.filedialog import askopenfilename
import os
import csv
def readFile(filename):
if not os.path.exists(filename): return
tree = ET.parse(filename)
root = tree.getroot()
| true | true |
f758b397558fdca32b74c0ca9f55cdfd92828831 | 5,027 | py | Python | ServidorPython/python32_web/Lib/site-packages/jsonschema/_utils.py | mak213k/Servidor_automatizado_python | 4403ef8027a2f814220baacc95856cf5fbf01d21 | [
"MIT"
] | 4 | 2020-02-05T11:26:47.000Z | 2021-05-26T07:48:46.000Z | ServidorPython/python32_web/Lib/site-packages/jsonschema/_utils.py | mak213k/Servidor_automatizado_python | 4403ef8027a2f814220baacc95856cf5fbf01d21 | [
"MIT"
] | 9 | 2019-12-05T00:49:12.000Z | 2021-09-08T01:31:25.000Z | backend/env/lib/python3.7/site-packages/jsonschema/_utils.py | US579/Seddit | 116a676efd0fa31c8cc6fe4c723b739203d9428b | [
"MIT"
] | 2 | 2019-08-28T14:57:54.000Z | 2019-11-26T16:18:30.000Z | import itertools
import json
import pkgutil
import re
from jsonschema.compat import MutableMapping, str_types, urlsplit
class URIDict(MutableMapping):
"""
Dictionary which uses normalized URIs as keys.
"""
def normalize(self, uri):
return urlsplit(uri).geturl()
def __init__(self, *args... | 23.059633 | 78 | 0.60374 | import itertools
import json
import pkgutil
import re
from jsonschema.compat import MutableMapping, str_types, urlsplit
class URIDict(MutableMapping):
def normalize(self, uri):
return urlsplit(uri).geturl()
def __init__(self, *args, **kwargs):
self.store = dict()
self.store.update(*... | true | true |
f758b4059a9d9557fa4f5a4b1e0f09cc46f3a30f | 687 | py | Python | configs/swin_zzy/htc_swin_tiny_3x_coco.py | nbl97/det | a38f3959c9f2cced4f445ac89d2d3010e479b684 | [
"Apache-2.0"
] | 1 | 2021-06-18T03:11:27.000Z | 2021-06-18T03:11:27.000Z | configs/swin_zzy/htc_swin_tiny_3x_coco.py | nbl97/det | a38f3959c9f2cced4f445ac89d2d3010e479b684 | [
"Apache-2.0"
] | null | null | null | configs/swin_zzy/htc_swin_tiny_3x_coco.py | nbl97/det | a38f3959c9f2cced4f445ac89d2d3010e479b684 | [
"Apache-2.0"
] | 1 | 2021-06-18T20:10:46.000Z | 2021-06-18T20:10:46.000Z | _base_ = 'htc_swin_base.py'
model = dict(
pretrained='pretrained/swin_tiny_patch4_window7_224.pth',
roi_head=dict(
semantic_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=256,
... | 32.714286 | 78 | 0.598253 | _base_ = 'htc_swin_base.py'
model = dict(
pretrained='pretrained/swin_tiny_patch4_window7_224.pth',
roi_head=dict(
semantic_roi_extractor=dict(
type='SingleRoIExtractor',
roi_layer=dict(type='RoIAlign', output_size=14, sampling_ratio=0),
out_channels=256,
... | true | true |
f758b661028fa08686c5adcc06de614ddb56b14a | 1,284 | py | Python | capture_and_uploadImage.py | khushmax/automation | 14398b52a6e084fb6e7d41dd3ca87f7ca8d3e725 | [
"MIT"
] | null | null | null | capture_and_uploadImage.py | khushmax/automation | 14398b52a6e084fb6e7d41dd3ca87f7ca8d3e725 | [
"MIT"
] | null | null | null | capture_and_uploadImage.py | khushmax/automation | 14398b52a6e084fb6e7d41dd3ca87f7ca8d3e725 | [
"MIT"
] | null | null | null | import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
#initializing cv2
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
#read the frames while the camera is on
ret,frame = videoCapture... | 26.204082 | 85 | 0.665888 | import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
ret,frame = videoCaptureObject.read()
img_name = "img"+str(numb... | true | true |
f758b82c0204eefd0e58228c761386658eada47c | 3,765 | py | Python | faculty/clients/workspace.py | taraganepola/faculty | ea63edf107c6e15c5ded5e71e6ec8a58d7e9d24c | [
"Apache-2.0"
] | 1 | 2021-06-22T12:27:18.000Z | 2021-06-22T12:27:18.000Z | faculty/clients/workspace.py | taraganepola/faculty | ea63edf107c6e15c5ded5e71e6ec8a58d7e9d24c | [
"Apache-2.0"
] | null | null | null | faculty/clients/workspace.py | taraganepola/faculty | ea63edf107c6e15c5ded5e71e6ec8a58d7e9d24c | [
"Apache-2.0"
] | null | null | null | # Copyright 2018-2021 Faculty Science 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 law or agreed... | 31.115702 | 78 | 0.667198 |
from enum import Enum
from collections import namedtuple
from marshmallow import fields, post_load, validates_schema, ValidationError
from marshmallow_enum import EnumField
from faculty.clients.base import BaseSchema, BaseClient
File = namedtuple("File", ["path", "name", "last_modified", "size"])
Di... | true | true |
f758b9f0025ba2eefc3f72eb3cc0341494c2a925 | 7,416 | py | Python | tensorboard/util/test_util.py | qzchenwl/tensorboard | e59ca8d45746f459d797f4e69377eda4433e1624 | [
"Apache-2.0"
] | null | null | null | tensorboard/util/test_util.py | qzchenwl/tensorboard | e59ca8d45746f459d797f4e69377eda4433e1624 | [
"Apache-2.0"
] | null | null | null | tensorboard/util/test_util.py | qzchenwl/tensorboard | e59ca8d45746f459d797f4e69377eda4433e1624 | [
"Apache-2.0"
] | null | null | null | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 33.863014 | 79 | 0.675431 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import threading
import unittest
import tensorflow as tf
ow_python_tf2
from tensorboard.compat.proto import event_pb2
from tensorboard.compat.proto import graph_pb2
from tensorboard.compat.pro... | true | true |
f758ba6b62f9e9473f47fea0196ca008fff34aec | 6,811 | py | Python | gym/envs/dart/flatworm_swim_straight_reduced.py | DragonMyth/MyDartEnv | 5a5c40d0104e22e0493f823c41734776fb2e6790 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | gym/envs/dart/flatworm_swim_straight_reduced.py | DragonMyth/MyDartEnv | 5a5c40d0104e22e0493f823c41734776fb2e6790 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | gym/envs/dart/flatworm_swim_straight_reduced.py | DragonMyth/MyDartEnv | 5a5c40d0104e22e0493f823c41734776fb2e6790 | [
"Python-2.0",
"OLDAP-2.7"
] | null | null | null | import numpy as np
from gym import utils
from gym.envs.dart import dart_env
from .simple_water_world import BaseFluidSimulator
class DartFlatwormSwimStraightReducedEnv(dart_env.DartEnv, utils.EzPickle):
def __init__(self):
control_bounds = np.array([[1.0] * 12, [-1.0] * 12])
self.action_scale = np... | 43.660256 | 141 | 0.608868 | import numpy as np
from gym import utils
from gym.envs.dart import dart_env
from .simple_water_world import BaseFluidSimulator
class DartFlatwormSwimStraightReducedEnv(dart_env.DartEnv, utils.EzPickle):
def __init__(self):
control_bounds = np.array([[1.0] * 12, [-1.0] * 12])
self.action_scale = np... | true | true |
f758ba9d818aa3db7295ccf1be6b6120c83f8587 | 2,412 | py | Python | drivers/devices/kinect_azure/helper.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | 23 | 2021-04-02T09:02:04.000Z | 2022-03-22T05:31:03.000Z | drivers/devices/kinect_azure/helper.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | 35 | 2021-04-12T09:41:05.000Z | 2022-03-26T13:32:46.000Z | drivers/devices/kinect_azure/helper.py | takuya-ki/wrs | f6e1009b94332504042fbde9b39323410394ecde | [
"MIT"
] | 16 | 2021-03-30T11:55:45.000Z | 2022-03-30T07:10:59.000Z | import cv2
import numpy as np
from drivers.devices.kinect_azure.pykinectazure import PyKinectAzure, _k4a
mtx = np.array([[610.16101074, 0, 638.35681152], [0, 610.19384766, 367.82455444], [0, 0, 1]])
def get_images(pk_obj):
while True:
pk_obj.device_get_capture()
color_image_handle = pk_obj.captur... | 36.545455 | 97 | 0.678275 | import cv2
import numpy as np
from drivers.devices.kinect_azure.pykinectazure import PyKinectAzure, _k4a
mtx = np.array([[610.16101074, 0, 638.35681152], [0, 610.19384766, 367.82455444], [0, 0, 1]])
def get_images(pk_obj):
while True:
pk_obj.device_get_capture()
color_image_handle = pk_obj.captur... | true | true |
f758bbd75b6b853d023482dcad85fedece201425 | 3,126 | py | Python | torch_geometric/read/planetoid.py | cysmnl/geometric_cognition | 473c0cf585aaf49904bfb87c35ea706e12f67f8a | [
"MIT"
] | 62 | 2018-12-12T16:06:34.000Z | 2022-02-18T11:32:04.000Z | torch_geometric/read/planetoid.py | cysmnl/geometric_cognition | 473c0cf585aaf49904bfb87c35ea706e12f67f8a | [
"MIT"
] | 2 | 2019-12-26T12:51:47.000Z | 2020-09-02T10:39:55.000Z | torch_geometric/read/planetoid.py | cysmnl/geometric_cognition | 473c0cf585aaf49904bfb87c35ea706e12f67f8a | [
"MIT"
] | 19 | 2018-12-12T17:51:43.000Z | 2021-09-19T08:01:29.000Z | import sys
import os.path as osp
from itertools import repeat
import torch
from torch_sparse import coalesce
from torch_geometric.data import Data
from torch_geometric.read import read_txt_array
from torch_geometric.utils import remove_self_loops
try:
import cPickle as pickle
except ImportError:
import pickle... | 31.897959 | 78 | 0.659309 | import sys
import os.path as osp
from itertools import repeat
import torch
from torch_sparse import coalesce
from torch_geometric.data import Data
from torch_geometric.read import read_txt_array
from torch_geometric.utils import remove_self_loops
try:
import cPickle as pickle
except ImportError:
import pickle... | true | true |
f758bc7b48af6cfeca955b9a2b428070838d6162 | 1,219 | py | Python | lib2/Sticker.py | Dularazero/chappie-bot | dad5a5ad886fbcba289015282618fa902d358db6 | [
"MIT"
] | 37 | 2020-10-05T17:12:02.000Z | 2022-03-07T14:53:35.000Z | lib2/Sticker.py | INIDboyzz/Juliana | b768e7d4aa13eb1a97e8d8df7e331b99b8b082fb | [
"MIT"
] | 24 | 2020-10-08T15:56:18.000Z | 2022-03-15T00:16:25.000Z | lib2/Sticker.py | INIDboyzz/Juliana | b768e7d4aa13eb1a97e8d8df7e331b99b8b082fb | [
"MIT"
] | 44 | 2020-10-10T12:58:24.000Z | 2022-02-09T13:58:01.000Z | import requests
from lib2 import upload
from setting import server
import time
def stickerSave(user, name, url):
save=requests.get(f"{server}/uploadSticker", params={"pengguna":user[:-5], "nama":name, "konten":upload(url).get("id")}).json()
print(save)
if save.get("status") == False and save.get("tersimpan"... | 38.09375 | 131 | 0.632486 | import requests
from lib2 import upload
from setting import server
import time
def stickerSave(user, name, url):
save=requests.get(f"{server}/uploadSticker", params={"pengguna":user[:-5], "nama":name, "konten":upload(url).get("id")}).json()
print(save)
if save.get("status") == False and save.get("tersimpan"... | true | true |
f758bcf7ed0d9b65199c986db84e5c2c71c65be2 | 3,588 | py | Python | embedders/FSTH.py | lichnost/latent-pose-reenactment | ee2719355f1db3d0b927f9b10b0d42d1fd07d4c9 | [
"Apache-2.0"
] | 103 | 2020-10-28T10:35:39.000Z | 2022-03-21T12:58:27.000Z | embedders/FSTH.py | lichnost/latent-pose-reenactment | ee2719355f1db3d0b927f9b10b0d42d1fd07d4c9 | [
"Apache-2.0"
] | 37 | 2020-10-29T02:32:28.000Z | 2022-02-26T16:06:55.000Z | embedders/FSTH.py | lichnost/latent-pose-reenactment | ee2719355f1db3d0b927f9b10b0d42d1fd07d4c9 | [
"Apache-2.0"
] | 26 | 2020-11-05T12:42:01.000Z | 2022-02-11T08:59:52.000Z | import torch
from torch import nn
from torch.nn.utils import spectral_norm
from generators.common import blocks
class Wrapper:
@staticmethod
def get_args(parser):
parser.add('--embed_padding', type=str, default='zero', help='zero|reflection')
parser.add('--embed_num_blocks', type=int, default=6... | 35.524752 | 106 | 0.615106 | import torch
from torch import nn
from torch.nn.utils import spectral_norm
from generators.common import blocks
class Wrapper:
@staticmethod
def get_args(parser):
parser.add('--embed_padding', type=str, default='zero', help='zero|reflection')
parser.add('--embed_num_blocks', type=int, default=6... | true | true |
f758bdf15b5111f612a497537c1ae9394f7696f6 | 2,341 | py | Python | inbc-program/inbc/inbc.py | ahameedx/intel-inb-manageability | aca445fa4cef0b608e6e88e74476547e10c06073 | [
"Apache-2.0"
] | 5 | 2021-12-13T21:19:31.000Z | 2022-01-18T18:29:43.000Z | inbc-program/inbc/inbc.py | ahameedx/intel-inb-manageability | aca445fa4cef0b608e6e88e74476547e10c06073 | [
"Apache-2.0"
] | 45 | 2021-12-30T17:21:09.000Z | 2022-03-29T22:47:32.000Z | inbc-program/inbc/inbc.py | ahameedx/intel-inb-manageability | aca445fa4cef0b608e6e88e74476547e10c06073 | [
"Apache-2.0"
] | 4 | 2022-01-26T17:42:54.000Z | 2022-03-30T04:48:04.000Z | """Command-line INBC tool to invoke Software update on the device with manageability framework.
Copyright (C) 2020-2022 Intel Corporation
SPDX-License-Identifier: Apache-2.0
"""
import logging
import sys
import signal
import itertools
from typing import Any
from time import sleep
from inbc import shared
from inbc.bro... | 29.2625 | 95 | 0.673217 |
import logging
import sys
import signal
import itertools
from typing import Any
from time import sleep
from inbc import shared
from inbc.broker import Broker
from inbc.parser import ArgsParser
from inbc.inbc_exception import InbcException, InbcCode
from inbc.xlink_checker import XlinkChecker
from inbm_vision_lib.requ... | true | true |
f758bf18673d40754d773cb1a2d9ff6569047826 | 969 | py | Python | python/en/_matplotlib/gallery/text_labels_and_annotations/auto-wrapping_text.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | python/en/_matplotlib/gallery/text_labels_and_annotations/auto-wrapping_text.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | python/en/_matplotlib/gallery/text_labels_and_annotations/auto-wrapping_text.py | aimldl/coding | 70ddbfaa454ab92fd072ee8dc614ecc330b34a70 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
text_labels_and_annotations/auto-wrapping_text.py
Matplotlib > Gallery > Text, labels and annotations> Auto-wrapping text
https://matplotlib.org/3.1.1/gallery/text_labels_and_annotations/autowrap.html#sphx-glr-gallery-text-labels-and-annotations-autowrap-py
"""
import... | 38.76 | 135 | 0.686275 |
import matplotlib.pyplot as plt
fig = plt.figure()
plt.axis([0, 10, 0, 10])
t = ("This is a really long string that I'd rather have wrapped so that it "
"doesn't go outside of the figure, but if it's long enough it will go "
"off the top or bottom!")
plt.text(4, 1, t, ha='left', rotation=15, wrap=True)
pl... | true | true |
f758bf27be5fccf1d91dc4799c65e0c53021e044 | 9,506 | py | Python | sdk/python/pulumi_azure_native/insights/v20191017preview/outputs.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 31 | 2020-09-21T09:41:01.000Z | 2021-02-26T13:21:59.000Z | sdk/python/pulumi_azure_native/insights/v20191017preview/outputs.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 231 | 2020-09-21T09:38:45.000Z | 2021-03-01T11:16:03.000Z | sdk/python/pulumi_azure_native/insights/v20191017preview/outputs.py | pulumi-bot/pulumi-azure-native | f7b9490b5211544318e455e5cceafe47b628e12c | [
"Apache-2.0"
] | 4 | 2020-09-29T14:14:59.000Z | 2021-02-10T20:38:16.000Z | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from... | 33.121951 | 162 | 0.639175 |
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from ... import _utilities, _tables
from . import outputs
__all__ = [
'PrivateEndpointConnectionResponse',
'PrivateEndpointPropertyResponse',
'PrivateLinkServiceConnectionStatePropertyResponse... | true | true |
f758bf4834acb13fea46b8d7fd536f49da4b64aa | 2,742 | py | Python | model_build.py | geetakumri/Moview_Review_Sentiment_Analysis | 41f4c17d9115633b000f52268ac768cfe013e808 | [
"MIT"
] | null | null | null | model_build.py | geetakumri/Moview_Review_Sentiment_Analysis | 41f4c17d9115633b000f52268ac768cfe013e808 | [
"MIT"
] | null | null | null | model_build.py | geetakumri/Moview_Review_Sentiment_Analysis | 41f4c17d9115633b000f52268ac768cfe013e808 | [
"MIT"
] | null | null | null | from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer, CountVectorizer
from sklearn import svm
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import roc_auc_score
from sklearn.pipeline import Pipeline
fr... | 36.56 | 154 | 0.719912 | from sklearn.model_selection import train_test_split
import pandas as pd
from sklearn.feature_extraction.text import TfidfVectorizer, TfidfTransformer, CountVectorizer
from sklearn import svm
from sklearn.naive_bayes import MultinomialNB
from sklearn.metrics import roc_auc_score
from sklearn.pipeline import Pipeline
fr... | true | true |
f758c067f31011c0d79434874f7bf50c5bdd1308 | 12,485 | py | Python | test/vpp_ip_route.py | leecoool/fdio-vpp | 694396dc589b4fe75b1fad02fde1d3c3cdaeef04 | [
"Apache-2.0"
] | null | null | null | test/vpp_ip_route.py | leecoool/fdio-vpp | 694396dc589b4fe75b1fad02fde1d3c3cdaeef04 | [
"Apache-2.0"
] | null | null | null | test/vpp_ip_route.py | leecoool/fdio-vpp | 694396dc589b4fe75b1fad02fde1d3c3cdaeef04 | [
"Apache-2.0"
] | null | null | null | """
IP Routes
object abstractions for representing IP routes in VPP
"""
import socket
from vpp_object import *
# from vnet/vnet/mpls/mpls_types.h
MPLS_IETF_MAX_LABEL = 0xfffff
MPLS_LABEL_INVALID = MPLS_IETF_MAX_LABEL + 1
class VppRoutePath(object):
def __init__(
self,
nh_addr,
... | 35.979827 | 73 | 0.48322 |
import socket
from vpp_object import *
MPLS_IETF_MAX_LABEL = 0xfffff
MPLS_LABEL_INVALID = MPLS_IETF_MAX_LABEL + 1
class VppRoutePath(object):
def __init__(
self,
nh_addr,
nh_sw_if_index,
nh_table_id=0,
labels=[],
nh_via_label=MPLS_LABEL_I... | true | true |
f758c1810cbfcd504a8a920a485a6e9e69db12e3 | 3,635 | py | Python | setup.py | faio/ibptws | dc9e6d66cb67005986abf2003aebfa66e2cec1ba | [
"Apache-2.0"
] | 10 | 2015-09-16T16:54:52.000Z | 2017-10-12T17:59:14.000Z | setup.py | faio/ibptws | dc9e6d66cb67005986abf2003aebfa66e2cec1ba | [
"Apache-2.0"
] | null | null | null | setup.py | faio/ibptws | dc9e6d66cb67005986abf2003aebfa66e2cec1ba | [
"Apache-2.0"
] | 10 | 2015-09-16T10:50:19.000Z | 2020-05-06T11:32:55.000Z | # -*- coding: utf-8 -*-
#
# setup.py
#
# Copyright 2015 Base4 Sistemas Ltda ME
#
# 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 re... | 31.336207 | 79 | 0.594773 |
import codecs
import io
import os
import re
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', os.linesep)
buf = []
for filename in filena... | true | true |
f758c34b3e3a98219b8c7bf010d21cbc6d4f300e | 5,779 | py | Python | diadem/align.py | wfondrie/diadem | cf42449ccd305b7fd040f9b03129256f60f13949 | [
"Apache-2.0"
] | 2 | 2019-11-21T12:34:31.000Z | 2021-02-22T05:10:22.000Z | diadem/align.py | wfondrie/diadem | cf42449ccd305b7fd040f9b03129256f60f13949 | [
"Apache-2.0"
] | null | null | null | diadem/align.py | wfondrie/diadem | cf42449ccd305b7fd040f9b03129256f60f13949 | [
"Apache-2.0"
] | null | null | null | """
This module contains the my implementation of the FastDTW algorithm.
The algorithm is described in http://cs.fit.edu/~pkc/papers/tdm04.pdf.
This implementation is losely based on the python package from this
GitHub repository: https://github.com/slaypni/fastdtw.
My code deviates from this repository is a few ways... | 34.60479 | 82 | 0.596124 | from typing import Tuple, Callable
import numpy as np
import numba as nb
@nb.njit
def cosine_distance(x, y, tiny=np.finfo(float).tiny):
denom = (np.linalg.norm(x) * np.linalg.norm(y) + tiny)
return 1 - np.dot(x, y) / denom
def fastdtw(x: np.ndarray, y: np.ndarray, radius: int = 1,
dist: Callab... | true | true |
f758c4028a7bb399086c6f515e16fdd210117147 | 14,922 | py | Python | ucscsdk/mometa/testing/TestingServiceProfileFsm.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 9 | 2016-12-22T08:39:25.000Z | 2019-09-10T15:36:19.000Z | ucscsdk/mometa/testing/TestingServiceProfileFsm.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 10 | 2017-01-31T06:59:56.000Z | 2021-11-09T09:14:37.000Z | ucscsdk/mometa/testing/TestingServiceProfileFsm.py | parag-may4/ucscsdk | 2ea762fa070330e3a4e2c21b46b157469555405b | [
"Apache-2.0"
] | 13 | 2016-11-14T07:42:58.000Z | 2022-02-10T17:32:05.000Z | """This module contains the general information for TestingServiceProfileFsm ManagedObject."""
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class TestingServiceProfileFsmConsts():
COMPLETION_TIME_ = ""
CURRENT_FSM_RESO... | 86.254335 | 2,721 | 0.752781 |
from ...ucscmo import ManagedObject
from ...ucsccoremeta import UcscVersion, MoPropertyMeta, MoMeta
from ...ucscmeta import VersionMeta
class TestingServiceProfileFsmConsts():
COMPLETION_TIME_ = ""
CURRENT_FSM_RESOLVE_MANY_POLICY_FSM = "ResolveManyPolicyFsm"
CURRENT_FSM_RESOLVE_POLICY_FSM = "ResolvePolic... | true | true |
f758c75f2b093046d2c0a61bf49806d0c6d30f3a | 6,168 | py | Python | AutomatedTesting/Gem/PythonTests/physics/C5296614_PhysXMaterial_ColliderShape.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-09-13T00:01:12.000Z | 2021-09-13T00:01:12.000Z | AutomatedTesting/Gem/PythonTests/physics/C5296614_PhysXMaterial_ColliderShape.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | null | null | null | AutomatedTesting/Gem/PythonTests/physics/C5296614_PhysXMaterial_ColliderShape.py | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T11:07:25.000Z | 2021-07-20T11:07:25.000Z | """
Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
# Test case ID : C5296614
# Test Case Title : Check that unless you assign a shape to a physX collider compone... | 38.792453 | 155 | 0.683366 |
class Tests:
enter_game_mode = ("Entered game mode", "Failed to enter game mode")
exit_game_mode = ("Exited game mode", "Couldn't exit game mode")
collider_1_found = ("collider_1 was found", "collider_1 was not found")
collider_2_found = ("coll... | true | true |
f758c77b931a16b4128f02a73f99a72e3a282871 | 9,340 | py | Python | plot_lib/snow_plot.py | tclarkin/shread_dash | a45e2f2946c74526e69c087587676aaa4cb15fba | [
"CC0-1.0"
] | null | null | null | plot_lib/snow_plot.py | tclarkin/shread_dash | a45e2f2946c74526e69c087587676aaa4cb15fba | [
"CC0-1.0"
] | null | null | null | plot_lib/snow_plot.py | tclarkin/shread_dash | a45e2f2946c74526e69c087587676aaa4cb15fba | [
"CC0-1.0"
] | null | null | null | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 27, 2022
SHREAD Dash Snow Plot
Script for running the snow plot in the dashboard (shread_dash.py)
@author: buriona, tclarkin (2020-2022)
"""
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from plot_lib.utils import import_snotel,import_csas_l... | 31.661017 | 118 | 0.54015 |
import pandas as pd
import numpy as np
import plotly.graph_objects as go
from plot_lib.utils import import_snotel,import_csas_live
from database import snotel_sites
from database import csas_gages
from plot_lib.utils import screen_spatial,ba_stats_all,ba_stats_std,screen_csas,screen_snotel
from plot_lib.utils import... | true | true |
f758c7f6537fbb8fe57f7d960b91163b1684542f | 414 | py | Python | implore/contact.py | skeptycal/implore | 18035c13b94e9277658d07baaaa519b41513f1d5 | [
"MIT",
"Unlicense"
] | null | null | null | implore/contact.py | skeptycal/implore | 18035c13b94e9277658d07baaaa519b41513f1d5 | [
"MIT",
"Unlicense"
] | null | null | null | implore/contact.py | skeptycal/implore | 18035c13b94e9277658d07baaaa519b41513f1d5 | [
"MIT",
"Unlicense"
] | null | null | null | # -*- coding: utf-8 -*-
""" Part of the `AutoSys` package
copyright (c) 2019 Michael Treanor
https://www.github.com/skeptycal/autosys
https://www.twitter.com/skeptycal
`AutoSys` is licensed under the `MIT License
`<https://opensource.org/licenses/MIT>`
"""
__license__ = "MIT"
... | 25.875 | 58 | 0.625604 |
__license__ = "MIT"
class Contact_List(list):
pass
| true | true |
f758c8125d9872f5ac97f9d244c326b22d4a8bd0 | 4,356 | py | Python | nnfs/model.py | tblut/NNFS | 75320c546043bc74f368a7a6edcd8bb70aa90dc4 | [
"MIT"
] | null | null | null | nnfs/model.py | tblut/NNFS | 75320c546043bc74f368a7a6edcd8bb70aa90dc4 | [
"MIT"
] | null | null | null | nnfs/model.py | tblut/NNFS | 75320c546043bc74f368a7a6edcd8bb70aa90dc4 | [
"MIT"
] | null | null | null | import numpy as np
from nnfs.layers import Linear
from nnfs.optimizers import SGD
class Model:
def __init__(self, layers, loss, optimizer=SGD(lr=0.01)):
self.layers = layers
self.loss = loss
self.optimizer = optimizer
def save_weights(self, filename):
weights = []
for ... | 41.884615 | 104 | 0.533976 | import numpy as np
from nnfs.layers import Linear
from nnfs.optimizers import SGD
class Model:
def __init__(self, layers, loss, optimizer=SGD(lr=0.01)):
self.layers = layers
self.loss = loss
self.optimizer = optimizer
def save_weights(self, filename):
weights = []
for ... | true | true |
f758c812b2de52a52e992a1798de379a959b6b41 | 2,235 | py | Python | demoDay25_CNNAndWord2Vec/boston_multi.py | mozhumz/machine_learning_py | 880f6778ac16b0a16a80b31972a35304caa91dc1 | [
"MulanPSL-1.0"
] | null | null | null | demoDay25_CNNAndWord2Vec/boston_multi.py | mozhumz/machine_learning_py | 880f6778ac16b0a16a80b31972a35304caa91dc1 | [
"MulanPSL-1.0"
] | null | null | null | demoDay25_CNNAndWord2Vec/boston_multi.py | mozhumz/machine_learning_py | 880f6778ac16b0a16a80b31972a35304caa91dc1 | [
"MulanPSL-1.0"
] | null | null | null | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
#加载数据集
boston_housing = tf.keras.datasets.boston_housing
(train_x,train_y),(test_x,test_y) = boston_housing.load_data()
num_train=len(train_x) #训练集和测试机中样本的数量
num_test=len(test_x)
#对训练样本和测试样本进行标准化(归一化),这里有用到张量的广播运算机制
x_train=(train_x-train_x... | 26.294118 | 79 | 0.717673 | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
boston_housing = tf.keras.datasets.boston_housing
(train_x,train_y),(test_x,test_y) = boston_housing.load_data()
num_train=len(train_x)
num_test=len(test_x)
x_train=(train_x-train_x.min(axis=0))/(train_x.max(axis=0)-train_x.min(axis=0))
... | true | true |
f758c89b34e2136b01c75ec0ab234101ab7a6120 | 2,508 | py | Python | zenml/components/bulk_inferrer/utils.py | ramitsurana/zenml | 6994ea7ec0a38e9495306d55c3069107cdd5e65f | [
"Apache-2.0"
] | 1 | 2021-08-13T03:07:53.000Z | 2021-08-13T03:07:53.000Z | zenml/components/bulk_inferrer/utils.py | ramitsurana/zenml | 6994ea7ec0a38e9495306d55c3069107cdd5e65f | [
"Apache-2.0"
] | null | null | null | zenml/components/bulk_inferrer/utils.py | ramitsurana/zenml | 6994ea7ec0a38e9495306d55c3069107cdd5e65f | [
"Apache-2.0"
] | null | null | null | # Copyright (c) maiot GmbH 2021. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | 38 | 74 | 0.685805 |
from typing import Any, Text, Union, Dict
import tensorflow as tf
from tensorflow_serving.apis import prediction_log_pb2
from tfx.components.bulk_inferrer.prediction_to_example_utils import \
convert
from tfx.proto import bulk_inferrer_pb2
_OutputExampleSpecType = Union[bulk_inferrer_pb2.OutputExam... | true | true |
f758c9c3c59b2323ce863aa66f0ffa57f7ffe669 | 1,709 | py | Python | for_imagenet/make_df_imagenet.py | tak-sakumoto/formatomato | 4713338135b2ac3960cc2f9a6f017199853cdc52 | [
"MIT"
] | null | null | null | for_imagenet/make_df_imagenet.py | tak-sakumoto/formatomato | 4713338135b2ac3960cc2f9a6f017199853cdc52 | [
"MIT"
] | null | null | null | for_imagenet/make_df_imagenet.py | tak-sakumoto/formatomato | 4713338135b2ac3960cc2f9a6f017199853cdc52 | [
"MIT"
] | null | null | null | import pandas as pd
from PIL import Image
from pathlib import Path
def make_df_imagenet(dataset):
"""
Making Pandas Dataframes of the extracted data
"""
# Making lists of class columns
classes = list(Path(dataset).iterdir())
classes = [p.stem for p in classes if p.is_dir()]
class_ids = [i f... | 24.768116 | 69 | 0.613224 | import pandas as pd
from PIL import Image
from pathlib import Path
def make_df_imagenet(dataset):
classes = list(Path(dataset).iterdir())
classes = [p.stem for p in classes if p.is_dir()]
class_ids = [i for i in range(len(classes))]
class_df_dict = {
'CLASS_ID': class_ids,
'CLASS'... | true | true |
f758c9c6f47d64357d55da2214cc499caa8c0026 | 1,081 | py | Python | onlinecourse/urls.py | orchestrationAPI/final-cloud-app-with-database | 42e2fe38113c5d37b1c5edae0ddb6d0db5b1ea30 | [
"Apache-2.0"
] | null | null | null | onlinecourse/urls.py | orchestrationAPI/final-cloud-app-with-database | 42e2fe38113c5d37b1c5edae0ddb6d0db5b1ea30 | [
"Apache-2.0"
] | null | null | null | onlinecourse/urls.py | orchestrationAPI/final-cloud-app-with-database | 42e2fe38113c5d37b1c5edae0ddb6d0db5b1ea30 | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
app_name = 'onlinecourse'
urlpatterns = [
# route is a string contains a URL pattern
# view refers to the view function
# name the URL
path(route='', view=views.CourseListView.as... | 41.576923 | 121 | 0.708603 | from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
app_name = 'onlinecourse'
urlpatterns = [
path(route='', view=views.CourseListView.as_view(), name='index'),
path('registration/', views.registration_request, name='regist... | true | true |
f758cb9a6d192d01147b286a1651a541028a6fab | 4,502 | py | Python | benchmark/startQiskit_noisy3345.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_noisy3345.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_noisy3345.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=49
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import ... | 35.448819 | 140 | 0.656375 |
import cirq
import qiskit
from qiskit.providers.aer import QasmSimulator
from qiskit.test.mock import FakeVigo
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
im... | true | true |
f758cc81eabe60a36359e034a4e1cc90d2e7f6e1 | 2,517 | pyw | Python | 20210214/main.pyw | TianqiVirus/tivsEssay | 8b40d6a1ef1e292b1bab90ad0a3309cbf3441128 | [
"BSD-2-Clause"
] | null | null | null | 20210214/main.pyw | TianqiVirus/tivsEssay | 8b40d6a1ef1e292b1bab90ad0a3309cbf3441128 | [
"BSD-2-Clause"
] | null | null | null | 20210214/main.pyw | TianqiVirus/tivsEssay | 8b40d6a1ef1e292b1bab90ad0a3309cbf3441128 | [
"BSD-2-Clause"
] | null | null | null | # tianqiVirus's Essay
# by TianqiVirus
# https://github.com/TianqiVirus
# Released under a "Simplified BSD" license
width=600
height=600
title="tianqiVirusEssay"
icon="clown.ico"
fps=32
import pygame
from random import randint
screen = pygame.display.set_mode([width,height])
pygame.display.set_caption... | 24.436893 | 93 | 0.681764 |
# by TianqiVirus
# https://github.com/TianqiVirus
# Released under a "Simplified BSD" license
width=600
height=600
title="tianqiVirusEssay"
icon="clown.ico"
fps=32
import pygame
from random import randint
screen = pygame.display.set_mode([width,height])
pygame.display.set_caption(title)
pygame.displa... | true | true |
f758ccb8fecb22b8d8a0bb7353808f478905ae94 | 3,501 | py | Python | qiskit_machine_learning/algorithms/distribution_learners/qgan/discriminative_network.py | FrankFeenix/qiskit-machine-learning | ec800bc8a58b32f3052ff399d54f19a74417fc7d | [
"Apache-2.0"
] | null | null | null | qiskit_machine_learning/algorithms/distribution_learners/qgan/discriminative_network.py | FrankFeenix/qiskit-machine-learning | ec800bc8a58b32f3052ff399d54f19a74417fc7d | [
"Apache-2.0"
] | null | null | null | qiskit_machine_learning/algorithms/distribution_learners/qgan/discriminative_network.py | FrankFeenix/qiskit-machine-learning | ec800bc8a58b32f3052ff399d54f19a74417fc7d | [
"Apache-2.0"
] | 1 | 2021-06-15T16:41:39.000Z | 2021-06-15T16:41:39.000Z | # This code is part of Qiskit.
#
# (C) Copyright IBM 2019, 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 derivat... | 27.785714 | 87 | 0.624107 |
from typing import List, Iterable, Optional, Dict
from abc import ABC, abstractmethod
import numpy as np
from qiskit.utils import QuantumInstance
class DiscriminativeNetwork(ABC):
@abstractmethod
def __init__(self) -> None:
super().__init__()
self._num_parameters = 0
se... | true | true |
f758ccecb26bc6bdc1ca4f2959fcaa71cc65c5bc | 13,137 | py | Python | electrum_xazab/plugins/hw_wallet/qt.py | nunumichael/electrum-xazab | f128c765f451b418a418f9cd8b8e24fd8f66df74 | [
"MIT"
] | null | null | null | electrum_xazab/plugins/hw_wallet/qt.py | nunumichael/electrum-xazab | f128c765f451b418a418f9cd8b8e24fd8f66df74 | [
"MIT"
] | null | null | null | electrum_xazab/plugins/hw_wallet/qt.py | nunumichael/electrum-xazab | f128c765f451b418a418f9cd8b8e24fd8f66df74 | [
"MIT"
] | 2 | 2021-05-23T23:38:56.000Z | 2021-05-24T19:01:07.000Z | #!/usr/bin/env python3
# -*- mode: python -*-
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2016 The Electrum developers
#
# 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... | 41.971246 | 115 | 0.649463 |
import threading
from functools import partial
from typing import TYPE_CHECKING, Union, Optional, Callable, Any
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtWidgets import QVBoxLayout, QLineEdit, QHBoxLayout, QLabel
from electrum_xazab.gui.qt.password_dialog import PasswordLayou... | true | true |
f758cdf9ab64b6534c4f2a7376f27a69cf0356f9 | 3,463 | py | Python | setup.py | dprelipcean/reana-workflow-engine-yadage | adb65a9166603e9e08b870fd945932cc4def45db | [
"MIT"
] | null | null | null | setup.py | dprelipcean/reana-workflow-engine-yadage | adb65a9166603e9e08b870fd945932cc4def45db | [
"MIT"
] | null | null | null | setup.py | dprelipcean/reana-workflow-engine-yadage | adb65a9166603e9e08b870fd945932cc4def45db | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
#
# This file is part of REANA.
# Copyright (C) 2017, 2018, 2019 CERN.
#
# REANA is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""REANA-Workflow-Engine-Yadage."""
from __future__ import absolute_import, print... | 30.377193 | 79 | 0.630956 |
from __future__ import absolute_import, print_function
import os
import re
from setuptools import find_packages, setup
readme = open('README.rst').read()
history = open('CHANGES.rst').read()
tests_require = [
'pytest-reana>=0.6.0.dev20190705,<0.7.0',
]
extras_require = {
'docs': [
'Sphinx>... | true | true |
f758ced5a2bb541850827028d347ba02ae8f2e33 | 1,351 | py | Python | nicos_mlz/sans1/setups/pilz.py | ebadkamil/nicos | 0355a970d627aae170c93292f08f95759c97f3b5 | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | nicos_mlz/sans1/setups/pilz.py | ebadkamil/nicos | 0355a970d627aae170c93292f08f95759c97f3b5 | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 1 | 2021-08-18T10:55:42.000Z | 2021-08-18T10:55:42.000Z | nicos_mlz/sans1/setups/pilz.py | ISISComputingGroup/nicos | 94cb4d172815919481f8c6ee686f21ebb76f2068 | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | null | null | null | description = 'Inputs from the Pilz control box'
group = 'lowlevel'
tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1/modbus/'
# TODO: Mapping and description of the devices
devices = dict(
iatt1 = device('nicos.devices.tango.NamedDigitalInput',
description = 'Unknown',
tangodevice = tango_ba... | 31.418605 | 62 | 0.635085 | description = 'Inputs from the Pilz control box'
group = 'lowlevel'
tango_base = 'tango://sans1hw.sans1.frm2:10000/sans1/modbus/'
devices = dict(
iatt1 = device('nicos.devices.tango.NamedDigitalInput',
description = 'Unknown',
tangodevice = tango_base + 'iatt1',
),
iatt2 = device('nicos... | true | true |
f758cf368c74b6ec1b4ea19fa0cfc201e3ffd830 | 2,503 | py | Python | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_parts/tests/test_model_part.py | piyushka17/azure-intelligent-edge-patterns | 0d088899afb0022daa2ac434226824dba2c997c1 | [
"MIT"
] | null | null | null | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_parts/tests/test_model_part.py | piyushka17/azure-intelligent-edge-patterns | 0d088899afb0022daa2ac434226824dba2c997c1 | [
"MIT"
] | null | null | null | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_parts/tests/test_model_part.py | piyushka17/azure-intelligent-edge-patterns | 0d088899afb0022daa2ac434226824dba2c997c1 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Azure Part Models testcases.
"""
from django.core.exceptions import MultipleObjectsReturned
from vision_on_edge.general.tests.azure_testcase import CustomVisionTestCase
from vision_on_edge.general.tests.test_special_strings import special_strings
from ..models import Part
class AzurePart... | 33.824324 | 77 | 0.586896 |
from django.core.exceptions import MultipleObjectsReturned
from vision_on_edge.general.tests.azure_testcase import CustomVisionTestCase
from vision_on_edge.general.tests.test_special_strings import special_strings
from ..models import Part
class AzurePartTestCase(CustomVisionTestCase):
def setUp(self):
... | true | true |
f758cf3d75ba605c8419a62c914609cc61f63dad | 3,731 | py | Python | pybelsberg/namespace.py | babelsberg/pybelsberg | 531998655d9b7a4a3ac1ecdbf5c6ef6c356c8deb | [
"BSD-3-Clause"
] | 6 | 2015-12-07T14:41:28.000Z | 2021-09-15T13:45:59.000Z | pybelsberg/namespace.py | Pybelsberg/pybelsberg | 80c6ad8f56cfbe9c593280c51eae649ff7ef150e | [
"BSD-3-Clause"
] | null | null | null | pybelsberg/namespace.py | Pybelsberg/pybelsberg | 80c6ad8f56cfbe9c593280c51eae649ff7ef150e | [
"BSD-3-Clause"
] | 2 | 2016-05-21T05:50:54.000Z | 2019-11-13T08:31:42.000Z | import functools
import z3
class WrappingNamespace(dict):
"""A namespace that automatically wraps all objects that are looked up on
it with magic substitutes for the getattr/setattr protocols.
:type constraints: pybelsberg.constraint.Constraints
:var patches: A mapping of all instance attributes to th... | 37.31 | 77 | 0.569016 | import functools
import z3
class WrappingNamespace(dict):
def __init__(self, constraints, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
self.constraints = constraints
self.patches = {}
def __getitem__(self, key):
if key == '__tracebackhide__':
return Fals... | true | true |
f758cf6c37622d53fc782eb99c355f17d7963b42 | 128 | py | Python | Darlington/phase1/python Basic 1/day 14 solution/qtn8.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Darlington/phase1/python Basic 1/day 14 solution/qtn8.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Darlington/phase1/python Basic 1/day 14 solution/qtn8.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | #program to check whether lowercase letters exist in a string.
str1 = 'A8238i823acdeOUEI'
print(any(c.islower() for c in str1))
| 32 | 62 | 0.765625 |
str1 = 'A8238i823acdeOUEI'
print(any(c.islower() for c in str1))
| true | true |
f758cf76d05e2f9deab3c71b3575e3b9b67644bb | 6,888 | py | Python | tools/heap.py | Melab/gvmt | 566eac01724b687bc5e11317e44230faab15f895 | [
"MIT"
] | null | null | null | tools/heap.py | Melab/gvmt | 566eac01724b687bc5e11317e44230faab15f895 | [
"MIT"
] | null | null | null | tools/heap.py | Melab/gvmt | 566eac01724b687bc5e11317e44230faab15f895 | [
"MIT"
] | 1 | 2021-12-04T15:59:58.000Z | 2021-12-04T15:59:58.000Z |
import os, common, gtypes, sys_compiler, gvmtlink, heap
_ptr_size = gtypes.p.size
_ptr_mask = _ptr_size - 1
ADDR_TEMPLATE = '.long %s\n'
ALIGN_TEMPLATE = '.align %s\n'
LINE_SIZE = 1 << 7
BLOCK_SIZE = 1 << 14
SUPER_BLOCK_ALIGN = 1 << 19
LINE_MASK = LINE_SIZE - 1
BLOCK_MASK = BLOCK_SIZE - 1
BLOCKS_PER_SUPER_BLOCK =... | 30.887892 | 92 | 0.563444 |
import os, common, gtypes, sys_compiler, gvmtlink, heap
_ptr_size = gtypes.p.size
_ptr_mask = _ptr_size - 1
ADDR_TEMPLATE = '.long %s\n'
ALIGN_TEMPLATE = '.align %s\n'
LINE_SIZE = 1 << 7
BLOCK_SIZE = 1 << 14
SUPER_BLOCK_ALIGN = 1 << 19
LINE_MASK = LINE_SIZE - 1
BLOCK_MASK = BLOCK_SIZE - 1
BLOCKS_PER_SUPER_BLOCK =... | true | true |
f758d08963292997742c43fed979119c28723640 | 15,704 | py | Python | src/hiss/handler/gntp/message.py | sffjunkie/hiss | ef4eb33d840b948f2e83efe112014f06dd687952 | [
"Apache-2.0"
] | 1 | 2019-03-21T09:50:09.000Z | 2019-03-21T09:50:09.000Z | src/hiss/handler/gntp/message.py | sffjunkie/hiss | ef4eb33d840b948f2e83efe112014f06dd687952 | [
"Apache-2.0"
] | null | null | null | src/hiss/handler/gntp/message.py | sffjunkie/hiss | ef4eb33d840b948f2e83efe112014f06dd687952 | [
"Apache-2.0"
] | null | null | null | import logging
import re
from binascii import unhexlify
from datetime import datetime
from os import urandom
from urllib.parse import urlparse
from hiss.encryption import PY_CRYPTO, encrypt, decrypt
from hiss.exception import MarshalError
from hiss.handler.gntp import GNTP_BASE_VERSION, ENCRYPTION_ALGORITHM
from hiss.... | 36.267898 | 223 | 0.546931 | import logging
import re
from binascii import unhexlify
from datetime import datetime
from os import urandom
from urllib.parse import urlparse
from hiss.encryption import PY_CRYPTO, encrypt, decrypt
from hiss.exception import MarshalError
from hiss.handler.gntp import GNTP_BASE_VERSION, ENCRYPTION_ALGORITHM
from hiss.... | true | true |
f758d16798393dfb15decddc237313befa8e9065 | 410 | py | Python | utility.py | cyber-meow/Robotic_state_repr_learning | d74fe372bea0b1cf42107450a8c3344a99279e91 | [
"MIT"
] | null | null | null | utility.py | cyber-meow/Robotic_state_repr_learning | d74fe372bea0b1cf42107450a8c3344a99279e91 | [
"MIT"
] | null | null | null | utility.py | cyber-meow/Robotic_state_repr_learning | d74fe372bea0b1cf42107450a8c3344a99279e91 | [
"MIT"
] | null | null | null |
"""
Utility functions
"""
import numpy as np
def set_all_args(obj, argdict):
for k in argdict.keys():
if hasattr(obj, k):
setattr(obj, k, argdict[k])
else:
print("Warning: parameter name {} not found!".format(k))
def div0(a,b):
with np.errstate(divide='ignore', inval... | 18.636364 | 68 | 0.570732 |
import numpy as np
def set_all_args(obj, argdict):
for k in argdict.keys():
if hasattr(obj, k):
setattr(obj, k, argdict[k])
else:
print("Warning: parameter name {} not found!".format(k))
def div0(a,b):
with np.errstate(divide='ignore', invalid='ignore'):
c = ... | true | true |
f758d1b0e0c3fd0f5a4dd3a259335c9dbc50c4f3 | 10,553 | py | Python | mgan.py | yashbonde/GAN-textures | 7e9bfa61c474f17812bad2430e63a2383ac85067 | [
"MIT"
] | 1 | 2020-09-06T13:24:22.000Z | 2020-09-06T13:24:22.000Z | mgan.py | yashbonde/GAN-textures | 7e9bfa61c474f17812bad2430e63a2383ac85067 | [
"MIT"
] | null | null | null | mgan.py | yashbonde/GAN-textures | 7e9bfa61c474f17812bad2430e63a2383ac85067 | [
"MIT"
] | null | null | null |
import os
import time
import random
import argparse
import numpy as np
from tqdm import trange
from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from ... | 38.097473 | 118 | 0.614517 |
import os
import time
import random
import argparse
import numpy as np
from tqdm import trange
from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from ... | true | true |
f758d208ddb3c925001fab0f7db87f8a82249f64 | 2,290 | py | Python | remedy/remedy.py | 4n6ir/remedy-scan-ecr-repositories | 8979edd7936ccaaa60e8f98b791f84a64e8be4f8 | [
"Apache-2.0"
] | 4 | 2021-12-21T03:02:30.000Z | 2021-12-29T20:44:00.000Z | remedy/remedy.py | 4n6ir/remedy-scan-ecr-repositories | 8979edd7936ccaaa60e8f98b791f84a64e8be4f8 | [
"Apache-2.0"
] | null | null | null | remedy/remedy.py | 4n6ir/remedy-scan-ecr-repositories | 8979edd7936ccaaa60e8f98b791f84a64e8be4f8 | [
"Apache-2.0"
] | null | null | null | import boto3
import json
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
repo_count = 0
img_count = 0
ec2 = boto3.client('ec2')
regions = ec2.describe_regions()
### Region Loop ###
for region in regions['Regio... | 30.945946 | 83 | 0.465066 | import boto3
import json
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def handler(event, context):
repo_count = 0
img_count = 0
ec2 = boto3.client('ec2')
regions = ec2.describe_regions()
]:
ecr = boto3.client('ecr', region_name... | true | true |
f758d223ba907a1ef4e96c98282edbdf25dfde75 | 3,209 | py | Python | jiant/jiant/tasks/lib/counterfactual_nli.py | wh629/CNLI-generalization | 5c6d4df5f6a7e58d23c6db1a9dbc50eb9bcfda2b | [
"MIT"
] | 1 | 2021-10-15T23:18:43.000Z | 2021-10-15T23:18:43.000Z | jiant/jiant/tasks/lib/counterfactual_nli.py | wh629/CNLI-generalization | 5c6d4df5f6a7e58d23c6db1a9dbc50eb9bcfda2b | [
"MIT"
] | null | null | null | jiant/jiant/tasks/lib/counterfactual_nli.py | wh629/CNLI-generalization | 5c6d4df5f6a7e58d23c6db1a9dbc50eb9bcfda2b | [
"MIT"
] | null | null | null | import numpy as np
import torch
from dataclasses import dataclass
from typing import List
from jiant.tasks.core import (
BaseExample,
BaseTokenizedExample,
BaseDataRow,
BatchMixin,
Task,
TaskTypes,
)
from jiant.tasks.lib.templates.shared import double_sentence_featurize, labels_to_bimap
from ji... | 27.663793 | 107 | 0.627298 | import numpy as np
import torch
from dataclasses import dataclass
from typing import List
from jiant.tasks.core import (
BaseExample,
BaseTokenizedExample,
BaseDataRow,
BatchMixin,
Task,
TaskTypes,
)
from jiant.tasks.lib.templates.shared import double_sentence_featurize, labels_to_bimap
from ji... | true | true |
f758d28efb67b79b1785a7d9285b906567f8a88f | 5,862 | py | Python | robust_loss/fit_partition_spline.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 23,901 | 2018-10-04T19:48:53.000Z | 2022-03-31T21:27:42.000Z | robust_loss/fit_partition_spline.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 891 | 2018-11-10T06:16:13.000Z | 2022-03-31T10:42:34.000Z | robust_loss/fit_partition_spline.py | deepneuralmachine/google-research | d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231 | [
"Apache-2.0"
] | 6,047 | 2018-10-12T06:31:02.000Z | 2022-03-31T13:59:28.000Z | # coding=utf-8
# Copyright 2021 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... | 38.064935 | 80 | 0.696691 |
from absl import app
import numpy as np
import tensorflow.compat.v2 as tf
from robust_loss import cubic_spline
from robust_loss import distribution
from robust_loss import general
tf.enable_v2_behavior()
def numerical_base_partition_function(alpha):
num_samples = 2**24 + 1
x_max = 10**10... | true | true |
f758d30990ab886f226cded852f7b56aaecc19b7 | 4,900 | py | Python | temboardui/model/orm.py | missmoiselle/temboard | ff9f0da27a8cf815f3ff41ee29c63554c48519ae | [
"PostgreSQL"
] | 294 | 2016-09-21T09:35:42.000Z | 2022-03-31T15:03:47.000Z | temboardui/model/orm.py | missmoiselle/temboard | ff9f0da27a8cf815f3ff41ee29c63554c48519ae | [
"PostgreSQL"
] | 667 | 2016-10-06T16:27:48.000Z | 2022-03-24T08:56:22.000Z | temboardui/model/orm.py | missmoiselle/temboard | ff9f0da27a8cf815f3ff41ee29c63554c48519ae | [
"PostgreSQL"
] | 46 | 2016-09-22T15:22:29.000Z | 2022-03-04T10:36:16.000Z | import datetime
from sqlalchemy import (
Boolean,
DateTime,
Integer,
String,
event,
)
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import (
case,
column,
extract,
func,
)
from temboardui.model import tables
Mode... | 23.671498 | 77 | 0.626735 | import datetime
from sqlalchemy import (
Boolean,
DateTime,
Integer,
String,
event,
)
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import (
case,
column,
extract,
func,
)
from temboardui.model import tables
Mode... | true | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.