max_stars_repo_path stringlengths 4 286 | max_stars_repo_name stringlengths 5 119 | max_stars_count int64 0 191k | id stringlengths 1 7 | content stringlengths 6 1.03M | content_cleaned stringlengths 6 1.03M | language stringclasses 111
values | language_score float64 0.03 1 | comments stringlengths 0 556k | edu_score float64 0.32 5.03 | edu_int_score int64 0 5 |
|---|---|---|---|---|---|---|---|---|---|---|
parser/fase2/team20/execution/executeSentence2.py | LopDlMa/tytus | 0 | 10000 | <gh_stars>0
from .AST.sentence import *
from .AST.expression import *
from .AST.error import *
import sys
sys.path.append("../")
from console import *
def executeSentence2(self, sentence):
if isinstance(sentence, CreateDatabase):
h=0
elif isinstance(sentence, ShowDatabases):
... | from .AST.sentence import *
from .AST.expression import *
from .AST.error import *
import sys
sys.path.append("../")
from console import *
def executeSentence2(self, sentence):
if isinstance(sentence, CreateDatabase):
h=0
elif isinstance(sentence, ShowDatabases):
h=0
e... | en | 0.11865 | #print(sentence.columns[0].function) #print(sentence.columns[0].expression) | 2.578078 | 3 |
src/test/cli/component.py | huseyinbolt/cord-tester | 0 | 10001 | <filename>src/test/cli/component.py
# Copyright 2017-present Open Networking 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
#
# Unl... | <filename>src/test/cli/component.py
# Copyright 2017-present Open Networking 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
#
# Unl... | en | 0.833798 | # Copyright 2017-present Open Networking 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 agr... | 1.402398 | 1 |
python-framework/handlers/base/auth.py | huangxingx/python-framework | 7 | 10002 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author: x.huang
# @date:17-8-4
import logging
from pony.orm import db_session
from handlers.base.base import BaseRequestHandler
class LoginRequireError(Exception):
pass
class AuthBaseHandler(BaseRequestHandler):
""" 登录验证的基类 """
def prepare(self):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @author: x.huang
# @date:17-8-4
import logging
from pony.orm import db_session
from handlers.base.base import BaseRequestHandler
class LoginRequireError(Exception):
pass
class AuthBaseHandler(BaseRequestHandler):
""" 登录验证的基类 """
def prepare(self):
... | en | 0.335607 | #!/usr/bin/env python # -*- coding: utf-8 -*- # @author: x.huang # @date:17-8-4 登录验证的基类 | 2.208761 | 2 |
pysol/core/helpers.py | lotfio/pysol | 2 | 10003 | # -*- coding: utf-8 -*-
#| This file is part of cony
#|
#| @package Pysol python cli application
#| @author <<NAME>>
#| @license MIT
#| @version 0.1.0
#| @copyright 2019 <NAME>
import sys
# load module function
# this function loads a module by string name
def load_module(module):
module_path ... | # -*- coding: utf-8 -*-
#| This file is part of cony
#|
#| @package Pysol python cli application
#| @author <<NAME>>
#| @license MIT
#| @version 0.1.0
#| @copyright 2019 <NAME>
import sys
# load module function
# this function loads a module by string name
def load_module(module):
module_path ... | en | 0.263816 | # -*- coding: utf-8 -*- #| This file is part of cony #| #| @package Pysol python cli application #| @author <<NAME>> #| @license MIT #| @version 0.1.0 #| @copyright 2019 <NAME> # load module function # this function loads a module by string name | 2.14629 | 2 |
autograd_hacks/test_autograd_hacks.py | jusjusjus/autograd-hacks | 1 | 10004 | <reponame>jusjusjus/autograd-hacks<gh_stars>1-10
import torch
import torch.nn as nn
import torch.nn.functional as F
import pytest
from . import autograd_hacks
class StriddenNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 20, 5, stride=2, padding=2)
self.c... | import torch
import torch.nn as nn
import torch.nn.functional as F
import pytest
from . import autograd_hacks
class StriddenNet(nn.Module):
def __init__(self):
super().__init__()
self.conv1 = nn.Conv2d(1, 20, 5, stride=2, padding=2)
self.conv2 = nn.Conv2d(20, 30, 5, stride=2, padding=2)
... | en | 0.596891 | Lenet-5 from https://github.com/pytorch/examples/blob/master/mnist/main.py Lenet-5 from https://github.com/pytorch/examples/blob/master/mnist/main.py Tiny LeNet-5 for Hessian testing # 28x28 # 7x7 # 6x6 # 3x3 # 2x2 # 1x1 # C * W * H # Autograd helpers, from https://gist.github.com/apaszke/226abdf867c4e9d6698bd198f3b45f... | 2.743614 | 3 |
tests/test_command.py | paulfurley/Mailpile | 1 | 10005 | <gh_stars>1-10
import unittest
import mailpile
from mock import patch
from mailpile.commands import Action as action
from tests import MailPileUnittest
class TestCommands(MailPileUnittest):
def test_index(self):
res = self.mp.rescan()
self.assertEqual(res.as_dict()["status"], 'success')
def ... | import unittest
import mailpile
from mock import patch
from mailpile.commands import Action as action
from tests import MailPileUnittest
class TestCommands(MailPileUnittest):
def test_index(self):
res = self.mp.rescan()
self.assertEqual(res.as_dict()["status"], 'success')
def test_search(sel... | en | 0.916306 | # A random search must return results in less than 0.2 seconds. | 2.635591 | 3 |
navrep/envs/rosnavtrainencodedenv.py | ReykCS/navrep | 0 | 10006 | <reponame>ReykCS/navrep
from gym import spaces
import numpy as np
from scipy import interpolate
import yaml
from navrep.envs.navreptrainenv import NavRepTrainEnv
from navrep.rosnav_models.utils.reward import RewardCalculator
from navrep.rosnav_models.utils.reward import RewardCalculator
class RosnavTrainEncodedEnv(N... | from gym import spaces
import numpy as np
from scipy import interpolate
import yaml
from navrep.envs.navreptrainenv import NavRepTrainEnv
from navrep.rosnav_models.utils.reward import RewardCalculator
from navrep.rosnav_models.utils.reward import RewardCalculator
class RosnavTrainEncodedEnv(NavRepTrainEnv):
""" ... | en | 0.492909 | takes a (2) action as input outputs encoded obs (546) # reward, reward_info = self.reward_calculator.get_reward( # np.array(lidar), # (rho, theta), # action=np.array([action_encoded[0], action_encoded[2]]), # global_plan=None, # robot_pose=None # ) # done = reward_info["is_done"] # done = reward... | 2.229795 | 2 |
pdm/models/repositories.py | gaojiuli/pdm | 1 | 10007 | <gh_stars>1-10
from __future__ import annotations
import sys
from functools import wraps
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Optional, Tuple
from pdm._types import CandidateInfo, Source
from pdm.context import context
from pdm.exceptions import CandidateInfoNotFound, CorruptedCacheError
... | from __future__ import annotations
import sys
from functools import wraps
from typing import TYPE_CHECKING, Callable, Dict, Iterable, List, Optional, Tuple
from pdm._types import CandidateInfo, Source
from pdm.context import context
from pdm.exceptions import CandidateInfoNotFound, CorruptedCacheError
from pdm.models... | en | 0.848441 | A Repository acts as the source of packages and metadata. :param sources: a list of sources to download packages from. :param environment: the bound environment instance. Get matching sources based on the index attribute. Get (dependencies, python_specifier, summary) of the candidate. # HACK: If this candidate ... | 2.043721 | 2 |
tests/backends/test_cookie.py | euri10/starsessions | 31 | 10008 | import pytest
from starsessions import SessionBackend
@pytest.mark.asyncio
async def test_cookie_read_write(cookie: SessionBackend, session_payload: dict) -> None:
new_id = await cookie.write(session_payload, "session_id")
assert await cookie.read(new_id) == session_payload
@pytest.mark.asyncio
async def t... | import pytest
from starsessions import SessionBackend
@pytest.mark.asyncio
async def test_cookie_read_write(cookie: SessionBackend, session_payload: dict) -> None:
new_id = await cookie.write(session_payload, "session_id")
assert await cookie.read(new_id) == session_payload
@pytest.mark.asyncio
async def t... | none | 1 | 2.278279 | 2 | |
sqlalchemy_dremio/db.py | thbeh/sqlalchemy_dremio | 14 | 10009 | <gh_stars>10-100
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from pyarrow import flight
from sqlalchemy_dremio.exceptions import Error, NotSupportedError
from sqlalchemy_dremio.flight_auth import H... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
from pyarrow import flight
from sqlalchemy_dremio.exceptions import Error, NotSupportedError
from sqlalchemy_dremio.flight_auth import HttpDremioClientAu... | en | 0.854859 | Decorator that checks if connection/cursor is closed. Decorator that checks if the cursor has results from `execute`. # TODO: Find a better way to extend to addition flight parameters Close the connection now. # already closed Return a new Cursor Object using the connection. # no-op Connection cursor. # This read/write... | 2.231761 | 2 |
docker-images/rasa2/snips_services/tts_server.py | sanyaade-machine-learning/opensnips_original | 57 | 10010 | <gh_stars>10-100
#!/opt/rasa/anaconda/bin/python
# -*-: coding utf-8 -*-
""" Snips core and nlu server. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import time
import os
from socket import error as... | #!/opt/rasa/anaconda/bin/python
# -*-: coding utf-8 -*-
""" Snips core and nlu server. """
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import json
import time
import os
from socket import error as socket_error
fr... | en | 0.424156 | #!/opt/rasa/anaconda/bin/python # -*-: coding utf-8 -*- Snips core and nlu server. # apt-get install sox libsox-fmt-all #print("MESSAGEtts: {}".format(msg.topic)) # .decode('utf-8') #pubCommand = "mosquitto_pub -h " +self.mqtt_hostname+" -t 'hermes/audioServer/default/playBytes/0049a91e-8449-4398-9752-07c858234' -f '" ... | 2.342232 | 2 |
gtd/migrations/0018_context_color.py | jimbofreedman/naggingnelly-api | 0 | 10011 | <gh_stars>0
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-08-02 17:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gtd', '0017_auto_20180108_1508'),
]
operations = [
migrations.A... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-08-02 17:53
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gtd', '0017_auto_20180108_1508'),
]
operations = [
migrations.AddField(
... | en | 0.715825 | # -*- coding: utf-8 -*- # Generated by Django 1.11.9 on 2018-08-02 17:53 | 1.488076 | 1 |
neuralintents/main.py | nitori/neuralintents | 0 | 10012 | from abc import ABCMeta, abstractmethod
import random
import json
import pickle
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import nltk
from nltk.stem import WordNetLemmatizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.... | from abc import ABCMeta, abstractmethod
import random
import json
import pickle
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import nltk
from nltk.stem import WordNetLemmatizer
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout
from tensorflow.... | en | 0.879207 | Implemented in child class Implemented in child class Implemented in child class Implemented in child class Implemented in child class | 2.279748 | 2 |
cogs/TieThePie.py | Engineer152/Engineer-Bot | 0 | 10013 | <reponame>Engineer152/Engineer-Bot
import discord
from discord.ext import commands
client = commands.Bot(command_prefix='your prefix',owner_ids = {your user id},case_insensitive=True )
class TieThePie(commands.Cog):
def __init__(self,client):
self.client=client
@commands.command()
async def tiethepie(self,... | import discord
from discord.ext import commands
client = commands.Bot(command_prefix='your prefix',owner_ids = {your user id},case_insensitive=True )
class TieThePie(commands.Cog):
def __init__(self,client):
self.client=client
@commands.command()
async def tiethepie(self,ctx):
embed=discord.Embed(title... | none | 1 | 2.763343 | 3 | |
python/lsst/eotest/simulation/generate_Fe55_images.py | tguillemLSST/eotest | 3 | 10014 | """
@brief Generate Fe55 images and associated darks and bias images
according to section 5.4 of the E/O document (Dec 19, 2012 version).
@author <NAME> <<EMAIL>>
"""
import os
import numpy as np
from sim_inputs import *
from sim_tools import *
def generate_Fe55_images(exptimes, nxrays, outdir, sensorid, gain=gain,
... | """
@brief Generate Fe55 images and associated darks and bias images
according to section 5.4 of the E/O document (Dec 19, 2012 version).
@author <NAME> <<EMAIL>>
"""
import os
import numpy as np
from sim_inputs import *
from sim_tools import *
def generate_Fe55_images(exptimes, nxrays, outdir, sensorid, gain=gain,
... | en | 0.74068 | @brief Generate Fe55 images and associated darks and bias images according to section 5.4 of the E/O document (Dec 19, 2012 version). @author <NAME> <<EMAIL>> # # Bias images # # electronics # read noise # # Dark images # # electronics # read noise # dark current # # Fe55 exposures # # electronics # read noise # dark ... | 2.151539 | 2 |
pcdet/models/backbones_3d/pfe/voxel_set_abstraction.py | rayguan97/M3DETR | 21 | 10015 | import math
import numpy as np
import torch
import torch.nn as nn
from ....ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_stack_modules
from ....ops.pointnet2.pointnet2_stack import pointnet2_utils as pointnet2_stack_utils
from ....utils import common_utils
from ...backbones_2d.transformer import ... | import math
import numpy as np
import torch
import torch.nn as nn
from ....ops.pointnet2.pointnet2_stack import pointnet2_modules as pointnet2_stack_modules
from ....ops.pointnet2.pointnet2_stack import pointnet2_utils as pointnet2_stack_utils
from ....utils import common_utils
from ...backbones_2d.transformer import ... | en | 0.693647 | Args: im: (H, W, C) [y, x] x: (N) y: (N) Returns: Args: rois: (M, 7 + C) points: (N, 3) sample_radius_with_roi: num_max_points_of_part: Returns: sampled_points: (N_out, 3) Args: points: (N, 3) num_sampled_points: int num_sec... | 1.860207 | 2 |
metabot2txt/display.py | HeitorBoschirolli/metabot2txt | 0 | 10016 | <filename>metabot2txt/display.py<gh_stars>0
import os
def display_on_editor(text):
with open('.metabot2txt', 'w') as f:
f.write(text)
os.system('gedit .metabot2txt')
def display_list_on_editor(texts):
if os.path.isfile('.metabot2txt'):
os.remove('.metabot2txt')
for text in texts... | <filename>metabot2txt/display.py<gh_stars>0
import os
def display_on_editor(text):
with open('.metabot2txt', 'w') as f:
f.write(text)
os.system('gedit .metabot2txt')
def display_list_on_editor(texts):
if os.path.isfile('.metabot2txt'):
os.remove('.metabot2txt')
for text in texts... | none | 1 | 2.849291 | 3 | |
cogs/errors.py | i1470s/IVRY | 3 | 10017 | #PRIMARY IMPORTS
import discord, os, datetime, sys, json, traceback, logging
#SECONDARY IMPORTS
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from discord.ext import commands
from data import config
#LOGGING
logger = logging.getLogger("ivry")
logger.debug("errors.py Started")
class Er... | #PRIMARY IMPORTS
import discord, os, datetime, sys, json, traceback, logging
#SECONDARY IMPORTS
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from discord.ext import commands
from data import config
#LOGGING
logger = logging.getLogger("ivry")
logger.debug("errors.py Started")
class Er... | en | 0.413854 | #PRIMARY IMPORTS #SECONDARY IMPORTS #LOGGING #ERROR MESSAGES #COMMAND ERROR #CONVERSION ERROR #USER INPUT ERROR #MISSING REQUIRED ARGUMENT #TOO MANY ARGUMENTS #BAD ARGUMENT #MESSAGE NOT FOUND #MEMBER NOT FOUND #USER NOT FOUND #CHANNEL NOT FOUND #CHANNEL NOT READABLE #BAD COLOR ARGUMENT #ROLE NOT FOUND #BAD INVITE ARGUM... | 2.317625 | 2 |
Using Python to Access Web Data/Problem 6_Extracting Data from JSON 5.py | Karoline0097/University-of-Michigan-Python-for-Everybody | 0 | 10018 | <reponame>Karoline0097/University-of-Michigan-Python-for-Everybody
## Problem 5: Extracting Data from JSON
# Example: http://py4e-data.dr-chuck.net/comments_42.json
# data consists of a number of names and comment counts in JSON
# {
# comments: [
# {
# name: "Matthias"
# count: 97
# },
# {
# ... | ## Problem 5: Extracting Data from JSON
# Example: http://py4e-data.dr-chuck.net/comments_42.json
# data consists of a number of names and comment counts in JSON
# {
# comments: [
# {
# name: "Matthias"
# count: 97
# },
# {
# name: "Geomer"
# count: 97
# }
# ...
# ]
# }
... | en | 0.639481 | ## Problem 5: Extracting Data from JSON # Example: http://py4e-data.dr-chuck.net/comments_42.json # data consists of a number of names and comment counts in JSON # { # comments: [ # { # name: "Matthias" # count: 97 # }, # { # name: "Geomer" # count: 97 # } # ... # ] # } #... | 3.82395 | 4 |
lessons/day_05/python/app.py | jiaguilera/a-walk-in-graphql | 16 | 10019 | from ariadne import make_executable_schema, load_schema_from_path
from ariadne.asgi import GraphQL
from resolvers import query, skill, person, eye_color, mutation
# import schema from GraphQL file
type_defs = load_schema_from_path("./schema.gql")
schema = make_executable_schema(
type_defs, query, skill, person, ... | from ariadne import make_executable_schema, load_schema_from_path
from ariadne.asgi import GraphQL
from resolvers import query, skill, person, eye_color, mutation
# import schema from GraphQL file
type_defs = load_schema_from_path("./schema.gql")
schema = make_executable_schema(
type_defs, query, skill, person, ... | en | 0.782967 | # import schema from GraphQL file | 1.698703 | 2 |
src/__main__.py | andreaswatch/piTomation | 0 | 10020 | import importlib
import time
from pathlib import Path
import os
import sys
def import_plugins():
#find actual path
realpath = os.path.realpath(__file__)
dirname = os.path.dirname(realpath)
#add modules & plugins
plugin_path = os.path.join(dirname, "plugins")
for dir_path in Path(plugin_path).... | import importlib
import time
from pathlib import Path
import os
import sys
def import_plugins():
#find actual path
realpath = os.path.realpath(__file__)
dirname = os.path.dirname(realpath)
#add modules & plugins
plugin_path = os.path.join(dirname, "plugins")
for dir_path in Path(plugin_path).... | en | 0.734025 | #find actual path #add modules & plugins only import the top level plugin directory, so that potential submodules are only imported if they are imported by the plugins. #try: # app = piTomation.App() #except Exception as ex: # print(ex) # exit() | 2.539009 | 3 |
src/decanter/core/extra/utils.py | MatthewK3023/decanter-ai-core-sdk | 0 | 10021 | """
Functions support other modules.
"""
import uuid
def check_response(response, key=None):
"""CHeck the api response.
Make sure the status call is successful and the response have specific key.
Return:
class: `Response <Response>`
"""
code = response.status_code
if not 200 <= code ... | """
Functions support other modules.
"""
import uuid
def check_response(response, key=None):
"""CHeck the api response.
Make sure the status call is successful and the response have specific key.
Return:
class: `Response <Response>`
"""
code = response.status_code
if not 200 <= code ... | en | 0.743243 | Functions support other modules. CHeck the api response. Make sure the status call is successful and the response have specific key. Return: class: `Response <Response>` Generate a random UUID if name isn't given. Returns: string Return True if SDK is running on Jupyter Notebook. # Jupyter... | 3.05427 | 3 |
03/03.py | stevenpclark/aoc2021 | 1 | 10022 | <reponame>stevenpclark/aoc2021<gh_stars>1-10
import numpy as np
def filter_data(data, use_most_common):
_, nc = data.shape
for c in range(nc):
nr, _ = data.shape
if nr <= 1:
break
col_score = sum(data[:,c])/nr
if use_most_common:
keep_val = col_s... | import numpy as np
def filter_data(data, use_most_common):
_, nc = data.shape
for c in range(nc):
nr, _ = data.shape
if nr <= 1:
break
col_score = sum(data[:,c])/nr
if use_most_common:
keep_val = col_score >= 0.5
else:
keep_va... | ko | 0.338478 | #fn = 'test.txt' | 2.934243 | 3 |
distillation/build_student.py | fengxiaoshuai/CNN_model_optimizer | 0 | 10023 | <filename>distillation/build_student.py
import tensorflow as tf
import numpy as np
with tf.variable_scope("student"):
input_label = tf.placeholder(dtype=tf.float32, shape=[10, 10], name="label")
input_image = tf.placeholder(dtype=tf.float32, shape=[10, 224, 224, 3], name="input")
conv1 = tf.layers.conv2d(... | <filename>distillation/build_student.py
import tensorflow as tf
import numpy as np
with tf.variable_scope("student"):
input_label = tf.placeholder(dtype=tf.float32, shape=[10, 10], name="label")
input_image = tf.placeholder(dtype=tf.float32, shape=[10, 224, 224, 3], name="input")
conv1 = tf.layers.conv2d(... | none | 1 | 2.420336 | 2 | |
code/statistical_tests.py | ChamiLamelas/Math36B_FinalProject | 0 | 10024 | import scipy.stats
import numpy as np
def f_test(sample_x, sample_y, larger_varx_alt):
"""
Computes the F-value and corresponding p-value for a pair of samples and alternative hypothesis.
Parameters
----------
sample_x : list
A random sample x1,...,xnx. Let its (underlying) variance be ox... | import scipy.stats
import numpy as np
def f_test(sample_x, sample_y, larger_varx_alt):
"""
Computes the F-value and corresponding p-value for a pair of samples and alternative hypothesis.
Parameters
----------
sample_x : list
A random sample x1,...,xnx. Let its (underlying) variance be ox... | en | 0.805749 | Computes the F-value and corresponding p-value for a pair of samples and alternative hypothesis. Parameters ---------- sample_x : list A random sample x1,...,xnx. Let its (underlying) variance be ox^2 and its sample variance Sx^2. sample_y : list A random sample y1,...,yny. Let its (un... | 3.263476 | 3 |
pawpyseed/compiler.py | akashkumarsingh612/pawpyseed | 0 | 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()) | 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()) | en | 0.600874 | ATTENTION, NOT FINISHED ATTENTION, NOT FINISHED | 2.351658 | 2 |
finnhub_python/socket.py | humdings/finnhub-python | 0 | 10026 | <reponame>humdings/finnhub-python<filename>finnhub_python/socket.py
"""
Example usage of Finnhub socket API.
"""
from __future__ import print_function # Py2 compat
import websocket
from finnhub_python.utils import get_finnhub_api_key
def write_line(data, fname):
with open(fname, 'a+') as f:
f.write(data ... | """
Example usage of Finnhub socket API.
"""
from __future__ import print_function # Py2 compat
import websocket
from finnhub_python.utils import get_finnhub_api_key
def write_line(data, fname):
with open(fname, 'a+') as f:
f.write(data + '\n')
def on_message(ws, message):
write_line(message, tick_... | en | 0.594886 | Example usage of Finnhub socket API. # Py2 compat ## closed ###") | 3.216424 | 3 |
pycovjson/cli/convert.py | RileyWilliams/pycovjson | 10 | 10027 | """
Pycovjson - Command line interface
Author: rileywilliams
Version: 0.1.0
"""
import argparse
from pycovjson.write import Writer
from pycovjson.read_netcdf import NetCDFReader as Reader
def main():
"""
Command line interface for pycovjson - Converts Scientific Data Formats into CovJSON and saves to disk.
... | """
Pycovjson - Command line interface
Author: rileywilliams
Version: 0.1.0
"""
import argparse
from pycovjson.write import Writer
from pycovjson.read_netcdf import NetCDFReader as Reader
def main():
"""
Command line interface for pycovjson - Converts Scientific Data Formats into CovJSON and saves to disk.
... | en | 0.439618 | Pycovjson - Command line interface Author: rileywilliams Version: 0.1.0 Command line interface for pycovjson - Converts Scientific Data Formats into CovJSON and saves to disk. :argument -i: Input file path. :argument -o: Output file name. :argument -t: Use Tiling. :argument -v: Which variable to popula... | 3.338622 | 3 |
duels/duels.py | ridinginstyle00/redcogs | 8 | 10028 | <reponame>ridinginstyle00/redcogs
import discord
from discord.ext import commands
from .utils import checks
from .utils.dataIO import dataIO
from __main__ import send_cmd_help
from __main__ import settings
from datetime import datetime
from random import choice
from random import sample
from copy import deepco... | import discord
from discord.ext import commands
from .utils import checks
from .utils.dataIO import dataIO
from __main__ import send_cmd_help
from __main__ import settings
from datetime import datetime
from random import choice
from random import sample
from copy import deepcopy
from collections import namedt... | en | 0.905531 | Duel with another player!! Add server to timer list Duel another player Adds a duel to the list Sets the maximum amount of duels that can be added #Save function here that isn't added yet #Save function here that isn't added yet Join tournament Show rank and XP of users.
Defaults to yours. Shows list of available ... | 2.482527 | 2 |
paranuara/citizens/models/citizens.py | SPLAYER-HD/Paranuara | 0 | 10029 | <gh_stars>0
"""Citizens model."""
# Django
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator
# models
from paranuara.companies.models import Company
# PostgreSQL fields
from django.contrib.postgres.fields import JSONField
# Utilities
f... | """Citizens model."""
# Django
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator
# models
from paranuara.companies.models import Company
# PostgreSQL fields
from django.contrib.postgres.fields import JSONField
# Utilities
from paranuar... | en | 0.926295 | Citizens model. # Django # models # PostgreSQL fields # Utilities Citizen model. Extend from Django's Abstract User, change the username field to email and add some extra fields. Class to represent many to many relation between Ctizens | 2.641948 | 3 |
tests/utils.py | niwibe/cobrascript | 1 | 10030 | <reponame>niwibe/cobrascript<filename>tests/utils.py<gh_stars>1-10
# -*- coding: utf-8 -*-
from cobra.utils import normalize
def norm(data):
return normalize(data)
| # -*- coding: utf-8 -*-
from cobra.utils import normalize
def norm(data):
return normalize(data) | en | 0.769321 | # -*- coding: utf-8 -*- | 1.872177 | 2 |
rgislackbot/dispatcher/dispatchconfig.py | raginggeek/RGISlackBot | 0 | 10031 | <reponame>raginggeek/RGISlackBot
class DispatchConfig:
def __init__(self, raw_config):
self.registered_commands = {}
for package in raw_config["handlers"]:
for command in package["commands"]:
self.registered_commands[command] = {
"class": package["clas... | class DispatchConfig:
def __init__(self, raw_config):
self.registered_commands = {}
for package in raw_config["handlers"]:
for command in package["commands"]:
self.registered_commands[command] = {
"class": package["class"],
"fullpat... | none | 1 | 2.303832 | 2 | |
chess/rules.py | DevStrikerTech/Chess-Engine | 18 | 10032 | <gh_stars>10-100
import pygame
from chess.board import Board
from .variable_declaration import black_piece, white_piece, position_piece, board_square_size
class Rules:
def __init__(self, window):
self._init()
self.window = window
def update(self):
self.chess_board.draw_pieces(self.win... | import pygame
from chess.board import Board
from .variable_declaration import black_piece, white_piece, position_piece, board_square_size
class Rules:
def __init__(self, window):
self._init()
self.window = window
def update(self):
self.chess_board.draw_pieces(self.window)
self... | none | 1 | 3.447172 | 3 | |
kivygames/games/noughtsandcrosses/__init__.py | jonathanjameswatson/kivygames | 0 | 10033 | import numpy as np
from kivygames.games import Game
import kivygames.games.noughtsandcrosses.c as c
class CellOccupiedError(Exception):
pass
class NoughtsAndCrosses(Game):
minPlayers = 2
maxPlayers = 2
hasAI = True
gridShape = (3, 3)
def __init__(self):
Game.__init__(self)
... | import numpy as np
from kivygames.games import Game
import kivygames.games.noughtsandcrosses.c as c
class CellOccupiedError(Exception):
pass
class NoughtsAndCrosses(Game):
minPlayers = 2
maxPlayers = 2
hasAI = True
gridShape = (3, 3)
def __init__(self):
Game.__init__(self)
... | none | 1 | 2.908558 | 3 | |
03-Decouvrez-POO/download_agents.py | gruiick/openclassrooms-py | 0 | 10034 | <reponame>gruiick/openclassrooms-py
#! /usr/bin/env python
import argparse
import json
import time
import urllib.error
import urllib.request
def main():
parser = argparse.ArgumentParser(description="Download agents from pplapi.com")
parser.add_argument("-c", "--count", type=int, default=10, help="Number of ag... | #! /usr/bin/env python
import argparse
import json
import time
import urllib.error
import urllib.request
def main():
parser = argparse.ArgumentParser(description="Download agents from pplapi.com")
parser.add_argument("-c", "--count", type=int, default=10, help="Number of agents to download.")
parser.add_a... | en | 0.796401 | #! /usr/bin/env python # Wait one second between every request | 2.998523 | 3 |
Commands/images.py | Mariobob/Proton | 0 | 10035 | <reponame>Mariobob/Proton<gh_stars>0
import functools
import re
import asyncio
from io import BytesIO
from discord.ext import commands
import discord
from Utils import canvas
import random
class Images:
"""
Contains commands for manipulation of images.
"""
def __init__(self, bot):
self.bot = ... | import functools
import re
import asyncio
from io import BytesIO
from discord.ext import commands
import discord
from Utils import canvas
import random
class Images:
"""
Contains commands for manipulation of images.
"""
def __init__(self, bot):
self.bot = bot
self.imageClient = canvas... | en | 0.789627 | Contains commands for manipulation of images. Ask US President Donald Trump to make something illegal. This... this is beautiful! Delet this garbage! #{member.discriminator}") See a unique robot image from any text. Thug Life..... | 2.928238 | 3 |
labJS/conf.py | lpomfrey/django-labjs | 0 | 10036 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from appconf import AppConf
from django.conf import settings # noqa
class LabjsConf(AppConf):
ENABLED = not settings.DEBUG
DEBUG_TOGGLE = 'labjs'
| # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from appconf import AppConf
from django.conf import settings # noqa
class LabjsConf(AppConf):
ENABLED = not settings.DEBUG
DEBUG_TOGGLE = 'labjs'
| en | 0.744791 | # -*- coding: utf-8 -*- # noqa | 1.102366 | 1 |
tests/test_nanoevents_vector.py | danbarto/coffea | 0 | 10037 | import awkward as ak
from coffea.nanoevents.methods import vector
import pytest
ATOL = 1e-8
def record_arrays_equal(a, b):
return (ak.fields(a) == ak.fields(b)) and all(ak.all(a[f] == b[f]) for f in ak.fields(a))
def test_two_vector():
a = ak.zip(
{
"x": [[1, 2], [], [3], [4]],
... | import awkward as ak
from coffea.nanoevents.methods import vector
import pytest
ATOL = 1e-8
def record_arrays_equal(a, b):
return (ak.fields(a) == ak.fields(b)) and all(ak.all(a[f] == b[f]) for f in ak.fields(a))
def test_two_vector():
a = ak.zip(
{
"x": [[1, 2], [], [3], [4]],
... | none | 1 | 2.345596 | 2 | |
testing/python/telBuggyScript2.py | sys-bio/rrplugins | 0 | 10038 | import roadrunner
import teplugins as tel
i = 0
#for i in range(100):
try:
noisePlugin = tel.Plugin ("tel_add_noise")
print noisePlugin.listOfProperties()
# Create a roadrunner instance
rr = roadrunner.RoadRunner()
rr.load("sbml_test_0001.xml")
# Generate data
data = rr.simulate(0, 10, 51... | import roadrunner
import teplugins as tel
i = 0
#for i in range(100):
try:
noisePlugin = tel.Plugin ("tel_add_noise")
print noisePlugin.listOfProperties()
# Create a roadrunner instance
rr = roadrunner.RoadRunner()
rr.load("sbml_test_0001.xml")
# Generate data
data = rr.simulate(0, 10, 51... | en | 0.392859 | #for i in range(100): # Create a roadrunner instance # Generate data # Want 512 points # Get the dataseries from roadrunner # Assign the dataseries to the plugin inputdata # Set parameter for the 'size' of the noise # Add the noise # Get the data to plot # tel.show() | 2.441255 | 2 |
encyclopaedia/labels.py | tcyrus/renpy-encyclopaedia | 0 | 10039 | <reponame>tcyrus/renpy-encyclopaedia
from renpy import store
class Labels(store.object):
"""Controls how the labels that display Encyclopaedia data appear.
Attributes:
percentage_label (str): Placed next to the percentage unlocked number
page_label (str): Placed before the entry page displaye... | from renpy import store
class Labels(store.object):
"""Controls how the labels that display Encyclopaedia data appear.
Attributes:
percentage_label (str): Placed next to the percentage unlocked number
page_label (str): Placed before the entry page displayed
page_separator_label (str):... | en | 0.605425 | Controls how the labels that display Encyclopaedia data appear. Attributes: percentage_label (str): Placed next to the percentage unlocked number page_label (str): Placed before the entry page displayed page_separator_label (str): Placed in-between the current page number and th... | 3.208695 | 3 |
ncservice/ncDeviceOps/threaded/get_configs.py | cunningr/yanccm | 0 | 10040 | <filename>ncservice/ncDeviceOps/threaded/get_configs.py
import logging
from ncservice.ncDeviceOps.nc_device_ops import NcDeviceOps
from ncservice.ncDeviceOps.task_report import TaskReport
from ncservice.ncDeviceOps.threaded.base_thread_class import BaseThreadClass
logger = logging.getLogger('main.{}'.format(__name__))... | <filename>ncservice/ncDeviceOps/threaded/get_configs.py
import logging
from ncservice.ncDeviceOps.nc_device_ops import NcDeviceOps
from ncservice.ncDeviceOps.task_report import TaskReport
from ncservice.ncDeviceOps.threaded.base_thread_class import BaseThreadClass
logger = logging.getLogger('main.{}'.format(__name__))... | none | 1 | 2.062717 | 2 | |
CodeHS/Looping/DoubleForLoop.py | Kev-in123/ICS2O7 | 2 | 10041 | <gh_stars>1-10
"""
This program visualizes nested for loops by printing number 0 through 3
and then 0 through 3 for the nested loop.
"""
for i in range(4):
print("Outer for loop: " + str(i))
for j in range(4):
print(" Inner for loop: " + str(j)) | """
This program visualizes nested for loops by printing number 0 through 3
and then 0 through 3 for the nested loop.
"""
for i in range(4):
print("Outer for loop: " + str(i))
for j in range(4):
print(" Inner for loop: " + str(j)) | en | 0.932416 | This program visualizes nested for loops by printing number 0 through 3
and then 0 through 3 for the nested loop. | 4.525121 | 5 |
saleor/graphql/channel/tests/test_base_channel_listing.py | fairhopeweb/saleor | 15,337 | 10042 | from collections import defaultdict
import graphene
import pytest
from django.core.exceptions import ValidationError
from ....shipping.error_codes import ShippingErrorCode
from ..mutations import BaseChannelListingMutation
def test_validate_duplicated_channel_ids(channel_PLN, channel_USD):
# given
channel_i... | from collections import defaultdict
import graphene
import pytest
from django.core.exceptions import ValidationError
from ....shipping.error_codes import ShippingErrorCode
from ..mutations import BaseChannelListingMutation
def test_validate_duplicated_channel_ids(channel_PLN, channel_USD):
# given
channel_i... | en | 0.24573 | # given # when # then # given # when # then # given # when # then # given # when # then # given # when # then # given # when # then # given # when # then # given # when # then | 2.40001 | 2 |
francoralite/apps/francoralite_front/tools.py | Francoralite/francoralite | 2 | 10043 | # -*- coding: utf-8 -*-
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: <NAME> / Coopérative ARTEFACTS <<EMAIL>>
import requests
from django.conf import settings
from django.contrib import messages
from dja... | # -*- coding: utf-8 -*-
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors: <NAME> / Coopérative ARTEFACTS <<EMAIL>>
import requests
from django.conf import settings
from django.contrib import messages
from dja... | en | 0.35647 | # -*- coding: utf-8 -*- # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # # Authors: <NAME> / Coopérative ARTEFACTS <<EMAIL>> TODO: À renseigner TODO: À renseigner TODO: À renseigner TODO: À renseigner TODO: À renseigner ... | 1.885997 | 2 |
python2.7/site-packages/twisted/internet/iocpreactor/client.py | 84KaliPleXon3/sslstrip-hsts-openwrt | 4 | 10044 | <reponame>84KaliPleXon3/sslstrip-hsts-openwrt<filename>python2.7/site-packages/twisted/internet/iocpreactor/client.py
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
import socket
from twisted.persisted import styles
from twisted.internet.base import BaseConnector
from twisted.inter... | # Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
import socket
from twisted.persisted import styles
from twisted.internet.base import BaseConnector
from twisted.internet import defer, interfaces, error
from twisted.python import failure
from abstract import ConnectedSocket
from ops ... | en | 0.915906 | # Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. # necessary for ConnectEx # factory hasn't called our connect() method # factory hasn't called our connect() method | 2.062129 | 2 |
pypika/tests/dialects/test_mssql.py | uhrm/pypika | 0 | 10045 | <gh_stars>0
import unittest
from pypika import Table
from pypika.analytics import Count
from pypika.dialects import MSSQLQuery
from pypika.utils import QueryException
class SelectTests(unittest.TestCase):
def test_normal_select(self):
q = MSSQLQuery.from_("abc").select("def")
self.assertEqual('S... | import unittest
from pypika import Table
from pypika.analytics import Count
from pypika.dialects import MSSQLQuery
from pypika.utils import QueryException
class SelectTests(unittest.TestCase):
def test_normal_select(self):
q = MSSQLQuery.from_("abc").select("def")
self.assertEqual('SELECT "def" ... | none | 1 | 2.619437 | 3 | |
Postprocessing/Hardt/Hardt.py | maliha93/Fairness-Analysis-Code | 0 | 10046 | <reponame>maliha93/Fairness-Analysis-Code
import cvxpy as cvx
import numpy as np
from collections import namedtuple
from metric import metric, cd
import pandas as pd
import sys
from helper import make_dataset
class Model(namedtuple('Model', 'pred label')):
def logits(self):
raw_logits = np.clip(np.log(self... | import cvxpy as cvx
import numpy as np
from collections import namedtuple
from metric import metric, cd
import pandas as pd
import sys
from helper import make_dataset
class Model(namedtuple('Model', 'pred label')):
def logits(self):
raw_logits = np.clip(np.log(self.pred / (1 - self.pred)), -100, 100)
... | en | 0.892149 | Percentage of samples belonging to the positive class True positive rate False positive rate True negative rate False negative rate Generalized false negative cost Generalized false positive cost # Create model objects - one for each group, validation and test # Find mixing rates for equalized odds models # Apply the m... | 2.653644 | 3 |
tests/test_exceptions.py | nesnahnoj/py3-textract | 2 | 10047 | <filename>tests/test_exceptions.py
import unittest
import os
import subprocess
import base
class ExceptionTestCase(base.GenericUtilities, unittest.TestCase):
"""This class contains a bunch of tests to make sure that textract
fails in expected ways.
"""
def test_unsupported_extension_cli(self):
... | <filename>tests/test_exceptions.py
import unittest
import os
import subprocess
import base
class ExceptionTestCase(base.GenericUtilities, unittest.TestCase):
"""This class contains a bunch of tests to make sure that textract
fails in expected ways.
"""
def test_unsupported_extension_cli(self):
... | en | 0.892638 | This class contains a bunch of tests to make sure that textract fails in expected ways. Make sure unsupported extension exits with non-zero status Make sure unsupported extension raises the correct error Make sure missing files exits with non-zero status Make sure missing files raise the correct error | 2.947029 | 3 |
dloud_ads/circular_queue.py | dataloudlabs/dloud-ads | 0 | 10048 | <gh_stars>0
"""Queue implementation using circularly linked list for storage."""
class CircularQueue:
"""Queue implementation using circularly linked list for storage."""
class _Node:
"""Lightweight, nonpublic class for storing a singly linked node."""
__slots__ = '_element', '_next'
... | """Queue implementation using circularly linked list for storage."""
class CircularQueue:
"""Queue implementation using circularly linked list for storage."""
class _Node:
"""Lightweight, nonpublic class for storing a singly linked node."""
__slots__ = '_element', '_next'
def __init__... | en | 0.710007 | Queue implementation using circularly linked list for storage. Queue implementation using circularly linked list for storage. Lightweight, nonpublic class for storing a singly linked node. Create an empty queue. Return the number of elements in the queue. Return True if the queue is empty. Return (but do not remove) th... | 4.04477 | 4 |
suplemon/helpers.py | johnmbaughman/suplemon | 0 | 10049 | <reponame>johnmbaughman/suplemon<gh_stars>0
# -*- encoding: utf-8
"""
Various helper constants and functions.
"""
import os
import re
import sys
import time
import traceback
def curr_time():
"""Current time in %H:%M"""
return time.strftime("%H:%M")
def curr_time_sec():
"""Current time in %H:%M:%S"""
... | # -*- encoding: utf-8
"""
Various helper constants and functions.
"""
import os
import re
import sys
import time
import traceback
def curr_time():
"""Current time in %H:%M"""
return time.strftime("%H:%M")
def curr_time_sec():
"""Current time in %H:%M:%S"""
return time.strftime("%H:%M:%S")
def mul... | en | 0.792321 | # -*- encoding: utf-8 Various helper constants and functions. Current time in %H:%M Current time in %H:%M:%S Return info about last error. Search string for a substring between two delimeters. False if not found. Return index of first non whitespace character on a line. Parse a relative path and return full directory a... | 3.099634 | 3 |
geofem/emg3d/meshes.py | iisadoramacedo/geofem-master | 0 | 10050 | """
:mod:`meshes` -- Discretization
===============================
Everything related to meshes appropriate for the multigrid solver.
"""
# Copyright 2018-2020 The emg3d Developers.
#
# This file is part of emg3d.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except... | """
:mod:`meshes` -- Discretization
===============================
Everything related to meshes appropriate for the multigrid solver.
"""
# Copyright 2018-2020 The emg3d Developers.
#
# This file is part of emg3d.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except... | en | 0.798831 | :mod:`meshes` -- Discretization =============================== Everything related to meshes appropriate for the multigrid solver. # Copyright 2018-2020 The emg3d Developers. # # This file is part of emg3d. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not # use this file except in compli... | 2.000068 | 2 |
QUICK_START/NODE_SQUEEZESEG_CLUSTER/src/script/squeezeseg/utils/clock.py | Hqss/DINK | 189 | 10051 | <reponame>Hqss/DINK
#! /usr/bin/python2
# -*- coding: utf-8 -*-
"""
Clock function to take running time following Segmatch.
"""
# BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution... | #! /usr/bin/python2
# -*- coding: utf-8 -*-
"""
Clock function to take running time following Segmatch.
"""
# BSD 3-Clause License
#
# Copyright (c) 2019, FPAI
# Copyright (c) 2019, SeriouslyHAO
# Copyright (c) 2019, xcj2019
# Copyright (c) 2019, Leonfirst
#
# All rights reserved.
#
# Redistribution and use in source a... | en | 0.732176 | #! /usr/bin/python2 # -*- coding: utf-8 -*- Clock function to take running time following Segmatch. # BSD 3-Clause License # # Copyright (c) 2019, FPAI # Copyright (c) 2019, SeriouslyHAO # Copyright (c) 2019, xcj2019 # Copyright (c) 2019, Leonfirst # # All rights reserved. # # Redistribution and use in source and binar... | 2.590278 | 3 |
office365/sharepoint/view_collection.py | andebor/Office365-REST-Python-Client | 0 | 10052 | <gh_stars>0
from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation
from office365.sharepoint.view import View
class ViewCollection(ClientObjectCollection):
"""Represents a collection of View resources... | from office365.runtime.client_object_collection import ClientObjectCollection
from office365.runtime.resource_path_service_operation import ResourcePathServiceOperation
from office365.sharepoint.view import View
class ViewCollection(ClientObjectCollection):
"""Represents a collection of View resources."""
def... | en | 0.657427 | Represents a collection of View resources. Gets the list view with the specified title. Gets the list view with the specified ID. | 2.255264 | 2 |
common-scrapers/common_src/scrapers/second_extinction.py | mrPaintMan/blog-scraper | 0 | 10053 | from common_src.lib.model.post import Post
from common_src.lib.model.source import Source
from common_src.scrapers.abstract_scraper import make_soup, remove_dups, now
SOURCE_CODE = "second_extinction"
WEBSITE = "https://www.secondextinctiongame.com/news"
ALT_IMAGE = 'https://www.secondextinctiongame.com/static/242486b... | from common_src.lib.model.post import Post
from common_src.lib.model.source import Source
from common_src.scrapers.abstract_scraper import make_soup, remove_dups, now
SOURCE_CODE = "second_extinction"
WEBSITE = "https://www.secondextinctiongame.com/news"
ALT_IMAGE = 'https://www.secondextinctiongame.com/static/242486b... | none | 1 | 2.902182 | 3 | |
systems/ILSVRC12/AlexNet/alexnet.py | mdatres/quantlab | 7 | 10054 | #
# alexnet.py
#
# Author(s):
# <NAME> <<EMAIL>>
#
# Copyright (c) 2020-2021 ETH Zurich.
#
# 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
# ... | #
# alexnet.py
#
# Author(s):
# <NAME> <<EMAIL>>
#
# Copyright (c) 2020-2021 ETH Zurich.
#
# 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
# ... | en | 0.801549 | # # alexnet.py # # Author(s): # <NAME> <<EMAIL>> # # Copyright (c) 2020-2021 ETH Zurich. # # 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 # # Unl... | 2.425672 | 2 |
e/mail-relay/web/apps/core/migrations/0012_auto_20151105_1442.py | zhouli121018/nodejsgm | 0 | 10055 | <gh_stars>0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0011_customersetting'),
]
operations = [
migrations.AlterField(
model_name='customersetting'... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0011_customersetting'),
]
operations = [
migrations.AlterField(
model_name='customersetting',
... | en | 0.769321 | # -*- coding: utf-8 -*- | 1.321897 | 1 |
madlib/main.py | FredericIV/PythonPractice | 0 | 10056 | <filename>madlib/main.py<gh_stars>0
#!/bin/python3
# Libraries
import sys
import array
import textwrap
# Variable Declaration
madlib_selection = "example.txt"
madlib_array = array.array('i')
copy_state = False
user_filler = ""
new_madlib = []
if len(sys.argv) != 1:
print(len(sys.argv))
if sys.argv[1] == "-":... | <filename>madlib/main.py<gh_stars>0
#!/bin/python3
# Libraries
import sys
import array
import textwrap
# Variable Declaration
madlib_selection = "example.txt"
madlib_array = array.array('i')
copy_state = False
user_filler = ""
new_madlib = []
if len(sys.argv) != 1:
print(len(sys.argv))
if sys.argv[1] == "-":... | en | 0.438125 | #!/bin/python3 # Libraries # Variable Declaration ## TODO: Add input validation, i.e. make sure the input is actully text. ## TODO: Add pipe as input option. | 3.602853 | 4 |
src/tests/control/test_devices.py | bsod85/pretix | 0 | 10057 | import pytest
from django.utils.timezone import now
from pretix.base.models import Device, Event, Organizer, Team, User
from pretix.base.models.devices import generate_api_token
@pytest.fixture
def organizer():
return Organizer.objects.create(name='Dummy', slug='dummy')
@pytest.fixture
def event(organizer):
... | import pytest
from django.utils.timezone import now
from pretix.base.models import Device, Event, Organizer, Team, User
from pretix.base.models.devices import generate_api_token
@pytest.fixture
def organizer():
return Organizer.objects.create(name='Dummy', slug='dummy')
@pytest.fixture
def event(organizer):
... | none | 1 | 1.886409 | 2 | |
mcp/augmentation/album.py | j20232/moco_image_pipeline | 5 | 10058 | <reponame>j20232/moco_image_pipeline
import numpy as np
from PIL import Image, ImageOps, ImageEnhance
import albumentations as A
# ndarray: H x W x C
def apply_aug(aug, image):
return aug(image=image)["image"]
# ----------------------------------- Blur -------------------------------------------
class RandomBl... | import numpy as np
from PIL import Image, ImageOps, ImageEnhance
import albumentations as A
# ndarray: H x W x C
def apply_aug(aug, image):
return aug(image=image)["image"]
# ----------------------------------- Blur -------------------------------------------
class RandomBlur():
def __init__(self, prob, bl... | en | 0.722461 | # ndarray: H x W x C # ----------------------------------- Blur ------------------------------------------- # ----------------------------------- Noise ------------------------------------------- # ---------------------------------- Distortion --------------------------------------- # ----------------------------------... | 2.565988 | 3 |
website/util/sanitize.py | bdyetton/prettychart | 0 | 10059 | # -*- coding: utf-8 -*-
import bleach
import json
def strip_html(unclean):
"""Sanitize a string, removing (as opposed to escaping) HTML tags
:param unclean: A string to be stripped of HTML tags
:return: stripped string
:rtype: str
"""
return bleach.clean(unclean, strip=True, tags=[], attribu... | # -*- coding: utf-8 -*-
import bleach
import json
def strip_html(unclean):
"""Sanitize a string, removing (as opposed to escaping) HTML tags
:param unclean: A string to be stripped of HTML tags
:return: stripped string
:rtype: str
"""
return bleach.clean(unclean, strip=True, tags=[], attribu... | en | 0.651422 | # -*- coding: utf-8 -*- Sanitize a string, removing (as opposed to escaping) HTML tags :param unclean: A string to be stripped of HTML tags :return: stripped string :rtype: str Format as a valid Tag :param data: A string to be cleaned :return: cleaned string :rtype: str # TODO: make this a m... | 3.376708 | 3 |
mainTrain.py | PolarizedLightFieldMicroscopy/LFMNet2 | 0 | 10060 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.utils import data
from torch import optim
import torchvision.models as models
from torch.autograd import Variable
import torchvision as tv
import random
import math
import time
from datetime i... | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
from torch.utils import data
from torch import optim
import torchvision.models as models
from torch.autograd import Variable
import torchvision as tv
import random
import math
import time
from datetime i... | en | 0.352193 | # # Arguments # parser = argparse.ArgumentParser() # # Number of epochs # parser.add_argument('--epochs', type=int, default=1000) # # Validate every n percentage of the data # parser.add_argument('--valEvery', type=float, default=0.25) # # Image indices to use for training and validation # parser.add_argument('--images... | 2.33527 | 2 |
tools/utils.py | valsworthen/toxic-comment-classification | 10 | 10061 | <filename>tools/utils.py
"""Utilities"""
import pandas as pd
import numpy as np
from attrdict import AttrDict
import yaml
def average_predictions(cv_predictions, n_splits, num_samples = 153164, num_labels = 6):
"""Average k-fold predictions stored in a dict"""
preds = np.zeros((num_samples, num_labels))
fo... | <filename>tools/utils.py
"""Utilities"""
import pandas as pd
import numpy as np
from attrdict import AttrDict
import yaml
def average_predictions(cv_predictions, n_splits, num_samples = 153164, num_labels = 6):
"""Average k-fold predictions stored in a dict"""
preds = np.zeros((num_samples, num_labels))
fo... | en | 0.807561 | Utilities Average k-fold predictions stored in a dict Average k-fold predictions stored in a dict | 2.698051 | 3 |
dags/exercise1.py | mikef-nl/airflow-training-skeleton | 0 | 10062 | <filename>dags/exercise1.py<gh_stars>0
import airflow
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
args = {
'owner': 'Mike',
'start_date': airflow.utils.dates.days_ago(2),
}
dag = DAG(
dag_id='exercise1',
default_args=args,
schedule_interval=None
)
t1 ... | <filename>dags/exercise1.py<gh_stars>0
import airflow
from airflow.models import DAG
from airflow.operators.dummy_operator import DummyOperator
args = {
'owner': 'Mike',
'start_date': airflow.utils.dates.days_ago(2),
}
dag = DAG(
dag_id='exercise1',
default_args=args,
schedule_interval=None
)
t1 ... | none | 1 | 2.235353 | 2 | |
pyhelp/scripts/produce_meteo_maps.py | jnsebgosselin/help | 12 | 10063 | <gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 10:54:25 2018
@author: jsgosselin
"""
# ---- Standard Library Imports
from itertools import product
import os.path as osp
import os
# ---- Third Party Imports
import netCDF4
from geopandas import GeoDataFrame
import pandas as pd
from shapely.geometr... | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 27 10:54:25 2018
@author: jsgosselin
"""
# ---- Standard Library Imports
from itertools import product
import os.path as osp
import os
# ---- Third Party Imports
import netCDF4
from geopandas import GeoDataFrame
import pandas as pd
from shapely.geometry import Point, P... | en | 0.525168 | # -*- coding: utf-8 -*- Created on Tue Feb 27 10:54:25 2018 @author: jsgosselin # ---- Standard Library Imports # ---- Third Party Imports # %% Get lat/lon from the netCDF # %% Read the weather data from the InfoClimat grid # %% Create a grid # polygon = Polygon([(lon[k]-dx, lat[j]-dy), # (lon[k]-dx,... | 2.304113 | 2 |
platform/core/tests/test_activitylogs/test_service.py | hackerwins/polyaxon | 0 | 10064 | <reponame>hackerwins/polyaxon<filename>platform/core/tests/test_activitylogs/test_service.py
# pylint:disable=ungrouped-imports
import uuid
import pytest
import activitylogs
from db.models.activitylogs import ActivityLog
from events.registry.experiment import EXPERIMENT_DELETED_TRIGGERED
from events.registry.user im... | # pylint:disable=ungrouped-imports
import uuid
import pytest
import activitylogs
from db.models.activitylogs import ActivityLog
from events.registry.experiment import EXPERIMENT_DELETED_TRIGGERED
from events.registry.user import USER_ACTIVATED
from factories.factory_experiments import ExperimentFactory
from factorie... | en | 0.255567 | # pylint:disable=ungrouped-imports | 1.981843 | 2 |
tests/framework/test_ingress.py | praus/shapy | 54 | 10065 | import unittest
from shapy.framework.tcelements import *
from shapy.framework.executor import run
from tests import TCTestCase
class TestIngress(TCTestCase):
def setUp(self):
self.interface = Interface('lo')
def test_ingress_filter(self):
q = IngressQdisc()
q.add(RedirectFilter('... | import unittest
from shapy.framework.tcelements import *
from shapy.framework.executor import run
from tests import TCTestCase
class TestIngress(TCTestCase):
def setUp(self):
self.interface = Interface('lo')
def test_ingress_filter(self):
q = IngressQdisc()
q.add(RedirectFilter('... | none | 1 | 2.187114 | 2 | |
software/hippietrap/gradient.py | mayhem/led-chandelier | 2 | 10066 | <reponame>mayhem/led-chandelier<gh_stars>1-10
from colorsys import hsv_to_rgb
from math import fabs, fmod
import os
from hippietrap.color import Color
class Gradient(object):
def __init__(self, palette, num_leds = 1):
# palletes are in format [ (.345, (128, 0, 128)) ]
self._validate_palette(palet... | from colorsys import hsv_to_rgb
from math import fabs, fmod
import os
from hippietrap.color import Color
class Gradient(object):
def __init__(self, palette, num_leds = 1):
# palletes are in format [ (.345, (128, 0, 128)) ]
self._validate_palette(palette)
self.palette = palette
sel... | en | 0.811047 | # palletes are in format [ (.345, (128, 0, 128)) ] # skip the first item | 3.091043 | 3 |
stix_shifter_modules/elastic/entry_point.py | 6un9-h0-Dan/stix-shifter | 1 | 10067 | from stix_shifter_utils.utils.entry_point_base import EntryPointBase
from stix_shifter_utils.modules.cim.stix_translation.cim_data_mapper import CimDataMapper
from stix_shifter_utils.modules.car.stix_translation.car_data_mapper import CarDataMapper
from .stix_translation.stix_to_elastic import StixToElastic
class Entr... | from stix_shifter_utils.utils.entry_point_base import EntryPointBase
from stix_shifter_utils.modules.cim.stix_translation.cim_data_mapper import CimDataMapper
from stix_shifter_utils.modules.car.stix_translation.car_data_mapper import CarDataMapper
from .stix_translation.stix_to_elastic import StixToElastic
class Entr... | none | 1 | 1.852056 | 2 | |
src/http_pick/pickergui.py | thomaspcole/http-pick | 0 | 10068 | <filename>src/http_pick/pickergui.py
from PyQt5.QtWidgets import (QMainWindow, QToolButton, QWidget, QHBoxLayout)
from PyQt5.QtGui import QIcon
from PyQt5 import QtCore
from math import floor
import sys
class MainWindow(QMainWindow):
def __init__(self, browsers, iconsize=72, displayappname=False, x=0, y=0, callba... | <filename>src/http_pick/pickergui.py
from PyQt5.QtWidgets import (QMainWindow, QToolButton, QWidget, QHBoxLayout)
from PyQt5.QtGui import QIcon
from PyQt5 import QtCore
from math import floor
import sys
class MainWindow(QMainWindow):
def __init__(self, browsers, iconsize=72, displayappname=False, x=0, y=0, callba... | en | 0.625489 | #'Normal' launch path #Flatpak ref | 2.520195 | 3 |
genetic_pwdcrack.py | robotenique/AI-programming | 3 | 10069 | """
Crack a password using a genetic algorithm!
"""
import random as rnd
def main():
"""
This file implements a genetic algorithm to solve the problem of
cracking a given password, by creating 'generations' of different
words, selecting the best, breeeding them, applying a simple crossover
(randomi... | """
Crack a password using a genetic algorithm!
"""
import random as rnd
def main():
"""
This file implements a genetic algorithm to solve the problem of
cracking a given password, by creating 'generations' of different
words, selecting the best, breeeding them, applying a simple crossover
(randomi... | en | 0.830542 | Crack a password using a genetic algorithm! This file implements a genetic algorithm to solve the problem of cracking a given password, by creating 'generations' of different words, selecting the best, breeeding them, applying a simple crossover (randomized) and a mutation chance. #variables dict: Define th... | 3.763436 | 4 |
openverse_catalog/dags/providers/provider_api_scripts/science_museum.py | yavik-kapadia/openverse-catalog | 25 | 10070 | <reponame>yavik-kapadia/openverse-catalog<filename>openverse_catalog/dags/providers/provider_api_scripts/science_museum.py
import logging
from common.licenses import get_license_info
from common.loader import provider_details as prov
from common.requester import DelayedRequester
from common.storage.image import ImageS... | import logging
from common.licenses import get_license_info
from common.loader import provider_details as prov
from common.requester import DelayedRequester
from common.storage.image import ImageStore
logging.basicConfig(
format="%(asctime)s - %(name)s - %(levelname)s: %(message)s", level=logging.INFO
)
logger ... | en | 0.881368 | # global variable to keep track of records pulled | 2.37825 | 2 |
digitaltape.py | heerdyes/tapegame | 0 | 10071 | <filename>digitaltape.py
# tape variables
TS_MAX=1000
# the digital tape model
class DTape:
def __init__(self,size,alphabet,noopidx=0):
if size>TS_MAX:
self.size=TS_MAX
else:
self.size=size
if len(alphabet)==0:
raise Exception('alphabet has zero symbols')... | <filename>digitaltape.py
# tape variables
TS_MAX=1000
# the digital tape model
class DTape:
def __init__(self,size,alphabet,noopidx=0):
if size>TS_MAX:
self.size=TS_MAX
else:
self.size=size
if len(alphabet)==0:
raise Exception('alphabet has zero symbols')... | en | 0.581374 | # tape variables # the digital tape model | 3.096112 | 3 |
webhook-cdk/lambda/vars.py | ncalteen/github-webhook-lambda-example | 0 | 10072 | <reponame>ncalteen/github-webhook-lambda-example
import json
# Output must be returned in the format mentioned below:
# https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format
lambda_response = {
"isBase64Encoded": Fals... | import json
# Output must be returned in the format mentioned below:
# https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format
lambda_response = {
"isBase64Encoded": False,
"statusCode": 200,
"headers": {
... | en | 0.769117 | # Output must be returned in the format mentioned below: # https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-output-format | 2.03945 | 2 |
gym_unblockme/envs/unblockme_render.py | fedingo/gym-unblockme | 3 | 10073 | import pygame
import time
import numpy as np
import sys
gray = (150, 150, 150)
white = (255, 255, 255)
black = (0, 0, 0, )
red_block = (255, 0, 0)
red_border = (76, 0, 19)
block_color = (255, 128, 0)
border_color = (165,42,42)
screen = None
SIDE = 50
BORDER = 5
MARGIN = 5
LINE = 1
h_switch = True
def __draw_hor... | import pygame
import time
import numpy as np
import sys
gray = (150, 150, 150)
white = (255, 255, 255)
black = (0, 0, 0, )
red_block = (255, 0, 0)
red_border = (76, 0, 19)
block_color = (255, 128, 0)
border_color = (165,42,42)
screen = None
SIDE = 50
BORDER = 5
MARGIN = 5
LINE = 1
h_switch = True
def __draw_hor... | en | 0.751741 | ## Render function for the unblockme_class # first we draw the background #draw the exit on the outer border # Draw the background with the grid pattern # then we draw the blocks in the grid | 3.054274 | 3 |
scaffolds/__init__.py | chhsiao1981/frontend_template | 0 | 10074 | # API
from pyramid.scaffolds import PyramidTemplate
import os
import re
import logging
def _camelcase_to_upper_camel_case(the_str):
if not the_str:
return ''
return the_str[0].upper() + the_str[1:]
def _upper_camelcase_to_camelcase(the_str):
if not the_str:
return ''
return the_str[... | # API
from pyramid.scaffolds import PyramidTemplate
import os
import re
import logging
def _camelcase_to_upper_camel_case(the_str):
if not the_str:
return ''
return the_str[0].upper() + the_str[1:]
def _upper_camelcase_to_camelcase(the_str):
if not the_str:
return ''
return the_str[... | none | 1 | 2.615994 | 3 | |
phy/cluster/tests/test_supervisor.py | mikailweston/phy | 0 | 10075 | # -*- coding: utf-8 -*-
"""Test GUI component."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
#from contextlib import contextmanager
from pytest import yield_fixture, fixture, raises
import ... | # -*- coding: utf-8 -*-
"""Test GUI component."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
#from contextlib import contextmanager
from pytest import yield_fixture, fixture, raises
import ... | en | 0.443504 | # -*- coding: utf-8 -*- Test GUI component. #------------------------------------------------------------------------------ # Imports #------------------------------------------------------------------------------ #from contextlib import contextmanager #------------------------------------------------------------------... | 1.894011 | 2 |
Source/CommandManager.py | SOBotics/Botpy | 5 | 10076 | <filename>Source/CommandManager.py
#
# CommandManager.py
# Botpy
#
# Created by <NAME> on 4th September 2017.
#
#
import threading
import chatexchange as ce
class CommandManager:
def __init__(self, commands):
self.commands = commands
self.running_commands = []
def run_command(self, command):
... | <filename>Source/CommandManager.py
#
# CommandManager.py
# Botpy
#
# Created by <NAME> on 4th September 2017.
#
#
import threading
import chatexchange as ce
class CommandManager:
def __init__(self, commands):
self.commands = commands
self.running_commands = []
def run_command(self, command):
... | en | 0.88065 | # # CommandManager.py # Botpy # # Created by <NAME> on 4th September 2017. # # #Everything else is arguments | 2.298014 | 2 |
tests/periodicities/gen_makefile.py | jmabry/pyaf | 377 | 10077 | <reponame>jmabry/pyaf<filename>tests/periodicities/gen_makefile.py
import os
import glob
subdirs = glob.glob("tests/periodicities/*");
subdirs = ['tests/periodicities/Month',
'tests/periodicities/Minute',
'tests/periodicities/Week',
'tests/periodicities/Business_Hour',
'test... | import os
import glob
subdirs = glob.glob("tests/periodicities/*");
subdirs = ['tests/periodicities/Month',
'tests/periodicities/Minute',
'tests/periodicities/Week',
'tests/periodicities/Business_Hour',
'tests/periodicities/Business_Day',
'tests/periodicities/Seco... | el | 0.263146 | #print(subdirs) # ********************************************** \n"); | 2.734335 | 3 |
test/test_util_registry.py | SimulatedANeal/carpedm | 2 | 10078 | #
# Copyright (C) 2018 <NAME>.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
#
# Portions of this module are copied or lightly modified from the
# Tensor2Tensor registry_test module, so here is their license:
#
# Copyright 2018 The Tensor2Ten... | #
# Copyright (C) 2018 <NAME>.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
#
# Portions of this module are copied or lightly modified from the
# Tensor2Tensor registry_test module, so here is their license:
#
# Copyright 2018 The Tensor2Ten... | en | 0.802799 | # # Copyright (C) 2018 <NAME>. # # This software may be modified and distributed under the terms # of the MIT license. See the LICENSE file for details. # # # Portions of this module are copied or lightly modified from the # Tensor2Tensor registry_test module, so here is their license: # # Copyright 2018 The Tensor2Ten... | 2.11834 | 2 |
pay-api/migrations/versions/8f7565cf50c1_.py | stevenc987/sbc-pay | 0 | 10079 | <reponame>stevenc987/sbc-pay
"""empty message
Revision ID: 8f7565cf50c1
Revises: 872760122cc9, <KEY>
Create Date: 2020-10-02 11:11:49.823678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = ('872760122cc9', '<KEY>')
branch_labels = None
d... | """empty message
Revision ID: 8f7565cf50c1
Revises: 872760122cc9, <KEY>
Create Date: 2020-10-02 11:11:49.823678
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = ('872760122cc9', '<KEY>')
branch_labels = None
depends_on = None
def upgrad... | en | 0.467755 | empty message Revision ID: 8f7565cf50c1 Revises: 872760122cc9, <KEY> Create Date: 2020-10-02 11:11:49.823678 # revision identifiers, used by Alembic. | 1.028404 | 1 |
iotronic/wamp/agent.py | smartmeio/stack4things-openstack-iotronic | 1 | 10080 | <reponame>smartmeio/stack4things-openstack-iotronic<filename>iotronic/wamp/agent.py<gh_stars>1-10
# Copyright 2017 MDSLAB - University of Messina
# 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 ob... | # Copyright 2017 MDSLAB - University of Messina
# 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
#
# U... | en | 0.836393 | # Copyright 2017 MDSLAB - University of Messina # 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 # # U... | 1.842086 | 2 |
src/export_to_poseviz.py | anibali/metro-pose3d | 52 | 10081 | <gh_stars>10-100
#!/usr/bin/env python3
import argparse
import logging
import sys
import numpy as np
import util
def main():
flags = initialize()
logging.debug(f'Loading from {flags.in_path}')
a = np.load(flags.in_path, allow_pickle=True)
all_results_3d = {}
for image_path, coords3d_pred in zip... | #!/usr/bin/env python3
import argparse
import logging
import sys
import numpy as np
import util
def main():
flags = initialize()
logging.debug(f'Loading from {flags.in_path}')
a = np.load(flags.in_path, allow_pickle=True)
all_results_3d = {}
for image_path, coords3d_pred in zip(a['image_path'],... | fr | 0.221828 | #!/usr/bin/env python3 | 2.291753 | 2 |
xcube/core/gen2/local/helpers.py | bcdev/xcube | 97 | 10082 | # The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation... | # The MIT License (MIT)
# Copyright (c) 2021 by the xcube development team and contributors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation... | en | 0.783621 | # The MIT License (MIT) # Copyright (c) 2021 by the xcube development team and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in # the Software without restriction, including without limitation... | 2.258219 | 2 |
core/log.py | dl-stuff/dl9 | 0 | 10083 | """Simulation logs"""
from __future__ import annotations # default once 3.10
import sys
from enum import Enum
from typing import Type, TYPE_CHECKING
if TYPE_CHECKING:
from core.timeline import Timeline
class LogKind(Enum):
def __str__(self) -> str:
return self.name
DEBUG = 0
SIM = 1
class... | """Simulation logs"""
from __future__ import annotations # default once 3.10
import sys
from enum import Enum
from typing import Type, TYPE_CHECKING
if TYPE_CHECKING:
from core.timeline import Timeline
class LogKind(Enum):
def __str__(self) -> str:
return self.name
DEBUG = 0
SIM = 1
class... | en | 0.677814 | Simulation logs # default once 3.10 1 row in the log Format this line of log Does any kind of updates to log data | 2.653929 | 3 |
zipline/__init__.py | chalant/pluto | 0 | 10084 | # #
# # Copyright 2015 Quantopian, 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 la... | # #
# # Copyright 2015 Quantopian, 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 la... | en | 0.598939 | # # # # Copyright 2015 Quantopian, 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 la... | 1.564181 | 2 |
smarts/core/utils/traffic_history_service.py | c-h-a-r-l-i-e/SMARTS | 0 | 10085 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... | en | 0.808112 | # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to us... | 1.801374 | 2 |
src/basics/sql_lite/update_data.py | FoxNeo/MyPythonProjects | 0 | 10086 | <gh_stars>0
import sqlite3
connect = sqlite3.connect("production.db")
cursor = connect.cursor()
cursor.execute("UPDATE PERSON SET edad = 19 WHERE nombre = 'Conker'")
connect.commit()
connect.close()
| import sqlite3
connect = sqlite3.connect("production.db")
cursor = connect.cursor()
cursor.execute("UPDATE PERSON SET edad = 19 WHERE nombre = 'Conker'")
connect.commit()
connect.close() | none | 1 | 2.573106 | 3 | |
calvin/runtime/south/plugins/media/defaultimpl/image.py | josrolgil/exjobbCalvin | 1 | 10087 | <filename>calvin/runtime/south/plugins/media/defaultimpl/image.py
import pygame
from StringIO import StringIO
import cv2
import os
import numpy
class Image(object):
"""
Image object
"""
def __init__(self):
self.display = None
def show_image(self, image, width, height):
"""
... | <filename>calvin/runtime/south/plugins/media/defaultimpl/image.py
import pygame
from StringIO import StringIO
import cv2
import os
import numpy
class Image(object):
"""
Image object
"""
def __init__(self):
self.display = None
def show_image(self, image, width, height):
"""
... | en | 0.746649 | Image object Show image # Too small to be a nearby face Close display | 2.935783 | 3 |
durin/models.py | mlodic/django-rest-durin | 0 | 10088 | <filename>durin/models.py<gh_stars>0
import binascii
from os import urandom
import humanize
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from durin.settings import durin_settings
from durin.signals import token_... | <filename>durin/models.py<gh_stars>0
import binascii
from os import urandom
import humanize
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from durin.settings import durin_settings
from durin.signals import token_... | en | 0.170369 | Token Time To Live (TTL) in timedelta. Format: <em>DAYS HH:MM:SS</em>. | 2.099509 | 2 |
linter.py | CudaText-addons/cuda_lint_htmltidy | 0 | 10089 | <filename>linter.py
# Copyright (c) 2013 <NAME>
# Change for CudaLint: <NAME>.
# License: MIT
import os
from cuda_lint import Linter, util
if os.name=='nt':
_exe = os.path.join(os.path.dirname(__file__), 'tidy_win32', 'tidy')
else:
_exe = 'tidy'
class HtmlTidy(Linter):
syntax = ('HTML', 'HTML_')
cmd ... | <filename>linter.py
# Copyright (c) 2013 <NAME>
# Change for CudaLint: <NAME>.
# License: MIT
import os
from cuda_lint import Linter, util
if os.name=='nt':
_exe = os.path.join(os.path.dirname(__file__), 'tidy_win32', 'tidy')
else:
_exe = 'tidy'
class HtmlTidy(Linter):
syntax = ('HTML', 'HTML_')
cmd ... | en | 0.556904 | # Copyright (c) 2013 <NAME> # Change for CudaLint: <NAME>. # License: MIT | 2.256847 | 2 |
PP4E-Examples-1.4/Examples/PP4E/Dstruct/Basic/inter2.py | AngelLiang/PP4E | 0 | 10090 | "set operations for multiple sequences"
def intersect(*args):
res = []
for x in args[0]: # scan the first list
for other in args[1:]: # for all other arguments
if x not in other: break # this item in each one?
else:
res.append(x) #... | "set operations for multiple sequences"
def intersect(*args):
res = []
for x in args[0]: # scan the first list
for other in args[1:]: # for all other arguments
if x not in other: break # this item in each one?
else:
res.append(x) #... | en | 0.601896 | # scan the first list # for all other arguments # this item in each one? # add common items to the end # for all sequence-arguments # for all nodes in argument # add new items to result | 3.582972 | 4 |
airtech_api/utils/error_messages/serialization_errors.py | chidioguejiofor/airtech-api | 1 | 10091 | <reponame>chidioguejiofor/airtech-api<gh_stars>1-10
msg_dict = {
'resource_not_found':
'The resource you specified was not found',
'invalid_gender':
"The gender you specified is invalid!!",
'many_invalid_fields':
'Some errors occured while validating some fields. Please check and try again',
... | msg_dict = {
'resource_not_found':
'The resource you specified was not found',
'invalid_gender':
"The gender you specified is invalid!!",
'many_invalid_fields':
'Some errors occured while validating some fields. Please check and try again',
'unique':
'The {} you inputted already exists',... | none | 1 | 2.547548 | 3 | |
blog/be/server/serialization/__init__.py | kamko/lnu_ht19_4ME310_final_project | 0 | 10092 | from .marshmallow import ma
from .schemas import ArticleSchema
__all__ = [
'ma',
'ArticleSchema'
]
| from .marshmallow import ma
from .schemas import ArticleSchema
__all__ = [
'ma',
'ArticleSchema'
]
| none | 1 | 1.056647 | 1 | |
scripts/fast_queue.py | ourresearch/openalex-guts | 48 | 10093 | import argparse
from time import sleep, time
from collections import defaultdict
from sqlalchemy import orm, text, insert, delete
from sqlalchemy.orm import selectinload
import models
from app import db
from app import logger
from scripts.queue import JsonWorks, JsonAuthors, JsonConcepts, JsonInstitutions, JsonVenues... | import argparse
from time import sleep, time
from collections import defaultdict
from sqlalchemy import orm, text, insert, delete
from sqlalchemy.orm import selectinload
import models
from app import db
from app import logger
from scripts.queue import JsonWorks, JsonAuthors, JsonConcepts, JsonInstitutions, JsonVenues... | en | 0.620966 | #{total_count} starting {obj}.{method_name}() method") # print(1/0) # fail loudly for now with chunk as ( select id from {queue_table} where started is null order by finished asc nulls first, rand limit :chunk ... | 2.237686 | 2 |
cogs/memes.py | Code-Cecilia/botman-rewrite | 2 | 10094 | import json
import discord
from discord.ext import commands
from assets import internet_funcs
from assets.list_funcs import chunks
class Memes(commands.Cog, description="Memes from https://imgflip.com/"):
def __init__(self, bot):
self.bot = bot
with open("config.json") as configFile:
... | import json
import discord
from discord.ext import commands
from assets import internet_funcs
from assets.list_funcs import chunks
class Memes(commands.Cog, description="Memes from https://imgflip.com/"):
def __init__(self, bot):
self.bot = bot
with open("config.json") as configFile:
... | en | 0.4917 | Fetches top 100 meme templates from imgflip.com # TODO: pagination for meme templates Generates a meme from imgflip. For template IDs, see the `memetemplates` command # clean up the number of boxes to send # ready the text boxes # send the request | 2.57659 | 3 |
examples/forest_fire/run.py | fire-suppression-abm/mesa | 1,704 | 10095 | <filename>examples/forest_fire/run.py
from forest_fire.server import server
server.launch()
| <filename>examples/forest_fire/run.py
from forest_fire.server import server
server.launch()
| none | 1 | 1.095216 | 1 | |
scripts/collect_timelines1.py | tedhchen/twitter_timeline_tools | 0 | 10096 | <reponame>tedhchen/twitter_timeline_tools
# Prep
import json, configparser, pickle, csv, logging, os
import pandas as pd
from tweepy import AppAuthHandler, API, Cursor
# Reading in configuation
params = configparser.ConfigParser()
params.read('config.ini')
# Functions
# Takes config file and returns authenticated api... | # Prep
import json, configparser, pickle, csv, logging, os
import pandas as pd
from tweepy import AppAuthHandler, API, Cursor
# Reading in configuation
params = configparser.ConfigParser()
params.read('config.ini')
# Functions
# Takes config file and returns authenticated api object
def twitter_auth(config):
auth = ... | en | 0.780228 | # Prep # Reading in configuation # Functions # Takes config file and returns authenticated api object # Get relevant user ids # takes user ids, and writes out a txt file wiith each user's status jsons # Running script # Setting up logger # Authenticating api # Get users from pre-parsed data # csv file with: # user, sub... | 2.788349 | 3 |
aquarius/app/auth_util.py | oceanprotocol/provider-backend | 0 | 10097 | <gh_stars>0
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
from eth_utils import is_address
from web3 import Web3
def sanitize_addresses(addresses):
return [Web3.toChecksumAddress(a) for a in addresses if is_address(a)]
def compare_eth_addresses(address, checker, logger):
... | #
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
from eth_utils import is_address
from web3 import Web3
def sanitize_addresses(addresses):
return [Web3.toChecksumAddress(a) for a in addresses if is_address(a)]
def compare_eth_addresses(address, checker, logger):
"""
C... | en | 0.647245 | # # Copyright 2021 Ocean Protocol Foundation # SPDX-License-Identifier: Apache-2.0 # Compare two addresses and return TRUE if there is a match :param str address: Address :param str checker: Address to compare with :param logger: instance of logging :return: boolean | 2.910401 | 3 |
oscar/lib/python2.7/site-packages/phonenumbers/data/region_DJ.py | sainjusajan/django-oscar | 0 | 10098 | """Auto-generated file, do not edit by hand. DJ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_DJ = PhoneMetadata(id='DJ', country_code=253, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[27]\\d{7}', possible_length=(8,)),
... | """Auto-generated file, do not edit by hand. DJ metadata"""
from ..phonemetadata import NumberFormat, PhoneNumberDesc, PhoneMetadata
PHONE_METADATA_DJ = PhoneMetadata(id='DJ', country_code=253, international_prefix='00',
general_desc=PhoneNumberDesc(national_number_pattern='[27]\\d{7}', possible_length=(8,)),
... | en | 0.825878 | Auto-generated file, do not edit by hand. DJ metadata | 2.126104 | 2 |
llvm-7.0.0.src/utils/unicode-case-fold.py | sillywalk/grazz | 171 | 10099 | <filename>llvm-7.0.0.src/utils/unicode-case-fold.py<gh_stars>100-1000
#!/usr/bin/env python
"""
Unicode case folding database conversion utility
Parses the database and generates a C++ function which implements the case
folding algorithm. The database entries are of the form:
<code>; <status>; <mapping>; # <name>
... | <filename>llvm-7.0.0.src/utils/unicode-case-fold.py<gh_stars>100-1000
#!/usr/bin/env python
"""
Unicode case folding database conversion utility
Parses the database and generates a C++ function which implements the case
folding algorithm. The database entries are of the form:
<code>; <status>; <mapping>; # <name>
... | en | 0.78973 | #!/usr/bin/env python Unicode case folding database conversion utility Parses the database and generates a C++ function which implements the case folding algorithm. The database entries are of the form: <code>; <status>; <mapping>; # <name> <status> can be one of four characters: C - Common mappings S - mappin... | 2.872822 | 3 |