id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3276391 | <reponame>yull1860outlook/Data-Analysis<filename>sentdex_data_analysis/pandas_joiningData.py
import pickle
import pandas as pd
import quandl
import matplotlib.pyplot as plt
from matplotlib import style
style.use("seaborn")
quandl.ApiConfig.api_key = "rFsSehe51RLzREtYhLfo"
def mortgage_30yr():
df = quandl.get("F... | StarcoderdataPython |
179128 | <gh_stars>0
#!_PYTHONLOC
#
# (C) COPYRIGHT 2004-2021 Ahasuerus and <NAME>
# ALL RIGHTS RESERVED
#
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
# Version: $Revision$
# Date: $Date$
import cgi
import sys
import MySQLdb
import st... | StarcoderdataPython |
1673338 | import logging
import requests
from msal import ConfidentialClientApplication
from core import config
from models.domain.workspace import Workspace, WorkspaceRole
from resources import strings
from services.access_service import AccessService, AuthConfigValidationError
from services.authentication import User
class... | StarcoderdataPython |
3256116 | <reponame>nhtri2003gmail/ctf-write-ups
#!/usr/bin/env python3
from pwn import *
binary = context.binary = ELF('./chall_13')
context.log_level = 'INFO'
if not args.REMOTE:
context.log_file = 'local.log'
libc = binary.libc
p = process(binary.path)
else:
context.log_file = 'remote.log'
libc_index = 1
p = remote('... | StarcoderdataPython |
3319973 | from styx_msgs.msg import TrafficLight
import rospy
import tensorflow as tf
import numpy as np
import os
import cv2
class TLClassifier(object):
def __init__(self, model_name):
# Variables
PATH_TO_CKPT = os.path.join(model_name, 'frozen_inference_graph.pb')
self.tl_colors = ['Red', 'Yello... | StarcoderdataPython |
3364617 | <gh_stars>0
from m5.SimObject import SimObject
from m5.params import *
from m5.proxy import *
class BaseEnergySM(SimObject):
type = 'BaseEnergySM'
cxx_header = "engy/state_machine.hh" | StarcoderdataPython |
4835229 | class SubrectangleQueries(object):
# Runtime: 192 ms
# Memory: 15 MB
def __init__(self, rectangle):
"""
:type rectangle: List[List[int]]
"""
self.rectangle = rectangle
def updateSubrectangle(self, row1, col1, row2, col2, newValue):
"""
:type row1: int
... | StarcoderdataPython |
4841030 | """
The SRP definition for CPHD 0.3.
"""
from typing import Union
import numpy
from sarpy.compliance import integer_types
from sarpy.io.phase_history.cphd1_elements.base import DEFAULT_STRICT
# noinspection PyProtectedMember
from sarpy.io.complex.sicd_elements.base import Serializable, _SerializableDescriptor, \
... | StarcoderdataPython |
1741834 | <filename>leo/plugins/obsolete/gtkGui.py
#@+leo-ver=4-thin
#@+node:ekr.20080112150934:@thin gtkGui.py
'''The plugin part of the gtk gui code.'''
import leoGlobals as g
import leoGtkGui
try:
import gtk
except ImportError:
gtk = None
g.es_print('can not import gtk')
#@+others
#@+node:ekr.20080112150934.1:i... | StarcoderdataPython |
108461 | <reponame>hiikezoe/web-platform-tests
# META: timeout=long
from tests.support.inline import inline
from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
from tests.support.fixtures import create_dialog
alert_doc = inline("<script>window.alert()</script>")
def read_global(session, na... | StarcoderdataPython |
4834253 | import numpy as np
import cv2
import logging
logger = logging.getLogger(__name__)
from ipapi.base.ipt_abstract import IptBase
import ipapi.base.ip_common as ipc
class IptSplittedRangeThreshold(IptBase):
def build_params(self):
self.add_enabled_checkbox()
self.add_channel_selector(... | StarcoderdataPython |
86119 | <gh_stars>100-1000
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | StarcoderdataPython |
176459 | <filename>src/AX.py<gh_stars>10-100
#! -*- coding:utf-8 -*-
# SuperGLUE评测
# AX-b and AX-g
# 思路:基于训练好的RTE模型进行预测
import json
import numpy as np
from six import b
from snippets import *
from bert4keras.snippets import sequence_padding, DataGenerator
from bert4keras.snippets import open
from tqdm import tqdm
# 基本参数
labe... | StarcoderdataPython |
168893 | from django.conf import settings
from django.http import JsonResponse, HttpResponseNotFound, HttpResponseRedirect
from django.views.decorators.http import require_GET, require_POST
from urlshortening.models import Url, get_short_url, invalidate_url
@require_POST
def get_short_link(request):
full_url = request.PO... | StarcoderdataPython |
1778842 | import pylewm.commands
import pylewm.window
import pylewm.monitors
import pythoncom
import win32gui, win32com.client
import win32api
import traceback
import ctypes
from pylewm.commands import PyleCommand
FocusQueue = pylewm.commands.CommandQueue()
FocusSpace = None
FocusWindow = None
LastFocusWindow = None
WindowFoc... | StarcoderdataPython |
3394319 | <gh_stars>1-10
import tdl
from utils import Colors
import logging
import textwrap
from models.EnumStatus import EGameState
from models.GenericObjects import Vector2
from managers import Messenger
logger = logging.getLogger('Rogue-EVE')
class GameState(object):
def __init__(self, state: EGameState):
self.... | StarcoderdataPython |
1789352 | import os
import shutil
import subprocess
DEST="/home/ubuntu/cleverhans/examples/nips17_adversarial_competition"
META_DIR = "/home/ubuntu/adversarial_attack/metafiles"
CONFIG_DIR = "config.csv"
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'... | StarcoderdataPython |
3321311 | from model.group import Group
def test_modify_first_group_name(app):
if app.group.count() == 0:
app.group.create(Group(name="test"))
app.group.modify_first_group(Group(name="New group"))
def test_modify_first_group_header(app):
if app.group.count() == 0:
app.group.create(Group(name="test")... | StarcoderdataPython |
1743585 | <filename>mfa/U2F.py
from u2flib_server.u2f import (begin_registration, begin_authentication,
complete_registration, complete_authentication)
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.serialization import En... | StarcoderdataPython |
25659 | <gh_stars>1-10
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
text = ax.text(0.5, 0.5, 'event', ha='center', va='center', fontdict={'size': 20})
def call_back(event):
# print( event.xdata, event.ydata)
info = 'name:{}\n button:{}\n x,y:{},{}\n xdata,ydata:{}{}'.format(event.name, event.button, even... | StarcoderdataPython |
3293480 | <reponame>LZC6244/scrapy_ddiy<gh_stars>1-10
# -*- coding: utf-8 -*-
import os
import requests
from time import sleep
from scrapy import signals
from twisted.internet import defer
from twisted.internet.error import (
ConnectError,
ConnectionDone,
ConnectionLost,
ConnectionRefusedError,
DNSLookupError... | StarcoderdataPython |
183380 | <filename>SSolver.py
board = [[7,8,0,4,0,0,1,2,0],
[6,0,0,0,7,5,0,0,9],
[0,0,0,6,0,1,0,7,8],
[0,0,7,0,4,0,2,6,0],
[0,0,1,0,5,0,9,3,0],
[9,0,4,0,6,0,0,0,5],
[0,7,0,3,0,0,0,1,2],
[1,2,0,0,0,7,4,0,0],
[0,4,9,2,0,6,0,0,7]]
def solve():
... | StarcoderdataPython |
3343470 | <gh_stars>0
# -*- coding: utf-8 -*-
# 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/LICENS... | StarcoderdataPython |
3306891 | from flask import Flask, request
# from flask import Flask, request, url_for
import codecs, unicodedata, urllib
# import math, time, re, os, os.path, random
app = Flask(__name__)
app.secret_key = 's9z9g8bs8b0jis secret key <KEY>'
# try to get the value both from the args and the form
def getform(key, defaul... | StarcoderdataPython |
1771605 | import cv2
from basecam import BaseCam
from util import apply_doc, get_cascade_file_path, is_escape, wait_frames
class HaarCam(BaseCam):
"""
Webcam that performs Haar Cascade object detection on the video stream.
"""
@apply_doc(BaseCam.__init__)
def __init__(self, window):
super(HaarCam,... | StarcoderdataPython |
1715579 | # Lint as: python2, python3
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | StarcoderdataPython |
4814633 | <reponame>AdamSwenson/TwitterProject
"""
This contains various simple datastructures which the various tools use.
It does not contain ORM classes.
Created by adam on 11/6/16
"""
__author__ = 'adam'
from collections import namedtuple
Result = namedtuple('Result', ['sentence_index', 'word_index', 'text', 'id', 'type']... | StarcoderdataPython |
1786976 | <reponame>M4gicT0/Distribute<filename>slave/client_node.py<gh_stars>0
import sys
import json
import netifaces as ni
from node import Node
from lead import LeadNode
from rpc_server import Server
import time
from uuid import getnode as get_mac
class ClientNode:
def __init__(self, config, debug=False):
sel... | StarcoderdataPython |
144566 | <gh_stars>1-10
from datetime import datetime, timedelta
def get_next_monday(now=datetime.now()):
for _ in range(8):
if now.weekday() == 0:
return now.date()
else:
now = now + timedelta(days=1)
def get_actual_monday(now=datetime.now()):
for _ in range(8):
if no... | StarcoderdataPython |
1766518 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiMerchantKbcloudSubuserloginstatusQueryModel(object):
def __init__(self):
self._session_id = None
self._sub_user_id = None
@property
def session_id(self):
re... | StarcoderdataPython |
3262393 | <filename>output/models/nist_data/list_pkg/decimal/schema_instance/nistschema_sv_iv_list_decimal_min_length_1_xsd/__init__.py<gh_stars>1-10
from output.models.nist_data.list_pkg.decimal.schema_instance.nistschema_sv_iv_list_decimal_min_length_1_xsd.nistschema_sv_iv_list_decimal_min_length_1 import NistschemaSvIvListDec... | StarcoderdataPython |
3221614 | <gh_stars>1-10
from __future__ import print_function
import collections
import logging
import os
from datetime import datetime, timedelta
from glob import glob
from airflow import models
from airflow.operators.bash_operator import BashOperator
from airflow.operators.email_operator import EmailOperator
from airflow.op... | StarcoderdataPython |
1754074 |
import numpy as np
from pylbm.stencil import Velocity
import pytest
import random
def test_velocity_argument():
with pytest.raises(Exception):
Velocity()
@pytest.mark.parametrize('dim, axis',
[(1, [None, 0]),
(2, [None, 0, 1]),
... | StarcoderdataPython |
3398993 | /usr/local/lib/python2.7/posixpath.py | StarcoderdataPython |
3219561 | <gh_stars>1-10
from __future__ import unicode_literals
import frappe
def get_context(context):
# do your magic here
context.title = "Agent Application"
# context.show_sidebar = 1
# context.add_breadcrumbs = 1
| StarcoderdataPython |
3382313 | <reponame>rojinva/music-recommendations_Hybrid
from datetime import datetime
import pandas
from app.DataReader import DataReader, DataSource
class SongFeatureSimilarity:
data_reader = DataReader()
SONG_DATA = {}
CACHED_SIMILARITIES = {}
def __init__(self):
entries = self.data_reader.read_file(DataSourc... | StarcoderdataPython |
3216055 | <reponame>powerboat9-school/UDT
MIN_SIG = 17000
MAX_SIG = 19000
BIN_SIZE = math.floor((MAX_SIG - MIN_SIG) / 32)
def getSignal(num):
if num == None || !isinstance(num, int) || int < 0 || int > 31:
raise Exception("Invalid signal")
return MIN_SIG + BIN_SIZE * num
def translate():
def snd(msg):
if... | StarcoderdataPython |
1610569 | <reponame>nanofrog/asyncflow<gh_stars>10-100
import sys
sys.path.append("../flowchart/generate")
import asyncflow
import Flowchart_AI
import Flowchart_Subchart
import time
import asyncflow
from io import StringIO
import pytest
class EventId():
Event0Arg = 3
Event1Arg = 4
Event2Arg = 5
class Character:
... | StarcoderdataPython |
154401 | <gh_stars>1-10
from typing import List
import numpy as np
from rdkit import Chem
from scoring.component_parameters import ComponentParameters
from scoring.score_components.base_score_component import BaseScoreComponent
from scoring.score_summary import ComponentSummary
class MatchingSubstructure(BaseScoreComponent)... | StarcoderdataPython |
175466 | <filename>examples/election.py
import logging
import random
from tornado import gen
log = logging.getLogger()
def arguments(parser):
parser.add_argument(
"--workers", "-w", type=int, default=5,
help="Number of workers to launch."
)
parser.add_argument(
"--znode-path", "-p", type... | StarcoderdataPython |
3253071 | <reponame>sumit-158/fermulerpy<gh_stars>1-10
import math
import warnings
def get_divisors(n):
"""
Finds all divisors of a number
Parameters
----------
n : int
denotes the natural number of which divisors needs to be calculated
return : array
returns an array ... | StarcoderdataPython |
98118 | import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
class GradCAM():
def __init__(self, model, target_layer, use_cuda):
self.model = model.eval()
self.target_layer = target_layer
self.use_cuda = use_cuda
self.feature_map = 0
... | StarcoderdataPython |
1773829 | from app import app as application
# chamado manualmente com: $ flask run
if __name__ == "__main__":
import os
application.run(host='0.0.0.0', port=os.getenv('SERVER_PORT'))
| StarcoderdataPython |
1614743 | <gh_stars>1-10
import base64
import requests
import os
import time
import json
import os.path as osp
from bs4 import BeautifulSoup
from utils.logger import *
tmp_dir = osp.join(osp.dirname(__file__), '..', 'tmp')
tmp_img_path = osp.join(tmp_dir, 'tmp.jpg')
logger = Logger.get_logger()
baidu_api_keys = json.load(open... | StarcoderdataPython |
4825135 | <filename>Extras/011 - The Time in Words/TimeInWords.py<gh_stars>1-10
def timeInWords(h, m):
stringHours = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve']
stringMinutes = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', '... | StarcoderdataPython |
82830 | <filename>app/toyApp/apps.py
from django.apps import AppConfig
class ToyappConfig(AppConfig):
name = 'toyApp'
| StarcoderdataPython |
12956 | <filename>lldb/examples/summaries/cocoa/NSException.py
"""
LLDB AppKit formatters
part of The LLVM Compiler Infrastructure
This file is distributed under the University of Illinois Open Source
License. See LICENSE.TXT for details.
"""
# summary provider for class NSException
import lldb.runtime.objc.objc_runtime
impor... | StarcoderdataPython |
1692240 | <reponame>stangelandcl/hardhat
from .base import GnuRecipe
class GdbRecipe(GnuRecipe):
def __init__(self, *args, **kwargs):
super(GdbRecipe, self).__init__(*args, **kwargs)
self.sha256 = '97dcc3169bd430270fc29adb65145846' \
'a58c1b55cdbb73382a4a89307bdad03c'
self.name... | StarcoderdataPython |
31674 | import edits
from edits import PageEditor
pe = PageEditor(keyword='spider', orientation='block')
pe.edit() | StarcoderdataPython |
199199 | import traceback
from collections import namedtuple, defaultdict
import inspect
import itertools
import logging
import textwrap
from os import path
from shutil import get_terminal_size
from .abstract import Callable, DTypeSpec, Dummy, Literal, Type, weakref
from .common import Opaque
from .misc import unliteral
from n... | StarcoderdataPython |
4837953 | <filename>flash/graph/classification/model.py
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... | StarcoderdataPython |
41451 | <filename>tools/visualize-sawtooth-label.py<gh_stars>0
#!/usr/bin/python3.6
import numpy as np
import csv
import argparse
import matplotlib.pyplot as plt
import sys
import os
####################################
# Sawtooth crash labels visualizer #
####################################
if __name__ == "__main__":
... | StarcoderdataPython |
139563 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: persistent_volume_claim.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goo... | StarcoderdataPython |
82878 | from types import CodeType as Code
def construct():
...
def create() -> Object:
...
def define() -> Code:
...
| StarcoderdataPython |
135007 | <filename>modules/check_result.mako.py
# -*- coding:utf-8 -*-
from mako import runtime, filters, cache
UNDEFINED = runtime.UNDEFINED
STOP_RENDERING = runtime.STOP_RENDERING
__M_dict_builtin = dict
__M_locals_builtin = locals
_magic_number = 10
_modified_time = 1510155020.292707
_enable_loop = True
_template_filename = ... | StarcoderdataPython |
1621968 | <reponame>ace-gabriel/chrome-extension<filename>application/main/clients/city.py
# -*- encoding='utf-8'
import pandas as pd
import numpy as np
from flask import request, jsonify, g
from flask import Blueprint
from ...utils.esquery import EsqueryHelper
from ...utils.query import QueryHelper
from ...utils.auth import req... | StarcoderdataPython |
13565 | from .linear_torch import TorchGradientDescentAutogradRegression
import torch, math, random
class stochasticGradientDescent(TorchGradientDescentAutogradRegression):
def __init__(self, X, Y, alpha, **kwargs):
super(stochasticGradientDescent, self).__init__(X, Y, alpha, **kwargs)
try:
h ... | StarcoderdataPython |
1661275 | <filename>threeDCNN.py
import torch
import torch.nn as nn
import torch.nn.functional as F
class CNNLayer(nn.Module):
def __init__(self, C_in, C_out):
super(CNNLayer, self).__init__()
self.layer = torch.nn.Sequential(
torch.nn.Conv3d(C_in, C_out, 3, 1, 1),
torch.nn.BatchNorm3... | StarcoderdataPython |
3269301 | from pillcase.pillcase import Pillcase
class VC(object):
def __init__(self):
self.config = {
"buffersize": 512,
"clearInterval": 50,
"overScan": 0.82,
"hOffset": 0.06525,
"pulseLength": (0.2 / 1000),
"lineWidth": 2.5,
"brightness": 1,
"saturation": 1,
"blend": True,
"hFreq": 225.0,
... | StarcoderdataPython |
1779425 | """
Django settings for homevisit_project project.
Generated by 'django-admin startproject' using Django 2.1.3.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
im... | StarcoderdataPython |
149445 | """
utilities routines associated with Kubernetes python client
"""
import os
import copy
import base64
import yaml
from kubernetes import client, config
from kubernetes.client.rest import ApiException
from pandaharvester.harvesterconfig import harvester_config
from pandaharvester.harvestermisc.info_utils import Pan... | StarcoderdataPython |
3304508 | # -*- coding: utf-8 -*-
"""Module containing the DOV data type for boreholes (Boring), including
subtypes."""
import numpy as np
from pydov.types.abstract import (
AbstractDovType,
AbstractDovSubType,
)
class InformeleStratigrafieLaag(AbstractDovSubType):
_name = 'informele_stratigrafie_laag'
_rootp... | StarcoderdataPython |
1604564 | from matplotlib import pyplot as plt
import matplotlib.image as mpimg
import numpy
#image = "ct34"
image_ext = ".jpg"
image_list = ["ct1","ct3","ct4","ct5","ct6","ct7","ct8","ct9","ct10","ct11","ct12","ct13",
"ct14","ct15","ct16","ct17","ct18","ct19","ct20","ct21","ct22","ct23","ct24","ct25","ct26",
"ct27","ct28... | StarcoderdataPython |
7438 | # Copyright 2019 The FastEstimator 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 appl... | StarcoderdataPython |
1633175 | <filename>cryptopals/set2/challenge12.py
#!/usr/bin/env python3
import base64
from typing import Tuple
from functions.aes import gen_random_bytes, AESCipher, pkcs7_pad
RESULT = b"""Rollin' in my 5.0
With my rag-top down so my hair can blow
The girlies on standby waving just to say hi
Did you stop? No, I just drove ... | StarcoderdataPython |
3387870 | import pytest
import responses
@responses.activate
def test_proxy_edit(nessus):
responses.add(responses.PUT,
'https://localhost:8834/settings/network/proxy'
)
nessus.proxy.edit(proxy='proxy.company.com',
proxy_auth='auto',
proxy_p... | StarcoderdataPython |
115216 | # GUI Application automation and testing library
# Copyright (C) 2006 <NAME>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; either version 2.1
# of the License, or (at your optio... | StarcoderdataPython |
28589 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 09 22:25:07 2019
@author: arnaudhub
"""
#import pandas as pd
from sqlalchemy import create_engine
from sqlalchemy.sql import text
import configparser,os
from urllib import parse
#import sql.connector
config = configparser.ConfigParser()
config.re... | StarcoderdataPython |
1615887 | """
A quantized model executes some or all of the operations with integers rather than floating point values. This allows for a more compact models and the use of high performance vectorized operations on many hardware platforms.
As a result, you get about 40% smaller and faster models. The speed-up depends on your... | StarcoderdataPython |
121157 | <filename>tests/twitter_learning_journal/builders/test_detail_builder.py<gh_stars>1-10
from pytest import mark
from app.twitter_learning_journal.builders.detail_builder import DetailBuilder
from app.twitter_learning_journal.models.tweet import Tweet
def test_detail_builder_init():
tweet = Tweet()
detail_bui... | StarcoderdataPython |
1677706 | import shutil
import requests
from projects.workers.base import Worker
from projects.workers.exceptions import *
class FetchURL(Worker):
id = 'fetch_url'
name = 'fetch_url'
image = ''
description = """
Fetch URL Ccntent. Limitations:
1. Uses HTTP GET Method
2. Max of 3 re... | StarcoderdataPython |
3380474 | from custom_envs.pybulletgym_custom.envs import register # this is included to trigger env loading | StarcoderdataPython |
1607528 | <filename>shop_app/utils/__init__.py
# -*- coding: utf-8 -*-
# @Time : 2020/10/27 下午1:47
# @Author : 司云中
# @File : __init__.py.py
# @Software: Pycharm | StarcoderdataPython |
3272879 | import os
import hypertune
import tensorflow as tf
class HypertuneHook(tf.train.SessionRunHook):
def __init__(self):
self.hypertune = hypertune.HyperTune()
self.hp_metric_tag = os.environ.get('CLOUD_ML_HP_METRIC_TAG', '')
self.trial_id = os.environ.get('CLOUD_ML_TRIAL_ID', 0)
def end(... | StarcoderdataPython |
1692689 | <filename>Data-Structures/tree/test_tree.py
from tree import _Node, BinaryTree, BinarySearchTree, Queue
import pytest
@pytest.fixture
def my_bst():
tree = BinarySearchTree()
tree.add(15)
tree.add(11)
tree.add(13)
tree.add(7)
tree.add(8)
tree.add(5)
tree.add(19)
tree.add(17)
tree... | StarcoderdataPython |
3385172 | <filename>venv_biblio_v1/lib/python2.7/site-packages/refextract/references/config.py
# -*- coding: utf-8 -*-
#
# This file is part of refextract.
# Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011, 2015, 2016 CERN.
#
# refextract is free software; you can redistribute it and/or
# modify it under the terms of the GNU Ge... | StarcoderdataPython |
175583 | from django.urls import path, include
from rest_framework import routers
from catalogue.api.views import (
ProductViewSet,
ProductCategoryViewSet,
MediaUploadViewSet,
AttributeGroupViewSet,
ProductAttributeViewSet,
ProductAttributeValueViewSet,
ProductStockViewSet,
)
router = routers.Def... | StarcoderdataPython |
16126 | import datetime
import os, sys
import pprint
import requests
from pandas.io.json import json_normalize
import pandas as pd
URL = 'https://wsn.latice.eu/api/query/v2/'
#URL = 'http://localhost:8000/wsn/api/query/v2/'
#TOKEN = os.getenv('WSN_TOKEN')
TOKEN = os.getenv('WSN_TOKEN')
path = os.getcwd()
def query(
limi... | StarcoderdataPython |
3227654 | <gh_stars>0
import os
import tornado.options
from docker import tls
from traitlets import HasTraits, Int, Unicode, Bool, Dict
from remoteappmanager import paths
from remoteappmanager.traitlets import set_traits_from_dict
class FileConfig(HasTraits):
"""Configuration options for the application server.
They ... | StarcoderdataPython |
1677884 | <filename>eventmanagement/events/models.py
from django.db import models
# Create your models here.
# Organization Model
class Organization(models.Model):
# blank = True set the field as non compulsory
# Name of the organization
orgName = models.CharField(max_length=200, default='', blank=True)
# Addr... | StarcoderdataPython |
1752115 | import base64
import string
hexdigits = set(string.hexdigits)
def hex2base64(hexstring):
return base64.b64encode(base64.b16decode(hexstring.upper())).decode('utf-8')
def base642hex(b64string):
return base64.b16encode(base64.b64decode(b64string)).decode('utf-8')
def xorhexstrings(hexstring1,hexstring2):
... | StarcoderdataPython |
1667892 | from model import DeepJIT
from utils import mini_batches_test
from sklearn.metrics import roc_auc_score
import torch
from tqdm import tqdm
def eval(labels, predicts, thresh=0.5):
TP, FN, FP, TN = 0, 0, 0, 0
for lable, predict in zip(labels, predicts):
# print(predict)
if predict >= thresh ... | StarcoderdataPython |
3274966 | '''
Created on 2012-01-19
@author: innovation
'''
import unittest
import numpy as np
from tests.simualtors.joint_binomial import JointSnvMixSimulator
from joint_snv_mix.counter import JointBinaryCountData, JointBinaryQualityData
from joint_snv_mix.models.joint_snv_mix import JointSnvMixModel, JointSnvMixPriors, Join... | StarcoderdataPython |
137638 | v0,v1,t=eval(input("enter v0,v1,t:"))
a=(v1-v0)/t
print(a)
| StarcoderdataPython |
1758116 | class Award:
def __init__(self,tconst,Award,Year,Category):
self.tconst = tconst
self.Award = Award
self.Year = Year
self.Category = Category
def __str__(self):
toString = 'Movie: '+self.tconst+', recieved a '+self.Award+' in '+self.Year
toString=toString+... | StarcoderdataPython |
3269042 | <filename>solved/67.py
#!/usr/bin/env python3
# https://projecteuler.net/problem=67
from solved import p18
# use a lambda such that the call stack
# for read_data() includes this file.
solve = lambda: p18.solve()
args = ()
solution = 7273
| StarcoderdataPython |
3275677 | # Test class and utilities for functional tests
#
# Copyright (c) 2018 Red Hat, Inc.
#
# Author:
# <NAME> <<EMAIL>>
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
import logging
import os
import sys
import uuid
import tempfile
import ... | StarcoderdataPython |
3362299 | <reponame>bdrich/neutron-lbaas<filename>.tox/scenario/lib/python2.7/site-packages/oslo_messaging/_drivers/zmq_driver/broker/zmq_broker.py
# Copyright 2015 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You ma... | StarcoderdataPython |
137326 | from brownie import *
from .settings import *
from .contracts import *
from .contract_addresses import *
import time
def main():
load_accounts()
# Initialise Project
operator = accounts[0]
wallet = accounts[1]
# GP: Split into public and miso access control
access_control = deploy_access_con... | StarcoderdataPython |
3225639 | """Dataset creation and transformations."""
import numpy as np
import tensorflow as tf
from opennmt.utils import compat
from opennmt.utils import misc
def make_datasets(dataset_cls, filenames):
"""Creates instances of :obj:`dataset_cls`.
Args:
dataset_cls: A class inheriting from ``tf.data.Dataset``.... | StarcoderdataPython |
1619296 | <reponame>jokajak/infinity_tracker
# import datetime
import logging
# from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from requests import Request, Session
# from defusedxml import ElementTree as ET
# Get an instance of a logger
logger = logg... | StarcoderdataPython |
1609371 | """
polymerXtal
In this work, we present PolymerXtal, a software designed to build and analyze molecular-level polymer crystal structures. PolymerXtal provides a standardized process to generate polymer crystal structure based on monomer, tacticity, helicity, chiriality and unit cell information and analyze the crystal... | StarcoderdataPython |
133421 | from __future__ import annotations
from typing import Sequence
from pathlib import Path
import numpy as np
import pandas as pd
from dscience.core.exceptions import *
from dscience.core.extended_df import *
from dscience.ml.confusion_matrix import *
from kale.ml.accuracy_frames import *
class DecisionFrame(OrganizingF... | StarcoderdataPython |
3317276 | <filename>tests/ftguess/test_basic.py
"""Test ftguess"""
import unittest
import os
from os.path import splitext
from oletools import ftguess
# Directory with test data, independent of current working directory
from tests.test_utils import DATA_BASE_DIR
from tests.test_utils.testdata_reader import loop_over_files
cl... | StarcoderdataPython |
3399473 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from abc import abst... | StarcoderdataPython |
4839587 | """Top-level package for LensLikelihood."""
__author__ = """<NAME>"""
__email__ = '<EMAIL>'
__version__ = '0.1.0'
| StarcoderdataPython |
3361889 | <filename>djenga/core/__init__.py<gh_stars>1-10
from .bunch import Bunch
from .env import * # noqa
| StarcoderdataPython |
4824805 | <filename>gusto/diffusion.py
from abc import ABCMeta, abstractmethod
from firedrake import (TestFunction, TrialFunction, Function,
inner, outer, grad, avg, dx, dS_h, dS_v,
FacetNormal, LinearVariationalProblem,
LinearVariationalSolver, action)
__all... | StarcoderdataPython |
3267854 | # Performs post-pruning of a rule set by deleting rules that don't improve the training accuracy
from . import simplification as s
from . import evaluation_formulas as ef
from operator import concat
import time
import math
import itertools
import heapq
def post_prune(dnf, class_condition, condition_example_dict, exam... | StarcoderdataPython |
3279251 | <reponame>tehw0lf/pybel<filename>src/pybel/struct/mutation/deletion/__init__.py
# -*- coding: utf-8 -*-
"""Modules supporting deletion and degradation of graphs."""
from . import protein_rna_origins, deletion
from .protein_rna_origins import *
from .deletion import *
__all__ = (
protein_rna_origins.__all__ +
... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.