id
stringlengths
1
7
text
stringlengths
6
1.03M
dataset_id
stringclasses
1 value
96075
<gh_stars>1-10 import torch import torch.nn as nn from pytorch_lightning import LightningModule from pytorch_lightning.metrics import Accuracy def lin_relu(in_features, out_features): return nn.Sequential( nn.Linear(in_features, out_features), nn.ReLU(inplace=True), ) class MLP(nn.Module): ...
StarcoderdataPython
4816268
# composition-kompozisyon import time class TekerlekliArac(): def yon_degistir(self, yon, durum): print("Tekerlekli araç ", yon, durum) class PaletliArac(): def yon_degistir(self, yon, durum): print("Paletli araç ", yon, durum) class Arac(): def __init__(self, sinif_kontrol): ...
StarcoderdataPython
79104
# import dash related libraries import dash import dash_html_components as html import dash_bootstrap_components as dbc import warnings warnings.filterwarnings('ignore') # import local libraries from callbacks import register_callbacks from lib import tabs from lib import title # create dash App server app = dash.Da...
StarcoderdataPython
1620196
import os def ATWFileList(HtmlUrl,n2): global ATWFileList0 # ATWFileList # 找出現在目錄所有.py L1 = [] L1.clear() ss = os.listdir(HtmlUrl) for item in ss: if(item.endswith(n2)): L1.append(item) i = 0 while i < len(L1): print(' ',i,'=====',L1...
StarcoderdataPython
3366971
from time import sleep while True: print('Hello world') sleep(1)
StarcoderdataPython
3232067
<reponame>BradleyBrown19/ModernArchitecturesFromScratch # AUTOGENERATED! DO NOT EDIT! File to edit: FullyConnectedNetwork.ipynb (unless otherwise specified). __all__ = ['get_weight', 'linear', 'relu', 'lin_rel', 'softmax', 'mse_loss', 'Module', 'Linear', 'ReLU', 'CrossSoft', 'eps', 'Model'] # Cell from .ba...
StarcoderdataPython
3363364
<reponame>pibico/frappe # Copyright (c) 2022, Frappe Technologies Pvt. Ltd. and Contributors # License: MIT. See LICENSE # Tree (Hierarchical) Nested Set Model (nsm) # # To use the nested set model, # use the following pattern # 1. name your parent field as "parent_item_group" if not have a property nsm_parent_field a...
StarcoderdataPython
1727445
<reponame>moeyensj/atm #!/usr/bin/env python # -*- coding: UTF-8 -*- import numpy as np from ..constants import Constants from .hg import calcQ __all__ = ["calcTss", "calcT1"] S = Constants.SOLAR_CONSTANT sigma = Constants.STEFAN_BOLTZMANN def calcTss(r, p_v, eps, G, eta): """ Calculate the sub...
StarcoderdataPython
125672
<reponame>bugengine/BugEngine from be_typing import TYPE_CHECKING class LR0Path(object): def __init__(self, node, use_marker=True): # type: (LR0DominanceNode, bool) -> None self._node = node self._use_marker = use_marker self._hash_cache = (self._node._item, ) # type: Optional[Tupl...
StarcoderdataPython
105037
import argparse, sys, json, yaml import pandas as pd import asyncio from iotsim.utils import to_iterable from iotsim.runtime.destinations import known_destinations from iotsim.assembler import from_config if __name__ != '__main__': sys.exit("This program must be run as a standalone script") parser = argparse.A...
StarcoderdataPython
3325531
# coding: utf-8 """ OANDA v20 REST API The full OANDA v20 REST API Specification. This specification defines how to interact with v20 Accounts, Trades, Orders, Pricing and more. To authenticate use the string 'Bearer ' followed by the token which can be obtained at https://www.oanda.com/demo-account/tpa/perso...
StarcoderdataPython
3337570
<reponame>onezens/python<filename>virtualenv/virtualenv.py #!/usr/bin/python #encoding=utf8 # 创建一个独立的 :virtualenv --no-site-packages venv # 新建的Python环境被放到当前目录下的venv目录。有了venv这个Python环境,可以用source进入该环境: # 了venv这个Python环境,可以用source进入该环境 : source venv/bin/activate # 在venv环境下,用pip安装的包都被安装到venv这个环境下, # 系统Python环境不受任何影响。也就是说...
StarcoderdataPython
1621741
<gh_stars>0 # # Copyright 2020 Nebulon, Inc. # All Rights Reserved. # # DISCLAIMER: THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO # EVENT SHALL THE AUTHOR...
StarcoderdataPython
3378255
from typing import ( List, Tuple, Dict, Callable, ) import os import argparse import logging import torch from torch import optim from allennlp.models import Model from allennlp.data.vocabulary import Vocabulary from allennlp.data import DatasetReader from allennlp.data.token_indexers.elmo_indexer im...
StarcoderdataPython
3295459
<filename>acme/settings.py import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SECRET_KEY = <KEY>' DEBUG = True ALLOWED_HOSTS = [] INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contri...
StarcoderdataPython
3207209
<filename>virt/lib/python3.7/site-packages/martor/fields.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django import forms from .settings import MARTOR_ENABLE_LABEL from .widgets import (MartorWidget, AdminMartorWidget) class MartorFormField(forms.CharField): def __init__(self, *args,...
StarcoderdataPython
3342043
<gh_stars>100-1000 expected_output = { "cdp": { "index": { 0: { "capability": "H P M", "hold_time": 94, "local_interface": "FastEthernet0/1", "platform": "420HD_GBE", "port_id": "Esw0" }, 1: {...
StarcoderdataPython
4833903
''' Created by auto_sdk on 2019.08.05 ''' from dingtalk.api.base import RestApi class OapiCateringPersonalorderPushRequest(RestApi): def __init__(self,url=None): RestApi.__init__(self,url) self.fee_actually_pay = None self.fee_after_discount = None self.fee_original = None self.fee_should_pay = None self.o...
StarcoderdataPython
137468
<filename>test_str_divide.py<gh_stars>1-10 import unittest from str_divide import divide class TestDivideStrings(unittest.TestCase): #cases to test # divide by 0 error # divide by 1 # 0 divided by # def test_obvious_small(self): self.assertEqual(divide('10','2'), '5') se...
StarcoderdataPython
159176
from tkinter import * from tkinter import ttk root = Tk() root.geometry("640x480+200+200") ttk.Label(root, text="Orange", background="orange").place( x=100, y=50, width=100, height=50 ) ttk.Label(root, text="Red", background="red").place( relx=0.5, rely=0.5, anchor="center", relwidth=0.5, relheight=0.5 ) t...
StarcoderdataPython
1658279
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('achat', '0002_achat_association'), ] operations = [ migrations.CreateModel( name='Pending', fields=[...
StarcoderdataPython
1666181
<gh_stars>0 import json import os,glob import time import numpy as np from flask_socketio import emit from flask_login import current_user from app import socketio, app, session from diagnostic_text import * # from models import add_file_selected, user_files_selected, remove_file_selected, clear_user_file_selected, add...
StarcoderdataPython
3341916
<reponame>tahirs95/pepys-import def format_datatime(datetime): microsecond_text = "" if datetime.microsecond: if datetime.microsecond > 9999: microsecond_text = ".9999" else: microsecond_text = "." + str(datetime.microsecond).zfill(4) return datetime.strftime...
StarcoderdataPython
1604537
#!/usr/bin/env python """ This is the base class seisflows.workflow.Inversion This is a main Seisflows class, it controls the main workflow. """ import os import sys import time from glob import glob import numpy as np from seisflows.config import custom_import from seisflows.tools import unix from seisflows.tools.to...
StarcoderdataPython
119703
<gh_stars>10-100 # -*- coding: utf-8 -*- # Copyright 2020 ICON 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 requir...
StarcoderdataPython
1684729
<reponame>bluesky0960/AlgorithmTest<filename>AlgorithmTest/BOJ_STEP_PYTHON/Step2/BOJ9498.py #https://www.acmicpc.net/problem/9498 a = int(input()) if a >= 90: print("A") elif a >= 80: print("B") elif a >= 70: print("C") elif a >= 60: print("D") else: print("F")
StarcoderdataPython
4800523
<filename>NewTests/testEncoderSimilarity.py import torch from torchvision import transforms import matplotlib.pyplot as plt import os from PIL import Image import glob import numpy as np from model_new import * from model import * from model_small import ImageCompressor_small from models.temp import Cheng2020Attention ...
StarcoderdataPython
3306695
<reponame>McMasterAI/RadiologyandAI-MedicalZooPytorch import numpy as np import scipy.ndimage as ndimage def random_rotate3D(img_numpy, min_angle, max_angle): """ Returns a random rotated array in the same shape :param img_numpy: 3D numpy array :param min_angle: in degrees :param max_angle: in deg...
StarcoderdataPython
43276
<filename>src/calculator_app.py from flask import Flask, render_template, request, redirect, url_for from calculator_logic import find_take_home_OR api = Flask(__name__) tax_inputs = {} @api.route('/welcome/') def hello_world(): # if request.method == 'GET': return render_template('tax_welcomepage.html') @ap...
StarcoderdataPython
12385
<filename>initialize_app_db.py<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- """ The next steps use just in case to recreate the already existing DB Backup and Delete the folder "migrations" Backup and Delete the file "app.db" Execute the next console commands Linux (venv) $ export FLASK_APP=microblog.py ...
StarcoderdataPython
3343935
<reponame>italo-batista/problems-solving<filename>models/queue.py class queue: def __init__(self, size): self.array = [0] * size self.tail = -1 self.head = 0 self.elements = 0 self.size = size def push(self, element): self.tail = (self.tail + 1) % self.size ...
StarcoderdataPython
3330169
from common.test_base.page_base import PageBase class PersonalPage(PageBase): def go_to_favorite_page(self): self.log.info("go to favorite") self.element("favorite_link").click() sync = self.element("sync_complete_toast").wait_presence() self.log.info(sync.text) ...
StarcoderdataPython
1649216
# row selection using loc and iloc import pandas as pd import numpy as np d={'one':pd.Series([1,2,3],index=['a','b','c']), 'two':pd.Series([1,2,3,4],index=['a','b','c','d']) } df=pd.DataFrame(d) print(df.loc['b']) print(df.iloc[0])
StarcoderdataPython
3285107
<gh_stars>0 import json class Edge: id = -1 node_1_id = -1 node_2_id = -1 weight = 1 class Node: id = -1 edges = None # list of (edge_id, node_id) class Instance: def __init__(self, filepath=None): self.nodes = [] self.edges = [] self.maximum_length = 1 ...
StarcoderdataPython
1620780
<filename>bd_tools/utils.py """Defines a set of convenient utilities to use in scripts.""" import time from typing import Callable class DebugLoop: """Loops a function and prints statistics.""" def __init__( self, callback: Callable[[], bool], num_iters: int, iters_per_print: ...
StarcoderdataPython
3243100
# adjectives.json and nouns.json from: https://github.com/leonardr/olipy # places.json from personal Moves data. import json nouns_file = open("nouns.json").read() adjectives_file = open("adjectives.json").read() places_file = open("places.json").read() nouns = json.loads(nouns_file) adjectives = json.loads(adjectives...
StarcoderdataPython
139794
<filename>TargetDataLoaderProcess/data_loader.py # Python 3 required. This is a seperate process. import aiohttp import asyncio import async_timeout import os import numpy as np import time import cv2 # Settings: Buffer = 100 BackBuffer = 20 Max_Query = 12 Timeout = 40 url_base = "https://test.yisual.com/images/me...
StarcoderdataPython
4806573
from floodsystem import geo from floodsystem.stationdata import build_station_list def run(): """Prints the number of rivers with a station and prints the first 10 stations at the rivers River Aire, River Cam, and River Thames in alphabetical order. """ # Build station list stations = build...
StarcoderdataPython
3317668
<filename>__manifest__.py # © 2021 <NAME> <<EMAIL>>, SOULinux # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { # pylint: disable=C8101,C8103 'name': 'Plano de Contas SOULinux', 'summary': "SOULinux - Plano de Contas", 'description': """SOULinux - Plano de Contas para Microempresa"""...
StarcoderdataPython
1751064
from concurrent.futures import ThreadPoolExecutor from .mp import connection as _connection from .executor import CoroBuilder from .util import run_in_executor __all__ = ["AioConnection"] class AioConnection(metaclass=CoroBuilder): coroutines = [ "recv", "poll", "send_bytes", "re...
StarcoderdataPython
1755392
<reponame>samkim91/CookItYourself import requests from bs4 import BeautifulSoup content = $_POST[''];
StarcoderdataPython
3285727
#! /usr/bin/env python import femtomes_ros_driver.femtomes as femtomes import rospy def main(): rospy.init_node("femtomes_rtk") ip = rospy.get_param("~ip") port = rospy.get_param("~port") rtk = femtomes.Femtomes(ip, port) rtk.capture() rospy.spin() if __name__ == "__main__": try: ...
StarcoderdataPython
4810824
<filename>static/bingfaceshi.py # -*- coding: utf-8 -*- # author: lituoheng # 环境要求python3以上 # 在命令行cmd用管理员模式使用"pip install gevent grequests"即可安装需要的第三方模块 import grequests import time from collections import Counter # 重写了模块内的方法,增加请求成功时的回调 def map(requests, stream=False, size=None, exception_handler=None, g...
StarcoderdataPython
33805
from flask import g, request from flask_restful import reqparse from werkzeug import datastructures from ..exceptions.system_error import SystemError from ..exceptions.system_exception import SystemException from ..exceptions.service_error import ServiceError from ..exceptions.service_exception import ServiceException...
StarcoderdataPython
1634366
<filename>targets/power/isa/p-common/isa.py # Copyright 2011-2021 IBM 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 req...
StarcoderdataPython
196973
<filename>jsk_recognition/jsk_perception/node_scripts/deep_sort/vis_bboxes.py import six import cv2 def voc_colormap(nlabels): colors = [] for i in six.moves.range(nlabels): r, g, b = 0, 0, 0 for j in range(8): if i & (1 << 0): r |= 1 << (7 - j) if i & (...
StarcoderdataPython
1731922
<reponame>plamen-nikolov/djangocms-flexslider # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig from django.utils.translation import ugettext_lazy as _ class PropertiesConfig(AppConfig): name = 'djangocms_flexslider' verbose_name = _("djangocms flexsli...
StarcoderdataPython
1619314
from importlib import metadata # print(metadata.version('pip')) metadados_pip = metadata.metadata('pip') print(metadados_pip) print(list(metadados_pip)) print(metadados_pip['Project-URL']) print(len(metadata.files('django'))) print(metadata.requires('django'))
StarcoderdataPython
148040
""" Evaluation Scripts """ from __future__ import absolute_import from __future__ import division from collections import namedtuple, OrderedDict from network import mynn import argparse import logging import os import torch import time import numpy as np from config import cfg, assert_and_infer_cfg import network imp...
StarcoderdataPython
1717061
from typing import Any from FlaUILibrary.flaui.exception import FlaUiError class TreeItemsParser: """ Helper class which handles the management of the given location string. The location is used to locate the exact tree item in the tree control. Examples: location = N:Nameofitem1->N:Nameofitem2->N...
StarcoderdataPython
3315974
<gh_stars>10-100 ''' Author: <NAME> Dec 10, 2020 Data and paper from here: https://robjhyndman.com/publications/mint/ Frequency is monthly, total of 36 observations Description: ''' # Imports import pandas as pd import numpy as np from collections import OrderedDict from matplotlib import pyplot as plt def import_...
StarcoderdataPython
3277685
# -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-04-22 11:53 from __future__ import unicode_literals import django.core.validators from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('part', '...
StarcoderdataPython
3348508
#!/usr/bin/env python # encoding: utf-8 import heapq class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution: # base subroutine def mergeTwoLists(l1, l2): curr = dummy = ListNode(-1) while l1 and l2: if l1.val < l2.val: ...
StarcoderdataPython
4812377
<filename>compiler/dialect_libraries/bq_library.py #!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICE...
StarcoderdataPython
3330179
import streamlit as st import altair as alt from clean_data_2 import * import pandas as pd st.image('logo.jpg', width=150, format='JPEG') st.title('Top offers by demographic') st.sidebar.title('Parameters') income = st.sidebar.slider('Income level', 0, 140_000, 40_000) gender = st.sidebar.selectbox( "Select Gen...
StarcoderdataPython
3332310
from dataclasses import dataclass @dataclass class Video: """Represents an YouTube video.""" playlist_id: int = int() video_id: int = int() name: str = str() search_query: str = str() search_query_bg: str = str() date: int = int() def __iter__(self): """Creates an iterator of...
StarcoderdataPython
1770451
<reponame>SemanticPriming/word2manylanguages import bz2 import html import numpy as np import os import pandas as pd import re import requests import simhash import sklearn.linear_model import sklearn.model_selection import sklearn.preprocessing import sklearn.utils import zipfile from lxml import etree from gensim.mod...
StarcoderdataPython
3325602
from Camera import Camera from abc import ABC import numpy as np import cv2 from skimage import io from io import BytesIO from IPython.display import clear_output, Image, display, update_display import PIL try: from Cameras.PySpinCapture import PySpinCapture as psc prin...
StarcoderdataPython
3334797
""" This module defines functions and data structures relating to descriptors. A descriptor is intended to be a generalized entity name; it's a short string expression that can represent the input or output of a function in Bionic. For example, instead of referring only to atomic entities like `raw_data` or `model`, we...
StarcoderdataPython
1791136
<reponame>pwnfooj716/cube-program import random import copy POP_SIZE = 50 INITIAL_LENGTH = 5 class PuzzleSolver: def __init__(self, puzzle): self.puzzle = puzzle def generate(self, length): chromosome = "" temp_moves = self.puzzle.moves prev_move = "" for i in ra...
StarcoderdataPython
3365540
<filename>budget/util/fileloader.py import json import logging import yaml def load_json(filename): fh = None try: with open(filename) as f: fh = json.load(f) except TypeError: fh = json.load(filename) except IOError: fh = json.loads('{}') except ValueError: ...
StarcoderdataPython
4804733
<gh_stars>1-10 """ Displays index.html. Leaves the routing to react. """ from flask import render_template from . import app @app.route('/') @app.route('/gameDayLineups') @app.route('/gameDateGames') @app.route('/gameDayAnalysis') def show_index(): return render_template('index.html')
StarcoderdataPython
153875
<filename>kinova_demo/nodes/kinova_demo/grab_object_in_tf.py #!/usr/bin/env python import rospy import numpy as np from pose_action_client import moveArm, currentCartesianCommand,Quaternion2EulerXYZ from fingers_action_client import moveFingers, currentFingerPosition,unitParser from math import pi import tf aux = [0....
StarcoderdataPython
24321
<gh_stars>0 """ _______ __ _______ __ __ __ | _ .----.-----.--.--.--.--| | _ | |_.----|__| |--.-----. |. 1___| _| _ | | | | _ | 1___| _| _| | <| -__| |. |___|__| |_____|________|_____|____ |____|__| |__|__|__|_____| |: 1 | |: ...
StarcoderdataPython
3680
import tkinter as tk import tkinter.messagebox from Control import Control class View: def __init__(self, control : Control.Control): self.control = control # Init Window self.root = tk.Tk() self.root.title(u"Header File Generator") self.root.geometry("700x800") se...
StarcoderdataPython
180818
import unittest from lmatch import film class TestFilm(unittest.TestCase): def setUp(self): self.sample_film = film.Film(412, "path_that", "name_this", 5.21) def test_ctor(self): self.assertEqual(self.sample_film.id, 412) self.assertEqual(self.sample_film.name, "name_this") sel...
StarcoderdataPython
3256198
# Generated by Django 3.1.6 on 2021-08-08 07:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('jobs', '0014_auto_20210807_1625'), ] operations = [ migrations.RemoveField( model_name='templatetask', name='parameters', ...
StarcoderdataPython
120162
<gh_stars>1-10 __author__ = 'eric' from simulate.order_input import OrdersInput from simulate.market_struct import MarketStructure def simulate(df_market_struct, ls_symbols): num_trading_days = len(df_market_struct) #iterate over each trading day for day in xrange(num_trading_days): na_orders = d...
StarcoderdataPython
1726373
<reponame>agrandev/Openfdafinal<gh_stars>0 # -*- coding: utf-8 -*- # # Copyright (C) 2015-2016 Bitergia # # 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 # (...
StarcoderdataPython
3215553
<gh_stars>1-10 # Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed ...
StarcoderdataPython
67204
from ..models import * from .availability_calendar_api import * from .calendar_api import * import json from datetime import datetime, timedelta def get_best(event_id): """ :param event_id: the id of the event we want to get best times of :return: A list of sorted pairs: [ (time, [users]), (time, [users]...
StarcoderdataPython
3224480
<gh_stars>0 import random random.seed(42) from virus import Virus class Person(object): ''' Person objects will populate the simulation. ''' def __init__(self, _id, is_vaccinated, infection=None): ''' We start out with is_alive = True, because we don't make vampires or zombies. All other valu...
StarcoderdataPython
101809
<reponame>hymer-up/streamlink import unittest from streamlink.plugins.stv import STV class TestPluginSTV(unittest.TestCase): def test_can_handle_url(self): self.assertTrue(STV.can_handle_url('https://player.stv.tv/live')) self.assertTrue(STV.can_handle_url('http://player.stv.tv/live')) def t...
StarcoderdataPython
41188
<gh_stars>1-10 import datetime from nba_api.stats.endpoints import Scoreboard from nba_api.stats.library.parameters import LeagueID from nba_api.stats.library.data import teams def get_teams(): return dict((team[0],team[5]) for team in teams) def get_games(date): teams = get_teams() gamefinder = Scoreboa...
StarcoderdataPython
3254503
<filename>bookmarks/urls.py<gh_stars>0 from django.conf.urls import include, url from . import views from rest_framework import routers router = routers.DefaultRouter(trailing_slash=False) router.register(r'bookmarks', views.BookmarkViewSet, 'bookmarks') router.register(r'categories', views.CategoryViewSet, 'categori...
StarcoderdataPython
75637
<gh_stars>0 from Scenes.TitleScreen import TitleScene import pygame import Tools.Images import datetime def run_game(width, height, fps, starting_scene): pygame.init() screen = pygame.display.set_mode((width, height)) clock = pygame.time.Clock() current_time = datetime.datetime.now() time_passed =...
StarcoderdataPython
82484
a=2 b=3 #三目运算符 str='a>b'if a>b else 'a<b' print(str)
StarcoderdataPython
29115
<reponame>gaivin/GWeb #!/usr/bin/env python # encoding: utf-8 """ @version: v1.0 @author: <NAME> @license: Apache Licence @contact: <EMAIL> @site: @software: PyCharm @file: chart.py @time: 10/10/2018 4:14 PM """ from pyecharts import Bar, Line, WordCloud import pandas as pd import random...
StarcoderdataPython
77706
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'Encoder_Control_GUI_ONLY.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 im...
StarcoderdataPython
3377035
<gh_stars>1-10 #!/usr/bin/env python2 # -*- coding: utf8 -*- # # Copyright (c) 2014 unfoldingWord # http://creativecommons.org/licenses/MIT/ # See LICENSE file for details. # # Contributors: # <NAME> <<EMAIL>> # # Requires PyGithub for unfoldingWord export. ''' Converts translationWords from JSON to Markdown. ''...
StarcoderdataPython
10223
<filename>edivorce/apps/core/views/graphql.py import graphene import graphene_django from django.http import HttpResponseForbidden from graphene_django.views import GraphQLView from graphql import GraphQLError from edivorce.apps.core.models import Document class PrivateGraphQLView(GraphQLView): def dispatch(self...
StarcoderdataPython
92825
<filename>26_ShortestPath/Step07/gamjapark.py import sys V, E = map(int, sys.stdin.readline().split()) max_size = E * (400 * 399) + 1 shortest_path = [[max_size for _ in range(V + 1)] for _ in range(V + 1)] for e in range(E): a, b, c = map(int, sys.stdin.readline().split()) shortest_path[a][b] = c for k in range(1...
StarcoderdataPython
114400
<reponame>aleasims/Peach def Test(tester): from Ft.Lib.DbUtil import EscapeQuotes for i,out in [('hello','hello'), ("he'llo",r"he\'llo"), ("he'll'o",r"he\'ll\'o"), ("'hello'",r"\'hello\'"), ("'","\\'"), (r"hhh\\hhhh",r"h...
StarcoderdataPython
3274630
<reponame>shinymud/ShinyMUD<filename>tests/shinytest/models/test_item.py<gh_stars>10-100 from shinytest import ShinyTestCase class TestItem(ShinyTestCase): def test_something(self): pass
StarcoderdataPython
1711597
<gh_stars>1-10 from django.conf.urls.defaults import * from news_and_events import views # from news_and_events.views import NewsAndEventsViews urlpatterns = patterns('', # news and events items url(r"^news/(?P<slug>[-\w]+)/$", views.newsarticle, name="newsarticle"), url(r"^event/(?P<slug>[-\w]+)/$",...
StarcoderdataPython
9234
import uvicorn from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware from routes import items import config from constants import * config.parse_args() app = FastAPI( title="API", description="API boilerplate", version="1.0.0", openapi_tags=API_TAGS_METADATA, ) app.add_midd...
StarcoderdataPython
192870
<filename>src/pipelines/epidemiology/us_wa_authority.py<gh_stars>100-1000 # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
StarcoderdataPython
3344536
""" Script to create catalogue entries for LLAGN sample. The catalogue is given by the positional cross-match between 2RXS and AllWISE, and removing the 3LAC blazars. A Seyferntess PDF is assigned and only sources with Seyfertness larger than 0.5 are selected in the final sample. """ from flarestack.analyses.agn_cores...
StarcoderdataPython
34001
<reponame>jpsantos-mf/ezdxf # Copyright (c) 2014-2019, <NAME> # License: MIT License import pytest from ezdxf.sections.acdsdata import AcDsDataSection from ezdxf import DXFKeyError from ezdxf.lldxf.tags import internal_tag_compiler, group_tags from ezdxf.lldxf.tagwriter import TagCollector, basic_tags_from_text @pyt...
StarcoderdataPython
4809302
<reponame>mtu2/stargazing import concurrent.futures import re import urllib.request import stargazing.audio.audio_player as audio_ap import stargazing.config.config as config from stargazing.utils.helper_funcs import silent_stderr, start_daemon_thread class AudioController(): """Audio manager, pre-loads the audi...
StarcoderdataPython
3249039
from django.utils.translation import gettext as _ from django.contrib.admin import ModelAdmin, register, site, display from django.contrib.auth.models import Group from .models import Usuario, Grupo site.unregister(Group) @register(Grupo) class GrupoAdmin(ModelAdmin): pass @register(Usuario) class UsuarioAdm...
StarcoderdataPython
1774519
from typing import List from Core.Base.BaseValidation import BaseValidation from Core.DatabaseFactory.DatabaseType import DatabaseType from Model.Bot import BotDataModel from Model.QnA import QnADataModel from Utils.DatabaseUtils import DatabaseHelper from .KnowledgePage import KnowledgePage class Knowledg...
StarcoderdataPython
4825438
########################################################################### # Imports ########################################################################### # Standard library imports import os import shutil from typing import Tuple from automan.api import Problem, Simulation, Automator # Local imports from data_...
StarcoderdataPython
1784516
class Pupil: next_id = 0 def __init__(self, loc, smoothing_factor): self.smoothing_factor = smoothing_factor self.location = loc self.id = Pupil.next_id self.certainty = 0 self.last_locations = [] Pupil.next_id += 1 def update_location(self, new_loc): ...
StarcoderdataPython
33878
<gh_stars>1-10 # Copyright 2022 DeepMind Technologies Limited # # 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 applicab...
StarcoderdataPython
43698
<reponame>LolloneS/DDPG-PyTorch import random from typing import List from src.transition import Transition random.seed(42) class ReplayBuffer: def __init__(self, size: int, random: bool = False): self.size = size self.memory: List[Transition] = [] self.random = random self.occup...
StarcoderdataPython
62258
<filename>fibonacci_calculator_onion/fibonacci_table.py class FibonacciTable: def __init__(self): self.forward_look_up_table = {0: 0, 1: 1} self.backward_look_up_table = {0: 0, 1: 1} def _build_lookup_table(self, fib_index: int) -> None: if fib_index in self.forward_look_up_table.keys(...
StarcoderdataPython
10025
<gh_stars>0 import os, subprocess def compile_core(comp, scilib): """ ATTENTION, NOT FINISHED """ subprocess.call(("make pawpy_%s"%comp).split()) def compile_core(comp, scilib): """ ATTENTION, NOT FINISHED """ subprocess.call("make hfc".split())
StarcoderdataPython
103640
# Copyright (C) 2019 <NAME>, <NAME>, <NAME>, <NAME> # All rights reserved. # This code is licensed under BSD 3-Clause License. import sys import os import numpy as np if __name__ == '__main__': xyz_list_path = sys.argv[1] xyzs = [xyz for xyz in os.listdir(xyz_list_path) if xyz.endswith('_predict_3.xyz')] ...
StarcoderdataPython
1652635
<filename>slender/tests/list/test_concat.py from unittest import TestCase from expects import expect, equal, raise_error from slender import List class TestConcat(TestCase): def setUp(self): self.l = List([1, 2, 3]) def test_concat_if_other_is_empty(self): expect(self.l.concat([]).to_list()...
StarcoderdataPython