file_name
large_stringlengths
4
140
prefix
large_stringlengths
0
39k
suffix
large_stringlengths
0
36.1k
middle
large_stringlengths
0
29.4k
fim_type
large_stringclasses
4 values
test1.go
// Copyright 2018 Alexander S.Kresin <alex@kresin.ru>, http://www.kresin.ru // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" egui "github.com/alkresin/external" "io/ioutil" "strconv" "time" ) const ( CLR_LBLUE = 16759929 CLR_L...
(p []string) string { if p[0] == "menu" { egui.MsgGet("Input something:", "MsgGet", 0, fmbox2, "fmbox2", "mm1") } else if p[0] == "mm1" { egui.MsgInfo(p[1], "Answer", nil, "", "") } return "" } func fmbox3(p []string) string { if p[0] == "menu" { arr := []string{"Alex Petrov", "Serg Lama", "Jimmy Hendrix", ...
fmbox2
identifier_name
test1.go
// Copyright 2018 Alexander S.Kresin <alex@kresin.ru>, http://www.kresin.ru // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" egui "github.com/alkresin/external" "io/ioutil" "strconv" "time" ) const ( CLR_LBLUE = 16759929 CLR_L...
pDlg.AddWidget(&egui.Widget{Type: "updown", Name: "upd1", X: 280, Y: 68, W: 60, H: 24}) pDlg.AddWidget(&egui.Widget{Type: "group", X: 10, Y: 110, W: 180, H: 76, Title: "Check"}) pDlg.AddWidget(&egui.Widget{Type: "check", Name: "chk1", X: 24, Y: 124, W: 150, H: 24, Title: "Married"}) pDlg.AddWidget(&egui.Widget{Typ...
pDlg.AddWidget(&egui.Widget{Type: "combo", Name: "comb", X: 20, Y: 68, W: 160, H: 24, AProps: map[string]string{"AItems": egui.ToString("first", "second", "third")}}) pDlg.AddWidget(&egui.Widget{Type: "label", X: 220, Y: 68, W: 80, H: 24, Title: "Age:"})
random_line_split
test1.go
// Copyright 2018 Alexander S.Kresin <alex@kresin.ru>, http://www.kresin.ru // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package main import ( "fmt" egui "github.com/alkresin/external" "io/ioutil" "strconv" "time" ) const ( CLR_LBLUE = 16759929 CLR_L...
else { iColor, _ := strconv.Atoi(p[1]) egui.Widg("main.l1").SetColor(int32(iColor), -1) } return "" } func fsele_font(p []string) string { if p[0] == "menu" { egui.SelectFont(fsele_font, "fsele_font", "") } else { fmt.Println("font id: ", p[0]) if pFont := egui.GetFont(p[0]); pFont != nil { if len(p)...
{ egui.SelectColor(0, fsele_color, "fsele_color", "mm1") }
conditional_block
serial_play.py
#!/usr/bin/env python # # Reads a vgm or vgz file and parses its contents. # The file must have extension either .vgm for uncompressed # files or .vgz for compressed files. After opening the file it sends music # music data to serial port specified by first parameter. # USB speed is configured at 9600 bps by...
def __init__(self, fd): self.__fd = fd self.__parse_header() self.__data = [] def dump_header(self): print("\x1b[2J") for k in ('id', 'str_version', 'total_samples', 'track_name', 'game_name', 'system_name','author_name', 'date'): ...
cnt = self.__header['gd3_offset'] - self.__header['vgm_data_offset'] self.__fd.seek(self.__header['vgm_data_offset']) self.__data = self.__fd.read(cnt)
identifier_body
serial_play.py
#!/usr/bin/env python # # Reads a vgm or vgz file and parses its contents. # The file must have extension either .vgm for uncompressed # files or .vgz for compressed files. After opening the file it sends music # music data to serial port specified by first parameter. # USB speed is configured at 9600 bps by...
# 0x62: Wait 1/60th second elif data[i] == 0x62: wait_value = WAIT60TH - (time.time() - frame_t) time.sleep(wait_value if wait_value > 0 else 0) frame_t = time.time() i += 1 ...
wait_value = struct.unpack('< H', data[i+1:i+3])[0] samples_played += wait_value #print(wait_value) # Substract time spent in code wait_value = 1.0 * wait_value / 44100 - (time.time() - frame_t) ...
conditional_block
serial_play.py
#!/usr/bin/env python # # Reads a vgm or vgz file and parses its contents. # The file must have extension either .vgm for uncompressed # files or .vgz for compressed files. After opening the file it sends music # music data to serial port specified by first parameter. # USB speed is configured at 9600 bps by...
# 0x63: Wait 1/50th second elif data[i] == 0x63: wait_value = WAIT50TH - (time.time() - frame_t) time.sleep(wait_value if wait_value > 0 else 0) frame_t = time.time() i += 1 ...
time.sleep(wait_value if wait_value > 0 else 0) frame_t = time.time() i += 1 samples_played += 735
random_line_split
serial_play.py
#!/usr/bin/env python # # Reads a vgm or vgz file and parses its contents. # The file must have extension either .vgm for uncompressed # files or .vgz for compressed files. After opening the file it sends music # music data to serial port specified by first parameter. # USB speed is configured at 9600 bps by...
(data, header): samples_played = 0; song_min, song_sec = to_minsec(header['total_samples'], 44100) with serial.Serial(sys.argv[1], BAUD) as ser: print("\n\x1b[33;1mIninitalizing USB serial...\x1b[0m", end='') time.sleep(2) # Wait for Arduino reset frame_t = time.time()...
vgm_play
identifier_name
test_utils.py
#!/usr/bin/python from __future__ import division, generators from hwgrader.utils import TestError from hwgrader.module_utils import _IOW from hwgrader import MMLOG_DEVICE_PATH, MMLOG_MODULE_LOAD, MMLOG_MODULE_UNLOAD import fcntl import pickle import shutil import time import errno import sys import os import re __al...
raise TestError('Requested wait() in child') if self_close: self.close_self() pid, exit_code = os.wait() self._exit_time = time.time() self._exit_code = exit_code def sync(self): """Wait for the other side of the fork to...
def wait(self, self_close=True): if self._inchild:
random_line_split
test_utils.py
#!/usr/bin/python from __future__ import division, generators from hwgrader.utils import TestError from hwgrader.module_utils import _IOW from hwgrader import MMLOG_DEVICE_PATH, MMLOG_MODULE_LOAD, MMLOG_MODULE_UNLOAD import fcntl import pickle import shutil import time import errno import sys import os import re __al...
def _get_fork_time(self): return self._fork_time fork_time = property(fget=_get_fork_time) def _get_exit_time(self): if self._inchild: raise TestError('Exit time is available only in parent') return self._exit_time exit_time = propert...
if self._inchild: raise TestError('Requested wait() in child') pid, exit_code = os.wait() self._exit_time = time.time() self._exit_code = exit_code
identifier_body
test_utils.py
#!/usr/bin/python from __future__ import division, generators from hwgrader.utils import TestError from hwgrader.module_utils import _IOW from hwgrader import MMLOG_DEVICE_PATH, MMLOG_MODULE_LOAD, MMLOG_MODULE_UNLOAD import fcntl import pickle import shutil import time import errno import sys import os import re __al...
action = re_result.group(1) pid = int(re_result.group(2)) address = re_result.group(3) if pid not in tracked_pids: continue f.write(line) f.write('\nProces...
continue
conditional_block
test_utils.py
#!/usr/bin/python from __future__ import division, generators from hwgrader.utils import TestError from hwgrader.module_utils import _IOW from hwgrader import MMLOG_DEVICE_PATH, MMLOG_MODULE_LOAD, MMLOG_MODULE_UNLOAD import fcntl import pickle import shutil import time import errno import sys import os import re __al...
(self): return self._cpid cpid = property(fget=_get_cpid) def _get_ppid(self): return self._ppid ppid = property(fget=_get_ppid) def exit(self, status=0): if not self._inchild: raise TestError('Requested exit() in parent') os....
_get_cpid
identifier_name
network.rs
extern crate reactivers; extern crate rand; use reactivers::engine::process::*; use reactivers::engine::signal::*; use reactivers::engine::signal::spmc_signal::*; use reactivers::engine::signal::mpsc_signal::*; use std::sync::Arc; use std::fs::File; use std::io::prelude::*; use self::rand::Rng; use super::graph::*;...
else { '-' }; let (x, y) = (2*start.x, 2*start.y); for k in 1..(2*length) { char_map[(y as i32 + k * dy) as usize][(x as i32 + k * dx) as usize] = c; } } // We collect the characters into a string. char_map.into_iter().map(|line| { line.into...
{ '|' }
conditional_block
network.rs
extern crate reactivers; extern crate rand; use reactivers::engine::process::*; use reactivers::engine::signal::*; use reactivers::engine::signal::spmc_signal::*; use reactivers::engine::signal::mpsc_signal::*; use std::sync::Arc; use std::fs::File; use std::io::prelude::*; use self::rand::Rng; use super::graph::*;...
{ pub x: usize, // Abscissa pub y: usize, // Ordinate } use std::ops::{ Index, IndexMut }; /// Allows indexing the grid by the crossroad coordinates. impl Index<CrossroadId> for Vec<Vec<Option<Crossroad>>> { type Output = Option<Crossroad>; #[inline] fn index(&self, index: CrossroadId) -> &O...
CrossroadId
identifier_name
network.rs
extern crate reactivers; extern crate rand; use reactivers::engine::process::*; use reactivers::engine::signal::*; use reactivers::engine::signal::spmc_signal::*; use reactivers::engine::signal::mpsc_signal::*; use std::sync::Arc; use std::fs::File; use std::io::prelude::*; use self::rand::Rng; use super::graph::*;...
// with specified destination crossroad. STEP(i32), // The car performs a step of specified length. VANISH, // The car vanished. CROSS(RoadInfo), // The car crossed and is now on s...
pub enum Move { NONE, // None happened. SPAWN(RoadInfo, usize, CrossroadId), // The car has spawned at specified road, position,
random_line_split
network.rs
extern crate reactivers; extern crate rand; use reactivers::engine::process::*; use reactivers::engine::signal::*; use reactivers::engine::signal::spmc_signal::*; use reactivers::engine::signal::mpsc_signal::*; use std::sync::Arc; use std::fs::File; use std::io::prelude::*; use self::rand::Rng; use super::graph::*;...
/// Add the two road linking the first crossroad to the second one. pub fn add_road(&mut self, (src_x, src_y): (usize, usize), (dest_x, dest_y): (usize, usize)) { let (src, dest) = (CrossroadId::new(src_x, src_y), CrossroadId::new(dest_x, dest_y)); // Checks the source and destina...
{ // We get the parameters of the road. let (dx, dy, length) = src.join(dest); let length = length * self.cars_per_unit - self.cars_per_crossroad; let (d1, d2) = compute_directions(dx, dy, side); let id = self.roads.len(); // First, it builds the road in the network. ...
identifier_body
reflect_test.go
package base import ( "fmt" "log" "reflect" "runtime" "testing" ) // Go语言提供了一种机制在运行时更新和检查变量的值、调用变量的方法和变量支持的内在操作,但是在编译时并不知道这些变量的具体类型,这种机制被称为反射。 // go语言提供了一种机制,在编译时不知道类型的情况下,可更新变量,在运行时查看值,调用方法以及直接对他们的布局进行操作。这种机制称为反射(reflection) // 在计算机科学领域,反射是指一类应用,它们能够自描述和自控制。也就是说,这类应用通过采用某种机制来实现对自己行为的描述(self-representation)和监测(e...
// 尝试从map中查找一个不存在的键 fmt.Println("不存在的键:", reflect.ValueOf(m).MapIndex(reflect.ValueOf(3)).IsValid()) } func TestReflectInvokeFun(t *testing.T) { of := reflect.ValueOf(testFunc) of.Call(getValues()) } // 注意,又不符合则panic // 如何通过反射来进行方法的调用? // 本来可以用u.ReflectCallFuncXXX直接调用的,但是如果要通过反射,那么首先要将方法注册,也就是MethodByName,然后通过反射调...
random_line_split
reflect_test.go
package base import ( "fmt" "log" "reflect" "runtime" "testing" ) // Go语言提供了一种机制在运行时更新和检查变量的值、调用变量的方法和变量支持的内在操作,但是在编译时并不知道这些变量的具体类型,这种机制被称为反射。 // go语言提供了一种机制,在编译时不知道类型的情况下,可更新变量,在运行时查看值,调用方法以及直接对他们的布局进行操作。这种机制称为反射(reflection) // 在计算机科学领域,反射是指一类应用,它们能够自描述和自控制。也就是说,这类应用通过采用某种机制来实现对自己行为的描述(self-representation)和监测(e...
identifier_name
reflect_test.go
package base import ( "fmt" "log" "reflect" "runtime" "testing" ) // Go语言提供了一种机制在运行时更新和检查变量的值、调用变量的方法和变量支持的内在操作,但是在编译时并不知道这些变量的具体类型,这种机制被称为反射。 // go语言提供了一种机制,在编译时不知道类型的情况下,可更新变量,在运行时查看值,调用方法以及直接对他们的布局进行操作。这种机制称为反射(reflection) // 在计算机科学领域,反射是指一类应用,它们能够自描述和自控制。也就是说,这类应用通过采用某种机制来实现对自己行为的描述(self-representation)和监测(e...
。 Type int `json:"type" id:"100"` } ins := cat{Name: "mimi", Type: 1} // 获取结构体实例的反射类型对象 typeOfCat := reflect.TypeOf(ins) // 获得一个结构体类型共有多少个字段。如果类型不是结构体,将会触发panic。 for i := 0; i < typeOfCat.NumField(); i++ { // 获取每个成员的结构体字段类型,返回 StructField 结构,这个结构描述结构体的成员信息,通过这个信息可以获取成员与结构体的关系,如偏移、索引、是否为匿名字段、结构体标签(StructTag)等 ...
q).Elem() typeOfT := s.Type() for i := 0; i < s.NumField(); i++ { f := s.Field(i) fmt.Printf("%d: %s %s = %v\n", i, typeOfT.Field(i).Name, f.Type(), f.Interface()) } s.Field(0).SetInt(77) s.Field(1).SetString("Sunset Strip") fmt.Println("t is now", t) } func TestReflectSetValue(t *testing.T) { var num f...
identifier_body
reflect_test.go
package base import ( "fmt" "log" "reflect" "runtime" "testing" ) // Go语言提供了一种机制在运行时更新和检查变量的值、调用变量的方法和变量支持的内在操作,但是在编译时并不知道这些变量的具体类型,这种机制被称为反射。 // go语言提供了一种机制,在编译时不知道类型的情况下,可更新变量,在运行时查看值,调用方法以及直接对他们的布局进行操作。这种机制称为反射(reflection) // 在计算机科学领域,反射是指一类应用,它们能够自描述和自控制。也就是说,这类应用通过采用某种机制来实现对自己行为的描述(self-representation)和监测(e...
e("ID") fmt.Println(field, b) user2 := &User{} var user3 interface{} user3 = user2 i := reflect.TypeOf(user3) elem := i.Elem() fmt.Println("elem:", elem.Name()) typeOf := reflect.TypeOf(test) fmt.Println(typeOf) name := runtime.FuncForPC(reflect.ValueOf(test).Pointer()).Name() fmt.Println("name:", name) }...
Println(a.Name(), a.Kind(), a.PkgPath()) field, b := a.FieldByNam
conditional_block
conn.go
package smtp import ( "crypto/tls" "encoding/base64" "errors" "fmt" "io" "io/ioutil" "net" "net/textproto" "regexp" "runtime/debug" "strconv" "strings" "sync" "time" ) // Number of errors we'll tolerate per connection before closing. Defaults to 3. const errThreshold = 3 type Conn struct { conn net....
() bool { _, isTLS := c.TLSConnectionState() return !c.server.AuthDisabled && (isTLS || c.server.AllowInsecureAuth) } // protocolError writes errors responses and closes the connection once too many // have occurred. func (c *Conn) protocolError(code int, ec EnhancedCode, msg string) { c.writeResponse(code, ec, msg...
authAllowed
identifier_name
conn.go
package smtp import ( "crypto/tls" "encoding/base64" "errors" "fmt" "io" "io/ioutil" "net" "net/textproto" "regexp" "runtime/debug" "strconv" "strings" "sync" "time" ) // Number of errors we'll tolerate per connection before closing. Defaults to 3. const errThreshold = 3 type Conn struct { conn net....
c.bdatPipe.CloseWithError(ErrDataReset) c.bdatPipe = nil } if c.session != nil { c.session.Logout() c.session = nil } return c.conn.Close() } // TLSConnectionState returns the connection's TLS connection state. // Zero values are returned if the connection doesn't use TLS. func (c *Conn) TLSConnectionSta...
if c.bdatPipe != nil {
random_line_split
conn.go
package smtp import ( "crypto/tls" "encoding/base64" "errors" "fmt" "io" "io/ioutil" "net" "net/textproto" "regexp" "runtime/debug" "strconv" "strings" "sync" "time" ) // Number of errors we'll tolerate per connection before closing. Defaults to 3. const errThreshold = 3 type Conn struct { conn net....
// ErrDataReset is returned by Reader pased to Data function if client does not // send another BDAT command and instead closes connection or issues RSET command. var ErrDataReset = errors.New("smtp: message transmission aborted") var errPanic = &SMTPError{ Code: 421, EnhancedCode: EnhancedCode{4, 0, 0}, ...
{ args := strings.Fields(arg) if len(args) == 0 { c.writeResponse(501, EnhancedCode{5, 5, 4}, "Missing chunk size argument") return } if len(args) > 2 { c.writeResponse(501, EnhancedCode{5, 5, 4}, "Too many arguments") return } if !c.fromReceived || len(c.recipients) == 0 { c.writeResponse(502, Enhance...
identifier_body
conn.go
package smtp import ( "crypto/tls" "encoding/base64" "errors" "fmt" "io" "io/ioutil" "net" "net/textproto" "regexp" "runtime/debug" "strconv" "strings" "sync" "time" ) // Number of errors we'll tolerate per connection before closing. Defaults to 3. const errThreshold = 3 type Conn struct { conn net....
if c.server.EnableSMTPUTF8 { caps = append(caps, "SMTPUTF8") } if _, isTLS := c.TLSConnectionState(); isTLS && c.server.EnableREQUIRETLS { caps = append(caps, "REQUIRETLS") } if c.server.EnableBINARYMIME { caps = append(caps, "BINARYMIME") } if c.server.MaxMessageBytes > 0 { caps = append(caps, fmt.Spri...
{ authCap := "AUTH" for name := range c.server.auths { authCap += " " + name } caps = append(caps, authCap) }
conditional_block
lib.rs
//! A high-level API for programmatically interacting with web pages //! through WebDriver. //! //! [WebDriver protocol]: https://www.w3.org/TR/webdriver/ //! [CSS selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors //! [powerful]: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes /...
( &self, locator: Locator, root: Option<WebElement>, ) -> Result<WebElement> { let cmd = match root { Option::None => WebDriverCommand::FindElement(locator.into()), Option::Some(elt) => { WebDriverCommand::FindElementElement(elt, locator.into()...
find
identifier_name
lib.rs
//! A high-level API for programmatically interacting with web pages //! through WebDriver. //! //! [WebDriver protocol]: https://www.w3.org/TR/webdriver/ //! [CSS selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors //! [powerful]: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes /...
/// Wait for the specified element(s) to appear on the page pub async fn $name( &self, search: Locator, root: Option<WebElement> ) -> Result<$return_typ> { loop { match self.$search_fn(search.clone(), root.clone()).await { ...
($name:ident, $search_fn:ident, $return_typ:ty) => {
random_line_split
lib.rs
//! A high-level API for programmatically interacting with web pages //! through WebDriver. //! //! [WebDriver protocol]: https://www.w3.org/TR/webdriver/ //! [CSS selectors]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors //! [powerful]: https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes /...
/// Set the `value` of the input element named `name` which is a child of `eid` pub async fn set_by_name( &self, eid: WebElement, name: String, value: String, ) -> Result<()> { let locator = Locator::Css(format!("input[name='{}']", name)); let elt = self.clo...
{ match self.clone().attr(eid.clone(), String::from("href")).await? { None => bail!("no href attribute"), Some(href) => { let current = self.current_url().await?.join(&href)?; self.goto(current.as_str()).await } } }
identifier_body
lib.rs
//! Brainfuck interpreter types //! //! This crate contains all the data types necessary for the Brainfuck //! interpreter project. #![deny(missing_docs)] use std::fmt; use std::io; use std::path::{Path, PathBuf}; use thiserror::Error; /// Represents a Brainfuck Types Error. #[derive(Error, fmt::Debug)] pub enum Br...
(s: &str) -> Vec<Self> { let mut instrs: Vec<BrainfuckInstr> = Vec::new(); for (l, pline) in s.lines().enumerate() { for (c, pbyte) in pline.bytes().enumerate() { if let Some(iraw) = BrainfuckInstrRaw::from_byte(pbyte) { instrs.push(BrainfuckInstr { ...
instrs_from_str
identifier_name
lib.rs
//! Brainfuck interpreter types //! //! This crate contains all the data types necessary for the Brainfuck //! interpreter project. #![deny(missing_docs)]
use thiserror::Error; /// Represents a Brainfuck Types Error. #[derive(Error, fmt::Debug)] pub enum BrainfuckTypesError { /// When an unmatched left or right bracket is found #[error("unmatched bracket, {0:?}")] UnmatchedBracket(BrainfuckInstr), } /// Represents the eight raw Brainfuck instructions. #[de...
use std::fmt; use std::io; use std::path::{Path, PathBuf};
random_line_split
sse_server.rs
//! Server-sent-event server for the note viewer feature. //! This module contains also the web browser Javascript client code. use crate::config::CFG; use crate::config::VIEWER_SERVED_MIME_TYPES_MAP; use crate::viewer::error::ViewerError; use crate::viewer::http_response::HttpResponse; use crate::viewer::init::LOCALH...
{ /// Receiver side of the channel where `update` events are sent. rx: Receiver<SseToken>, /// Byte stream coming from a TCP connection. pub(crate) stream: TcpStream, /// A list of referenced relative URLs to images or other /// documents as they appear in the delivered Tp-Note documents. /...
ServerThread
identifier_name
sse_server.rs
//! Server-sent-event server for the note viewer feature. //! This module contains also the web browser Javascript client code. use crate::config::CFG; use crate::config::VIEWER_SERVED_MIME_TYPES_MAP; use crate::viewer::error::ViewerError; use crate::viewer::http_response::HttpResponse; use crate::viewer::init::LOCALH...
/// Write HTTP event response. fn respond_event_ok(&mut self) -> Result<(), ViewerError> { // Declare SSE capability and allow cross-origin access. let response = format!( "\ HTTP/1.1 200 OK\r\n\ Date: {}\r\n\ Access-Control-Allow-Origin: *\r\...
{ // One reference is hold by the `manage_connections` thread and does not count. // This is why we subtract 1. let open_connections = Arc::<()>::strong_count(&self.conn_counter) - 1; log::trace!( "TCP port local {} to peer {}: New incoming TCP connection ({} open).", ...
identifier_body
sse_server.rs
//! Server-sent-event server for the note viewer feature. //! This module contains also the web browser Javascript client code. use crate::config::CFG; use crate::config::VIEWER_SERVED_MIME_TYPES_MAP; use crate::viewer::error::ViewerError; use crate::viewer::http_response::HttpResponse; use crate::viewer::init::LOCALH...
pub enum SseToken { /// Server-Sent-Event token to request nothing but check if the client is still /// there. Ping, /// Server-Sent-Event token to request a page update. Update, } pub fn manage_connections( event_tx_list: Arc<Mutex<Vec<SyncSender<SseToken>>>>, listener: TcpListener, do...
/// Server-Sent-Event tokens our HTTP client has registered to receive. #[derive(Debug, Clone, Copy)]
random_line_split
inner_product_proof.rs
#![allow(non_snake_case)] #![doc(include = "../docs/inner-product-protocol.md")] use std::borrow::Borrow; use std::iter; use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::VartimeMultiscalarMul; use proof_transcript::ProofTranscript; #[derive(Serial...
} } /// Computes an inner product of two vectors /// \\[ /// {\langle {\mathbf{a}}, {\mathbf{b}} \rangle} = \sum\_{i=0}^{n-1} a\_i \cdot b\_i. /// \\] /// Panics if the lengths of \\(\mathbf{a}\\) and \\(\mathbf{b}\\) are not equal. pub fn inner_product(a: &[Scalar], b: &[Scalar]) -> Scalar { let mut out =...
{ Err(()) }
conditional_block
inner_product_proof.rs
#![allow(non_snake_case)] #![doc(include = "../docs/inner-product-protocol.md")] use std::borrow::Borrow; use std::iter; use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::VartimeMultiscalarMul; use proof_transcript::ProofTranscript; #[derive(Serial...
( &self, transcript: &mut ProofTranscript, ) -> (Vec<Scalar>, Vec<Scalar>, Vec<Scalar>) { let lg_n = self.L_vec.len(); let n = 1 << lg_n; // 1. Recompute x_k,...,x_1 based on the proof transcript let mut challenges = Vec::with_capacity(lg_n); for (L, R) in s...
verification_scalars
identifier_name
inner_product_proof.rs
#![allow(non_snake_case)] #![doc(include = "../docs/inner-product-protocol.md")] use std::borrow::Borrow; use std::iter; use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::VartimeMultiscalarMul; use proof_transcript::ProofTranscript; #[derive(Serial...
// where b' = b \circ y^(-n) let b_prime = b.iter().zip(util::exp_iter(y_inv)).map(|(bi, yi)| bi * yi); // a.iter() has Item=&Scalar, need Item=Scalar to chain with b_prime let a_prime = a.iter().cloned(); let P = RistrettoPoint::vartime_multiscalar_mul( a_prime.chai...
// P would be determined upstream, but we need a correct P to check the proof. // // To generate P = <a,G> + <b,H'> + <a,b> Q, compute // P = <a,G> + <b',H> + <a,b> Q,
random_line_split
spotutils.py
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
c[i] = sed.Nlambda(x[i]) * filter.Tlambda(x[i]) o = numpy.ones((npts)) I = numpy.zeros((2*nOrder)) lctr = numpy.mean(x) for k in range(2*nOrder): I[k] = numpy.sum(o*(x-lctr)**k*c) # orthogonal polynomial p_n # require sum_{j=0}^n coef_{n-j} I_{j+k} = 0 or # sum_{j=0}^{n-1} coef_{n-j} I_{j+k} = ...
c = numpy.zeros((npts)) for i in range(npts):
random_line_split
spotutils.py
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
# psi is a vector of Zernikes, in wavelengths # mask information: (currently none) # scale = sampling (points per lambda/D) # Nstep = # grid points # output normalized to sum to 1 def mono_psf(psi, mask, scale, Nstep): if hasattr(mask, 'N'): if hasattr(mask, 'spline'): interp_spline = mask.spline else...
for k in range(36): psi = numpy.zeros(36) psi[k] = 1 N=5 M = zernike_map_noll(psi, N, N/(N-1)) print(' *** Zernike {:2d} ***'.format(k+1)) for j in range(N): out = '' for i in range(N): out = out + ' {:10.5f}'.format(M[j,i]) print(out) print('')
identifier_body
spotutils.py
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
this_psi = numpy.copy(psi)/wl[i] # convert from um -> wavelengths of wavefront sumc += c output += c * mono_psf(this_psi, mask, scale_1um*wl[i], Nstep) #print('{:6.4f} {:11.5E}'.format(wl[i],filter.Tlambda(wl[i]))) output /= sumc return(output) # make oversampled PSF at given SCA, position # # se...
if addInfo.FastMode: c = dwl[i]
conditional_block
spotutils.py
import numpy import numpy.fft import numpy.linalg import copy from astropy.io import fits from scipy.interpolate import RectBivariateSpline from scipy.signal import convolve import offset_index # some basic definitions psSize = 9 # psSize x psSize postage stamps of stars # zero padded RectBivariateSpline, if on def R...
(self, lambda_): # smoothed tophat if self.type=='STH': lmin = self.info[0]; dlmin = lmin*.02 lmax = self.info[1]; dlmax = lmax*.02 return((numpy.tanh((lambda_-lmin)/dlmin)-numpy.tanh((lambda_-lmax)/dlmax))/2.) # interpolated file # info shape (N,2) -- info[:,0] = wavelength, info[:,1...
Tlambda
identifier_name
pim_rpf_hash_bag.pb.go
/* Copyright 2019 Cisco Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
return "" } func (m *PimRpfHashBag_KEYS) GetSourceAddress() string { if m != nil { return m.SourceAddress } return "" } func (m *PimRpfHashBag_KEYS) GetMofrr() uint32 { if m != nil { return m.Mofrr } return 0 } type PimAddrtype struct { AfName string `protobuf:"bytes,1,opt,name=af_name,j...
{ return m.TopologyName }
conditional_block
pim_rpf_hash_bag.pb.go
/* Copyright 2019 Cisco Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
func (m *PimAddrtype) GetIpv6Address() string { if m != nil { return m.Ipv6Address } return "" } type PimRpfHashBag struct { NextHopMultipathEnabled bool `protobuf:"varint,50,opt,name=next_hop_multipath_enabled,json=nextHopMultipathEnabled,proto3" json:"next_hop_multipath_enabled,omitempty"` NextHop...
{ if m != nil { return m.Ipv4Address } return "" }
identifier_body
pim_rpf_hash_bag.pb.go
/* Copyright 2019 Cisco Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
() { proto.RegisterType((*PimRpfHashBag_KEYS)(nil), "cisco_ios_xr_ipv4_pim_oper.pim.standby.vrfs.vrf.safs.saf.rpf_hash_sources.rpf_hash_source.pim_rpf_hash_bag_KEYS") proto.RegisterType((*PimAddrtype)(nil), "cisco_ios_xr_ipv4_pim_oper.pim.standby.vrfs.vrf.safs.saf.rpf_hash_sources.rpf_hash_source.pim_addrtype") prot...
init
identifier_name
pim_rpf_hash_bag.pb.go
/* Copyright 2019 Cisco Systems Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software d...
type PimRpfHashBag struct { NextHopMultipathEnabled bool `protobuf:"varint,50,opt,name=next_hop_multipath_enabled,json=nextHopMultipathEnabled,proto3" json:"next_hop_multipath_enabled,omitempty"` NextHopAddress *PimAddrtype `protobuf:"bytes,51,opt,name=next_hop_address,json=nextHopAddress,proto3...
if m != nil { return m.Ipv6Address } return "" }
random_line_split
index.js
'use strict'; const FFI = require('ffi'), path = require('path'), ref = require('ref'), /** * @typedef LogLevel * @type {object} * @property {int} NONE No logging. * @property {int} NORMAL Normal logging of important events like errors and warnings. The default log level. ...
static get LogLevel () { return LogLevel; } /** * <p>Create bindings for the Nymi API</p> * * @constructor * @param {boolean} [nymulator=false] TRUE create bindings for networked library, FALSE create bindings for native library. */ constructor (nymulator) { ...
random_line_split
index.js
'use strict'; const FFI = require('ffi'), path = require('path'), ref = require('ref'), /** * @typedef LogLevel * @type {object} * @property {int} NONE No logging. * @property {int} NORMAL Normal logging of important events like errors and warnings. The default log level. ...
{ return LogLevel; } /** * <p>Create bindings for the Nymi API</p> * * @constructor * @param {boolean} [nymulator=false] TRUE create bindings for networked library, FALSE create bindings for native library. */ constructor (nymulator) { nymulator = nymulator ...
el ()
identifier_name
index.js
'use strict'; const FFI = require('ffi'), path = require('path'), ref = require('ref'), /** * @typedef LogLevel * @type {object} * @property {int} NONE No logging. * @property {int} NORMAL Normal logging of important events like errors and warnings. The default log level. ...
if (outcome === NapiBinding.GetOutcome.OKAY) { json = JSON.parse(buf.readCString(0)); } } catch (err) { outcome = NapiBinding.GetOutcome.ERROR; } return {outcome: outcome, json: json}; } /** * <p>Receive a JSON message from NAPI if o...
outcome = _g(this, 'binding').napiGet(buf, len.deref(), len); }
conditional_block
index.js
'use strict'; const FFI = require('ffi'), path = require('path'), ref = require('ref'), /** * @typedef LogLevel * @type {object} * @property {int} NONE No logging. * @property {int} NORMAL Normal logging of important events like errors and warnings. The default log level. ...
/** * LogLevel * * @static * @return {LogLevel} */ static get LogLevel () { return LogLevel; } /** * <p>Create bindings for the Nymi API</p> * * @constructor * @param {boolean} [nymulator=false] TRUE create bindings for networked library, FALSE cre...
return ConfigOutcome; }
identifier_body
run.py
#run.py import hrr import cleanup_lib.cleanup_utilities as cu import cleanup_lib.learn_cleanup as lc from stats.bootstrapci import bootstrapci from ca.nengo.util.impl import NodeThreadPool from optparse import OptionParser import sys import random import ConfigParser import numeric as np import logging def make_simpl...
def dry_run(results_file): logging.info("Dry run!") config = ConfigParser.ConfigParser() config.add_section('Error') config.set('Error', 'mean', 0.0) config.set('Error', 'var', 0.0) f = open(results_file, 'w') config.write(f) f.close() sys.exit() def start(): (options, a...
run = 0 run_length = (options.learningpres + options.testingpres) * trial_length * options.dt logging.info("Run length: %g" % (run_length)) controller = network._get_node('EC') errors = [] while run < options.num_runs: logging.info("Starting run: %d" % (run + 1)) network.run(run_leng...
identifier_body
run.py
#run.py import hrr import cleanup_lib.cleanup_utilities as cu import cleanup_lib.learn_cleanup as lc from stats.bootstrapci import bootstrapci from ca.nengo.util.impl import NodeThreadPool from optparse import OptionParser import sys import random import ConfigParser import numeric as np import logging def make_simpl...
(): yield learning yield testing return f def simple_noise(noise): def f(input_vec): v = input_vec + noise * hrr.HRR(D).v v = v / np.sqrt(sum(v**2)) return v return f def hrr_noise(D, num): noise_vocab = hrr.Vocabulary(D) keys = [noise_vocab.parse(str(x))...
f
identifier_name
run.py
#run.py import hrr import cleanup_lib.cleanup_utilities as cu import cleanup_lib.learn_cleanup as lc from stats.bootstrapci import bootstrapci from ca.nengo.util.impl import NodeThreadPool from optparse import OptionParser import sys import random import ConfigParser import numeric as np import logging def make_simpl...
help="Dimension of the vectors that the cleanup operates on") parser.add_option("-V", "--numvectors", dest="num_vecs", default=4, type="int", help="Number of vectors that the cleanup will try to learn") parser.add_option("--dt", default=0.001, type="float", help="Time step") pars...
help="Number of neurons per dimension for other ensembles") parser.add_option("-D", "--dim", dest="D", default=16, type="int",
random_line_split
run.py
#run.py import hrr import cleanup_lib.cleanup_utilities as cu import cleanup_lib.learn_cleanup as lc from stats.bootstrapci import bootstrapci from ca.nengo.util.impl import NodeThreadPool from optparse import OptionParser import sys import random import ConfigParser import numeric as np import logging def make_simpl...
else: options.learning_noise = simple_noise(options.learning_noise) options.testing_noise = simple_noise(options.testing_noise) options.schedule_func = make_simple_test_schedule(options.learningpres, options.testingpres) options_dict = options.__dict__ network = lc.make_learnable_cle...
options.learning_noise = hrr_noise(options.D, options.learning_noise) options.testing_noise = hrr_noise(options.D, options.testing_noise)
conditional_block
tab_switch_cuj.go
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Package tabswitchcuj contains the test code for TabSwitchCUJ. The test is // extracted into this package to be shared between TabSwitchCUJRecorder and // TabSwitchCUJ. // ...
vars.bTconn, err = vars.br.TestAPIConn(ctx) if err != nil { return nil, errors.Wrap(err, "failed to get browser TestAPIConn") } vars.recorder, err = cujrecorder.NewRecorder(ctx, vars.cr, vars.bTconn, nil, cujrecorder.RecorderOptions{}) if err != nil { return nil, errors.Wrap(err, "failed to create a recorde...
{ return nil, errors.Wrap(err, "failed to open the browser") }
conditional_block
tab_switch_cuj.go
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Package tabswitchcuj contains the test code for TabSwitchCUJ. The test is // extracted into this package to be shared between TabSwitchCUJRecorder and // TabSwitchCUJ. // ...
(ctx context.Context, tconn *chrome.TestConn, tabs *[]map[string]interface{}, tabIndexWithinWindow int, timeout time.Duration) error { // Define parameters for API calls activateTabProperties := map[string]interface{}{ "active": true, } // Find id of tab with positional index. tabID := int((*tabs)[tabIndexWithi...
focusTab
identifier_name
tab_switch_cuj.go
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Package tabswitchcuj contains the test code for TabSwitchCUJ. The test is // extracted into this package to be shared between TabSwitchCUJRecorder and // TabSwitchCUJ. // ...
topRow, err := input.KeyboardTopRowLayout(ctx, kw) if err != nil { return errors.Wrap(err, "failed to obtain the top-row layout") } if err = kw.Accel(ctx, topRow.VolumeMute); err != nil { return errors.Wrap(err, "failed to press mute key") } return nil } // findAnchorURLs returns the unique URLs of the anc...
return errors.Wrap(err, "failed to open the keyboard") } defer kw.Close()
random_line_split
tab_switch_cuj.go
// Copyright 2022 The ChromiumOS Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Package tabswitchcuj contains the test code for TabSwitchCUJ. The test is // extracted into this package to be shared between TabSwitchCUJRecorder and // TabSwitchCUJ. // ...
func retrieveAllTabs(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration) ([]map[string]interface{}, error) { emptyQuery := map[string]interface{}{} // Get all tabs var tabs []map[string]interface{} ctx, cancel := context.WithTimeout(ctx, timeout) defer cancel() err := tconn.Call(ctx, &tabs, `ta...
{ query := map[string]interface{}{ "status": "loading", "currentWindow": true, } return testing.Poll(ctx, func(ctx context.Context) error { var tabs []map[string]interface{} if err := tconn.Call(ctx, &tabs, `tast.promisify(chrome.tabs.query)`, query); err != nil { return testing.PollBreak(err) } ...
identifier_body
main.rs
#[macro_use] extern crate errln; #[macro_use] extern crate error_chain; extern crate clap; extern crate hex; extern crate lalrpop_util; extern crate parser_haskell; extern crate regex; extern crate tempdir; extern crate walkdir; extern crate corollary; extern crate inflector; use parser_haskell::util::{print_parse_err...
quick_main!(run); fn run() -> Result<()> { use std::io::Write; let matches = App::new("corollary") .version("0.1") .about("Converts Haskell to Rust") .arg(Arg::with_name("run") .short("r") .long("run") .help("Runs the file")) .arg(Arg::with...
{ let mut contents = input.to_string(); let mut file_out = String::new(); let mut rust_out = String::new(); // Parse out HASKELL /HASKELL RUST /RUST sections. let re = Regex::new(r#"HASKELL[\s\S]*?/HASKELL"#).unwrap(); contents = re.replace(&contents, "").to_string(); let re = Regex::new(r#...
identifier_body
main.rs
#[macro_use] extern crate errln; #[macro_use] extern crate error_chain; extern crate clap; extern crate hex; extern crate lalrpop_util; extern crate parser_haskell; extern crate regex; extern crate tempdir; extern crate walkdir; extern crate corollary; extern crate inflector; use parser_haskell::util::{print_parse_err...
} // Starting message. if arg_run { errln!("running {:?}...", arg_input); } else { errln!("cross-compiling {:?}...", arg_input); } // Read file contents. let mut file = File::open(arg_input) .chain_err(|| format!("Could not open {:?}", arg_input))?; let mut cont...
} if (arg_run || arg_out.is_some()) && arg_ast { bail!("Cannot use --ast and (--run or --out) at the same time.");
random_line_split
main.rs
#[macro_use] extern crate errln; #[macro_use] extern crate error_chain; extern crate clap; extern crate hex; extern crate lalrpop_util; extern crate parser_haskell; extern crate regex; extern crate tempdir; extern crate walkdir; extern crate corollary; extern crate inflector; use parser_haskell::util::{print_parse_err...
(input: &str, p: &Path, inline_mod: bool, dump_ast: bool) -> Result<(String, String)> { let mut contents = input.to_string(); let mut file_out = String::new(); let mut rust_out = String::new(); // Parse out HASKELL /HASKELL RUST /RUST sections. let re = Regex::new(r#"HASKELL[\s\S]*?/HASKELL"#).unwr...
convert_file
identifier_name
main.rs
#[macro_use] extern crate errln; #[macro_use] extern crate error_chain; extern crate clap; extern crate hex; extern crate lalrpop_util; extern crate parser_haskell; extern crate regex; extern crate tempdir; extern crate walkdir; extern crate corollary; extern crate inflector; use parser_haskell::util::{print_parse_err...
else { writeln!(file_out, "#[macro_use] use corollary_support::*;")?; writeln!(file_out, "")?; let state = PrintState::new(); writeln!(file_out, "{}", print_item_list(state, &v.items, true))?; } } } ...
{ writeln!(file_out, "pub mod {} {{", v.name.0.replace(".", "_"))?; writeln!(file_out, " use haskell_support::*;")?; writeln!(file_out, "")?; let state = PrintState::new(); writeln!(file_out, "{}", print_item_list(sta...
conditional_block
bgs-utils.ts
import { CardIds, GameType, Race, ReferenceCard } from '../public-api'; export const ALL_BG_RACES = [ Race.BEAST, Race.DEMON, Race.DRAGON, Race.MECH, Race.MURLOC, Race.PIRATE, Race.ELEMENTAL, Race.QUILBOAR, Race.NAGA, Race.UNDEAD, ]; export const TOTAL_RACES_IN_GAME = 5; export const NON_BUYABLE_MINION_IDS...
CardIds.SpiritRaptor_BG22_HERO_001_Buddy, CardIds.RagingContender_TB_BaconShop_HERO_67_Buddy, CardIds.CaptainFairmount_BG21_HERO_000_Buddy, CardIds.FlightTrainer_BG20_HERO_283_Buddy, CardIds.JandicesApprentice_TB_BaconShop_HERO_71_Buddy, CardIds.CrimsonHandCenturion_TB_BaconShop_HERO_60_Buddy, CardIds.CrazyMonke...
export const NON_DISCOVERABLE_BUDDIES = [
random_line_split
make_final_plot.py
import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib.patches import Rectangle from matplotlib.colors import LinearSegmentedColormap import matplotlib from biaxread import * def load_event_properties(experiment):
def load_blacklist(experiment): """ Load event numbers from the blacklist file for each experiment and return them as an array """ blacklist = np.loadtxt('../Slip_Property_Data/%s_blacklist.txt'%experiment) return blacklist def load_events(experiment): """ Loads all events from a give...
""" Load event property file picks for a given experiment number and return that data as an array """ return np.loadtxt('../Slip_Property_Data/%s_event_properties.txt'%experiment,delimiter=',',skiprows=1)
identifier_body
make_final_plot.py
import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib.patches import Rectangle from matplotlib.colors import LinearSegmentedColormap import matplotlib from biaxread import * def load_event_properties(experiment): """ Load event property file picks for a given experiment number ...
coord1 = transFigure.transform(ax2.transData.transform([50,0])) coord2 = transFigure.transform(ax2.transData.transform([50,-0.3])) line3 = matplotlib.lines.Line2D((coord1[0],coord2[0]),(coord1[1],coord2[1]), transform=fig.transFigure,color='k') coord3 = transFigure.transform(ax3.transDat...
random_line_split
make_final_plot.py
import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib.patches import Rectangle from matplotlib.colors import LinearSegmentedColormap import matplotlib from biaxread import * def
(experiment): """ Load event property file picks for a given experiment number and return that data as an array """ return np.loadtxt('../Slip_Property_Data/%s_event_properties.txt'%experiment,delimiter=',',skiprows=1) def load_blacklist(experiment): """ Load event numbers from the blacklis...
load_event_properties
identifier_name
make_final_plot.py
import numpy as np import matplotlib.pyplot as plt import pandas as pd from matplotlib.patches import Rectangle from matplotlib.colors import LinearSegmentedColormap import matplotlib from biaxread import * def load_event_properties(experiment): """ Load event property file picks for a given experiment number ...
print bin_steps[:,2] return disp_means,amb_means # These are the "Tableau 20" colors as RGB. tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120), (44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150), (148, 103, 189), (197, 176, 213), (140, 86, 75)...
disp_means.append(np.mean(bin_steps[:,0])) amb_means.append(np.mean(bin_steps[:,1])) #amb_means.append(np.median(bin_steps[:,1]))
conditional_block
process.go
// Copyright 2020-2021 Dolthub, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
() { if i.onDone != nil { i.onDone() i.onDone = nil } if i.node != nil { i.Dispose() i.node = nil } } func disposeNode(n sql.Node) { transform.Inspect(n, func(node sql.Node) bool { sql.Dispose(node) return true }) transform.InspectExpressions(n, func(e sql.Expression) bool { sql.Dispose(e) retur...
done
identifier_name
process.go
// Copyright 2020-2021 Dolthub, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
func (p *QueryProcess) IsReadOnly() bool { return p.Child().IsReadOnly() } // WithChildren implements the Node interface. func (p *QueryProcess) WithChildren(children ...sql.Node) (sql.Node, error) { if len(children) != 1 { return nil, sql.ErrInvalidChildrenNumber.New(p, len(children), 1) } return NewQueryProc...
}
random_line_split
process.go
// Copyright 2020-2021 Dolthub, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
// CollationCoercibility implements the interface sql.CollationCoercible. func (p *QueryProcess) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte) { return sql.GetCoercibility(ctx, p.Child()) } func (p *QueryProcess) String() string { return p.Child().String() } func (p *QueryP...
{ return p.Child().CheckPrivileges(ctx, opChecker) }
identifier_body
process.go
// Copyright 2020-2021 Dolthub, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
if i.node != nil { i.Dispose() i.node = nil } } func disposeNode(n sql.Node) { transform.Inspect(n, func(node sql.Node) bool { sql.Dispose(node) return true }) transform.InspectExpressions(n, func(e sql.Expression) bool { sql.Dispose(e) return true }) } func (i *trackedRowIter) Dispose() { if i.no...
{ i.onDone() i.onDone = nil }
conditional_block
peer.go
package fluidbackup import "sync" import "fmt" import "io/ioutil" import "time" import "math/rand" import "strings" import "os" const ( STATUS_ONLINE = 0 STATUS_OFFLINE = 1 ) type PeerId struct { Address string Port int } func (this *PeerId) String() string
func strToPeerId(str string) PeerId { parts := strings.Split(str, ":") return PeerId{ Address: parts[0], Port: strToInt(parts[1]), } } /* * Represents another peer, storing information about * the other peer as necessary, and handling requests/actions * involving that other peer (storeShard, etc.) * *...
{ return fmt.Sprintf("%s:%d", this.Address, this.Port) }
identifier_body
peer.go
package fluidbackup import "sync" import "fmt" import "io/ioutil" import "time" import "math/rand" import "strings" import "os" const ( STATUS_ONLINE = 0 STATUS_OFFLINE = 1 ) type PeerId struct { Address string Port int } func (this *PeerId) String() string { return fmt.Sprintf("%s:%d", this.Address, this....
} } func (this *Peer) getShardPath(label int64) string { // todo: make the store directory automatically return fmt.Sprintf("store/%s_%d.obj", this.id.String(), label) } /* * called on a representation * to say that the peer it represents is trying to * store data on our peer */ func (this *Peer) eventStoreSha...
return false
random_line_split
peer.go
package fluidbackup import "sync" import "fmt" import "io/ioutil" import "time" import "math/rand" import "strings" import "os" const ( STATUS_ONLINE = 0 STATUS_OFFLINE = 1 ) type PeerId struct { Address string Port int } func (this *PeerId) String() string { return fmt.Sprintf("%s:%d", this.Address, this....
this.shardsAccounted[shard.Id] = true result := this.protocol.storeShard(this.id, int64(shard.Id), shard.Contents) if result == 0 { return true } else if result == -2 { // peer actively refused the shard! // probably the agreement is not synchronized or peer terminated agreement go this.terminateAgreemen...
{ // this is bad, blockstore is trying to store a shard that hasn't been reserved yet? Log.Error.Printf("Peer handler %s received unaccounted shard %d!", this.id.String(), shard.Id) return false }
conditional_block
peer.go
package fluidbackup import "sync" import "fmt" import "io/ioutil" import "time" import "math/rand" import "strings" import "os" const ( STATUS_ONLINE = 0 STATUS_OFFLINE = 1 ) type PeerId struct { Address string Port int } func (this *PeerId) String() string { return fmt.Sprintf("%s:%d", this.Address, this....
(localBytes int, remoteBytes int) { this.mu.Lock() this.localBytes += localBytes this.remoteBytes += remoteBytes Log.Debug.Printf("New agreement with %s (%d to %d; total %d/%d to %d/%d)", this.id.String(), localBytes, remoteBytes, this.localUsedBytes, this.localBytes, this.remoteUsedBytes, this.remoteBytes) this.m...
eventAgreement
identifier_name
TelephonyBaseTest.py
#!/usr/bin/env python3.4 # # Copyright 2016 - Google # # 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 appl...
ad.log.info("Enter PUK code and pin") if not ad.droid.telephonySupplyPuk(ad.puk, ad.puk_pin): abort_all_tests( ad.log, "Puk and puk_pin provided in testbed config do NOT work" ) self.skip_re...
abort_all_tests(ad.log, "puk_pin is not provided")
conditional_block
TelephonyBaseTest.py
#!/usr/bin/env python3.4 # # Copyright 2016 - Google # # 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 appl...
# Use for logging in the test cases to facilitate # faster log lookup and reduce ambiguity in logging. @staticmethod def tel_test_wrap(fn): def _safe_wrap_test_case(self, *args, **kwargs): test_id = "%s:%s:%s" % (self.__class__.__name__, self.test_name, ...
"Puk and puk_pin provided in testbed config do NOT work" ) self.skip_reset_between_cases = self.user_params.get( "skip_reset_between_cases", True)
random_line_split
TelephonyBaseTest.py
#!/usr/bin/env python3.4 # # Copyright 2016 - Google # # 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 appl...
def teardown_test(self): return True def on_exception(self, test_name, begin_time): self._pull_diag_logs(test_name, begin_time) self._take_bug_report(test_name, begin_time) self._cleanup_logger_sessions() def on_fail(self, test_name, begin_time): self._pull_diag_l...
if getattr(self, "diag_logger", None): for logger in self.diag_logger: self.log.info("Starting a diagnostic session %s", logger) self.logger_sessions.append((logger, logger.start())) if self.skip_reset_between_cases: ensure_phones_idle(self.log, self.andr...
identifier_body
TelephonyBaseTest.py
#!/usr/bin/env python3.4 # # Copyright 2016 - Google # # 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 appl...
(self, *args, **kwargs): test_id = "%s:%s:%s" % (self.__class__.__name__, self.test_name, self.begin_time.replace(' ', '-')) self.test_id = test_id log_string = "[Test ID] %s" % test_id self.log.info(log_string) try: ...
_safe_wrap_test_case
identifier_name
reader.go
package gospelmaria import ( "context" "database/sql" "errors" "fmt" "strings" "time" "github.com/VividCortex/ewma" "github.com/jmalloc/gospel/src/gospel" "github.com/jmalloc/gospel/src/internal/metrics" "github.com/jmalloc/gospel/src/internal/options" "github.com/jmalloc/twelf/src/twelf" "golang.org/x/ti...
done: make(chan error, 1), ctx: runCtx, cancel: cancel, addr: addr, globalLimit: limit, adaptiveLimit: rate.NewLimiter(rate.Every(accetableLatency), 1), acceptableLatency: accetableLatency, starvationLatency: getStarvationLatency(opts), aver...
r := &Reader{ logger: logger, facts: make(chan gospel.Fact, getReadBufferSize(opts)), end: make(chan struct{}),
random_line_split
reader.go
package gospelmaria import ( "context" "database/sql" "errors" "fmt" "strings" "time" "github.com/VividCortex/ewma" "github.com/jmalloc/gospel/src/gospel" "github.com/jmalloc/gospel/src/internal/metrics" "github.com/jmalloc/gospel/src/internal/options" "github.com/jmalloc/twelf/src/twelf" "golang.org/x/ti...
() (int, error) { rows, err := r.stmt.QueryContext( r.ctx, r.addr.Offset, ) if err != nil { return 0, err } defer rows.Close() f := gospel.Fact{ Addr: r.addr, } count := 0 var first, now time.Time for rows.Next() { if err := rows.Scan( &f.Addr.Offset, &f.Time, &f.Event.EventType, &f....
poll
identifier_name
reader.go
package gospelmaria import ( "context" "database/sql" "errors" "fmt" "strings" "time" "github.com/VividCortex/ewma" "github.com/jmalloc/gospel/src/gospel" "github.com/jmalloc/gospel/src/internal/metrics" "github.com/jmalloc/gospel/src/internal/options" "github.com/jmalloc/twelf/src/twelf" "golang.org/x/ti...
// Next blocks until a fact is available for reading or ctx is canceled. // // If err is nil, the "current" fact is ready to be returned by Get(). // // nx is the offset within the stream that the reader has reached. It can be // used to efficiently resume reading in a future call to EventStore.Open(). // // Note tha...
{ // Note that runCtx is NOT derived from ctx, which is only used for the // opening of the reader itself. runCtx, cancel := context.WithCancel(context.Background()) accetableLatency := getAcceptableLatency(opts) r := &Reader{ logger: logger, facts: make(chan gospel.Fact, getReadBuffer...
identifier_body
reader.go
package gospelmaria import ( "context" "database/sql" "errors" "fmt" "strings" "time" "github.com/VividCortex/ewma" "github.com/jmalloc/gospel/src/gospel" "github.com/jmalloc/gospel/src/internal/metrics" "github.com/jmalloc/gospel/src/internal/options" "github.com/jmalloc/twelf/src/twelf" "golang.org/x/ti...
else if d >= time.Second { return fmt.Sprintf("%6.02fs ", d.Seconds()) } else if d >= time.Millisecond { return fmt.Sprintf("%6.02fms", d.Seconds()/time.Millisecond.Seconds()) } return fmt.Sprintf("%6.02fµs", d.Seconds()/time.Microsecond.Seconds()) }
return fmt.Sprintf("%6.02fm ", d.Seconds()/60) }
conditional_block
CaptureGridView.js
var CaptureGridView = CustomGridView.extend({ className: 'CaptureGridView', columnSelectView: undefined, colPreferences: undefined, collection: undefined, //SimpleDocuments ro: undefined, captureGridItemViews: undefined, editingView: undefined, resizeMe: true, resizeOnDocumentViewRe...
editString += '</div>'; var $dlg; var that = this; var okFunc = function (cleanupFunc) { var $editElements = $dlg.find('.searchColumnEdit input, .searchColumnEdit select'); var value = that.applyColumnEdit(cleanupFunc, selected, columnId, $e...
if (this.captureGridItemViews[i].model === selected[0]) { editString += this.captureGridItemViews[i].getFieldEditObject(columnId, ['']); break; } }
conditional_block
CaptureGridView.js
var CaptureGridView = CustomGridView.extend({ className: 'CaptureGridView', columnSelectView: undefined, colPreferences: undefined, collection: undefined, //SimpleDocuments ro: undefined, captureGridItemViews: undefined, editingView: undefined, resizeMe: true, resizeOnDocumentViewRe...
if (colPreferences[id]) { if (preference[id].width === undefined) { //if width is not specified copy from existing preference. preference[id].width = colPreferences[id].width; } if (preference[id].order === undefined) { ...
//Loop preference adding back values from exising preferences that are not specified while still dropping columns no longer displayed. (no extend). var id; var totWidth = 0; for (id in preference) { if (preference.hasOwnProperty(id)) {
random_line_split
pix2pix_sat_imgs.py
# -*- coding: utf-8 -*- """Copie de pix2pix_sat_imgs.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1gedyO3q39-3CGiaQPvOoKASf5_SQZKjP #Image-to-Image Translation with Conditional Adversarial Nets In this notebook we impleted Pix2Pix by , an ima...
center_height = image.shape[2] // 2 center_width = image.shape[3] // 2 top_left = center_height - round(target_shape[2] / 2) top_right = top_left + target_shape[2] bottom_left = center_width - round(target_shape[3] / 2) bottom_right = bottom_left + target_shape[3] self.new_imag...
return decoded_fm def crop_image(self, image, target_shape):
random_line_split
pix2pix_sat_imgs.py
# -*- coding: utf-8 -*- """Copie de pix2pix_sat_imgs.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1gedyO3q39-3CGiaQPvOoKASf5_SQZKjP #Image-to-Image Translation with Conditional Adversarial Nets In this notebook we impleted Pix2Pix by , an ima...
cur_step += 1
if cur_step > 0: print(f"Epoch {epoch}: Step {cur_step}: Generator (U-Net) loss: {mean_generator_loss}, Discriminator loss: {mean_discriminator_loss}") else: print("Pretrained initial state") plot_images(condition, size=(input_img_channels, target_shape, target_sh...
conditional_block
pix2pix_sat_imgs.py
# -*- coding: utf-8 -*- """Copie de pix2pix_sat_imgs.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1gedyO3q39-3CGiaQPvOoKASf5_SQZKjP #Image-to-Image Translation with Conditional Adversarial Nets In this notebook we impleted Pix2Pix by , an ima...
(self, input_fm): out = self.conv_layer1(input_fm) if self.use_bn: out = self.bn(out) if self.use_dropout: out = self.dropout(out) out = self.act_function(out) out = self.conv_layer2(out) if self.use_bn: out = self.bn(out) if se...
forward
identifier_name
pix2pix_sat_imgs.py
# -*- coding: utf-8 -*- """Copie de pix2pix_sat_imgs.ipynb Automatically generated by Colaboratory. Original file is located at https://colab.research.google.com/drive/1gedyO3q39-3CGiaQPvOoKASf5_SQZKjP #Image-to-Image Translation with Conditional Adversarial Nets In this notebook we impleted Pix2Pix by , an ima...
def forward(self, input_fm): out = self.conv_layer1(input_fm) if self.use_bn: out = self.bn(out) if self.use_dropout: out = self.dropout(out) out = self.act_function(out) out = self.conv_layer2(out) if self.use_bn: out = self.bn(o...
super(EncoderUnit, self).__init__() self.conv_layer1 = nn.Conv2d(input_channels, input_channels * 2,kernel_size=3,padding=1) self.conv_layer2 = nn.Conv2d(input_channels * 2, input_channels * 2, kernel_size=3, padding=1) self.act_function= nn.LeakyReLU(0.2) self.pooling_layer = nn.MaxPool...
identifier_body
exec.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
/// /// This overrides whatever was previously set via the `nfa` or /// `bounded_backtracking` methods. pub fn automatic(mut self) -> Self { self.match_type = None; self } /// Sets the matching engine to use the NFA algorithm no matter what /// optimizations are possible. ...
random_line_split
exec.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
<'c>(ExecNoSync<'c>); /// `ExecReadOnly` comprises all read only state for a regex. Namely, all such /// state is determined at compile time and never changes during search. #[derive(Debug)] struct ExecReadOnly { /// The original regular expressions given by the caller to compile. res: Vec<String>, /// A c...
ExecNoSyncStr
identifier_name
exec.rs
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
#[inline(always)] // reduces constant overhead fn is_match_at(&self, text: &str, start: usize) -> bool { self.0.is_match_at(text.as_bytes(), start) } #[inline(always)] // reduces constant overhead fn find_at(&self, text: &str, start: usize) -> Option<(usize, usize)> { self.0.find_...
{ self.0.shortest_match_at(text.as_bytes(), start) }
identifier_body
blob_store.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
#[test] fn blobid_identity() { fn prop(name: Vec<u8>, begin: uint, end: uint) -> bool { let blob_id = BlobID{name: name.into_vec(), begin: begin, end: end}; BlobID::from_bytes(blob_id.as_bytes()) == blob_id } qcheck(prop); } }
{ fn prop(chunks: Vec<Vec<u8>>) -> bool { let mut backend = MemoryBackend::new(); let local_backend = backend.clone(); let bsP: BlobStoreProcess<MemoryBackend> = Process::new(proc() { BlobStore::new_for_testing(local_backend, 1024) }); let mut ids = Vec::new(); for chunk in c...
identifier_body
blob_store.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
() -> blob_index::BlobDesc { blob_index::BlobDesc{name: b"".into_vec(), id: 0} } impl <B: BlobStoreBackend> BlobStore<B> { pub fn new(index: BlobIndexProcess, backend: B, max_blob_size: uint) -> BlobStore<B> { let mut bs = BlobStore{ backend: backend, blob_index: index, blob_de...
empty_blob_desc
identifier_name
blob_store.rs
// Copyright 2014 Google Inc. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable...
}, None => break, } } self.blob_index.send_reply(blob_index::InAir(old_blob_desc.clone())); self.backend_store(old_blob_desc.name.as_slice(), blob.as_slice()); self.blob_index.send_reply(blob_index::CommitDone(old_blob_desc)); // Go through callbacks for (blobid, cb) in r...
blob.push_all(chunk.as_slice());
random_line_split
input_loop.go
// // Copyright © 2018 Aljabr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
else if err != nil { il.log.Error().Err(err).Msg("Failed to execute task") } }() } else if il.spec.HasLaunchPolicyCustom() { // Custom launch policy; Make snapshot available to snapshot service if err := il.snapshotService.Execute(ctx, snapshot); ctx.Err() != nil { return ctx.Err() } ...
// Context canceled, ignore }
conditional_block
input_loop.go
// // Copyright © 2018 Aljabr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
// processExecQueue pulls snapshots from the exec queue and: // - executes them in case of tasks with auto launch policy or // - allows the executor to pull the snapshot in case of tasks with custom launch policy. func (il *inputLoop) processExecQueue(ctx context.Context) error { var lastCancel context.CancelFunc fo...
defer close(il.execQueue) g, lctx := errgroup.WithContext(ctx) if len(il.spec.Inputs) > 0 { // Watch inputs for _, tis := range il.spec.Inputs { tis := tis // Bring in scope stats := il.statistics.InputByName(tis.Name) g.Go(func() error { return il.watchInput(lctx, il.spec.SnapshotPolicy, tis, stat...
identifier_body
input_loop.go
// // Copyright © 2018 Aljabr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
// Run the input loop until the given context is canceled. func (il *inputLoop) Run(ctx context.Context) error { defer close(il.execQueue) g, lctx := errgroup.WithContext(ctx) if len(il.spec.Inputs) > 0 { // Watch inputs for _, tis := range il.spec.Inputs { tis := tis // Bring in scope stats := il.statisti...
}, nil }
random_line_split
input_loop.go
// // Copyright © 2018 Aljabr, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
ctx context.Context, snapshot *InputSnapshot) error { // Update statistics atomic.AddInt64(&il.statistics.SnapshotsWaiting, -1) atomic.AddInt64(&il.statistics.SnapshotsInProgress, 1) snapshot.AddInProgressStatistics(1) // Update statistics on return defer func() { snapshot.AddInProgressStatistics(-1) snapsho...
xecOnSnapshot(
identifier_name
Confess.js
import React, { Component } from 'react'; import { Container, Icon, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import Tetzel from '../build/contracts/Tetzel.json'; import TetzelCrowdsale from '../build/contracts/TetzelCrowdsale.json'; import TermsAndConditionsModal from './components/Ter...
changeActiveView(nextView) { const validViews = ['CONFESS_SIN', 'VALUE_SIN', 'PURCHASE_SIN', 'FORGIVENESS']; if (validViews.indexOf(nextView) === -1) { throw new Error('Invalid view'); } // Validating sin text input shouldn't have to occur here, but it does // with the way this is currently...
random_line_split
Confess.js
import React, { Component } from 'react'; import { Container, Icon, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import Tetzel from '../build/contracts/Tetzel.json'; import TetzelCrowdsale from '../build/contracts/TetzelCrowdsale.json'; import TermsAndConditionsModal from './components/Ter...
handleInvalidSinText() { this.setState({errorMsg: 'Please confess before moving on.'}); } updateTestSinValues(idx, val) { var newTestSinValues = this.state.testSinValues.slice(); newTestSinValues[idx] = val; this.setState({testSinValues: newTestSinValues}); } updateSinRecipient(val) { ...
{ return this.state.sinText.length > 0; }
identifier_body
Confess.js
import React, { Component } from 'react'; import { Container, Icon, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import Tetzel from '../build/contracts/Tetzel.json'; import TetzelCrowdsale from '../build/contracts/TetzelCrowdsale.json'; import TermsAndConditionsModal from './components/Ter...
() { const showActiveView = () => { switch(this.state.activeView) { case 'CONFESS_SIN': return ( <ConfessSin errorMsg={ this.state.errorMsg } sinText={ this.state.sinText } updateSinText={ this.updateSinText.bind(this) } on...
render
identifier_name
mod.rs
#![warn(missing_docs)] //! Contains all data structures and method to work with model resources. //! //! Model is an isolated scene that is used to create copies of its data - this //! process is known as `instantiation`. Isolation in this context means that //! such scene cannot be modified, rendered, etc. It just a ...
/// A set of options that will be applied to a model resource when loading it from external source. /// /// # Details /// /// The engine has a convenient way of storing import options in a `.options` files. For example you may /// have a `foo.fbx` 3d model, to change import options create a new file with additional `.o...
Self::MaterialsDirectory(path.as_ref().to_path_buf()) } }
random_line_split
mod.rs
#![warn(missing_docs)] //! Contains all data structures and method to work with model resources. //! //! Model is an isolated scene that is used to create copies of its data - this //! process is known as `instantiation`. Isolation in this context means that //! such scene cannot be modified, rendered, etc. It just a ...
ModelLoadError::NotSupported(v) => { write!(f, "Model format is not supported: {v}") } ModelLoadError::Fbx(v) => v.fmt(f), } } } impl From<FbxError> for ModelLoadError { fn from(fbx: FbxError) -> Self { ModelLoadError::Fbx(fbx) } } impl ...
{ write!(f, "An error occurred while reading a data source {v:?}") }
conditional_block