id stringlengths 1 265 | text stringlengths 6 5.19M | dataset_id stringclasses 7
values |
|---|---|---|
40588 | from .objects import schema
from tests.graphql.graphql_test_utils import GraphQLTestCase, remove_ws
class Test(GraphQLTestCase):
GRAPHQL_SCHEMA = schema
REF_GRAPHQL_SCHEMA = """
schema {
query: Query
}
type ActionInfo {
name: String!
parameters: [... | StarcoderdataPython |
121095 | from django.contrib import messages
from django.contrib.auth import login
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import PasswordChangeView
from django.contrib.sites.shortcuts import get_current_site
from django.core.mail import EmailMessage
from django.db import transac... | StarcoderdataPython |
3254002 | # Copyright 2021-2022 NVIDIA 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 required by applicable law or agreed to ... | StarcoderdataPython |
1790207 | import os
from invoke import task
from os import path as osp
from subprocess import list2cmdline
repo_url = 'https://upload.pypi.org/legacy/'
os.chdir(osp.dirname(osp.dirname(__file__)))
@task
def init(ctx):
ctx.run('pip install -e .')
@task
def test(ctx):
ctx.run('tox')
@task
def build(ctx):
ctx.... | StarcoderdataPython |
1726943 | #!/usr/bin/env python
from scapy.layers.inet import IP
from scapy.layers.inet import ICMP
from scapy.layers.inet import TCP
from scapy.utils import rdpcap, wrpcap
import pdb, sys, os
import re, random
from scapy.all import *
ipDict = {};
def generateIpv6(baseIpv4=None):
global ipDict;
if (baseIpv4):
i... | StarcoderdataPython |
3304990 | <reponame>stevenvanuytsel/trackpy
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
import numpy as np
import trackpy as tp
from trackpy.artificial import draw_feature
from trackpy.tests.common import assert_coordinates_close, StrictTestCase
from tr... | StarcoderdataPython |
57100 | expected_output = {
"interfaces": {
"Port-channel1": {
"name": "Port-channel1",
"protocol": "lacp",
"members": {
"GigabitEthernet0/0/1": {
"activity": "Active",
"age": 18,
"aggregatable": True,
... | StarcoderdataPython |
3365506 | from django.contrib.contenttypes.models import ContentType
from rest_framework.generics import get_object_or_404, GenericAPIView
from rest_framework.reverse import reverse
CONTENTTYPES_PARAMS_URL = r'(?P<content_type>\d+)/(?P<object_id>\d+)'
class ContenttypesParamsMixin(GenericAPIView):
'''
Add the content_... | StarcoderdataPython |
37444 | from .decrypt import decrypt as d
from .encrypt import encrypt as e
from .generatekeys import genkeys as g
def pg(e, bit):
dp = open("rsakeys/d", "w+")
ep = open("rsakeys/e", "w+")
np = open("rsakeys/n", "w+")
a, b, c = g(e,bit)
np.write(str(a))
ep.write(str(b))
dp.write(str(c))
dp.close... | StarcoderdataPython |
1767717 | <reponame>DavidBitner/Aprendizado-Python<gh_stars>0
x = int(input())
z = int(input())
while z <= x:
z = int(input())
soma = x
contador = 1
base = x + 1
while soma <= z:
soma += base
base += 1
contador += 1
print(contador)
| StarcoderdataPython |
3368726 | import nltk
import random
# CC -> coordinating conjunction
# RB -> adverb
# IN -> preposition
# NN -> listen
# JJ -> adjective
# VB* -> verb
class TitleMaker(object):
"""docstring for TitMaker."""
def __init__(self, corpus=[]):
super(TitleMaker, self).__init__()
self.corpus = corpus
se... | StarcoderdataPython |
1650 | #!/usr/bin/env python2.7
# Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | StarcoderdataPython |
3361471 | import wx.adv
import wx
from .wxControl import *
class 超级列表框(wx.ListCtrl, 公用方法):
pass
@property
def 行数(self):
return self.取行数()
@行数.setter
def 行数(self, value):
self.SetItemCount(value)
@property
def 列数(self):
return self.GetColumnCount()
@列数.setter
def 列数... | StarcoderdataPython |
1670990 | import numpy as np
from annoy import AnnoyIndex
import os
import sys
index_filename = sys.argv[1]
vector_filename = sys.argv[2]
image_filename = sys.argv[3]
with open(image_filename) as fp:
images = [x.strip() for x in fp.readlines()]
vectors = np.load(vector_filename, mmap_mode='r')
dim = vectors.shape[1]
inde... | StarcoderdataPython |
101113 | """Test for multiprocess prime generation."""
import unittest
import rsa.prime
import rsa.parallel
import rsa.common
class ParallelTest(unittest.TestCase):
"""Tests for multiprocess prime generation."""
def test_parallel_primegen(self):
p = rsa.parallel.getprime(1024, 3)
self.assertFalse(r... | StarcoderdataPython |
3212341 | <filename>main_zyf.py
#!/usr/bin/env python
# Train CIFAR10 with PyTorch.
# based on: https://github.com/kuangliu/pytorch-cifar
# maintainer: zhaoyafei (https://github.com/walkoncross, <EMAIL>)
from __future__ import print_function
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functio... | StarcoderdataPython |
180696 | <reponame>try-dash-now/dash-ia
__author__ = '<NAME>'
'''created @2015/7/27'''
import unittest
import sys,os
pardir =os.path.dirname(os.path.realpath(__file__))
pardir= os.path.sep.join(pardir.split(os.path.sep)[:-1])
sys.path.append(os.path.sep.join([pardir,'lib']))
print('\n'.join(sys.path))
from common import arra... | StarcoderdataPython |
1680262 | # -*- coding: utf-8 -*-
"""
Domain adaptation with optimal transport with GPU implementation
"""
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <https://github.com/aje>
#
# License: MIT License
import cupy as np # np used for matrix computation
import cupy as cp #... | StarcoderdataPython |
3319733 | <reponame>soran-ghaderi/Chromusic_search_engine
from jinja2 import Template
from .base_template import BaseTemplate, BaseTemplateData
from tase.utils import _trans
class HomeTemplate(BaseTemplate):
name = "home_template"
template = Template(
"{{c_dir}}<b>{{s_main_menu}} | {{emoji._house}}</b>"
... | StarcoderdataPython |
3307510 | <reponame>pingrunhuang/CodeChallenge
"""
The set [1,2,3,...,n] contains a total of n! unique permutations.
By listing and labeling all of the permutations in order, we get the following sequence for n = 3:
"123"
"132"
"213"
"231"
"312"
"321"
Given n and k, return the kth permutation sequence.
Note:
Given n will be ... | StarcoderdataPython |
117639 | <reponame>chris2013/pydupe
import time
import subprocess
start_time = time.time()
cmd= ['pydupe','dd', '/home/chris/Pictures/']
sub = subprocess.Popen(cmd, text=True, stdout=subprocess.PIPE, stderr = subprocess.PIPE)
stdout, stderr = sub.communicate()
print("--- %s seconds ---" % (time.time() - start_time))
# HASH:
... | StarcoderdataPython |
3206232 | <gh_stars>0
from lib.jobcan import JobcanInput
import pandas as pd
from datetime import timedelta
from argparse import ArgumentParser
import os
import re
RESERVED_COLS = ["date"]
def calc_rest_of_hour(total_hour, task_hours, row, cols):
hour, minute = [int(t) for t in total_hour.split(":")]
total = timedelt... | StarcoderdataPython |
1681065 | <gh_stars>0
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distribu... | StarcoderdataPython |
3335820 | <filename>fake-pw-dump-gen.py
#!/usr/bin/python
import time
import gzip
import argparse
import numpy
import random
import sys
from faker import Faker
def gen_pw(pass_type):
password = ''
if pass_type == 'weak':
password = random.choice(lines).decode('utf-8').rstrip()
if pass_type == 'strong':
... | StarcoderdataPython |
1765866 | from django.apps import AppConfig
class TyphoonConfig(AppConfig):
name = 'typhoon'
| StarcoderdataPython |
3268810 | import numpy as np
from ._base import GraphWorld, grid_to_adj
class OpenField(GraphWorld):
"""Open field task environment.
Parameters
----------
reward : float
Value of reward.
punishment : float
Value of punishment.
Attributes
----------
states : array, shape ... | StarcoderdataPython |
3216408 | <filename>collector_center_sdk/api/collection_config/collection_config_client.py
# -*- coding: utf-8 -*-
import os
import sys
import collector_center_sdk.api.collection_config.create_collection_config_pb2
import collector_center_sdk.api.collection_config.debug_collection_config_pb2
import collector_center_sdk.api.c... | StarcoderdataPython |
1753288 | <filename>wcd_pth_migration/management/commands/migration_clear_whatmanager.py
from django.core.management.base import BaseCommand
from books.models import BookUpload
from home.models import WhatTorrent, TransTorrent, WhatFulltext, WhatFileMetadataCache, \
WhatLoginCache, ReplicaSet
from what_transcode.models impo... | StarcoderdataPython |
4803449 | <reponame>AMontgomerie/jigsaw-toxic-severity-competition<gh_stars>1-10
import torch
import torch.nn as nn
from torch.nn import MarginRankingLoss
from torch.optim import AdamW
from torch.utils.data import DataLoader
from torch.cuda import amp
from transformers import get_scheduler
from tqdm import tqdm
import os
import ... | StarcoderdataPython |
3272101 | #Exercício Python 013: Faça um algoritmo que leia o salário de um funcionário
# mostre seu novo salário, com 15% de aumento.
salario = float(input("Salário do funcionario:R$"))
aumento = salario + (salario*15/100)
print("Com aumento de 15% o seu salário passará a ser",aumento,"R$") | StarcoderdataPython |
3225686 | # -*- coding: utf-8 -*-
import sympy as sy
from .testfunction import TestMinFunction
from .meta import symbolize, substitute
def Rosenbrock(a=1, b=100):
"""
Creates the Rosenbrock function object.
f(x,y) = (a-x)**2 + b*(y-x**2)**2
a,b are constants, tipically a is set to 1 and b is set to 100.
... | StarcoderdataPython |
165376 | <reponame>kaparna126/magellanmapper<gh_stars>1-10
# Object colocalization
# Copyright The MagellanMapper Contributors
"""Colocalize objects in an image, typically in separate channels."""
from enum import Enum
import multiprocessing as mp
import pandas as pd
import numpy as np
from skimage import morphology
from mag... | StarcoderdataPython |
3243060 | # -*- coding: utf-8 -*-
from .bicluster_analysis import find_biclusters
class KeywordBicluster:
def __init__(self, keyword_rows, keyword_columns, similarity_matrix, density, g_value):
self.keyword_rows = keyword_rows
self.keyword_columns = keyword_columns
self.similarity_matrix = similari... | StarcoderdataPython |
1624877 | <reponame>dromakin/db_api_protection
"""
init_db.py
created by dromakin as 03.05.2021
Project app
"""
__author__ = 'dromakin'
__maintainer__ = 'dromakin'
__credits__ = ['dromakin', ]
__status__ = 'Development'
__version__ = '20210503'
from sqlalchemy.orm import Session
from pydantic import EmailStr
from app import ... | StarcoderdataPython |
142662 | # -*- coding: utf-8 -*-
#
# -----------------------------------------------------------------------------------
# Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd. All rights reserved.
#
# The MIT License (MIT)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this softw... | StarcoderdataPython |
120789 | """Slicing"""
import math
from itertools import islice
# Recaps: slicing sequence type
l = [1, 2, 3, 4]
print(l[0:2])
s = slice(0, 2)
print(l[s])
# Slicing an iterator
def factorials(n):
for i in range(n):
yield math.factorial(i)
def slice_(iterable, start, stop):
"""Demonstrate how islice() works... | StarcoderdataPython |
3341869 | <filename>examples/SendMore.py<gh_stars>1-10
"""
See https://en.wikipedia.org/wiki/Verbal_arithmetic
A model for a general form of this problem is in CryptoPuzzle.py
"""
import satx
satx.engine(16, cnf_path='aux.cnf')
# letters[i] is the digit of the ith letter involved in the equation
s, e, n, d, m, o, r, y = lett... | StarcoderdataPython |
3216012 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | StarcoderdataPython |
123297 |
import os
pyt = 'python'
#pyt = 'python3'
os.system('cd tests; %s test_hobj.py' % pyt)
os.system('cd tests; %s test_active_nodes.py' % pyt)
os.system('cd bench; %s bench.py' % pyt)
os.system('cd examples; %s d40nano.py 4' % pyt)
os.system('cd examples; %s ms_sqnp.py 12 12' % pyt)
os.system('cd examples; %s rand_reg6.... | StarcoderdataPython |
3396025 | <filename>channel.py
import requests
from bs4 import BeautifulSoup
import json
class channelTube():
def __init__(self, channel_id = None):
self.headers = {"User-Agent": "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"}
self.channel_id = channel_id
self.crawlChanne... | StarcoderdataPython |
3201184 | <filename>registry/views.py
from django.http import HttpResponse
from models import Contact
import json
def contacts(req):
contacts = [ '"' + contact.name.replace('"', '') + '":' + contact.json for contact in Contact.objects.all() ]
return HttpResponse('{' + ','.join(contacts) + '}', content_type='application/... | StarcoderdataPython |
29875 | <gh_stars>1-10
"""Tests for mlpiot.base.vision_pipeline_manager"""
import unittest
from mlpiot.base.action_executor import ActionExecutor
from mlpiot.base.event_extractor import EventExtractor
from mlpiot.base.scene_descriptor import SceneDescriptor
from mlpiot.base.trainer import Trainer
from mlpiot.base.vision_pipe... | StarcoderdataPython |
3347383 | <filename>flasky2/venv/Lib/site-packages/weka/core/version.py
# 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 3 of the License, or
# (at your option) any later version.
#
# This ... | StarcoderdataPython |
1624594 | def judge(self, m: str) -> bool:
for i in range(len(m) // 2):
x = m[i]
y = m[-(i + 1)]
if x != y:
return False
return True
def XXX(self, s: str) -> str:
if not s:
return ''
if len(s) == 1:
return s
result = ''
ts = ''
for i in s:
... | StarcoderdataPython |
1613153 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="easyaspi",
version="2019.02.17",
author="<NAME>",
author_email="<EMAIL>",
description="A module intended to abstract away a lot of the complexity of using the GPIO and PiCamera for beginne... | StarcoderdataPython |
4803146 | <reponame>unliar/python-tool<gh_stars>0
import csv
import smtplib
import time
from random import choice
from email.mime.text import MIMEText
def create_mail_server(mail_server_host, mail_server_port, from_addr, from_pass):
"""
@ mail_server_host 你的smtp服务器地址
@ mail_server_port 你的smtp端口
@ from_addr 你的... | StarcoderdataPython |
94565 | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
# Author: kakakaya, Date: Sun Oct 15 19:49:06 2017
from unittest import TestCase
from nose.tools import ok_, eq_, raises
import irasutoya
class TestIrasutoyaEntry(TestCase):
def test_single_illust_entry(self):
url = 'http://www.irasutoya.com/2017/10/blog-post_... | StarcoderdataPython |
1773844 | <filename>can_tools/scrapers/__init__.py
from can_tools.scrapers.base import CMU, DatasetBase
from can_tools.scrapers.official import ( # IllinoisDemographics,; IllinoisHistorical,; Massachusetts,
CaliforniaCasesDeaths,
CaliforniaHospitals,
CDCCovidDataTracker,
CDCStateVaccine,
DCCases,
DCDeath... | StarcoderdataPython |
3267106 | <reponame>sriramsocrates/B_Scan<gh_stars>0
import os
import requests
import sys
import time
import socket
import datetime
import json
from bs4 import BeautifulSoup
from termcolor import cprint, colored
class Breach(object):
def RunMainCheck(self, email):
email_list = []
api = "https://haveibeenpwn... | StarcoderdataPython |
1761021 | <filename>src/syndicate/read_csv_01.py
with open('test01.csv', 'r') as reader:
for line in reader:
print(len(line))
| StarcoderdataPython |
3219191 | <filename>index.py
#!/bin/env python3
"""
# Todology - Import Schoology Assignments to Todoist
Imports everything from the schoology calendar that matches the following criteria:
1. Started before the first day of the previous month.
* For example, if today is the Jan 31 2016, then it will import anything that *sta... | StarcoderdataPython |
193055 | import logging
import sys
from abc import ABC
import tensorflow as tf
from tensorflow.keras import layers
from base import Base
from activation import MaskedActivation
from depthwiseconv import DepthwiseConv3D
from spatial import SpatialAttention
from stem import Stem
logging.basicConfig(
stream=sys.stdout,
l... | StarcoderdataPython |
4840052 | """
Copyright (c) 2022 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | StarcoderdataPython |
3235891 | <reponame>dsmyda/upsolve
from .contest_interface import ContestInterface
from cement import Handler
from ..constants import BINARYSEARCH_WEEKLY_CODE, BINARYSEARCH, platform_display, GREEN
from .utils.binarysearch_helper import query_problem_instances, verify_question_number
class BinarysearchWeekly(ContestInterface, H... | StarcoderdataPython |
169182 | #!/usr/bin/env python3
import RPi.GPIO as GPIO
import sys
import time
from pathlib import Path
"""
Example usage:
sudo -u solarthing /opt/solarthing/other/rpi/gpio_1wire_reload.py 14 /sys/bus/w1/devices/28-0301a279f5ff/name /sys/bus/w1/devices/28-0301a279ffb2/name
I recommend using pin 17, but pin 14 works as long a... | StarcoderdataPython |
3262194 | <reponame>Wales-Wyf/Distributed-Algorithm-Simulation-Platform-DSP--2.0<gh_stars>1-10
import copy
def taskFunction(self,id,adjDirection,datalist):
n = copy.deepcopy(datalist[0])
a = copy.deepcopy(datalist[n])
b = copy.deepcopy(datalist[-1])
ann = copy.deepcopy(datalist[1:-1])
x = 0.0
K = 5
d... | StarcoderdataPython |
1705274 | from __future__ import division
from scipy.integrate import simps
from scipy.interpolate import interp1d
import matplotlib.pyplot as plt
from scipy.stats import kstest
from scipy.stats import norm
import numpy as np
import scipy.fftpack
import scipy.signal
from src.BHKickUtils import tools as gwt
import cmath
import sc... | StarcoderdataPython |
1692623 | from setuptools import find_packages, setup
if __name__ == "__main__":
setup(
name="docs_snippets",
author="Elementl",
author_email="<EMAIL>",
license="Apache-2.0",
url="https://github.com/dagster-io/dagster/tree/master/examples/docs_snippets",
classifiers=[
... | StarcoderdataPython |
3234867 | import unittest
import moddb
class TestTeam(unittest.TestCase):
def setUp(self):
self.team = moddb.pages.Team(moddb.get_page(getattr(self, "url", "https://www.moddb.com/company/edainmod-dev-team")))
def test_get_addons(self):
addons = self.team.get_addons()
self.team.get_addons(2)
... | StarcoderdataPython |
16026 | <reponame>trodge/declarative-resource-client-library
# Copyright 2021 Google LLC. 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... | StarcoderdataPython |
3263382 | from collections import namedtuple, OrderedDict
import datetime as date
import hashlib
Transaction = namedtuple(
'transaction',
['sender',
'to',
'amount',
'signature'])
Block = namedtuple(
'block',
['index',
'timestamp',
'proof',
'previous_hash',
'hash',
'tran... | StarcoderdataPython |
3367746 | <filename>gui/api_plugins/flow.py
#!/usr/bin/env python
"""API renderers for dealing with flows."""
from grr.gui import api_aff4_object_renderers
from grr.gui import api_call_renderers
from grr.gui import api_value_renderers
from grr.lib import access_control
from grr.lib import aff4
from grr.lib import data_store
fr... | StarcoderdataPython |
4802258 | ## \author <NAME>
##
## This workflow corrects the succeptiblity artifacts of the input DWI data,
## and aligns that to corresponding t2 image space
## Important outputs: CorrectedDWI_in_T2Space, DWIBrainMask
"""
CorrectionWorkflow.py
============================
Description:
The purpose of this is to...
Auth... | StarcoderdataPython |
3300838 | """Views for users application."""
import json
import logging
from random import Random
from django.db import transaction
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from django.utils import timezone
from django.contrib.auth import get_user_model
from django.contrib.a... | StarcoderdataPython |
107562 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File: request.py
@Desc: None
"""
import requests
def __genericHeader():
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36"
}
return headers
def... | StarcoderdataPython |
1682084 | # Copyright 2019 Atalaya Tech, 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 or agreed to in writing, ... | StarcoderdataPython |
1619381 | import time
import sys
from urllib.parse import parse_qs
from urllib.parse import urlparse
from oktaawscli.version import __version__
class OktaAuthMfaApp():
""" Handles per-app Okta MFA """
def __init__(self, logger, session, verify_ssl, auth_url):
self.session = session
self.logger = logger
... | StarcoderdataPython |
52264 | from django.conf import settings
import requests
from argos.libs.discovery import Discovery
__author__ = 'mphilpot'
class OntologyClient(object):
def __init__(self, token, url=None):
if url is None:
discovery = Discovery()
self.url = discovery.get_url("ontology")
else:
... | StarcoderdataPython |
31487 | <reponame>rossjones/ckan-mini
'''Unit tests for ckan/logic/auth/create.py.
'''
from pylons import config
import mock
import nose.tools
import ckan.tests.helpers as helpers
import ckan.tests.factories as factories
import ckan.model as model
import ckan.logic as logic
import ckan.plugins as p
assert_equals = nose.too... | StarcoderdataPython |
15112 | class Solution:
def minPathSum(self, grid: List[List[int]]) -> int:
"""
[1,3,1]
[1,5,1]
[4,2,1]
time O (nm)
space O(nm)
state -> sums[r][c] = min path sum till r, c position
initial state -> sums[0][0…cols] = inf
-> sums... | StarcoderdataPython |
3266969 | import torch
import numpy as np
from databases.joint_sets import MuPoTSJoints
def th_sp2cart(r, t, p):
x = r * torch.cos(p) * torch.cos(t)
y = r * torch.sin(p) * torch.cos(t)
z = r * torch.sin(t)
return x, y, z
def orient2pose(pred_bo, bl, root):
joint_set = MuPoTSJoints()
connected_joints ... | StarcoderdataPython |
4822912 | <reponame>riceissa/spaced-inbox
#!/usr/bin/env python3
import datetime
import sqlite3
import sys
from script import DB_COLUMNS, Note
if __name__ == "__main__":
DB_FILE = sys.argv[1]
INBOX_NAME = sys.argv[2]
MAX_REVIEWS_PER_DAY = int(sys.argv[3])
conn = sqlite3.connect(DB_FILE)
cur = conn.cursor()
fetch... | StarcoderdataPython |
3231484 | <gh_stars>10-100
# --------------------------------------------------------
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
import argparse
import sys
from pathlib import Path
import bpy
import os
MAX_SIZE = 5e7
_package_dir = os.path.dirname(os.... | StarcoderdataPython |
49098 | #!/usr/bin/env python
"""Creates or updates distribution files"""
import subprocess
print "Updates JavaScript and Type Definition files..."
subprocess.call(['rm', 'dist', '-rf'])
subprocess.call(['tsc', '--declaration'])
| StarcoderdataPython |
107147 | <filename>oldCode/03b_build_IPPA_bkgImages.py
# This script will construct one average background image per waveplate angle,
# per waveband, per night. This assumes that the supersky structure is constant
# throughout the night. This is a reasonable assumption for the actual sky
# background contribution, but the tele... | StarcoderdataPython |
1791212 | <reponame>sgheb/kaiko-api
"""
Kaiko API Wrapper
"""
import logging
from os import environ
import pandas as pd
import kaiko.utils as ut
try:
from cStringIO import StringIO # Python 2
except ImportError:
from io import StringIO
# Base URLs
_BASE_URL_KAIKO_US = 'https://us.market-api.kaiko.io/'
_BASE_URL_... | StarcoderdataPython |
1737443 | <filename>fuzzers/005-tilegrid/mmcm/top.py
import os
import random
random.seed(int(os.getenv("SEED"), 16))
from prjxray import util
from prjxray import verilog
from prjxray.db import Database
def gen_sites():
db = Database(util.get_db_root())
grid = db.grid()
for tile_name in sorted(grid.tiles()):
... | StarcoderdataPython |
1734057 | <gh_stars>0
from PyQt4 import QtGui, QtCore
from core.domainobjects import MovieModel
import core.Constants as Constants
import ui.DefaultComponents
SAVE_BUTTON_LABEL = " Save "
UPDATE_BUTTON_LABEL = " Update "
class AddMovieRequest(QtGui.QFrame):
def __init__(self, mainWindow):
super(AddMovieRe... | StarcoderdataPython |
1722555 | """ Mapnik StaticMap Provider.
Use Sperical Mercator projection
Sample configuration:
"provider":
{
"class": "TileStache.Goodies.Providers.StaticMap:Marker",
"kwargs":
{
"mapfile": "mymap.xml",
}
}
mapfile: the mapnik xml file to load the map from
"""
import logging
fro... | StarcoderdataPython |
98697 | <reponame>shaolinbertrand/PythonMundo2
nomemv = ''
media = m20 = mv = 0
for i in range(4):
nome = input('Digite o nome da pessoa {}: '.format(i))
idade = int(input('Digite a idade do(a) {}: '.format(nome)))
sexo = input('Digite o sexo do(a) {}: '.format(nome))
media = media + idade
if(sexo=='f'):
... | StarcoderdataPython |
1669093 | <gh_stars>1-10
from strategy import Strategy
from trendy import segtrends
from strategy import *
class twpStrategy(Strategy):
@classmethod
def visu(cls, stockname, save=False):
from pylab import title, figure, savefig, subplot, show
print "#1) Automatic buy/sales visualisation of the curr... | StarcoderdataPython |
103710 | from __future__ import print_function
import click
from click.testing import CliRunner
from kcleaner import cli
runner = CliRunner()
| StarcoderdataPython |
1754827 | <filename>ddb/feature/run/schema.py
# -*- coding: utf-8 -*-
from ddb.feature.schema import FeatureSchema
class RunSchema(FeatureSchema):
"""
Run feature schema.
"""
| StarcoderdataPython |
136114 | """Support for Overkiz water heater devices."""
from homeassistant.components.water_heater import DOMAIN as WATER_HEATER
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from .const import DOMAIN
from... | StarcoderdataPython |
3317758 | # import my hello function
import my_func
# print my_func
greeting = my_func.print_hello
print
print greeting()
# used my_func from /automation_class/class2
# used my_func from /tmp
# used my_func from ~/applied_python/lib/python2.7/site-packages/
| StarcoderdataPython |
88079 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Test TorchGeneratorAgent.
"""
import unittest
import math
import torch
from parlai.core.agents import create_agent
im... | StarcoderdataPython |
18515 | from robot.api.deco import keyword
from robot.libraries.BuiltIn import BuiltIn
class Gazebo(object):
"""Robot Framework test library for the Gazebo simulator
See also http://gazebosim.org/tutorials/?tut=ros_comm
== Table of contents ==
%TOC%
"""
ROBOT_LIBRARY_SCOPE = 'SUITE'
def __init... | StarcoderdataPython |
1716253 | from _pytest.nodes import Item
class Stack:
def __init__(self) -> None:
self._storage = []
def __len__(self):
return len(self._storage)
def push(self, item):
self._storage.append(item)
def pop(self):
try:
item = self._storage.pop()
except I... | StarcoderdataPython |
1689544 | import unittest
from dateutil import parser
from fleet_request import FleetRequest
from datetime import datetime, timedelta
from fleet_factory import create_fleet
# ====================== DEFAULT TEST PARAMETERS =======================
# fleets = ['BatteryInverter', 'ElectricVehicle', 'PV', 'WaterHeater', 'Elec... | StarcoderdataPython |
3364512 | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | StarcoderdataPython |
44169 | # -*- coding: utf-8 -*-
"""Classifying Images with Pre-trained ImageNet CNNs.
Let’s learn how to classify images with pre-trained Convolutional Neural Networks
using the Keras library.
Example:
$ python imagenet_pretrained.py --image example_images/example_01.jpg --model vgg16
$ python imagenet_pretrained.py ... | StarcoderdataPython |
1696204 |
# -*- coding: utf-8 -*-
# pop - populacao a ser decodificada
# ncrom - numero de cromossomos (parametros) por individuo
# comlim - matrix (ncrom x 2) contendo os limites superior e inferior para os cromossomos (parametros)
# lbits - vetor ncrom contendo o numero de bits para cada cromossomo
class Decode():
def _... | StarcoderdataPython |
62962 |
from typing import Dict, Generator, Optional, Tuple, Union
import numpy as np
from joblib import ( # type: ignore
delayed,
Parallel,
)
from numpy import linalg
from sklearn.metrics import accuracy_score
from sklearn.base import BaseEstimator
from libifbtsvm.functions import (
fuzzy_membership,
trai... | StarcoderdataPython |
193549 | from django.contrib.contenttypes.models import ContentType
from django.shortcuts import get_object_or_404
from django.views.generic.list_detail import object_list
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.datastructures import MultiValueDictKeyError
from taggit.models i... | StarcoderdataPython |
36956 | <gh_stars>0
from test.conftest import pytest
from tools import logger
from tools.read_file import ReadFile
from tools.send_email import EmailServe
import os
import shutil
report = ReadFile.read_config('$.file_path.report')
logfile = ReadFile.read_config('$.file_path.log')
file_path = ReadFile.read_config('$.file_path'... | StarcoderdataPython |
94839 | import numpy as np
from uwb.generator import BaseGenerator
class NoiseMap:
"""Base class for noise maps
Attributes:
generator: measurement that can be accessed by an iterator.
"""
def __init__(self, generator: BaseGenerator):
"""Initializes the estimation of the parameters."""
... | StarcoderdataPython |
40591 |
from unittest import TestCase, mock
import requests
from waterdata.commands.lookup_generation.wqp_lookups import (
get_lookup_by_json, is_us_county, get_nwis_state_lookup, get_nwis_county_lookup)
@mock.patch('waterdata.commands.lookup_generation.wqp_lookups.execute_get_request')
class GetLookupByJsonTestCase(T... | StarcoderdataPython |
1686102 | <reponame>erccarls/county_covid_seir_models
import numpy as np
import pandas as pd
from pyseir import load_data
class ParameterEnsembleGenerator:
"""
Generate ensembles of parameters for SEIR modeling.
Parameters
----------
fips: str
County fips code.
N_samples: int
Integer nu... | StarcoderdataPython |
39380 | from config import db, ma
class Notification(db.Model):
__tablename__ = "notification"
__table_args__ = {"schema": "eagle_db"}
id = db.Column(db.Integer(), primary_key=True)
isActive = db.Column(db.Boolean())
lastUpdated = db.Column(db.String(20))
toUserId = db.Column(db.Integer(), db... | StarcoderdataPython |
1680786 | """
Cartesian Product Functorial Construction
AUTHORS:
- <NAME> (2008-2010): initial revision and refactorization
"""
#*****************************************************************************
# Copyright (C) 2010 <NAME> <nthiery at users.sf.net>
#
# Distributed under the terms of the GNU General Public Licens... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.