id stringlengths 1 8 | text stringlengths 6 1.05M | dataset_id stringclasses 1
value |
|---|---|---|
3321608 | <reponame>juanluisrosaramos/keras_to_tf_to_tflite
import tensorflow as tf
import numpy as np
from pathlib import Path
from absl import flags
from absl import app
from absl import logging
FLAGS = flags.FLAGS
flags.DEFINE_string('input_model', None, 'Path to the input model.')
flags.DEFINE_string('input_arrays', None, ... | StarcoderdataPython |
3463603 | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""=================================================================
@Project : Algorithm_YuweiYin/LeetCode-All-Solution/Python3
@File : LC-0913-Cat-and-Mouse.py
@Author : [YuweiYin](https://github.com/YuweiYin)
@Date : 2022-01-04
=====================================... | StarcoderdataPython |
1915153 | <filename>FunHouse_Fume_Extractor/code.py
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import time
import board
import simpleio
import adafruit_sgp30
import displayio
import adafruit_imageload
from adafruit_emc2101 import EMC2101
from adafruit_funhouse import FunHouse
... | StarcoderdataPython |
5122830 | from sys import argv
with open(argv[1], 'r', encoding='UTF-8') as input:
with open(argv[2], 'w', encoding='Shift-JIS') as output:
for line in input:
data = line.split(',')
if len(data) == 3: #which it always is
expression = data[0]
if expressi... | StarcoderdataPython |
1627334 | #!/usr/bin/env python
#
# Copyright 2015 British Broadcasting 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.org/licenses/LICENSE-2.0
#
# Unless requ... | StarcoderdataPython |
8055918 | # Copyright (c) 2020-2021 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | StarcoderdataPython |
3458386 | <reponame>techdragon/django-auth0-auth<gh_stars>1-10
from django_auth0_user.models import AbstractAuth0User
class Auth0User(AbstractAuth0User):
"""
A user model designed for easy use with Auth0
"""
pass
| StarcoderdataPython |
11251956 | <gh_stars>10-100
"""Representation of a text block within the HTML canvas."""
from html import unescape
from inscriptis.html_properties import WhiteSpace
class Block:
"""The current block of text.
A block usually refers to one line of output text.
.. note::
If pre-formatted content is merged wit... | StarcoderdataPython |
3390311 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-20 10:41
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('pages', '0013_formpage_button_name'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
5040896 | <filename>test/hlt/pytest/python/com/huawei/iotplatform/client/dto/DeviceEventHeader.py
class DeviceEventHeader(object):
def __init__(self):
self.requestId = "requestId"
self.from_ = "from_"
self.to = "to"
self.deviceId = "deviceId"
self.serviceType = "serviceType"
s... | StarcoderdataPython |
8108870 | # this file was created by <NAME> it contains large portions of code from
# https://github.com/lanl-ansi/bqpsolvers/ repository
import warnings
import dwavebinarycsp
from gurobipy import Model, GRB
import dimod
from utils.jobshop_helpers import ones_from_sample
from utils.jobshopproblem import JobShopProblem, pruned... | StarcoderdataPython |
3599060 | import requests
from flask import Blueprint, current_app
from api.utils import (
get_jwt,
jsonify_data,
url_for,
get_response_data,
catch_ssl_errors
)
health_api = Blueprint('health', __name__)
@catch_ssl_errors
def check_spycloud_health():
url = url_for('watchlist/example.org')
headers... | StarcoderdataPython |
1977103 | #!/usr/bin/env python3
from paramiko import SSHClient
import json
import sys
# Should be in the form "user@server:folder_path"
folder_path = sys.argv[1]
user = folder_path.split("@")[0]
server = folder_path.split("@")[1].split(":")[0]
folders = folder_path.split("@")[1].split(":")[1]
folder_name = folder_path.split("... | StarcoderdataPython |
5146604 | from ProjectEulerCommons.Base import *
from ProjectEulerCommons.PrimeNumbers import generate_prime
Answer(
nth(generate_prime(), 10001 - 1)
)
"""
------------------------------------------------
ProjectEuler.Problem.007.py
The Answer is: 104743
Time Elasped: 0.3361032009124756sec
------------------------... | StarcoderdataPython |
9780392 | '''
Write a code to receive an integer (n). Then, the code outputs the three lines as follows:
- 1st line shows n of *.
- 2nd line shows (n-2) of *. (If n-2 is less than 1, no need to output any asterisks.)
- 3rd line shows (n-4) of *. (If n-4 is less than 1, no need to output any asterisks.)
Input
An integer (n).
... | StarcoderdataPython |
11320513 | # coding: utf-8
from pathlib import Path
from collections import Counter
from itertools import chain
import os, fire, re, csv, pickle
import pandas as pd
from typing import Callable, List, Collection
from concurrent.futures.process import ProcessPoolExecutor
from sacremoses import MosesTokenizer
ORTH = 65
def p... | StarcoderdataPython |
6665190 | <gh_stars>0
import midi
from tb3step import TB3Step
from tb3pattern import TB3Pattern
class MIDIParser:
def __init__(self,midi_path):
self.midi_path = midi_path
def parse(self,track_index=0):
pattern = midi.read_midifile(self.midi_path)
track = pattern[track_index]
#Pulses per quarter
p... | StarcoderdataPython |
6517540 | import numpy as np
import cv2
import scipy
import scipy.signal
def add_salt_and_pepper(image):
s_vs_p = 0.5
amount = 0.004
out = np.copy(image)
# Salt mode
num_salt = np.ceil(amount * image.size * s_vs_p)
coords = [np.random.randint(0, i - 1, int(num_salt))
for i in image.shape]
... | StarcoderdataPython |
3310508 | <filename>paw2018/userpicks/admin.py
from django.contrib import admin
from .models import UserPick
# Register your models here.
class UserPickAdmin(admin.ModelAdmin):
list_display = ('team', 'game', 'pick')
admin.site.register(UserPick, UserPickAdmin)
| StarcoderdataPython |
3594859 | import torch
from torch import nn
import math
from torch.nn import functional as F
from utils import cat_boxlist, Assigner
from utils import GIoULoss,SigmoidFocalLoss,concat_box_prediction_layers,get_num_gpus,reduce_sum
class ATSSHead(nn.Module):
def __init__(self, in_channels, n_class, n_conv, prior, regr... | StarcoderdataPython |
6531525 | from env import *
from scipy import integrate
from scipy.stats import entropy
from copy import deepcopy
# normalization trix from tim viera blog
def exp_normalize(x):
b = x.max()
y = np.exp(x - b)
return y / y.sum()
K_DIS = 5
# this is just the hypothesis space, which is same for every casino
H_S... | StarcoderdataPython |
5144714 | #!/usr/bin/python
# example string: BIGip<ervername>110536896.20480.0000
import struct
import sys
import re
if len(sys.argv) != 2:
print "Usage: %s cookie" % sys.argv[0]
exit(1)
cookie = sys.argv[1]
print "\n[*] Cookie to decode: %s\n" % cookie
(cookie_name, cookie_value) = cookie.split('=')
pool = re.sea... | StarcoderdataPython |
9606517 | """
Description:
Test argparser.
Author: lincoln12w
Github: https://github.com/Lincoln12w
Module:
argparse
Doc: https://docs.python.org/2/howto/argparse.html &
https://docs.python.org/3/library/argparse.html
APIs:
ArgumentParser.add_argument()
action - The basic type of action to be taken whe... | StarcoderdataPython |
6569899 | <filename>algorithms/mDSDI/src/models/model_factory.py
from algorithms.mDSDI.src.models.mnistnet import MNIST_CNN, Color_MNIST_CNN
from algorithms.mDSDI.src.models.resnet import ResNet
nets_map = {"mnistnet": MNIST_CNN, "cmnistnet": Color_MNIST_CNN, "resnet50": ResNet}
def get_model(name):
if name not in nets_m... | StarcoderdataPython |
1704022 | <gh_stars>0
import boto3
import os
import time
AUTOSCAL = os.environ['AUTOSCAL']
CLUSTER = os.environ['ECS']
TASK = os.environ['TASKDEF']
def lambda_handler(event, context):
# TODO implement
try:
set_autoscaling(AUTOSCAL)
time.sleep(300)
run_task(CLUSTER, TASK)
except:
rai... | StarcoderdataPython |
11227245 | import numpy as np
from numpy.testing import run_module_suite
from skimage import filter, data, color
from skimage import img_as_uint, img_as_ubyte
class TestTvDenoise():
def test_tv_denoise_2d(self):
"""
Apply the TV denoising algorithm on the lena image provided
by scipy
"""
... | StarcoderdataPython |
3443514 | <filename>PythonCode/Iteration1.py
nums = [2, 3, 4, 5, 6, 7] # created a list
for i in nums: # using a for loop, we can easily iterate through the list. The variable i could be anything.
print(i) # printing each part of the list, iterating through it. | StarcoderdataPython |
9612772 | import argparse
import numpy as np
import csv
import pandas as pd
import json
import scipy.sparse as sp
from sparsebm import (
SBM,
LBM,
ModelSelection,
generate_LBM_dataset,
generate_SBM_dataset,
)
from sparsebm.utils import reorder_rows, ARI
import logging
logger = logging.getLogger(__name__)
tr... | StarcoderdataPython |
3323563 | import numpy as np
import pandas as pd
import DataAnalysisRoutines as dar
def create_voyager_file_list_years(start,end):
import glob
# set directory for voyager files
basedir='/archive/cdaweb.gsfc.nasa.gov/pub/data/voyager/voyager1/'
filelist=[]
# sort all the files collected in the for each year in the ra... | StarcoderdataPython |
1629694 | <filename>blog/forms.py
from xml.etree.ElementTree import Comment
from django import forms
from blog.models import commnet
from captcha.fields import CaptchaField
class commentform (forms.ModelForm):
#captcha = CaptchaField()
class Meta:
model = commnet
fields = ['post','name','subject','messa... | StarcoderdataPython |
3243596 | <gh_stars>0
import datetime
import json
from typing import List, Dict, Union
import dateutil.parser
import requests
from requests import Response
class BotmanApi:
def __init__(self, base_url: str, token: str, cert=False, timeout: int = 5):
self.base_url = base_url + "{path}"
self.token = token
... | StarcoderdataPython |
8005894 | <gh_stars>1-10
from bson.binary import OLD_UUID_SUBTYPE
from pymongo.common import WriteConcern
from database import Database
from bson.json_util import dumps, loads
from bson.objectid import ObjectId
import json
class Connection():
database_path = None
def __init__(self, database_path, tz_aware=False, **... | StarcoderdataPython |
3449786 | """
Autor: <NAME>
Formula de Kamenetsky
Complexidade: O(1)
A formula de kamenetsky permite saber quantos
digitos tem o fatorial de um numero qualquer > 0
sem precisar calcular seu fatorial.
"""
def kamenetsky(number):
"""
:param number: O numero do fatorial
:return: Quantidade de digit... | StarcoderdataPython |
8040888 | <reponame>mrmotallebi/pytorch_geometric
from math import pi as PI
import torch
class Spherical(object):
r"""Saves the spherical coordinates of linked nodes in its edge attributes.
Args:
norm (bool, optional): If set to :obj:`False`, the output will not be
normalized to the interval :math... | StarcoderdataPython |
9728547 | <filename>mri-2d-resnet18-cam-norm.py
"""
Class Activation Map for ResNet-18 with 2D Tensor of MRI slices.
Normalize the response over small subset of patches from all classes.
author: <NAME>
email: <EMAIL>
date: 10-03-2019
"""
import torch
from torch import nn
import matplotlib.pyplot as plt
from matplotlib.pyplot i... | StarcoderdataPython |
5185592 | # Script to
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
file_name = '/home/jon/PycharmProjects/jon-insight-project/data/processed/pa_course_database_processed.plk'
df = pd.read_pickle(file_name)
#print(df.head())
sns.distplot(df.rating.dropna(), bins=10)
plt.sh... | StarcoderdataPython |
5182179 | from .align import align
import docopt
import re
import collections
import os
import sys
import numpy as np
import pandas as pd
from Bio import SeqIO
import seaborn as sns
import matplotlib.pyplot as plt
def determine_thresholds():
"""
Run routine to determine the positive pair thresholds for all given opening... | StarcoderdataPython |
6651214 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
import cached_auth
try:
from django.contrib.auth ... | StarcoderdataPython |
9712454 | <reponame>suhasksv/py-ground<filename>syn_py.py<gh_stars>1-10
# defining a function
def greet(friends):
for i in friends:
print("Hi", i)
friend = ["Python", "Go", "HTML5", "Java", "C", "C++"]
greet(friend)
print("\n")
def price(price):
tax = (price * 0.06)
final = tax + price
return "The pric... | StarcoderdataPython |
5033989 | <filename>src/d02_intermediate/preprocess_4_travel_time.py
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import geopandas as gpd
import pickle
# system path
import sys
import os
# util path
utility_path = os.path.join(os.getcwd(),'src/d00_utils/')
sys.path.append(utility_path)
import utilitie... | StarcoderdataPython |
11296960 | import traceback
__author__ = '<NAME> (<EMAIL>)'
from virtualisation.wrapper.history.abstractreader import AbstractReader
from virtualisation.misc.buffer import Buffer
from virtualisation.misc.lists import TimestampedList, BufferedTimestampedList
from virtualisation.misc.log import Log
import csv
import os.path
class... | StarcoderdataPython |
6672095 | <filename>utils.py<gh_stars>0
from math import sqrt
import numpy as np
import shutil
import os
# =============================================================================
# Confidence Intervel for Sensitivity and Specificity
# The Confidence Interval use Wilson Score interval formula to calculate
# the upper ... | StarcoderdataPython |
3230323 | <reponame>niksell/phenotypes-prediction-using-genotypes-Master-Thesis
import os.path
import time
import numpy as np
from DataStructure.PatientPhenotype import PatientPhenotype
from DataStructure.Snp import Snp
class Output:
def __init__(self,path,numberOfChromosomes):
self.__path = path
... | StarcoderdataPython |
9657396 | import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
import time
Motor1A = 16
Motor1B = 18
Motor2A = 11
Motor2B = 15
GPIO.setup(Motor1A,GPIO.OUT)
GPIO.setup(Motor1B,GPIO.OUT)
GPIO.setup(Motor2A,GPIO.OUT)
GPIO.setup(Motor2B,GPIO.OUT)
def backward():
print("Going Back")
GPIO.output(Motor1A,GPIO.HIGH)
GPIO.output(Moto... | StarcoderdataPython |
6432332 | <reponame>avilcheslopez/geopm
#!/usr/bin/env python3
#
# Copyright (c) 2015 - 2022, Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause
#
'''
Example frequency sweep experiment using geopmbench.
'''
from experiment.frequency_sweep import frequency_sweep
from apps.geopmbench import geopmbench
if __name__ ==... | StarcoderdataPython |
1975239 | # Copyright 2018 Open Source Robotics Foundation, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | StarcoderdataPython |
1872725 | <reponame>oscarbatori/doltpy
from typing import List, Callable, Any, Mapping, Iterable
import pandas as pd
from doltpy.core.dolt import Dolt, DEFAULT_HOST, DEFAULT_PORT
import logging
import io
import tempfile
from datetime import datetime, date, time
from sqlalchemy import String, DateTime, Date, Integer, Float, Table... | StarcoderdataPython |
5092299 | <gh_stars>1-10
"""
Interface for using a web3 provider
"""
from typing import Optional
from src.utils import helpers
from src.utils.config import shared_config
from src.utils.multi_provider import MultiProvider
from web3 import HTTPProvider, Web3
web3: Optional[Web3] = None
def get_web3():
# pylint: disable=W0... | StarcoderdataPython |
8157644 | <filename>mmdet/datasets/icdar/tools/__init__.py
from .script import icdar_eval_tool | StarcoderdataPython |
3409141 | <gh_stars>0
import re
from basebot import BaseBot
HQ_expression = re.compile(r"HQ:(\d+)Id:(\d+)")
UNIT_expression = re.compile(r"U:(\d+)Id:(\d+)")
BLOCK_expression = re.compile(r"B")
class InvalidActionException(Exception):
pass
class PointInMap(object):
def __init__(self, coord_x, coord_y):
self.... | StarcoderdataPython |
11371882 | <reponame>uktrade/auditinater
import requests
def strip_bearer(token):
"""Strip the bearer text from the token if present
:returns: The token string without the bearer keyword.
E.g.::
'bearer 1234' -> '1234'
'1234' -> '1234'
"""
# remove trailing spaces
_token = token.strip... | StarcoderdataPython |
6622879 | <reponame>jkunimune15/kodi-analysis
import matplotlib.pyplot as plt
import numpy as np
import perlin
r = np.sqrt(np.random.random(1000000))
t = 2*np.pi*np.random.random(1000000)
x, y = r*np.cos(t), r*np.sin(t)
dx, dy = np.zeros(x.shape), np.zeros(y.shape)
for n in range(0, 3):
dx += perlin.perlin(x, y, 2**(-n), 0.1... | StarcoderdataPython |
3569076 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 20 2016
@author: <EMAIL>
Poles and zeros were calculated in Maxima from circuit component values which
are listed in:
https://www.itu.int/dms_pubrec/itu-r/rec/bs/R-REC-BS.468-4-198607-I!!PDF-E.pdf
http://www.beis.de/Elektronik/AudioMeasure/WeightingFilters.html#CCIR
http... | StarcoderdataPython |
5123748 | import sys
import os
import errno
import time
import json
import glob
import argparse
from base64 import b64decode
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
class Handler(FileSystemEventHandler):
def __init__(self, args):
self.traefik_version = args.traefikV... | StarcoderdataPython |
129801 | from logging import getLogger
from typing import Tuple, Union
import torch
from torch import nn
from torch.nn.utils import spectral_norm
from ..modules import init_xavier_uniform
from ..modules.lightweight import SimpleDecoderBlock
logger = getLogger(__name__)
logger.debug('スクリプトを読み込みました。')
class SimpleDecoder(nn.M... | StarcoderdataPython |
4889617 | <filename>data/pakistan-data/crawler.py
from selenium import webdriver
from datetime import datetime, timedelta
import requests
import time
opts = webdriver.FirefoxOptions()
opts.add_argument("--headless")
driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub',
desired_cap... | StarcoderdataPython |
6496477 |
from threading import Timer
def delayed(seconds):
def decorator(f):
def wrapper(*args, **kargs):
t = Timer(seconds, f, args, kargs)
t.start()
return wrapper
return decorator
@delayed(3)
def timer_print():
print "timer_print"
for i in range(3):
timer_print() | StarcoderdataPython |
4889236 | <filename>demo/demo.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import logging
import multiprocessing as mp
import numpy as np
import os
import torch
from detectron2.config import get_cfg
from detectron2.data import MetadataCat... | StarcoderdataPython |
6493679 | import discord
from discord.ext import commands
import datetime
import traceback
import time
class CommandLogging(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.bot.info_channel_id = 527373033568993282
self.bot.mod_commands = []
async def on_command(self, ctx):
ct... | StarcoderdataPython |
11209496 | """
Trace object space traces operations and bytecode execution
in frames.
"""
from pypy.tool import pydis
from pypy.rlib.rarithmetic import intmask
# __________________________________________________________________________
#
# Tracing Events
# _________________________________________________________________... | StarcoderdataPython |
273067 | import configargparse
def config_parser():
parser = configargparse.ArgumentParser()
parser.add_argument('--config', is_config_file=True,
help='config file path')
parser.add_argument("--expname", type=str,
help='experiment name')
parser.add_argument("--b... | StarcoderdataPython |
9721350 | import io
import time
import picamera
import asyncio
import file_naming_manager
import os
import time
from subprocess import call
import base64
#make sure the video_detections folder exists
class CameraHandler:
def __init__(self, parent):
self.parent = parent
self.dir_path = os.path.dirname(os.path... | StarcoderdataPython |
8187935 | """
<http://ircv3.net/specs/extensions/tls-3.1.html>
"""
from irctest import cases
from irctest.basecontrollers import NotImplementedByController
class StarttlsFailTestCase(cases.BaseServerTestCase):
@cases.SpecificationSelector.requiredBySpecification('IRCv3.1')
def testStarttlsRequestTlsFail(self):
... | StarcoderdataPython |
1993634 | # Copyright 2016-2020 Swiss National Supercomputing Centre (CSCS/ETH Zurich)
# ReFrame Project Developers. See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: BSD-3-Clause
import os
import reframe as rfm
import reframe.utility.sanity as sn
@rfm.required_version('>=2.14')
@rfm.simple_test
class G... | StarcoderdataPython |
136926 | <gh_stars>0
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Registration(models.Model):
title = models.CharField(max_length=200)
newstext = models.CharField(max_length=200)
newsvideourl = models.CharField(max_length=200)
fburl = models.CharFi... | StarcoderdataPython |
3523685 | <reponame>elizabethandrews/llvm<gh_stars>100-1000
# DExTer : Debugging Experience Tester
# ~~~~~~ ~ ~~ ~ ~~
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-ex... | StarcoderdataPython |
3248271 | #!/usr/bin/env python
import sys,os,time
def send_angles(j1,j2,j3,j5,j6,wait):
with open("/run/shm/angles.tmp","w") as f:
f.write("%d,%d,%d,%d,%d\n" % (j1,j2,j3,j5,j6))
f.flush()
os.rename("/run/shm/angles.tmp","/run/shm/angles")
time.sleep(wait)
if __name__ == "__main__" :
send_angles(0,0,90,90,0,2.0)
fo... | StarcoderdataPython |
11390487 | # -*- encoding: utf-8 -*-
"""
Basic account handling. Most of the openid methods are adapted from the
Flask-OpenID documentation.
"""
from flask import Blueprint, session, redirect, render_template, request,\
flash, g, url_for
import pygraz_website as site
import uuid
import hashlib
from pygraz_website import ... | StarcoderdataPython |
144547 | #
# -*- coding: utf-8 -*-
#
# This file is part of reclass
#
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import copy
import itertools as it
import operator
import pyparsing as pp
from six import iteritems
from six... | StarcoderdataPython |
6653148 | <filename>src/lstm.py
#!/usr/bin/env python3 -u
import chainer
import chainer.links as L
import chainer.functions as F
from general_model import GeneralModel
import numpy as np
def sequence_embed(embed, xs):
x_len = [len(x) for x in xs]
x_section = np.cumsum(x_len[:-1])
ex = embed(F.concat(xs, axis=0))
... | StarcoderdataPython |
9704166 | begin_unit
comment|'# Licensed under the Apache License, Version 2.0 (the "License"); you may'
nl|'\n'
comment|'# not use this file except in compliance with the License. You may obtain'
nl|'\n'
comment|'# a copy of the License at'
nl|'\n'
comment|'#'
nl|'\n'
comment|'# http://www.apache.org/licenses/L... | StarcoderdataPython |
6663325 | <filename>WorldTime/test.py
###
# Copyright (c) 2014, spline
# Copyright (c) 2020, oddluck <<EMAIL>>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must ret... | StarcoderdataPython |
308554 | <reponame>usegalaxy-no/usegalaxy
# -*- coding: utf-8 -*-
# Copyright 2020 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
class FactDiffBase:
def __init__(self, task_args,... | StarcoderdataPython |
11231437 | <reponame>lenguyenthanh/heltour
# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-12-30 22:04
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tournament', '0127_auto_20161230_1947'),
]
operation... | StarcoderdataPython |
1947314 | <filename>fb_scrape_public.py
'''
This script can download posts and comments from public Facebook pages. It requires Python 3.
INSTRUCTIONS
1. This script is written for Python 3 and won't work with previous Python versions.
2. The main function in this module is scrape_fb. It is the only function most users w... | StarcoderdataPython |
1871135 | <reponame>lfx/honeybadger-python<filename>honeybadger/contrib/flask.py<gh_stars>0
from __future__ import absolute_import
import logging
from honeybadger import honeybadger
from honeybadger.plugins import Plugin, default_plugin_manager
from honeybadger.utils import filter_dict
from six import iteritems
logger = loggi... | StarcoderdataPython |
8129038 | <gh_stars>10-100
# Copyright (c) 2018 FlashX, LLC
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge,... | StarcoderdataPython |
1638037 | # main script 1 - robin_crypto_info.py
import robin_stocks
from robin_stocks import *
import robin_stocks.robinhood as r
import time
import os
from twilio.rest import Client
from math import log10, flooR
account_sid = os.environ['account_sid']
auth_token = os.environ['auth_token']
client = Client(account_sid, auth_t... | StarcoderdataPython |
3442769 | <gh_stars>0
from django.db import models
from django.urls import reverse, reverse_lazy
class ReferenceQuestion(models.Model):
message = models.TextField(blank=True, null=True)
is_anonymized = models.BooleanField(blank=True, null=True, default=False)
lh3ChatID = models.PositiveIntegerField(blank=True, null... | StarcoderdataPython |
11308678 | <filename>aria/modeling/service_changes.py
# 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, Vers... | StarcoderdataPython |
1739043 | <reponame>saadidrees/dynRet
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 18 14:53:08 2022
@author: <NAME>, <NAME>'s Lab, York University
<EMAIL>
This is a custom keras layer that converts light stimulus (R*/rod/s) into photoreceptor currents by using a biophysical model
of the photoreceptors ... | StarcoderdataPython |
6543643 | <filename>motion_planning.py
import numpy as np
from utils_3D import Motion_Planer
if __name__ == "__main__":
data = [[1, 10,10, 0,20, 20,20, 10,30, 15], [0, 1,1, 4,4, 1,4, 4,1, 17], [0, 18,-4, 24,2, 18,8, 12,2, 17]]
"""
****data descripe the buildings or obstacles****
data: [z, a_x,a_y, b_x,b_y, c_x... | StarcoderdataPython |
9621958 | # -*- coding: utf-8 -*-
"""Conservation urls."""
from django.urls import path
from . import views
app_name = 'conservation'
urlpatterns = [
path('threats/',
views.ConservationThreatListView.as_view(),
name="conservationthreat-list"),
path('threats/<int:pk>/',
views.ConservationThre... | StarcoderdataPython |
9777818 | <filename>prosit/constants.py
DATA_PATH = "/root/data.hdf5"
MODEL_SPECTRA = "/root/model_spectra/"
MODEL_IRT = "/root/model_irt/"
OUT_DIR = "/root/prediction/"
VAL_SPLIT = 0.8
TRAIN_EPOCHS = 500
TRAIN_BATCH_SIZE = 1024
PRED_BATCH_SIZE = 1024
PRED_BAYES = False
PRED_N = 100
TOLERANCE_FTMS = 25
TOLERANCE_ITMS = 0.35
T... | StarcoderdataPython |
9729862 | """Testing the metrics developed to asses performance of a ride."""
# Authors: <NAME> <<EMAIL>>
# <NAME>
# License: MIT
import pytest
import pandas as pd
import numpy as np
from sksports.metrics import normalized_power_score
from sksports.metrics import intensity_factor_score
from sksports.metrics import t... | StarcoderdataPython |
92727 | <filename>inferelator_prior/motifs/fimo.py
import io
import subprocess
import pandas as pd
import numpy as np
import pandas.errors as pde
from inferelator_prior import FIMO_EXECUTABLE_PATH
from inferelator_prior.motifs import meme, chunk_motifs, SCAN_SCORE_COL, SCORE_PER_BASE
from inferelator_prior.motifs._motif impor... | StarcoderdataPython |
3485462 | # coding: utf-8
"""
VNS3 Controller API
Cohesive networks VNS3 API providing complete control of your network's addresses, routes, rules and edge # noqa: E501
The version of the OpenAPI document: 4.8
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
from __future__ import absol... | StarcoderdataPython |
8041781 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: kangliang
date: 2019-12-25
"""
import configparser
from poseidon.core.output import *
def get_ini_info(file, section, key):
config = configparser.ConfigParser()
config.read(file, encoding="utf-8")
_value = config.get(section, ke... | StarcoderdataPython |
6562862 | <reponame>doanthevu1910/ams-real-estate
import matplotlib.pyplot as plt
y = rf.feature_importances_
list_y = [a for a in y if a > 0.005]
print(list_y)
list_of_index = []
for i in list_y:
a = np.where(y==i)
list_of_index.append(a)
print(list_of_index)
list_of_index = [0, 1]
col = []
for i in feature_list:
... | StarcoderdataPython |
4926691 | <gh_stars>0
###############################################
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
> File Name: urls.py
> Author: lixuebin
> Mail: <EMAIL>
> Created Time: 2019年08月04日 星期日 07时17分51秒
"""
################################################
from django.urls import path, re_path
from . import vi... | StarcoderdataPython |
1725752 | # SPDX-License-Identifier: MIT
import sys, json, os, re, requests
import nvd, scancode
from glob import glob
from os import path, remove
from subprocess import call
from collections import OrderedDict
from shutil import rmtree
def main(argv):
if len(argv) <= 1:
print("Usage: ./riskmetrics.py <github-rep... | StarcoderdataPython |
3520237 | import random
import math
import sqlite3
import pytest
import genomicsqlite
def test_twobit_random():
con = genomicsqlite.connect(":memory:")
random.seed(42)
for seqlen in (random.randint(2, 1250) for _ in range(5000)):
rna = random.choice((False, True))
nucs = (
("a", "A", "... | StarcoderdataPython |
8157288 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@version: 1.0
@author: li
@file: cnn_model.py
@time: 2020/1/8 2:51 下午
"""
import tensorflow as tf
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
class TCNNConfig(object):
"""CNN配置参数"""
embedding_dim = 64 # 词向量维度
seq_length = 600 # 序列长度
num_cl... | StarcoderdataPython |
1640359 | <reponame>stevebob/camkes-cli<gh_stars>0
import multiprocessing
import toml
from . import common
def make_subparser(subparsers):
parser = subparsers.add_parser('init', description="Initialize an existing project")
parser.add_argument('--jobs', type=int, help="Number of threads to use when downloading code",
... | StarcoderdataPython |
6659308 | <gh_stars>0
"""
given an encoded relation, and an example of this relation (or not), can we classify
it correctly?
means, no need for any nlp bits, or REINFORCE.
let's us test various ways of using the encoded relation to classify the image
a few ways we can try:
- concatenate the encoding with that of the image
- d... | StarcoderdataPython |
6416734 | # Django Imports
from django.contrib.auth.decorators import login_required
from django.shortcuts import get_object_or_404
from django.shortcuts import redirect
from django.template.context_processors import csrf
from django.urls import reverse
# HTK Imports
from htk.apps.forums.forms import MessageCreationForm
from ht... | StarcoderdataPython |
205550 | <gh_stars>1-10
from os.path import dirname, join
from setuptools import find_packages, setup
def read_file(file):
with open(file, "rt") as f:
return f.read()
with open(join(dirname(__file__), 'transformer_pytorch/VERSION.txt'), 'rb') as f:
version = f.read().decode('ascii').strip()
setup(
... | StarcoderdataPython |
1937217 | """ResNet with Deconvolution layers for CenterNet object detection."""
# pylint: disable=unused-argument
from __future__ import absolute_import
import warnings
import math
import torch
from torch import nn
from torchvision import models
from ..model_zoo import get_model
__all__ = ['DeconvResnet', 'get_deconv_resnet'... | StarcoderdataPython |
4825058 | from minecraft.networking.packets import Packet
from minecraft.networking.types import (
Double, Float, Byte, VarInt, BitFieldEnum, PositionAndLook
)
class PlayerPositionAndLookPacket(Packet, BitFieldEnum):
@staticmethod
def get_id(context):
return 0x32 if context.protocol_version >= 389 else \
... | StarcoderdataPython |
3546176 | import sys
import numpy as np
from os.path import join as opj
from brainiak.searchlight.searchlight import Searchlight
from nilearn.image import load_img
from scipy.stats import pearsonr
from searchlight_config import config
# voxel function for searchlight
def sfn(l, msk, sl_rad, bcast_var):
video_corrs, diag_ma... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.