id stringlengths 1 7 | text stringlengths 6 1.03M | dataset_id stringclasses 1
value |
|---|---|---|
3367243 | #NVDAObjects/IAccessible/akelEdit.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2010 <NAME> <<EMAIL>>
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
from . import IAccessible
class AkelEdit(IAccessible):
name = ""
| StarcoderdataPython |
3213666 | __version__ = '0.24.0'
| StarcoderdataPython |
3351241 | #!/usr/bin/env python3
#Test suite for Problem Set 4 (Drug Simulation)
import sys
import unittest
import numpy as np
import ps4
population = [[100, 115, 122, 129, 134, 138, 151, 167, 174, 183, 196, 208, 215, 223, 233,
240, 253, 268, 284, 294, 306, 316, 325, 338, 360, 372, 378, 388, 399, 415, 414, 431, 456,
477, 485,... | StarcoderdataPython |
189170 | def relax():
neopixel.setAnimation("Color Wipe", 0, 0, 20, 1)
sleep(2)
neopixel.setAnimation("Ironman", 0, 0, 255, 1)
if (i01.eyesTracking.getOpenCV().capturing):
global MoveBodyRandom
MoveBodyRandom=0
global MoveHeadRandom
MoveHeadRandom=0
i01.setHandSpeed("left", 0.85, 0.85, ... | StarcoderdataPython |
1643177 | <filename>src/papaprice/etmall.py
import re
import requests
import json
import js2py
from bs4 import BeautifulSoup as bs
from papaprice.papaprice import PapaPrice
class Etmall(PapaPrice):
def __init__(self, proxies = None):
super().__init__(proxies)
self.url_template = 'https://www.etmall... | StarcoderdataPython |
1616371 | <gh_stars>1-10
"""
VRChat API Documentation
The version of the OpenAPI document: 1.6.8
Contact: <EMAIL>
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from vrchatapi.api_client import ApiClient, Endpoint as _Endpoint
from vrchatapi.model_utils impo... | StarcoderdataPython |
1715640 | # Important Imports
import numpy as np
from PIL import Image
from scipy.signal import find_peaks
# image = PIL.Image, n = Number of Segments
# ignoreBottomTop = Segmentation of top and bottom of Image
# axis = 0 (for vertical-lines) or 1 (for horizontal-lines)
# Returns a gray image, PIL Image.
def recursiveXYCut(imag... | StarcoderdataPython |
47076 | <filename>ptt/page.py
import re
from .type import Url
from typing import Iterator, List
import urllib.parse as urlpasre
from abc import ABC, abstractmethod
class PageManager(ABC):
def __init__(self, start_url: Url) -> None:
self.start_url = start_url
@abstractmethod
def get_urls(self, search_pag... | StarcoderdataPython |
105873 | <reponame>xiaolao/PaddleX
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
# 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 |
3293913 | import torch
import torch.nn as nn
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
class BaseModel(torch.nn.Module):
def load(self, path):
"""Load model from file.
Args:
path (str): file path
"""
parameters = torch.load(path, map_location=device)
... | StarcoderdataPython |
50871 | """
Copyright 2011 <NAME> <<EMAIL>>
This file is part of PyCAM.
PyCAM 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.
PyCAM is distributed... | StarcoderdataPython |
3299075 | # -*- coding: utf-8 -*-
from mahjong.constants import CHUN, HAKU, HATSU
from mahjong.hand_calculating.yaku import Yaku
from mahjong.utils import is_pon, is_pair
class Shosangen(Yaku):
"""
Hand with two dragon pon sets and one dragon pair
"""
def __init__(self, yaku_id):
super(Shosangen, self)... | StarcoderdataPython |
3204055 | <filename>opencadd/tests/structure/test_pocket_base.py
"""
Tests for opencadd.structure.pocket.core
"""
import pytest
from opencadd.structure.pocket import PocketBase
class TestPocketBase:
"""
Test PocketBase class methods.
"""
@pytest.mark.parametrize(
"residue_ids, residue_ixs, residue_id... | StarcoderdataPython |
162789 | <reponame>sayantansatpati/disdat<filename>tests/functional/test_tags.py
import uuid
import pytest
from disdat import api, common
from disdat.pipe import PipeTask
TAGS = {'tag1': 'omg', 'tag2': 'it works'}
class Source(PipeTask):
def pipe_requires(self):
self.set_bundle_name('tagged')
def pipe_run... | StarcoderdataPython |
3308813 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('filmfestival', '0011_auto_20150610_1401'),
]
operations = [
migrations.AddField(
model_name='day... | StarcoderdataPython |
1711505 | import numpy as np
from sklearn.preprocessing import normalize
from utils.data_utils import convert_dir_vec_to_pose, dir_vec_pairs
def convert_pose_to_line_segments(pose):
line_segments = np.zeros((len(dir_vec_pairs) * 2, 3))
for j, pair in enumerate(dir_vec_pairs):
line_segments[2 * j] = pose[pair[0... | StarcoderdataPython |
3248621 | """
helper_script.py
Copyright 2013 <NAME>
This file is part of w3af, http://w3af.org/ .
w3af 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 version 2 of the License.
w3af is distributed in the hope that it wi... | StarcoderdataPython |
3244401 | <reponame>conradjones/ngraph-bridge
# ==============================================================================
# Copyright 2018-2020 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 ... | StarcoderdataPython |
103620 | # -*- Mode:Python;indent-tabs-mode:nil; -*-
#
# File: psaExceptions.py
# Created: 05/09/2014
# Author: BSC
#
# Description:
# Custom execption class to manage error in the PSC
#
class psaExceptions( object ):
class confRetrievalFailed( Exception ):
pass
| StarcoderdataPython |
35874 |
class bcolors():
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OK = '\033[92m'
WARNING = '\033[96m'
FAIL = '\033[91m'
TITLE = '\033[93m'
ENDC = '\033[0m'
| StarcoderdataPython |
101676 | <reponame>AlleyDismay/The-Third-Element
from glob import glob
files = glob("*.py") + glob("Game/*.py")
files.remove("lineCt.py")
lines = 0
comments = 0
chars = 0
for f in files:
thing = open(f).read()
lines += thing.count("\n")
comments += thing.count("#")
print("%d Lines\n%d Files\nWithout comments %d"%(lines, ... | StarcoderdataPython |
4837410 | <filename>checkout/migrations/0004_auto_20210801_1232.py
# Generated by Django 3.2.4 on 2021-08-01 12:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('checkout', '0003_order_addition'),
]
operations = [
migrations.AddField(
... | StarcoderdataPython |
1729494 | from .implicit import *
from . import implicit
__all__ = implicit.__all__
| StarcoderdataPython |
1650171 | from behave import *
from src.sample.ISBN import ISBN
use_step_matcher("re")
@given("we have an instance of ISBN and a ISBN number")
def step_impl(context):
context.isbn = ISBN()
@when("isbn number equal to (?P<isbn>.+)")
def step_impl(context, isbn):
context.result = context.isbn.validate(isbn)
@then("v... | StarcoderdataPython |
1764248 | from django import forms
from django.conf import settings
from qa_moderator.questions.models import Question
class QuestionForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(QuestionForm, self).__init__(*args, **kwargs)
self.fields['moderator_num'].widget = forms.HiddenInput()
... | StarcoderdataPython |
7433 | <reponame>jasonivey/scripts
#!/usr/bin/env python3
# vim:softtabstop=4:ts=4:sw=4:expandtab:tw=120
from ansimarkup import AnsiMarkup, parse
import csv
import datetime
import operator
import os
from pathlib import Path
import re
import sys
import traceback
_VERBOSE = False
user_tags = {
'error' : par... | StarcoderdataPython |
1700325 | <reponame>wietze/bsides-ldn-2019
from plugins.adversary.app.operation.operation import Step, OPDomain, OPCredential, OPRat, OPVar, OPHost, OPUser, OPFile
from plugins.adversary.app.commands import *
from plugins.adversary.app.custom import *
class DumpCreds(Step):
""" Description:
This step uses Inv... | StarcoderdataPython |
4824195 | # Copyright 2020 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | StarcoderdataPython |
3248599 | <gh_stars>100-1000
from neo.Core.Mixins import VerifiableMixin
class InventoryMixin(VerifiableMixin):
def __init__(self):
super(InventoryMixin, self).__init__()
self.InventoryType = None
def Verify(self):
pass
| StarcoderdataPython |
82831 | import os
from dodo_commands.dependencies import (yaml_round_trip_dump,
yaml_round_trip_load)
from dodo_commands.framework.config import merge_into_config
from dodo_commands.framework.paths import Paths
def create_config_dir(config_dir):
"""Install the dir with dodo_comman... | StarcoderdataPython |
58968 | <reponame>AhnSeongHyun/plate
# -*- coding:utf-8 -*-
from os.path import join
from os.path import split
from bs4 import BeautifulSoup
from jinja2 import Environment
from jinja2 import PackageLoader
from plate.common import is_absolute
def local_url_for(endpoint, **values):
dir_path, file_path = split(values['f... | StarcoderdataPython |
1681632 | from argoverse.evaluation.eval_tracking import eval_tracks
import os.path
data_dir = "/data/argoai"
labels_dir = os.path.join(data_dir, "downloads/argoverse-tracking/test")
our_output = os.path.join(data_dir, "marius/argoverse-tracker")
log_id = "028d5cb1-f74d-366c-85ad-84fde69b0fd3"
labels = os.path.join(labels_dir... | StarcoderdataPython |
3286323 | from avalon import api
import pyblish.api
import openpype.api
from openpype.pipeline import PublishXmlValidationError
from openpype.hosts.aftereffects.api import get_stub
class ValidateInstanceAssetRepair(pyblish.api.Action):
"""Repair the instance asset with value from Context."""
label = "Repair"
icon ... | StarcoderdataPython |
3209369 | <gh_stars>100-1000
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Azure Service helpers."""
import logging
from tempfile import NamedTemporaryFile
from adal.adal_error import AdalError
from azure.common import AzureException
from azure.core.exceptions import HttpResponseError
from msrest.ex... | StarcoderdataPython |
1654685 | # Copyright 2021 DAI Foundation
#
# 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 |
1777669 | <reponame>LittleNed/toontown-stride
from toontown.coghq.SpecImports import *
LobbyParent = 10014
LobbyCell = 0
BattleCells = {}
ReserveCogData = []
CogData = [] | StarcoderdataPython |
1602617 | #import functions
from mcpi.minecraft import Minecraft
from time import sleep
#define variables
mc = Minecraft.create()
flower = 38
#mainloop
while True:
x, y, z = mc.player.getPos()
mc.setBlock(x, y, z, flower)
sleep(0.1)
| StarcoderdataPython |
1654115 | <reponame>jazzband/join
import wrapt
from flask import flash, redirect
from flask_login import current_user
from ..account.views import default_url
def member_required(next_url=None, message=None):
if message is None:
message = "Sorry but you're not a member of Jazzband at the moment."
@wrapt.decora... | StarcoderdataPython |
199807 | from .dart_command import DartCommand
import sublime_plugin
class PubAddCommand(DartCommand):
def run(self, package_name):
if project := super().project():
project.pub_add(package_name)
def input(self, _):
return PackageNameInputHandler()
class PackageNameInputHandler(sublime_... | StarcoderdataPython |
1604336 | import torch
import numpy as np
def get_topic_diversity(beta, topk):
num_topics = beta.shape[0]
list_w = np.zeros((num_topics, topk))
for k in range(num_topics):
idx = beta[k,:].argsort()[-topk:][::-1]
list_w[k,:] = idx
n_unique = len(np.unique(list_w))
TD = n_unique / (topk * num_t... | StarcoderdataPython |
1736789 | """Package info"""
__version__ = '0.6.0'
__author__ = '<NAME> et al.'
__author_email__ = '<EMAIL>'
__license__ = 'Apache-2.0'
__copyright__ = 'Copyright (c) 2018-2019, %s.' % __author__
__homepage__ = 'https://github.com/PyTorchLightning/pytorch-lightning'
# this has to be simple string, see: https://github.com/pypa/t... | StarcoderdataPython |
3367542 | <filename>solum-6.0.0/solum/tests/common/test_hacking.py<gh_stars>0
# Copyright 2015 Intel, 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/... | StarcoderdataPython |
1626210 | <reponame>gridengine/config-api<gh_stars>1-10
#!/usr/bin/env python
#
# ___INFO__MARK_BEGIN__
#######################################################################################
# Copyright 2016-2021 Univa Corporation (acquired and owned by Altair Engineering Inc.)
# Licensed under the Apache License, Version 2.0 ... | StarcoderdataPython |
78076 | <reponame>andersy005/pydata-issue-tracker-datasette
import requests
import os
import collections
import pandas as pd
import datetime
import itertools
import pathlib
from prefect import Flow, task, unmapped, Parameter
from prefect.triggers import all_successful
headers = {'Authorization': f"token {os.environ['GH_TOKE... | StarcoderdataPython |
3264011 | <gh_stars>1-10
# https://plot.ly/python/
# https://docs.google.com/document/d/1DjWL2DxLiRaBrlD3ELyQlCBRu7UQuuWfgjv9LncNp_M/edit#heading=h.w8hlxhsxs4zj
from plotly.offline import iplot
from plotly.offline import init_notebook_mode
import plotly.graph_objs as go
init_notebook_mode(connected=True)
# BASICS ----------... | StarcoderdataPython |
1766658 | # file is saved as .py file because 'mat' is similar dictionary in python, nothing else
mat
{
'__header__': b'MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Fri Nov 18 20:05:04 2016',
'__version__': '1.0',
'__globals__': [],
"""
### general structure of image_info ###
... | StarcoderdataPython |
146726 | # Generated by Django 2.2.1 on 2019-07-11 07:05
from django.db import migrations
import pretix.base.models.fields
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0126_item_show_quota_left'),
]
operations = [
migrations.RenameField(
model_name='questi... | StarcoderdataPython |
4841593 | def factorial(n):
# state a base case of if n equals zero
if n == 0:
# return 1
return 1
# return n multiplied by factorial called with n - 1
return n * factorial(n - 1)
print(factorial(5))
| StarcoderdataPython |
78066 | # proxy module
from pyface.grid.grid_cell_renderer import *
| StarcoderdataPython |
176314 | <filename>h2o-py/tests/testdir_algos/rf/pyunit_node_assignment_prostateRF.py
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.random_forest import H2ORandomForestEstimator
from h2o.tree.tree import H2OTree
def map_node_ids_to... | StarcoderdataPython |
4828834 | import time
import typing
import traceback
import threading
import warnings
from .state_status import StateStatus
from .board import Board
class State():
# Name of this state
_name: str
_transitions: typing.Sequence[typing.Tuple[typing.Callable[[
'State', Board], bool], 'State']] # Stor... | StarcoderdataPython |
3319294 | <reponame>fiaasco/php7<filename>molecule/ubuntu/tests/test_php7_bionic.py<gh_stars>0
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('php7-ubuntu-bionic')
@pytest.mark.parametrize('pkg',... | StarcoderdataPython |
3343786 | <reponame>andrejchikilev/django-stored-messages<filename>stored_messages/tests/test_restapi.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from unittest import skipUnless
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from stored_messages.... | StarcoderdataPython |
1686852 | <reponame>guru-narayana/autonomous-car-SLAM-and-ROS-Navigation-
#! /usr/bin/python
from RPi import GPIO
import signal
import rospy
from geometry_msgs.msg import Twist
clk1 = 13 #left wheel
dt1 = 6
clk2 = 19 #right Wheel
dt2 = 26
def keyboardInterruptHandler(signal, frame):
print("this is velocity publisher signi... | StarcoderdataPython |
1702297 | <reponame>letaylor/limix
# Copyright(c) 2014, The LIMIX developers (<NAME>, <NAME>, <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
#
#U... | StarcoderdataPython |
1628736 | <reponame>rennerocha/pybr14-scrapy-tutorial<gh_stars>1-10
import scrapy
class MyFirstSpider(scrapy.Spider):
name = 'my-first-spider'
def start_requests(self):
urls = [
'http://quotes.toscrape.com/page/1/',
'http://quotes.toscrape.com/page/2/',
]
requests = []
for url in urls:
re... | StarcoderdataPython |
3354304 | import copy
import contextlib
import StringIO
import unittest
from view import viewfile
def _make_simple_entry(name, branch='master', revision='HEAD'):
return viewfile.ViewFileEntry(name, 'git://{0}/{0}'.format(name), 'GIT',
branch, revision)
class TestViewFileEntryMethods(unitt... | StarcoderdataPython |
1639321 | __version__ = "0.12.17.5"
| StarcoderdataPython |
1689956 | <reponame>hayj/MachineLearning
import numpy as np
from operator import itemgetter
def softmax_mean_rank(y_true, y_pred):
"""
This function calcute the mean rank of the true category
A score near to 1 means the model always predict a good softmax
Near to 0.5 --> random softmax...
"""
... | StarcoderdataPython |
119732 | from django.shortcuts import render
from django.http import HttpResponse
from apps.inverted import main, main2, main3
# Create your views here.
# def index(request):
# return HttpResponse("Hello, world. You're at the polls index.")
def home(request):
return render(request, 'apps/home.html')
def index(request... | StarcoderdataPython |
3234696 |
class LinkedList:
def __init__(self):
self.head = self.get_sentinal()
self.tail = self.get_sentinal()
self.head.next = self.tail
def get_sentinal(self):
return Node(None, None, None)
class Node:
def __init__(self, prev, data, next):
self.prev = prev
self.... | StarcoderdataPython |
4825880 | class Card:
def __init__(self,suit,face):
self.suit = int(suit)
self.face = int(face)
def cardSuit(self):
if self.suit == 0:
return "SPADES"
elif self.suit == 1:
return "HEARTS"
elif self.suit == 2:
return "CLUBS"
elif self.sui... | StarcoderdataPython |
34609 | from unittest import TestCase
import os
class TestSet_up_logger(TestCase):
def test_set_up_logger(self):
from utils import set_up_logger
from logging import Logger
logger = set_up_logger("test", "test.log")
self.assertIsInstance(logger, Logger)
os.remove("test.log")
| StarcoderdataPython |
117395 | <reponame>Akash16s/youtube-video-fetch-api
# Generated by Django 3.0.5 on 2020-04-29 06:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('apiCall', '0003_youtubemodel'),
]
operations = [
migrations.AlterField(
... | StarcoderdataPython |
4836177 | <filename>django/contrib/localflavor/de/forms.py
"""
DE-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
import re
id_re = re.compile(r"^(... | StarcoderdataPython |
3325631 | """
Encrypt files in the raw-private folder to raw-private-encrypted
"""
import logging
import sys
from argparse import Namespace
from getpass import getpass
from pathlib import Path
from typing import Optional, Iterable
from compendium.command.command import CompendiumCommand
from compendium.compendium import Compe... | StarcoderdataPython |
9529 | <filename>lib/galaxy/model/migrate/versions/0026_cloud_tables.py
"""
This script adds tables needed for Galaxy cloud functionality.
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, MetaData, Table, TEXT
now = datetime.date... | StarcoderdataPython |
37387 |
def create_supervised_data(env, agents, num_runs=50):
val = []
# the data threeple
action_history = []
predict_history = []
mental_history = []
character_history = []
episode_history = []
traj_history = []
grids = []
ep_length = env.maxtime
filler = env.get_filler()
obs = env.reset(setting=setting, nu... | StarcoderdataPython |
191516 |
import unittest
import _init_paths
from datasets.pascal_voc import pascal_voc
class MyTestCase(unittest.TestCase):
def test_pascal_voc(self):
d = pascal_voc('trainval', '2007')
res = d.roidb
from IPython import embed
embed()
if __name__ == '__main__':
unittest.main()
| StarcoderdataPython |
3265157 | from ...plugins.sqliteregistry import SqliteRegistry
def get_sql_registry():
sql_registry = SqliteRegistry()
return lambda: sql_registry
| StarcoderdataPython |
1606048 | import network
import time
import gc
import apa
import pwm
from umqtt.simple import MQTTClient
# Config
wifi_ssid = "HaSi-Kein-Internet-Legacy"
wifi_psk = "bugsbunny"
mqtt_server = "mqtt.hasi"
mqtt_client_name = "ircometer"
mqtt_state_topic = "hasi/lights/ircometer"
mqtt_msg_topic = "hasi/telegram/message"
lights_on... | StarcoderdataPython |
3346504 | from django.conf.urls import url, patterns
from . import views
urlpatterns = patterns('',
url(r'^$', views.my_contact, name='satchless-contact-my-contact'),
url(r'^address/new/', views.address_edit, name='satchless-contact-address-new'),
url(r'^address/(?P<address_pk>[0-9]+)/edit/',
... | StarcoderdataPython |
107909 | <filename>tests/model/test_flair.py
# -*- coding: utf-8 -*-
import pytest
import os
import torch
import flair
from eznlp.token import TokenSequence
from eznlp.model import FlairConfig
from eznlp.training import count_params
@pytest.mark.parametrize("agg_mode", ['last', 'mean'])
def test_flair_embeddings(agg_mode, fl... | StarcoderdataPython |
4821708 | from .krokimagic import KrokiMagic
def load_ipython_extension(ipython):
ipython.register_magics(KrokiMagic)
| StarcoderdataPython |
4834873 | <gh_stars>1-10
import gc
import networkx as nx
import numpy as np
import os
import logging
import pickle
from dca.schemes import (
DCALoggers,
DelaunayGraphVisualizer,
REData,
ExperimentDirs,
DelaunayGraphParams,
HDBSCANParams,
GeomCAParams,
QueryData,
)
from dca.delaunay_graph import De... | StarcoderdataPython |
1797927 | import pybullet as p
class Obstacle(object):
def __init__(self, urdf_file, position, scale=1.0) -> None:
self.body_id = p.loadURDF(urdf_file, position, globalScaling=scale)
def __del__(self):
p.removeBody(self.body_id)
@staticmethod
def load_obstacle(obstacle):
return Obstacl... | StarcoderdataPython |
1729432 | <reponame>daveshah1/linux-on-litex-vexriscv
#!/usr/bin/env python3
import argparse
from migen import *
from litex.boards.targets import arty
from litex.soc.interconnect import wishbone
from litex.soc.integration.soc_core import mem_decoder
from litex.soc.integration.builder import Builder
from litex.soc.cores.spi_f... | StarcoderdataPython |
3230380 | <filename>models/conv.py<gh_stars>10-100
import torch
from layers import Conv2d, Linear
class ConvModel(torch.nn.Module):
def __init__(self, in_channels: int, out_channels: int, dropout: bool = True):
super().__init__()
self.features = torch.nn.Sequential(
Conv2d(in_channels, 32, 3, pa... | StarcoderdataPython |
3373824 | from tests.base import BaseTestCase
from nose.plugins.attrib import attr
from shiftevent.event import Event
from shiftevent.handlers import Dummy1
@attr('event', 'handler', 'dummy1')
class Dummy1Test(BaseTestCase):
def test_instantiating_handler(self):
""" Instantiating dummy1 handler """
handle... | StarcoderdataPython |
1720652 | """tasks.py
Simple tutorial invoke based task execution tool for building debian package (rpm support in process...) of ip2w application.
Use [invoke.yaml] config file or cli params (see @task specification)
Usage:
invoke builddeb --no-use-git | --use-git (default)
"""
import os
import time
import tempfile as tmp... | StarcoderdataPython |
157097 | from sqlalchemy import (
Column,
String,
DateTime
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from spendy.db.utils import get_db_engine
Base = declarative_base()
class BankAccount(Base):
__tablename__ = 'bank_accounts'
id = Column(String(50), prima... | StarcoderdataPython |
1781132 | # scopus_fulltext_spider.py
import json
import logging
import typing as tg
import os
from ..dependencies.elsapy.elsdoc import FullDoc
from ..dependencies.elsapy.elsclient import ElsClient
class ScopusFulltextSpider:
'''通过调用Elsevier的全文API检索指定doi的全文。
全文结果将以xml格式储存在output_path目录下。'''
def __init__(
... | StarcoderdataPython |
3244563 | # AUTOGENERATED! DO NOT EDIT! File to edit: 04_data.ipynb (unless otherwise specified).
__all__ = ['open_tif', 'MSTensorImage', 'BAND_STATS', 'bands', 'means', 'stds', 'Channelcopy', 'Channelaug',
'TrainTransform', 'ValTransform', 'trainaug', 'globalaug1', 'globalaug2', 'locaaug', 'val_pipe', 'aug',
... | StarcoderdataPython |
134367 | __all__ = ['controle', 'modelo', 'view_ui'] | StarcoderdataPython |
3349147 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import datetime as DT
import json
from pathlib import Path
import shutil
import sys
sys.path.append('..')
sys.path.append('../genre_translate_file')
from db import Dump
from load import load
from common_utils import get_logger
from common impor... | StarcoderdataPython |
1669558 | <filename>setup.py
#!/usr/bin/pythoni
from setuptools import setup, find_packages
from os import path
p = path.abspath(path.dirname(__file__))
with open(path.join(p, 'README.rst')) as f:
README = f.read()
setup(
name='paywix',
version='1.4.0',
author="<NAME>",
author_email="<EMAIL>",
descript... | StarcoderdataPython |
129983 | <gh_stars>0
import psycopg2
import tensorflow as tf
import logging
from src.config import predict_categories, label_name, feature_names
class Db2Tfrecord:
def query_db(self):
raise NotImplementedError
def format_data(self):
raise NotImplementedError
def write2tfrecord(self):
rais... | StarcoderdataPython |
3338010 | <reponame>vinwerill/vinwerill-22
# 高雄市公有路外停車場一覽表
import sys
import urllib.request
import json
import csv
def fetch(query_limit):
# 指定查詢筆數上限
url = 'https://ws.kinmen.gov.tw/001/Upload/0/relfile/0/0/92b4584c-f454-4bd5-a75f-818dcf901f32.json'
req = urllib.request.urlopen(url)
# 確認資料庫編碼 (utf-8)
charse... | StarcoderdataPython |
1708059 | ##############################################################################
#
# Kennedy Institute of Rheumatology
#
# $Id$
#
# Copyright (C) 2015 <NAME>
#
# 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 Fr... | StarcoderdataPython |
94712 | # Copyright 2019 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 |
78125 | # -*- coding: utf-8 -*-
import furl
import urllib
import urlparse
import bson.objectid
import httplib as http
from datetime import datetime
import itsdangerous
from flask import request
from werkzeug.local import LocalProxy
from weakref import WeakKeyDictionary
from framework.flask import redirect
from framework.mo... | StarcoderdataPython |
3274402 | <gh_stars>0
import codecs
import numpy as np
import random
from copy import deepcopy
categories = ['science', 'style', 'culture', 'life', 'economics', 'business', 'travel', 'forces', 'media', 'sport']
dict_file = codecs.open('processed/dictionary.txt', 'r', 'utf_8_sig')
dictionary = []
for line in dict_file:
lin... | StarcoderdataPython |
1717293 | #!/usr/bin/env python3
import fileinput
import datetime
import os
today = datetime.date.today()
with open("/root/birthdays.txt") as file:
next(file)
raw = []
for line in file:
raw.append(tuple(line.split()))
names = [' '.join(i[2:]) for i in raw]
start = [(int(i[0]),int(i[1])) for i in raw]
end = start[:]
for t i... | StarcoderdataPython |
1762661 | # Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
from __future__ import absolute_import
from . import boundingBox
from . import imageGradients
from . import rawData
view_extensions = [
# Set show=True if extension should be shown by default
# in the 'Select Visualization Method' dialog. These d... | StarcoderdataPython |
43519 | <filename>backend/unpp_api/apps/partner/migrations/0017_auto_20170920_0639.py
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-09-20 06:39
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('partner', '001... | StarcoderdataPython |
1700522 | '''
* Vendor: Artica Soluciones Tecnologicas
* Product: Integria IMS Server
* Version: 5.0 MR56 Package 58 and probably earlier
* Category: CWE-640 Weak Password Recovery Mechanism
* Reported: 3/14/17
* Patched: 6/20/17
* Disclosed: 5/14/18
* Researcher: <NAME>
* CVE: TBD
* Reference: https://cp270.wordpress... | StarcoderdataPython |
168340 | <filename>pdsf_py2/pydysofu/fuzz_weaver.py
"""
Core fuzzing functionality.
@author twsswt
"""
import ast
import copy
import inspect
from core_fuzzers import identity
from workflow_transformer import WorkflowTransformer
from drawer import weave_clazz, weave_module, unweave_class, unweave_all_classes, IdentityAspect
... | StarcoderdataPython |
3212911 |
# to plot on the same figure ppo, ddpg and td3 for unused and unsatisfied
# 1 simple
# 2 multiple agent
# plot reward of simple / multi-agent / rsu
"""
# 1***Simple agent *****
import matplotlib.pyplot as plt
import pickle
var = "rc"
pdf_plot = var # R_c, C_o, C_u, k
lstt = [var]#, "C_o", "C_u", "k... | StarcoderdataPython |
17098 | import h2o
from h2o.base import Keyed
from h2o.exceptions import H2OValueError
from h2o.job import H2OJob
from h2o.model import ModelBase
from h2o.utils.typechecks import assert_is_type, is_type
class H2OAutoMLBaseMixin:
def predict(self, test_data):
"""
Predict on a dataset.
:param ... | StarcoderdataPython |
1694552 | import torch
import pdb
import transformer
from transformer import VisionTransformer, VisionTransformerUpHead
from transformer import config
backbone_arg = config.model['backbone']
decode_head_arg = config.model['decode_head']
pdb.set_trace()
model = VisionTransformer(model_name='vit_large_patch16_384', **b... | StarcoderdataPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.