id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
52945 | # -*- coding: utf-8 -*-
# __author__ = wangsheng
# __copyright__ = "Copyright 2018, Trump Organization"
# __email__ = "<EMAIL>"
# __status__ = "experiment"
# __time__ = 2018/11/8 11:15
# __file__ = __init__.py.py
from .knearestneighbor import KNN
from .linear_model import Ridge, Lasso, ElasticNet, LogisticRegression
f... | StarcoderdataPython |
1778612 | <reponame>waikato-ufdl/ufdl-backend
from typing import List
from rest_framework import routers
from rest_framework.parsers import FileUploadParser
from rest_framework.request import Request
from rest_framework.response import Response
from ufdl.json.core import FileMetadata
from ...exceptions import JSONParseFailure... | StarcoderdataPython |
1872 | #!/usr/bin/python
# Copyright (C) 2014 Belledonne Communications SARL
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.... | StarcoderdataPython |
3369970 | <filename>fit_Mdyn/analyze_fit_dynesty.py
import pickle
import dynesty
from dynesty import plotting as dyplot
import matplotlib.pyplot as plt
wdir = '/Users/justinvega/Documents/GitHub/dyn-masses/fit_Mdyn/pickles/'
picklefile = open(wdir + 'dynesty_results_90000_logL.pickle', 'rb')
dyresults = pickle.load(picklefile)... | StarcoderdataPython |
1623212 | #11/1/2018
#universal embedding
from sklearn.metrics import mean_absolute_error
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import StratifiedKFold
from gensim.models import Word2Vec
from gensim.test.utils import common_texts
from gensim.models.doc2vec import Doc2Vec, TaggedDocument
from ... | StarcoderdataPython |
1750399 | <gh_stars>0
import pytest
def test_setupSmoke():
x = 1;
y = 2;
assert (x+1) == y, "test setup smoke failed"
| StarcoderdataPython |
3304511 | from kedro.io import AbstractDataSet, CSVLocalDataSet, MemoryDataSet, PickleLocalDataSet
import numpy as np
import logging
from .dataobjects.uplift_model_params import UpliftModelParams
from .dataobjects.propensity_model_params import PropensityModelParams
from .dataobjects.dataset_catalog import DatasetCatalog
from .... | StarcoderdataPython |
4841058 | from numpy.core.numeric import Inf
import torch
from torchdiffeq import odeint_adjoint
import matplotlib.pyplot as plt
import torch.optim as optim
from utils import data_utils
from models import PendulumModel
import copy
# Get environment
device = 'cpu'
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
print(f... | StarcoderdataPython |
3201158 | # -*- coding: utf-8 -*-
"""
Functions to perform deconvolution using the framework laid by Rudin-Osher and
Fatemi (ROF) in [1]. The minimization is performed using the FISTA method
derived by <NAME> and <NAME> in [2] as described in their paper for
TV-FISTA in [3]. The FISTA iterations have improved convergence by ut... | StarcoderdataPython |
193272 | <gh_stars>0
# -*- coding: utf-8 -*- #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# U... | StarcoderdataPython |
3344608 | <filename>src/bot.py<gh_stars>0
import argparse
import aws_comprehend as ac
import json
import os
import qa_engine as qa
import slackclient
import time
import urllib.request
INSTANCE_ID = urllib.request.urlopen('http://169.254.169.254/latest/meta-data/instance-id').read().decode()
AVAILABILITY_ZONE = urllib.request.u... | StarcoderdataPython |
4834538 | <filename>panelapp/panels/views/panels.py
##
## Copyright (c) 2016-2019 Genomics England Ltd.
##
## This file is part of PanelApp
## (see https://panelapp.genomicsengland.co.uk).
##
## Licensed to the Apache Software Foundation (ASF) under one
## or more contributor license agreements. See the NOTICE file
## distribut... | StarcoderdataPython |
1654654 | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 3 22:26:25 2021
@author: zrowl
"""
import types
from geographiclib.geodesic import Geodesic
from paths import linear
def coords2path(coords=[], geo=Geodesic.WGS84, interp_func_name='linear'):
lat_funcstr = "def lat_path(d, _):"
lon_funcstr = "... | StarcoderdataPython |
1685997 | # Copyright 2020 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 law or agreed to in writi... | StarcoderdataPython |
164345 | import pickle
from sklearn.decomposition import PCA
import numpy as np
class PCA_reduction:
def __init__(self, pca_path):
self.pca_reload = pickle.load(open(pca_path,'rb'))
def reduce_size(self, vector):
return self.pca_reload.transform([vector])[0]
@staticmethod
def create_new_pca_model(vectors, path_to_sa... | StarcoderdataPython |
198628 | <filename>src/main.py
import numpy as np
from kaggle_environments import evaluate, make
from src import agents
from src.utils import render_game
def play_game(agent1, agent2, environment, configuration):
env = make(environment=environment, configuration=configuration, debug=True)
env.run([agent1, agent2])
... | StarcoderdataPython |
3329737 | <gh_stars>0
import tensorflow as tf
import datetime
from datetime import timedelta
from timeit import default_timer as timer
from estimation.config import get_default_configuration
# base_dir = "D://coco-dataset"
# annot_path_train = base_dir + "/annotations/person_keypoints_train2017.json"
# annot_path_val = base_dir... | StarcoderdataPython |
3360999 | import sys
import numpy as np
import cv2
import scipy.io as sio
import matplotlib.pyplot as plt
from scipy import ndimage
from numpy import *
port_side_data = sys.argv[1]
stbd_side_data = sys.argv[2]
port_mat = sio.loadmat(port_side_data)
port_matrix = np.array(port_mat['port_intensity_matrix'])
stbd_mat = sio.loadmat... | StarcoderdataPython |
581 | <reponame>kirmerzlikin/intellij-community
r'''
This module provides utilities to get the absolute filenames so that we can be sure that:
- The case of a file will match the actual file in the filesystem (otherwise breakpoints won't be hit).
- Providing means for the user to make path conversions whe... | StarcoderdataPython |
1704576 | <reponame>annacarbery/VS_ECFP
from sklearn.tree import DecisionTreeClassifier
import json
import numpy as np
from sklearn.metrics import plot_confusion_matrix
import matplotlib.pyplot as plt
def make_input(list1, list2):
X = []
y = []
for l in [list1, list2]:
for ECFPs in l:
vec = [0]*... | StarcoderdataPython |
2656 | <filename>DistributedRL/Gateway/build/Code/sim/Parser/LAI/GreenIndex.py<gh_stars>1-10
import argparse
from PIL import Image, ImageStat
import math
parser = argparse.ArgumentParser()
parser.add_argument('fname')
parser.add_argument('pref', default="", nargs="?")
args = parser.parse_args()
im = Image.open(args.fname)
R... | StarcoderdataPython |
1746730 | # Given a binary search tree with non-negative values,
# find the minimum absolute difference between values of any two nodes.
# Example:
# Input:
# 1
# \
# 3
# /
# 2
# Output:
# 1
# Explanation:
# The minimum absolute difference is 1,
# which is the difference between 2 and 1 (or between 2 and 3)... | StarcoderdataPython |
3261180 | <reponame>SMAPPNYU/smappdragon
import os
import pymongo
import unittest
from test.config import config
from smappdragon import MongoCollection
from smappdragon.tools.tweet_parser import TweetParser
class TestMongoCollection(unittest.TestCase):
def test_iterator_returns_tweets(self):
collection = MongoCollection( ... | StarcoderdataPython |
1643181 | """
watches the remote status file (on s3) and updates a local status file
infinite loop like a deamon
if you want sms control this must be running
"""
from __future__ import print_function
from time import sleep
import urllib2
print('ok watching https://s3.amazonaws.com/blackcatsensor/status')
while Tru... | StarcoderdataPython |
4815624 | <reponame>jaimiles23/Multiplication_Medley<filename>2_interaction_model/sample_utterance_generation/UserNameIntent_utterances.py
"""/**
* @author [<NAME>]
* @email [<EMAIL>]
* @create date 2020-05-06 10:59:24
* @modify date 2020-05-06 10:59:24
* @desc [
Script to generate sample utterances for UserNameIntent.
... | StarcoderdataPython |
78919 | import json
from topojson.core.extract import Extract
from shapely import geometry
import geopandas
import geojson
# extract copies coordinates sequentially into a buffer
def test_extract_linestring():
data = {
"foo": {"type": "LineString", "coordinates": [[0, 0], [1, 0], [2, 0]]},
"bar": {"type":... | StarcoderdataPython |
1720611 | <reponame>craigatron/parse-tle<gh_stars>0
from setuptools import setup
setup(
name='parsetle',
version='0.1',
description='Parses two-line element set files',
url='https://github.com/craigatron/parse-tle',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['parsetle'],
... | StarcoderdataPython |
1653628 | class Solution:
# @param {integer[]} nums
# @param {integer} val
# @return {integer}
def removeElement(self, nums, val):
count = 0
idx = 0
while idx < len(nums) - count:
if nums[idx] == val:
count += 1
nums[idx], nums[-count] = nums[-co... | StarcoderdataPython |
3393373 | <reponame>gdikov/MNIST_Challenge
from models.model import AbstractModel
from models.nn.layers import *
from numerics.softmax import softmax
import config as cfg
import os
import cPickle
import numpy as np
# from utils.vizualiser import plot_filters
class ConvolutionalNeuralNetwork(AbstractModel):
def __init__(... | StarcoderdataPython |
3300107 | <gh_stars>10-100
#! /usr/bin/env python3
###
# KINOVA (R) KORTEX (TM)
#
# Copyright (c) 2018 Kinova inc. All rights reserved.
#
# This software may be modified and distributed
# under the terms of the BSD 3-Clause license.
#
# Refer to the LICENSE file for details.
#
###
import sys
import os
import ti... | StarcoderdataPython |
188864 | """
Author: ArchieYoung <<EMAIL>>
Time: Thu Jul 5 09:24:07 CST 2018
"""
import sys
import argparse
import os
from multiprocessing import Pool
from glob import iglob
from sv_vcf import SV
def vcf_to_db_bed(_args):
vcf, min_support_reads, out_dir, sv_id_prefix = _args
with open(vcf, "r") as io:
li... | StarcoderdataPython |
3232120 | from typing import Any, Callable, Dict, List, Mapping, Optional, Tuple, Union
import copy
import os
import numpy as np
import torch
import torch.distributed as dist
import torch.nn as nn
from torch.nn.parallel import DistributedDataParallel
from catalyst.core.engine import IEngine
from catalyst.typing import (
D... | StarcoderdataPython |
137308 | <reponame>matthijsvk/convNets
# ----------------------------------------------------------------------------
# Copyright 2016 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License a... | StarcoderdataPython |
1708850 | #!/usr/bin/env python3
"""Supporting utilities.
Classes
-------
.. autosummary::
ProgressBar
OptionReader
Routines
--------
.. autosummary::
read_param
round_up
evaluate_ratio
humansize
humantime
----
"""
from __future__ import absolute_import
from __future__ import division
from __fut... | StarcoderdataPython |
35795 | <reponame>NCGThompson/damgard-jurik
#!/usr/bin/env python3
from damgard_jurik.crypto import EncryptedNumber, PrivateKeyRing, PrivateKeyShare, PublicKey, keygen
| StarcoderdataPython |
1668744 | <filename>notebooks/utils.py
import numpy as np
def _epsilon(i, j, k):
"""
Levi-Civita tensor
"""
assert i>=0 and i<3, "Index i goes from 0 to 2 included"
assert j>=0 and j<3, "Index j goes from 0 to 2 included"
assert k>=0 and k<3, "Index k goes from 0 to 2 included"
if (i, j, k) in ... | StarcoderdataPython |
21942 | <filename>pythonVersion/interpolateMetm.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 11 21:36:32 2021
@author: rachel
"""
import numpy as np
from scipy import interpolate
import matplotlib.pyplot as plt
def interpolateMetm(uxsg, ufsg, uxl, ufl, m, M, fact1, fact2):
#%%%%% interpolate o... | StarcoderdataPython |
4825047 | from __future__ import absolute_import, division, print_function
from cctbx.geometry_restraints.auto_linking_types import origin_ids
class linking_class(dict):
def __init__(self):
self.data = {}
origin_id = 0
for oi in origin_ids:
for i, item in oi.items():
if item[0] in self: continue
... | StarcoderdataPython |
3291438 | <gh_stars>1-10
"""Constants for Plum ecoMAX test suite."""
from custom_components.plum_ecomax.const import (
CONF_CAPABILITIES,
CONF_CONNECTION_TYPE,
CONF_DEVICE,
CONF_HOST,
CONF_MODEL,
CONF_PORT,
CONF_SOFTWARE,
CONF_UID,
CONF_UPDATE_INTERVAL,
CONNECTION_TYPE_SERIAL,
CONNECT... | StarcoderdataPython |
1693328 | <reponame>tarmstrong/nbdiff<gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'The NBDiff Team'
__email__ = '<EMAIL>'
__version__ = '1.0.4'
| StarcoderdataPython |
4825490 | <gh_stars>10-100
"""Defines prop default values."""
_BOX_WIDTH = 0.04
_BOX_HEIGHT = 0.04
_BOX_DEPTH = 0.04
_BOX_MASS = 0.02
_SPHERE_RADIUS = 0.02
_SPHERE_MASS = 0.02
_CYLINDER_RADIUS = 0.02
_CYLINDER_LENGTH = 0.06
_CYLINDER_MASS = 0.02
_CAPSULE_RADIUS = 0.02
_CAPSULE_LENGTH = 0.06
_CAPSULE_MASS = 0.02
_TOTE_SCALE ... | StarcoderdataPython |
164195 | <gh_stars>1-10
from output.models.nist_data.atomic.positive_integer.schema_instance.nistschema_sv_iv_atomic_positive_integer_min_inclusive_5_xsd.nistschema_sv_iv_atomic_positive_integer_min_inclusive_5 import NistschemaSvIvAtomicPositiveIntegerMinInclusive5
__all__ = [
"NistschemaSvIvAtomicPositiveIntegerMinInclus... | StarcoderdataPython |
3202644 | <reponame>unixfy/summercamp18<filename>Python/test.py
if __name__ == "__main__":
name = input("TELL ME YOUR NAME USER! ")
def print_name(loop):
for i in range(0,loop):
print("DID YOU KNOW? YOUR NAME IS %s" % (name))
print_name(10) | StarcoderdataPython |
3370200 | import os
import re
import locale
import sqlite3
import zipfile
import click
import arrow
from wtforms import Field
from jinja2 import Environment, StrictUndefined, FileSystemLoader
import ruamel.yaml
import IPython
from .app import create_app
from .submitter import sendmail
from .database import (
init_db, expor... | StarcoderdataPython |
3277263 | from builtins import object
import re
from orderedmultidict import omdict
class GroupNotExists(Exception):
def __str__(self):
return "Group not exists"
class UserAlreadyInAGroup(Exception):
def __str__(self):
return "User already in a group"
class UserNotInAGroup(Exception):
def __s... | StarcoderdataPython |
1626949 | from src.services.world_name_generators.base_world_name_generator import BaseWorldNameGenerator
from src.services.world_name_generators.txt_file_world_name_generator import TxtFileWorldNameGenerator
class WorldNameGeneratorSelector:
def select_world_name_generator(self) -> BaseWorldNameGenerator:
return T... | StarcoderdataPython |
3370622 | <filename>coro/http/websocket.py
# -*- Mode: Python -*-
import base64
import struct
import coro
import os
import sys
import hashlib
W = coro.write_stderr
from coro.http.protocol import HTTP_Upgrade
from coro import read_stream
# RFC 6455
class WebSocketError (Exception):
pass
class TooMuchData (WebSocketError... | StarcoderdataPython |
1626262 | from datetime import datetime, timezone
import os
from io import StringIO
from pathlib import Path
import sys
import traceback
from typing import Union, Dict, Any
from uuid import uuid4
import ecs_logging
import structlog
from structlog.contextvars import bind_contextvars, merge_contextvars, unbind_contextvars
from .... | StarcoderdataPython |
1648242 | <filename>reserway/bookings/migrations/0001_initial.py
# Generated by Django 3.1.2 on 2020-11-24 19:46
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('accounts', '0002_bo... | StarcoderdataPython |
3251424 | <gh_stars>0
"""Write helper script to submit job to slurm
"""
import os, sys
import subprocess
import platform
import datetime
from typing import Callable, List
from colorama import init, Fore
from omegaconf.dictconfig import DictConfig
init(autoreset=True)
SLURM_CMD = """#!/bin/bash
# set a job name
#SBATCH --job-... | StarcoderdataPython |
1748852 | schema = {
"$schema": "http://json-schema.org/draft-06/schema#",
"$comment": "Definition of the custom exchange with price data included in the specified CSV file.",
"type": "object",
"properties": {
"baseAsset": {
"$comment": "Base asset of the pair in the input CSV file, e.g. BTC, ETH, XLM, ADA, ...",
"t... | StarcoderdataPython |
3213599 | from src.githubinfo.api.github_file import GitHubFile
from src.githubinfo.api.github_folder import GitHubFolder
from src.githubinfo.api.github_repo import GitHubRepo
class TestGitHubRepo:
def setup_method(self):
self.repo = GitHubRepo("Cutewarriorlover", "test-repo")
folder = self.repo.root_folder... | StarcoderdataPython |
116727 | <filename>main.py
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 26 05:11:54 2018
@author: zefa
"""
import sys
from PyQt5 import QtCore, QtGui, QtWidgets
from UI.main_win import Ui_MainWindow
from UI.LabelQWidget import LabelQWidget
from UI.HistPlotQWidget import HistPlotQWidget
from app.GuiControl import GuiContro... | StarcoderdataPython |
4818779 | # -*- coding: utf-8 -*-
"""
Author: <NAME>
Created: 28.02.2019
Updated: 12.03.2019
Email: <EMAIL>
# Description
The main function of this script is to update the annotation of reactions to different subsystems and pathways.
The curated annotation of subsystems and pathways is found in "ComplementaryData/curation/pat... | StarcoderdataPython |
3354312 | <filename>Sketch/sketchMe.py
# coding: utf-8
# python sketchMe.py (1)path/to/input (2)path/to/target
# In[1]:
from __future__ import print_function
import numpy as np
import pandas as pd
import cv2 as cv
import os
import h5py
import sys
#import matplotlib.pyplot as plt
import matplotlib
matplotlib.use('TkAgg')
from m... | StarcoderdataPython |
76716 | <gh_stars>0
import config
config.init()
import argparse
import torch.backends.cudnn as cudnn
from data import *
from metrics import *
from utils import *
cudnn.benchmark = True
parser = argparse.ArgumentParser(description='Config')
for k in config.PARAM:
exec('parser.add_argument(\'--{0}\',default=config.PARAM[\'... | StarcoderdataPython |
3211350 | <reponame>patientzero/timage-icann2019<gh_stars>1-10
from .resnet import ResNet152, ResNet50
network_models_classes = {
'resnet152': ResNet152,
'resnet50': ResNet50
}
| StarcoderdataPython |
3218455 | import unittest
from acme import Product
from acme_report import generate_products, adj, noun
class AcmeProductTests(unittest.TestCase):
"""Making sure Acme products are the tops!"""
def test_default_product_price(self):
"""Test default product price being 10."""
prod = Product('Test Product')... | StarcoderdataPython |
1745055 | # PROGRAMMING EXERCISE
import csv
import re
def read_source_file():
temperatures = []
# Reading of user input in try-catch block to ensure no exception is thrown in case of wrong path provided by user
try:
# Test file available in data/ folder
# filename = "./data/temperatures.csv"
... | StarcoderdataPython |
1798044 | """PyVogen命令行接口"""
import json
import vogen
from typing import List
import argparse
Parser=argparse.ArgumentParser
def main():
#显示默认帮助
def pyvogen_default(args):
print("PyVogen命令行工具\n\npm 包管理器\nversion 显示版本信息\n\n可在此找到更多帮助:https://gitee.com/oxygendioxide/vogen")
parser = Parser(prog='pyvogen')
#prin... | StarcoderdataPython |
146305 | import unittest
from cred import Credential
class TestUser(unittest.TestCase):
'''
Test class that defines tes cases for the Credential class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating test cases
'''
def setUp(self):
'''
Set up method to run before each t... | StarcoderdataPython |
3207673 | <gh_stars>10-100
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2018 ASLP@NPU <NAME>
from __future__ import absolute_import
from __future__ import division
from __future__ import absolute_import
import os
import sys
import numpy as np
sys.path.append(os.path.dirname(sys.path[0]) + '/utils')
from sig... | StarcoderdataPython |
29760 | from django.conf.urls.defaults import patterns, include, url
from django.contrib import admin
from board.feeds import EventFeed
from board.views import IndexView, ServiceView
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$', IndexView.as_view(), name='index'),
url(r'^services/(?P<slug>[-\w]+)$', Serv... | StarcoderdataPython |
3249157 | <reponame>fabriciopashaj/downloader-4anime
import os
from downloader_4anime import Stream, Status
from downloader_4anime.cacher import AnimeDescriptor
local = os.path.expandvars("$HOME/python/downloader-4anime")
stream = Stream(AnimeDescriptor('Naruto-Shippuden', 'v5.4animu.me', 750),
104, 1024 << 4)
print(stream)... | StarcoderdataPython |
1678478 | from rdr_service.api import check_ppi_data_api
from rdr_service.code_constants import FIRST_NAME_QUESTION_CODE
from rdr_service.dao.code_dao import CodeDao
from rdr_service.dao.participant_dao import ParticipantDao
from rdr_service.dao.participant_summary_dao import ParticipantSummaryDao
from rdr_service.model.particip... | StarcoderdataPython |
4840123 | <gh_stars>0
import tensorflow as tf
from tensorflow.keras import layers
from custom_layers import Focus, Conv, BottleneckCSP, SPP, Bottleneck
from config import Configuration
cfg = Configuration()
class YOLOv5r5Backbone(tf.keras.Model):
def __init__(self, depth, width, **kwargs):
super(YOLOv5r5Backbone, se... | StarcoderdataPython |
3301530 | <reponame>closerbibi/faster-rcnn_hha<gh_stars>0
import parseLoss as pl
import pdb
import matplotlib.pyplot as plt
import matplotlib as mt
#mt.use('Agg')
#plt.ioff()
logname = 'train_rankpooling' # remember to change this
path = '/home/closerbibi/bin/faster-rcnn/logfile/%s.log' % logname
loss = pl.loadfile(path)
fig = ... | StarcoderdataPython |
52189 | <filename>mean_hr_bpm.py
def mean_beats(threshold=0.7, voltage_array=None, time_array=None):
"""returns avg_beats
This function calculates the average heart rate.
The function requires the peakutils package to determine the indexes
of every peak in the voltage array. The second line in the function
... | StarcoderdataPython |
1690912 | <gh_stars>0
from django.contrib.postgres.fields import JSONField
from django.db import models
from django.utils import timezone
from mptt.models import MPTTModel, TreeForeignKey
from waherb.utils import AuditMixin, ActiveMixin, smart_truncate
class Reference(AuditMixin, ActiveMixin):
"""A reference from which tax... | StarcoderdataPython |
1628462 | from enum import Enum
from types import ModuleType, new_class
from inspect import Signature, Parameter
from .error import UnknownType
from .util import TypeWrapper
class RecordType:
pass
def create_enum_implementation(enum, name_converter):
name = name_converter.enum_name(enum.name)
enum_dict = {name_co... | StarcoderdataPython |
3283378 | <gh_stars>1-10
"""XPath lexing rules.
To understand how this module works, it is valuable to have a strong
understanding of the `ply <http://www.dabeaz.com/ply/>` module.
"""
from __future__ import unicode_literals
operator_names = {
'or': 'OR_OP',
'and': 'AND_OP',
'div': 'DIV_OP',
'mod': 'MOD_OP',
... | StarcoderdataPython |
64663 | import math
import torch
import torch.nn as nn
from onmt.utils.misc import aeq
from onmt.utils.loss import LossComputeBase
def collapse_copy_scores(scores, batch, tgt_vocab, src_vocabs,
batch_dim=1, batch_offset=None):
"""
Given scores from an expanded dictionary
corresponeding t... | StarcoderdataPython |
3263501 | <reponame>dawidePl/Linux-SysInfo
import psutil
import platform
from datetime import datetime
class SysInfo(object):
def __init__(self):
self.units = ["", "K", "M", "G", "T", "P"]
self.factor = 1024
self.func_dict = {
'system': self.get_system,
'uptime': self.get_uptime,
'cpu': self.get_cpu_data,
'ra... | StarcoderdataPython |
3208478 | <gh_stars>1000+
from pythonforandroid.recipes.kivy import KivyRecipe
assert KivyRecipe.depends == ['sdl2', 'pyjnius', 'setuptools', 'python3']
assert KivyRecipe.python_depends == ['certifi']
class KivyRecipePinned(KivyRecipe):
# kivy master 2020-12-10 (2.0.0 plus a few bugfixes)
version = "2debbc3b1484b1482... | StarcoderdataPython |
3237516 | <reponame>mgthometz/advent-of-code-2021
import sys, collections
from grid import gridsource as grid
from util import findints
Target = collections.namedtuple('Target', 'xmin xmax ymin ymax')
def main():
f = open(sys.argv[1] if len(sys.argv) > 1 else 'in')
target = Target(*findints(f.read()))
result = 0... | StarcoderdataPython |
3271948 | # raw trade data as returned by ccxt for kraken
kraken_trades = [{
'amount': 0.02,
'datetime': '2017-02-02T18:00:20.000Z',
'fee': {
'cost': 0.05,
'currency': 'EUR'
},
'id': 'ABCDEF-GHIJK-LMNOPQ',
'info': {
'cost': '20.8',
'fee': '0.05',
'id': 'ABCDEF-GHIJ... | StarcoderdataPython |
1646832 | <filename>logger_es_cli/__main__.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# __main__.py
# @Author : <NAME> (<EMAIL>)
# @Link :
from logger_es_cli.cli_driver import app
import sys
def main():
app(prog_name="logger-es-cli")
if __name__ == "__main__":
sys.exit(main())
| StarcoderdataPython |
33239 | #!/usr/bin/env python
# coding: utf-8
# Copyright 2014 The Crashpad 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/LICEN... | StarcoderdataPython |
1726297 | #!/usr/bin/env python
"""
First run convert_strips.py to convert 16bit pansharpened multispectral to 8bit pansharpened RGB. Then run this script to reproject.
"""
import os
import subprocess
names = [
'01_rio',
'02_vegas',
'03_paris',
'04_shanghai',
'05_khartoum',
'06_atlanta',
'07_mosco... | StarcoderdataPython |
4835358 | <gh_stars>1-10
import sys
if sys.version_info < (3,):
raise RuntimeError("libhxl requires Python 3 or higher")
__version__="0.1"
| StarcoderdataPython |
1667302 | <reponame>gdyp/bert-awesome
# /user/bin/python3.6
# -*-coding: utf-8-*-
from pytorch_pretrained_bert.tokenization import BertTokenizer
from pathlib import Path
import torch
from tqdm import tqdm_notebook as tqdm
import os
from tqdm import tqdm
import sys
import random
import numpy as np
# import apex
from tensorboardX... | StarcoderdataPython |
171723 | <filename>IL_method/prototype.py
from torch.nn import functional as F
import torch
import torch.nn as nn
import os
import pickle
from torch.utils.data.dataloader import DataLoader
from torchvision import transforms
# my package
from retinanet.losses import calc_iou
from retinanet.dataloader import IL_dataset, Resiz... | StarcoderdataPython |
96886 | <reponame>zh012/flask-dropin<gh_stars>10-100
#!/usr/bin/env python
from setuptools import setup
options = dict(
name='Flask-DropIn',
version='0.0.1',
description='Flask-DropIn let you easily organize large flask project.',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/zh012/... | StarcoderdataPython |
187854 | <reponame>Monia234/NCI-GwasQc
from pathlib import Path
from typing import Optional
from pydantic import BaseModel, Field
class ReferenceFiles(BaseModel):
"""A list of reference files used by the pipeline.
.. code-block:: yaml
reference_files:
illumina_manifest_file: /path/to/bpm/file/GS... | StarcoderdataPython |
1767588 | import sys
import json
from sklearn import preprocessing
from sklearn import feature_extraction
from iologreg import IOLogisticRegression
features = []
labels = {}
invlabels = {}
# read labels and associated features
for line in open(sys.argv[1]):
(label, f) = line.strip().split('\t')
invlabels[len(labels)] = labe... | StarcoderdataPython |
3272036 | <filename>paginas/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('pagina/<str:slug>', views.pagina, name="pagina"),
]
| StarcoderdataPython |
3306179 | <reponame>paulorssalves/coletivo-rexiste
from django.apps import AppConfig
class RexisteConfig(AppConfig):
name = 'rexiste'
| StarcoderdataPython |
3223152 | #!/usr/bin/env python
"""
CREATED AT: 2022/1/4
Des:
https://leetcode.com/problems/complement-of-base-10-integer/
GITHUB: https://github.com/Jiezhi/myleetcode
Difficulty: Easy
Tag: Bit
See:
Time Spent: min
"""
class Solution:
def bitwiseComplement(self, n: int) -> int:
"""
Runtime: 43 ms, fa... | StarcoderdataPython |
1637264 | <filename>sources/genericStatusPage.py
import requests
from utils import getName, getGlobalStatus
def getMetrics(url: str) -> dict:
data = requests.get(url).json()
metrics = {}
base = getName(data["page"]["name"]) + "_"
for c in data["components"]:
metrics[base + getName(c["name"])] = getStat... | StarcoderdataPython |
4839660 | #!/usr/bin/env python
"""
Refactoring tests work a little bit similar to integration tests. But the idea
is here to compare two versions of code. If you want to add a new test case,
just look at the existing ones in the ``test/refactor`` folder and copy them.
"""
import os
import platform
import re
from parso import s... | StarcoderdataPython |
172435 | """Test ThroughputReporter"""
import pytest
@pytest.fixture
def klass():
"""Return CUT."""
from agile_analytics import ThroughputReporter
return ThroughputReporter
def test_title(klass):
"""Ensure the title gets set."""
r = klass(
title="Weekly Throughput"
)
assert r.title == "W... | StarcoderdataPython |
48650 | import typing as t
import numpy as np
import pandas as pd
from house_prices_regression_model import __version__ as VERSION
from house_prices_regression_model.processing.data_manager import load_pipeline
from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH
from house_prices_regression_m... | StarcoderdataPython |
3327215 | import networkx as nx
import networkx.convert as convert
# Class "GraphQW" is a NetworkX graph with generated individual attributes
class GraphQW(nx.DiGraph):
def __init__(self, g = None, q = None, dq = None, limcoal = None, dw = None):
self.graph = {}
self._node = self.node_dict_factory()
... | StarcoderdataPython |
1688302 | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='rsabias',
version='0.1',
description='Tool to analyse RSA key generation and classification',
long_description=readme... | StarcoderdataPython |
1794208 | #!/usr/bin/env python3
import sys
sys.path.insert( 0, '..' )
# this will later be a session multiplexer object in a module abstraction library
from Engines.POF_com import Session as POFSession
def Main():
config = POFSession.Config("config.ini")
testSession = POFSession(config)
testSession.login()
... | StarcoderdataPython |
3389270 | <reponame>finbyz/finbyz_dashboard
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.utils import flt, cint, getdate, now, date_diff
# from frappe.uti... | StarcoderdataPython |
3276308 | <gh_stars>0
import numpy as np
def measure_frequency_response(filter_function, freqs=np.logspace(-3,0,1024), input_length=2**18):
"""
Empericaly measure frequency response of a filtering function using sine waves.
Parameters
----------
filter_function : callable
freqs : array of floats
... | StarcoderdataPython |
3328726 | <reponame>openeuler-mirror/pkgship
#!/usr/bin/python3
# ******************************************************************************
# Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
# licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the... | StarcoderdataPython |
115278 | from app import app
from .conf import tasks_api
from . import tasks # initialize routes of tasks
tasks_api.init_app(app)
| StarcoderdataPython |
1692542 | from django.apps import AppConfig
class ReferenciaConfig(AppConfig):
name = 'referencia'
| StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.