id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
3379826 | import pickle
import sys
##########################################################
# usage
# pypy get_jump_map.py xid_train.p ../../data/train ./jump_train ./jump_map_train
# xid_train.p is a list like ['loIP1tiwELF9YNZQjSUO',''....] to specify
# the order of samples in traing data
# ../../data/train is the path of ... | StarcoderdataPython |
131009 | <gh_stars>0
# local
from ..misc import are_you_sure
from ..subcommand import ServiceCommand
class RestartCommand(ServiceCommand):
"""kiwi restart"""
def __init__(self):
super().__init__(
'restart', num_projects='?', num_services='*',
action="Restarting",
descriptio... | StarcoderdataPython |
4822753 | <reponame>mplusc/Web-Scraping
# coding: utf-8
# In[1]:
# Import Libraries
from bs4 import BeautifulSoup as bs
import pandas as pd
import requests
from splinter import Browser
# In[2]:
# Create executable path using Chrome
executable_path = {'executable_path': 'chromedriver.exe'}
browser = Browser('chrome', **ex... | StarcoderdataPython |
178421 |
from greenclock.utils import Scheduler, every_second, every_hour
from datetime import datetime
import time
def func_1():
print('Calling func_1() at ' + str(datetime.now()))
time.sleep(2)
print('Ended call to func_1() at ' + str(datetime.now()))
def func_2():
print('Calling func_2() at ' + str(datet... | StarcoderdataPython |
3255424 | <filename>steps/console/prompt.py
from steps.console import align
def choice(numbers, choices, prompt='\nEnter choice: ', error='Invalid choice.'):
'''
Prompt user for choice
Return an integer of valid choice
'''
assert len(numbers) == len(choices), 'Length of list of numbers and list of choices must be the same.... | StarcoderdataPython |
21845 | su = 0
a = [3,5,6,2,7,1]
print(sum(a))
x, y = input("Enter a two value: ").split()
x = int(x)
y = int(y)
su = a[y] + sum(a[:y])
print(su) | StarcoderdataPython |
3388791 | <reponame>Entertrainer-robot/gazebo<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 10 22:09:18 2020
@author: psuba
"""
import numpy as np
import matplotlib.pyplot as plt
def deg_2_rad(deg):
return (deg*np.pi)/180
def time_of_flight(v_0,theta,g):
'''
Returns the time of flight for the whole jo... | StarcoderdataPython |
3244338 | <gh_stars>1-10
from rest_framework import viewsets
from rest_framework.permissions import AllowAny
from djangoapps.features.models import Feature
from djangoapps.features.serializers import FeatureSerializer
class FeatureViewSet (viewsets.ModelViewSet):
""" ViewSet for viewing and editing Feature objects """
... | StarcoderdataPython |
90157 | import datetime
from datetime import date
import pandas as pd
import numpy as np
import boto3
import smtplib
import matplotlib.pyplot as plt
import os
try:
os.mkdir('output_files')
except:
pass
data = pd.read_json('https://raw.githubusercontent.com/pomber/covid19/master/docs/timeseries.json')
s3 = boto3.reso... | StarcoderdataPython |
3361801 | def front_times(str, n):
if len(str) < 3:
return str * n
return str[:3] * n
| StarcoderdataPython |
121317 | #!/usr/bin/python3
import pyaudio
import os
import numpy as np
from scipy.interpolate import UnivariateSpline
from scipy.signal import butter, lfilter, filtfilt, resample
from scipy.optimize import curve_fit
import scipy as sp
import time
import pygame
from pygame.locals import *
from pygame import gfxdraw
from pygame ... | StarcoderdataPython |
1623829 | from turbogears.database import PackageHub
# import some basic SQLObject classes for declaring the data model
# (see http://www.sqlobject.org/SQLObject.html#declaring-the-class)
from sqlobject import SQLObject, SQLObjectNotFound, RelatedJoin
# import some datatypes for table columns from SQLObject
# (see http://www.sql... | StarcoderdataPython |
80395 | <reponame>Zhao-Jichao/Python_DL_based_PyTorch<gh_stars>1-10
# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
# 程序选择框
# ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ParX =('Par8.1.2', 'Par8.1.3', 'Par8.3')
ParX_val = ParX[1]
print("正在运行第 "+ParX_val+" 节程序......")
# '''''''''''... | StarcoderdataPython |
58866 | # Copyright (C) 2018 Innoviz Technologies
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD 3-Clause license. See the LICENSE file for details.
import pandas as pd
import os
import numpy as np
from utilities.math_utils import RotationTranslationData
from visualizatio... | StarcoderdataPython |
3256850 | <gh_stars>1-10
import requests
from DiscordHooks import Embed, EmbedField, EmbedThumbnail, Color
import datetime
from discord import send_data
languages = {
'da': 'Danish, Denmark',
'de': 'German, Germany',
'en-GB': 'English, United Kingdom',
'en-US': 'English, United States',
'es-ES': 'Spanish, Spa... | StarcoderdataPython |
1781301 | import sys
import pygame
import random
from cell import *
from grid import *
def recursive_dfs(currentCell, grid):
# 1. Given current cell as a parameter
# 2. Make the current cell as visited
currentCell.visited = True
# while the current cell has any unvisited neighbor cells
neighbors = g... | StarcoderdataPython |
1652730 | # Copyright 2019 The Forte Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | StarcoderdataPython |
3312418 | from __future__ import absolute_import
from .pyadexceptions import *
# http://msdn.microsoft.com/en-us/library/aa772263(VS.85).aspx
ADS_GROUP_TYPE = {
'GLOBAL':0x2,
'LOCAL':0x4,
'UNIVERSAL':0x8,
'SECURITY_ENABLED':-0x80000000}
# http://msdn.microsoft.com/en-us/library/aa772300.aspx
ADS_US... | StarcoderdataPython |
4822345 | from enum import Enum
class ProductStream(Enum):
"""Product stream"""
BATTERY = 'BATTERY'
"""Battery"""
PACKAGING = 'PACKAGING'
"""Packaging products"""
OTHER_PETROL = 'OTHER_PETROL'
"""Other petroleum product"""
ELECTRONIC = 'ELECTRONIC'
"""The electric appliance, electronic equip... | StarcoderdataPython |
1603060 | <filename>v0.1/concentration_ponds/utils/EvaporationPonds.py<gh_stars>1-10
import classes as cl
import datetime
import formulas as f
import json
import math
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.dates import (MONTHLY, DateFormatter, rrulewrapper, RRuleLocator, drange)
import numpy as np
impo... | StarcoderdataPython |
12481 | <filename>leaderboard/scenarios/background_activity.py
#!/usr/bin/env python
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
"""
Scenario spawning elements to make the town dynamic and interesting
"""
import math
from collections import OrderedDi... | StarcoderdataPython |
4832889 | <reponame>Uatapatau/rustack-esu
import pytest
from esu.base import NotFoundEx
from esu.client import Client
from esu.project import Project
from esu.tests import load_fixtures
from esu.vdc import Vdc
@load_fixtures
def test_not_found_by_id(rsps):
project_id = '20000000-2000-2000-2000-200000000000'
with pytes... | StarcoderdataPython |
3326695 | <filename>eskanafarin_scrapper/__init__.py
from .functions import login_session_abs24
from .functions import deactivate_abs24_session | StarcoderdataPython |
1757155 | <reponame>msHujindou/Tetris-DQN
import multiprocessing as mp
import time
import datetime
def f(x):
time.sleep(5)
return [x, x * x]
if __name__ == "__main__":
cpu_count = mp.cpu_count()
print("multiprocessing count is ", cpu_count, type(cpu_count))
start_time = datetime.datetime.... | StarcoderdataPython |
1608781 | <filename>server.py
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import altair as alt
import vega_datasets
import numpy as np
from app import data_info
import pandas as pd
import geopandas as gpd
import json
# NEW IMPORT
# See ... | StarcoderdataPython |
1747474 | """
Created on 27 Sep 2020
:author: semuadmin
:copyright: SEMU Consulting © 2020
:license: BSD 3-Clause
"""
# pylint: disable=wrong-import-position, invalid-name
from ._version import __version__
from .exceptions import UBXMessageError, UBXParseError, UBXTypeError, UBXStreamError
from .ubxmessage import UB... | StarcoderdataPython |
3293971 | <gh_stars>0
from cairio import client as ca
from PIL import Image
import json
import pandas as pd
import spikeextractors as si
def kb_read_text_file(fname):
return ca.loadText(path=fname)
def kb_read_json_file(fname):
return ca.loadObject(path=fname)
class SFSortingResult():
def __init__(self,obj,rec... | StarcoderdataPython |
1638188 | __author__ = "<NAME> <<EMAIL>>"
__date__ = "2012-01-19"
__copyright__ = "Copyright (C) 2012 <NAME>"
__license__ = "GNU LGPL version 3 or any later version"
# Last changed: 2012-01-19
from fenics import *
# Create mesh and define function space
mesh = UnitSquareMesh(32, 32)
V = FunctionSpace(mesh, "Lagrange", 1)
# ... | StarcoderdataPython |
1708568 | <gh_stars>1-10
#%%
import numpy as np
import matplotlib.pyplot as plt
# matplotlib parameters to ensure correctness of Chinese characters
plt.rcParams["font.family"] = 'sans-serif'
plt.rcParams['font.sans-serif']=['Arial Unicode MS', 'SimHei'] # Chinese font
plt.rcParams['axes.unicode_minus']=False # correct minus sig... | StarcoderdataPython |
4823712 | import re
import os
import sys
import time
import numpy
import pickle
import datetime
try:
import pycuda
except ImportError:
ans = input('PyCUDA not found. Regression tests will take forever. Do you want to continue? [y/n] ')
if ans in ['Y', 'y']:
pass
else:
sys.exit()
from pygbe.mai... | StarcoderdataPython |
3398801 | <gh_stars>0
name = "ServerName"
user = "mongo"
japd = None
host = "hostname"
port = 27017
auth = False
repset = None
repset_hosts = None
auth_db = "admin"
use_arg = True
use_uri = False
| StarcoderdataPython |
1700652 | <reponame>TirolJPN/ngweight<filename>.waf3-1.5.18-402a8e0721eb718ff717906f130db0f4/wafadmin/Tools/gcc.py
#! /usr/bin/env python
# encoding: utf-8
import os,sys
import Configure,Options,Utils
import ccroot,ar
from Configure import conftest
def find_gcc(conf):
cc=conf.find_program(['gcc','cc'],var='CC',mandatory=True)
... | StarcoderdataPython |
1790372 | <filename>svm.py<gh_stars>0
"""
Utilities for evaluating svms on neural model outputs
Useful functions:
* predict_svm_vectors -- for predicting test and training vectors
* evaluate_svm
"""
import os
import sys
import keras
from keras.preprocessing.image import ImageDataGenerator
from preprocess import apply, buil... | StarcoderdataPython |
3339416 | from utils import *
"""
Question: I is {I} and F is {F} what is the first value that
results from applying F to I
Expression: I[0]*F[0]+I[1]*F[1]... (for length of F)
Returns a train_data, test_data, and test_answers
Each is a list that contains dictionaries in the associated formats"""
def return_data(tr... | StarcoderdataPython |
4824903 | #usr/bin/python
# following script uses requests module to make GET requests w/ vt's API seems to only work on python3
import requests
params = {'apikey': , 'resource': hashes_file} # Changed order of params here
response = requests.get('https://www.virustotal.com/api/v2/file/report', params)
r = response.json()... | StarcoderdataPython |
1793239 | <gh_stars>0
# Copyright (c) 2013 OpenStack Foundation
# 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
#
... | StarcoderdataPython |
1645659 | def init(job):
from JumpScale.baselib.atyourservice81.AtYourServiceBuild import ensure_container
ensure_container(job.service, root=True)
def install(job):
from JumpScale.baselib.atyourservice81.AtYourServiceBuild import build
def build_func(cuisine):
cuisine.package.install('shellinabox')
... | StarcoderdataPython |
1765678 | # -*- coding: ascii -*-
import sys
import random
import unittest
try:
import StringIO
except ImportError:
import io as StringIO
from funtoo.core import config
class ErrorTests(unittest.TestCase):
def test_noarg(self):
error = config.ConfigFileError()
expected = "(no message)"
self.assertEqual(expected, str... | StarcoderdataPython |
3329436 | # coding=utf-8
import os
import csv
import errno
from hashlib import md5
import datetime
from django.http.response import JsonResponse
from django.conf import settings
from django.db.models import (
Case, When, F, Count, Sum, FloatField, Q
)
from django.db.models.functions import Cast
from bims.api_views.search_ver... | StarcoderdataPython |
3308725 | <reponame>kilinger/marathon-rocketchat-hubot<gh_stars>1-10
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('addons', '0014_auto_20160408_1632'),
]
operations = [
migrations.... | StarcoderdataPython |
1671915 | <filename>src/python/pants/base/generator.py<gh_stars>1-10
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pprint
import pystache
from pants.base.mustache import MustacheRenderer
# TODO(benjy): Get rid of this class? It just ... | StarcoderdataPython |
167102 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2022/3/7 23:26
# @Author : 张大鹏
# @Site :
# @File : practice01.py
# @Software: PyCharm
from zdppy_mysql import Mysql
import json
m = Mysql(db="test")
# 查询所有同学的学生编号、学生姓名、选课总数、所有课程的总成绩(没成绩的显示为null)
sql = """
select student.SId,student.Sname,t1.sumscore,t... | StarcoderdataPython |
25469 | import os
filename = os.path.dirname(__file__) + "\\input"
arrayList = []
with open(filename) as file:
for line in file:
arrayList.append(line.rstrip())
width = len(arrayList[0].rstrip())
print(f'len {width}')
gamma_nums = arrayList
for r in range(width):
start = 0
x = []
for line in gamma_num... | StarcoderdataPython |
100707 | <reponame>victor-iyi/heart-disease<filename>app/database/tables.py
# Copyright 2021 <NAME>
#
# 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
#... | StarcoderdataPython |
193047 | <gh_stars>100-1000
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import
from django.db import migrations, models
import django.db.models.deletion
import django_extensions.db.fields.json
class Migration(migrations.Migration):
dependencies = [
('nsot', '00... | StarcoderdataPython |
1665548 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
class MyModel(nn.Module):
def __init__(self, gpus):
super(MyModel, self).__init__()
self.gpus = gpus
self.NN = net() ## import model
if len(self.gpus) > 1:
self.NN = torch.nn.DataParallel(
self.NN... | StarcoderdataPython |
1708070 | import requests
# Vuln Base Info
def info():
return {
"author": "cckuailong",
"name": '''CMSimple 3.1 - Local File Inclusion''',
"description": '''Directory traversal vulnerability in cmsimple/cms.php in CMSimple 3.1, when register_globals is enabled, allows remote attackers to include and... | StarcoderdataPython |
1640482 | <reponame>antoine-amara/advent-of-code-2021<filename>advent_of_code_2021/day-2.py
from helpers.input_parser import read_input_as_dataframe
# move direction
HORIZONTAL = "horizontal"
DEPTH = "depth"
AIM = "aim"
# move list
FORWARD = "forward"
DOWN = "down"
UP = "up"
def read_input(input_name="example.txt"):
df =... | StarcoderdataPython |
1640582 | <reponame>alysivji/github-adapter
from datetime import date
import logging
from typing import NamedTuple
from dateutil.parser import parse as parse_dt
import requests
from .blueprint import cfps_bp
from .models import CallForProposalsConfiguration
from busy_beaver.common.wrappers import SlackClient
from busy_beaver.t... | StarcoderdataPython |
1777653 | # Copyright (c) 2021 RS Components Ltd
# SPDX-License-Identifier: MIT License
'''
ESDK THV board interface
'''
import smbus2
from smbus2 import i2c_msg
import time
from .DFRobot_SGP40_VOCAlgorithm import DFRobot_VOCAlgorithm
moduleVersionString = "THV0.2"
SHT_ADDR = 0x44
SGP_ADDR = 0x59
# SGP40 commands
SGP40_MEAS... | StarcoderdataPython |
1713144 | <filename>gradle-conda-plugin/examples/multi-project-example/example-app/src/main/python/example.py
class Greeter:
def __init__(self, message):
self.message = message
def greet(self, name):
return self.message + " " + name
def main():
greeter = Greeter("Good afternoon")
print(greeter... | StarcoderdataPython |
3368617 | <reponame>SfS-unsupervisedCL/project-translation_meaning_clustering<filename>Clustering.py
import sklearn.cluster.k_means_
import numpy as np
from sklearn.cluster.k_means_ import KMeans
# X is a numpy array/matrix
# K is number of desired clusters
def clusterViaKmeans(X, K):
kmeans = KMeans(n_clusters=K, random_st... | StarcoderdataPython |
1722693 | <reponame>harisbal/dash-bootstrap-components
import dash_bootstrap_components as dbc
import dash_html_components as html
from .util import make_subheading
jumbotron = html.Div(
[
make_subheading("Jumbotron", "jumbotron"),
dbc.Jumbotron(
[
html.H2("This is a jumbotron"),... | StarcoderdataPython |
1792187 | <gh_stars>10-100
import networkzero as nw0
address = nw0.discover("news1")
while True:
topic, temperature = nw0.wait_for_news_from(address)
print("Temperature is:", temperature)
| StarcoderdataPython |
1771177 | from datetime import date as date_
from typing import List
from uuid import UUID
import factory
from src.core.constants import OrderStatus
from src.core.models.order import CreateOrder
from src.core.models.order_detail import CreateOrderDetail
from .order_detail import CreateOrderDetailFactory
class CreateOrderFac... | StarcoderdataPython |
3288711 | <reponame>aineon/velvet-goldmine<filename>products/contexts.py
from products.models import Product
import random
def rand_product_list(request):
"""Generate list of random products"""
all_products = list(Product.objects.all())
rand_products = random.sample(all_products, 7)
context = {
'rand... | StarcoderdataPython |
149338 | # Copyright 2019-2022 Cambridge Quantum Computing
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | StarcoderdataPython |
56441 | """
Defining and working with payload.
"""
from aeroport.abc import AbstractPayload, AbstractField
class Field(AbstractField):
"""Container of field metadata"""
class Payload(AbstractPayload):
def postprocess(self, **kwargs):
pass
| StarcoderdataPython |
139821 | from __future__ import absolute_import
from __future__ import unicode_literals
from flask_wtf import FlaskForm
from wtforms import BooleanField, SelectField, validators
from wtforms.fields.html5 import EmailField
class ProfileEditForm(FlaskForm):
email = EmailField('Email Address', [validators.Required(), valid... | StarcoderdataPython |
3288966 | <gh_stars>0
from datetime import timedelta, datetime, time
from unittest.mock import patch
from django.contrib.auth.models import User, Permission
from django.core.exceptions import ValidationError
from django.test import TestCase
from django.utils import timezone
from make_queue.fields import MachineTypeField
from m... | StarcoderdataPython |
1655118 | # -*- coding: utf-8 -*-
from ctypes import cdll
mydll = cdll.LoadLibrary('libtest.so')
print(mydll.sum(5, 3)) | StarcoderdataPython |
3273998 | """
The sklearn directory contains ...
last modified date: Feb 21, 2016
"""
# from test import test
from . import sklearn_wrapper as sklw
__all__ = []
| StarcoderdataPython |
1730948 | <reponame>abdellaui/des_pipeline_ui
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main2.ui'
#
# Created by: PyQt5 UI code generator 5.9.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def... | StarcoderdataPython |
3362248 | from django.db import models
from django.conf import settings
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.contrib.redirects.models import Redirect
from django.core.validators import ... | StarcoderdataPython |
1677750 | <reponame>senisioi/Romanian-Transformers
from transformers import *
import torch
from sklearn.preprocessing import LabelEncoder
def load_data_from_file(path,
batch_size,
tokens_column, predict_column,
lang_model,
max_len,
... | StarcoderdataPython |
57123 | <reponame>spiralgenetics/biograph<filename>python/biograph/variants/read_cov_test.py
# pylint: disable=missing-docstring
from __future__ import print_function
import unittest
import biograph
import biograph.variants as bgexvar
def vcf_assembly(pos, ref, alt, asm_id):
pos = int(pos)-1
if ref and alt and ref[0... | StarcoderdataPython |
1729994 | import sys
import typing
from datetime import datetime
import discord
from discord.ext import commands
from sweeperbot.utilities.helpers import set_sentry_scope
class UserStats(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command(aliases=["us", "user"])
@commands.guild_only(... | StarcoderdataPython |
1663155 | <gh_stars>1-10
# 1
# 01234567890123
parrot = "Norwegian Blue"
print (parrot)
print (parrot[3:5])
print ()
print ("win")
print (parrot[:9])
print (parrot[9:])
print (parrot[:6] + parrot[6:])
print (parrot[:])
var = input (parrot[:])
print (var) | StarcoderdataPython |
174513 | <reponame>dantin/leetcode-py<filename>leetcode/implement_strstr.py
# -*- coding: utf-8 -*-
from typing import Dict
class Solution:
def strStr(self, haystack: str, needle: str) -> int:
def init_shift_mat(s: str) -> Dict[str, int]:
mat = {}
for i in range(len(s) - 1, -1, -1):
... | StarcoderdataPython |
19654 | <filename>testing_ideas/try_pymed_package/try_pymed_and_ss_api.py
# Use the pymed package to call the PubMed API to get lots of papers from, in this case, JEB
from pymed import PubMed
import pandas as pd
import requests
_REQUESTS_TIMEOUT = 3.0
df_jeb = pd.DataFrame(columns=['title', 'abstract'])
df_jeb = df_jeb.conv... | StarcoderdataPython |
95955 | import unittest
from msdm.domains import GridWorld
class GridWorldTestCase(unittest.TestCase):
def test_feature_locations(self):
gw = GridWorld([
"cacg",
"sabb"])
fl = gw.feature_locations
lf = gw.location_features
fl2 = {}
for l, f in lf.items():
... | StarcoderdataPython |
153587 | from openmdao.main.api import Assembly, Component, SequentialWorkflow, set_as_top
from math import sin
from openmdao.lib.datatypes.api import Float
from openmdao.lib.drivers.api import DOEdriver
from openmdao.lib.doegenerators.api import FullFactorial, Uniform
from openmdao.lib.components.api import MetaModel
from ope... | StarcoderdataPython |
27452 | import argparse
from functools import partial
from numbers import Number
from typing import Callable, Union, Tuple, Optional
import numpy as np
from skimage import img_as_uint
from starfish.errors import DataFormatWarning
from starfish.image import ImageStack
from starfish.pipeline.filter.gaussian_low_pass import Gau... | StarcoderdataPython |
1766004 | <gh_stars>0
import pytest
from .load import Load, PointLoad, UniformLoad
def test_generic_load():
l = Load(magnitude=5, direction='Y', label='car', description='weight of car')
assert l.magnitude == 5
assert l.direction == 'Y'
assert l.label == 'car'
assert l.description == 'weight of car'
a... | StarcoderdataPython |
4820116 | <filename>scripts/publisher_node.py
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from object_recognition_pkg.msg import data_completed
def talker():
# pub = rospy.Publisher('chatter', String, queue_size=10)
pub = rospy.Publisher('chatter', data_completed)
rospy.init_node('publishe... | StarcoderdataPython |
89367 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------
# cssqc/noUnderscores.py
#
# Do not underscores in class, id and mixin names.
# ----------------------------------------------------------------
# copyright (c) 2014 - <NAME>
# Distributed under The MIT Li... | StarcoderdataPython |
3371210 | <gh_stars>1-10
"""
inserts data from file into database
"""
import requests
import json
from tqdm import tqdm
from pprint import pprint
from itertools import count
import pandas as pd
uri = 'http://localhost:8000/articles/batch'
def add_large_datasets():
filenames = ["aylien.parquet", "cord19.parquet"]
batc... | StarcoderdataPython |
1776829 | #!/usr/bin/python
import os
import sys
import socket
import urllib.request
import boto3
client = boto3.client('route53')
def getPublicIP():
print('Retrieving public IP address')
ip = urllib.request.urlopen('https://checkip.amazonaws.com').read().decode('utf-8').rstrip()
print(ip)
return ip
def getCu... | StarcoderdataPython |
3284259 | <gh_stars>1-10
def main():
"""
Main thread:
for each source in sources do get_source
can we hold a websocket connection? one for all sources or each?
if on air then spawn a ffmpeg subprocess and a (optional) danmaku process
need to rewrite a new processor for ffmpeg, danmaku and ... | StarcoderdataPython |
118714 | import json
import os
import io
import re
from collections import defaultdict
import flask
from flask import Flask
app = Flask(__name__)
#ndcg_eval_dir = "data/ndcg_eval_dir"
origs = {}
needed_judgements = defaultdict(list)
# From http://stackoverflow.com/questions/273192/how-to-check-if-a-directory-exists-and-cre... | StarcoderdataPython |
4829227 | <filename>tests/python/pants_test/process/test_xargs.py
# 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, print_function, unicode_literals
import errno
import os
import uni... | StarcoderdataPython |
3388134 | # Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioTaskRouterClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "<KEY>"
auth_token = "<PASSWORD>"
workspace_sid = "WSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
worker_sid = "WKXXXXXXXXXXXXXXXXXXX... | StarcoderdataPython |
93690 | # Generated by Django 3.1.5 on 2021-01-23 06:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0057_auto_20210122_2049'),
]
operations = [
migrations.AddField(
model_name='exam',
name='m... | StarcoderdataPython |
1675766 | <filename>scrapy/tabelog/tabelog/__pycache__/items.py<gh_stars>0
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class TabelogItem(scrapy.Item):
# define the fields for your item here like:
... | StarcoderdataPython |
1646536 | '''
Author: <NAME>
Big Data Final Project
Secondary Protein Structure
interpret the fasta files
'''
import get_scores
import pickle
def read_fasta(filename):
'''reads in the fasta files and creates the desired data structures'''
names = []
seqids = []
descriptions = []
sequences = []
for lin... | StarcoderdataPython |
1715661 | <reponame>dkajtoch/datasets<filename>datasets/ar_cov19/ar_cov19.py
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may... | StarcoderdataPython |
23610 | <reponame>angrydill/ItsyBitser<gh_stars>0
#!/usr/bin/env python3
""" Packs/unpacks Hextream content to/from the Varipacker format """
import sys
import argparse
from itsybitser import hextream, varipacker
def main():
""" Program entry point """
parser = argparse.ArgumentParser(
description="Packs/unp... | StarcoderdataPython |
3216276 | from entity.conf import settings
from entity.utils.importers import import_class
from rest_framework import viewsets
authentication = import_class(settings.API_AUTHENTICATION_CLASS)
permission = import_class(settings.API_PERMISSION_CLASS)
pagination = import_class(settings.API_PAGINATION_CLASS)
class BaseViewSet(vie... | StarcoderdataPython |
3289614 | # OpenCascade tutorial by headfire (<EMAIL>)
# point and line attributes
import sys
sys.path.insert(0, "../scene")
from scene import ScInit, ScPoint, ScLine, ScCircle, ScShape, ScLabel, ScStart, ScStyle
from OCC.Core.gp import gp_Pnt, gp_Trsf, gp_Dir, gp_Vec, gp_Ax1, gp_Ax2, gp_GTrsf, gp_OZ
from OCC.Core.Geom import... | StarcoderdataPython |
3305117 | #
# Define some helper functions which provide text such as build options
# and library lists to be used in SConstruct. Also there are a few functions
# that perform little tasks - put here to keep SConstruct more readable.
#
from glob import glob
import os, re, string
import sys
import subprocess
# Check that some... | StarcoderdataPython |
3235021 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys;
sys.dont_write_bytecode = True;
import os;
import signal;
from utilities import *;
import decoder;
reload(sys);
sys.setdefaultencoding("utf-8");
if len(sys.argv) < 2:
eprint("usage: " + sys.argv[0] + " [filename]");
exit();
if not os.path.exists(sys.ar... | StarcoderdataPython |
29157 | import torch
import torch.nn.functional as F
from torch import nn
from util.misc import (NestedTensor, nested_tensor_from_tensor_list,
accuracy, get_world_size, interpolate,
is_dist_avail_and_initialized)
from .backbone import build_backbone
from .matcher import build_mat... | StarcoderdataPython |
1627826 | """
This is the main script that runs all modules.
"""
import os
import argparse
import datetime as dt
os.chdir('C:\\Users\\flint\\OneDrive\\Dokumenter\\GitHub\\Recession-Predictor') # my own
#os.chdir(os.path.dirname(os.path.abspath(__file__)))
import src.data.make_dataset as mk
import src.features.build_features_a... | StarcoderdataPython |
1707576 | <reponame>linklab-uva/deepracing<gh_stars>10-100
import scipy
import scipy.integrate
import scipy.interpolate
from scipy.interpolate import make_interp_spline as mkspl
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.axes import Axes
from matplotlib.figure import Figure
import num... | StarcoderdataPython |
123117 | <reponame>vladstreltsin/blox
from blox_old.core.persistence.base import Persister, PersisterError
from blox_old.utils import join_not_none
from blox_old.core.block.base import Port
from blox_old.core.engine import Session, DefaultDevice
class PortPersister(Persister):
def can_save(self, obj, *args, **kwargs):
... | StarcoderdataPython |
44261 | <reponame>netMedi/hl7apy
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018, CRS4
#
# 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 righ... | StarcoderdataPython |
178185 | import orm_mfk
from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=orm_mfk.engine)
session = Session()
addr1 = orm_mfk.Address(street="adsfad")
addr2 = orm_mfk.Address(street="123")
addr3 = orm_mfk.Address(street="2321asd")
c1 = orm_mfk.Customer(name="jack", billing_address = addr1, shiping_address=... | StarcoderdataPython |
1650543 | import datetime
import json
import logging
from collections import Counter
from typing import List
from django.utils import timezone
from orders.exceptions import OrderException
from orders.models import Order, Product, Shift
from users.models import User
def execute_data_minimisation(dry_run=False):
"""
Re... | StarcoderdataPython |
4827253 | <gh_stars>1-10
# coding=utf-8
import math
class Solution:
"""
计数质数
"""
def count_primes(self, n: int) -> int:
"""
Time: O(n*log(log(n))), Space: O(n)
:param n:
:return:
"""
if n <= 2:
return 0
primes = [True for _ in range(n)]
... | StarcoderdataPython |
3285139 | #!/bin/python3
from aws_helpers.s3 import S3Bucket, S3Client
import argparse
from boto3.session import Session
import json
import os
import subprocess
BUCKET_NAME = 'ellen-zehra.me'
BUCKET_REGION = 'eu-west-1'
def create_parser():
"""Create parser object used for defining all options for locust-nest.
Return... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.